diff --git a/crates/erp-health/src/handler/consent_handler.rs b/crates/erp-health/src/handler/consent_handler.rs index cef5969..b66572e 100644 --- a/crates/erp-health/src/handler/consent_handler.rs +++ b/crates/erp-health/src/handler/consent_handler.rs @@ -9,12 +9,19 @@ use crate::dto::consent_dto::*; use crate::service::consent_service; use crate::state::HealthState; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, utoipa::IntoParams)] pub struct ConsentListParams { pub page: Option, pub page_size: Option, } +#[utoipa::path( + get, + path = "/health/patients/{patient_id}/consents", + responses((status = 200, description = "知情同意列表")), + tag = "知情同意", + security(("bearer_auth" = [])), +)] pub async fn list_consents( State(state): State, Extension(ctx): Extension, @@ -33,6 +40,13 @@ where Ok(Json(ApiResponse::ok(result))) } +#[utoipa::path( + post, + path = "/health/consents", + responses((status = 200, description = "授权成功")), + tag = "知情同意", + security(("bearer_auth" = [])), +)] pub async fn grant_consent( State(state): State, Extension(ctx): Extension, @@ -50,6 +64,13 @@ where Ok(Json(ApiResponse::ok(result))) } +#[utoipa::path( + put, + path = "/health/consents/{consent_id}/revoke", + responses((status = 200, description = "撤销成功")), + tag = "知情同意", + security(("bearer_auth" = [])), +)] pub async fn revoke_consent( State(state): State, Extension(ctx): Extension, diff --git a/crates/erp-health/src/handler/device_handler.rs b/crates/erp-health/src/handler/device_handler.rs index fb18e7a..0cb8095 100644 --- a/crates/erp-health/src/handler/device_handler.rs +++ b/crates/erp-health/src/handler/device_handler.rs @@ -27,6 +27,16 @@ pub struct DeviceListQuery { } /// GET /api/v1/health/devices — 设备绑定列表 +#[utoipa::path( + get, + path = "/health/devices", + params(DeviceListQuery), + responses( + (status = 200, description = "设备列表"), + ), + tag = "设备管理", + security(("bearer_auth" = [])), +)] pub async fn list_devices( State(state): State, Extension(ctx): Extension, @@ -60,6 +70,16 @@ where } /// DELETE /api/v1/health/devices/{id} — 解绑设备(软删除) +#[utoipa::path( + delete, + path = "/health/devices/{id}", + responses( + (status = 200, description = "解绑成功"), + (status = 404, description = "设备不存在"), + ), + tag = "设备管理", + security(("bearer_auth" = [])), +)] pub async fn unbind_device( State(state): State, Extension(ctx): Extension,