eight
2025-04-01 b63358eeefeb4c7d0078cffe5dbba0380a740afc
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
@@ -10,6 +10,7 @@
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.appointment.AppointmentMapper;
import cn.lihu.jh.module.ecg.dal.mysql.checktype.CheckTypeMapper;
import cn.lihu.jh.module.ecg.dal.mysql.devmanage.DeviceMapper;
import cn.lihu.jh.module.ecg.dal.mysql.jobrecord.JobRecordMapper;
import cn.lihu.jh.module.ecg.dal.mysql.queue.QueueMapper;
@@ -74,6 +75,9 @@
    @Resource
    QueueMapper queueMapper;
    @Resource
    CheckTypeMapper checkTypeMapper;
    @Override
    public CommonResult<Long> registerOperation(DevRentSaveReqVO createReqVO) {
@@ -726,11 +730,18 @@
    }
    // 确费处理
    // 返回值:  0 成功  1 失败  2 不用确费
    @Override
    public Integer feeConfirm(Long rentId, String hisId, String userNickname, Boolean isFeeConfirmOrCancel) {
        DevRentDO devRentDO = devRentMapper.selectById(rentId);
        PatDetails patDetails = devRentDO.getPatDetails();
        // 查询检查类型,确定是否需要确费
        CheckTypeDO checkTypeDO = checkTypeMapper.getCheckTypeByValue(devRentDO.getCheckType());
        if (0 == checkTypeDO.getExpenseRecognition()) {
            return 2;
        }
        PatDetails patDetails = devRentDO.getPatDetails();
        HisFeeConfirmReqBody hisFeeConfirmReqBody = new HisFeeConfirmReqBody();
        MsgHeader msgHeader = new MsgHeader();
        msgHeader.setMsgType("ODS_2212");
@@ -758,7 +769,7 @@
        if (0 == returnValue) {
            devRentMapper.setPaid(rentId, isFeeConfirmOrCancel ? 1 : 0);
        }
        return returnValue;  // 0 成功  1 失败
        return returnValue;  // 0 成功  1 失败  2 不用确费
    }
    // 标记 设备已被领取
@@ -835,10 +846,15 @@
        }
    }
    /**
     * 领用完成,主动寻求依附
     */
    private void procAffinityWhenReadyFinish(/*IN,OUT*/QueueDO bedOnStageQueueItem, Integer[] affinityCheckTypes) {
        // 如果存在 [安装中] 亲和项,则跟随其中一个亲和项
        List<QueueDO> affinityInstallingItems = queueMapper.getCurPatGivenCheckTypesAndStatus(
                bedOnStageQueueItem.getPatId(), affinityCheckTypes, QueueStatusEnum.INSTALLING.getStatus());
        // 如果存在 [安装中] [安装过号] [安装召回] 能被依附的检查项,则依附到其中一个检查项
        List<QueueDO> affinityInstallingItems = queueMapper.getCurPatGivenCheckTypesAndStatusList(
                bedOnStageQueueItem.getPatId(), affinityCheckTypes,
                List.of(QueueStatusEnum.INSTALLING.getStatus(), QueueStatusEnum.PASSED_INSTALL.getStatus(),
                        QueueStatusEnum.RECALLED_INSTALL.getStatus()));
        if (!affinityInstallingItems.isEmpty()) {
            QueueDO affinityInstallingItem = affinityInstallingItems.get(0);
            bedOnStageQueueItem.setStatus(QueueStatusEnum.AFFINITY_RECEIVED.getStatus()); // 亲和-领用
@@ -856,6 +872,7 @@
        }
    }
    // 如果存在 [亲和-领用] 亲和项,则选择 其中一个亲和项 接替其 处于 [安装中]
    private void procAffinityWhenInstallFinish(QueueDO bedInstallingQueueItem, Integer[] affinityCheckTypes) {
        List<QueueDO> affinityAffinityReceivedItems = queueMapper.getCurPatGivenCheckTypesAndStatus(
                bedInstallingQueueItem.getPatId(), affinityCheckTypes, QueueStatusEnum.AFFINITY_RECEIVED.getStatus());