From ae8070849c1f0a6cd067bd0bed2110e3edae7b69 Mon Sep 17 00:00:00 2001 From: liuhongrui Date: Wed, 12 Mar 2025 14:55:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E8=AF=8A=E7=9A=AE=E8=AF=95=20up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IOutpatientSkinTestRecordService.java | 13 +-- .../OutpatientSkinTestRecordServiceImpl.java | 94 ++++++++++++------- .../OutpatientSkinTestRecordController.java | 4 +- .../dto/OutpatientSkinTestRecordDto.java | 1 + .../OutpatientManageMapper.xml | 6 +- .../com/openhis/common/enums/EventStatus.java | 2 +- 6 files changed, 76 insertions(+), 44 deletions(-) diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientSkinTestRecordService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientSkinTestRecordService.java index 2de38042..c77a6e34 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientSkinTestRecordService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientSkinTestRecordService.java @@ -2,16 +2,12 @@ package com.openhis.web.outpatientmanage.appservice; import java.util.List; -import com.core.common.core.domain.R; import org.apache.ibatis.annotations.Param; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto; import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordSearchParam; import com.openhis.web.patientmanage.dto.PatientListDto; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; /** * 门诊管理 应用实现类 @@ -31,6 +27,11 @@ public interface IOutpatientSkinTestRecordService { */ List getSkinTestResult(); + /** + * 获取药品状态列表 + */ + List getMedicationStatus(); + /** * 分页查询门诊皮试记录,可选条件 * @@ -67,13 +68,13 @@ public interface IOutpatientSkinTestRecordService { * * @param outpatientSkinTestRecordDto 皮试记录信息 */ - int editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto); + boolean editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto); /** * 护士核对皮试结果后,确认签名(服务申请管理与过敏与不耐受的相关字段更新) * * @param outpatientSkinTestRecordDto 皮试记录信息 */ - int nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto); + boolean nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientSkinTestRecordServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientSkinTestRecordServiceImpl.java index 800fb6fc..82a05e05 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientSkinTestRecordServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientSkinTestRecordServiceImpl.java @@ -26,6 +26,7 @@ import com.openhis.clinical.domain.AllergyIntolerance; import com.openhis.clinical.mapper.AllergyIntoleranceMapper; import com.openhis.clinical.service.IAllergyIntoleranceService; import com.openhis.common.enums.ClinicalStatus; +import com.openhis.common.enums.EventStatus; import com.openhis.common.enums.VerificationStatus; import com.openhis.common.utils.EnumUtils; import com.openhis.web.outpatientmanage.appservice.IOutpatientSkinTestRecordService; @@ -59,7 +60,7 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR PractitionerRoleMapper practitionerRoleMapper; @Autowired - IAllergyIntoleranceService AllergyIntoleranceService; + IAllergyIntoleranceService allergyIntoleranceService; @Autowired IPractitionerRoleService practitionerRoleService; @@ -109,6 +110,24 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR return dtos; } + /** + * 获取药品状态列表 + */ + @Override + public List getMedicationStatus() { + // 获取药品状态列表 + List statusList = Arrays.asList(EventStatus.values()); + List dtos = new ArrayList<>(); + // 取得更新值 + for (EventStatus status : statusList) { + PatientListDto dto = new PatientListDto(); + dto.setValue(status.getValue()); + dto.setInfo(status.getInfo()); + dtos.add(dto); + } + return dtos; + } + /** * 分页查询门诊皮试记录,可选条件 * @@ -136,6 +155,9 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR // 皮试检查项目状态枚举类回显赋值 e.setVerificationStatusEnum_enumText( EnumUtils.getInfoByValue(VerificationStatus.class, e.getVerificationStatusEnum())); + // 药品状态状态枚举类回显赋值 + e.setMedicationStatusEnum_enumText( + EnumUtils.getInfoByValue(EventStatus.class, e.getMedicationStatusEnum())); }); return outpatientSkinTestRecordPage; } @@ -173,11 +195,12 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR * @param outpatientSkinTestRecordDto 皮试记录信息 */ @Override - public int editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) { - // 判断核对人是否不为空 - if (outpatientSkinTestRecordDto.getPerformerCheckId() != null) { - // 签名后不能修改 - return 0; + public boolean editSkinTestRecord(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) { + // 判断核对人是否不为空,药品状态不是已发药 + if (outpatientSkinTestRecordDto.getPerformerCheckId() != null + || outpatientSkinTestRecordDto.getMedicationStatusEnum() != EventStatus.COMPLETED.getValue()) { + // 签名后不能修改,未发药不能修改 + return false; } // 更新服务申请管理表 @@ -187,7 +210,7 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR // 判断开始时间为空,不允许更新表 if (StringUtils.isEmpty(outpatientSkinTestRecordDto.getOccurrenceStartTime())) { - return 0; + return false; } Date endTime; // 判断结束时间,为空以开始时间基础加10分钟 @@ -208,7 +231,7 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR Practitioner practitioner = practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId()); if (practitioner == null) { - return 0; + return false; } // 设置执行人ID serviceRequest.setPerformerId(practitioner.getId()); @@ -249,26 +272,20 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR // 设置备注 .setNote(outpatientSkinTestRecordDto.getNote()); - // 当皮试结果是为阳性的时候,设置过敏时间 - if (allergyIntolerance.getClinicalStatusEnum() == 0) { - // 设置过敏时间(当下日期) - allergyIntolerance.setOnsetDateTime(DateUtils.getNowDate()); - } - // 以服务申请ID为主条件更新过敏与不耐受表 UpdateWrapper updateWrapperAI = new UpdateWrapper<>(); updateWrapperAI.eq("request_id", allergyIntolerance.getRequestId()); - boolean result = AllergyIntoleranceService.saveOrUpdate(allergyIntolerance, updateWrapperAI); + boolean result = allergyIntoleranceService.saveOrUpdate(allergyIntolerance, updateWrapperAI); // 更新或插入失败 if (!result || countUpdate <= 0) { - return 0; + return false; } - return 1; + return true; } @Override - public int nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) { + public boolean nurseSignChkPs(OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) { // 过敏与不耐受表更新 QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -276,9 +293,10 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR AllergyIntolerance allergyIntolerance = allergyIntoleranceMapper.selectOne(queryWrapper); // 检查的状态是确定和反驳的时候,不更新 - if (allergyIntolerance == null || (allergyIntolerance.getVerificationStatusEnum() != 2 - && allergyIntolerance.getVerificationStatusEnum() != 3)) { - return 0; + if (allergyIntolerance == null + || (allergyIntolerance.getVerificationStatusEnum() != VerificationStatus.CONFIRMED.getValue() + && allergyIntolerance.getVerificationStatusEnum() != VerificationStatus.REFUTED.getValue())) { + return false; } // 更新服务申请管理表的 @@ -288,30 +306,42 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId()); // 找不到找到practitionerId时,不更新 if (practitioner == null) { - return 0; + return false; } // 设置核对人ID serviceRequest.setPerformerCheckId(practitioner.getId()); + // 把服务请求的状态设置为已完成 + serviceRequest.setStatusEnum(EventStatus.COMPLETED.getValue()); // 以id为主条件更新服务申请管理表 UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.eq("id", outpatientSkinTestRecordDto.getId()).set("performer_check_id", - serviceRequest.getPerformerCheckId()); + updateWrapper.eq("id", outpatientSkinTestRecordDto.getId()) + .set("performer_check_id", serviceRequest.getPerformerCheckId()) + .set("status_enum", serviceRequest.getStatusEnum()); boolean resultUpdateRequestService = serviceRequestService.update(null, updateWrapper); // 设置断言人 allergyIntolerance.setCheckPractitionerId(practitioner.getId()); - // 以服务申请ID为主条件更新服务申请管理表 - UpdateWrapper updateWrapperAI = new UpdateWrapper<>(); - updateWrapperAI.eq("request_id", outpatientSkinTestRecordDto.getId()).set("check_practitioner_id", - allergyIntolerance.getCheckPractitionerId()); - boolean resultUpdateAllergyIntolerance = serviceRequestService.update(updateWrapper); - if (resultUpdateRequestService && resultUpdateAllergyIntolerance) { - return 1; + // 当皮试结果是为阳性的时候,设置过敏时间 + if (allergyIntolerance.getClinicalStatusEnum() == ClinicalStatus.ACTIVE.getValue()) { + // 设置过敏时间(皮实结束时间) + allergyIntolerance + .setOnsetDateTime(DateUtils.parseDate(outpatientSkinTestRecordDto.getOccurrenceEndTime())); } - return 0; + // 以服务申请ID为主条件更新服务申请管理表 + UpdateWrapper updateWrapperAI = new UpdateWrapper<>(); + updateWrapperAI.eq("request_id", outpatientSkinTestRecordDto.getId()) + .set("check_practitioner_id", allergyIntolerance.getCheckPractitionerId()) + .set("onset_date_time", allergyIntolerance.getOnsetDateTime()); + boolean resultUpdateAllergyIntolerance = allergyIntoleranceService.update(null, updateWrapperAI); + + if (resultUpdateRequestService && resultUpdateAllergyIntolerance) { + return true; + } + + return false; } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientSkinTestRecordController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientSkinTestRecordController.java index f924b817..27fdea6e 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientSkinTestRecordController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientSkinTestRecordController.java @@ -55,7 +55,7 @@ public class OutpatientSkinTestRecordController { @PutMapping("/outpatient-record-skintest") public R editSkinTestRecord(@Validated @RequestBody OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) { - if (OutpatientSkinTestRecordService.editSkinTestRecord(outpatientSkinTestRecordDto) <= 0) { + if (!OutpatientSkinTestRecordService.editSkinTestRecord(outpatientSkinTestRecordDto)) { return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); } return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"皮试项目检查"})); @@ -69,7 +69,7 @@ public class OutpatientSkinTestRecordController { @PutMapping("/outpatient-record-signcheck") public R nurseSignChkPs(@Validated @RequestBody OutpatientSkinTestRecordDto outpatientSkinTestRecordDto) { - if (OutpatientSkinTestRecordService.nurseSignChkPs(outpatientSkinTestRecordDto) <= 0) { + if (!OutpatientSkinTestRecordService.nurseSignChkPs(outpatientSkinTestRecordDto)) { return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00003, null)); } return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"皮试记录护士核对签名"})); diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientSkinTestRecordDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientSkinTestRecordDto.java index 7e788db2..38cf73de 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientSkinTestRecordDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientSkinTestRecordDto.java @@ -72,6 +72,7 @@ public class OutpatientSkinTestRecordDto { /** 药品状态 */ private Integer medicationStatusEnum; + private String medicationStatusEnum_enumText; /** 皮试结果 */ private Integer clinicalStatusEnum; diff --git a/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml index c1a4a3e4..192fdba5 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml @@ -16,7 +16,7 @@ ad.name AS medicationInformation, --药品信息 md.bus_no || ' ' || md.name || ' 规格:' || COALESCE(m.total_volume, '') AS medicationDetail,--药品 m.lot_number AS medicationLotNumber, --药品批次号 - mr.status_enum, --药品状态 + mr.status_enum AS medicationStatusEnum, --药品状态 sr.performer_id, --执行护士 sr.performer_check_id,--核对人 to_char(sr.occurrence_start_time, 'YYYY-MM-DD HH24:MI:SS') AS occurrenceStartTime, --预计执行时间 @@ -39,7 +39,7 @@ ad.bus_no = 'ps001' -- 皮试检查的编号,todo:编号未定,后期修改 AND mr.skin_test_flag = 1 AND md.skin_test_flag = 1 - AND sr.status_enum = 2 --服务状态有效 + AND sr.status_enum in (2,3,6) --服务状态有效 AND ep.type_code = '1' --参与者身份类型是医生 @@ -95,7 +95,7 @@ ad.bus_no = 'ps001' -- 皮试检查的编号,todo:编号未定,后期修改 AND mr.skin_test_flag = 1 AND md.skin_test_flag = 1 - AND sr.status_enum = 2 --服务状态有效 + AND sr.status_enum in (2,3,6) --服务状态有效 AND ep.type_code = '1' --参与者身份类型是医生 diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/EventStatus.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/EventStatus.java index 04a86be8..40cfb096 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/EventStatus.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/EventStatus.java @@ -11,7 +11,7 @@ import lombok.Getter; */ @Getter @AllArgsConstructor -public enum EventStatus { +public enum EventStatus implements HisEnumInterface { /** * 草稿