eight
2024-11-21 74868ba9e0775ccc21d02ef9e0f805bd1e6ae0aa
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
@@ -3,6 +3,7 @@
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;
@@ -14,11 +15,16 @@
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;
@@ -35,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.*;
/**
@@ -48,6 +56,9 @@
    @Resource
    QueueServiceTxFunctions queueServiceTxFunctions;
    @Resource
    private RemoteDataService remoteDataService;
    @Resource
    private DevRentMapper devRentMapper;
@@ -74,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>();
@@ -141,6 +153,8 @@
            procAffinityWhenRoutineFinish( firstOnStageQueueItem.getPatId(), checkTypeDO.getAffinityCheckTypes() );
        }
        // 确费处理
        feeConfirm(firstOnStageQueueItem, userHisId, userNickname);
        return CommonResult.success(rent_id);
    }
@@ -814,5 +828,79 @@
        }
    }
    private void feeConfirm(QueueDO queueItem, String hisId, String userNickname, Boolean isFeeConfirmCancel) throws JsonProcessingException {
        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( isFeeConfirmCancel? "6" : "5" ); //
        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();
    }
    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";
    }
}