| | |
| | | import cn.lihu.jh.framework.common.exception.ErrorCode; |
| | | import cn.lihu.jh.framework.common.exception.enums.GlobalErrorCodeConstants; |
| | | import cn.lihu.jh.framework.common.util.object.BeanUtils; |
| | | 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.checktype.CheckTypeDO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueStatisticDO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.call.CallMapper; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.checktype.CheckTypeMapper; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.devrent.DevRentMapper; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.queue.queueMapper; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.queue.QueueMapper; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.room.RoomMapper; |
| | | import cn.lihu.jh.module.ecg.enums.BedStatusEnum; |
| | | import cn.lihu.jh.module.ecg.enums.QueueStatusEnum; |
| | | import cn.lihu.jh.module.system.api.oauth2.OAuth2TokenApi; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | |
| | | import java.util.*; |
| | | import java.util.concurrent.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.lihu.jh.framework.common.pojo.CommonResult.error; |
| | |
| | | private OAuth2TokenApi oAuth2TokenApi; |
| | | |
| | | @Resource |
| | | private queueMapper queueMapper; |
| | | private QueueMapper queueMapper; |
| | | |
| | | @Resource |
| | | private RoomMapper roomMapper; |
| | |
| | | @Resource |
| | | private DevRentMapper devRentMapper; |
| | | |
| | | @Resource |
| | | private CheckTypeMapper checkTypeMapper; |
| | | |
| | | |
| | | AtomicInteger openingFlag = new AtomicInteger(0); |
| | | AtomicInteger curSeqNum = new AtomicInteger(0); |
| | | |
| | | ConcurrentHashMap<String, BedQueueBO > mapBedVsQueue = new ConcurrentHashMap<>(); |
| | | |
| | | //PriorityBlockingQueue<BedQueueBO> priorityQueue = new PriorityBlockingQueue<>(); |
| | | Map<Integer, PriorityBlockingQueue<BedQueueBO>> mapCheckTypeVsPriorityQueue = new HashMap(); |
| | | // 装机工位..不进入优先队列 |
| | | Map<Integer, PriorityBlockingQueue<BedQueueBO>> mapCheckTypePriorityQueue = new HashMap(); |
| | | |
| | | Map<Integer, Integer> mapCheckTypeVsReadyMax = null; |
| | | // 基于类型的, 装机准备的优先队列 |
| | | // Map<Integer, PriorityBlockingQueue<BedQueueBO>> mapReadyPriorityQueue = new HashMap(); |
| | | |
| | | Map<Integer, CheckTypeDO> mapCheckTypeVsReadyMax = null; |
| | | |
| | | /** |
| | | * 已关闭 或者 关闭中,可以开通工位 |
| | |
| | | * @return |
| | | */ |
| | | public ErrorCode bedOpen(Long roomId, String roomName, String bedNo) { |
| | | BedQueueBO bedQueueBO2 = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | BedQueueBO bedQueueBO2 = mapBedVsQueue.get( Utils.formatRoomBed(roomId, bedNo) ); |
| | | if (null != bedQueueBO2) { |
| | | log.error("bedOpen mapBedVsQueue has existed. " + roomId + " " + bedNo); |
| | | return QUEUE_BED_EXIST; |
| | |
| | | return ROOM_INVALID_STATUS; |
| | | } |
| | | |
| | | List<Byte> queueStatusList = new ArrayList<>(); |
| | | List<Integer> queueStatusList = new ArrayList<>(); |
| | | queueStatusList.add(QueueStatusEnum.READY.getStatus()); |
| | | List<QueueDO> queueDOList = queueMapper.getDoctorQueueByStatus(roomId, bedNo, queueStatusList); |
| | | List<QueueDO> queueDOList = queueMapper.getBedQueueByStatus(roomId, bedNo, queueStatusList); |
| | | |
| | | RoomDO roomDO = roomMapper.getRoom(roomId, bedNo); |
| | | |
| | |
| | | bedQueueBO.setStatus(BedStatusEnum.OPENING.getStatus()); |
| | | bedQueueBO.setCheckTypes( roomDO.getCheckTypes() ); |
| | | bedQueueBO.setOpType( roomDO.getOpType() ); |
| | | mapBedVsQueue.put(String.format("%09d%s", roomId, bedNo), bedQueueBO); |
| | | mapBedVsQueue.put( Utils.formatRoomBed(roomId, bedNo), bedQueueBO); |
| | | |
| | | return GlobalErrorCodeConstants.SUCCESS; |
| | | } |
| | | |
| | | public ErrorCode bedClose(Long roomId, String bedNo) { |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get( Utils.formatRoomBed(roomId, bedNo) ); |
| | | if (null == bedQueueBO) { |
| | | log.error("bedClose mapBedVsQueue DONOT existed. " + roomId + " " + bedNo); |
| | | return QUEUE_BED_NOT_EXIST; |
| | |
| | | // 除了判断 准备候诊中 的人数,还需要 判断 过号的人数 |
| | | //if (bedQueueBO.getQueueNum().get() >0) |
| | | // return QUEUE_HAVE_PATIENT; |
| | | List<Byte> queueStatusList = new ArrayList<>(); |
| | | List<Integer> queueStatusList = new ArrayList<>(); |
| | | queueStatusList.add(QueueStatusEnum.READY.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.PASSED.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.RECALLED.getStatus()); |
| | | List<QueueDO> queueDOList = queueMapper.getDoctorQueueByStatus(roomId, bedNo, queueStatusList); |
| | | List<QueueDO> queueDOList = queueMapper.getBedQueueByStatus(roomId, bedNo, queueStatusList); |
| | | if (queueDOList.size() > 0) |
| | | return QUEUE_HAVE_PATIENT; |
| | | |
| | |
| | | return ROOM_INVALID_STATUS; |
| | | } |
| | | |
| | | mapBedVsQueue.remove(String.format("%09d%s", roomId, bedNo)); |
| | | mapBedVsQueue.remove( Utils.formatRoomBed(roomId, bedNo) ); |
| | | removePriorityQueue(bedQueueBO); |
| | | return GlobalErrorCodeConstants.SUCCESS; |
| | | } |
| | | |
| | | public ErrorCode bedDoctorPause(Long roomId, String bedNo, Long docId, String docName) { |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get( Utils.formatRoomBed(roomId, bedNo) ); |
| | | if (null == bedQueueBO) { |
| | | log.error("bedDoctorPause mapBedVsQueue DONOT existed. " + roomId + " " + bedNo); |
| | | return QUEUE_BED_NOT_EXIST; |
| | |
| | | } |
| | | |
| | | public ErrorCode bedDoctorResume(Long roomId, String bedNo, Long docId, String docName) { |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get( Utils.formatRoomBed(roomId, bedNo) ); |
| | | if (null == bedQueueBO || !bedQueueBO.getStatus().equals(BedStatusEnum.PAUSE.getStatus())) { |
| | | log.error("bedDoctorResume mapBedVsQueue DONOT existed OR NOT Paused. " + roomId + " " + bedNo); |
| | | return QUEUE_BED_NOT_EXIST; |
| | |
| | | } |
| | | |
| | | public ErrorCode bedDoctorOn(Long roomId, String bedNo, Long docId, String docName) { |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get( Utils.formatRoomBed(roomId, bedNo) ); |
| | | if (null == bedQueueBO) { |
| | | log.error("bedDoctorOn mapBedVsQueue DONOT existed. " + roomId + " " + bedNo); |
| | | return QUEUE_BED_NOT_EXIST; |
| | |
| | | } |
| | | |
| | | public ErrorCode bedDoctorOff(Long roomId, String bedNo, Long docId, String docName) { |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get( Utils.formatRoomBed( roomId, bedNo ) ); |
| | | if (null == bedQueueBO) { |
| | | log.error("bedDoctorOff mapBedVsQueue DONOT existed. " + roomId + " " + bedNo); |
| | | return QUEUE_BED_NOT_EXIST; |
| | |
| | | return GlobalErrorCodeConstants.SUCCESS; |
| | | } |
| | | |
| | | // 常规 或者 领用 时 医生 取下一位患者 |
| | | public ErrorCode nextPatient(Long roomId, String bedNo) { |
| | | // 从 DB 把 序号最小的 就诊准备中的人 设置为就诊中 |
| | | Integer updateNum = queueMapper.updateQueueStatus(roomId, bedNo, |
| | | // 从 DB 把 序号最小的 [就诊准备中] 的人 设置为 [就诊中] (或领用中) |
| | | Integer updateNum = queueMapper.updateBedQueueStatus(roomId, bedNo, |
| | | QueueStatusEnum.READY.getStatus(), QueueStatusEnum.ONSTAGE.getStatus()); |
| | | // 该工位 没有 就诊准备中 人员 |
| | | // 该工位 没有 [就诊准备中] 人员 |
| | | if (null == updateNum || 0 == updateNum) { |
| | | return QUEUE_NOT_READY_PATIENT; |
| | | } |
| | | |
| | | // 优先队列中 该工位 就诊准备中人的数量 减一 |
| | | BedQueueBO bo = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | BedQueueBO bo = mapBedVsQueue.get( Utils.formatRoomBed( roomId, bedNo ) ); |
| | | bo.queueNum.getAndDecrement(); // 可能已经【并发的】在 hurry-up 中改变了值 |
| | | |
| | | removePriorityQueue(bo); |
| | | refreshPriorityQueue(bo); |
| | | return GlobalErrorCodeConstants.SUCCESS; |
| | | } |
| | | |
| | | // 装机时 医生 取下一位患者 |
| | | public ErrorCode nextInstallPatient(Long roomId, String bedNo) { |
| | | // 从 DB 把 序号最小的 [已领用] 的人 设置为 [安装中] |
| | | Integer updateNum = queueMapper.preemptToBeInstalledPatient(roomId, bedNo, |
| | | List.of(QueueStatusEnum.RECEIVED.getStatus(), QueueStatusEnum.RECALLED_INSTALL.getStatus()), |
| | | QueueStatusEnum.INSTALLING.getStatus()); |
| | | // 该工位 没有 [已领用] 人员 |
| | | if (null == updateNum || 0 == updateNum) { |
| | | return QUEUE_NOT_READY_PATIENT; |
| | | } |
| | | |
| | | // 装机工位 无优先队列 |
| | | // 优先队列中 该工位 [已领用]人的数量 减一 |
| | | //BedQueueBO bo = mapBedVsQueue.get( Utils.formatRoomBed( roomId, bedNo ) ); |
| | | //bo.queueNum.getAndDecrement(); // 可能已经【并发的】在 hurry-up 中改变了值 |
| | | //refreshPriorityQueue(bo); |
| | | |
| | | return GlobalErrorCodeConstants.SUCCESS; |
| | | } |
| | | |
| | |
| | | * 2. 服务运维重启时 |
| | | */ |
| | | public ErrorCode bedReload() { |
| | | mapCheckTypeVsPriorityQueue.clear(); |
| | | mapCheckTypePriorityQueue.clear(); |
| | | mapBedVsQueue.clear(); |
| | | |
| | | // 清除非当天的排队人员 |
| | |
| | | List<BedQueueBO> bedQueueBOList = roomDOList.stream().map(item -> BeanUtils.toBean(item, BedQueueBO.class)).toList(); |
| | | |
| | | // 从DB 获取 队列中 就诊准备中人员统计 列表 |
| | | List<Byte> queueStatusList = new ArrayList<>(); |
| | | List<Integer> queueStatusList = new ArrayList<>(); |
| | | queueStatusList.add(QueueStatusEnum.READY.getStatus()); |
| | | List<QueueStatisticDO> queueStatisticDOList = queueMapper.queueStatistic(queueStatusList); |
| | | |
| | |
| | | throw new RuntimeException("init: exceed max queue number!"); |
| | | |
| | | item.queueNum.set( queueNum ); |
| | | mapBedVsQueue.put(String.format("%09d%s", item.roomId, item.bedNo), item); |
| | | mapBedVsQueue.put( Utils.formatRoomBed(item.roomId, item.bedNo), item); |
| | | if (BedStatusEnum.DOCTOR_ON.getStatus() == item.getStatus()) { |
| | | addPriorityQueue(item); |
| | | } |
| | |
| | | bedQueueBO.getRoomName(), |
| | | bedQueueBO.getBedNo(), |
| | | curSeqNum.get() + 1, |
| | | QueueStatusEnum.RECALLED.getStatus(), |
| | | QueueStatusEnum.RECALLED.getStatus(), // 不需要处理 [安装召回], 原因: 安装工位 没有优先队列 |
| | | QueueStatusEnum.READY.getStatus()); |
| | | if (null == updateNum || 0 == updateNum) |
| | | break; |
| | |
| | | |
| | | public void hurryupOneCheckType(Integer checkType) { |
| | | |
| | | PriorityBlockingQueue<BedQueueBO> priorityQueue = mapCheckTypeVsPriorityQueue.get(checkType); |
| | | PriorityBlockingQueue<BedQueueBO> priorityQueue = mapCheckTypePriorityQueue.get(checkType); |
| | | if (null == priorityQueue) |
| | | return; |
| | | |
| | |
| | | return; |
| | | |
| | | // 查看 是否有排队中的患者 |
| | | Integer updateNum = queueMapper.preemptPatient( |
| | | Integer updateNum = queueMapper.preemptWaitingPatient( |
| | | bedQueueBO.getRoomId(), |
| | | bedQueueBO.getRoomName(), |
| | | bedQueueBO.getBedNo(), |
| | |
| | | openingFlag.set(flag); |
| | | } |
| | | |
| | | public void setCheckTypeReadyMax(Map<Integer, Integer> max) { |
| | | mapCheckTypeVsReadyMax = max; |
| | | public void initCheckType() { |
| | | List<CheckTypeDO> checkTypeDOList = checkTypeMapper.simpleCheckTypeList(); |
| | | mapCheckTypeVsReadyMax = checkTypeDOList.stream().collect(Collectors.toMap(CheckTypeDO::getValue, checkType -> checkType)); |
| | | } |
| | | |
| | | public BedQueueBO getBedQueueBO(Long roomId, String bedNo) { |
| | | return mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | return mapBedVsQueue.get( Utils.formatRoomBed(roomId, bedNo) ); |
| | | } |
| | | |
| | | public MonitorInfoVO getMonitorInfo() { |
| | | MonitorInfoVO monitorInfoVO = new MonitorInfoVO(); |
| | | monitorInfoVO.setOpeningFlag( openingFlag.get() ); |
| | | String[] arrStatInfo = roomBedStatistic(); |
| | | monitorInfoVO.setOpeningInfo(arrStatInfo[0]); |
| | | monitorInfoVO.setOperatingInfo(arrStatInfo[1]); |
| | | roomBedStatistic(monitorInfoVO); |
| | | |
| | | return monitorInfoVO; |
| | | } |
| | | |
| | | public void monitorInfo() { |
| | | String[] arrStatInfo = roomBedStatistic(); |
| | | log.info(" opening " + openingFlag.get() + " openingInfo " + arrStatInfo[0] + " operatingInfo " + arrStatInfo[1] ); |
| | | MonitorInfoVO monitorInfoVO = new MonitorInfoVO(); |
| | | roomBedStatistic(monitorInfoVO); |
| | | log.info(" opening " + openingFlag.get() + " " + monitorInfoVO.getQueueNum() + " " + monitorInfoVO.getActiveQueueNum() + " " + monitorInfoVO.getCheckTypeBedInfo().toString() ); |
| | | } |
| | | |
| | | private Integer getBedReadyMax(Long roomId, String bedNo) { |
| | |
| | | Integer[] checkTypes = roomDO.getCheckTypes(); |
| | | Integer ret = 0; |
| | | for (int i=0; i<checkTypes.length; i++) { |
| | | Integer tmp = mapCheckTypeVsReadyMax.get(checkTypes[i]); |
| | | CheckTypeDO checkTypeDO = mapCheckTypeVsReadyMax.get(checkTypes[i]); |
| | | Integer tmp = checkTypeDO.getReadyNum(); |
| | | ret = ret < tmp ? tmp : ret; //取大值 |
| | | } |
| | | return ret; |
| | |
| | | private void addPriorityQueue(BedQueueBO bedQueueBO) { |
| | | Integer[] checkTypes = bedQueueBO.getCheckTypes(); |
| | | Arrays.stream(checkTypes).forEach(checkType -> { |
| | | PriorityBlockingQueue<BedQueueBO> priorityQueue = mapCheckTypeVsPriorityQueue.get(checkType); |
| | | CheckTypeDO checkTypeDO = mapCheckTypeVsReadyMax.get(checkType); |
| | | // 装机工位 不进 优先队列,不从排队中接收人 |
| | | if (checkTypeDO.getNeedDevReady() == 1 && bedQueueBO.getOpType() == 2) { |
| | | return; |
| | | } |
| | | |
| | | PriorityBlockingQueue<BedQueueBO> priorityQueue = mapCheckTypePriorityQueue.get(checkType); |
| | | if (null == priorityQueue) { |
| | | priorityQueue = new PriorityBlockingQueue<BedQueueBO>(); |
| | | mapCheckTypePriorityQueue.put( checkType, priorityQueue ); |
| | | } |
| | | |
| | | if (!priorityQueue.contains(bedQueueBO)) { |
| | | priorityQueue.offer(bedQueueBO); |
| | | } else { |
| | |
| | | private void removePriorityQueue(BedQueueBO bedQueueBO) { |
| | | Integer[] checkTypes = bedQueueBO.getCheckTypes(); |
| | | Arrays.stream(checkTypes).forEach(checkType -> { |
| | | PriorityBlockingQueue<BedQueueBO> priorityBlockingQueue = mapCheckTypeVsPriorityQueue.get(checkType); |
| | | PriorityBlockingQueue<BedQueueBO> priorityBlockingQueue = mapCheckTypePriorityQueue.get(checkType); |
| | | if (null != priorityBlockingQueue) |
| | | priorityBlockingQueue.remove(bedQueueBO); |
| | | }); |
| | |
| | | private void refreshPriorityQueue(BedQueueBO bedQueueBO) { |
| | | Integer[] checkTypes = bedQueueBO.getCheckTypes(); |
| | | Arrays.stream(checkTypes).forEach(checkType -> { |
| | | PriorityBlockingQueue<BedQueueBO> priorityQueue = mapCheckTypeVsPriorityQueue.get(checkType); |
| | | PriorityBlockingQueue<BedQueueBO> priorityQueue = mapCheckTypePriorityQueue.get(checkType); |
| | | priorityQueue.remove(bedQueueBO); |
| | | priorityQueue.offer(bedQueueBO); |
| | | }); |
| | | } |
| | | |
| | | private String[] roomBedStatistic() { |
| | | private void roomBedStatistic(MonitorInfoVO monitorInfoVO) { |
| | | Map<Integer, Integer> mapOpeningCheckBedStatInfo = new HashMap<>(); |
| | | Map<Integer, Integer> mapOpeningReadyBedStatInfo = new HashMap<>(); |
| | | Map<Integer, Integer> mapOpeningInstallBedStatInfo = new HashMap<>(); |
| | | Map<Integer, Integer> mapOperatingCheckBedStatInfo = new HashMap<>(); |
| | | Map<Integer, Integer> mapOperatingReadyBedStatInfo = new HashMap<>(); |
| | | Map<Integer, Integer> mapOperatingInstallBedStatInfo = new HashMap<>(); |
| | | mapCheckTypeVsReadyMax.keySet().forEach( checkType -> { |
| | | mapOpeningCheckBedStatInfo.put(checkType, 0); |
| | | mapOpeningReadyBedStatInfo.put(checkType, 0); |
| | | mapOpeningInstallBedStatInfo.put(checkType, 0); |
| | | mapOperatingCheckBedStatInfo.put(checkType, 0); |
| | | mapOperatingReadyBedStatInfo.put(checkType, 0); |
| | | mapOperatingInstallBedStatInfo.put(checkType, 0); |
| | | }); |
| | | |
| | | //开通的工位统计 |
| | | //开通的 和 运营中 的工位统计 |
| | | mapBedVsQueue.values().forEach( bedQueueBO -> { |
| | | Integer[] checkTypes = bedQueueBO.getCheckTypes(); |
| | | Arrays.stream(checkTypes).forEach(checkType -> { |
| | | if (bedQueueBO.opType == 0) |
| | | if (bedQueueBO.opType == 0 || bedQueueBO.opType == 1) |
| | | mapOpeningCheckBedStatInfo.put(checkType, mapOpeningCheckBedStatInfo.get(checkType) + 1 ); |
| | | else |
| | | mapOpeningReadyBedStatInfo.put(checkType, mapOpeningReadyBedStatInfo.get(checkType) + 1 ); |
| | | mapOpeningInstallBedStatInfo.put(checkType, mapOpeningInstallBedStatInfo.get(checkType) + 1 ); |
| | | |
| | | if (bedQueueBO.getStatus() == BedStatusEnum.DOCTOR_ON.getStatus()) { |
| | | if (bedQueueBO.opType == 0 || bedQueueBO.opType == 1) |
| | | mapOperatingCheckBedStatInfo.put(checkType, mapOperatingCheckBedStatInfo.get(checkType) + 1); |
| | | else |
| | | mapOperatingInstallBedStatInfo.put(checkType, mapOperatingInstallBedStatInfo.get(checkType) + 1); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | String openingBedInfo = "总数:" + mapBedVsQueue.size() + " 检查工位数: " + mapOpeningCheckBedStatInfo.toString() + " 领用工位数: " + mapOpeningReadyBedStatInfo.toString(); |
| | | |
| | | //运营中工位统计 |
| | | // 接收..排队中患者..的优先队列 |
| | | HashSet<BedQueueBO> hashSetOperatingBedQueue = new HashSet<>(); |
| | | mapCheckTypeVsPriorityQueue.values().forEach(priorityQueue->{ |
| | | mapCheckTypePriorityQueue.values().forEach(priorityQueue->{ |
| | | priorityQueue.stream().forEach(bedQueueBO -> hashSetOperatingBedQueue.add(bedQueueBO)); |
| | | }); |
| | | |
| | | hashSetOperatingBedQueue.stream().forEach( bedQueueBO -> { |
| | | Integer[] checkTypes = bedQueueBO.getCheckTypes(); |
| | | Arrays.stream(checkTypes).forEach(checkType -> { |
| | | if (bedQueueBO.opType == 0) |
| | | mapOperatingCheckBedStatInfo.put(checkType, mapOperatingCheckBedStatInfo.get(checkType) + 1 ); |
| | | else |
| | | mapOperatingReadyBedStatInfo.put(checkType, mapOperatingReadyBedStatInfo.get(checkType) + 1 ); |
| | | }); |
| | | |
| | | Map<Integer, String> mapCheckTypeBedInfo = new HashMap<>(); |
| | | mapCheckTypeVsReadyMax.keySet().forEach( checkType -> { |
| | | String str = mapOpeningCheckBedStatInfo.get(checkType) + " " + |
| | | mapOpeningInstallBedStatInfo.get(checkType) + " " + |
| | | mapOperatingCheckBedStatInfo.get(checkType) + " " + |
| | | mapOperatingInstallBedStatInfo.get(checkType) + " "; |
| | | mapCheckTypeBedInfo.put( checkType, str); |
| | | }); |
| | | |
| | | String operatingBedInfo = "总数:" + hashSetOperatingBedQueue.size() + " 检查工位数: " + mapOperatingCheckBedStatInfo.toString() + " 领用工位数: " + mapOperatingReadyBedStatInfo.toString(); |
| | | |
| | | return new String[]{openingBedInfo, operatingBedInfo}; |
| | | monitorInfoVO.setCheckTypeBedInfo(mapCheckTypeBedInfo); |
| | | monitorInfoVO.setQueueNum(mapBedVsQueue.size()); |
| | | monitorInfoVO.setActiveQueueNum((int) mapBedVsQueue.values().stream().filter(item -> item.getStatus() == BedStatusEnum.DOCTOR_ON.getStatus()).count()); |
| | | monitorInfoVO.setPriorityQueueNum( hashSetOperatingBedQueue.size() ); |
| | | } |
| | | |
| | | } |