feat: Iteration 3 — 咨询轮询、统计概览、埋点后端
- consultation_service 支持 after_id 增量消息查询 - 小程序咨询详情页 8 秒轮询新消息 - 新增 DashboardStatsResp 综合统计端点 (/statistics/dashboard) - 新增 /analytics/batch 埋点接收端点(日志记录模式)
This commit is contained in:
@@ -46,3 +46,22 @@ where
|
||||
let result = stats_service::get_follow_up_statistics(&state, ctx.tenant_id).await?;
|
||||
Ok(Json(ApiResponse::ok(result)))
|
||||
}
|
||||
|
||||
pub async fn get_dashboard_stats<S>(
|
||||
State(state): State<HealthState>,
|
||||
Extension(ctx): Extension<TenantContext>,
|
||||
) -> Result<Json<ApiResponse<DashboardStatsResp>>, AppError>
|
||||
where
|
||||
HealthState: FromRef<S>,
|
||||
S: Clone + Send + Sync + 'static,
|
||||
{
|
||||
require_permission(&ctx, "health.patient.list")?;
|
||||
let patients = stats_service::get_patient_statistics(&state, ctx.tenant_id).await?;
|
||||
let consultations = stats_service::get_consultation_statistics(&state, ctx.tenant_id).await?;
|
||||
let follow_ups = stats_service::get_follow_up_statistics(&state, ctx.tenant_id).await?;
|
||||
Ok(Json(ApiResponse::ok(DashboardStatsResp {
|
||||
patients,
|
||||
consultations,
|
||||
follow_ups,
|
||||
})))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user