fix: 全面修复 - 实时通讯、报告AI流程、健康概览、用药运动提醒
- SignalR Hub消息持久化+防重复+跨端广播 - 报告VLM+LLM真实AI流程(验证→提取→解读) - 医生审核页重构(严重程度/建议模板/综合评语) - 健康概览五合一趋势图(fl_chart+指标切换) - 用药提醒时区修复+跨午夜+过期提醒 - 运动打卡DayOfWeek映射修复+计划覆盖查询 - 体重与其他四指标同级(Abnormal检查/确认卡牌) - AI Agent支持多种类多时段批量录入 - 删除硬编码假数据(张三/假医生/假AI解读) - 随访/报告审核数据链路全部打通
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using Health.WebApi.Hubs;
|
||||
|
||||
namespace Health.WebApi.Endpoints;
|
||||
|
||||
public static class ConsultationEndpoints
|
||||
@@ -43,12 +45,32 @@ public static class ConsultationEndpoints
|
||||
return Results.Ok(new { code = 0, data = messages, message = (string?)null });
|
||||
});
|
||||
|
||||
group.MapPost("/consultations/{id:guid}/messages", async (Guid id, SendMessageRequest req, HttpContext http, AppDbContext db, CancellationToken ct) =>
|
||||
group.MapPost("/consultations/{id:guid}/messages", async (Guid id, SendMessageRequest req, HttpContext http, AppDbContext db, IHubContext<Hubs.ConsultationHub> hubContext, CancellationToken ct) =>
|
||||
{
|
||||
var userId = GetUserId(http);
|
||||
var msg = new ConsultationMessage { Id = Guid.NewGuid(), ConsultationId = id, SenderType = ConsultationSenderType.User, Content = req.Content, SenderName = null, CreatedAt = DateTime.UtcNow };
|
||||
db.ConsultationMessages.Add(msg);
|
||||
|
||||
// 用户发消息后,状态从 AiTalking → WaitingDoctor
|
||||
var consultation = await db.Consultations.FirstOrDefaultAsync(c => c.Id == id, ct);
|
||||
if (consultation != null && consultation.Status == ConsultationStatus.AiTalking)
|
||||
{
|
||||
consultation.Status = ConsultationStatus.WaitingDoctor;
|
||||
}
|
||||
|
||||
await db.SaveChangesAsync(ct);
|
||||
|
||||
// 通过 SignalR 广播给问诊房间(医生端实时接收)
|
||||
await hubContext.Clients.Group(id.ToString()).SendAsync("ReceiveMessage", new
|
||||
{
|
||||
msg.Id,
|
||||
consultationId = id.ToString(),
|
||||
senderType = "User",
|
||||
senderName = (string?)null,
|
||||
content = req.Content,
|
||||
msg.CreatedAt
|
||||
});
|
||||
|
||||
return Results.Ok(new { code = 0, data = new { msg.Id }, message = (string?)null });
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user