From db1ad1b67a55f005baea15a6d640df370a6c74a9 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期三, 09 四月 2025 08:39:04 +0800
Subject: [PATCH] 工位分流控制信息 设置逻辑调整
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java | 42 +++++++++++++++---------------------------
1 files changed, 15 insertions(+), 27 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 db4bdd6..6b7b460 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
@@ -98,10 +98,6 @@
return ROOM_INVALID_STATUS;
}
- List<Integer> queueStatusList = new ArrayList<>();
- queueStatusList.add(QueueStatusEnum.READY.getStatus());
- List<QueueDO> queueDOList = queueMapper.getBedQueueByStatus(roomId, bedNo, queueStatusList);
-
RoomDO roomDO = roomMapper.getRoom(roomId, bedNo);
// 鏂板..宸ヤ綅闃熷垪
@@ -109,8 +105,6 @@
bedBO.setRoomId(roomId);
bedBO.setRoomName(roomName);
bedBO.setBedNo(bedNo);
- bedBO.setMaxReadyPatNum(getBedReadyMax(roomId, bedNo));
- bedBO.setReadyPatNum(new AtomicInteger(queueDOList.size()));
bedBO.setStatus(BedStatusEnum.OPENING.getStatus());
bedBO.setCheckTypes( roomDO.getCheckTypes() );
bedBO.setOpType( roomDO.getOpType() );
@@ -334,19 +328,7 @@
List<RoomDO> roomDOList = roomMapper.simpleRoomList(bedStatusEnumList);
List<BedBO> bedBOList = roomDOList.stream().map(item -> BeanUtils.toBean(item, BedBO.class)).toList();
- // 浠嶥B 鑾峰彇 闃熷垪涓� 銆愬�欒瘖涓�戜汉鍛樼粺璁� 鍒楄〃
- List<Integer> queueStatusList = new ArrayList<>();
- queueStatusList.add(QueueStatusEnum.READY.getStatus());
- List<QueueStatisticDO> queueStatisticDOList = queueMapper.queueStatistic(queueStatusList);
-
bedBOList.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.getMaxReadyPatNum() < queueNum )
- throw new RuntimeException("init: exceed max queue number!");
-
- item.setReadyPatNum( new AtomicInteger(queueNum) );
mapOpeningBed.put( Utils.formatRoomBed(item.roomId, item.bedNo), item);
if (BedStatusEnum.DOCTOR_ON.getStatus() == item.getStatus()) {
addRoutingQueue(item);
@@ -582,12 +564,11 @@
}
}
- private Integer getBedReadyMax(Long roomId, String bedNo) {
- RoomDO roomDO = roomMapper.getRoom(roomId, bedNo);
- Integer[] checkTypes = roomDO.getCheckTypes();
- Integer ret = 0;
- for (int i=0; i<checkTypes.length; i++) {
- CheckTypeDO checkTypeDO = mapCheckTypeVsReadyMax.get(checkTypes[i]);
+ private Integer getBedReadyMax(BedBO bedBO) {
+ Integer[] checkTypes = bedBO.getCheckTypes();
+ int ret = 0;
+ for (Integer checkType : checkTypes) {
+ CheckTypeDO checkTypeDO = mapCheckTypeVsReadyMax.get(checkType);
Integer tmp = checkTypeDO.getReadyNum();
ret = ret < tmp ? tmp : ret; //銆愬�欒瘖涓�戞暟閲� 鍙栧ぇ鍊�
}
@@ -596,8 +577,15 @@
private void addRoutingQueue(BedBO bedBO) {
// 瑁呮満宸ヤ綅 涓嶈繘 鍒嗘祦闃熷垪锛屼笉鎺ユ敹 銆愭帓闃熶腑銆戞偅鑰呭垎娴�
- if (BedOpTypeEnum.OP_INSTALL.getOpType() == bedBO.getOpType())
+ if (Objects.equals(BedOpTypeEnum.OP_INSTALL.getOpType(), bedBO.getOpType()))
return;
+
+ // 鍚屾DB, 璁剧疆宸ヤ綅鐨勫垎娴佹帶鍒朵俊鎭�
+ List<Integer> queueStatusList = new ArrayList<>();
+ queueStatusList.add(QueueStatusEnum.READY.getStatus()); //[鍊欒瘖涓璢
+ List<QueueDO> queueDOList = queueMapper.getBedQueueByStatus(bedBO.getRoomId(), bedBO.getBedNo(), queueStatusList);
+ bedBO.setMaxReadyPatNum( getBedReadyMax(bedBO) );
+ bedBO.setReadyPatNum(new AtomicInteger(queueDOList.size()));
Integer[] checkTypes = bedBO.getCheckTypes();
Arrays.stream(checkTypes).forEach(checkType -> {
@@ -618,7 +606,7 @@
private void removeRoutingQueue(BedBO bedBO) {
// 瑁呮満宸ヤ綅 涓嶈繘 鍒嗘祦闃熷垪锛屼笉鎺ユ敹 銆愭帓闃熶腑銆戞偅鑰呭垎娴�
- if (BedOpTypeEnum.OP_INSTALL.getOpType() == bedBO.getOpType())
+ if (Objects.equals(BedOpTypeEnum.OP_INSTALL.getOpType(), bedBO.getOpType()))
return;
Integer[] checkTypes = bedBO.getCheckTypes();
@@ -631,7 +619,7 @@
private void refreshRoutingQueue(BedBO bedBO) {
// 瑁呮満宸ヤ綅 涓嶈繘 鍒嗘祦闃熷垪锛屼笉鎺ユ敹 銆愭帓闃熶腑銆戞偅鑰呭垎娴�
- if (BedOpTypeEnum.OP_INSTALL.getOpType() == bedBO.getOpType())
+ if (Objects.equals(BedOpTypeEnum.OP_INSTALL.getOpType(), bedBO.getOpType()))
return;
Integer[] checkTypes = bedBO.getCheckTypes();
--
Gitblit v1.9.3