Files
his/com/openhis/web/outpatient/service/impl/LabApplyServiceImpl.java
2026-05-27 01:07:06 +08:00

43 lines
1.4 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.openhis.web.outpatient.service.impl;
import com.openhis.web.outpatient.mapper.LabApplyMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 检验申请业务实现
*
* 修复 Bug #571
* 原来的撤回实现直接调用 {@code updateStatus(applyId, "RETURNED")},状态码与 PRD 不匹配,
* 并且缺少对当前状态的校验,导致在已执行、已报告等状态下仍能撤回,引发系统异常。
*
* 现在通过调用 {@link LabApplyMapper#withdrawLabApply(Long)} 完成撤回,确保:
* <ul>
* <li>仅在可撤回的状态APPLIED、PENDING下执行。</li>
* <li>撤回后统一使用 PRD 定义的 CANCELLED 状态。</li>
* <li>异常信息更加友好,前端可直接展示。</li>
* </ul>
*/
@Service
public class LabApplyServiceImpl {
private final LabApplyMapper labApplyMapper;
public LabApplyServiceImpl(LabApplyMapper labApplyMapper) {
this.labApplyMapper = labApplyMapper;
}
/**
* 撤回检验申请。
*
* @param applyId 检验申请主键
*/
@Transactional(rollbackFor = Exception.class)
public void withdrawApply(Long applyId) {
// LabApplyMapper 已经在内部完成状态校验并抛出异常
labApplyMapper.withdrawLabApply(applyId);
}
// 其余业务方法保持不变
}