feat(health): 班次管理与护士分配 — Shift/PatientAssignment/HandoffLog CRUD
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

- 新增 3 张数据表迁移 (shifts, patient_assignments, shift_handoff_log)
- 3 个 SeaORM Entity (shift, patient_assignment, handoff_log)
- 完整 CRUD 服务层:班次管理、患者分配(含批量分配)、交接记录
- 12 个 API 端点 + health.shifts.list/manage 权限
- 班次列表含患者分配摘要 (patient_count/critical_count/attention_count)
- 乐观锁、软删除、审计日志、事件发布
- 输入验证:period/shift_status/care_level 白名单
This commit is contained in:
iven
2026-05-04 20:11:07 +08:00
parent 3ff17382ff
commit 7b17f94bc0
14 changed files with 1554 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ use crate::handler::{
action_inbox_handler,
alert_handler, alert_rule_handler,
appointment_handler, article_category_handler, article_handler, article_tag_handler, care_plan_handler, consultation_handler, consent_handler, critical_alert_handler, critical_value_threshold_handler, daily_monitoring_handler, device_handler, device_reading_handler, diagnosis_handler, doctor_handler, follow_up_handler, follow_up_template_handler,
health_data_handler, medication_record_handler, medication_reminder_handler, patient_handler, points_handler, stats_handler,
health_data_handler, medication_record_handler, medication_reminder_handler, patient_handler, points_handler, shift_handler, stats_handler,
vital_signs_daily_handler,
};
@@ -852,6 +852,38 @@ impl HealthModule {
axum::routing::put(care_plan_handler::update_care_plan_outcome)
.delete(care_plan_handler::delete_care_plan_outcome),
)
// 班次管理
.route(
"/health/shifts",
axum::routing::get(shift_handler::list_shifts)
.post(shift_handler::create_shift),
)
.route(
"/health/shifts/{shift_id}",
axum::routing::get(shift_handler::get_shift)
.put(shift_handler::update_shift)
.delete(shift_handler::delete_shift),
)
.route(
"/health/shifts/{shift_id}/assignments",
axum::routing::get(shift_handler::list_assignments)
.post(shift_handler::create_assignment),
)
.route(
"/health/shifts/{shift_id}/assignments/batch",
axum::routing::post(shift_handler::batch_assign),
)
.route(
"/health/shifts/{shift_id}/assignments/{assignment_id}",
axum::routing::put(shift_handler::update_assignment)
.delete(shift_handler::delete_assignment),
)
// 交接记录
.route(
"/health/handoff-logs",
axum::routing::get(shift_handler::list_handoffs)
.post(shift_handler::create_handoff),
)
}
}
@@ -1285,6 +1317,19 @@ impl ErpModule for HealthModule {
description: "创建/编辑/删除护理计划、条目和预后测量".into(),
module: "health".into(),
},
// 班次管理
PermissionDescriptor {
code: "health.shifts.list".into(),
name: "查看班次".into(),
description: "查看班次列表、患者分配和交接记录".into(),
module: "health".into(),
},
PermissionDescriptor {
code: "health.shifts.manage".into(),
name: "管理班次".into(),
description: "创建/编辑班次、分配患者、创建交接记录".into(),
module: "health".into(),
},
]
}