liusheng
5 天以前 376c1f1782fda955d0344dbcc1305dd5fb750448
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
@@ -24,8 +24,10 @@
import cn.lihu.jh.module.ecg.enums.QueueStatusEnum;
import cn.lihu.jh.module.ecg.feign.FeeConfirmFeignService;
import cn.lihu.jh.module.ecg.service.queue.QueueServiceTxFunctions;
import cn.lihu.jh.module.ecg.webservice.client.JHFWWebServiceClient;
import cn.lihu.jh.module.ecg.webservice.WebServiceClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
@@ -73,8 +75,11 @@
    @Resource
    CheckTypeMapper checkTypeMapper;
    @Resource
    private JHFWWebServiceClient jhfwWebServiceClient;
    @Autowired
    private WebServiceClient webServiceClient;
    @Value("${spring.profiles.active}")
    private String active;
    @Override
@@ -156,6 +161,34 @@
            procAffinityWhenRoutineFinish(firstOnStageQueueItem.getPatId(), checkTypeDO.getAffinityCheckTypes());
        }
        //检查完成后,此时检查登记写成了,需要将这个回写给集成平台(线上环境才回写)
        if (active.equals("prod")) {
            if (createReqVO.getCheckType() != 100 && createReqVO.getCheckType() != 1000 && createReqVO.getCheckType() != 1100 && createReqVO.getCheckType() != 1400 && createReqVO.getCheckType() != 1500) {
                AppointmentDO appointmentDO = appointmentMapper.getByApplyNo(createReqVO.getApplyNo());
                ApplicationTemplate app = new ApplicationTemplate();
                String action = "S0405";
                String message = app.getXML(createReqVO.getApplyNo(), "4", "取消检查", createReqVO.getOperater(), appointmentDO.getPatDeptCode(), appointmentDO.getPatDeptDesc(), appointmentDO.getPatWardCode(), appointmentDO.getPatWardDesc(), appointmentDO.getPatBedNo(), appointmentDO.getEpisodeId(), "" + appointmentDO.getBookSrc(), appointmentDO.getPatId(), appointmentDO.getPatName());
                String s = webServiceClient.callJHFWTYRK(action, "", message);
                log.info("routineFinishWebServiceClient的返回值为:{}", s);
                if (s.contains("更新成功")) {
                    //需要根据applyNo,将appiontment表里的status改成3
                    appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "4");
                }
            } else {
                //检查类型是床边的或常规的,需要根据applyNo,将appiontment表里的status改成7
                appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "7");
            }
        } else {
            if (createReqVO.getCheckType() != 100 && createReqVO.getCheckType() != 1000 && createReqVO.getCheckType() != 1100 && createReqVO.getCheckType() != 1400 && createReqVO.getCheckType() != 1500) {
                //需要根据applyNo,将appiontment表里的status改成3
                appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "4");
            } else {
                //检查类型是床边的或常规的,需要根据applyNo,将appiontment表里的status改成7
                appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "7");
            }
        }
        return CommonResult.success(rent_id);
    }
@@ -180,14 +213,22 @@
            throw exception(DEVICE_NOT_FREE);
        }
//        //设备领取完成后,此时检查登记写成了,需要将这个回写给集成平台
//        String action = "S0405";
//        String message = "";
        //设备领取完成后,此时检查登记写成了,需要将这个回写给集成平台(线上环境才回写)
        if (active.equals("prod")) {
            AppointmentDO appointmentDO = appointmentMapper.getByApplyNo(createReqVO.getApplyNo());
            ApplicationTemplate app = new ApplicationTemplate();
            String action = "S0405";
            String message = app.getXML(createReqVO.getApplyNo(), "3", "检查登记", createReqVO.getOperater(), appointmentDO.getPatDeptCode(), appointmentDO.getPatDeptDesc(), appointmentDO.getPatWardCode(), appointmentDO.getPatWardDesc(), appointmentDO.getPatBedNo(), appointmentDO.getEpisodeId(), "" + appointmentDO.getBookSrc(), appointmentDO.getPatId(), appointmentDO.getPatName());
            String s = webServiceClient.callJHFWTYRK(action, "", message);
            log.info("webservice的返回值为:{}", s);
            if (s.contains("更新成功")) {
                //需要根据applyNo,将appiontment表里的status改成3
                appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "3");
            }
        } else {
            appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "3");
