From ae9a96822ee46d07c5b30e6e641c126aebd704af Mon Sep 17 00:00:00 2001 From: wangjian963 <15215920+aprilry@user.noreply.gitee.com> Date: Tue, 31 Mar 2026 17:30:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(consultation):=20=E9=99=90=E5=88=B6?= =?UTF-8?q?=E4=BC=9A=E8=AF=8A=E7=94=B3=E8=AF=B7=E4=BD=9C=E5=BA=9F=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改会诊申请作废逻辑,仅允许新开和已提交状态可作废 前端界面同步调整作废按钮的禁用状态 后端增加状态校验防止非法操作 --- .../appservice/impl/ConsultationAppServiceImpl.java | 8 +++++++- .../web/consultation/enums/ConsultationStatusEnum.java | 6 ++++-- .../consultationapplication/index.vue | 7 ++++--- 3 files changed, 15 insertions(+), 6 deletions(-) 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 }