fix: consultation notifications, profile edit hint, doctor report in Chinese, chat UI polish, tabbar badge

This commit is contained in:
MingNian
2026-05-21 15:40:17 +08:00
parent 3ef25e734f
commit 204bc19ce5
6 changed files with 180 additions and 120 deletions

View File

@@ -59,6 +59,30 @@ public class ConsultationService(AppDbContext db)
ImageUrl = imageUrl,
};
db.ConsultationMessages.Add(message);
// Create notification for the recipient
var consultation = await db.Consultations
.Include(c => c.Patient)
.Include(c => c.Doctor)
.FirstOrDefaultAsync(c => c.Id == consultationId);
if (consultation != null)
{
var targetUserId = senderRole == "patient" ? consultation.DoctorId : consultation.PatientId;
var senderName = senderRole == "patient" ? consultation.Patient?.Name : consultation.Doctor?.Name;
var notifyTitle = senderRole == "patient" ? "新患者消息" : "医生已回复";
var notifyContent = $"{senderName ?? ""}{TruncateContent(content)}";
db.Notifications.Add(new Notification
{
UserId = targetUserId,
Type = "consultation",
Title = notifyTitle,
Content = notifyContent,
RelatedId = consultationId,
});
}
await db.SaveChangesAsync();
return message;
}
@@ -70,4 +94,7 @@ public class ConsultationService(AppDbContext db)
query = query.Where(u => u.Department == department);
return await query.ToListAsync();
}
private static string TruncateContent(string content) =>
content.Length > 50 ? content[..50] + "..." : content;
}