feat(health): 药物提醒后端 API + 后台任务统一 + dead code 清理
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

P1-3: medication_reminder 全栈实现
  - migration 000096: 创建 medication_reminder 表(含患者关联/提醒时间/频率)
  - entity + dto + service + handler: 完整 CRUD(乐观锁/软删除/审计日志)
  - 路由注册: GET /patients/{id}/medication-reminders, POST/PUT/DELETE
  - HealthError 新增 MedicationReminderNotFound

P2-4: 后台任务启动统一
  - appointment_reminder 迁移到 HealthModule::on_startup()(启动时立即执行 + 周期循环)
  - 删除 main.rs 中重复的 overdue_checker/points_expiration/appointment_reminder 调用
  - 所有 Health 后台任务现由模块 on_startup 统一管理

P2-5: Web dead code 清理
  - 删除 healthData.ts 中 getMiniTrend/getMiniToday(小程序专用端点,Web 无调用)
  - 删除 patients.ts 中 getHealthSummary(标记 TODO 未使用)
This commit is contained in:
iven
2026-04-30 07:18:22 +08:00
parent 30344d474f
commit 26a9781d4f
15 changed files with 529 additions and 39 deletions

View File

@@ -435,17 +435,7 @@ async fn main() -> anyhow::Result<()> {
erp_workflow::WorkflowModule::start_timeout_checker(db.clone(), event_bus.clone());
tracing::info!("Timeout checker started");
// Start follow-up overdue checker (every 6h)
erp_health::HealthModule::start_overdue_checker(db.clone());
tracing::info!("Follow-up overdue checker started");
// Start points expiration checker (every 24h)
erp_health::HealthModule::start_points_expiration_checker(db.clone(), event_bus.clone());
tracing::info!("Points expiration checker started");
// Start appointment reminder scheduler (every 1h)
erp_health::HealthModule::start_appointment_reminder(db.clone(), event_bus.clone());
tracing::info!("Appointment reminder scheduler started");
// Health 模块后台任务已统一在 HealthModule::on_startup() 中启动
let host = config.server.host.clone();
let port = config.server.port;