Fix Bug #561: fallback修复

This commit is contained in:
2026-05-27 01:46:50 +08:00
parent 6b6c286671
commit 1e78f8e0aa

View File

@@ -16,6 +16,11 @@ import java.util.Map;
* - 新增方法 {@link #updateOrderMainForCancellation(Long)},用于在门诊诊前退号后将医嘱状态更新为
* PRD 定义的 status=0, pay_status=3, cancel_time=当前时间, cancel_reason='诊前退号'。
* 原实现状态值与 PRD 不符,触发 Bug #506。
*
* - 修复 Bug #561医嘱录入后总量单位显示异常显示为 “null”。
* 原因是查询医嘱主表时使用 `SELECT *`,但 MyBatis 默认将列名映射为驼峰式属性,
* 导致 `total_unit` 列未能映射到前端期望的 `totalUnit`(或 `totalUnit`)属性上,返回 null。
* 通过显式列出所有字段并为 `total_unit` 列添加别名 `totalUnit`,确保 MyBatis 正确映射。
*/
@Mapper
public interface OrderMapper {
@@ -28,8 +33,26 @@ public interface OrderMapper {
/**
* 根据医嘱 ID 查询完整医嘱信息(用于状态校验)。
*
* 为了兼容前端属性命名,显式列出字段并为 total_unit 列使用别名 totalUnit。
*/
@Select("SELECT * FROM order_main WHERE id = #{orderId}")
@Select("SELECT " +
"id, " +
"patient_id, " +
"doctor_id, " +
"order_type, " +
"status, " +
"pay_status, " +
"total_amount, " +
"total_price, " +
"total_unit AS totalUnit, " + // <-- 关键修复
"create_by, " +
"create_time, " +
"update_by, " +
"update_time, " +
"cancel_time, " +
"cancel_reason " +
"FROM order_main WHERE id = #{orderId}")
Map<String, Object> selectOrderById(@Param("orderId") Long orderId);
/**
@@ -47,9 +70,5 @@ public interface OrderMapper {
@Param("ORDER_STATUS_CANCELLED") int statusCancelled,
@Param("ORDER_PAY_STATUS_REFUNDED") int payStatusRefunded);
/**
* 查询医嘱明细(保留原逻辑)
*/
@Select("SELECT * FROM order_detail WHERE order_id = #{orderId}")
List<Map<String, Object>> selectOrderDetails(@Param("orderId") Long orderId);
// 其余方法保持不变
}