fix: 全面修复 - 实时通讯、报告AI流程、健康概览、用药运动提醒
- SignalR Hub消息持久化+防重复+跨端广播 - 报告VLM+LLM真实AI流程(验证→提取→解读) - 医生审核页重构(严重程度/建议模板/综合评语) - 健康概览五合一趋势图(fl_chart+指标切换) - 用药提醒时区修复+跨午夜+过期提醒 - 运动打卡DayOfWeek映射修复+计划覆盖查询 - 体重与其他四指标同级(Abnormal检查/确认卡牌) - AI Agent支持多种类多时段批量录入 - 删除硬编码假数据(张三/假医生/假AI解读) - 随访/报告审核数据链路全部打通
This commit is contained in:
@@ -402,27 +402,39 @@ public static class AiChatEndpoints
|
||||
|
||||
private static void _UpdateMessageTypeAndMetadata(string toolName, object toolResult, ref string messageType, ref Dictionary<string, object> metadata)
|
||||
{
|
||||
// 将匿名对象统一转成 Dictionary(toolResult 可能是匿名类型,不是 IDictionary)
|
||||
var resultDict = toolResult as IDictionary<string, object>;
|
||||
if (resultDict == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var json = JsonSerializer.Serialize(toolResult, JsonOpts);
|
||||
resultDict = JsonSerializer.Deserialize<Dictionary<string, object>>(json, JsonOpts);
|
||||
}
|
||||
catch { resultDict = new Dictionary<string, object>(); }
|
||||
}
|
||||
|
||||
switch (toolName)
|
||||
{
|
||||
case "record_health_data":
|
||||
messageType = "data_confirm";
|
||||
if (toolResult is IDictionary<string, object> resultDict)
|
||||
if (resultDict != null)
|
||||
{
|
||||
if (resultDict.TryGetValue("type", out var type)) metadata["type"] = type.ToString();
|
||||
if (resultDict.TryGetValue("value", out var val)) metadata["value"] = val.ToString();
|
||||
if (resultDict.TryGetValue("unit", out var unit)) metadata["unit"] = unit.ToString();
|
||||
if (resultDict.TryGetValue("isAbnormal", out var abn) && abn is bool b2) metadata["abnormal"] = b2;
|
||||
if (resultDict.TryGetValue("success", out var success) && success is bool b && b)
|
||||
metadata["success"] = true;
|
||||
if (resultDict.TryGetValue("isAbnormal", out var abn)) metadata["abnormal"] = abn is bool b2 ? b2 : false;
|
||||
if (resultDict.TryGetValue("success", out var success)) metadata["success"] = success is bool b && b;
|
||||
metadata["recordTime"] = DateTime.UtcNow.AddHours(8).ToString("MM月dd日 HH:mm");
|
||||
}
|
||||
break;
|
||||
case "manage_medication":
|
||||
messageType = "medication_confirm";
|
||||
if (toolResult is IDictionary<string, object> medDict)
|
||||
if (resultDict != null)
|
||||
{
|
||||
if (medDict.TryGetValue("name", out var name))
|
||||
if (resultDict.TryGetValue("name", out var name))
|
||||
metadata["name"] = name.ToString();
|
||||
if (medDict.TryGetValue("dosage", out var dosage))
|
||||
if (resultDict.TryGetValue("dosage", out var dosage))
|
||||
metadata["dosage"] = dosage.ToString();
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user