From fc8492c1a1143ef2466c8dca219b82fc5bf6550c Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期六, 12 十月 2024 15:56:14 +0800
Subject: [PATCH] 队列状态 更新逻辑调整
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java | 18 +++++----
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java | 24 +++++++++--
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java | 11 +++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java | 8 ++++
4 files changed, 47 insertions(+), 14 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java
index fdbc85f..a67fb44 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java
@@ -195,15 +195,17 @@
queueService.finishInstallNextPatient(roomId, bedNo);
List<Byte> queueStatusList = new ArrayList<>();
- queueStatusList.add(QueueStatusEnum.RECALLED.getStatus());
- queueStatusList.add(QueueStatusEnum.READY.getStatus());
- queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus());
- queueStatusList.add(QueueStatusEnum.PASSED.getStatus());
- List<QueueDO> queueDOList = queueService.getBedQueueByStatus(roomId, bedNo, queueStatusList);
+ queueStatusList.add(QueueStatusEnum.RECEIVED.getStatus());
+ List<QueueDO> queueDOList = queueService.getRoomQueueByStatus(roomId, queueStatusList);
- // 杩囨护鍑� 灏辫瘖涓殑锛屽噯澶囧彨鍙�
- QueueDO onStageItem = queueDOList.stream().filter(item -> Objects.equals(item.getStatus(), QueueStatusEnum.ONSTAGE.getStatus())).findFirst().orElse(null);
- if (null != onStageItem) {
+ queueStatusList.clear();
+ queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus());
+ List<QueueDO> installingQueueDOList = queueService.getBedQueueByStatus(roomId, bedNo, queueStatusList);
+ queueDOList.addAll( installingQueueDOList );
+
+ // 杩囨护鍑� [瀹夎涓璢 鐨勶紝鍑嗗鍙彿 璇ュ伐浣嶅簲璇� 鏈�澶氬彧鏈変竴涓� [瀹夎涓璢
+ if (installingQueueDOList.size() > 0) {
+ QueueDO onStageItem = installingQueueDOList.getFirst();
CallSaveReqVO callSaveReqVO = BeanUtils.toBean(onStageItem, CallSaveReqVO.class);
callSaveReqVO.setId(null);
callService.createCall(callSaveReqVO);
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java
index 4da0f9c..34aedca 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java
@@ -98,10 +98,19 @@
List<BedQueueStatisticDO> bedQueueStatistic(@Param("roomId")Long roomId, @Param("bedNo")String bedNo);
@Select("<script>" +
+ "SELECT count(1) FROM lihu.queue " +
+ "where room_id = #{roomId} and bed_no = #{bedNo} and status in (" +
+ " <foreach collection='statusList' separator=',' item='status'>" +
+ " #{status} " +
+ " </foreach> )" +
+ "</script>")
+ Integer bedQueueStatisticByStatus(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("statusList")List<Byte> statusList);
+
+ @Select("<script>" +
"SELECT * FROM lihu.queue " +
"where room_id = #{roomId} and bed_no = #{bedNo} and status in (" +
" <foreach collection='statusList' separator=',' item='status'>" +
- " #{status} " +
+ " #{status} " +
" </foreach> )" +
" order by status desc, seq_num" +
"</script>")
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
index a59f286..139f048 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java
@@ -120,6 +120,10 @@
}
}
+ // 鏇存柊..闃熷垪鐘舵��
+ queueMapper.updateBedQueueStatus(createReqVO.getRoomId(), createReqVO.getBedNo(),
+ QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.RECEIVED.getStatus());
+
return CommonResult.success(rent_id);
}
@@ -185,6 +189,10 @@
jobRecordMapper.updateById(jobRecordDO);
}
+ // 鏇存柊..闃熷垪鐘舵��
+ queueMapper.updateBedQueueStatus(createReqVO.getRoomId(), createReqVO.getBedNo(),
+ QueueStatusEnum.INSTALLING.getStatus(), QueueStatusEnum.FINISH.getStatus());
+
return CommonResult.success(rent_id);
}
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 4fa8e7c..4485429 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
@@ -338,9 +338,16 @@
// 棰嗙敤 鍙彿
@Override
public void finishReceiveNextPatient(Long roomId, String bedNo) {
- // 浠� DB 鎶� 灏辫瘖涓殑浜� 璁剧疆涓哄氨璇婂畬鎴�
- Integer ret = queueMapper.updateBedQueueStatus(roomId, bedNo,
- QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.RECEIVED.getStatus());
+ // 浠� DB 鎶� [灏辫瘖涓璢 鐨勪汉 璁剧疆涓� 銆愬凡棰嗙敤銆�
+ //Integer ret = queueMapper.updateBedQueueStatus(roomId, bedNo,
+ // QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.RECEIVED.getStatus());
+
+ // 浠� DB 妫�鏌� 璇ュ伐浣� 鏄惁鏈� [灏辫瘖涓璢 浜哄憳锛岃嫢鏈夊氨.鏀惧純.鍙栦笅涓�浣�
+ List<Byte> queueStatusList = new ArrayList<>();
+ queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus());
+ Integer num = queueMapper.bedQueueStatisticByStatus(roomId, bedNo, queueStatusList);
+ if ( num != null && num > 0)
+ return;
startNextPatient(roomId, bedNo);
}
@@ -349,8 +356,15 @@
@Override
public void finishInstallNextPatient(Long roomId, String bedNo) {
// 浠� DB 鎶� [瀹夎涓璢 鐨勪汉 璁剧疆涓� [宸插氨璇奭
- Integer ret = queueMapper.updateBedQueueStatus(roomId, bedNo,
- QueueStatusEnum.INSTALLING.getStatus(), QueueStatusEnum.FINISH.getStatus());
+ //Integer ret = queueMapper.updateBedQueueStatus(roomId, bedNo,
+ // QueueStatusEnum.INSTALLING.getStatus(), QueueStatusEnum.FINISH.getStatus());
+
+ // 浠� DB 妫�鏌� 璇ュ伐浣� 鏄惁鏈� [灏辫瘖涓璢 浜哄憳锛岃嫢鏈夊氨.鏀惧純.鍙栦笅涓�浣�
+ List<Byte> queueStatusList = new ArrayList<>();
+ queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus());
+ Integer num = queueMapper.bedQueueStatisticByStatus(roomId, bedNo, queueStatusList);
+ if ( num != null && num > 0)
+ return;
startNextInstallPatient(roomId, bedNo);
}
--
Gitblit v1.9.3