fix(web+health): 修复咨询轮询 temp ID 400 + 健康数据统计 500
- ConsultationDetail: 轮询取 lastId 时过滤 temp_ 前缀的乐观消息 ID, 避免将非法 UUID 传给 after_id 参数导致后端 400 - stats_service: count_abnormal_lab_items 和 compute_daily_report_rate 中 SQL 字面量 0 类型为 INT4,与 Rust i64 (INT8) 不匹配, 改为 0::bigint 确保类型兼容
This commit is contained in:
@@ -120,7 +120,8 @@ export default function ConsultationDetail() {
|
||||
pollRef.current = setInterval(async () => {
|
||||
if (!sessionId) return;
|
||||
try {
|
||||
const lastId = messages.length > 0 ? messages[messages.length - 1].id : undefined;
|
||||
const realMsgs = messages.filter((m) => !m.id.startsWith('temp_'));
|
||||
const lastId = realMsgs.length > 0 ? realMsgs[realMsgs.length - 1].id : undefined;
|
||||
const result = await consultationApi.listMessages(sessionId, {
|
||||
page: 1,
|
||||
page_size: 50,
|
||||
|
||||
@@ -386,7 +386,7 @@ async fn count_abnormal_lab_items(
|
||||
(SELECT jsonb_agg(elem) FROM jsonb_array_elements(items) elem WHERE elem->>'is_abnormal' = 'true'),
|
||||
'[]'::jsonb
|
||||
)
|
||||
)), 0) AS total
|
||||
)), 0::bigint) AS total
|
||||
FROM lab_report
|
||||
WHERE tenant_id = $1 AND deleted_at IS NULL AND items IS NOT NULL
|
||||
AND created_at >= date_trunc('month', NOW())
|
||||
@@ -446,7 +446,7 @@ async fn compute_daily_report_rate(
|
||||
let sql = r#"
|
||||
SELECT d::date::text AS date,
|
||||
COUNT(DISTINCT vs.patient_id) AS reported,
|
||||
0 AS total
|
||||
0::bigint AS total
|
||||
FROM generate_series(
|
||||
CURRENT_DATE - INTERVAL '6 days',
|
||||
CURRENT_DATE,
|
||||
|
||||
Reference in New Issue
Block a user