//        jhfwWebServiceClient.callJHFWTYRK(action, message);
        }
        List<Integer> jobTypeList = new ArrayList<Integer>();
        jobTypeList.add(DevRentStateEnum.RECEIVED.getState());
        jobTypeList.add(DevRentStateEnum.RECEIVED_CANCELLED.getState());
@@ -446,6 +487,33 @@
            createReqVO.setState(DevRentStateEnum.ROUTINE_CANCELLED.getState());
            updateDevRent(createReqVO);
            if (active.equals("prod")) {
                if (cancelReqVO.getCheckType() != 100 && cancelReqVO.getCheckType() != 1000 && cancelReqVO.getCheckType() != 1100 && cancelReqVO.getCheckType() != 1400 && cancelReqVO.getCheckType() != 1500) {
                    AppointmentDO appointmentDO = appointmentMapper.getByApplyNo(createReqVO.getApplyNo());
                    ApplicationTemplate app = new ApplicationTemplate();
                    String action = "S0405";
                    String message = app.getXML(createReqVO.getApplyNo(), "4", "取消检查", createReqVO.getOperater(), appointmentDO.getPatDeptCode(), appointmentDO.getPatDeptDesc(), appointmentDO.getPatWardCode(), appointmentDO.getPatWardDesc(), appointmentDO.getPatBedNo(), appointmentDO.getEpisodeId(), "" + appointmentDO.getBookSrc(), appointmentDO.getPatId(), appointmentDO.getPatName());
                    String s = webServiceClient.callJHFWTYRK(action, "", message);
                    log.info("routineFinishWebServiceClient的返回值为:{}", s);
                    if (s.contains("更新成功")) {
                        //需要根据applyNo,将appiontment表里的status改成3
                        appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "4");
                    }
                } else {
                    //检查类型是床边的或常规的,需要根据applyNo,将appiontment表里的status改成7
                    appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "7");
                }
            } else {
                if (cancelReqVO.getCheckType() != 100 && cancelReqVO.getCheckType() != 1000 && cancelReqVO.getCheckType() != 1100 && cancelReqVO.getCheckType() != 1400 && cancelReqVO.getCheckType() != 1500) {
                    //需要根据applyNo,将appiontment表里的status改成3
                    appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "4");
                } else {
                    //检查类型是床边的或常规的,需要根据applyNo,将appiontment表里的status改成7
                    appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "7");
                }
            }
            JobRecordSaveReqVO jobRecordSaveReqVO = new JobRecordSaveReqVO();
            jobRecordSaveReqVO.setRentId(rent_id);
            jobRecordSaveReqVO.setDevId(null);
@@ -472,6 +540,11 @@
            jobRecordDO.setUpdateTime(LocalDateTime.now());
            jobRecordMapper.updateById(jobRecordDO);
        }
        QueueDO firstOnStageQueueItem = queueMapper.getBedFirstQueueItemByApplyNo(createReqVO.getApplyNo(), QueueStatusEnum.ONSTAGE.getStatus());
        // QueueStatusEnum.ONSTAGE  =>  QueueStatusEnum.FINISH
        firstOnStageQueueItem.setStatus(QueueStatusEnum.FINISH.getStatus());  // 默认状态 设置
        firstOnStageQueueItem.setUpdateTime(LocalDateTime.now());
        queueMapper.updateById(firstOnStageQueueItem);
        return CommonResult.success(rent_id);
    }
