From f96cc88f8b85cfecd73d41acc2913833882ee5c0 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期日, 08 九月 2024 17:27:41 +0800
Subject: [PATCH] LocalDate json process
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/queueMapper.java | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 110 insertions(+), 4 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 30a3e14..0bbaaaf 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
@@ -4,8 +4,12 @@
import cn.lihu.jh.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.lihu.jh.framework.mybatis.core.mapper.BaseMapperX;
import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
-import org.apache.ibatis.annotations.Mapper;
+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.*;
import cn.lihu.jh.module.ecg.controller.admin.queue.vo.*;
+
+import java.util.List;
/**
* 鎺掗槦 Mapper
@@ -26,10 +30,112 @@
.eqIfPresent(QueueDO::getStatus, reqVO.getStatus())
.eqIfPresent(QueueDO::getPassed, reqVO.getPassed())
.eqIfPresent(QueueDO::getExpired, reqVO.getExpired())
- .eqIfPresent(QueueDO::getRoomNum, reqVO.getRoomNum())
- .eqIfPresent(QueueDO::getBedNum, reqVO.getBedNum())
+ .eqIfPresent(QueueDO::getRoomId, reqVO.getRoomId())
+ .eqIfPresent(QueueDO::getBedNo, reqVO.getBedNo())
.betweenIfPresent(QueueDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(QueueDO::getId));
}
-}
\ No newline at end of file
+ @Select("SELECT max(seq_num) FROM lihu.queue")
+ 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 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} " +
+ " </foreach> );" +
+ "</script>")
+ Integer statusStatistic(@Param("statusList")List<Byte> statusList);
+
+ @Select("<script>" +
+ "SELECT room_id, bed_no, count(1) as total_in_status FROM lihu.queue where status in (" +
+ " <foreach collection='statusList' separator=',' item='status'>" +
+ " #{status} " +
+ " </foreach> )" +
+ " group by room_id, bed_no; "
+ +"</script>")
+ List<QueueStatisticDO> queueStatistic(@Param("statusList")List<Byte> statusList);
+
+ @Select("<script>" +
+ "SELECT status, count(1) as total_in_status FROM lihu.queue where " +
+ " room_id = #{roomId} and bed_no = #{bedNo} " +
+ " group by status " +
+ "</script>")
+ List<BedQueueStatisticDO> bedQueueStatistic(@Param("roomId")Long roomId, @Param("bedNo")String bedNo);
+
+ @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);
+
+ @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" +
+ " (select a.id from \n" +
+ " (select id from lihu.queue where status = #{curStatus} order by jump_flag desc, book_timeslot, create_time limit 1) a)")
+ Integer preemptPatient(@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}, seq_num = #{seqNum}, passed = 1 " +
+ " 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)")
+ 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 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 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())")
+ Integer clearQueue();
+}
+
--
Gitblit v1.9.3