From 2d5d01bedce223562018ae5e100ddd6e1c73f548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=80=E5=BD=A7?= <荀彧@gentronhealth.com> Date: Tue, 12 May 2026 23:34:14 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#457:=20=E9=97=A8=E8=AF=8A=E6=94=B6?= =?UTF-8?q?=E8=B4=B9=EF=BC=9A=E5=B7=B2=E7=AD=BE=E5=8F=91=E7=9A=84=E6=89=8B?= =?UTF-8?q?=E6=9C=AF=E7=B1=BB=E5=8C=BB=E5=98=B1=E5=9C=A8=E9=97=A8=E8=AF=8A?= =?UTF-8?q?=E6=94=B6=E8=B4=B9=E5=88=97=E8=A1=A8=E4=B8=AD=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=A1=B9=E7=9B=AE=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因分析:门诊医生站处方列表查询(DoctorStationAdviceAppMapper.xml)中, 手术类医嘱(category_enum=4)的 advice_table_name 固定返回 'wor_activity_definition', 而非 'cli_surgery'。当医生通过"签发"按钮处理手术医嘱时,handService() 据此创建 ChargeItem,导致 product_table = 'wor_activity_definition',但 product_id 实际指向 cli_surgery 表中的手术记录。 门诊收费SQL查询的CASE语句仅匹配 product_table = 'cli_surgery' 的手术项, 因此这些手术医嘱无法匹配,item_name 返回 NULL。 修复方案:在 selectEncounterPatientPrescription 和 selectEncounterPatientPrescriptionWithPrice 的 item_name CASE 表达式中新增兜底分支: WHEN context_enum = #{activity} AND service_table = 'wor_service_request' THEN COALESCE(T9.surgery_name, wsr.content_json->>'surgeryName', wsr.content_json->>'adviceName', T2."name") 按优先级回退获取手术名称:cli_surgery表 → content_json手术名称 → content_json医嘱名称 → 诊疗定义名称 Co-Authored-By: Claude Opus 4.7 --- .../resources/mapper/chargemanage/OutpatientChargeAppMapper.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml index 47b950d4d..c3d9da2da 100755 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml @@ -100,6 +100,7 @@ WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name") WHEN T1.context_enum = 6 THEN T2."name" WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name") + WHEN T1.context_enum = #{activity} AND T1.service_table = 'wor_service_request' THEN COALESCE(T9.surgery_name, wsr.content_json::json->>'surgeryName', wsr.content_json::json->>'adviceName', T2."name") WHEN T1.context_enum = #{activity} THEN COALESCE(wsr.content_json::json->>'surgeryName', wsr.content_json::json->>'adviceName', T2."name") WHEN T1.context_enum = #{medication} THEN T3."name" WHEN T1.context_enum = #{device} THEN T4."name" @@ -225,6 +226,7 @@ WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name") WHEN T1.context_enum = 6 THEN T2."name" WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name") + WHEN T1.context_enum = #{activity} AND T1.service_table = 'wor_service_request' THEN COALESCE(T9.surgery_name, wsr.content_json::json->>'surgeryName', wsr.content_json::json->>'adviceName', T2."name") WHEN T1.context_enum = #{activity} THEN COALESCE(wsr.content_json::json->>'surgeryName', wsr.content_json::json->>'adviceName', T2."name") WHEN T1.context_enum = #{medication} THEN T3."name" WHEN T1.context_enum = #{device} THEN T4."name"