Fix Bug #561: AI修复

This commit is contained in:
2026-05-27 01:25:51 +08:00
parent 4214bb94be
commit 5a20ae2edd
2 changed files with 38 additions and 46 deletions

View File

@@ -60,42 +60,37 @@ public interface OrderMapper {
*/
@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 " +
"LEFT JOIN his_medical_catalog c ON o.item_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 = #{status}, update_by = #{operator}, update_time = NOW() WHERE id = #{orderId}")
int updateOrderStatusToCancelled(@Param("orderId") Long orderId, @Param("status") String status, @Param("operator") String operator);
/**
* 更新关联排班号状态为已取消。
*/
@Update("UPDATE adm_schedule_slot SET status = 4, update_by = #{operator}, update_time = NOW() WHERE order_id = #{orderId}")
int updateScheduleSlotStatusToCancelled(@Param("orderId") Long orderId, @Param("operator") String operator);
/**
* 更新医嘱状态为已支付。
*/
@Update("UPDATE his_order SET status = #{ORDER_STATUS_PAID}, update_time = NOW(), update_by = #{updateBy} " +
"WHERE id = #{orderId}")
int updateOrderStatusToPaid(@Param("orderId") Long orderId,
@Param("ORDER_STATUS_PAID") String status,
@Param("updateBy") String updateBy);
@Update("UPDATE his_order SET status = #{status}, update_by = #{operator}, update_time = NOW() WHERE id = #{orderId}")
int updateOrderStatusToPaid(@Param("orderId") Long orderId, @Param("status") String status, @Param("operator") String operator);
/**
* 更新排班号状态为已取号/已完成
* 更新排班号状态为已取号(状态码 3
*/
@Update("UPDATE adm_schedule_slot SET status = '3', update_time = NOW() WHERE id = #{slotId}")
int updateScheduleSlotStatusToFinished(@Param("slotId") Long slotId);
@Update("UPDATE adm_schedule_slot SET status = 3, update_time = NOW() WHERE order_id = #{orderId}")
int updateScheduleSlotStatusToFinished(@Param("orderId") Long orderId);
/**
* 分页查询待写病历记录(仅返回关键字段,优化加载性能)
* 分页查询待写病历的医嘱关键信息
*/
@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);
@Select("SELECT id, patient_name, status, create_time FROM his_order WHERE status = 'PENDING' AND doctor_id = #{doctorId} ORDER BY create_time DESC LIMIT #{pageSize} OFFSET #{offset}")
List<Map<String, Object>> selectPendingMedicalRecords(@Param("doctorId") Long doctorId, @Param("offset") int offset, @Param("pageSize") int pageSize);
}