Fix Bug #561: fallback修复
This commit is contained in:
@@ -13,6 +13,9 @@ import java.util.Map;
|
||||
* 时通过 LEFT JOIN 诊疗目录表(treatment_catalog),并将 total_unit
|
||||
* 映射为 totalUnit(前端使用的属性名),从而保证即使医嘱本身没有该字段,
|
||||
* 也能得到正确的单位值。
|
||||
*
|
||||
* 进一步改进:如果 outpatient_order 表本身也可能保存 total_unit(如手工覆盖),
|
||||
* 使用 COALESCE 优先取订单表的值,再取目录表的默认值,确保前端始终得到有效单位。
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderMapper {
|
||||
@@ -36,8 +39,8 @@ public interface OrderMapper {
|
||||
" o.route,",
|
||||
" o.start_date AS startDate,",
|
||||
" o.end_date AS endDate,",
|
||||
" /* 从诊疗目录获取配置的总量单位 */",
|
||||
" tc.total_unit AS totalUnit",
|
||||
" /* 从订单或诊疗目录获取配置的总量单位 */",
|
||||
" COALESCE(o.total_unit, 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}",
|
||||
|
||||
Reference in New Issue
Block a user