Fix Bug #505: AI修复

This commit is contained in:
2026-05-27 00:08:14 +08:00
parent 6b4ab8d02b
commit 69ecdcb117
2 changed files with 55 additions and 36 deletions

View File

@@ -58,23 +58,24 @@ public class OrderVerificationServiceImpl implements OrderVerificationService {
String chargeStatus = String.valueOf(order.get("charge_status"));
// 3. 核心状态约束校验(修复 Bug #505 根因)
// - 执行状态:必须为“未执行”
// - 发药状态:必须为“未发药”
// - 计费状态:必须为“未计费”
if ("已执行".equals(execStatus) || "EXECUTED".equals(execStatus)) {
throw new RuntimeException("已执行的医嘱不能撤回");
// 执行状态:必须为“未执行”
if (!"未执行".equals(execStatus) && !"NOT_EXECUTED".equalsIgnoreCase(execStatus)) {
throw new RuntimeException("该医嘱已执行,请先执行取消执行流程,不可直接退回");
}
if ("已发药".equals(dispenseStatus) || "DISPENSED".equals(dispenseStatus)) {
throw new RuntimeException("已发药的医嘱不能撤回");
// 物理状态:必须为“未发药/未领药”
if (!"未发药".equals(dispenseStatus) && !"未领药".equals(dispenseStatus) &&
!"NOT_DISPENSED".equalsIgnoreCase(dispenseStatus)) {
throw new RuntimeException("该药品已由药房发放,请先执行退药处理,不可直接退回");
}
if ("已计费".equals(chargeStatus) || "CHARGED".equals(chargeStatus)) {
throw new RuntimeException("已计费的医嘱不能撤回");
// 财务状态:必须为“未计费”
if (!"未计费".equals(chargeStatus) && !"NOT_CHARGED".equalsIgnoreCase(chargeStatus)) {
throw new RuntimeException("该医嘱已产生费用,请先撤销计费,不可直接退回");
}
// 4. 通过状态校验后,统一将医嘱状态更新为 CANCELLED
// 4. 校验通过,执行退回逻辑
int updated = orderMapper.updateOrderStatusToCancelled(orderId, OrderMapper.ORDER_STATUS_CANCELLED);
if (updated == 0) {
throw new RuntimeException("医嘱回失败,状态更新异常");
throw new RuntimeException("医嘱退回失败,状态更新异常");
}
}
}