diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/consultation/appservice/impl/ConsultationAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/consultation/appservice/impl/ConsultationAppServiceImpl.java index 72457271..0b9fd2f2 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/consultation/appservice/impl/ConsultationAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/consultation/appservice/impl/ConsultationAppServiceImpl.java @@ -465,7 +465,13 @@ public class ConsultationAppServiceImpl implements IConsultationAppService { updateServiceRequestStatus(entity.getOrderId(), RequestStatus.DRAFT.getValue()); } else { - // 作废:将状态改为"已取消" + // 作废:状态校验 - 已确认(20)、已签名(30)、已完成(40) 状态禁止作废 + ConsultationStatusEnum currentStatus = ConsultationStatusEnum.getByCode(entity.getConsultationStatus()); + if (currentStatus != null && !currentStatus.canCancel()) { + throw new IllegalArgumentException("当前状态【" + currentStatus.getDescription() + "】不允许作废,只有新开或已提交状态的会诊申请才能作废"); + } + + // 将状态改为"已取消" entity.setConsultationStatus(CANCELLED.getCode()); entity.setCancelReason(cancelReason); entity.setCancelNatureDate(new Date()); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/consultation/enums/ConsultationStatusEnum.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/consultation/enums/ConsultationStatusEnum.java index 72886204..8aded5d1 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/consultation/enums/ConsultationStatusEnum.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/consultation/enums/ConsultationStatusEnum.java @@ -76,10 +76,12 @@ public enum ConsultationStatusEnum { } /** - * 判断是否可以取消 + * 判断是否可以取消/作废 + * 只有新开(0)和已提交(10)状态可以作废 + * 已确认(20)、已签名(30)、已完成(40)状态禁止作废 */ public boolean canCancel() { - return this == NEW || this == SUBMITTED || this == CONFIRMED; + return this == NEW || this == SUBMITTED; } } diff --git a/openhis-ui-vue3/src/views/consultationmanagement/consultationapplication/index.vue b/openhis-ui-vue3/src/views/consultationmanagement/consultationapplication/index.vue index 613cd172..d915b961 100644 --- a/openhis-ui-vue3/src/views/consultationmanagement/consultationapplication/index.vue +++ b/openhis-ui-vue3/src/views/consultationmanagement/consultationapplication/index.vue @@ -174,7 +174,7 @@ size="small" :icon="Delete" @click="handleDelete(scope.row)" - :disabled="scope.row.consultationStatus >= STATUS.ENDED" + :disabled="scope.row.consultationStatus >= STATUS.CONFIRMED" title="作废" /> @@ -666,8 +666,9 @@ const handleSave = async () => { } const handleDelete = async (row) => { - if (row.consultationStatus >= STATUS.ENDED) { - ElMessage.warning('已结束的会诊申请不可作废') + // 已确认(20)、已签名(30)、已完成(40) 状态禁止作废 + if (row.consultationStatus >= STATUS.CONFIRMED) { + ElMessage.warning('已确认/已签名状态的会诊申请不可作废') return }