Fix Bug #495: 【医嘱闭环】已校对医嘱无法流转至"医嘱执行"界面,导致费用无法提交执行

后端SQL查询未过滤requestStatus(医嘱请求状态),导致医嘱执行页面的"待执行"tab
返回所有状态医嘱而非仅返回已校对(status=3)的医嘱。修复方式:
1. AdviceProcessAppMapper.java: 新增requestStatus参数
2. AdviceProcessAppMapper.xml: 在med_medication_request和wor_service_request子查询的
   WHERE条件中增加 AND T1.status_enum = #{requestStatus} 过滤
3. AdviceProcessAppServiceImpl.java: 保存requestStatus并传递给mapper,
   替代原注释"后端SQL已通过CASE条件处理"的错误假设

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
关羽
2026-05-15 00:21:32 +08:00
parent 64325a8493
commit b3de1dec38
3 changed files with 6 additions and 3 deletions

View File

@@ -178,7 +178,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
inpatientAdviceParam.setEncounterIds(null);
Integer exeStatus = inpatientAdviceParam.getExeStatus();
inpatientAdviceParam.setExeStatus(null);
// requestStatus由前端tab控制后端SQL已通过CASE条件处理校对状态过滤无需再作为SQL条件
Integer requestStatus = inpatientAdviceParam.getRequestStatus();
inpatientAdviceParam.setRequestStatus(null);
// 构建查询条件
QueryWrapper<InpatientAdviceParam> queryWrapper
@@ -198,7 +198,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
ParticipantType.ADMITTING_DOCTOR.getCode(), AccountType.PERSONAL_CASH_ACCOUNT.getCode(),
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.REFUNDED.getValue(), EncounterClass.IMP.getValue(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
GenerateSource.DOCTOR_PRESCRIPTION.getValue(), requestStatus);
inpatientAdvicePage.getRecords().forEach(e -> {
// 是否皮试
e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag()));

View File

@@ -69,5 +69,6 @@ public interface AdviceProcessAppMapper {
@Param("active") Integer active, @Param("bed") Integer bed, @Param("admittingDoctor") String admittingDoctor,
@Param("personalCashAccount") String personalCashAccount, @Param("billable") Integer billable,
@Param("billed") Integer billed, @Param("refunded") Integer refunded, @Param("imp") Integer imp,
@Param("doctorPrescription") Integer doctorPrescription);
@Param("doctorPrescription") Integer doctorPrescription,
@Param("requestStatus") Integer requestStatus);
}

View File

@@ -290,6 +290,7 @@
WHERE T1.delete_flag = '0'
AND T1.refund_medicine_id IS NULL
AND T1.generate_source_enum = #{doctorPrescription}
AND T1.status_enum = #{requestStatus}
AND CASE WHEN T1.status_enum = #{draft}
THEN T1.performer_check_id IS NOT NULL
ELSE 1=1 END
@@ -422,6 +423,7 @@
AND af.delete_flag = '0'
WHERE T1.delete_flag = '0'
AND T1.generate_source_enum = #{doctorPrescription}
AND T1.status_enum = #{requestStatus}
AND CASE WHEN T1.status_enum = #{draft}
THEN T1.performer_check_id IS NOT NULL
ELSE 1=1 END