From e743e68c542c4f3fac4e085df830aa74fd34fd49 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 20 八月 2024 18:04:20 +0800
Subject: [PATCH] 医生叫号 初步实现

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/queueMapper.java |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 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 6e8745d..eb6ac45 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
@@ -10,6 +10,7 @@
 import cn.lihu.jh.module.ecg.controller.admin.queue.vo.*;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 
 import java.util.List;
 
@@ -49,4 +50,33 @@
             " group by room_id, bed_no; "
             +"</script>")
     List<QueueStatisticDO> queueStatistic(@Param("statusList")List<Byte> statusList);
-}
\ No newline at end of file
+
+    @Select("<script>" +
+            "SELECT * FROM lihu.queue where status in (" +
+            " <foreach collection='statusList' separator=',' item='status'>" +
+            " #{status} " +
+            " </foreach> )" +
+            " order by book_timeslot, create_time " +
+            "</script>")
+    List<QueueDO> getOrderedQueue(@Param("statusList")List<Byte> statusList);
+
+    //@Update("update lihu.queue set status = #{newStatus} where pat_id = #{patId} ans status = #{curStatus} ")
+
+    @Update("update lihu.queue set status = #{newStatus} 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 bed_no = #{bedNo} and status = #{curStatus}) a )")
+    Integer updateQueueStatus(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus);
+
+    @Select("select * from lihu.queue where status = #{status} order by book_timeslot, create_time limit 1")
+    QueueDO getFirstInQueueByStatus(Byte status);
+
+    @Select("<script>" +
+            "SELECT * FROM lihu.queue " +
+            "where room_id = #{roomId} and bed_no = #{bedNo} and status in (" +
+            " <foreach collection='statusList' separator=',' item='status'>" +
+            " #{status} " +
+            " </foreach> )" +
+            " order by seq_num" +
+            "</script>")
+    List<QueueDO> getDoctorQueueByStatus(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("statusList")List<Byte> statusList);
+}

--
Gitblit v1.9.3