From 7cf7537009b3add8ce851b56163f43ed15000041 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 15 十月 2024 14:12:40 +0800
Subject: [PATCH] 装机 过号&召回 逻辑 update
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java | 49 +++-------------
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java | 32 +++++++++-
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java | 35 +++++++++--
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/QueueStatusEnum.java | 1
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueService.java | 4 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java | 7 +-
6 files changed, 75 insertions(+), 53 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/QueueStatusEnum.java b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/QueueStatusEnum.java
index d6b1275..38e861e 100644
--- a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/QueueStatusEnum.java
+++ b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/QueueStatusEnum.java
@@ -20,6 +20,7 @@
PASSED_INSTALL((byte)7, "宸茶繃鍙�-瀹夎"),
WAITING((byte)10, "鎺掗槦涓�"),
RECALLED((byte)15, "宸插彫鍥�"),
+ RECALLED_INSTALL((byte)17, "宸插彫鍥�-瀹夎"),
READY((byte)20, "鍊欒瘖涓�"),
ONSTAGE((byte)30, "灏辫瘖涓�"), // 鎴� 棰嗙敤涓�
RECEIVED((byte)33, "宸查鐢�"),
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 fc67401..0a5ac64 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
@@ -194,15 +194,9 @@
{
queueService.finishInstallNextPatient(roomId, bedNo);
- List<Byte> queueStatusList = new ArrayList<>();
- queueStatusList.add(QueueStatusEnum.RECEIVED.getStatus());
- List<QueueDO> queueDOList = queueService.getRoomQueueByStatus(roomId, queueStatusList);
+ List<QueueDO> queueDOList = queueService.getToBeInstalledPatient(roomId, bedNo);
- queueStatusList.clear();
- queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus());
- List<QueueDO> installingQueueDOList = queueService.getBedQueueByStatus(roomId, bedNo, queueStatusList);
- queueDOList.addAll(0, installingQueueDOList );
-
+ List<QueueDO> installingQueueDOList = queueDOList.stream().filter(queueDO -> queueDO.getStatus() == QueueStatusEnum.INSTALLING.getStatus()).toList();
// 杩囨护鍑� [瀹夎涓璢 鐨勶紝鍑嗗鍙彿 璇ュ伐浣嶅簲璇� 鏈�澶氬彧鏈変竴涓� [瀹夎涓璢
if (installingQueueDOList.size() > 0) {
QueueDO onStageItem = installingQueueDOList.getFirst();
@@ -214,6 +208,7 @@
return success(BeanUtils.toBean(queueDOList, QueueRespVO.class));
}
+ // 甯歌妫�鏌ヨ繃鍙枫�侀鐢ㄨ繃鍙�
@GetMapping("/pass-next-patient")
@Operation(summary = "杩囧彿銆佷笅涓�浣嶆偅鑰�")
@Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116")
@@ -225,12 +220,7 @@
{
queueService.passNextPatient(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);
+ List<QueueDO> queueDOList = queueService.getToBeCheckedPatient(roomId, bedNo);
// 杩囨护鍑� 灏辫瘖涓殑锛屽噯澶囧彨鍙�
QueueDO onStageItem = queueDOList.stream().filter(item -> Objects.equals(item.getStatus(), QueueStatusEnum.ONSTAGE.getStatus())).findFirst().orElse(null);
@@ -254,14 +244,7 @@
{
queueService.passInstallNextPatient(roomId, bedNo);
- List<Byte> queueStatusList = new ArrayList<>();
- queueStatusList.add(QueueStatusEnum.RECEIVED.getStatus());
- queueStatusList.add(QueueStatusEnum.PASSED_INSTALL.getStatus());
- List<QueueDO> queueDOList = queueService.getRoomQueueByStatus(roomId, queueStatusList);
-
- queueStatusList.clear();
- queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus());
- queueDOList.addAll(0, queueService.getBedQueueByStatus(roomId, bedNo, queueStatusList) );
+ List<QueueDO> queueDOList = queueService.getToBeInstalledPatient(roomId, bedNo);
/*
// 杩囨护鍑� 灏辫瘖涓殑锛屽噯澶囧彨鍙�
@@ -305,21 +288,16 @@
return success("鎿嶄綔鎴愬姛");
}
- @GetMapping("/get-patient-list")
- @Operation(summary = "鍙栨偅鑰呭垪琛�")
+ @GetMapping("/get-to-be-checked-list")
+ @Operation(summary = "鍙� [甯歌妫�鏌 鎴� [寰呴鐢╙ 鎮h�呭垪琛�")
@Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116")
@Parameter(name = "bedNo", description = "宸ヤ綅缂栧彿", required = true, example = "B2")
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
- public CommonResult<List<QueueRespVO>> getPatientList(
+ public CommonResult<List<QueueRespVO>> getToBeCheckedPatientList(
@RequestParam("roomId") Long roomId,
@RequestParam("bedNo") String 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);
+ List<QueueDO> queueDOList = queueService.getToBeCheckedPatient(roomId, bedNo);
return success(BeanUtils.toBean(queueDOList, QueueRespVO.class));
}
@@ -332,14 +310,7 @@
@RequestParam("roomId") Long roomId,
@RequestParam("bedNo") String bedNo)
{
- List<Byte> queueStatusList = new ArrayList<>();
- queueStatusList.add(QueueStatusEnum.RECEIVED.getStatus());
- queueStatusList.add(QueueStatusEnum.PASSED_INSTALL.getStatus());
- List<QueueDO> queueDOList = queueService.getRoomQueueByStatus(roomId, queueStatusList);
-
- queueStatusList.clear();
- queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus());
- queueDOList.addAll(0, queueService.getBedQueueByStatus(roomId, bedNo, queueStatusList) );
+ List<QueueDO> queueDOList = queueService.getToBeInstalledPatient(roomId, bedNo);
return success(BeanUtils.toBean(queueDOList, QueueRespVO.class));
}
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 86b13fb..55e490f 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
@@ -141,11 +141,20 @@
" (select min(seq_num) as min_seq_num from lihu.queue where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus}) a )")
Integer updateBedQueueStatus(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus);
- // 鏌愪釜璇婂鑼冨洿鍐� [宸查鐢╙浜哄憳 鎶㈠崰
- @Update("update lihu.queue set status = #{newStatus}, bed_no = #{bedNo} where seq_num = \n" +
- "(select a.min_seq_num from \n" +
- " (select min(seq_num) as min_seq_num from lihu.queue where room_id = #{roomId} and status = #{curStatus}) a )")
- Integer preemptReceivedPatient(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus);
+ // 鏌愪釜璇婂鑼冨洿鍐� [宸查鐢╙ [宸插彫鍥�-瀹夎] 浜哄憳 鎶㈠崰
+ @Update("<script> " +
+ "update lihu.queue set status = #{newStatus}, bed_no = #{bedNo} where seq_num = \n" +
+ " (select a.min_seq_num from \n" +
+ " (select min(seq_num) as min_seq_num from lihu.queue where room_id = #{roomId} " +
+ " and status in ( " +
+ " <foreach collection='curStatusList' separator=',' item='status'>" +
+ " #{status} " +
+ " </foreach> )" +
+ " ) a " +
+ " )" +
+ "</script>"
+ )
+ Integer preemptToBeInstalledPatient(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("curStatusList")List<Byte> curStatusList, @Param("newStatus")Byte newStatus);
@Update("update lihu.queue set status = #{newStatus} where pat_id = #{patId} and status = #{curStatus}")
Integer updatePatientQueueStatus(@Param("patId")String patId, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus);
@@ -159,18 +168,28 @@
@Param("seqNum")Integer seqNum, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus,
@Param("checkType")Integer checkType);
- @Update("update lihu.queue set status = #{newStatus}, seq_num = #{seqNum}, passed = 1 " +
+ @Update("update lihu.queue set status = #{newStatus}, seq_num = #{seqNum} " +
" where id = " +
" (select a.id from \n" +
- " (select id from lihu.queue where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus} order by seq_num limit 1) a)")
+ " (select id from lihu.queue where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus} " +
+ " order by seq_num limit 1" +
+ " ) a" +
+ " )" )
Integer queueRecalledPatient(@Param("roomId")Long roomId, @Param("roomName")String roomName, @Param("bedNo")String bedNo,
@Param("seqNum")Integer seqNum, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus);
- @Update("update lihu.queue set status = #{newStatus} " +
+ // 甯歌妫�鏌� 鎴� 棰嗙敤 鐨勬偅鑰呭彫鍥�, 鍘熷伐浣嶅鐞�
+ @Update("update lihu.queue set status = #{newStatus}, passed = 1 " +
" where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus} and pat_id = #{patId} ")
Integer recallPassedPatient(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("patId")String patId,
@Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus);
+ // 瑁呮満鍖荤敓 鍏佽鎶㈠崰 鏈瀹� [瀹夎杩囧彿] 鐨勬偅鑰�
+ @Update("update lihu.queue set status = #{newStatus}, bed_no = #{bedNo}, passed = 1 " +
+ " where room_id = #{roomId} and status = #{curStatus} and pat_id = #{patId} ")
+ Integer recallPassedInstallPatient(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("patId")String patId,
+ @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus);
+
@Update("update lihu.queue set jump_flag = #{jumped} " +
" where status = #{curStatus} and pat_id = #{patId}")
Integer queueJump(@Param("patId")String patId, @Param("curStatus")Byte curStatus, @Param("jumped")Byte jumped );
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueService.java
index 36ee3e8..f2d6055 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueService.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueService.java
@@ -131,4 +131,8 @@
Integer patientJump(String patId, Byte jumped );
RoomDO getDocRoomInfo(Long docId);
+
+ List<QueueDO> getToBeCheckedPatient(Long roomId, String bedNo);
+
+ List<QueueDO> getToBeInstalledPatient(Long roomId, String bedNo);
}
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 85cd522..4c9be7e 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
@@ -517,9 +517,10 @@
@Override
public Integer recallInstallPatient(Long roomId, String bedNo, String patId) {
- Integer updateNum = queueMapper.recallPassedPatient(roomId, bedNo, patId,
- QueueStatusEnum.PASSED_INSTALL.getStatus(), QueueStatusEnum.RECEIVED.getStatus());
- startHurryUpOneBed(roomId, bedNo);
+ Integer updateNum = queueMapper.recallPassedInstallPatient(roomId, bedNo, patId,
+ QueueStatusEnum.PASSED_INSTALL.getStatus(), QueueStatusEnum.RECALLED_INSTALL.getStatus());
+ // 瀹夎宸ヤ綅 涓嶈璁� 浼樺厛闃熷垪
+ //startHurryUpOneBed(roomId, bedNo);
return updateNum;
}
@@ -537,6 +538,31 @@
return roomMapper.getRoomByDocId(docId);
}
+ @Override
+ public List<QueueDO> getToBeCheckedPatient(Long roomId, String 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 = getBedQueueByStatus(roomId, bedNo, queueStatusList);
+ return queueDOList;
+ }
+
+ @Override
+ public List<QueueDO> getToBeInstalledPatient(Long roomId, String bedNo) {
+ List<Byte> queueStatusList = new ArrayList<>();
+ queueStatusList.add(QueueStatusEnum.RECEIVED.getStatus());
+ queueStatusList.add(QueueStatusEnum.PASSED_INSTALL.getStatus());
+ List<QueueDO> queueDOList = getRoomQueueByStatus(roomId, queueStatusList);
+
+ queueStatusList.clear();
+ queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus());
+ queueStatusList.add(QueueStatusEnum.RECALLED_INSTALL.getStatus());
+ queueDOList.addAll(0, getBedQueueByStatus(roomId, bedNo, queueStatusList) );
+ return queueDOList;
+ }
+
private RoomDO getRoomDO(Long roomId, String bedNo) {
RoomDO roomDO = mapRoomBed.get( Utils.formatRoomBed(roomId, bedNo) );
if ( null == roomDO)
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 a7dc7b6..635e873 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
@@ -259,8 +259,9 @@
// 瑁呮満鏃� 鍖荤敓 鍙栦笅涓�浣嶆偅鑰�
public ErrorCode nextInstallPatient(Long roomId, String bedNo) {
// 浠� DB 鎶� 搴忓彿鏈�灏忕殑 [宸查鐢╙ 鐨勪汉 璁剧疆涓� [瀹夎涓璢
- Integer updateNum = queueMapper.preemptReceivedPatient(roomId, bedNo,
- QueueStatusEnum.RECEIVED.getStatus(), QueueStatusEnum.INSTALLING.getStatus());
+ Integer updateNum = queueMapper.preemptToBeInstalledPatient(roomId, bedNo,
+ List.of(QueueStatusEnum.RECEIVED.getStatus(), QueueStatusEnum.RECALLED_INSTALL.getStatus()),
+ QueueStatusEnum.INSTALLING.getStatus());
// 璇ュ伐浣� 娌℃湁 [宸查鐢╙ 浜哄憳
if (null == updateNum || 0 == updateNum) {
return QUEUE_NOT_READY_PATIENT;
@@ -360,7 +361,7 @@
bedQueueBO.getRoomName(),
bedQueueBO.getBedNo(),
curSeqNum.get() + 1,
- QueueStatusEnum.RECALLED.getStatus(),
+ QueueStatusEnum.RECALLED.getStatus(), // 涓嶉渶瑕佸鐞� [瀹夎鍙洖], 鍘熷洜: 瀹夎宸ヤ綅 娌℃湁浼樺厛闃熷垪
QueueStatusEnum.READY.getStatus());
if (null == updateNum || 0 == updateNum)
break;
--
Gitblit v1.9.3