feat(health): 事件驱动集成 + 数据一致性修复 + 逾期随访检查

- event.rs 重写为有状态处理器(订阅 workflow.task.completed / message.sent)
- module.rs on_startup 初始化 HealthCrypto 并注册事件处理器
- consultation_service 消息发送改为事务包裹(INSERT + CAS 原子更新)
- appointment_service 取消预约释放排班名额增加下限保护
- appointment_service update_schedule 增加 max_appointments >= current_appointments 校验
- follow_up_service 新增 complete_task_by_system 和 check_overdue_tasks
- validation.rs 随访状态机增加 overdue 状态支持
- main.rs 启动时运行逾期随访检查后台任务
This commit is contained in:
iven
2026-04-25 00:30:32 +08:00
parent 6c70e2a783
commit 43e127d4f7
7 changed files with 202 additions and 35 deletions

View File

@@ -389,6 +389,10 @@ async fn main() -> anyhow::Result<()> {
erp_workflow::WorkflowModule::start_timeout_checker(db.clone());
tracing::info!("Timeout checker started");
// Start follow-up overdue checker (every 6 hours)
erp_health::HealthModule::start_overdue_checker(db.clone());
tracing::info!("Follow-up overdue checker started");
let host = config.server.host.clone();
let port = config.server.port;