From 1d2a7fa1aeddb40bb978bb1234178e0c9da04e38 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 08 四月 2025 22:47:01 +0800
Subject: [PATCH] just refactor - rename
---
/dev/null | 27 -----
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/MonitorInfoVO.java | 4
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java | 4
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Utils.java | 3
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/RoutingBedBO.java | 27 +++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java | 178 +++++++++++++++++-----------------
6 files changed, 120 insertions(+), 123 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Utils.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Utils.java
index c36b8f5..bd936db 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Utils.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Utils.java
@@ -1,8 +1,5 @@
package cn.lihu.jh.module.ecg;
-import cn.lihu.jh.module.ecg.service.queue.BedQueueBO;
-import jodd.typeconverter.impl.LocalTimeConverter;
-
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/MonitorInfoVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/MonitorInfoVO.java
index 549b0dd..eed03cd 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/MonitorInfoVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/MonitorInfoVO.java
@@ -1,6 +1,6 @@
package cn.lihu.jh.module.ecg.controller.admin.room.vo;
-import cn.lihu.jh.module.ecg.service.queue.BedQueueBO;
+import cn.lihu.jh.module.ecg.service.queue.RoutingBedBO;
import lombok.Data;
import java.util.Map;
@@ -13,5 +13,5 @@
private Integer routingBedNum;
private Integer openingFlag;
private Map<Integer, String> checkTypeBedInfo;
- private ConcurrentHashMap<String, BedQueueBO> mapBedVsQueue;
+ private ConcurrentHashMap<String, RoutingBedBO> mapBedVsQueue;
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedQueueBO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedQueueBO.java
deleted file mode 100644
index 4405965..0000000
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedQueueBO.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package cn.lihu.jh.module.ecg.service.queue;
-
-import lombok.Data;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-@Data
-public class BedQueueBO implements Comparable<BedQueueBO> {
- String bedNo;
- Long roomId;
- String roomName;
- AtomicInteger queueNum = new AtomicInteger(0);
- Integer maxQueueNum;
-
- /**
- * @see cn.lihu.jh.module.ecg.enums.BedStatusEnum
- */
- Integer status;
- Integer[] checkTypes;
- Integer opType;
-
- @Override
- public int compareTo(@NotNull BedQueueBO o) {
- return Integer.compare(this.queueNum.get(), o.queueNum.get());
- }
-}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java
index bfb2b81..4f761b9 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java
@@ -284,8 +284,8 @@
return error(ROOM_NOT_SIT);
}
- BedQueueBO bedQueueBO = queueServiceTxFunctions.getBedQueueBO(roomId, bedNo);
- if (null == bedQueueBO) {
+ RoutingBedBO routingBedBO = queueServiceTxFunctions.getBedQueueBO(roomId, bedNo);
+ if (null == routingBedBO) {
log.error("getRoom mapBedVsQueue DONOT existed. " + roomId + " " + bedNo);
return error(QUEUE_BED_NOT_EXIST);
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java
index ffb85d8..4ec390ca 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java
@@ -69,10 +69,10 @@
AtomicInteger curSeqNum = new AtomicInteger(0);
// 缁存姢 寮�鏀剧殑宸ヤ綅
- ConcurrentHashMap<String, BedQueueBO > mapOpeningBed = new ConcurrentHashMap<>();
+ ConcurrentHashMap<String, RoutingBedBO> mapOpeningBed = new ConcurrentHashMap<>();
// 瑁呮満宸ヤ綅..涓嶈繘鍏ュ垎娴侀槦鍒�
- Map<Integer, PriorityBlockingQueue<BedQueueBO>> mapCheckTypeRoutingQueue = new HashMap();
+ Map<Integer, PriorityBlockingQueue<RoutingBedBO>> mapCheckTypeRoutingQueue = new HashMap();
Map<Integer, CheckTypeDO> mapCheckTypeVsReadyMax = null;
@@ -83,8 +83,8 @@
* @return
*/
public ErrorCode bedOpen(Long roomId, String roomName, String bedNo) {
- BedQueueBO bedQueueBO2 = mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
- if (null != bedQueueBO2) {
+ RoutingBedBO routingBedBO2 = mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
+ if (null != routingBedBO2) {
log.error("bedOpen mapBedVsQueue has existed. " + roomId + " " + bedNo);
return QUEUE_BED_EXIST;
}
@@ -105,23 +105,23 @@
RoomDO roomDO = roomMapper.getRoom(roomId, bedNo);
// 鏂板..宸ヤ綅闃熷垪
- BedQueueBO bedQueueBO = new BedQueueBO();
- bedQueueBO.setRoomId(roomId);
- bedQueueBO.setRoomName(roomName);
- bedQueueBO.setBedNo(bedNo);
- bedQueueBO.setMaxQueueNum(getBedReadyMax(roomId, bedNo));
- bedQueueBO.setQueueNum(new AtomicInteger(queueDOList.size()));
- bedQueueBO.setStatus(BedStatusEnum.OPENING.getStatus());
- bedQueueBO.setCheckTypes( roomDO.getCheckTypes() );
- bedQueueBO.setOpType( roomDO.getOpType() );
- mapOpeningBed.put( Utils.formatRoomBed(roomId, bedNo), bedQueueBO);
+ RoutingBedBO routingBedBO = new RoutingBedBO();
+ routingBedBO.setRoomId(roomId);
+ routingBedBO.setRoomName(roomName);
+ routingBedBO.setBedNo(bedNo);
+ routingBedBO.setMaxReadyPatNum(getBedReadyMax(roomId, bedNo));
+ routingBedBO.setReadyPatNum(new AtomicInteger(queueDOList.size()));
+ routingBedBO.setStatus(BedStatusEnum.OPENING.getStatus());
+ routingBedBO.setCheckTypes( roomDO.getCheckTypes() );
+ routingBedBO.setOpType( roomDO.getOpType() );
+ mapOpeningBed.put( Utils.formatRoomBed(roomId, bedNo), routingBedBO);
return GlobalErrorCodeConstants.SUCCESS;
}
public ErrorCode bedClose(Long roomId, String bedNo) {
- BedQueueBO bedQueueBO = mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
- if (null == bedQueueBO) {
+ RoutingBedBO routingBedBO = mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
+ if (null == routingBedBO) {
log.error("bedClose mapBedVsQueue DONOT existed. " + roomId + " " + bedNo);
return QUEUE_BED_NOT_EXIST;
}
@@ -154,13 +154,13 @@
}
mapOpeningBed.remove( Utils.formatRoomBed(roomId, bedNo) );
- removeRoutingQueue(bedQueueBO);
+ removeRoutingQueue(routingBedBO);
return GlobalErrorCodeConstants.SUCCESS;
}
public ErrorCode bedDoctorPause(Long roomId, String bedNo, Long docId, String docName) {
- BedQueueBO bedQueueBO = mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
- if (null == bedQueueBO) {
+ RoutingBedBO routingBedBO = mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
+ if (null == routingBedBO) {
log.error("bedDoctorPause mapBedVsQueue DONOT existed. " + roomId + " " + bedNo);
return QUEUE_BED_NOT_EXIST;
}
@@ -174,14 +174,14 @@
return ROOM_INVALID_STATUS;
}
- bedQueueBO.setStatus(BedStatusEnum.PAUSE.getStatus());
- removeRoutingQueue(bedQueueBO);
+ routingBedBO.setStatus(BedStatusEnum.PAUSE.getStatus());
+ removeRoutingQueue(routingBedBO);
return GlobalErrorCodeConstants.SUCCESS;
}
public ErrorCode bedDoctorResume(Long roomId, String bedNo, Long docId, String docName) {
- BedQueueBO bedQueueBO = mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
- if (null == bedQueueBO || !bedQueueBO.getStatus().equals(BedStatusEnum.PAUSE.getStatus())) {
+ RoutingBedBO routingBedBO = mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
+ if (null == routingBedBO || !routingBedBO.getStatus().equals(BedStatusEnum.PAUSE.getStatus())) {
log.error("bedDoctorResume mapBedVsQueue DONOT existed OR NOT Paused. " + roomId + " " + bedNo);
return QUEUE_BED_NOT_EXIST;
}
@@ -196,14 +196,14 @@
return ROOM_INVALID_STATUS;
}
- bedQueueBO.setStatus(BedStatusEnum.DOCTOR_ON.getStatus());
- addRoutingQueue(bedQueueBO);
+ routingBedBO.setStatus(BedStatusEnum.DOCTOR_ON.getStatus());
+ addRoutingQueue(routingBedBO);
return GlobalErrorCodeConstants.SUCCESS;
}
public ErrorCode bedDoctorOn(Long roomId, String bedNo, Long docId, String docName) {
- BedQueueBO bedQueueBO = mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
- if (null == bedQueueBO) {
+ RoutingBedBO routingBedBO = mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
+ if (null == routingBedBO) {
log.error("bedDoctorOn mapBedVsQueue DONOT existed. " + roomId + " " + bedNo);
return QUEUE_BED_NOT_EXIST;
}
@@ -217,14 +217,14 @@
return ROOM_INVALID_STATUS;
}
- bedQueueBO.setStatus(BedStatusEnum.DOCTOR_ON.getStatus());
- addRoutingQueue(bedQueueBO);
+ routingBedBO.setStatus(BedStatusEnum.DOCTOR_ON.getStatus());
+ addRoutingQueue(routingBedBO);
return GlobalErrorCodeConstants.SUCCESS;
}
public ErrorCode bedDoctorOff(Long roomId, String bedNo, Long docId, String docName) {
- BedQueueBO bedQueueBO = mapOpeningBed.get( Utils.formatRoomBed( roomId, bedNo ) );
- if (null == bedQueueBO) {
+ RoutingBedBO routingBedBO = mapOpeningBed.get( Utils.formatRoomBed( roomId, bedNo ) );
+ if (null == routingBedBO) {
log.error("bedDoctorOff mapBedVsQueue DONOT existed. " + roomId + " " + bedNo);
return QUEUE_BED_NOT_EXIST;
}
@@ -239,9 +239,9 @@
return ROOM_INVALID_STATUS;
}
- removeRoutingQueue(bedQueueBO);
+ removeRoutingQueue(routingBedBO);
- bedQueueBO.setStatus(BedStatusEnum.OPENING.getStatus());
+ routingBedBO.setStatus(BedStatusEnum.OPENING.getStatus());
return GlobalErrorCodeConstants.SUCCESS;
}
@@ -278,8 +278,8 @@
queueMapper.updateById( firstReadyQueueItem );
// 鍒嗘祦闃熷垪涓� 璇ュ伐浣� 鍊欒瘖涓腑浜虹殑鏁伴噺 鍑忎竴
- BedQueueBO bo = mapOpeningBed.get( Utils.formatRoomBed( roomId, bedNo ) );
- bo.queueNum.getAndDecrement(); // 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 hurry-up 涓敼鍙樹簡鍊�
+ RoutingBedBO bo = mapOpeningBed.get( Utils.formatRoomBed( roomId, bedNo ) );
+ bo.readyPatNum.getAndDecrement(); // 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 hurry-up 涓敼鍙樹簡鍊�
refreshRoutingQueue(bo);
return GlobalErrorCodeConstants.SUCCESS;
@@ -332,21 +332,21 @@
bedStatusEnumList.add(BedStatusEnum.DOCTOR_ON);
bedStatusEnumList.add(BedStatusEnum.PAUSE);
List<RoomDO> roomDOList = roomMapper.simpleRoomList(bedStatusEnumList);
- List<BedQueueBO> bedQueueBOList = roomDOList.stream().map(item -> BeanUtils.toBean(item, BedQueueBO.class)).toList();
+ List<RoutingBedBO> routingBedBOList = roomDOList.stream().map(item -> BeanUtils.toBean(item, RoutingBedBO.class)).toList();
// 浠嶥B 鑾峰彇 闃熷垪涓� 銆愬�欒瘖涓�戜汉鍛樼粺璁� 鍒楄〃
List<Integer> queueStatusList = new ArrayList<>();
queueStatusList.add(QueueStatusEnum.READY.getStatus());
List<QueueStatisticDO> queueStatisticDOList = queueMapper.queueStatistic(queueStatusList);
- bedQueueBOList.forEach(item -> {
- item.setMaxQueueNum( getBedReadyMax(item.roomId, item.bedNo) );
+ routingBedBOList.forEach(item -> {
+ item.setMaxReadyPatNum( getBedReadyMax(item.roomId, item.bedNo) );
Optional<QueueStatisticDO> queueStatisticDOOptional = queueStatisticDOList.stream().filter(it->it.getRoomId()==item.roomId && it.getBedNo().equals(item.getBedNo())).findFirst();
int queueNum = queueStatisticDOOptional.isPresent() ? queueStatisticDOOptional.get().getTotalInStatus() : 0;
- if ( item.getMaxQueueNum() < queueNum )
+ if ( item.getMaxReadyPatNum() < queueNum )
throw new RuntimeException("init: exceed max queue number!");
- item.setQueueNum( new AtomicInteger(queueNum) );
+ item.setReadyPatNum( new AtomicInteger(queueNum) );
mapOpeningBed.put( Utils.formatRoomBed(item.roomId, item.bedNo), item);
if (BedStatusEnum.DOCTOR_ON.getStatus() == item.getStatus()) {
addRoutingQueue(item);
@@ -388,15 +388,15 @@
if (0 == openingFlag.get())
return;
- BedQueueBO bedQueueBO = getBedQueueBO(roomId, bedNo);
+ RoutingBedBO routingBedBO = getBedQueueBO(roomId, bedNo);
// 澶勭悊 杩囧彿-鍥炴潵 鐨勪汉
- while (bedQueueBO.queueNum.get() < bedQueueBO.maxQueueNum) {
+ while (routingBedBO.readyPatNum.get() < routingBedBO.maxReadyPatNum) {
// 鏌ョ湅 褰撳墠宸ヤ綅 鏄惁鏈夎繃鍙�-鍥炴潵鐨勬偅鑰�
Integer updateNum = queueMapper.queueRecalledPatient(
- bedQueueBO.getRoomId(),
- bedQueueBO.getRoomName(),
- bedQueueBO.getBedNo(),
+ routingBedBO.getRoomId(),
+ routingBedBO.getRoomName(),
+ routingBedBO.getBedNo(),
curSeqNum.get() + 1, // 杩囧彿鍥炴潵锛屾帓鍒板綋鍓嶇殑涓嬩竴浣�
QueueStatusEnum.RECALLED.getStatus(), // 涓嶉渶瑕佸鐞� [瀹夎鍙洖], 鍘熷洜: 瀹夎宸ヤ綅 涓嶈繘鍏ュ垎娴侀槦鍒�
QueueStatusEnum.READY.getStatus());
@@ -414,14 +414,14 @@
curSeqNum.getAndIncrement();
// 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 nextPatient 涓敼鍙樹簡鍊�
- bedQueueBO.queueNum.incrementAndGet();
+ routingBedBO.readyPatNum.incrementAndGet();
// 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 nextPatient 涓敼鍙樹簡鍒嗘祦闃熷垪椤哄簭
- refreshRoutingQueue(bedQueueBO);
+ refreshRoutingQueue(routingBedBO);
}
// 澶勭悊 鎺掗槦涓� 鎮h��
- hurryupOneBedCheckTypeList( bedQueueBO );
+ hurryupOneBedCheckTypeList(routingBedBO);
}
/**
@@ -433,31 +433,31 @@
*/
public void hurryupOneCheckType(Integer checkType) {
- PriorityBlockingQueue<BedQueueBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
+ PriorityBlockingQueue<RoutingBedBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
if (null == routingQueue)
return;
while (true) {
- BedQueueBO bedQueueBO = routingQueue.peek();
- if (null == bedQueueBO)
+ RoutingBedBO routingBedBO = routingQueue.peek();
+ if (null == routingBedBO)
return;
- int curQueueNum = bedQueueBO.queueNum.get();
- if (curQueueNum > bedQueueBO.maxQueueNum)
+ int curQueueNum = routingBedBO.readyPatNum.get();
+ if (curQueueNum > routingBedBO.maxReadyPatNum)
throw new RuntimeException("hurryupOneCheckType: exceed max queue number!");
- if (curQueueNum == bedQueueBO.maxQueueNum)
+ if (curQueueNum == routingBedBO.maxReadyPatNum)
return;
// 鏌ョ湅 鏄惁鏈夋帓闃熶腑鐨勬偅鑰�
Integer updateNum = queueMapper.preemptWaitingPatientWithBedCheckTypes(
- bedQueueBO.getRoomId(),
- bedQueueBO.getRoomName(),
- bedQueueBO.getBedNo(),
+ routingBedBO.getRoomId(),
+ routingBedBO.getRoomName(),
+ routingBedBO.getBedNo(),
curSeqNum.get() + 1,
QueueStatusEnum.WAITING.getStatus(),
QueueStatusEnum.READY.getStatus(),
- bedQueueBO.checkTypes); //鍏抽敭鐐� 鍏抽敭鐐� 鍏抽敭鐐� checkType
+ routingBedBO.checkTypes); //鍏抽敭鐐� 鍏抽敭鐐� 鍏抽敭鐐� checkType
// 娌℃湁鎶㈠埌鎺掗槦鎮h��
if (null == updateNum || 0 == updateNum) {
@@ -475,10 +475,10 @@
curSeqNum.getAndIncrement();
// 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 nextPatient 涓敼鍙樹簡鍊�
- bedQueueBO.queueNum.incrementAndGet();
+ routingBedBO.readyPatNum.incrementAndGet();
// 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 nextPatient 涓敼鍙樹簡鍒嗘祦闃熷垪椤哄簭
- refreshRoutingQueue(bedQueueBO);
+ refreshRoutingQueue(routingBedBO);
}
}
@@ -499,7 +499,7 @@
return mapCheckTypeVsReadyMax.get( checkType );
}
- public BedQueueBO getBedQueueBO(Long roomId, String bedNo) {
+ public RoutingBedBO getBedQueueBO(Long roomId, String bedNo) {
return mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
}
@@ -517,17 +517,17 @@
log.info(" opening " + openingFlag.get() + " " + monitorInfoVO.getOpeningBedNum() + " " + monitorInfoVO.getDocBedNum() + " " + monitorInfoVO.getCheckTypeBedInfo().toString() );
}
- private void hurryupOneBedCheckTypeList(BedQueueBO bedQueueBO) {
- while (bedQueueBO.queueNum.get() < bedQueueBO.maxQueueNum) {
+ private void hurryupOneBedCheckTypeList(RoutingBedBO routingBedBO) {
+ while (routingBedBO.readyPatNum.get() < routingBedBO.maxReadyPatNum) {
// 鎶㈠崰 鏄惁鏈夋帓闃熶腑鐨勬偅鑰�
Integer updateNum = queueMapper.preemptWaitingPatientWithBedCheckTypes(
- bedQueueBO.getRoomId(),
- bedQueueBO.getRoomName(),
- bedQueueBO.getBedNo(),
+ routingBedBO.getRoomId(),
+ routingBedBO.getRoomName(),
+ routingBedBO.getBedNo(),
curSeqNum.get() + 1,
QueueStatusEnum.WAITING.getStatus(),
QueueStatusEnum.READY.getStatus(),
- bedQueueBO.checkTypes);
+ routingBedBO.checkTypes);
// 娌℃湁鎶㈠埌鎺掗槦鎮h��
if (null == updateNum || 0 == updateNum) {
@@ -544,11 +544,11 @@
curSeqNum.getAndIncrement();
- bedQueueBO.queueNum.incrementAndGet();
+ routingBedBO.readyPatNum.incrementAndGet();
}
// 鏀瑰彉浜嗗垎娴侀槦鍒楅『搴�
- refreshRoutingQueue(bedQueueBO);
+ refreshRoutingQueue(routingBedBO);
}
/**
@@ -594,51 +594,51 @@
return ret;
}
- private void addRoutingQueue(BedQueueBO bedQueueBO) {
+ private void addRoutingQueue(RoutingBedBO routingBedBO) {
// 瑁呮満宸ヤ綅 涓嶈繘 鍒嗘祦闃熷垪锛屼笉鎺ユ敹 銆愭帓闃熶腑銆戞偅鑰呭垎娴�
- if (BedOpTypeEnum.OP_INSTALL.getOpType() == bedQueueBO.getOpType())
+ if (BedOpTypeEnum.OP_INSTALL.getOpType() == routingBedBO.getOpType())
return;
- Integer[] checkTypes = bedQueueBO.getCheckTypes();
+ Integer[] checkTypes = routingBedBO.getCheckTypes();
Arrays.stream(checkTypes).forEach(checkType -> {
CheckTypeDO checkTypeDO = mapCheckTypeVsReadyMax.get(checkType);
- PriorityBlockingQueue<BedQueueBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
+ PriorityBlockingQueue<RoutingBedBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
if (null == routingQueue) {
- routingQueue = new PriorityBlockingQueue<BedQueueBO>();
+ routingQueue = new PriorityBlockingQueue<RoutingBedBO>();
mapCheckTypeRoutingQueue.put( checkType, routingQueue );
}
- if (!routingQueue.contains(bedQueueBO)) {
- routingQueue.offer(bedQueueBO);
+ if (!routingQueue.contains(routingBedBO)) {
+ routingQueue.offer(routingBedBO);
} else {
- log.error("bedDoctorResume routingQueue still exist!. " + bedQueueBO.getRoomId() + " " + bedQueueBO.getBedNo());
+ log.error("bedDoctorResume routingQueue still exist!. " + routingBedBO.getRoomId() + " " + routingBedBO.getBedNo());
}
});
}
- private void removeRoutingQueue(BedQueueBO bedQueueBO) {
+ private void removeRoutingQueue(RoutingBedBO routingBedBO) {
// 瑁呮満宸ヤ綅 涓嶈繘 鍒嗘祦闃熷垪锛屼笉鎺ユ敹 銆愭帓闃熶腑銆戞偅鑰呭垎娴�
- if (BedOpTypeEnum.OP_INSTALL.getOpType() == bedQueueBO.getOpType())
+ if (BedOpTypeEnum.OP_INSTALL.getOpType() == routingBedBO.getOpType())
return;
- Integer[] checkTypes = bedQueueBO.getCheckTypes();
+ Integer[] checkTypes = routingBedBO.getCheckTypes();
Arrays.stream(checkTypes).forEach(checkType -> {
- PriorityBlockingQueue<BedQueueBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
+ PriorityBlockingQueue<RoutingBedBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
if (null != routingQueue)
- routingQueue.remove(bedQueueBO);
+ routingQueue.remove(routingBedBO);
});
}
- private void refreshRoutingQueue(BedQueueBO bedQueueBO) {
+ private void refreshRoutingQueue(RoutingBedBO routingBedBO) {
// 瑁呮満宸ヤ綅 涓嶈繘 鍒嗘祦闃熷垪锛屼笉鎺ユ敹 銆愭帓闃熶腑銆戞偅鑰呭垎娴�
- if (BedOpTypeEnum.OP_INSTALL.getOpType() == bedQueueBO.getOpType())
+ if (BedOpTypeEnum.OP_INSTALL.getOpType() == routingBedBO.getOpType())
return;
- Integer[] checkTypes = bedQueueBO.getCheckTypes();
+ Integer[] checkTypes = routingBedBO.getCheckTypes();
Arrays.stream(checkTypes).forEach(checkType -> {
- PriorityBlockingQueue<BedQueueBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
- routingQueue.remove(bedQueueBO);
- routingQueue.offer(bedQueueBO);
+ PriorityBlockingQueue<RoutingBedBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
+ routingQueue.remove(routingBedBO);
+ routingQueue.offer(routingBedBO);
});
}
@@ -688,7 +688,7 @@
});
// 鎺ユ敹..鎺掗槦涓偅鑰�..鐨勫垎娴侀槦鍒�
- HashSet<BedQueueBO> hashSetOperatingBedQueue = new HashSet<>();
+ HashSet<RoutingBedBO> hashSetOperatingBedQueue = new HashSet<>();
mapCheckTypeRoutingQueue.values().forEach(routingQueue->{
routingQueue.stream().forEach(bedQueueBO -> hashSetOperatingBedQueue.add(bedQueueBO));
});
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/RoutingBedBO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/RoutingBedBO.java
new file mode 100644
index 0000000..f509d04
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/RoutingBedBO.java
@@ -0,0 +1,27 @@
+package cn.lihu.jh.module.ecg.service.queue;
+
+import lombok.Data;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+@Data
+public class RoutingBedBO implements Comparable<RoutingBedBO> {
+ String bedNo;
+ Long roomId;
+ String roomName;
+ AtomicInteger readyPatNum = new AtomicInteger(0);
+ Integer maxReadyPatNum;
+
+ /**
+ * @see cn.lihu.jh.module.ecg.enums.BedStatusEnum
+ */
+ Integer status;
+ Integer[] checkTypes;
+ Integer opType;
+
+ @Override
+ public int compareTo(@NotNull RoutingBedBO o) {
+ return Integer.compare(this.readyPatNum.get(), o.readyPatNum.get());
+ }
+}
--
Gitblit v1.9.3