yxh
2026-09-18 0fa1f4767affcd1879709ebea630016356836c75
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java
@@ -6,13 +6,16 @@
import cn.lihu.jh.module.ecg.Utils;
import cn.lihu.jh.module.ecg.controller.admin.room.vo.MonitorInfoVO;
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.devrent.DevRentDO;
import cn.lihu.jh.module.ecg.dal.mysql.appointment.AppointmentMapper;
import cn.lihu.jh.module.ecg.dal.mysql.devrent.DevRentMapper;
import cn.lihu.jh.module.ecg.enums.DevRentStateEnum;
import cn.lihu.jh.module.system.api.oauth2.OAuth2TokenApi;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.cxf.common.util.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -84,6 +87,24 @@
        // 更新
        QueueDO updateObj = BeanUtils.toBean(updateReqVO, QueueDO.class);
        queueMapper.updateById(updateObj);
    }
    public void updateStop(long roomId,String bedNo) {
        // 校验存在
       if(ObjectUtils.isNotEmpty(roomId)) {
           QueueDO updateObj=new QueueDO();
           updateObj.setStatus(40);
           UpdateWrapper<QueueDO> wrapper=new UpdateWrapper<>();
           wrapper.eq("room_id",roomId).eq("bed_no",bedNo).eq("status","30");
           queueMapper.update(updateObj,wrapper);
           QueueDO updateObj1=new QueueDO();
           updateObj1.setRoomId(0l);
           updateObj1.setBedNo(" ");
           UpdateWrapper<QueueDO> wrapper1=new UpdateWrapper<>();
           wrapper1.eq("room_id",roomId).eq("bed_no",bedNo).eq("status","20");
           queueMapper.update(updateObj1,wrapper1);
       }
    }
    @Override
@@ -298,9 +319,7 @@
    @Override
    public PageResult<QueueDO> getqueuePage(QueuePageReqVO pageReqVO) {
        PageResult<QueueDO> queueDOPageResult = queueMapper.selectPage(pageReqVO);
        queueDOPageResult.getList().forEach(queueDO -> {
            queueDO.setTolerance(appointmentMapper.getByApplyNo(queueDO.getApplyNo()).getTolerance());
        });
        fillAppointmentInfo(queueDOPageResult.getList());
        return queueDOPageResult;
    }
@@ -404,23 +423,42 @@
    public List<QueueDO> getBedQueueByStatus(Long roomId, String bedNo, List<Integer> statusList) {
        List<QueueDO> queueDOList = queueMapper.getBedQueueByStatus(roomId, bedNo, statusList);
        if (!CollectionUtils.isEmpty(queueDOList)) {
            queueDOList.forEach(queueDO -> {
                queueDO.setTolerance(appointmentMapper.getByApplyNo(queueDO.getApplyNo()).getTolerance());
            });
        }
        fillAppointmentInfo(queueDOList);
        return queueDOList;
    }
    /**
     * 从预约单补齐 queue 表上没有的患者信息。
     *
     * queue 表不存这些字段,但医生端列表接口需要展示,所以查询后按 applyNo 回查预约单填充:
     * 多耐药、性别、出生日期、登记时间、开单医师、开单日期。
     */
    private void fillAppointmentInfo(List<QueueDO> queueDOList) {
        if (CollectionUtils.isEmpty(queueDOList)) {
            return;
        }
        queueDOList.forEach(queueDO -> {
            if (null == queueDO.getApplyNo() || queueDO.getApplyNo().isEmpty()) {
                return;
            }
            AppointmentDO appointment = appointmentMapper.getByApplyNo(queueDO.getApplyNo());
            if (null == appointment) {
                return;
            }
            queueDO.setTolerance(appointment.getTolerance());
            queueDO.setPatGender(appointment.getPatGender());
            queueDO.setPatBirthday(appointment.getPatBirthday());
            queueDO.setRegisterDate(appointment.getRegisterDate());
            queueDO.setDoctor(appointment.getDoctor());
            queueDO.setDoctorTime(appointment.getDoctorTime());
        });
    }
    @Override
    public List<QueueDO> getRoomQueueByStatus(Long roomId, List<Integer> statusList) {
        List<QueueDO> queueDOList = queueMapper.getRoomQueueByStatus(roomId, statusList);
        if (!CollectionUtils.isEmpty(queueDOList)) {
            queueDOList.forEach(queueDO -> {
                queueDO.setTolerance(appointmentMapper.getByApplyNo(queueDO.getApplyNo()).getTolerance());
            });
        }
        fillAppointmentInfo(queueDOList);
        return queueDOList;
    }