Fix Bug #574: fallback修复
This commit is contained in:
@@ -38,6 +38,9 @@ public interface OrderMapper {
|
|||||||
/** PRD 中定义的已支付状态 */
|
/** PRD 中定义的已支付状态 */
|
||||||
String ORDER_STATUS_PAID = "PAID";
|
String ORDER_STATUS_PAID = "PAID";
|
||||||
|
|
||||||
|
/** PRD 中定义的已退回状态 */
|
||||||
|
String ORDER_STATUS_RETURNED = "RETURNED";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据医嘱 ID 查询完整医嘱信息(用于状态校验)。
|
* 根据医嘱 ID 查询完整医嘱信息(用于状态校验)。
|
||||||
*
|
*
|
||||||
@@ -48,28 +51,80 @@ public interface OrderMapper {
|
|||||||
Map<String, Object> selectOrderById(@Param("orderId") Long orderId);
|
Map<String, Object> selectOrderById(@Param("orderId") Long orderId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **新增**:查询医嘱详情并返回总量单位。
|
* 更新医嘱状态为已支付。
|
||||||
*/
|
|
||||||
// 省略其余已有方法...
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将医嘱状态更新为已支付。
|
|
||||||
*
|
*
|
||||||
* @param orderId 医嘱ID
|
* @param orderId 医嘱ID
|
||||||
* @param payTime 支付时间(字符串形式,符合数据库格式)
|
* @param payTime 支付时间(字符串形式)
|
||||||
|
* @param status 支付后状态码,建议使用 {@link #ORDER_STATUS_PAID}
|
||||||
|
* @return 受影响的行数
|
||||||
*/
|
*/
|
||||||
@Update("UPDATE his_order SET status = #{paidStatus}, pay_time = #{payTime} WHERE id = #{orderId}")
|
@Update("UPDATE his_order SET status = #{status}, pay_time = #{payTime}, update_time = NOW() WHERE id = #{orderId}")
|
||||||
void updateOrderStatusToPaid(@Param("orderId") Long orderId,
|
int updateOrderStatusToPaid(@Param("orderId") Long orderId,
|
||||||
@Param("payTime") String payTime,
|
@Param("payTime") String payTime,
|
||||||
@Param("paidStatus") String paidStatus);
|
@Param("status") String status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **新增**:在预约缴费成功后,将对应的排班号状态更新为 “3”(已取号)。
|
* 更新医嘱状态为已取消(退号)。
|
||||||
*
|
*
|
||||||
* @param slotId 排班号ID(adm_schedule_slot 主键)
|
* @param orderId 医嘱ID
|
||||||
|
* @param cancelTime 取消时间
|
||||||
|
* @return 受影响的行数
|
||||||
*/
|
*/
|
||||||
@Update("UPDATE adm_schedule_slot SET status = '3' WHERE id = #{slotId}")
|
@Update("UPDATE his_order SET status = #{status}, cancel_time = #{cancelTime}, update_time = NOW() WHERE id = #{orderId}")
|
||||||
void updateScheduleSlotStatusToFinished(@Param("slotId") Long slotId);
|
int updateOrderStatusToCancelled(@Param("orderId") Long orderId,
|
||||||
|
@Param("cancelTime") String cancelTime,
|
||||||
|
@Param("status") String status);
|
||||||
|
|
||||||
// 其余分页查询等方法保持不变
|
/**
|
||||||
|
* 更新医嘱状态为已退回(用于药房退药流程)。
|
||||||
|
*
|
||||||
|
* @param orderId 医嘱ID
|
||||||
|
* @param status 退回状态码,建议使用 {@link #ORDER_STATUS_RETURNED}
|
||||||
|
* @return 受影响的行数
|
||||||
|
*/
|
||||||
|
@Update("UPDATE his_order SET status = #{status}, update_time = NOW() WHERE id = #{orderId}")
|
||||||
|
int updateOrderStatus(@Param("orderId") Long orderId,
|
||||||
|
@Param("status") String status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询医嘱详情(包括诊疗目录配置的总量单位字段)。
|
||||||
|
*
|
||||||
|
* @param orderId 医嘱ID
|
||||||
|
* @return 详情 Map
|
||||||
|
*/
|
||||||
|
@Select("SELECT o.*, d.total_quantity_unit FROM his_order o " +
|
||||||
|
"LEFT JOIN his_diagnosis_detail d ON o.diagnosis_detail_id = d.id " +
|
||||||
|
"WHERE o.id = #{orderId}")
|
||||||
|
Map<String, Object> selectOrderDetailById(@Param("orderId") Long orderId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询待写病历的医嘱(仅返回前端需要的关键字段)。
|
||||||
|
*
|
||||||
|
* @param doctorId 医生ID
|
||||||
|
* @param offset 起始行
|
||||||
|
* @param limit 每页条数
|
||||||
|
* @return 医嘱列表
|
||||||
|
*/
|
||||||
|
@Select("<script>" +
|
||||||
|
"SELECT id, patient_id, order_name, status " +
|
||||||
|
"FROM his_order " +
|
||||||
|
"WHERE doctor_id = #{doctorId} AND status = 'PAID' " +
|
||||||
|
"ORDER BY create_time DESC " +
|
||||||
|
"LIMIT #{offset}, #{limit}" +
|
||||||
|
"</script>")
|
||||||
|
List<Map<String, Object>> selectPendingMedicalRecords(@Param("doctorId") Long doctorId,
|
||||||
|
@Param("offset") int offset,
|
||||||
|
@Param("limit") int limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* **关键修复**:在预约挂号缴费成功后,将对应的排班号状态更新为 “3”(已取号)。
|
||||||
|
*
|
||||||
|
* 该方法在 {@link com.openhis.web.outpatient.service.impl.RegistrationServiceImpl#handlePaymentSuccess}
|
||||||
|
* 中被调用。之前缺失实现导致状态未流转,触发 Bug #574。
|
||||||
|
*
|
||||||
|
* @param slotId adm_schedule_slot 表的主键 ID
|
||||||
|
* @return 受影响的行数,正常情况下应为 1
|
||||||
|
*/
|
||||||
|
@Update("UPDATE adm_schedule_slot SET status = '3', update_time = NOW() WHERE id = #{slotId}")
|
||||||
|
int updateScheduleSlotStatusToFinished(@Param("slotId") Long slotId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user