feat(health): Track 3 医疗阈值 — warning 种子 + 患者端只读 API

- 新增 6 条 warning 级别阈值种子数据(血压/心率/血糖参考范围)
- 新增 GET /health/critical-value-thresholds/public 患者端只读接口
- 扩展 indicator 验证支持 blood_sugar_fasting/postprandial 等新指标
This commit is contained in:
iven
2026-05-02 11:37:21 +08:00
parent 23cd62a70f
commit e8ee441ae1
5 changed files with 86 additions and 1 deletions

View File

@@ -109,3 +109,16 @@ where
.await?;
Ok(Json(ApiResponse::ok(())))
}
/// 患者端只读接口 — 返回当前租户所有活跃阈值,仅需认证。
pub async fn list_public_thresholds<S>(
State(state): State<HealthState>,
Extension(ctx): Extension<TenantContext>,
) -> Result<Json<ApiResponse<Vec<crate::entity::critical_value_threshold::Model>>>, AppError>
where
HealthState: FromRef<S>,
S: Clone + Send + Sync + 'static,
{
let list = critical_value_threshold_service::find_thresholds(&state.db, ctx.tenant_id).await?;
Ok(Json(ApiResponse::ok(list)))
}