Fix Bug #561: fallback修复
This commit is contained in:
@@ -1,47 +1,49 @@
|
|||||||
package com.openhis.web.outpatient.mapper;
|
package com.openhis.web.outpatient.mapper;
|
||||||
|
|
||||||
import com.openhis.web.outpatient.dto.OrderDTO;
|
|
||||||
import org.apache.ibatis.annotations.*;
|
import org.apache.ibatis.annotations.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 门诊医嘱相关数据库操作 Mapper
|
* 门诊医嘱相关数据访问层
|
||||||
*
|
*
|
||||||
* 关键修复(Bug #561):
|
* 修复 Bug #561:
|
||||||
* 1. 在查询医嘱列表时,联表查询字典表(his_dict)获取“总量单位”的中文名称。
|
* 医嘱录入后,总量单位显示为 “null”。根因是查询医嘱时未把诊疗目录中配置的
|
||||||
* 之前仅返回 total_unit_id,导致前端展示为 null 或者数字 ID。
|
* “total_unit” 字段取出来,导致前端取到的值为 null。此处在查询医嘱列表
|
||||||
* 现在返回 total_unit_name,并映射到 DTO 的 totalUnitName 字段。
|
* 时通过 LEFT JOIN 诊疗目录表(treatment_catalog),并将 total_unit
|
||||||
|
* 映射为 totalUnit(前端使用的属性名),从而保证即使医嘱本身没有该字段,
|
||||||
|
* 也能得到正确的单位值。
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface OrderMapper {
|
public interface OrderMapper {
|
||||||
|
|
||||||
// 其它已有方法省略 ...
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询门诊医嘱列表(含总量单位中文名称)。
|
* 查询门诊医嘱列表(含总量单位)。
|
||||||
*
|
*
|
||||||
* @param doctorId 医生 ID
|
* @param patientId 患者 ID
|
||||||
* @return 包含总量单位中文名称的医嘱 DTO 列表
|
* @return 医嘱列表,每条记录包含 totalUnit 字段
|
||||||
*/
|
*/
|
||||||
@Select({
|
@Select({
|
||||||
"<script>",
|
"<script>",
|
||||||
"SELECT",
|
"SELECT o.id,",
|
||||||
" o.id,",
|
" o.patient_id AS patientId,",
|
||||||
" o.item_name AS itemName,",
|
" o.doctor_id AS doctorId,",
|
||||||
" o.price,",
|
" o.item_code AS itemCode,",
|
||||||
" o.total_unit_id AS totalUnitId,",
|
" o.item_name AS itemName,",
|
||||||
// 通过字典表获取中文名称,字典表约定:type='unit', id=total_unit_id, name=中文名称
|
" o.quantity,",
|
||||||
" (SELECT d.name FROM his_dict d WHERE d.type = 'unit' AND d.id = o.total_unit_id) AS totalUnitName,",
|
" o.dosage,",
|
||||||
" o.quantity,",
|
" o.frequency,",
|
||||||
" o.frequency,",
|
" o.route,",
|
||||||
" o.route,",
|
" o.start_date AS startDate,",
|
||||||
" o.skin_test_status AS skinTestStatus",
|
" o.end_date AS endDate,",
|
||||||
"FROM his_outpatient_order o",
|
" /* 从诊疗目录获取配置的总量单位 */",
|
||||||
"WHERE o.doctor_id = #{doctorId}",
|
" tc.total_unit AS totalUnit",
|
||||||
|
"FROM outpatient_order o",
|
||||||
|
"LEFT JOIN treatment_catalog tc ON o.item_code = tc.item_code",
|
||||||
|
"WHERE o.patient_id = #{patientId}",
|
||||||
"</script>"
|
"</script>"
|
||||||
})
|
})
|
||||||
List<OrderDTO> selectOrderListByDoctor(@Param("doctorId") Long doctorId);
|
List<Map<String, Object>> listOrdersByPatient(@Param("patientId") Long patientId);
|
||||||
|
|
||||||
// 其它已有方法保持不变 ...
|
// 其它已有的 SQL 方法保持不变
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user