From a0b546266d93130ec4526eb2bbe96cd8155f7a44 Mon Sep 17 00:00:00 2001 From: chenqi Date: Wed, 21 Jan 2026 16:22:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(mapper):=20=E4=BF=AE=E5=A4=8D=E6=82=A3?= =?UTF-8?q?=E8=80=85=E4=B8=BB=E4=BF=A1=E6=81=AF=E6=9F=A5=E8=AF=A2=E7=9A=84?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=95=B0=E6=8D=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 getRegPatientMainInfo 查询中添加 DISTINCT ON 子句按 patient_id 去重 - 为分页功能添加 getRegPatientMainInfoCount 计数查询 - 修复 SQL 拼接条件的语法错误,将 ${ew.customSqlSegment} 替换为标准的动态 SQL 标签 - 调整字典标签查询逻辑,先查询指定表再回退到默认字典缓存 - 优化查询性能,避免不必要的数据重复和错误的 SQL 语法 - 添加缺失的 ORDER BY 子句确保查询结果的一致性 --- .../AdviceManageAppMapper.xml | 94 ++++++++++++++++++- .../openhis/common/aspectj/DictAspect.java | 8 +- 2 files changed, 94 insertions(+), 8 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml index 1774a420..6201b68d 100644 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml @@ -5,7 +5,8 @@ + + + \ No newline at end of file diff --git a/openhis-server-new/openhis-common/src/main/java/com/openhis/common/aspectj/DictAspect.java b/openhis-server-new/openhis-common/src/main/java/com/openhis/common/aspectj/DictAspect.java index c35d38a6..a8fa2b51 100644 --- a/openhis-server-new/openhis-common/src/main/java/com/openhis/common/aspectj/DictAspect.java +++ b/openhis-server-new/openhis-common/src/main/java/com/openhis/common/aspectj/DictAspect.java @@ -117,10 +117,7 @@ public class DictAspect { private String queryDictLabel(String dictTable, String dictCode, String dictText, String dictValue) { if (StringUtils.hasText(dictTable)) { - // 场景 1:默认字典走DictUtils缓存 - return DictUtils.getDictLabel(dictCode, dictValue); - } else { - // 场景 2:查询指定表 + // 场景 1:查询指定表 String sql = String.format("SELECT %s FROM %s WHERE %s::varchar = ? LIMIT 1", dictText, dictTable, dictCode); try { return jdbcTemplate.queryForObject(sql, String.class, dictValue); @@ -128,6 +125,9 @@ public class DictAspect { // 如果查询结果为空,返回 空字符串 return ""; } + } else { + // 场景 2:默认字典走DictUtils缓存 + return DictUtils.getDictLabel(dictCode, dictValue); } } } \ No newline at end of file