From b765c3a93685c4c97601aff6291a00ec770a537e Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期三, 04 九月 2024 18:19:35 +0800
Subject: [PATCH] 诊间屏

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java |    3 ++-
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/RoomController.java   |   15 +++++++++++++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/room/RoomMapper.java              |    2 +-
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomServiceImpl.java           |   13 +++++++++++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomService.java               |    2 ++
 5 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java
index c3ed451..05ab0b3 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java
@@ -37,6 +37,7 @@
 import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
 import cn.lihu.jh.module.ecg.service.queue.QueueService;
 
+import javax.annotation.security.PermitAll;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
@@ -172,7 +173,7 @@
 
     @GetMapping("/room-screen-data")
     @Operation(summary = "璇婇棿灞忔暟鎹�")
-    @PreAuthorize("@ss.hasPermission('ecg:queue:setting')")
+    @PermitAll
     public CommonResult<List<QueueRespVO>> callingDataRoom(HttpServletRequest request)
     {
         String reqIp = ServletUtil.getClientIP(request);
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/RoomController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/RoomController.java
index f511f68..ce78549 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/RoomController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/RoomController.java
@@ -4,12 +4,17 @@
 import java.io.IOException;
 import java.util.stream.Collectors;
 import javax.annotation.Resource;
+import javax.annotation.security.PermitAll;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
+import cn.hutool.extra.servlet.ServletUtil;
 import cn.lihu.jh.module.ecg.controller.admin.room.vo.MonitorInfoVO;
+import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
 import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO;
 import cn.lihu.jh.module.ecg.service.queue.QueueService;
+import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -79,6 +84,15 @@
     @PreAuthorize("@ss.hasPermission('clinic:room:query')")
     public CommonResult<RoomRespVO> getRoom(@RequestParam("id") Integer id) {
         RoomDO room = roomService.getRoom(id);
+        return success(BeanUtils.toBean(room, RoomRespVO.class));
+    }
+
+    @GetMapping("/get-room-by-ip")
+    @Operation(summary = "鑾峰緱璇婂鍜岃瘖鐤楀簥")
+    @PermitAll
+    public CommonResult<RoomRespVO> getRoomByIP(HttpServletRequest request) {
+        String reqIp = ServletUtil.getClientIP(request);
+        RoomDO room = roomService.getRoomByIP(reqIp);
         return success(BeanUtils.toBean(room, RoomRespVO.class));
     }
 
@@ -188,4 +202,5 @@
         return success(0);
     }
 
+
 }
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 3e6fd43..a99128c 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
@@ -31,7 +31,7 @@
                 .orderByDesc(RoomDO::getId));
     }
 
-    @Select("select lihu.clinic_room where ip = #{ip}")
+    @Select("select * from lihu.clinic_room where ip = #{ip}")
     List<RoomDO> queueByIp(@Param("ip") String ip);
 
     @Update("<script> " +
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomService.java
index 15468ad..c218f74 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomService.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomService.java
@@ -47,6 +47,8 @@
      */
     RoomDO getRoom(Integer id);
 
+    RoomDO getRoomByIP(String ip);
+
     /**
      * 鑾峰緱璇婂鍜岃瘖鐤楀簥鍒嗛〉
      *
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 2c02c92..f2bb5f9 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
@@ -5,10 +5,12 @@
 
 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.queue.QueueDO;
 import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO;
 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.util.StringUtils;
 import org.springframework.validation.annotation.Validated;
 
 import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomPageReqVO;
@@ -77,6 +79,17 @@
     }
 
     @Override
+    public RoomDO getRoomByIP(String ip) {
+        List<RoomDO> roomDOList = roomMapper.queueByIp(ip);
+        Optional<RoomDO> optionalQueueDO = roomDOList.stream().filter(item -> StringUtils.hasLength(item.getIp())).findFirst();
+        if (!optionalQueueDO.isPresent()) {
+            return null;
+        }
+
+        return optionalQueueDO.get();
+    }
+
+    @Override
     public PageResult<RoomDO> getRoomPage(RoomPageReqVO pageReqVO) {
         return roomMapper.selectPage(pageReqVO);
     }

--
Gitblit v1.9.3