feat(web): Phase 2A-2 患者档案 AI 自动摘要 — 侧边栏顶部摘要卡片
当 AI 侧边栏打开且当前页面为患者详情时,自动调用 GET /ai/health-summary 并在侧边栏顶部显示摘要卡片: - 风险等级标签(低/中/高/严重,对应绿/橙/红/深红) - 活跃洞察数量 + 近期分析次数 - 最多 3 条摘要项(按 category + severity 着色) - 最新洞察标题(带警告图标) - 离开患者页面或关闭侧边栏时自动清除 同时: - analysis.ts 新增 getHealthSummary API + HealthSummaryResponse 类型 - 权限检查:需要 ai.analysis.list 才显示摘要卡片
This commit is contained in:
@@ -16,6 +16,21 @@ export interface AnalysisItem {
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface HealthSummaryResponse {
|
||||
patient_id: string;
|
||||
risk_level: 'low' | 'medium' | 'high' | 'critical';
|
||||
active_insights_count: number;
|
||||
recent_analyses_count: number;
|
||||
latest_insight_title: string | null;
|
||||
latest_analysis_type: string | null;
|
||||
summary_items: Array<{
|
||||
category: string;
|
||||
title: string;
|
||||
severity: string | null;
|
||||
created_at: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export const analysisApi = {
|
||||
list: async (params?: { patient_id?: string; analysis_type?: string; page?: number; page_size?: number }) => {
|
||||
const resp = await client.get('/ai/analysis/history', { params });
|
||||
@@ -25,4 +40,8 @@ export const analysisApi = {
|
||||
const resp = await client.get(`/ai/analysis/${id}`);
|
||||
return resp.data.data as AnalysisItem;
|
||||
},
|
||||
getHealthSummary: async (patientId: string) => {
|
||||
const resp = await client.get('/ai/health-summary', { params: { patient_id: patientId } });
|
||||
return resp.data.data as HealthSummaryResponse;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user