From d78710765c31d449bef4f1af3de285221eb12080 Mon Sep 17 00:00:00 2001 From: eight <641137800@qq.com> Date: 星期四, 19 九月 2024 18:31:28 +0800 Subject: [PATCH] update --- jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/queueMapper.java | 79 +++++++++++++++++++++++++-------------- 1 files changed, 51 insertions(+), 28 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 ca3c9b7..06cd3e9 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 @@ -6,11 +6,8 @@ import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO; import cn.lihu.jh.module.ecg.dal.dataobject.queue.BedQueueStatisticDO; import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueStatisticDO; -import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.*; 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; @@ -43,6 +40,37 @@ Integer getMaxSeqNum(); @Select("<script>" + + "SELECT * FROM lihu.queue " + + "where room_id = #{roomId} and status in (" + + " <foreach collection='statusList' separator=',' item='status'>" + + " #{status} " + + " </foreach> )" + + " order by seq_num" + + "</script>") + List<QueueDO> getRoomQueueByStatus(@Param("roomId")Long roomId, @Param("statusList")List<Byte> statusList); + + @Select("<script>" + + "SELECT * FROM lihu.queue " + + "where status in (" + + " <foreach collection='statusList' separator=',' item='status'>" + + " #{status} " + + " </foreach> )" + + " order by status desc, seq_num" + + "</script>") + List<QueueDO> getQueueByStatus( @Param("statusList")List<Byte> statusList); + + @Select("<script>" + + "SELECT * FROM lihu.queue " + + "where id >= #{from} and status in (" + + " <foreach collection='statusList' separator=',' item='status'>" + + " #{status} " + + " </foreach> )" + + " limit #{size} " + + " order by id" + + "</script>") + List<QueueDO> getPartialQueueByStatus( @Param("statusList")List<Byte> statusList, @Param("from") Integer from, @Param("size") Integer size); + + @Select("<script>" + "SELECT count(1) as total_in_status FROM lihu.queue where status in (" + " <foreach collection='statusList' separator=',' item='status'>" + " #{status} " + @@ -67,23 +95,6 @@ List<BedQueueStatisticDO> bedQueueStatistic(@Param("roomId")Long roomId, @Param("bedNo")String bedNo); @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 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'>" + @@ -92,6 +103,14 @@ " order by seq_num" + "</script>") List<QueueDO> getDoctorQueueByStatus(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("statusList")List<Byte> statusList); + + @Update( "update lihu.queue set called = 1 where pat_id = #{patId}" ) + Integer markCalled(@Param("patId")String patId); + + @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); @Update("update lihu.queue set status = #{newStatus}, room_id = #{roomId}, room_name = #{roomName}, \n" + " bed_no = #{bedNo}, seq_num = #{seqNum} where id = \n" + @@ -103,17 +122,21 @@ @Update("update lihu.queue set status = #{newStatus}, seq_num = #{seqNum}, passed = 1 " + " where id = " + " (select a.id from \n" + - " (select id from lihu.queue where status = #{curStatus} and room_id = #{roomId} and room_name = #{roomName} and bed_no = #{bedNo} order by seq_num limit 1) a)") - Integer procPassedReturnPatient(@Param("roomId")Long roomId, @Param("roomName")String roomName, @Param("bedNo")String bedNo, - @Param("seqNum")Integer seqNum, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus); + " (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} " + - " where pat_id = #{patId} amd status = #{curStatus} and room_id = #{roomId} and bed_no = #{bedNo}") - Integer passedPatientReturn(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("patId")String patId, + " 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 jumped = #{jumped} " + - " where pat_id = #{patId} amd status = #{curStatus}") + @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 ); + + //@Delete("delete from lihu.queue where TO_DAYS(book_date) != TO_DAYS(NOW())") + @Update("TRUNCATE TABLE lihu.queue") + void clearQueue(); } -- Gitblit v1.9.3