From cac7f142c909d712d6d49c45b0d4efbdef673e48 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期三, 13 十一月 2024 16:25:16 +0800
Subject: [PATCH] 过号 - 检查项目.亲和性
---
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java | 1
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java | 21 +++++--
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java | 31 ++++++++-
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queue/QueueMapper.java | 19 +++++-
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueService.java | 4
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java | 53 ++++++++++++-----
6 files changed, 96 insertions(+), 33 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 d3549ec..658fdc1 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
@@ -27,6 +27,7 @@
ErrorCode QUEUE_BED_EXIST = new ErrorCode(1_010_003_002, "宸ヤ綅闃熷垪宸插瓨鍦�");
ErrorCode QUEUE_HAVE_PATIENT = new ErrorCode(1_010_003_003, "闃熷垪涓湁鎮h��");
ErrorCode QUEUE_NOT_READY_PATIENT = new ErrorCode(1_010_003_004, "娌℃湁鍑嗗涓殑鎮h��");
+ ErrorCode QUEUE_RECALL_INSTALL_NOT_CUR_ROOM = new ErrorCode(1_010_003_005, "涓嶈兘鍙洖鍏朵粬璇婂鐨勫畨瑁呮偅鑰�");
ErrorCode PATIENT_NOT_EXISTS = new ErrorCode(1_010_004_000, "鎮h�呬笉瀛樺湪");
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java
index bd393d7..6f80f2a 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java
@@ -28,8 +28,7 @@
import static cn.lihu.jh.framework.common.exception.enums.GlobalErrorCodeConstants.SUCCESS;
import static cn.lihu.jh.framework.common.pojo.CommonResult.error;
import static cn.lihu.jh.framework.common.pojo.CommonResult.success;
-import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.ECG_INNER_ERROR;
-import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.PATIENT_NOT_EXISTS;
+import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*;
@Tag(name = "绠$悊鍚庡彴 - 鍖荤敓鍙彿")
@RestController
@@ -385,9 +384,12 @@
public CommonResult<String> recallPatient(
@RequestParam("roomId") Long roomId,
@RequestParam("bedNo") String bedNo,
- @RequestParam("patId") String patId )
+ @RequestParam("patId") String patId,
+ @RequestParam("checkType") Integer checkType,
+ @RequestParam("roomId_operator") Long roomId_operator,
+ @RequestParam("bedNo_operator") String bedNo_operator )
{
- Integer result = queueService.recallPatient(roomId, bedNo, patId);
+ Integer result = queueService.recallPatient(roomId, bedNo, patId, checkType);
if (null == result || 0 == result)
return error(PATIENT_NOT_EXISTS);
@@ -399,13 +401,20 @@
@Parameter(name = "roomId", description = "璇婂缂栧彿", required = true, example = "116")
@Parameter(name = "bedNo", description = "宸ヤ綅缂栧彿", required = true, example = "B2")
@Parameter(name = "patId", description = "鎮h�呯紪鍙�", required = true, example = "B2")
+ @Parameter(name = "checkType", description = "妫�鏌ョ被鍨�", required = true, example = "100")
@PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
public CommonResult<String> recallInstallPatient(
@RequestParam("roomId") Long roomId,
@RequestParam("bedNo") String bedNo,
- @RequestParam("patId") String patId )
+ @RequestParam("patId") String patId,
+ @RequestParam("checkType") Integer checkType,
+ @RequestParam("roomId_operator") Long roomId_operator,
+ @RequestParam("bedNo_operator") String bedNo_operator )
{
- Integer result = queueService.recallInstallPatient(roomId, bedNo, patId);
+ if (roomId != roomId_operator)
+ return error(QUEUE_RECALL_INSTALL_NOT_CUR_ROOM);
+
+ Integer result = queueService.recallInstallPatient(roomId, bedNo, patId, checkType, bedNo_operator);
if (null == result || 0 == result)
return error(PATIENT_NOT_EXISTS);
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 d79bc05..7592e6b 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
@@ -174,6 +174,15 @@
"</script>" )
QueueDO getFirstItemByRoomAndStatus(@Param("roomId")Long roomId, @Param("curStatusList")List<Integer> curStatusList);
+
+/*
+ @Select("select * from lihu.queue where room_id = #{roomId} and bed_no = #{bedNo} " +
+ " and status = #{curStatus} and pat_id = #{patId} and book_check_type=#{checkType}")
+ QueueDO XXX(@Param("roomId")Long roomId, @Param("bedNo")String bedNo,
+ @Param("patId")String patId, @Param("checkType")Integer checkType,
+ @Param("curStatus")Integer curStatus);
+*/
+
@Update("update lihu.queue set status = #{newStatus} where status = #{curStatus} and 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 )")
@@ -220,14 +229,16 @@
// 甯歌妫�鏌� 鎴� 棰嗙敤 鐨勬偅鑰呭彫鍥�, 鍘熷伐浣嶅鐞�
@Update("update lihu.queue set status = #{newStatus}, passed = 1 " +
- " 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,
+ " where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus} and pat_id = #{patId} and book_check_type=#{checkType}")
+ Integer recallPassedPatient(@Param("roomId")Long roomId, @Param("bedNo")String bedNo,
+ @Param("patId")String patId, @Param("checkType")Integer checkType,
@Param("curStatus")Integer curStatus, @Param("newStatus")Integer newStatus);
// 瑁呮満鍖荤敓 鍏佽鎶㈠崰 鏈瀹� [瀹夎杩囧彿] 鐨勬偅鑰�
@Update("update lihu.queue set status = #{newStatus}, bed_no = #{bedNo}, passed = 1 " +
- " where room_id = #{roomId} and status = #{curStatus} and pat_id = #{patId} ")
- Integer recallPassedInstallPatient(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("patId")String patId,
+ " where room_id = #{roomId} and status = #{curStatus} and pat_id = #{patId} and book_check_type=#{checkType}")
+ Integer recallPassedInstallPatient(@Param("roomId")Long roomId, @Param("bedNo")String bedNo,
+ @Param("patId")String patId, @Param("checkType")Integer checkType,
@Param("curStatus")Integer curStatus, @Param("newStatus")Integer newStatus);
@Update("update lihu.queue set jump_flag = #{jumped} " +
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 3db4f8a..fc8277f 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
@@ -124,9 +124,9 @@
PatientStatisticVO getBedDevInstallStatistic(Long roomId, String bedNo);
- Integer recallPatient(Long roomId, String bedNo, String patId);
+ Integer recallPatient(Long roomId, String bedNo, String patId, Integer checkType);
- Integer recallInstallPatient(Long roomId, String bedNo, String patId);
+ Integer recallInstallPatient(Long roomId, String bedNo, String patId, Integer checkType, String bedNo_operator);
Integer patientJump(String patId, Byte jumped );
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 9eba672..611be23 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
@@ -523,18 +523,26 @@
}
@Override
- public Integer recallPatient(Long roomId, String bedNo, String patId) {
- Integer updateNum = queueMapper.recallPassedPatient(roomId, bedNo, patId,
+ public Integer recallPatient(Long roomId, String bedNo, String patId, Integer checkType) {
+ Integer updateNum = queueMapper.recallPassedPatient(roomId, bedNo, patId, checkType,
QueueStatusEnum.PASSED.getStatus(), QueueStatusEnum.RECALLED.getStatus());
+
+ // 妫�鏌ラ」鐩�.浜插拰鎬� 涓嶉渶瑕佸湪杩欓噷澶勭悊
+ // 浼氬湪 HurryUpOnBed 閲岄潰澶勭悊 妫�鏌ラ」鐩�.浜插拰鎬�
+
startHurryUpOneBed(roomId, bedNo);
return updateNum;
}
@Override
- public Integer recallInstallPatient(Long roomId, String bedNo, String patId) {
- Integer updateNum = queueMapper.recallPassedInstallPatient(roomId, bedNo, patId,
+ public Integer recallInstallPatient(Long roomId, String bedNo, String patId, Integer checkType, String bedNo_operator) {
+ Integer updateNum = queueMapper.recallPassedInstallPatient(roomId, bedNo_operator, patId, checkType,
QueueStatusEnum.PASSED_INSTALL.getStatus(), QueueStatusEnum.RECALLED_INSTALL.getStatus());
- // 瀹夎宸ヤ綅 涓嶈璁� 浼樺厛闃熷垪
+
+ // 妫�鏌ラ」鐩�.浜插拰鎬� 澶勭悊
+ updateAffinityItemsWhenInstallRecall(patId, checkType, bedNo_operator);
+
+ // 瀹夎宸ヤ綅 涓嶆秹鍙� 浼樺厛闃熷垪
//startHurryUpOneBed(roomId, bedNo);
return updateNum;
}
@@ -634,4 +642,17 @@
return roomDO;
}
+ private void updateAffinityItemsWhenInstallRecall(String patId, Integer checkType, String bedNo_operator) {
+ CheckTypeDO checkTypeDO = queueServiceTxFunctions.getCheckTypeItem( checkType );
+ if ( checkTypeDO.getAffinityCheckTypes().length > 0) {
+ List<QueueDO> affinityItems = queueMapper.getCurPatGivenCheckTypesAndStatus(patId,
+ checkTypeDO.getAffinityCheckTypes(), QueueStatusEnum.AFFINITY_RECEIVED.getStatus());
+ for (int i = 0; i < affinityItems.size(); i++) {
+ QueueDO queueItem = affinityItems.get(i);
+ queueItem.setBedNo( bedNo_operator );
+ //queueItem.setSeqNum( preemptQueueItem.getSeqNum() ); // 瑁呮満鏃� 鍐呴儴搴忓彿涓嶅彉
+ queueMapper.updateById(queueItem);
+ }
+ }
+ }
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java
index 6c7db20..4139321 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java
@@ -401,11 +401,15 @@
bedQueueBO.getRoomId(),
bedQueueBO.getRoomName(),
bedQueueBO.getBedNo(),
- curSeqNum.get() + 1,
+ curSeqNum.get() + 1, // 杩囧彿鍥炴潵锛屾帓鍒板綋鍓嶇殑涓嬩竴浣�
QueueStatusEnum.RECALLED.getStatus(), // 涓嶉渶瑕佸鐞� [瀹夎鍙洖], 鍘熷洜: 瀹夎宸ヤ綅 娌℃湁浼樺厛闃熷垪
QueueStatusEnum.READY.getStatus());
if (null == updateNum || 0 == updateNum)
break;
+
+ // 鍙洖 [杩囧彿] 鎮h�呭悗锛屽鐞� 妫�鏌ラ」鐩�.浜插拰鎬� 閫昏緫
+ QueueDO recalledQueueItem = queueMapper.getQueueItemBySeqNum(curSeqNum.get() + 1);
+ updateAffinityItemsWhenRecalled( recalledQueueItem );
curSeqNum.getAndIncrement();
@@ -455,21 +459,8 @@
}
// 鎶㈠埌鎺掗槦鎮h�呭悗锛屽鐞� 妫�鏌ラ」鐩�.浜插拰鎬� 閫昏緫
- QueueDO queueDO = queueMapper.getQueueItemBySeqNum(curSeqNum.get() + 1);
- CheckTypeDO checkTypeDO = getCheckTypeItem( queueDO.getBookCheckType() );
- if ( checkTypeDO.getAffinityCheckTypes().length > 0) {
- List<QueueDO> affinityItems = queueMapper.getCurPatGivenCheckTypesAndStatus(queueDO.getPatId(),
- checkTypeDO.getAffinityCheckTypes(), QueueStatusEnum.WAITING.getStatus());
- for (int i = 0; i < affinityItems.size(); i++) {
- QueueDO queueItem = affinityItems.get(i);
- queueItem.setStatus(QueueStatusEnum.AFFINITY_WAITING.getStatus()); //鏀瑰彉 鎺掗槦鐘舵��
- queueItem.setRoomId(queueDO.getRoomId());
- queueItem.setRoomName(queueDO.getRoomName());
- queueItem.setBedNo(queueDO.getBedNo());
- queueItem.setSeqNum(curSeqNum.get() + 1); // 浣跨敤鍚屼竴涓� 鍐呴儴搴忓彿
- queueMapper.updateById(queueItem);
- }
- }
+ QueueDO preemptQueueItem = queueMapper.getQueueItemBySeqNum(curSeqNum.get() + 1);
+ updateAffinityItemsWhenPreempt( preemptQueueItem );
curSeqNum.getAndIncrement();
@@ -516,6 +507,36 @@
log.info(" opening " + openingFlag.get() + " " + monitorInfoVO.getQueueNum() + " " + monitorInfoVO.getActiveQueueNum() + " " + monitorInfoVO.getCheckTypeBedInfo().toString() );
}
+ private void updateAffinityItemsWhenPreempt(QueueDO preemptQueueItem) {
+ CheckTypeDO checkTypeDO = getCheckTypeItem( preemptQueueItem.getBookCheckType() );
+ if ( checkTypeDO.getAffinityCheckTypes().length > 0) {
+ List<QueueDO> affinityItems = queueMapper.getCurPatGivenCheckTypesAndStatus(preemptQueueItem.getPatId(),
+ checkTypeDO.getAffinityCheckTypes(), QueueStatusEnum.WAITING.getStatus());
+ for (int i = 0; i < affinityItems.size(); i++) {
+ QueueDO queueItem = affinityItems.get(i);
+ queueItem.setStatus(QueueStatusEnum.AFFINITY_WAITING.getStatus()); //鏀瑰彉 鎺掗槦鐘舵��
+ queueItem.setRoomId(preemptQueueItem.getRoomId());
+ queueItem.setRoomName(preemptQueueItem.getRoomName());
+ queueItem.setBedNo(preemptQueueItem.getBedNo());
+ queueItem.setSeqNum( preemptQueueItem.getSeqNum()); // 浣跨敤鍚屼竴涓� 鍐呴儴搴忓彿
+ queueMapper.updateById(queueItem);
+ }
+ }
+ }
+
+ private void updateAffinityItemsWhenRecalled(QueueDO recalledQueueItem) {
+ CheckTypeDO checkTypeDO = getCheckTypeItem( recalledQueueItem.getBookCheckType() );
+ if ( checkTypeDO.getAffinityCheckTypes().length > 0) {
+ List<QueueDO> affinityItems = queueMapper.getCurPatGivenCheckTypesAndStatus(recalledQueueItem.getPatId(),
+ checkTypeDO.getAffinityCheckTypes(), QueueStatusEnum.AFFINITY_WAITING.getStatus());
+ for (int i = 0; i < affinityItems.size(); i++) {
+ QueueDO queueItem = affinityItems.get(i);
+ queueItem.setSeqNum( recalledQueueItem.getSeqNum() ); // 鍙洖鍚庯紝鍘熷唴閮ㄥ簭鍙锋洿鏂�
+ queueMapper.updateById(queueItem);
+ }
+ }
+ }
+
private Integer getBedReadyMax(Long roomId, String bedNo) {
RoomDO roomDO = roomMapper.getRoom(roomId, bedNo);
Integer[] checkTypes = roomDO.getCheckTypes();
--
Gitblit v1.9.3