From ce6ce8f0fc90718184bf54a149d6cf70a63efb17 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 12 十一月 2024 16:02:09 +0800
Subject: [PATCH] update

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

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 e68f444..ba35dd8 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
@@ -168,15 +168,17 @@
             " (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")Integer curStatus, @Param("newStatus")Integer 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} " +
+            "update lihu.queue set status = #{newStatus}, bed_no = #{bedNo} where id = \n" +
+            "  (select a.id from \n" +
+            "    (select id from lihu.queue where room_id = #{roomId} " +
             "       and status in ( " +
             "           <foreach collection='curStatusList' separator=',' item='status'>" +
             "             #{status} " +
             "           </foreach> )" +
+            "       order by seq_num, create_time limit 1 " +
             "    ) a " +
             "  )" +
             "</script>"
@@ -186,7 +188,7 @@
     @Update("update lihu.queue set status = #{newStatus} where pat_id = #{patId} and status = #{curStatus}")
     Integer updatePatientQueueStatus(@Param("patId")String patId, @Param("curStatus")Integer curStatus, @Param("newStatus")Integer newStatus);
 
-    // 鏁翠釜绯荤粺鑼冨洿鍐� [鎺掗槦涓璢浜哄憳 鎶㈠崰
+    // 鏁翠釜绯荤粺鑼冨洿鍐� [鎺掗槦涓璢浜哄憳 [琚伐浣嶅尰鐢焆鎶㈠崰
     @Update("update lihu.queue set status = #{newStatus}, room_id = #{roomId}, room_name = #{roomName}, \n" +
             " bed_no = #{bedNo}, seq_num = #{seqNum} where id = \n" +
             "  (select a.id from \n" +

--
Gitblit v1.9.3