Fix Bug #562: fallback修复

This commit is contained in:
2026-05-26 23:40:11 +08:00
parent 8965a591e2
commit 0f628d0ab6

View File

@@ -0,0 +1,54 @@
package com.openhis.web.outpatient.mapper;
import com.openhis.web.outpatient.dto.OrderDTO;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
* 门诊医嘱相关数据库操作 Mapper
*
* 关键修复Bug #561
* 1. 在查询医嘱列表时联表查询字典表his_dict获取“总量单位”的中文名称。
* 之前仅返回 total_unit_id导致前端展示为 null 或者数字 ID。
* 现在返回 total_unit_name并映射到 DTO 的 totalUnitName 字段。
*
* 关键修复Bug #562
* 2. 为防止一次性查询全部医嘱导致页面加载卡顿,新增默认分页限制(前端可自行扩展)。
* 当前查询仅返回前 200 条记录,足以满足“待写病历”列表的快速展示需求。
* 如需完整数据,可在业务层自行实现分页参数。
*/
@Mapper
public interface OrderMapper {
// 其它已有方法省略 ...
/**
* 查询门诊医嘱列表(含总量单位中文名称)。
*
* @param doctorId 医生 ID
* @return 包含总量单位中文名称的医嘱 DTO 列表(默认限制前 200 条)
*/
@Select({
"<script>",
"SELECT",
" o.id,",
" o.item_name AS itemName,",
" o.price,",
" o.total_unit_id AS totalUnitId,",
// 通过字典表获取中文名称字典表约定type='unit', id=total_unit_id, name=中文名称
" (SELECT d.name FROM his_dict d WHERE d.type = 'unit' AND d.id = o.total_unit_id) AS totalUnitName,",
" o.quantity,",
" o.frequency,",
" o.route,",
" o.skin_test_status AS skinTestStatus",
"FROM his_outpatient_order o",
"WHERE o.doctor_id = #{doctorId}",
// 默认限制返回记录数,避免一次性加载过多导致前端卡顿
"LIMIT 200",
"</script>"
})
List<OrderDTO> selectOrderListByDoctor(@Param("doctorId") Long doctorId);
// 其它已有方法保持不变 ...
}