@@ -505,6 +578,29 @@
            createReqVO.setId(rent_id);
            createReqVO.setState(DevRentStateEnum.RECEIVED_CANCELLED.getState());
            updateDevRent(createReqVO);
            if (active.equals("prod")) {
                AppointmentDO appointmentDO = appointmentMapper.getByApplyNo(createReqVO.getApplyNo());
                ApplicationTemplate app = new ApplicationTemplate();
                String action = "S0405";
                String message = app.getXML(createReqVO.getApplyNo(), "4", "取消检查", createReqVO.getOperater(), appointmentDO.getPatDeptCode(), appointmentDO.getPatDeptDesc(), appointmentDO.getPatWardCode(), appointmentDO.getPatWardDesc(), appointmentDO.getPatBedNo(), appointmentDO.getEpisodeId(), "" + appointmentDO.getBookSrc(), appointmentDO.getPatId(), appointmentDO.getPatName());
                String s = webServiceClient.callJHFWTYRK(action, "", message);
                log.info("routineFinishWebServiceClient的返回值为:{}", s);
                if (s.contains("更新成功")) {
                    //需要根据applyNo,将appiontment表里的status改成3
                    appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "4");
                }
            } else {
                if (cancelReqVO.getCheckType() != 100 && cancelReqVO.getCheckType() != 1000 && cancelReqVO.getCheckType() != 1100 && cancelReqVO.getCheckType() != 1400 && cancelReqVO.getCheckType() != 1500) {
                    //需要根据applyNo,将appiontment表里的status改成3
                    appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "4");
                } else {
                    //检查类型是床边的或常规的,需要根据applyNo,将appiontment表里的status改成7
                    appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "7");
                }
            }
            JobRecordSaveReqVO jobRecordSaveReqVO = new JobRecordSaveReqVO();
            jobRecordSaveReqVO.setRentId(rent_id);
@@ -565,6 +661,28 @@
            createReqVO.setId(rent_id);
            createReqVO.setState(DevRentStateEnum.INSTALL_CANCELLED.getState());
            updateDevRent(createReqVO);
            if (active.equals("prod")) {
                AppointmentDO appointmentDO = appointmentMapper.getByApplyNo(createReqVO.getApplyNo());
                ApplicationTemplate app = new ApplicationTemplate();
                String action = "S0405";
                String message = app.getXML(createReqVO.getApplyNo(), "4", "取消检查", createReqVO.getOperater(), appointmentDO.getPatDeptCode(), appointmentDO.getPatDeptDesc(), appointmentDO.getPatWardCode(), appointmentDO.getPatWardDesc(), appointmentDO.getPatBedNo(), appointmentDO.getEpisodeId(), "" + appointmentDO.getBookSrc(), appointmentDO.getPatId(), appointmentDO.getPatName());
                String s = webServiceClient.callJHFWTYRK(action, "", message);
                log.info("routineFinishWebServiceClient的返回值为:{}", s);
                if (s.contains("更新成功")) {
                    //需要根据applyNo,将appiontment表里的status改成3
                    appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "4");
                }
            } else {
                if (cancelReqVO.getCheckType() != 100 && cancelReqVO.getCheckType() != 1000 && cancelReqVO.getCheckType() != 1100 && cancelReqVO.getCheckType() != 1400 && cancelReqVO.getCheckType() != 1500) {
                    //需要根据applyNo,将appiontment表里的status改成3
                    appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "4");
                } else {
                    //检查类型是床边的或常规的,需要根据applyNo,将appiontment表里的status改成7
                    appointmentMapper.updateStatusByApplyNo(createReqVO.getApplyNo(), "7");
                }
            }
            JobRecordSaveReqVO jobRecordSaveReqVO = new JobRecordSaveReqVO();
            jobRecordSaveReqVO.setRentId(rent_id);
@@ -886,6 +1004,5 @@
        return "01";
    }
}