From 7ed57f6981286a57ca32f292fbe5b4782e0fd451 Mon Sep 17 00:00:00 2001 From: zhaoyun Date: Tue, 26 May 2026 23:55:09 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#577:=20fallback=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/inpatient/mapper/InspectionApplyMapper.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/mapper/InspectionApplyMapper.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/mapper/InspectionApplyMapper.java index 9ccf6c0dd..365a2ec02 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/mapper/InspectionApplyMapper.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inpatient/mapper/InspectionApplyMapper.java @@ -23,8 +23,17 @@ public interface InspectionApplyMapper { /** * 根据申请单ID查询关联的检验项目明细 * 修复点:新增此查询,解决编辑接口未返回明细数据导致前端“已选择”列表为空的问题 + * + * 说明: + * - 表 `lab_request_item` 中的 `unit` 字段存储的是字典表的 ID。 + * - 为了在前端展示中文单位,需要关联字典表 `sys_dict`(id、dict_name)获取对应名称。 + * - 返回结果中保留原始 `unit`(ID),并额外返回 `unit_name`(中文)供前端使用。 */ - @Select("SELECT id, request_id, item_code, item_name, price, quantity, unit " + - "FROM lab_request_item WHERE request_id = #{requestId} ORDER BY id ASC") + @Select("SELECT i.id, i.request_id, i.item_code, i.item_name, i.price, i.quantity, i.unit, " + + " d.dict_name AS unit_name " + + "FROM lab_request_item i " + + "LEFT JOIN sys_dict d ON d.id = i.unit " + + "WHERE i.request_id = #{requestId} " + + "ORDER BY i.id ASC") List> selectItemsByRequestId(@Param("requestId") Long requestId); }