From c98f3f5dc2d9e7bcffdb505f226bb9888f9b3869 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期日, 01 九月 2024 10:48:59 +0800
Subject: [PATCH] update
---
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java | 4 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java | 85 +++++++++++++++++++++++++++---------------
2 files changed, 57 insertions(+), 32 deletions(-)
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 0191cf8..e12702c 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
@@ -13,9 +13,11 @@
ErrorCode APPOINTMENT_NOT_EXISTS = new ErrorCode(1_010_001_000, "棰勭害涓嶅瓨鍦�");
ErrorCode ROOM_NOT_EXISTS = new ErrorCode(1_010_002_000, "璇婂鍜岃瘖鐤楀簥涓嶅瓨鍦�");
+ ErrorCode ROOM_NOT_SIT = new ErrorCode(1_010_002_000, "璇烽噸鏂板氨搴�");
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_BED_NOT_EXIST = new ErrorCode(1_010_003_001, "宸ヤ綅闃熷垪涓嶅瓨鍦�");
+ ErrorCode QUEUE_BED_EXIST = new ErrorCode(1_010_003_001, "宸ヤ綅闃熷垪宸插瓨鍦�");
ErrorCode QUEUE_HAVE_PATIENT = new ErrorCode(1_010_003_002, "闃熷垪涓湁鎮h��");
ErrorCode QUEUE_NOT_READY_PATIENT = new ErrorCode(1_010_003_003, "娌℃湁鍑嗗涓殑鎮h��");
}
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 bd58c2d..7668e31 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
@@ -236,13 +236,20 @@
*/
@Override
public ErrorCode bedOpen(Long roomId, String bedNo) {
+ BedQueueBO bedQueueBO2 = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo));
+ if (null != bedQueueBO2) {
+ log.error("bedOpen mapBedVsQueue has existed" + roomId + " " + bedNo);
+ return QUEUE_BED_EXIST;
+ }
+
// DB update
List statusList = new ArrayList<BedStatusEnum>();
statusList.add(BedStatusEnum.CLOSED);
- Integer updateNum = roomMapper.setBedOpeningClosed(roomId, bedNo,
- BedStatusEnum.OPENING, statusList);
- if ( null==updateNum || 0 == updateNum )
+ Integer updateNum = roomMapper.setBedOpeningClosed(roomId, bedNo, BedStatusEnum.OPENING, statusList);
+ if ( null==updateNum || 0 == updateNum ) {
+ log.error("bedOpen DB invalid status " + roomId + " " + bedNo);
return ROOM_INVALID_STATUS;
+ }
List<Byte> queueStatusList = new ArrayList<>();
queueStatusList.add(QueueStatusEnum.READY.getStatus());
@@ -263,8 +270,10 @@
@Override
public ErrorCode bedClose(Long roomId, String bedNo) {
BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo));
- if (null == bedQueueBO)
- return QUEUE_BED_ABNORMAL;
+ if (null == bedQueueBO) {
+ log.error("bedClose mapBedVsQueue DONOT existed" + roomId + " " + bedNo);
+ return QUEUE_BED_NOT_EXIST;
+ }
// 闄や簡鍒ゆ柇 鍑嗗鍊欒瘖涓� 鐨勪汉鏁帮紝杩橀渶瑕� 鍒ゆ柇 杩囧彿鐨勪汉鏁�
//if (bedQueueBO.getQueueNum().get() >0)
@@ -284,8 +293,10 @@
statusList.add(BedStatusEnum.PAUSE);
Integer updateNum = roomMapper.setBedOpeningClosed(roomId, bedNo,
BedStatusEnum.CLOSED, statusList);
- if ( null==updateNum || 0 == updateNum )
+ if ( null==updateNum || 0 == updateNum ) {
+ log.error("bedClose DB invalid status " + roomId + " " + bedNo);
return ROOM_INVALID_STATUS;
+ }
mapBedVsQueue.remove(String.format("%09d%s", roomId, bedNo));
priorityQueue.remove(bedQueueBO);
@@ -296,13 +307,13 @@
public CommonResult<RoomRespVO> getRoom(Long roomId, String bedNo, Long docId) {
BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo));
if (null == bedQueueBO) {
- return error(QUEUE_BED_ABNORMAL);
+ log.error("getRoom mapBedVsQueue DONOT existed" + roomId + " " + bedNo);
+ return error(QUEUE_BED_NOT_EXIST);
}
RoomDO roomDO = roomMapper.getRoom(roomId, bedNo, docId);
if (null == roomDO) {
- System.out.println("getRoom ========");
- return error(ECG_INNER_ERROR);
+ return error(ROOM_NOT_SIT);
}
RoomRespVO roomRespVO = BeanUtils.toBean(roomDO, RoomRespVO.class);
@@ -312,16 +323,19 @@
@Override
public ErrorCode bedDoctorPause(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;
+ if (null == bedQueueBO) {
+ log.error("bedDoctorPause mapBedVsQueue DONOT existed" + roomId + " " + bedNo);
+ return QUEUE_BED_NOT_EXIST;
+ }
// DB update
List statusList = new ArrayList<BedStatusEnum>();
statusList.add(BedStatusEnum.DOCTOR_ON);
- Integer updateNum = roomMapper.setBedDoctorStatus(roomId, bedNo, docId,
- BedStatusEnum.PAUSE, statusList);
- if ( null==updateNum || 0 == updateNum )
+ Integer updateNum = roomMapper.setBedDoctorStatus(roomId, bedNo, docId, BedStatusEnum.PAUSE, statusList);
+ if ( null==updateNum || 0 == updateNum ) {
+ log.error("bedDoctorPause DB invalid status " + roomId + " " + bedNo);
return ROOM_INVALID_STATUS;
+ }
bedQueueBO.setStatus(BedStatusEnum.PAUSE.getStatus());
priorityQueue.remove(bedQueueBO);
@@ -331,22 +345,27 @@
@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 || !bedQueueBO.getStatus().equals(BedStatusEnum.PAUSE.getStatus()))
- return QUEUE_BED_ABNORMAL;
+ if (null == bedQueueBO || !bedQueueBO.getStatus().equals(BedStatusEnum.PAUSE.getStatus())) {
+ log.error("bedDoctorResume mapBedVsQueue DONOT existed OR NOT Paused. " + roomId + " " + bedNo);
+ return QUEUE_BED_NOT_EXIST;
+ }
// DB update
List statusList = new ArrayList<BedStatusEnum>();
statusList.add(BedStatusEnum.PAUSE);
Integer updateNum = roomMapper.setBedDoctorStatus(roomId, bedNo, docId,
BedStatusEnum.DOCTOR_ON, statusList);
- if ( null==updateNum || 0 == updateNum )
+ if ( null==updateNum || 0 == updateNum ) {
+ log.error("bedDoctorResume DB invalid status " + roomId + " " + bedNo);
return ROOM_INVALID_STATUS;
+ }
bedQueueBO.setStatus(BedStatusEnum.DOCTOR_ON.getStatus());
if (!priorityQueue.contains(bedQueueBO)) {
priorityQueue.offer(bedQueueBO);
} else {
- log.error("bedDoctorResume HAVE EXCEPTION!");
+ log.error("bedDoctorResume priorityQueue still exist!. " + roomId + " " + bedNo);
+ return ECG_INNER_ERROR;
}
hurryup();
@@ -356,38 +375,42 @@
@Override
public ErrorCode bedDoctorOn(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;
+ if (null == bedQueueBO) {
+ log.error("bedDoctorOn mapBedVsQueue DONOT existed. " + roomId + " " + bedNo);
+ return QUEUE_BED_NOT_EXIST;
+ }
// DB update
List statusList = new ArrayList<BedStatusEnum>();
statusList.add(BedStatusEnum.OPENING);
- Integer updateNum = roomMapper.setBedDoctorOn(roomId, bedNo, docId, docName,
- BedStatusEnum.DOCTOR_ON, statusList);
- if ( null==updateNum || 0 == updateNum )
+ Integer updateNum = roomMapper.setBedDoctorOn(roomId, bedNo, docId, docName, BedStatusEnum.DOCTOR_ON, statusList);
+ if ( null==updateNum || 0 == updateNum ) {
+ log.error("bedDoctorOn DB invalid status " + roomId + " " + bedNo);
return ROOM_INVALID_STATUS;
+ }
bedQueueBO.setStatus(BedStatusEnum.DOCTOR_ON.getStatus());
-
return SUCCESS;
}
@Override
public ErrorCode bedDoctorOff(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;
+ if (null == bedQueueBO) {
+ log.error("bedDoctorOff mapBedVsQueue DONOT existed. " + roomId + " " + bedNo);
+ return QUEUE_BED_NOT_EXIST;
+ }
// DB update
List statusList = new ArrayList<BedStatusEnum>();
statusList.add(BedStatusEnum.DOCTOR_ON);
- Integer updateNum = roomMapper.setBedDoctorOff(roomId, bedNo, docId,
- BedStatusEnum.OPENING, statusList);
- if ( null==updateNum || 0 == updateNum )
+ Integer updateNum = roomMapper.setBedDoctorOff(roomId, bedNo, docId, BedStatusEnum.OPENING, statusList);
+ if ( null==updateNum || 0 == updateNum ) {
+ log.error("bedDoctorOff DB invalid status " + roomId + " " + bedNo);
return ROOM_INVALID_STATUS;
+ }
bedQueueBO.setStatus(BedStatusEnum.OPENING.getStatus());
-
return SUCCESS;
}
@@ -461,6 +484,7 @@
if (0 == openingFlag.get())
return;
+ // TODO
if (mapBedVsQueue.size() != priorityQueue.size()) {
log.error("map " + mapBedVsQueue.size() + " priority " + priorityQueue.size());
}
@@ -546,7 +570,6 @@
// 浠� DB 鎶� 搴忓彿鏈�灏忕殑 灏辫瘖鍑嗗涓殑浜� 璁剧疆涓哄氨璇婁腑
Integer updateNum = queueMapper.updateQueueStatus(roomId, bedNo,
QueueStatusEnum.READY.getStatus(), QueueStatusEnum.ONSTAGE.getStatus());
-
// 璇ュ伐浣� 娌℃湁 灏辫瘖鍑嗗涓� 浜哄憳
if (null == updateNum || 0 == updateNum) {
return QUEUE_NOT_READY_PATIENT;
--
Gitblit v1.9.3