From d083a3123ad5c21b9bc7eab6a081a890772ba1b6 Mon Sep 17 00:00:00 2001 From: chenqi Date: Thu, 12 Mar 2026 15:53:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Bug=20#177=20=E4=BF=AE=E5=A4=8D=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8C=BB=E5=98=B1=E6=8A=A5=E9=94=99=20-=20category=5F?= =?UTF-8?q?code=20=E7=B1=BB=E5=9E=8B=E8=BD=AC=E6=8D=A2=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题原因: SQL查询中尝试将 wor_activity_definition.category_code(中文值如'检验'、'检查') 直接转换为 INTEGER 类型,导致 PostgreSQL 类型转换错误。 修复方案: 使用 CASE WHEN 语句将中文 category_code 映射为对应的整数值: - 检验 -> 1 - 检查 -> 2 - 护理 -> 3 - 手术 -> 4 - 其他 -> 5 这与 ActivityType 枚举定义保持一致。 --- .../doctorstation/DoctorStationAdviceAppMapper.xml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml index bf8fa65f..8406580f 100644 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml @@ -204,8 +204,16 @@ T1.yb_no AS yb_no, '' AS product_name, -- 前端"类型"列:显示目录类别(category_code) - -- 将category_code转换为整数,用于字典转换(字典转换框架会自动填充activityType_dictText) - CAST(T1.category_code AS INTEGER) AS activity_type, + -- 🔧 Bug #177 修复:将category_code(中文)转换为对应的整数值,用于字典转换 + -- 检验->1, 检查->2, 护理->3, 手术->4, 其他->5 + CASE T1.category_code + WHEN '检验' THEN 1 + WHEN '检查' THEN 2 + WHEN '护理' THEN 3 + WHEN '手术' THEN 4 + WHEN '其他' THEN 5 + ELSE 0 + END AS activity_type, NULL AS activity_type_dictText, -- 前端"包装单位"列:显示使用单位(permitted_unit_code) T1.permitted_unit_code AS unit_code,