Fix Bug #561: fallback修复
This commit is contained in:
@@ -8,12 +8,42 @@ import java.util.Map;
|
||||
* 预约订单数据访问层
|
||||
*
|
||||
* 新增方法用于门诊诊前退号时更新订单状态。
|
||||
*
|
||||
* 修复 Bug #561:
|
||||
* 医嘱录入后,总量单位(total_unit)在前端显示为 “null”。根因是查询医嘱明细时直接返回
|
||||
* 数据库字段值,若诊疗目录中未配置单位则返回 null,前端未做空值处理导致显示 “null”。
|
||||
* 通过在 SQL 中使用 COALESCE 将 null 替换为诊疗目录配置的默认单位(若仍为 null 则返回空字符串),
|
||||
* 从而保证前端始终得到合法的字符串,避免 “null” 文本展示。
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderMapper {
|
||||
|
||||
// 现有方法省略 ...
|
||||
|
||||
/**
|
||||
* 查询门诊医嘱明细(包括总量单位)
|
||||
*
|
||||
* @param orderId 订单ID
|
||||
* @return 医嘱明细列表
|
||||
*
|
||||
* 说明:
|
||||
* - 诊疗目录表(diagnosis_catalog)中字段 total_unit 保存默认单位;
|
||||
* - 医嘱明细表(outpatient_order_item)中字段 total_unit 可能为空;
|
||||
* - 使用 COALESCE 优先取医嘱明细的 total_unit,若为空则取目录默认单位,
|
||||
* 再为空时返回空字符串,防止前端出现 “null”。
|
||||
*/
|
||||
@Select("SELECT " +
|
||||
" i.id, " +
|
||||
" i.item_name, " +
|
||||
" i.quantity, " +
|
||||
" COALESCE(i.total_unit, c.total_unit, '') AS total_unit, " + // <-- 修复点
|
||||
" i.price, " +
|
||||
" i.amount " +
|
||||
"FROM outpatient_order_item i " +
|
||||
"LEFT JOIN diagnosis_catalog c ON i.catalog_id = c.id " +
|
||||
"WHERE i.order_id = #{orderId}")
|
||||
List<Map<String, Object>> getOrderItemsWithUnit(@Param("orderId") Long orderId);
|
||||
|
||||
/**
|
||||
* 更新订单支付状态
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user