- 从 HMS 基座复制 apps/web/ (React + Ant Design + Vite + TypeScript) - 管理端自动代理 API 到 localhost:3000 (vite.config.ts) - 更新 scripts/dev.sh 支持三端启动: backend/admin/app - 登录验证通过, 用户管理/角色权限/审计日志等页面正常 - 添加 .gitignore 排除 node_modules/dist
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import client from '../client';
|
|
import type { PaginatedResponse } from '../types';
|
|
|
|
export interface AnalysisItem {
|
|
id: string;
|
|
patient_id: string;
|
|
patient_name?: string;
|
|
analysis_type: string;
|
|
source_ref: string;
|
|
model_used: string;
|
|
status: string;
|
|
result_content: string | null;
|
|
result_metadata: Record<string, unknown> | null;
|
|
error_message: string | null;
|
|
created_at: string;
|
|
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 });
|
|
return resp.data.data as PaginatedResponse<AnalysisItem>;
|
|
},
|
|
get: async (id: string) => {
|
|
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;
|
|
},
|
|
};
|