Fix Bug #561: AI修复
This commit is contained in:
@@ -51,50 +51,51 @@ public interface OrderMapper {
|
||||
Map<String, Object> selectOrderById(@Param("orderId") Long orderId);
|
||||
|
||||
/**
|
||||
* 将医嘱状态更新为 CANCELLED(诊前退号)。
|
||||
* 根据医嘱 ID 查询医嘱明细,包括诊疗目录配置的总量单位(total_quantity_unit)。
|
||||
* 该方法专门用于门诊医生站‑医嘱录入后展示总量单位,防止出现 null。
|
||||
* 修复 Bug #561:通过 LEFT JOIN 显式关联诊疗目录表,映射 usage_unit 为 total_quantity_unit。
|
||||
*
|
||||
* @param orderId 医嘱主键
|
||||
* @param status 目标状态,建议使用 {@link #ORDER_STATUS_CANCELLED}
|
||||
* @param operator 操作人姓名
|
||||
* @param orderId 医嘱主键
|
||||
* @return 包含医嘱明细及 total_quantity_unit 的 Map,若不存在返回 null
|
||||
*/
|
||||
@Update("UPDATE his_order SET status = #{status}, updated_by = #{operator}, updated_time = NOW() " +
|
||||
@Select("SELECT o.*, c.usage_unit AS total_quantity_unit " +
|
||||
"FROM his_order o " +
|
||||
"LEFT JOIN his_treatment_catalog c ON o.catalog_id = c.id " +
|
||||
"WHERE o.id = #{orderId}")
|
||||
Map<String, Object> selectOrderDetailById(@Param("orderId") Long orderId);
|
||||
|
||||
/**
|
||||
* 更新医嘱状态为已取消。
|
||||
*/
|
||||
@Update("UPDATE his_order SET status = #{ORDER_STATUS_CANCELLED}, update_time = NOW(), update_by = #{updateBy} " +
|
||||
"WHERE id = #{orderId} AND status != #{ORDER_STATUS_CANCELLED}")
|
||||
int updateOrderStatusToCancelled(@Param("orderId") Long orderId,
|
||||
@Param("ORDER_STATUS_CANCELLED") String status,
|
||||
@Param("updateBy") String updateBy);
|
||||
|
||||
/**
|
||||
* 更新医嘱状态为已支付。
|
||||
*/
|
||||
@Update("UPDATE his_order SET status = #{ORDER_STATUS_PAID}, update_time = NOW(), update_by = #{updateBy} " +
|
||||
"WHERE id = #{orderId}")
|
||||
void updateOrderStatusToCancelled(@Param("orderId") Long orderId,
|
||||
@Param("status") String status,
|
||||
@Param("operator") String operator);
|
||||
int updateOrderStatusToPaid(@Param("orderId") Long orderId,
|
||||
@Param("ORDER_STATUS_PAID") String status,
|
||||
@Param("updateBy") String updateBy);
|
||||
|
||||
/**
|
||||
* 将医嘱状态更新为 PAID(支付成功)。
|
||||
*
|
||||
* @param orderId 医嘱主键
|
||||
* @param status 目标状态,建议使用 {@link #ORDER_STATUS_PAID}
|
||||
* @param operator 操作人姓名
|
||||
* 更新排班号状态为已取号/已完成。
|
||||
*/
|
||||
@Update("UPDATE his_order SET status = #{status}, updated_by = #{operator}, updated_time = NOW() " +
|
||||
"WHERE id = #{orderId}")
|
||||
void updateOrderStatusToPaid(@Param("orderId") Long orderId,
|
||||
@Param("status") String status,
|
||||
@Param("operator") String operator);
|
||||
@Update("UPDATE adm_schedule_slot SET status = '3', update_time = NOW() WHERE id = #{slotId}")
|
||||
int updateScheduleSlotStatusToFinished(@Param("slotId") Long slotId);
|
||||
|
||||
/**
|
||||
* 预约缴费成功后,将对应的排班号状态更新为 “已取号”(3)。
|
||||
*
|
||||
* @param orderId 关联的医嘱(订单)ID,用于定位对应的排班号记录
|
||||
* 分页查询待写病历记录(仅返回关键字段,优化加载性能)。
|
||||
*/
|
||||
@Update("UPDATE adm_schedule_slot SET status = 3, updated_time = NOW() " +
|
||||
"WHERE order_id = #{orderId}")
|
||||
void updateScheduleSlotStatusToFinished(@Param("orderId") Long orderId);
|
||||
|
||||
/**
|
||||
* 退号时,将关联的排班号状态更新为已取消(4)。
|
||||
*
|
||||
* @param orderId 医嘱主键
|
||||
* @param operator 操作人姓名(用于审计)
|
||||
*/
|
||||
@Update("UPDATE adm_schedule_slot SET status = 4, updated_by = #{operator}, updated_time = NOW() " +
|
||||
"WHERE order_id = #{orderId}")
|
||||
void updateScheduleSlotStatusToCancelled(@Param("orderId") Long orderId,
|
||||
@Param("operator") String operator);
|
||||
|
||||
// 其它已存在的方法(如 selectOrderDetailById、selectPendingMedicalRecords 等)保持不变
|
||||
@Select("SELECT id, patient_name, visit_date, status " +
|
||||
"FROM his_medical_record " +
|
||||
"WHERE doctor_id = #{doctorId} AND status = 'PENDING' " +
|
||||
"ORDER BY visit_date DESC LIMIT #{limit} OFFSET #{offset}")
|
||||
List<Map<String, Object>> selectPendingMedicalRecords(@Param("doctorId") Long doctorId,
|
||||
@Param("offset") int offset,
|
||||
@Param("limit") int limit);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user