From 069328ea846a08e673c508725e7e8d019f8a6333 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期日, 30 三月 2025 20:49:09 +0800
Subject: [PATCH] get room profile

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomServiceImpl.java |   67 +++++++++++++++++++++++----------
 1 files changed, 46 insertions(+), 21 deletions(-)

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 e4f8cb7..68554a7 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
@@ -4,8 +4,10 @@
 import javax.annotation.Resource;
 
 import cn.lihu.jh.framework.common.pojo.PageResult;
-import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomRespVO;
+import cn.lihu.jh.module.ecg.controller.admin.room.vo.MonitorInfoVO;
 import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO;
+import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomProfile;
+import cn.lihu.jh.module.ecg.enums.RoomCallingScreenEnum;
 import cn.lihu.jh.module.ecg.service.queue.QueueService;
 import cn.lihu.jh.module.system.api.oauth2.OAuth2TokenApi;
 import org.springframework.stereotype.Service;
@@ -13,7 +15,6 @@
 
 import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomPageReqVO;
 import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomSaveReqVO;
-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 cn.lihu.jh.framework.common.util.object.BeanUtils;
@@ -77,13 +78,48 @@
     }
 
     @Override
-    public PageResult<RoomDO> getRoomPage(RoomPageReqVO pageReqVO) {
-        return roomMapper.selectPage(pageReqVO);
+    public RoomProfile getRoomByIP(String ip) {
+        List<RoomDO> roomDOList = roomMapper.queueByIp(ip);
+
+        RoomProfile roomProfile = new RoomProfile();
+        roomProfile.setBedNum( 0 );
+        roomProfile.setCallingScreenType( RoomCallingScreenEnum.NONE.getCallingScreenType() );
+
+        for (RoomDO roomDO : roomDOList) {
+            roomProfile.setRoomId(roomDO.getRoomId());
+            roomProfile.setRoomName(roomDO.getRoomName());
+            roomProfile.setBedNum( roomProfile.getBedNum() + 1);
+
+            // 璁$畻 璇婇棿灞忕被鍨�
+            if (roomProfile.getCallingScreenType() == RoomCallingScreenEnum.NONE.getCallingScreenType()) {
+                if ( roomDO.getOpType() == 0 || roomDO.getOpType() == 1 ) {
+                    roomProfile.setCallingScreenType( RoomCallingScreenEnum.CHECK_ONLY.getCallingScreenType());
+                } else if ( roomDO.getOpType() == 2 ) {
+                    roomProfile.setCallingScreenType( RoomCallingScreenEnum.INSTALL_ONLY.getCallingScreenType());
+                }
+            } else if (roomProfile.getCallingScreenType() == RoomCallingScreenEnum.CHECK_ONLY.getCallingScreenType()) {
+                if ( roomDO.getOpType() == 0 || roomDO.getOpType() == 1 ) {
+                    // do nothing
+                } else if ( roomDO.getOpType() == 2 ) {
+                    roomProfile.setCallingScreenType( RoomCallingScreenEnum.HYBRID.getCallingScreenType());
+                }
+            } else if (roomProfile.getCallingScreenType() == RoomCallingScreenEnum.INSTALL_ONLY.getCallingScreenType()) {
+                if ( roomDO.getOpType() == 0 || roomDO.getOpType() == 1 ) {
+                    roomProfile.setCallingScreenType( RoomCallingScreenEnum.HYBRID.getCallingScreenType());
+                } else if ( roomDO.getOpType() == 2 ) {
+                    // do nothing
+                }
+            } else if (roomProfile.getCallingScreenType() == RoomCallingScreenEnum.HYBRID.getCallingScreenType()) {
+                // do nothing
+            }
+        }
+
+        return roomProfile;
     }
 
     @Override
-    public List<RoomStatisticsDO> roomStatistics() {
-        return roomMapper.roomStatistic();
+    public PageResult<RoomDO> getRoomPage(RoomPageReqVO pageReqVO) {
+        return roomMapper.selectPage(pageReqVO);
     }
 
     @Override
@@ -96,23 +132,12 @@
     }
 
     @Override
-    public void resetRoom() {
-        List<BedStatusEnum> bedStatusEnumList = new ArrayList<BedStatusEnum>();
-        bedStatusEnumList.add(BedStatusEnum.DOCTOR_ON);
-        bedStatusEnumList.add(BedStatusEnum.PAUSE);
-        List<RoomDO> roomDOList = roomMapper.simpleRoomList(bedStatusEnumList);
-
-        Integer ret = roomMapper.resetRoom(BedStatusEnum.CLOSED.getStatus());
-
-        //
-        List<Long> userIdList = roomDOList.stream().map(roomDO -> roomDO.getDocId()).toList();
-        oAuth2TokenApi.tick(userIdList);
-
-        queueService.startBedReload();
+    public void resetRoom(Boolean needCloseBed) {
+        queueService.startResetRoom(needCloseBed);
     }
 
     @Override
-    public Integer getOpeningFlag() {
-        return queueService.getOpeningFlag();
+    public MonitorInfoVO getMonitorInfo() {
+        return queueService.getMonitorInfo();
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3