feat(ai): Phase 2A-3 随访页 AI 辅助生成小结 — SSE 端点 + 前端集成

- AnalysisType 新增 FollowUpSummary 变体(as_str/prompt_name)
- HealthDataProvider 新增 get_follow_up_summary_data() + FollowUpSummaryDataDto
- erp-health 实现随访数据查询(task + records + PII 解密)
- 新增 /ai/analyze/follow-up-summary SSE 端点
- SanitizationService 新增 sanitize_follow_up_data()
- 前端 analysisSse.ts/AiAnalysisCard 支持 follow-up-summary 类型
- FollowUpTaskList 操作列新增「AI 小结」按钮
This commit is contained in:
iven
2026-05-19 00:54:15 +08:00
parent 205f6fb5a2
commit 2660f1afff
10 changed files with 223 additions and 13 deletions

View File

@@ -19,6 +19,7 @@ pub enum AnalysisType {
Trends,
CheckupPlan,
ReportSummary,
FollowUpSummary,
}
impl AnalysisType {
@@ -28,6 +29,7 @@ impl AnalysisType {
Self::Trends => "trend",
Self::CheckupPlan => "checkup_plan",
Self::ReportSummary => "report_summary",
Self::FollowUpSummary => "follow_up_summary",
}
}
@@ -37,6 +39,7 @@ impl AnalysisType {
Self::Trends => "health_trend_analysis",
Self::CheckupPlan => "personalized_checkup_plan",
Self::ReportSummary => "report_summary_generation",
Self::FollowUpSummary => "follow_up_summary_generation",
}
}
}
@@ -161,6 +164,7 @@ mod tests {
assert_eq!(AnalysisType::Trends.as_str(), "trend");
assert_eq!(AnalysisType::CheckupPlan.as_str(), "checkup_plan");
assert_eq!(AnalysisType::ReportSummary.as_str(), "report_summary");
assert_eq!(AnalysisType::FollowUpSummary.as_str(), "follow_up_summary");
}
// ---- AnalysisType::prompt_name ----
@@ -180,6 +184,10 @@ mod tests {
AnalysisType::ReportSummary.prompt_name(),
"report_summary_generation"
);
assert_eq!(
AnalysisType::FollowUpSummary.prompt_name(),
"follow_up_summary_generation"
);
}
// ---- AnalysisType serde round-trip ----
@@ -191,6 +199,7 @@ mod tests {
AnalysisType::Trends,
AnalysisType::CheckupPlan,
AnalysisType::ReportSummary,
AnalysisType::FollowUpSummary,
];
for t in types {
let json = serde_json::to_string(&t).unwrap();