From c475f2545f477846e984c051f10a4b7ea6b64d02 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期四, 15 八月 2024 17:56:16 +0800
Subject: [PATCH] update
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java | 8 ++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedQueueBO.java | 2
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java | 4
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueRespVO.java | 8 ++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/queueDO.java | 8 ++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java | 43 +++++++++++---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueSaveReqVO.java | 7 +
sql/mysql/jh.sql | 11 ++-
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/queueMapper.java | 14 ++--
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queuePageReqVO.java | 7 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/QueueStatisticDO.java | 4 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java | 10 +++
12 files changed, 92 insertions(+), 34 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
index 574bae5..0376e30 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
@@ -176,8 +176,8 @@
queueSaveReqVO.setPassed((byte)0);
queueSaveReqVO.setExpired((byte)0);
- queueSaveReqVO.setRoomNum("-");
- queueSaveReqVO.setBedNum("-");
+ queueSaveReqVO.setRoomName("-");
+ queueSaveReqVO.setBedNo("-");
queueService.createqueue(queueSaveReqVO);
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java
index f10ec87..e206c24 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java
@@ -92,4 +92,12 @@
BeanUtils.toBean(list, QueueRespVO.class));
}
+ @GetMapping("/opening-setting")
+ @Operation(summary = "寮�璇婅缃�")
+ @PreAuthorize("@ss.hasPermission('ecg:queue:setting')")
+ public CommonResult<Integer> openingSetting() {
+ queueService.initQueue();
+ queueService.hurryup();
+ return success(0);
+ }
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queuePageReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queuePageReqVO.java
index a33d804..d0f2915 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queuePageReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queuePageReqVO.java
@@ -42,10 +42,13 @@
private Boolean expired;
@Schema(description = "璇婂缂栧彿")
- private String roomNum;
+ private Long roomId;
+
+ @Schema(description = "璇婂鍚嶇О")
+ private String roomName;
@Schema(description = "璇婄枟搴婄紪鍙�")
- private String bedNum;
+ private String bedNo;
@Schema(description = "鍒涘缓鏃堕棿")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueRespVO.java
index bbbbe08..e3a11be 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueRespVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueRespVO.java
@@ -53,11 +53,15 @@
@Schema(description = "璇婂缂栧彿")
@ExcelProperty("璇婂缂栧彿")
- private String roomNum;
+ private Long roomId;
+
+ @Schema(description = "璇婂鍚嶇О")
+ @ExcelProperty("璇婂鍚嶇О")
+ private String roomName;
@Schema(description = "璇婄枟搴婄紪鍙�")
@ExcelProperty("璇婄枟搴婄紪鍙�")
- private String bedNum;
+ private String bedNo;
@Schema(description = "鍒涘缓鏃堕棿", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("鍒涘缓鏃堕棿")
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueSaveReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueSaveReqVO.java
index d58a983..ae75e8f 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueSaveReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/vo/queueSaveReqVO.java
@@ -49,9 +49,12 @@
private Byte expired;
@Schema(description = "璇婂缂栧彿")
- private String roomNum;
+ private Long roomId;
+
+ @Schema(description = "璇婂鍚嶇О")
+ private String roomName;
@Schema(description = "璇婄枟搴婄紪鍙�")
- private String bedNum;
+ private String bedNo;
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/QueueStatisticDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/QueueStatisticDO.java
index 86ce7c7..f2b51e6 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/QueueStatisticDO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/QueueStatisticDO.java
@@ -14,7 +14,9 @@
@Data
public class QueueStatisticDO {
- private Byte status;
+ private Long roomId;
+
+ private String bedNo;
private Integer totalInStatus;
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/queueDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/queueDO.java
index 2a64685..dcc8507 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/queueDO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/queue/queueDO.java
@@ -63,10 +63,14 @@
/**
* 璇婂缂栧彿
*/
- private String roomNum;
+ private Long roomId;
+ /**
+ * 璇婂鍚嶇О
+ */
+ private String roomName;
/**
* 璇婄枟搴婄紪鍙�
*/
- private String bedNum;
+ private String bedNo;
}
\ No newline at end of file
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 faacf8c..6e8745d 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
@@ -32,21 +32,21 @@
.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));
}
+ @Select("SELECT max(seq_num) FROM lihu.queue")
+ Integer getMaxSeqNum();
+
@Select("<script>" +
- "SELECT status, count(1) as total_in_status FROM lihu.queue where status in (" +
+ "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 status; "
+ " group by room_id, bed_no; "
+"</script>")
List<QueueStatisticDO> queueStatistic(@Param("statusList")List<Byte> statusList);
-
- @Select("SELECT max(seq_num) FROM lihu.queue")
- int getMaxSeqNum();
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedQueueBO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedQueueBO.java
index 86ae942..23d99c1 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedQueueBO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedQueueBO.java
@@ -13,6 +13,6 @@
@Override
public int compareTo(@NotNull BedQueueBO o) {
- return Integer.compare(o.queueNum, this.queueNum);
+ return Integer.compare(this.queueNum, o.queueNum);
}
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java
index 4e90d54..0160b16 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java
@@ -61,4 +61,14 @@
* @param queueSaveReqVO
*/
void queue(QueueSaveReqVO queueSaveReqVO);
+
+ /**
+ *
+ */
+ void initQueue();
+
+ /**
+ *
+ */
+ void hurryup();
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java
index 5b558c7..7fdb051 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java
@@ -20,9 +20,7 @@
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.List;
-import java.util.PriorityQueue;
+import java.util.*;
import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*;
@@ -98,32 +96,57 @@
@Override
public void queue(QueueSaveReqVO queueSaveReqVO) {
BedQueueBO bedQueueBO = priorityQueue.peek();
+ if (null == bedQueueBO)
+ return;
+
if (bedQueueBO.queueNum == bedQueueBO.maxQueueNum) {
queueSaveReqVO.setStatus(QueueStatusEnum.WAITING.getStatus()); //鎺掗槦涓�
+ QueueDO queue = BeanUtils.toBean(queueSaveReqVO, QueueDO.class);
+ queueMapper.insert(queue); // queue.getId();
} else if (bedQueueBO.queueNum < bedQueueBO.maxQueueNum) {
queueSaveReqVO.setStatus(QueueStatusEnum.READY.getStatus()); //鍊欒瘖鍑嗗涓�
- queueSaveReqVO.setRoomNum(bedQueueBO.getRoomName());
- queueSaveReqVO.setBedNum(bedQueueBO.getBedNo());
- queueSaveReqVO.setSeqNum(curSeqNum++);
+ queueSaveReqVO.setRoomId(bedQueueBO.getRoomId());
+ queueSaveReqVO.setRoomName(bedQueueBO.getRoomName());
+ queueSaveReqVO.setBedNo(bedQueueBO.getBedNo());
+ queueSaveReqVO.setSeqNum(curSeqNum);
QueueDO queue = BeanUtils.toBean(queueSaveReqVO, QueueDO.class);
queueMapper.insert(queue); // queue.getId();
+ curSeqNum++;
bedQueueBO.queueNum++;
+ BedQueueBO bedQueueBO2 = priorityQueue.poll();
+ priorityQueue.offer(bedQueueBO2);
}
+
+
}
@PostConstruct
- private void initQueue() {
+ public void initQueue() {
+ priorityQueue.clear();
+
List<RoomDO> roomDOList = roomMapper.simpleRoomList();
List<BedQueueBO> bedQueueBOList = roomDOList.stream().map(item -> BeanUtils.toBean(item, BedQueueBO.class)).toList();
+ List<Byte> queueStatusList = new ArrayList<>();
+ queueStatusList.add(QueueStatusEnum.READY.getStatus());
+ List<QueueStatisticDO> queueStatisticDOList = queueMapper.queueStatistic(queueStatusList);
+
bedQueueBOList.forEach(item -> {
item.maxQueueNum = MAX_QUEUE_NUM;
- item.queueNum = 0;
- priorityQueue.add(item);
+ Optional<QueueStatisticDO> queueStatisticDOOptional = queueStatisticDOList.stream().filter(it->it.getRoomId()==item.roomId && it.getBedNo().equals(item.getBedNo())).findFirst();
+ item.queueNum = queueStatisticDOOptional.isPresent() ? queueStatisticDOOptional.get().getTotalInStatus() : 0;
+ priorityQueue.offer(item);
});
curSeqNum = queueMapper.getMaxSeqNum();
+ curSeqNum = null == curSeqNum ? 1 : ++curSeqNum;
+ }
+
+ /**
+ * TODO 鏂板紑闃熷垪鏃讹紝闇�瑕佹妸鎺掗槦涓殑浜� 杞埌 灏辫瘖鍑嗗 鐘舵��
+ * 绛夊埌鍙栦笅涓�涓� 鎺掗槦涓汉鍛� 鐨勯�昏緫瀹屾垚鍚庯紝鍐嶅洖鏉ヤ笉閿�
+ */
+ public void hurryup() {
}
}
-
diff --git a/sql/mysql/jh.sql b/sql/mysql/jh.sql
index 423790b..776bbc7 100644
--- a/sql/mysql/jh.sql
+++ b/sql/mysql/jh.sql
@@ -49,12 +49,13 @@
`pat_gender` tinyint(1) DEFAULT NULL COMMENT '鎮h�呮�у埆',
`book_timeslot` int NOT NULL COMMENT '棰勭害鏃堕棿娈�',
`book_check_type` tinyint(1) DEFAULT NULL COMMENT '棰勭害妫�鏌ョ被鍨�',
- `seq_num` int NOT NULL COMMENT '鎺掗槦搴忓彿',
+ `seq_num` int DEFAULT NULL COMMENT '鎺掗槦搴忓彿',
`status` tinyint(1) NOT NULL COMMENT '10:鎺掗槦涓� 20:鍊欒瘖鍑嗗 30:灏辫瘖涓� 40:灏辫瘖瀹屾垚 50:杩囧彿 60:杩囨湡',
- `passed` tinyint(1) NOT NULL COMMENT '杩囧彿鏍囪',
- `expired` tinyint(1) NOT NULL COMMENT '棰勭害杩囨湡鏍囪',
- `room_num` varchar(10) DEFAULT NULL COMMENT '璇婂缂栧彿',
- `bed_num` varchar(10) DEFAULT NULL COMMENT '璇婄枟搴婄紪鍙�',
+ `passed` tinyint(1) DEFAULT 0 COMMENT '杩囧彿鏍囪',
+ `expired` tinyint(1) DEFAULT 0 COMMENT '棰勭害杩囨湡鏍囪',
+ `room_id` BIGINT DEFAULT 0 COMMENT '璇婂缂栧彿',
+ `room_name` varchar(10) DEFAULT "" COMMENT '璇婂鍚嶇О',
+ `bed_no` varchar(10) DEFAULT "" COMMENT '璇婄枟搴婄紪鍙�',
`tenant_id` int NOT NULL COMMENT '绉熸埛缂栧彿',
`creator` varchar(10) DEFAULT '' COMMENT '鍒涘缓鑰�',
`create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿',
--
Gitblit v1.9.3