From d88aeadb43f3aa1ce9fe6a358c5466e721a53038 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 08 四月 2025 22:41:19 +0800
Subject: [PATCH] just refactopr 工位信息维护 分流队列维护
---
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/BedOpTypeEnum.java | 29 +++++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedQueueBO.java | 4 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/MonitorInfoVO.java | 6
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomDO.java | 4
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java | 179 ++++++++++++++++++++++++--------------------
README.md | 8 ++
6 files changed, 141 insertions(+), 89 deletions(-)
diff --git a/README.md b/README.md
index af01220..77b3884 100644
--- a/README.md
+++ b/README.md
@@ -35,3 +35,11 @@
05. 灏忓睆锛� 閮芥槸宸茬粡鍒嗘祦鐨� 鏈夊伐浣嶅拰鍐呴儴搴忓彿
+### 寮�璇婅缃�
+寮�璇婃椂闂达細6:30~23:59 1
+宸ヤ綅姒傚喌锛� 8 2 1 銆愬紑鏀剧殑宸ヤ綅 鏈夊尰鐢熺殑宸ヤ綅 鍙備笌鍒嗘祦鐨勫伐浣�(鍖荤敓鏆傚仠鐨勪笉璁″叆)銆�
+甯歌蹇冪數鍥� 3 0 0 0
+鍔ㄦ�佸績鐢� 1 2 1 1 銆愬紑鏀剧殑妫�鏌�/棰嗙敤宸ヤ綅 寮�鏀剧殑瀹夎宸ヤ綅 鏈夊尰鐢熺殑妫�鏌�/棰嗙敤宸ヤ綅 鏈夊尰鐢熺殑瀹夎宸ヤ綅銆�
+鍔ㄦ�佽鍘� 1 2 1 1
+骞虫澘杩愬姩蹇冪數 1 0 0 0
+鍔ㄨ剦纭寲鐩戞祴 1 0 0 0
diff --git a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/BedOpTypeEnum.java b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/BedOpTypeEnum.java
new file mode 100644
index 0000000..7d0f75c
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/BedOpTypeEnum.java
@@ -0,0 +1,29 @@
+package cn.lihu.jh.module.ecg.enums;
+
+import cn.lihu.jh.framework.common.core.IntArrayValuable;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.Arrays;
+
+/**
+ * 閫氱敤鐘舵�佹灇涓�
+ *
+ * @author 鑺嬮亾婧愮爜
+ */
+@Getter
+@AllArgsConstructor
+public enum BedOpTypeEnum {
+ OP_CHECK(0, "妫�鏌�"),
+ OP_RECEIVE(1, "棰嗙敤"),
+ OP_INSTALL(2, "瀹夎");
+
+ /**
+ * 鎿嶄綔绫诲瀷鍊�
+ */
+ private final Integer opType;
+ /**
+ * 鎿嶄綔绫诲瀷鍚�
+ */
+ private final String name;
+}
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 8d11b5a..549b0dd 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
@@ -8,9 +8,9 @@
@Data
public class MonitorInfoVO {
- private Integer queueNum;
- private Integer activeQueueNum;
- private Integer priorityQueueNum;
+ private Integer openingBedNum;
+ private Integer docBedNum;
+ private Integer routingBedNum;
private Integer openingFlag;
private Map<Integer, String> checkTypeBedInfo;
private ConcurrentHashMap<String, BedQueueBO> mapBedVsQueue;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomDO.java
index 49e25fd..0ae5e35 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomDO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomDO.java
@@ -65,9 +65,7 @@
private Integer[] checkTypes;
/**
- * 0 妫�鏌�
- * 1 棰嗙敤
- * 2 瑁呮満
+ * @see cn.lihu.jh.module.ecg.enums.BedOpTypeEnum
*/
private Integer opType;
}
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
index 7431881..4405965 100644
--- 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
@@ -12,6 +12,10 @@
String roomName;
AtomicInteger queueNum = new AtomicInteger(0);
Integer maxQueueNum;
+
+ /**
+ * @see cn.lihu.jh.module.ecg.enums.BedStatusEnum
+ */
Integer status;
Integer[] checkTypes;
Integer opType;
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 c87aa2f..ffb85d8 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
@@ -14,6 +14,7 @@
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.room.RoomMapper;
+import cn.lihu.jh.module.ecg.enums.BedOpTypeEnum;
import cn.lihu.jh.module.ecg.enums.BedStatusEnum;
import cn.lihu.jh.module.ecg.enums.QueueStatusEnum;
import cn.lihu.jh.module.infra.api.config.ConfigApi;
@@ -67,14 +68,12 @@
AtomicInteger openingFlag = new AtomicInteger(0);
AtomicInteger curSeqNum = new AtomicInteger(0);
- ConcurrentHashMap<String, BedQueueBO > mapBedVsQueue = new ConcurrentHashMap<>();
+ // 缁存姢 寮�鏀剧殑宸ヤ綅
+ ConcurrentHashMap<String, BedQueueBO > mapOpeningBed = new ConcurrentHashMap<>();
- // 瑁呮満宸ヤ綅..涓嶈繘鍏ヤ紭鍏堥槦鍒�
- Map<Integer, PriorityBlockingQueue<BedQueueBO>> mapCheckTypePriorityQueue = new HashMap();
-
- // 鍩轰簬绫诲瀷鐨�, 瑁呮満鍑嗗鐨勪紭鍏堥槦鍒�
- // Map<Integer, PriorityBlockingQueue<BedQueueBO>> mapReadyPriorityQueue = new HashMap();
-
+ // 瑁呮満宸ヤ綅..涓嶈繘鍏ュ垎娴侀槦鍒�
+ Map<Integer, PriorityBlockingQueue<BedQueueBO>> mapCheckTypeRoutingQueue = new HashMap();
+
Map<Integer, CheckTypeDO> mapCheckTypeVsReadyMax = null;
/**
@@ -84,7 +83,7 @@
* @return
*/
public ErrorCode bedOpen(Long roomId, String roomName, String bedNo) {
- BedQueueBO bedQueueBO2 = mapBedVsQueue.get( Utils.formatRoomBed(roomId, bedNo) );
+ BedQueueBO bedQueueBO2 = mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
if (null != bedQueueBO2) {
log.error("bedOpen mapBedVsQueue has existed. " + roomId + " " + bedNo);
return QUEUE_BED_EXIST;
@@ -115,25 +114,29 @@
bedQueueBO.setStatus(BedStatusEnum.OPENING.getStatus());
bedQueueBO.setCheckTypes( roomDO.getCheckTypes() );
bedQueueBO.setOpType( roomDO.getOpType() );
- mapBedVsQueue.put( Utils.formatRoomBed(roomId, bedNo), bedQueueBO);
+ mapOpeningBed.put( Utils.formatRoomBed(roomId, bedNo), bedQueueBO);
return GlobalErrorCodeConstants.SUCCESS;
}
public ErrorCode bedClose(Long roomId, String bedNo) {
- BedQueueBO bedQueueBO = mapBedVsQueue.get( Utils.formatRoomBed(roomId, bedNo) );
+ BedQueueBO bedQueueBO = mapOpeningBed.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<Integer> queueStatusList = new ArrayList<>();
queueStatusList.add(QueueStatusEnum.READY.getStatus());
+ queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus());
+ queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus());
queueStatusList.add(QueueStatusEnum.PASSED.getStatus());
+ queueStatusList.add(QueueStatusEnum.PASSED_INSTALL.getStatus());
queueStatusList.add(QueueStatusEnum.RECALLED.getStatus());
+ queueStatusList.add(QueueStatusEnum.RECALLED_INSTALL.getStatus());
+ queueStatusList.add(QueueStatusEnum.AFFINITY.getStatus());
+ queueStatusList.add(QueueStatusEnum.AFFINITY_INSTALL.getStatus());
List<QueueDO> queueDOList = queueMapper.getBedQueueByStatus(roomId, bedNo, queueStatusList);
if (queueDOList.size() > 0)
return QUEUE_HAVE_PATIENT;
@@ -150,13 +153,13 @@
return ROOM_INVALID_STATUS;
}
- mapBedVsQueue.remove( Utils.formatRoomBed(roomId, bedNo) );
- removePriorityQueue(bedQueueBO);
+ mapOpeningBed.remove( Utils.formatRoomBed(roomId, bedNo) );
+ removeRoutingQueue(bedQueueBO);
return GlobalErrorCodeConstants.SUCCESS;
}
public ErrorCode bedDoctorPause(Long roomId, String bedNo, Long docId, String docName) {
- BedQueueBO bedQueueBO = mapBedVsQueue.get( Utils.formatRoomBed(roomId, bedNo) );
+ BedQueueBO bedQueueBO = mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
if (null == bedQueueBO) {
log.error("bedDoctorPause mapBedVsQueue DONOT existed. " + roomId + " " + bedNo);
return QUEUE_BED_NOT_EXIST;
@@ -172,12 +175,12 @@
}
bedQueueBO.setStatus(BedStatusEnum.PAUSE.getStatus());
- removePriorityQueue(bedQueueBO);
+ removeRoutingQueue(bedQueueBO);
return GlobalErrorCodeConstants.SUCCESS;
}
public ErrorCode bedDoctorResume(Long roomId, String bedNo, Long docId, String docName) {
- BedQueueBO bedQueueBO = mapBedVsQueue.get( Utils.formatRoomBed(roomId, bedNo) );
+ BedQueueBO bedQueueBO = mapOpeningBed.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;
@@ -194,12 +197,12 @@
}
bedQueueBO.setStatus(BedStatusEnum.DOCTOR_ON.getStatus());
- addPriorityQueue(bedQueueBO);
+ addRoutingQueue(bedQueueBO);
return GlobalErrorCodeConstants.SUCCESS;
}
public ErrorCode bedDoctorOn(Long roomId, String bedNo, Long docId, String docName) {
- BedQueueBO bedQueueBO = mapBedVsQueue.get( Utils.formatRoomBed(roomId, bedNo) );
+ BedQueueBO bedQueueBO = mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
if (null == bedQueueBO) {
log.error("bedDoctorOn mapBedVsQueue DONOT existed. " + roomId + " " + bedNo);
return QUEUE_BED_NOT_EXIST;
@@ -215,12 +218,12 @@
}
bedQueueBO.setStatus(BedStatusEnum.DOCTOR_ON.getStatus());
- addPriorityQueue(bedQueueBO);
+ addRoutingQueue(bedQueueBO);
return GlobalErrorCodeConstants.SUCCESS;
}
public ErrorCode bedDoctorOff(Long roomId, String bedNo, Long docId, String docName) {
- BedQueueBO bedQueueBO = mapBedVsQueue.get( Utils.formatRoomBed( roomId, bedNo ) );
+ BedQueueBO bedQueueBO = mapOpeningBed.get( Utils.formatRoomBed( roomId, bedNo ) );
if (null == bedQueueBO) {
log.error("bedDoctorOff mapBedVsQueue DONOT existed. " + roomId + " " + bedNo);
return QUEUE_BED_NOT_EXIST;
@@ -236,7 +239,7 @@
return ROOM_INVALID_STATUS;
}
- removePriorityQueue(bedQueueBO);
+ removeRoutingQueue(bedQueueBO);
bedQueueBO.setStatus(BedStatusEnum.OPENING.getStatus());
return GlobalErrorCodeConstants.SUCCESS;
@@ -253,11 +256,11 @@
return QUEUE_NOT_READY_PATIENT;
}
- // 浼樺厛闃熷垪涓� 璇ュ伐浣� 鍊欒瘖涓腑浜虹殑鏁伴噺 鍑忎竴
+ // 鍒嗘祦闃熷垪涓� 璇ュ伐浣� 鍊欒瘖涓腑浜虹殑鏁伴噺 鍑忎竴
BedQueueBO bo = mapBedVsQueue.get( Utils.formatRoomBed( roomId, bedNo ) );
bo.queueNum.getAndDecrement(); // 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 hurry-up 涓敼鍙樹簡鍊�
- refreshPriorityQueue(bo);
+ refreshRoutingQueue(bo);
return GlobalErrorCodeConstants.SUCCESS;
}
*/
@@ -274,11 +277,11 @@
firstReadyQueueItem.setStatus(QueueStatusEnum.ONSTAGE.getStatus());
queueMapper.updateById( firstReadyQueueItem );
- // 浼樺厛闃熷垪涓� 璇ュ伐浣� 鍊欒瘖涓腑浜虹殑鏁伴噺 鍑忎竴
- BedQueueBO bo = mapBedVsQueue.get( Utils.formatRoomBed( roomId, bedNo ) );
+ // 鍒嗘祦闃熷垪涓� 璇ュ伐浣� 鍊欒瘖涓腑浜虹殑鏁伴噺 鍑忎竴
+ BedQueueBO bo = mapOpeningBed.get( Utils.formatRoomBed( roomId, bedNo ) );
bo.queueNum.getAndDecrement(); // 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 hurry-up 涓敼鍙樹簡鍊�
- refreshPriorityQueue(bo);
+ refreshRoutingQueue(bo);
return GlobalErrorCodeConstants.SUCCESS;
}
@@ -301,22 +304,22 @@
procAffinityWhenSomeOneEntryInstalling(firstItem.getPatId(), roomId, bedNo, checkTypeDO.getAffinityCheckTypes() );
}
- // 瑁呮満宸ヤ綅 鏃犱紭鍏堥槦鍒�
- // 浼樺厛闃熷垪涓� 璇ュ伐浣� [宸查鐢╙浜虹殑鏁伴噺 鍑忎竴
+ // 瑁呮満宸ヤ綅 涓嶈繘鍏� 鍒嗘祦闃熷垪
+ // 鍒嗘祦闃熷垪涓� 璇ュ伐浣� [宸查鐢╙浜虹殑鏁伴噺 鍑忎竴
//BedQueueBO bo = mapBedVsQueue.get( Utils.formatRoomBed( roomId, bedNo ) );
//bo.queueNum.getAndDecrement(); // 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 hurry-up 涓敼鍙樹簡鍊�
- //refreshPriorityQueue(bo);
+ //refreshRoutingQueue(bo);
return GlobalErrorCodeConstants.SUCCESS;
}
/**
- * 1. 姣忓ぉ寮�璇婂墠 浠嶥B鍚屾宸ヤ綅鐨勬偅鑰呴槦鍒楁暟鎹埌 宸ヤ綅浼樺厛闃熷垪
+ * 1. 姣忓ぉ寮�璇婂墠 浠嶥B鍚屾宸ヤ綅鐨勬偅鑰呴槦鍒楁暟鎹埌 宸ヤ綅鍒嗘祦闃熷垪
* 2. 鏈嶅姟杩愮淮閲嶅惎鏃�
*/
public ErrorCode bedReload() {
- mapCheckTypePriorityQueue.clear();
- mapBedVsQueue.clear();
+ mapCheckTypeRoutingQueue.clear();
+ mapOpeningBed.clear();
// 娓呴櫎闈炲綋澶╃殑鎺掗槦浜哄憳
queueMapper.clearQueue();
@@ -331,22 +334,22 @@
List<RoomDO> roomDOList = roomMapper.simpleRoomList(bedStatusEnumList);
List<BedQueueBO> bedQueueBOList = roomDOList.stream().map(item -> BeanUtils.toBean(item, BedQueueBO.class)).toList();
- // 浠嶥B 鑾峰彇 闃熷垪涓� 鍊欒瘖涓腑浜哄憳缁熻 鍒楄〃
+ // 浠嶥B 鑾峰彇 闃熷垪涓� 銆愬�欒瘖涓�戜汉鍛樼粺璁� 鍒楄〃
List<Integer> queueStatusList = new ArrayList<>();
queueStatusList.add(QueueStatusEnum.READY.getStatus());
List<QueueStatisticDO> queueStatisticDOList = queueMapper.queueStatistic(queueStatusList);
bedQueueBOList.forEach(item -> {
- item.maxQueueNum = getBedReadyMax(item.roomId, item.bedNo);
+ item.setMaxQueueNum( 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.maxQueueNum < queueNum )
+ if ( item.getMaxQueueNum() < queueNum )
throw new RuntimeException("init: exceed max queue number!");
- item.queueNum.set( queueNum );
- mapBedVsQueue.put( Utils.formatRoomBed(item.roomId, item.bedNo), item);
+ item.setQueueNum( new AtomicInteger(queueNum) );
+ mapOpeningBed.put( Utils.formatRoomBed(item.roomId, item.bedNo), item);
if (BedStatusEnum.DOCTOR_ON.getStatus() == item.getStatus()) {
- addPriorityQueue(item);
+ addRoutingQueue(item);
}
});
@@ -375,7 +378,7 @@
if (0 == openingFlag.get())
return;
- mapBedVsQueue.values().forEach(bedQueueBO -> hurryupOneBed(bedQueueBO.roomId, bedQueueBO.bedNo));
+ mapOpeningBed.values().forEach(bedQueueBO -> hurryupOneBed(bedQueueBO.roomId, bedQueueBO.bedNo));
}
/**
@@ -395,7 +398,7 @@
bedQueueBO.getRoomName(),
bedQueueBO.getBedNo(),
curSeqNum.get() + 1, // 杩囧彿鍥炴潵锛屾帓鍒板綋鍓嶇殑涓嬩竴浣�
- QueueStatusEnum.RECALLED.getStatus(), // 涓嶉渶瑕佸鐞� [瀹夎鍙洖], 鍘熷洜: 瀹夎宸ヤ綅 娌℃湁浼樺厛闃熷垪
+ QueueStatusEnum.RECALLED.getStatus(), // 涓嶉渶瑕佸鐞� [瀹夎鍙洖], 鍘熷洜: 瀹夎宸ヤ綅 涓嶈繘鍏ュ垎娴侀槦鍒�
QueueStatusEnum.READY.getStatus());
if (null == updateNum || 0 == updateNum)
break;
@@ -413,8 +416,8 @@
// 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 nextPatient 涓敼鍙樹簡鍊�
bedQueueBO.queueNum.incrementAndGet();
- // 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 nextPatient 涓敼鍙樹簡浼樺厛闃熷垪椤哄簭
- refreshPriorityQueue(bedQueueBO);
+ // 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 nextPatient 涓敼鍙樹簡鍒嗘祦闃熷垪椤哄簭
+ refreshRoutingQueue(bedQueueBO);
}
// 澶勭悊 鎺掗槦涓� 鎮h��
@@ -430,12 +433,12 @@
*/
public void hurryupOneCheckType(Integer checkType) {
- PriorityBlockingQueue<BedQueueBO> priorityQueue = mapCheckTypePriorityQueue.get(checkType);
- if (null == priorityQueue)
+ PriorityBlockingQueue<BedQueueBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
+ if (null == routingQueue)
return;
while (true) {
- BedQueueBO bedQueueBO = priorityQueue.peek();
+ BedQueueBO bedQueueBO = routingQueue.peek();
if (null == bedQueueBO)
return;
@@ -474,8 +477,8 @@
// 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 nextPatient 涓敼鍙樹簡鍊�
bedQueueBO.queueNum.incrementAndGet();
- // 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 nextPatient 涓敼鍙樹簡浼樺厛闃熷垪椤哄簭
- refreshPriorityQueue(bedQueueBO);
+ // 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 nextPatient 涓敼鍙樹簡鍒嗘祦闃熷垪椤哄簭
+ refreshRoutingQueue(bedQueueBO);
}
}
@@ -497,7 +500,7 @@
}
public BedQueueBO getBedQueueBO(Long roomId, String bedNo) {
- return mapBedVsQueue.get( Utils.formatRoomBed(roomId, bedNo) );
+ return mapOpeningBed.get( Utils.formatRoomBed(roomId, bedNo) );
}
public MonitorInfoVO getMonitorInfo() {
@@ -511,7 +514,7 @@
public void monitorInfo() {
MonitorInfoVO monitorInfoVO = new MonitorInfoVO();
roomBedStatistic(monitorInfoVO);
- log.info(" opening " + openingFlag.get() + " " + monitorInfoVO.getQueueNum() + " " + monitorInfoVO.getActiveQueueNum() + " " + monitorInfoVO.getCheckTypeBedInfo().toString() );
+ log.info(" opening " + openingFlag.get() + " " + monitorInfoVO.getOpeningBedNum() + " " + monitorInfoVO.getDocBedNum() + " " + monitorInfoVO.getCheckTypeBedInfo().toString() );
}
private void hurryupOneBedCheckTypeList(BedQueueBO bedQueueBO) {
@@ -544,8 +547,8 @@
bedQueueBO.queueNum.incrementAndGet();
}
- // 鏀瑰彉浜嗕紭鍏堥槦鍒楅『搴�
- refreshPriorityQueue(bedQueueBO);
+ // 鏀瑰彉浜嗗垎娴侀槦鍒楅『搴�
+ refreshRoutingQueue(bedQueueBO);
}
/**
@@ -586,49 +589,56 @@
for (int i=0; i<checkTypes.length; i++) {
CheckTypeDO checkTypeDO = mapCheckTypeVsReadyMax.get(checkTypes[i]);
Integer tmp = checkTypeDO.getReadyNum();
- ret = ret < tmp ? tmp : ret; //鍙栧ぇ鍊�
+ ret = ret < tmp ? tmp : ret; //銆愬�欒瘖涓�戞暟閲� 鍙栧ぇ鍊�
}
return ret;
}
- private void addPriorityQueue(BedQueueBO bedQueueBO) {
+ private void addRoutingQueue(BedQueueBO bedQueueBO) {
+ // 瑁呮満宸ヤ綅 涓嶈繘 鍒嗘祦闃熷垪锛屼笉鎺ユ敹 銆愭帓闃熶腑銆戞偅鑰呭垎娴�
+ if (BedOpTypeEnum.OP_INSTALL.getOpType() == bedQueueBO.getOpType())
+ return;
+
Integer[] checkTypes = bedQueueBO.getCheckTypes();
Arrays.stream(checkTypes).forEach(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 );
+ PriorityBlockingQueue<BedQueueBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
+ if (null == routingQueue) {
+ routingQueue = new PriorityBlockingQueue<BedQueueBO>();
+ mapCheckTypeRoutingQueue.put( checkType, routingQueue );
}
- if (!priorityQueue.contains(bedQueueBO)) {
- priorityQueue.offer(bedQueueBO);
+ if (!routingQueue.contains(bedQueueBO)) {
+ routingQueue.offer(bedQueueBO);
} else {
- log.error("bedDoctorResume priorityQueue still exist!. " + bedQueueBO.getRoomId() + " " + bedQueueBO.getBedNo());
+ log.error("bedDoctorResume routingQueue still exist!. " + bedQueueBO.getRoomId() + " " + bedQueueBO.getBedNo());
}
});
}
- private void removePriorityQueue(BedQueueBO bedQueueBO) {
+ private void removeRoutingQueue(BedQueueBO bedQueueBO) {
+ // 瑁呮満宸ヤ綅 涓嶈繘 鍒嗘祦闃熷垪锛屼笉鎺ユ敹 銆愭帓闃熶腑銆戞偅鑰呭垎娴�
+ if (BedOpTypeEnum.OP_INSTALL.getOpType() == bedQueueBO.getOpType())
+ return;
+
Integer[] checkTypes = bedQueueBO.getCheckTypes();
Arrays.stream(checkTypes).forEach(checkType -> {
- PriorityBlockingQueue<BedQueueBO> priorityBlockingQueue = mapCheckTypePriorityQueue.get(checkType);
- if (null != priorityBlockingQueue)
- priorityBlockingQueue.remove(bedQueueBO);
+ PriorityBlockingQueue<BedQueueBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
+ if (null != routingQueue)
+ routingQueue.remove(bedQueueBO);
});
}
- private void refreshPriorityQueue(BedQueueBO bedQueueBO) {
+ private void refreshRoutingQueue(BedQueueBO bedQueueBO) {
+ // 瑁呮満宸ヤ綅 涓嶈繘 鍒嗘祦闃熷垪锛屼笉鎺ユ敹 銆愭帓闃熶腑銆戞偅鑰呭垎娴�
+ if (BedOpTypeEnum.OP_INSTALL.getOpType() == bedQueueBO.getOpType())
+ return;
+
Integer[] checkTypes = bedQueueBO.getCheckTypes();
Arrays.stream(checkTypes).forEach(checkType -> {
- PriorityBlockingQueue<BedQueueBO> priorityQueue = mapCheckTypePriorityQueue.get(checkType);
- priorityQueue.remove(bedQueueBO);
- priorityQueue.offer(bedQueueBO);
+ PriorityBlockingQueue<BedQueueBO> routingQueue = mapCheckTypeRoutingQueue.get(checkType);
+ routingQueue.remove(bedQueueBO);
+ routingQueue.offer(bedQueueBO);
});
}
@@ -660,7 +670,7 @@
});
//寮�閫氱殑 鍜� 杩愯惀涓� 鐨勫伐浣嶇粺璁�
- mapBedVsQueue.values().forEach( bedQueueBO -> {
+ mapOpeningBed.values().forEach(bedQueueBO -> {
Integer[] checkTypes = bedQueueBO.getCheckTypes();
Arrays.stream(checkTypes).forEach(checkType -> {
if (bedQueueBO.opType == 0 || bedQueueBO.opType == 1)
@@ -677,10 +687,10 @@
});
});
- // 鎺ユ敹..鎺掗槦涓偅鑰�..鐨勪紭鍏堥槦鍒�
+ // 鎺ユ敹..鎺掗槦涓偅鑰�..鐨勫垎娴侀槦鍒�
HashSet<BedQueueBO> hashSetOperatingBedQueue = new HashSet<>();
- mapCheckTypePriorityQueue.values().forEach(priorityQueue->{
- priorityQueue.stream().forEach(bedQueueBO -> hashSetOperatingBedQueue.add(bedQueueBO));
+ mapCheckTypeRoutingQueue.values().forEach(routingQueue->{
+ routingQueue.stream().forEach(bedQueueBO -> hashSetOperatingBedQueue.add(bedQueueBO));
});
@@ -694,10 +704,13 @@
});
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() );
- monitorInfoVO.setMapBedVsQueue( mapBedVsQueue );
+ monitorInfoVO.setOpeningBedNum(mapOpeningBed.size());
+ monitorInfoVO.setDocBedNum((int) mapOpeningBed.values().stream().filter(item ->
+ item.getStatus() == BedStatusEnum.DOCTOR_ON.getStatus() ||
+ item.getStatus() == BedStatusEnum.PAUSE.getStatus())
+ .count());
+ monitorInfoVO.setRoutingBedNum( hashSetOperatingBedQueue.size() );
+ monitorInfoVO.setMapBedVsQueue(mapOpeningBed);
}
}
--
Gitblit v1.9.3