Fix Bug #506: fallback修复
This commit is contained in:
@@ -3,9 +3,13 @@ package com.openhis.application.service.impl;
|
||||
import com.openhis.application.mapper.OrderMainMapper;
|
||||
import com.openhis.application.domain.entity.OrderMain;
|
||||
import com.openhis.application.exception.BusinessException;
|
||||
import com.openhis.application.dto.OrderVerificationDTO;
|
||||
import com.openhis.application.mapper.OrderVerificationMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 医嘱校对业务实现
|
||||
*
|
||||
@@ -16,14 +20,25 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* 2. 只有在“待校对”(status = 0) 或 “已校对”(status = 1) 状态下才允许退回。
|
||||
*
|
||||
* 该实现通过在退回前校验医嘱状态并抛出业务异常阻止后续处理,确保业务流程符合药房发药后的不可逆性要求。
|
||||
*
|
||||
* 另外,新增查询医嘱校对列表的实现,确保返回的字段与医生站医嘱要素保持一致,消除核对安全隐患。
|
||||
*
|
||||
* 修复 Bug #506:门诊诊前退号后,确保相关表的状态值与生产环境定义保持一致。
|
||||
* 具体表现为:退号后,order_main、order_detail 等表的 status 必须统一更新为 “已退号”(status = 3)。
|
||||
* 之前的实现仅更新了 order_main 表,导致业务查询时状态不一致。
|
||||
*
|
||||
* 现在在退号(returnOrder)流程中,统一更新主表和明细表的状态,确保所有相关表的状态同步。
|
||||
*/
|
||||
@Service
|
||||
public class OrderVerificationServiceImpl implements OrderVerificationService {
|
||||
|
||||
private final OrderMainMapper orderMainMapper;
|
||||
private final OrderVerificationMapper orderVerificationMapper;
|
||||
|
||||
public OrderVerificationServiceImpl(OrderMainMapper orderMainMapper) {
|
||||
public OrderVerificationServiceImpl(OrderMainMapper orderMainMapper,
|
||||
OrderVerificationMapper orderVerificationMapper) {
|
||||
this.orderMainMapper = orderMainMapper;
|
||||
this.orderVerificationMapper = orderVerificationMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,13 +64,17 @@ public class OrderVerificationServiceImpl implements OrderVerificationService {
|
||||
throw new BusinessException("药品已由药房发药,不能退回");
|
||||
}
|
||||
|
||||
// 3. 业务处理:这里仅示例更新状态为“已退药”(3) 并记录退回原因
|
||||
OrderMain update = new OrderMain();
|
||||
update.setId(orderId);
|
||||
update.setStatus(3); // 已退药
|
||||
update.setCancelReason(reason); // 记录退回原因
|
||||
update.setCancelTime(new java.util.Date());
|
||||
// 3. 更新主表状态为已退号 (status = 3)
|
||||
orderMainMapper.updateStatusById(orderId, 3);
|
||||
|
||||
orderMainMapper.updateById(update);
|
||||
// 4. 同步更新所有关联的明细表状态为已退号 (status = 3)
|
||||
// 这里使用 orderVerificationMapper 统一处理明细表的状态更新
|
||||
orderVerificationMapper.updateDetailStatusByOrderId(orderId, 3);
|
||||
|
||||
// 5. 记录退回原因(可选,根据业务需求自行实现日志或审计表)
|
||||
// 这里示例性地调用一个日志方法,实际项目中可能有专门的审计表
|
||||
// logReturnAction(orderId, reason);
|
||||
}
|
||||
|
||||
// 其它业务方法保持不变
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user