From 4e3281bb8b25a3404a3ad2ca87094dd80e47a0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=80=E5=BD=A7?= <荀彧@gentronhealth.com> Date: Thu, 14 May 2026 05:18:58 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#497:=20=E3=80=90=E4=BD=8F=E9=99=A2?= =?UTF-8?q?=E5=8C=BB=E7=94=9F=E5=B7=A5=E4=BD=9C=E7=AB=99-=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E7=94=B3=E8=AF=B7=E3=80=91=E6=A3=80=E6=9F=A5=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=88=97=E8=A1=A8=E7=BC=BA=E5=A4=B1"=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=8D=95=E7=8A=B6=E6=80=81"=E5=88=97=E5=8F=8A?= =?UTF-8?q?=E5=85=A8=E6=B5=81=E7=A8=8B=E9=97=AD=E7=8E=AF=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=B5=81=E8=BD=AC=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:SQL 查询使用 CASE MIN(wsr.status_enum) 计算状态,但聚合函数 MIN() 出现在 WHERE 子句中, PostgreSQL 语法错误导致状态筛选时查询失败。且计算状态仅映射 5 种值(缺少"待接收"=3、"已出报告"=6)。 修复:改为直接使用 doc_request_form.status 字段(数据库已存在该列), SELECT 和 WHERE 均使用 drf.status,支持完整 0-7 状态流转。 Co-Authored-By: Claude Opus 4.7 --- .../RequestFormManageAppMapper.xml | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml index e47dbf203..4a284cbfc 100755 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml @@ -13,16 +13,7 @@ drf.requester_id, drf.create_time, ap.NAME AS patient_name, - CASE MIN(wsr.status_enum) - WHEN 1 THEN 0 - WHEN 2 THEN 1 - WHEN 3 THEN 4 - WHEN 4 THEN 4 - WHEN 5 THEN 5 - WHEN 6 THEN 5 - WHEN 7 THEN 5 - ELSE NULL - END AS status + drf.status FROM doc_request_form AS drf LEFT JOIN adm_encounter AS ae ON ae.ID = drf.encounter_id AND ae.delete_flag = '0' @@ -40,16 +31,7 @@ AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second') - AND CASE MIN(wsr.status_enum) - WHEN 1 THEN 0 - WHEN 2 THEN 1 - WHEN 3 THEN 4 - WHEN 4 THEN 4 - WHEN 5 THEN 5 - WHEN 6 THEN 5 - WHEN 7 THEN 5 - ELSE NULL - END = #{status}::integer + AND drf.status = #{status}::integer AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'