feat(health): 随访模板系统 — follow_up_template + template_field 全栈
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

新增随访模板和模板字段两张表及完整 CRUD:
- 迁移 083: follow_up_template + follow_up_template_field
- Entity: 模板(名称/类型/适用范围/状态) + 字段(标签/键名/类型/选项/校验)
- DTO: 创建时内嵌字段列表、更新支持全量替换字段
- Service: 随访类型+字段类型校验、级联软删除
- Handler: 5 端点 + RBAC 权限
- 路由: /api/v1/health/follow-up-templates
This commit is contained in:
iven
2026-04-27 14:40:28 +08:00
parent ca96310a84
commit dc5879228e
13 changed files with 869 additions and 2 deletions

View File

@@ -77,6 +77,9 @@ pub enum HealthError {
#[error("透析方案不存在")]
DialysisPrescriptionNotFound,
#[error("随访模板不存在")]
FollowUpTemplateNotFound,
#[error("状态转换无效: {0}")]
InvalidStatusTransition(String),
@@ -113,7 +116,8 @@ impl From<HealthError> for AppError {
| HealthError::ConsentNotFound
| HealthError::AlertRuleNotFound
| HealthError::AlertNotFound
| HealthError::DialysisPrescriptionNotFound => AppError::NotFound(err.to_string()),
| HealthError::DialysisPrescriptionNotFound
| HealthError::FollowUpTemplateNotFound => AppError::NotFound(err.to_string()),
HealthError::ScheduleFull => AppError::Validation(err.to_string()),
HealthError::InvalidStatusTransition(s) => AppError::Validation(s),
HealthError::VersionMismatch => AppError::VersionMismatch,