From 3090ed6f6ff02c215360da580e2fbe8a453bcc0f Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 27 八月 2024 16:19:47 +0800
Subject: [PATCH] update
---
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java | 1
jh-server/src/main/resources/application-local.yaml | 10 ++-
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java | 63 +++++++++++++++++++-
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/room/RoomMapper.java | 11 +++
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/BedStatusEnum.java | 1
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomServiceImpl.java | 7 ++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedDoctorResumeCallable.java | 29 +++++++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java | 2
8 files changed, 113 insertions(+), 11 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/BedStatusEnum.java b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/BedStatusEnum.java
index df87e00..d28ea84 100644
--- a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/BedStatusEnum.java
+++ b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/BedStatusEnum.java
@@ -15,7 +15,6 @@
@AllArgsConstructor
public enum BedStatusEnum implements IntArrayValuable {
CLOSED(0, "宸插叧闂�"),
- CLOSING(1, "鍏抽棴涓�"),
OPENING(10, "宸插紑閫�"),
DOCTOR_ON(20, "鏈夊尰鐢�"),
PAUSE(30, "鏆傚仠");
diff --git a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
index 310a6dc..7dbe8dc 100644
--- a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
+++ b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java
@@ -16,4 +16,5 @@
ErrorCode ROOM_INVALID_STATUS = new ErrorCode(1_010_002_001, "璇婂鍜岃瘖鐤楀簥鐘舵�佸紓甯�");
ErrorCode QUEUE_NOT_EXISTS = new ErrorCode(1_010_003_000, "鎺掗槦涓嶅瓨鍦�");
ErrorCode QUEUE_BED_ABNORMAL = new ErrorCode(1_010_003_001, "宸ヤ綅闃熷垪涓嶅瓨鍦�");
+ ErrorCode QUEUE_HAVE_PATIENT = new ErrorCode(1_010_003_001, "鎮h�呴槦鍒椾腑");
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/room/RoomMapper.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/room/RoomMapper.java
index f62617b..786d154 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/room/RoomMapper.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/room/RoomMapper.java
@@ -34,8 +34,15 @@
@Select({ "SELECT room_id, room_name, count(1) as bed_num FROM lihu.clinic_room group by room_id;" })
List<RoomStatisticsDO> roomStatistic();
- @Select({ "SELECT id, room_id, room_name, bed_no, status, doc_id, doc_name FROM lihu.clinic_room where status >= 10;" })
- List<RoomDO> simpleRoomList();
+ @Select("<script> " +
+ "SELECT id, room_id, room_name, bed_no, status, doc_id, doc_name FROM lihu.clinic_room " +
+ "where status in ( " +
+ " <foreach collection='curStatusList' separator=',' item='curStatus'>" +
+ " #{curStatus.status} " +
+ " </foreach> );" +
+ "</script>")
+
+ List<RoomDO> simpleRoomList(@Param("curStatusList") List<BedStatusEnum> curStatusList);
@Update("<script> " +
"update lihu.clinic_room set status=#{newStatus.status} where room_id=#{roomId} and bed_no=#{bedNo} " +
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedDoctorResumeCallable.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedDoctorResumeCallable.java
new file mode 100644
index 0000000..aa44f25
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/BedDoctorResumeCallable.java
@@ -0,0 +1,29 @@
+package cn.lihu.jh.module.ecg.service.queue;
+
+import cn.lihu.jh.framework.common.exception.ErrorCode;
+
+import java.util.concurrent.Callable;
+
+public class BedDoctorResumeCallable implements Callable<ErrorCode> {
+
+ QueueService queueService;
+ private Long roomId;
+ private String bedNo;
+ private Long docId;
+ private String docName;
+
+ public BedDoctorResumeCallable(QueueService queueService, Long roomId, String bedNo, Long docId, String docName)
+ {
+ super();
+ this.queueService = queueService;
+ this.roomId = roomId;
+ this.bedNo = bedNo;
+ this.docId = docId;
+ this.docName = docName;
+ }
+
+ public ErrorCode call() throws Exception {
+ return queueService.bedDoctorResume(roomId, bedNo, docId, docName);
+ }
+
+}
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 7095865..1170cf1 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
@@ -48,12 +48,14 @@
ErrorCode startBedOpen(Long roomId, String bedNo);
ErrorCode startBedClose(Long roomId, String bedNo);
ErrorCode startBedDoctorPause(Long roomId, String bedNo, Long docId, String docName);
+ ErrorCode startBedDoctorResume(Long roomId, String bedNo, Long docId, String docName);
ErrorCode startBedDoctorOn(Long roomId, String bedNo, Long docId, String docName);
ErrorCode startBedDoctorOff(Long roomId, String bedNo, Long docId, String docName);
ErrorCode bedOpen(Long roomId, String bedNo);
ErrorCode bedClose(Long roomId, String bedNo);
ErrorCode bedDoctorPause(Long roomId, String bedNo, Long docId, String docName);
+ ErrorCode bedDoctorResume(Long roomId, String bedNo, Long docId, String docName);
ErrorCode bedDoctorOn(Long roomId, String bedNo, Long docId, String docName);
ErrorCode bedDoctorOff(Long roomId, String bedNo, Long docId, String docName);
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 88e09de..eb40058 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
@@ -130,6 +130,24 @@
}
@Override
+ public ErrorCode startBedDoctorResume(Long roomId, String bedNo, Long docId, String docName) {
+ Future<ErrorCode> future = singleThreadExecutor.submit(
+ new BedDoctorResumeCallable(this, roomId, bedNo, docId, docName)
+ );
+
+ try {
+ ErrorCode ret = future.get();
+ return ret;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ }
+
+ return ECG_INNER_ERROR;
+ }
+
+ @Override
public ErrorCode startBedDoctorOn(Long roomId, String bedNo, Long docId, String docName) {
Future<ErrorCode> future = singleThreadExecutor.submit(
new BedDoctorOnCallable(this, roomId, bedNo, docId, docName)
@@ -177,7 +195,6 @@
// DB update
List statusList = new ArrayList<BedStatusEnum>();
statusList.add(BedStatusEnum.CLOSED);
- statusList.add(BedStatusEnum.CLOSING);
Integer updateNum = roomMapper.setBedStatus(roomId, bedNo,
BedStatusEnum.OPENING, statusList);
if ( null==updateNum || 0 == updateNum )
@@ -193,6 +210,7 @@
bedQueueBO.setBedNo(bedNo);
bedQueueBO.setMaxQueueNum(MAX_QUEUE_NUM);
bedQueueBO.setQueueNum(new AtomicInteger(queueDOList.size()));
+ bedQueueBO.setStatusEnum(BedStatusEnum.OPENING);
priorityQueue.offer(bedQueueBO);
mapBedVsQueue.put(String.format("%09d%s", roomId, bedNo), bedQueueBO);
return SUCCESS;
@@ -204,13 +222,19 @@
if (null == bedQueueBO)
return QUEUE_BED_ABNORMAL;
+ if (bedQueueBO.getQueueNum().get() >0)
+ return QUEUE_HAVE_PATIENT;
+
+ BedStatusEnum destStatusEnum = destStatusEnum = BedStatusEnum.CLOSED;
+ mapBedVsQueue.remove(String.format("%09d%s", roomId, bedNo));
+ priorityQueue.remove(bedQueueBO);
+
// DB update
List statusList = new ArrayList<BedStatusEnum>();
statusList.add(BedStatusEnum.OPENING);
statusList.add(BedStatusEnum.DOCTOR_ON);
statusList.add(BedStatusEnum.PAUSE);
- Integer updateNum = roomMapper.setBedStatus(roomId, bedNo,
- BedStatusEnum.CLOSING, statusList);
+ Integer updateNum = roomMapper.setBedStatus(roomId, bedNo, destStatusEnum, statusList);
if ( null==updateNum || 0 == updateNum )
return ROOM_INVALID_STATUS;
@@ -222,6 +246,29 @@
BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo));
if (null == bedQueueBO)
return QUEUE_BED_ABNORMAL;
+
+ bedQueueBO.setStatusEnum(BedStatusEnum.PAUSE);
+ priorityQueue.remove(bedQueueBO);
+
+ // DB update
+ List statusList = new ArrayList<BedStatusEnum>();
+ statusList.add(BedStatusEnum.DOCTOR_ON);
+ Integer updateNum = roomMapper.setBedDoctorPause(roomId, bedNo, docId, docName,
+ BedStatusEnum.PAUSE, statusList);
+ if ( null==updateNum || 0 == updateNum )
+ return ROOM_INVALID_STATUS;
+
+ return SUCCESS;
+ }
+
+ @Override
+ public ErrorCode bedDoctorResume(Long roomId, String bedNo, Long docId, String docName) {
+ BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo));
+ if (null == bedQueueBO)
+ return QUEUE_BED_ABNORMAL;
+
+ bedQueueBO.setStatusEnum(BedStatusEnum.DOCTOR_ON);
+ priorityQueue.offer(bedQueueBO);
// DB update
List statusList = new ArrayList<BedStatusEnum>();
@@ -248,6 +295,8 @@
if ( null==updateNum || 0 == updateNum )
return ROOM_INVALID_STATUS;
+ bedQueueBO.setStatusEnum(BedStatusEnum.DOCTOR_ON);
+
return SUCCESS;
}
@@ -264,6 +313,8 @@
BedStatusEnum.OPENING, statusList);
if ( null==updateNum || 0 == updateNum )
return ROOM_INVALID_STATUS;
+
+ bedQueueBO.setStatusEnum(BedStatusEnum.OPENING);
return SUCCESS;
}
@@ -294,7 +345,11 @@
mapBedVsQueue.clear();
// 浠嶥B 鑾峰彇 宸ヤ綅鍒楄〃
- List<RoomDO> roomDOList = roomMapper.simpleRoomList();
+ List<BedStatusEnum> bedStatusEnumList = new ArrayList<BedStatusEnum>();
+ bedStatusEnumList.add(BedStatusEnum.OPENING);
+ bedStatusEnumList.add(BedStatusEnum.DOCTOR_ON);
+ bedStatusEnumList.add(BedStatusEnum.PAUSE);
+ List<RoomDO> roomDOList = roomMapper.simpleRoomList(bedStatusEnumList);
List<BedQueueBO> bedQueueBOList = roomDOList.stream().map(item -> BeanUtils.toBean(item, BedQueueBO.class)).toList();
// 浠嶥B 鑾峰彇 闃熷垪涓� 灏辫瘖鍑嗗涓汉鍛樼粺璁� 鍒楄〃
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomServiceImpl.java
index 72834a7..f6060ee 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomServiceImpl.java
@@ -5,6 +5,7 @@
import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO;
import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomStatisticsDO;
import cn.lihu.jh.module.ecg.dal.mysql.room.RoomMapper;
+import cn.lihu.jh.module.ecg.enums.BedStatusEnum;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
@@ -81,6 +82,10 @@
@Override
public List<RoomDO> simpleRoomList() {
- return roomMapper.simpleRoomList();
+ List<BedStatusEnum> bedStatusEnumList = new ArrayList<BedStatusEnum>();
+ bedStatusEnumList.add(BedStatusEnum.OPENING);
+ bedStatusEnumList.add(BedStatusEnum.DOCTOR_ON);
+ bedStatusEnumList.add(BedStatusEnum.PAUSE);
+ return roomMapper.simpleRoomList(bedStatusEnumList);
}
}
\ No newline at end of file
diff --git a/jh-server/src/main/resources/application-local.yaml b/jh-server/src/main/resources/application-local.yaml
index acac1e8..899c467 100644
--- a/jh-server/src/main/resources/application-local.yaml
+++ b/jh-server/src/main/resources/application-local.yaml
@@ -74,10 +74,14 @@
# Redis 閰嶇疆銆俁edisson 榛樿鐨勯厤缃冻澶熶娇鐢紝涓�鑸笉闇�瑕佽繘琛岃皟浼�
redis:
- host: 116.62.18.175 #r-bp1zyjl0g07e1ry08rpd.redis.rds.aliyuncs.com # 鍦板潃
- port: 6020 #绔彛 6379
+# host: 116.62.18.175 #r-bp1zyjl0g07e1ry08rpd.redis.rds.aliyuncs.com # 鍦板潃
+# port: 6020 #绔彛 6379
+# database: 15 # 鏁版嵁搴撶储寮�
+# password: Smartor #Root@yinyu # 瀵嗙爜锛屽缓璁敓浜х幆澧冨紑鍚�
+ host: 127.0.0.1
+ port: 6379
database: 15 # 鏁版嵁搴撶储寮�
- password: Smartor #Root@yinyu # 瀵嗙爜锛屽缓璁敓浜х幆澧冨紑鍚�
+# password: Root@yinyu # 瀵嗙爜锛屽缓璁敓浜х幆澧冨紑鍚�
--- #################### 瀹氭椂浠诲姟鐩稿叧閰嶇疆 ####################
--
Gitblit v1.9.3