feat(ai): 实现 AI 数据桥接 — 4 个 HealthDataProvider 方法从 stub 替换为真实查询
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled

- get_lab_report: 查询 lab_report + patient,解析 JSON items 构造 LabReportDto
- get_vital_signs: 查询 vital_signs 时间序列,按指标提取 8 种体征数据
- get_patient_summary: 聚合 patient + diagnosis + medication_record + health_record
- get_full_report: 查询 health_record + 关联诊断和化验报告构造章节
- AiState 新增 health_provider 字段,erp-server 注入 HealthDataProviderImpl
- 4 个 SSE handler 从 placeholder JSON 改为调用 provider + sanitizer 真实数据流
This commit is contained in:
iven
2026-04-28 19:08:38 +08:00
parent ace04ee56d
commit 0aab27295c
4 changed files with 419 additions and 77 deletions

View File

@@ -467,12 +467,16 @@ async fn main() -> anyhow::Result<()> {
);
let prompt = std::sync::Arc::new(erp_ai::service::prompt::PromptService::new(db.clone()));
let usage = std::sync::Arc::new(erp_ai::service::usage::UsageService::new(db.clone()));
let health_provider = std::sync::Arc::new(erp_health::HealthDataProviderImpl {
db: db.clone(),
});
erp_ai::AiState {
db: db.clone(),
event_bus: event_bus.clone(),
analysis,
prompt,
usage,
health_provider,
}
};