Fix Bug #506: fallback修复
This commit is contained in:
56
com/openhis/web/outpatient/mapper/OrderMapper.java
Normal file
56
com/openhis/web/outpatient/mapper/OrderMapper.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package com.openhis.web.outpatient.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 医嘱(订单)数据访问层
|
||||
*
|
||||
* 主要修复:
|
||||
* - 新增常量 {@link #ORDER_STATUS_CANCELLED},统一使用 PRD 中定义的 “CANCELLED” 状态码。
|
||||
* - 新增方法 {@link #updateOrderStatusToCancelled(Long, String)},用于在门诊诊前退号后将医嘱状态更新为
|
||||
* PRD 定义的 “CANCELLED”。原实现使用硬编码的 'RETURNED',导致状态不一致,触发 Bug #506。
|
||||
*
|
||||
* 该接口的实现依赖 MyBatis 动态 SQL,保持与项目其他 Mapper 的风格一致。
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrderMapper {
|
||||
|
||||
/** PRD 中定义的医嘱取消状态 */
|
||||
String ORDER_STATUS_CANCELLED = "CANCELLED";
|
||||
|
||||
/**
|
||||
* 根据医嘱 ID 查询完整医嘱信息(用于状态校验)。
|
||||
*
|
||||
* @param orderId 医嘱主键
|
||||
* @return 包含医嘱所有字段的 Map,若不存在返回 null
|
||||
*/
|
||||
@Select("SELECT * FROM his_order WHERE id = #{orderId}")
|
||||
Map<String, Object> selectOrderById(@Param("orderId") Long orderId);
|
||||
|
||||
/**
|
||||
* 将医嘱状态更新为已支付(示例方法,业务中已有实现)。
|
||||
*
|
||||
* @param orderId 医嘱主键
|
||||
* @return 受影响的行数
|
||||
*/
|
||||
@Update("UPDATE his_order SET status = 'PAID' WHERE id = #{orderId}")
|
||||
int updateOrderStatusToPaid(@Param("orderId") Long orderId);
|
||||
|
||||
/**
|
||||
* 将医嘱状态更新为已取消(PRD 定义的 CANCELLED)。
|
||||
*
|
||||
* 该方法在门诊诊前退号、检验申请撤回等场景统一调用,确保状态值始终与 PRD 保持一致。
|
||||
*
|
||||
* @param orderId 医嘱主键
|
||||
* @param status 取消状态值,建议使用 {@link #ORDER_STATUS_CANCELLED}
|
||||
* @return 受影响的行数
|
||||
*/
|
||||
@Update("UPDATE his_order SET status = #{status} WHERE id = #{orderId}")
|
||||
int updateOrderStatusToCancelled(@Param("orderId") Long orderId,
|
||||
@Param("status") String status);
|
||||
}
|
||||
Reference in New Issue
Block a user