feat(health): 家庭成员健康代理 — 同意追踪 + 健康摘要查看
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

Phase 1 Care Engine MVP 最后一项 (#8):
- 迁移: patient_family_member 表新增 user_id/consent_status/access_level/consented_at/consent_revoked_at
- 实体: 更新 patient_family_member Model 含新字段
- DTO: FamilyMemberResp 扩展 + 新增 GrantFamilyAccessReq/FamilyPatientSummaryResp/FamilyHealthSummaryResp
- Service: 授权/撤销访问、家庭成员查看关联患者列表、查看健康摘要(按 access_level 分级)
- Handler: 5 个端点(grant/revoke/list/summary/link-user)
- 路由: /health/patients/{id}/family-members/{fid}/grant-access 等
- 权限: health.family-proxy.list/manage
- 已有 CRUD 适配新字段(list/create/update 返回 consent 状态)
This commit is contained in:
iven
2026-05-04 20:57:24 +08:00
parent 0a9272bcf6
commit 95fa09c383
11 changed files with 675 additions and 1 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,
ble_gateway_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,
ble_gateway_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, family_proxy_handler, follow_up_handler, follow_up_template_handler,
health_data_handler, medication_record_handler, medication_reminder_handler, patient_handler, points_handler, shift_handler, stats_handler,
vital_signs_daily_handler,
};
@@ -233,6 +233,28 @@ impl HealthModule {
"/health/patients/{id}/doctors",
axum::routing::post(patient_handler::assign_doctor),
)
// 家庭成员健康代理 — 管理端
.route(
"/health/patients/{patient_id}/family-members/{family_member_id}/grant-access",
axum::routing::post(family_proxy_handler::grant_family_access),
)
.route(
"/health/patients/{patient_id}/family-members/{family_member_id}/revoke-access",
axum::routing::put(family_proxy_handler::revoke_family_access),
)
// 家庭成员健康代理 — 患者端(小程序)
.route(
"/health/family/patients",
axum::routing::get(family_proxy_handler::list_my_family_patients),
)
.route(
"/health/family/patients/{patient_id}/health-summary",
axum::routing::get(family_proxy_handler::get_family_health_summary),
)
.route(
"/health/family/members/{family_member_id}/link-user",
axum::routing::post(family_proxy_handler::link_family_member_user),
)
.route(
"/health/patients/{id}/doctors/{did}",
axum::routing::delete(patient_handler::remove_doctor),
@@ -1384,6 +1406,19 @@ impl ErpModule for HealthModule {
description: "注册/编辑/删除 BLE 网关、管理患者绑定".into(),
module: "health".into(),
},
// 家庭成员健康代理
PermissionDescriptor {
code: "health.family-proxy.list".into(),
name: "查看家庭健康代理".into(),
description: "家庭成员查看关联患者列表和健康摘要".into(),
module: "health".into(),
},
PermissionDescriptor {
code: "health.family-proxy.manage".into(),
name: "管理家庭健康代理".into(),
description: "授权/撤销家庭成员健康数据访问".into(),
module: "health".into(),
},
]
}