From 7105cd2dd94171feb6fa969f71f8f9ba491b0729 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期一, 02 十二月 2024 14:25:08 +0800
Subject: [PATCH] 登出时退出所有的工位

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java |    2 +-
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/room/RoomMapper.java      |    4 ++--
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueService.java     |    2 +-
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/api/doctor/DoctorApiImpl.java       |    8 +++++---
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/api/doctor/DoctorApiImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/api/doctor/DoctorApiImpl.java
index 4bb24db..bfd0245 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/api/doctor/DoctorApiImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/api/doctor/DoctorApiImpl.java
@@ -7,6 +7,7 @@
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 @Service
 public class DoctorApiImpl implements DoctorApi {
@@ -16,13 +17,14 @@
 
     @Override
     public ErrorCode bedDoctorOff(Long userId, String userName) {
-        RoomDO roomDO = queueService.getDocRoomInfo(userId);
+        List<RoomDO> roomDOList = queueService.getDocRoomInfo(userId);
         // 鏈叆搴�, 璺宠繃
-        if (null == roomDO) {
+        if (roomDOList.isEmpty()) {
             return GlobalErrorCodeConstants.SUCCESS;
         }
 
-        return queueService.startBedDoctorOff(roomDO.getRoomId(), roomDO.getBedNo(), userId, userName);
+        roomDOList.forEach( bedItem -> queueService.startBedDoctorOff(bedItem.getRoomId(), bedItem.getBedNo(), userId, userName));
+        return GlobalErrorCodeConstants.SUCCESS;
     }
 
 }
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 f352a2f..bd271eb 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
@@ -62,8 +62,8 @@
     @Select("SELECT * FROM lihu.clinic_room where room_id=#{roomId} and bed_no=#{bedNo} and doc_id=#{docId}")
     RoomDO getRoomByRoomBedDoc(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("docId")Long docId);
 
-    @Select("SELECT * FROM lihu.clinic_room where doc_id=#{docId} limit 1")
-    RoomDO getRoomByDocId(@Param("docId")Long docId);
+    @Select("SELECT * FROM lihu.clinic_room where doc_id=#{docId}")
+    List<RoomDO> getRoomByDocId(@Param("docId")Long docId);
 
     @Update("<script> " +
             "update lihu.clinic_room set status=#{newStatus.status} " +
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 a064f63..e121b2b 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
@@ -139,7 +139,7 @@
 
     Integer patientJump(String patId, Byte jumped );
 
-    RoomDO getDocRoomInfo(Long docId);
+    List<RoomDO> getDocRoomInfo(Long docId);
 
     List<QueueDO> getToBeCheckedPatient(Long roomId, String bedNo);
 
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 978af4c..71f57c9 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
@@ -579,7 +579,7 @@
     }
 
     @Override
-    public RoomDO getDocRoomInfo(Long docId) {
+    public List<RoomDO> getDocRoomInfo(Long docId) {
         return roomMapper.getRoomByDocId(docId);
     }
 

--
Gitblit v1.9.3