From f9e7b317627d82d3c7432d23e497748cbdf3b993 Mon Sep 17 00:00:00 2001 From: eight <641137800@qq.com> Date: 星期五, 22 十一月 2024 09:08:20 +0800 Subject: [PATCH] update --- jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java | 96 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 93 insertions(+), 3 deletions(-) diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java index f1ddcc6..4f67a2b 100644 --- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java @@ -3,9 +3,11 @@ import cn.lihu.jh.framework.common.pojo.CommonResult; import cn.lihu.jh.framework.security.core.util.SecurityFrameworkUtils; import cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo.JobRecordSaveReqVO; +import cn.lihu.jh.module.ecg.dal.dataobject.appointment.AppointmentDO; import cn.lihu.jh.module.ecg.dal.dataobject.checktype.CheckTypeDO; import cn.lihu.jh.module.ecg.dal.dataobject.devmanage.DeviceDO; import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordDO; +import cn.lihu.jh.module.ecg.dal.dataobject.patient.PatDetails; import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO; import cn.lihu.jh.module.ecg.dal.mysql.devmanage.DeviceMapper; import cn.lihu.jh.module.ecg.dal.mysql.jobrecord.JobRecordMapper; @@ -13,15 +15,21 @@ import cn.lihu.jh.module.ecg.enums.DevRentStateEnum; import cn.lihu.jh.module.ecg.enums.DevStateEnum; import cn.lihu.jh.module.ecg.enums.QueueStatusEnum; +import cn.lihu.jh.module.ecg.feign.*; +import cn.lihu.jh.module.ecg.feign.dto.AppointmentExternal; import cn.lihu.jh.module.ecg.service.queue.QueueServiceTxFunctions; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.dataformat.xml.XmlMapper; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; +import java.io.Console; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Map; import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*; import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO; @@ -33,6 +41,8 @@ import javax.annotation.Resource; import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.lihu.jh.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +import static cn.lihu.jh.framework.common.util.date.DateUtils.getCurTimeString; import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*; /** @@ -46,6 +56,9 @@ @Resource QueueServiceTxFunctions queueServiceTxFunctions; + + @Resource + private RemoteDataService remoteDataService; @Resource private DevRentMapper devRentMapper; @@ -72,8 +85,9 @@ Long userId = SecurityFrameworkUtils.getLoginUserId(); String userNickname = SecurityFrameworkUtils.getLoginUserNickname(); + String userHisId = SecurityFrameworkUtils.getLoginUserHisId(); - // 鍚屾牱 鍦ㄩ绾︾‘瀹炴椂 灏辫繘鍏� [dev_rent] 琛ㄤ簡 + // 鍚屾牱 鍦ㄩ绾︾‘璁ゆ椂 灏辫繘鍏� [dev_rent] 琛ㄤ簡 Long rent_id = createReqVO.getId(); List<Integer> jobTypeList = new ArrayList<Integer>(); @@ -155,7 +169,7 @@ Long rent_id = createReqVO.getId(); // dev_rent 琛ㄧ殑ID // 鏍囨敞璁惧 宸查鍙� - Integer ret = markDevRecieved(createReqVO.getDevId(), rent_id); + Integer ret = markDevRecieved(createReqVO.getDevId(), rent_id, createReqVO.getPatDetails()); if (null == ret || 0 == ret) { throw exception(DEVICE_NOT_FREE); } @@ -706,13 +720,14 @@ } // 鏍囪 璁惧宸茶棰嗗彇 - private Integer markDevRecieved(String devId, Long rentId) { + private Integer markDevRecieved(String devId, Long rentId, PatDetails patDetails) { // 璁惧鏍囨敞 宸查鍙� DeviceDO deviceDO = deviceMapper.getDeviceByDevId(devId); if (null != deviceDO && DevStateEnum.FREE.isEqual(deviceDO.getState())) { deviceDO.setState( DevStateEnum.RECEIVED.getState() ); deviceDO.setRentId( rentId ); deviceDO.setStateDate( LocalDate.now() ); + deviceDO.setPatDetails( patDetails ); return deviceMapper.updateById(deviceDO); } @@ -760,6 +775,7 @@ deviceDO.setState( DevStateEnum.FREE.getState() ); deviceDO.setStateDate( LocalDate.now() ); deviceDO.setRentId(null); + deviceDO.setPatDetails(null); return deviceMapper.updateById(deviceDO); } @@ -810,5 +826,79 @@ } } + private void feeConfirm(QueueDO queueItem, String hisId, String userNickname, Boolean isFeeConfirmOrCancel) { + PatDetails patDetails = queueItem.getPatDetails(); + + HisFeeConfirmReqBody hisFeeConfirmReqBody = new HisFeeConfirmReqBody(); + MsgHeader msgHeader = new MsgHeader(); + msgHeader.setMsgType("ODS_2212"); + msgHeader.setMsgVersion("3.0"); + msgHeader.setSender("ECG"); + hisFeeConfirmReqBody.setMsgHeader(msgHeader); + Item item = new Item(); + item.setItemCode( getHisCheckCode(queueItem.getBookCheckType()) ); // + item.setItemStatus( isFeeConfirmOrCancel? "5" : "6" ); // 5 纭垂 6 鍙栨秷纭垂 + item.setExeOrganization("47162057-2"); + item.setExeDeptName("蹇冪數绉�"); + item.setExeDept("蹇冪數绉�"); + item.setExeDoctor( hisId ); // + item.setExeDoctorName( userNickname ); // + item.setExeDateTime( getCurTimeString() ); // + ExmRequest exmRequest = new ExmRequest(); + exmRequest.setAuthorOrganization("47162057-2"); + exmRequest.setRequestId( patDetails.getApplyNo() ); // + exmRequest.setPatientType( getPatientType(patDetails.getSource()) ); // + exmRequest.setItem(item); + hisFeeConfirmReqBody.setExmRequest(exmRequest); + HisFeeConfirmRespResult result = remoteDataService.httpFeeApi("UpdateExmRequestStatus", "ECG", "ECG", hisFeeConfirmReqBody); + result.getMsgHeader().getStatus(); //TODO + } + + private String getHisCheckCode(Integer checkType) { + if (100 == checkType) + return "691133607"; + else if (200 == checkType) + return "201605"; + else if (300 == checkType) + return "200327"; + else if (400 == checkType) + return "201652"; + else if (500 == checkType) + return "502490914"; + else if (600 == checkType) + return "419562119"; + else if (700 == checkType) + return "201604"; + else if (800 == checkType) + return "1202042"; + else if (900 == checkType) + return "1202058"; + else if (1000 == checkType) + return "1202065"; + else if (1100 == checkType) + return "559542128"; + else if (1200 == checkType) + return "590244511"; + else if (1300 == checkType) + return "666454217"; + else if (1400 == checkType) + return "720791490"; + else if (1500 == checkType) + return "720792077"; + + return "691133607"; + } + + String getPatientType( Integer patientSource ) { + if (1 == patientSource || 2 == patientSource) + return "01"; + else if (3 == patientSource) + return "03"; + else if (4 == patientSource) + return "04"; + + return "01"; + } + } -- Gitblit v1.9.3