feat(ai): 定期自动分析定时任务 — 每 24 小时扫描高风险患者
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

新增 auto_analysis.rs 服务:
- 启动后延迟 5 分钟,每 24 小时执行一次
- 查找所有活跃租户中高风险患者(异常体征指标)
- 自动调用趋势分析并存储分析结果
- 每租户限制 50 名患者,防止过载
- erp-server main.rs 中注册后台任务
This commit is contained in:
iven
2026-04-28 20:02:01 +08:00
parent 493b479373
commit a84378ab50
3 changed files with 289 additions and 0 deletions

View File

@@ -480,6 +480,10 @@ async fn main() -> anyhow::Result<()> {
}
};
// Start auto trend analysis (every 24h, scans high-risk patients)
erp_ai::service::auto_analysis::start_auto_analysis(ai_state.clone());
tracing::info!("Auto trend analysis scheduler started");
// Build shared state
let pii_crypto = if config.crypto.kek == "__MUST_SET_VIA_ENV__" {
#[cfg(debug_assertions)]