From d40cde3bca854c21c869cb35d25ece4aa7dac265 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期四, 10 四月 2025 16:43:34 +0800
Subject: [PATCH] 检查记录  排除 未检查的记录

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomServiceImpl.java |  117 +++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 95 insertions(+), 22 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 f630467..532d6de 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
@@ -1,23 +1,26 @@
 package cn.lihu.jh.module.ecg.service.room;
 
-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.RoomResVO;
-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 java.util.*;
+import javax.annotation.Resource;
+
+import cn.lihu.jh.framework.common.pojo.PageResult;
+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;
 import org.springframework.validation.annotation.Validated;
 
-import java.util.*;
-import cn.lihu.jh.framework.common.pojo.PageResult;
+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.mysql.room.RoomMapper;
+import cn.lihu.jh.module.ecg.enums.BedStatusEnum;
 import cn.lihu.jh.framework.common.util.object.BeanUtils;
-
-import javax.annotation.Resource;
 
 import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.ROOM_NOT_EXISTS;
-
 
 /**
  * 璇婂鍜岃瘖鐤楀簥 Service 瀹炵幇绫�
@@ -31,10 +34,16 @@
     @Resource
     private RoomMapper roomMapper;
 
+    @Resource
+    private OAuth2TokenApi oAuth2TokenApi;
+
+    @Resource
+    QueueService queueService;
+
     @Override
     public Integer createRoom(RoomSaveReqVO createReqVO) {
         // 鎻掑叆
-        RoomResVO room = BeanUtils.toBean(createReqVO, RoomResVO.class);
+        RoomDO room = BeanUtils.toBean(createReqVO, RoomDO.class);
         roomMapper.insert(room);
         // 杩斿洖
         return room.getId();
@@ -45,7 +54,7 @@
         // 鏍¢獙瀛樺湪
         validateRoomExists(updateReqVO.getId());
         // 鏇存柊
-        RoomResVO updateObj = BeanUtils.toBean(updateReqVO, RoomResVO.class);
+        RoomDO updateObj = BeanUtils.toBean(updateReqVO, RoomDO.class);
         roomMapper.updateById(updateObj);
     }
 
@@ -64,26 +73,90 @@
     }
 
     @Override
-    public RoomResVO getRoom(Integer id) {
+    public RoomDO getRoom(Integer id) {
         return roomMapper.selectById(id);
     }
 
     @Override
-    public PageResult<RoomResVO> getRoomPage(RoomPageReqVO pageReqVO) {
+    public RoomProfile getRoomByIP(String ip, Long roomId) {
+        List<RoomDO> roomDOList = null;
+        if (null != roomId) {
+            roomDOList = roomMapper.selectList(RoomDO::getRoomId, roomId);
+        } else {
+            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);
+
+            // 0 妫�鏌� 1 棰嗙敤 2 瑁呮満
+
+            // 璁$畻 璇婇棿灞忕被鍨�
+            if (roomProfile.getCallingScreenType() == RoomCallingScreenEnum.NONE.getCallingScreenType()) {
+                if ( roomDO.getOpType() == 0 ) {
+                    roomProfile.setCallingScreenType(RoomCallingScreenEnum.CHECK_ONLY.getCallingScreenType());
+                } else if ( roomDO.getOpType() == 1 ) {
+                    roomProfile.setCallingScreenType( RoomCallingScreenEnum.RECEIVE_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.CHECK_INSTALL.getCallingScreenType());
+                }
+            } else if (roomProfile.getCallingScreenType() == RoomCallingScreenEnum.RECEIVE_ONLY.getCallingScreenType()) {
+                if ( roomDO.getOpType() == 0 || roomDO.getOpType() == 1 ) {
+                    // do nothing
+                } else if ( roomDO.getOpType() == 2 ) {
+                    roomProfile.setCallingScreenType( RoomCallingScreenEnum.RECEIVE_INSTALL.getCallingScreenType());
+                }
+            } else if (roomProfile.getCallingScreenType() == RoomCallingScreenEnum.INSTALL_ONLY.getCallingScreenType()) {
+                if ( roomDO.getOpType() == 0 ) {
+                    roomProfile.setCallingScreenType( RoomCallingScreenEnum.CHECK_INSTALL.getCallingScreenType());
+                } else if ( roomDO.getOpType() == 1 ) {
+                    roomProfile.setCallingScreenType( RoomCallingScreenEnum.RECEIVE_INSTALL.getCallingScreenType());
+                } else if ( roomDO.getOpType() == 2 ) {
+                    // do nothing
+                }
+            } else if (roomProfile.getCallingScreenType() == RoomCallingScreenEnum.RECEIVE_INSTALL.getCallingScreenType()) {
+                // do nothing
+            } else if (roomProfile.getCallingScreenType() == RoomCallingScreenEnum.CHECK_INSTALL.getCallingScreenType()) {
+                // do nothing
+            }
+        }
+
+        return roomProfile;
+    }
+
+    @Override
+    public PageResult<RoomDO> getRoomPage(RoomPageReqVO pageReqVO) {
         return roomMapper.selectPage(pageReqVO);
     }
 
     @Override
-    public List<RoomStatisticsDO> roomStatistics() {
-        return roomMapper.roomStatistic();
-    }
-
-    @Override
-    public List<RoomResVO> simpleRoomList() {
+    public List<RoomDO> simpleRoomList() {
         List<BedStatusEnum> bedStatusEnumList = new ArrayList<BedStatusEnum>();
         bedStatusEnumList.add(BedStatusEnum.OPENING);
         bedStatusEnumList.add(BedStatusEnum.DOCTOR_ON);
-        bedStatusEnumList.add(BedStatusEnum.PAUSE);
+        bedStatusEnumList.add(BedStatusEnum.DOCTOR_PAUSE);
         return  roomMapper.simpleRoomList(bedStatusEnumList);
     }
+
+    @Override
+    public void resetRoom(Boolean needCloseBed) {
+        queueService.startResetRoom(needCloseBed);
+    }
+
+    @Override
+    public MonitorInfoVO getMonitorInfo() {
+        return queueService.getMonitorInfo();
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3