Fix Bug #561: fallback修复

This commit is contained in:
2026-05-27 00:19:54 +08:00
parent 93791bdd3e
commit 3b5ffb83f6

View File

@@ -14,6 +14,8 @@ import java.util.Map;
* - 新增常量 {@link #ORDER_STATUS_CANCELLED},统一使用 PRD 中定义的 “CANCELLED” 状态码。
* - 新增方法 {@link #updateOrderStatusToCancelled(Long, String)},用于在门诊诊前退号后将医嘱状态更新为
* PRD 定义的 “CANCELLED”。原实现使用硬编码的 'RETURNED',导致状态不一致,触发 Bug #506。
* - **新增方法 {@link #selectOrderDetailById(Long)}**,显式返回诊疗目录配置的总量单位字段,
* 解决医嘱录入后总量单位显示为 “null” 的 Bug #561。
*
* 该接口的实现依赖 MyBatis 动态 SQL保持与项目其他 Mapper 的风格一致。
*/
@@ -32,6 +34,37 @@ public interface OrderMapper {
@Select("SELECT * FROM his_order WHERE id = #{orderId}")
Map<String, Object> selectOrderById(@Param("orderId") Long orderId);
/**
* **新增**:查询医嘱详情并返回总量单位。
*
* <p>诊疗目录中配置的单位保存在列 {@code total_unit_name},前端 DTO 期望的属性名为 {@code totalUnit}
*(对应数据库列 {@code total_unit})。原始的 {@code SELECT *} 只能映射到 {@code total_unit},导致
* 前端得到 {@code null}。此查询通过别名把 {@code total_unit_name} 映射为 {@code total_unit}
* 从而保证前端能够正确显示。</p>
*
* @param orderId 医嘱主键
* @return 包含医嘱所有字段(包括别名后的 total_unit的 Map若不存在返回 null
*/
@Select("SELECT " +
"id, " +
"order_no, " +
"patient_id, " +
"doctor_id, " +
"dept_id, " +
"order_type, " +
"order_status, " +
"exec_status, " +
"dispense_status, " +
"billing_status, " +
"total_quantity, " +
// 将诊疗目录的单位列映射为前端需要的列名
"total_unit_name AS total_unit, " +
"price, " +
"create_time, " +
"update_time " +
"FROM his_order WHERE id = #{orderId}")
Map<String, Object> selectOrderDetailById(@Param("orderId") Long orderId);
/**
* 将医嘱状态更新为已支付(示例方法,业务中已有实现)。
*
@@ -51,7 +84,5 @@ public interface OrderMapper {
*/
@Update("UPDATE his_order SET status = #{status} WHERE id = #{orderId}")
int updateOrderStatusToCancelled(@Param("orderId") Long orderId,
@Param("status") String status);
// 其它业务相关方法保持不变
@Param("status") String status);
}