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

@@ -92,6 +92,15 @@ pub enum HealthError {
#[error("护理计划预后不存在")]
CarePlanOutcomeNotFound,
#[error("班次不存在")]
ShiftNotFound,
#[error("患者分配不存在")]
PatientAssignmentNotFound,
#[error("交接记录不存在")]
HandoffLogNotFound,
#[error("状态转换无效: {0}")]
InvalidStatusTransition(String),
@@ -133,7 +142,10 @@ impl From<HealthError> for AppError {
| HealthError::MedicationReminderNotFound
| HealthError::CarePlanNotFound
| HealthError::CarePlanItemNotFound
| HealthError::CarePlanOutcomeNotFound => AppError::NotFound(err.to_string()),
| HealthError::CarePlanOutcomeNotFound
| HealthError::ShiftNotFound
| HealthError::PatientAssignmentNotFound
| HealthError::HandoffLogNotFound => AppError::NotFound(err.to_string()),
HealthError::ScheduleFull => AppError::Validation(err.to_string()),
HealthError::InvalidStatusTransition(s) => AppError::Validation(s),
HealthError::VersionMismatch => AppError::VersionMismatch,