From c48f179be89343dc1620bfa147433bfe87d9bed3 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期一, 11 十一月 2024 17:29:50 +0800
Subject: [PATCH] 检查项-亲和性处理

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 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 be4e8d3..95b1f73 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
@@ -39,6 +39,9 @@
     @Select("SELECT max(seq_num) FROM lihu.queue")
     Integer getMaxSeqNum();
 
+    @Select("SELECT * FROM lihu.queue where seq_num = #{seqNum}")
+    QueueDO getQueueItemBySeqNum(@Param("seqNum")Integer seqNum);
+
     @Select("SELECT * FROM lihu.queue where pat_id = #{patId}")
     QueueDO getQueueByPatId(@Param("patId")String patId);
 
@@ -61,6 +64,27 @@
             " order by status desc, seq_num" +
             "</script>")
     List<QueueDO> getQueueByStatus( @Param("statusList")List<Integer> statusList);
+
+    @Select("<script>" +
+            "SELECT * FROM lihu.queue " +
+            "where pat_id = #{patId} and book_check_type in (" +
+            " <foreach collection='arrCheckType' separator=',' item='checkType'>" +
+            "   #{checkType} " +
+            " </foreach> )" +
+            " and TO_DAYS(book_date) = TO_DAYS(NOW()) " +
+            "</script>")
+    List<QueueDO> getCurPatGivenCheckTypes(@Param("patId")String patId, @Param("checkTypeList")Integer[] arrCheckType);
+
+    @Select("<script>" +
+            "SELECT * FROM lihu.queue " +
+            "where pat_id = #{patId} and book_check_type in (" +
+            " <foreach collection='arrCheckType' separator=',' item='checkType'>" +
+            "   #{checkType} " +
+            " </foreach> ) " +
+            " and status = #{status} " +
+            " and TO_DAYS(book_date) = TO_DAYS(NOW()) " +
+            "</script>")
+    List<QueueDO> getCurPatGivenCheckTypesAndStatus(@Param("patId")String patId, @Param("checkTypeList")Integer[] arrCheckType, @Param("status")Integer status);
 
     @Select("<script>" +
             "SELECT * FROM lihu.queue " +
@@ -136,7 +160,10 @@
             "</script>")
     List<QueueDO> getBedQueueByStatus(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("statusList")List<Integer> statusList);
 
-    @Update("update lihu.queue set status = #{newStatus} where seq_num = \n" +
+    @Select("SELECT * from lihu.queue where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus} order by seq_num limit 1")
+    QueueDO getFirstItemByBedAndStatus(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("curStatus")Integer curStatus);
+
+    @Update("update lihu.queue set status = #{newStatus} where status = #{curStatus} and 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 updateBedQueueStatus(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("curStatus")Integer curStatus, @Param("newStatus")Integer newStatus);

--
Gitblit v1.9.3