feat(ai): Phase 2A-4 新增 3 个 Agent Tool — 化验报告/预约/用药查询

新增 3 个 AI Agent Tool 扩展医护沙箱能力:
- query_patient_lab_reports: 查询患者化验报告列表(含异常计数)
- query_patient_appointments: 查询患者即将到来的预约
- query_patient_medications: 查询患者当前用药列表

同时:
- HealthDataProvider trait 新增 get_patient_lab_reports 方法 + LabReportListItemDto
- erp-health 实现新 trait 方法(含 PII 解密)
- sandbox.rs 更新角色权限:Patient 可查体征/化验/用药,MedicalStaff 额外可查预约
- 修复 ai_prompt_tests.rs 中 AnalysisService::new 签名变更的遗留编译错误
- 新增 5 个 agent 测试覆盖新 Tool 和沙箱权限过滤
This commit is contained in:
iven
2026-05-19 00:19:10 +08:00
parent 89581b070f
commit b2053d5bcc
10 changed files with 401 additions and 12 deletions

View File

@@ -53,6 +53,14 @@ pub trait HealthDataProvider: Send + Sync {
tenant_id: Uuid,
patient_id: Uuid,
) -> AppResult<Vec<MedicationSummaryDto>>;
/// 获取患者化验报告列表(简要摘要,不含指标明细)
async fn get_patient_lab_reports(
&self,
tenant_id: Uuid,
patient_id: Uuid,
limit: u64,
) -> AppResult<Vec<LabReportListItemDto>>;
}
// === DTO 定义 ===
@@ -184,3 +192,11 @@ pub struct MedicationSummaryDto {
pub dosage: String,
pub frequency: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LabReportListItemDto {
pub id: Uuid,
pub report_type: String,
pub report_date: String,
pub abnormal_count: usize,
}