From 0a8ff4bbe7006cacefa76f0fe5cead9cdbd4298e Mon Sep 17 00:00:00 2001 From: iven Date: Mon, 11 May 2026 13:07:57 +0800 Subject: [PATCH] =?UTF-8?q?docs(health):=20OpenAPI=20=E6=B3=A8=E8=A7=A3=20?= =?UTF-8?q?=E2=80=94=20diagnosis=20+=20device=5Freading=20+=20vital=5Fsign?= =?UTF-8?q?s=5Fdaily?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为 3 个 handler 文件共 8 个函数添加 #[utoipa::path] 注解。 P1-5 批次 2/N。 --- .../src/handler/device_reading_handler.rs | 21 ++++++++++++++ .../src/handler/diagnosis_handler.rs | 28 +++++++++++++++++++ .../src/handler/vital_signs_daily_handler.rs | 7 +++++ 3 files changed, 56 insertions(+) diff --git a/crates/erp-health/src/handler/device_reading_handler.rs b/crates/erp-health/src/handler/device_reading_handler.rs index 97cee2a..890ab65 100644 --- a/crates/erp-health/src/handler/device_reading_handler.rs +++ b/crates/erp-health/src/handler/device_reading_handler.rs @@ -33,6 +33,13 @@ pub struct HourlyQuery { pub page_size: Option, } +#[utoipa::path( + post, + path = "/health/patients/{patient_id}/device-readings/batch", + responses((status = 200, description = "批量创建成功")), + tag = "设备数据", + security(("bearer_auth" = [])), +)] pub async fn batch_create( State(state): State, Extension(ctx): Extension, @@ -50,6 +57,13 @@ where Ok(axum::Json(ApiResponse::ok(result))) } +#[utoipa::path( + get, + path = "/health/patients/{patient_id}/device-readings", + responses((status = 200, description = "设备读数列表")), + tag = "设备数据", + security(("bearer_auth" = [])), +)] pub async fn list_readings( State(state): State, Extension(ctx): Extension, @@ -76,6 +90,13 @@ where Ok(axum::Json(ApiResponse::ok(result))) } +#[utoipa::path( + get, + path = "/health/patients/{patient_id}/device-readings/hourly", + responses((status = 200, description = "小时聚合数据")), + tag = "设备数据", + security(("bearer_auth" = [])), +)] pub async fn list_hourly( State(state): State, Extension(ctx): Extension, diff --git a/crates/erp-health/src/handler/diagnosis_handler.rs b/crates/erp-health/src/handler/diagnosis_handler.rs index 457337c..f46ee11 100644 --- a/crates/erp-health/src/handler/diagnosis_handler.rs +++ b/crates/erp-health/src/handler/diagnosis_handler.rs @@ -16,6 +16,13 @@ pub struct PaginationParams { pub page_size: Option, } +#[utoipa::path( + get, + path = "/health/patients/{patient_id}/diagnoses", + responses((status = 200, description = "诊断记录列表")), + tag = "诊断记录", + security(("bearer_auth" = [])), +)] pub async fn list_diagnoses( State(state): State, Extension(ctx): Extension, @@ -35,6 +42,13 @@ where Ok(Json(ApiResponse::ok(result))) } +#[utoipa::path( + post, + path = "/health/patients/{patient_id}/diagnoses", + responses((status = 200, description = "创建成功")), + tag = "诊断记录", + security(("bearer_auth" = [])), +)] pub async fn create_diagnosis( State(state): State, Extension(ctx): Extension, @@ -59,6 +73,13 @@ where Ok(Json(ApiResponse::ok(result))) } +#[utoipa::path( + put, + path = "/health/diagnoses/{diagnosis_id}", + responses((status = 200, description = "更新成功")), + tag = "诊断记录", + security(("bearer_auth" = [])), +)] pub async fn update_diagnosis( State(state): State, Extension(ctx): Extension, @@ -84,6 +105,13 @@ where Ok(Json(ApiResponse::ok(result))) } +#[utoipa::path( + delete, + path = "/health/diagnoses/{diagnosis_id}", + responses((status = 200, description = "删除成功")), + tag = "诊断记录", + security(("bearer_auth" = [])), +)] pub async fn delete_diagnosis( State(state): State, Extension(ctx): Extension, diff --git a/crates/erp-health/src/handler/vital_signs_daily_handler.rs b/crates/erp-health/src/handler/vital_signs_daily_handler.rs index 57dd98c..7e10b3e 100644 --- a/crates/erp-health/src/handler/vital_signs_daily_handler.rs +++ b/crates/erp-health/src/handler/vital_signs_daily_handler.rs @@ -19,6 +19,13 @@ pub struct DailyAggQuery { pub end_date: String, } +#[utoipa::path( + get, + path = "/health/vital-signs/daily", + responses((status = 200, description = "日聚合数据")), + tag = "设备数据", + security(("bearer_auth" = [])), +)] pub async fn get_daily_aggregations( State(state): State, Extension(ctx): Extension,