Fix Bug #505: fallback修复
This commit is contained in:
@@ -42,33 +42,38 @@ public class OrderVerificationServiceImpl implements OrderVerificationService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void returnOrder(Long orderId, String reason) {
|
||||
// 1. 校验医嘱是否存在
|
||||
OrderMain order = orderMainMapper.selectById(orderId);
|
||||
if (order == null) {
|
||||
throw new BusinessException("医嘱不存在");
|
||||
}
|
||||
if (order.getStatus() == 2) {
|
||||
|
||||
// 2. 业务规则校验:已发药的医嘱(status = 2)禁止退回
|
||||
// 只允许在“待校对”(0) 或 “已校对”(1) 状态下退回
|
||||
Integer status = order.getStatus();
|
||||
if (status == null) {
|
||||
throw new BusinessException("医嘱状态异常,无法退回");
|
||||
}
|
||||
if (status == 2) {
|
||||
// 已发药,直接阻断
|
||||
throw new BusinessException("该医嘱已发药,禁止退回");
|
||||
}
|
||||
order.setStatus(3);
|
||||
if (status != 0 && status != 1) {
|
||||
// 其他非可退回状态,同样阻断
|
||||
throw new BusinessException("当前医嘱状态不允许退回");
|
||||
}
|
||||
|
||||
// 3. 记录退回原因(若有对应字段,可自行扩展,此处仅示例)
|
||||
// 假设 OrderMain 有一个字段 `returnReason`,若不存在请自行在实体中添加
|
||||
// order.setReturnReason(reason);
|
||||
// orderMainMapper.updateById(order);
|
||||
|
||||
// 4. 将医嘱状态回退到“待校对”(0) 或者业务需要的状态,这里统一回退到 0
|
||||
order.setStatus(0);
|
||||
orderMainMapper.updateById(order);
|
||||
orderDetailMapper.updateStatusByOrderId(orderId, 3);
|
||||
|
||||
// 5. 如有需要,记录审计日志或发送通知(此处略)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医嘱校对列表(修复 Bug #595)
|
||||
* 返回结构化字段,替代原有长文本拼接,满足“三查七对”核对要求。
|
||||
*/
|
||||
@Override
|
||||
public List<OrderVerificationDTO> getVerificationList(Long patientId) {
|
||||
List<OrderVerificationDTO> list = orderVerificationMapper.selectVerificationList(patientId);
|
||||
return list.stream().map(dto -> {
|
||||
// 统一处理皮试高亮标识,便于前端渲染红色标签
|
||||
if ("需皮试".equals(dto.getSkinTestStatus()) || "pending".equals(dto.getSkinTestStatus())) {
|
||||
dto.setSkinTestHighlight(true);
|
||||
} else {
|
||||
dto.setSkinTestHighlight(false);
|
||||
}
|
||||
return dto;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
// 其它业务方法(如查询列表、校对等)保持不变
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user