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

@@ -61,6 +61,13 @@ pub trait HealthDataProvider: Send + Sync {
patient_id: Uuid,
limit: u64,
) -> AppResult<Vec<LabReportListItemDto>>;
/// 获取随访摘要数据(任务 + 已有记录,用于 AI 生成小结)
async fn get_follow_up_summary_data(
&self,
tenant_id: Uuid,
task_id: Uuid,
) -> AppResult<FollowUpSummaryDataDto>;
}
// === DTO 定义 ===
@@ -200,3 +207,22 @@ pub struct LabReportListItemDto {
pub report_date: String,
pub abnormal_count: usize,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FollowUpSummaryDataDto {
pub task_id: Uuid,
pub patient_id: Uuid,
pub follow_up_type: String,
pub planned_date: String,
pub task_status: String,
pub records: Vec<FollowUpRecordDto>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FollowUpRecordDto {
pub executed_date: String,
pub result: String,
pub patient_condition: Option<String>,
pub medical_advice: Option<String>,
pub next_follow_up_date: Option<String>,
}