From 7bc725bea3fa8e02e952635dcbb1a493e4a74a13 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期六, 12 十月 2024 11:41:41 +0800
Subject: [PATCH] update
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java | 81 ++++++++++++++++++++++------------------
1 files changed, 44 insertions(+), 37 deletions(-)
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 7d4f6d3..ba0d10b 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
@@ -11,7 +11,7 @@
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;
@@ -44,7 +44,7 @@
private OAuth2TokenApi oAuth2TokenApi;
@Resource
- private queueMapper queueMapper;
+ private QueueMapper queueMapper;
@Resource
private RoomMapper roomMapper;
@@ -64,11 +64,11 @@
ConcurrentHashMap<String, BedQueueBO > mapBedVsQueue = new ConcurrentHashMap<>();
- // 鍩轰簬绫诲瀷鐨�, 妫�鏌ユ垨瑁呮満鐨勪紭鍏堥槦鍒�
- Map<Integer, PriorityBlockingQueue<BedQueueBO>> mapCheckPriorityQueue = new HashMap();
+ // 瑁呮満宸ヤ綅..涓嶈繘鍏ヤ紭鍏堥槦鍒�
+ Map<Integer, PriorityBlockingQueue<BedQueueBO>> mapCheckTypePriorityQueue = new HashMap();
// 鍩轰簬绫诲瀷鐨�, 瑁呮満鍑嗗鐨勪紭鍏堥槦鍒�
- Map<Integer, PriorityBlockingQueue<BedQueueBO>> mapReadyPriorityQueue = new HashMap();
+ // Map<Integer, PriorityBlockingQueue<BedQueueBO>> mapReadyPriorityQueue = new HashMap();
Map<Integer, CheckTypeDO> mapCheckTypeVsReadyMax = null;
@@ -96,7 +96,7 @@
List<Byte> 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);
@@ -129,7 +129,7 @@
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;
@@ -250,7 +250,7 @@
BedQueueBO bo = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo));
bo.queueNum.getAndDecrement(); // 鍙兘宸茬粡銆愬苟鍙戠殑銆戝湪 hurry-up 涓敼鍙樹簡鍊�
- removePriorityQueue(bo);
+ refreshPriorityQueue(bo);
return GlobalErrorCodeConstants.SUCCESS;
}
@@ -259,7 +259,7 @@
* 2. 鏈嶅姟杩愮淮閲嶅惎鏃�
*/
public ErrorCode bedReload() {
- mapCheckPriorityQueue.clear();
+ mapCheckTypePriorityQueue.clear();
mapBedVsQueue.clear();
// 娓呴櫎闈炲綋澶╃殑鎺掗槦浜哄憳
@@ -360,7 +360,7 @@
public void hurryupOneCheckType(Integer checkType) {
- PriorityBlockingQueue<BedQueueBO> priorityQueue = mapCheckPriorityQueue.get(checkType);
+ PriorityBlockingQueue<BedQueueBO> priorityQueue = mapCheckTypePriorityQueue.get(checkType);
if (null == priorityQueue)
return;
@@ -447,7 +447,18 @@
private void addPriorityQueue(BedQueueBO bedQueueBO) {
Integer[] checkTypes = bedQueueBO.getCheckTypes();
Arrays.stream(checkTypes).forEach(checkType -> {
- PriorityBlockingQueue<BedQueueBO> priorityQueue = mapCheckPriorityQueue.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 {
@@ -459,7 +470,7 @@
private void removePriorityQueue(BedQueueBO bedQueueBO) {
Integer[] checkTypes = bedQueueBO.getCheckTypes();
Arrays.stream(checkTypes).forEach(checkType -> {
- PriorityBlockingQueue<BedQueueBO> priorityBlockingQueue = mapCheckPriorityQueue.get(checkType);
+ PriorityBlockingQueue<BedQueueBO> priorityBlockingQueue = mapCheckTypePriorityQueue.get(checkType);
if (null != priorityBlockingQueue)
priorityBlockingQueue.remove(bedQueueBO);
});
@@ -468,7 +479,7 @@
private void refreshPriorityQueue(BedQueueBO bedQueueBO) {
Integer[] checkTypes = bedQueueBO.getCheckTypes();
Arrays.stream(checkTypes).forEach(checkType -> {
- PriorityBlockingQueue<BedQueueBO> priorityQueue = mapCheckPriorityQueue.get(checkType);
+ PriorityBlockingQueue<BedQueueBO> priorityQueue = mapCheckTypePriorityQueue.get(checkType);
priorityQueue.remove(bedQueueBO);
priorityQueue.offer(bedQueueBO);
});
@@ -476,58 +487,54 @@
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);
+ }
});
});
- //杩愯惀涓伐浣嶇粺璁�
+ // 鎺ユ敹..鎺掗槦涓偅鑰�..鐨勪紭鍏堥槦鍒�
HashSet<BedQueueBO> hashSetOperatingBedQueue = new HashSet<>();
- mapCheckPriorityQueue.values().forEach(priorityQueue->{
- priorityQueue.stream().forEach(bedQueueBO -> hashSetOperatingBedQueue.add(bedQueueBO));
- });
- mapReadyPriorityQueue.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) + " " +
- mapOpeningReadyBedStatInfo.get(checkType) + " " +
+ mapOpeningInstallBedStatInfo.get(checkType) + " " +
mapOperatingCheckBedStatInfo.get(checkType) + " " +
- mapOperatingReadyBedStatInfo.get(checkType) + " ";
+ mapOperatingInstallBedStatInfo.get(checkType) + " ";
mapCheckTypeBedInfo.put( checkType, str);
});
monitorInfoVO.setCheckTypeBedInfo(mapCheckTypeBedInfo);
monitorInfoVO.setQueueNum(mapBedVsQueue.size());
- monitorInfoVO.setActiveQueueNum(hashSetOperatingBedQueue.size());
+ monitorInfoVO.setActiveQueueNum((int) mapBedVsQueue.values().stream().filter(item -> item.getStatus() == BedStatusEnum.DOCTOR_ON.getStatus()).count());
+ monitorInfoVO.setPriorityQueueNum( hashSetOperatingBedQueue.size() );
}
}
--
Gitblit v1.9.3