From 2bc90e242eceb83d9aa80d48ea9f991c0f9b99c6 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期四, 12 十二月 2024 19:47:57 +0800
Subject: [PATCH] 工位选择界面 诊室按照room id排序

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/RoomController.java |   97 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 73 insertions(+), 24 deletions(-)

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 fe1f1d8..fe94bf3 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
@@ -1,39 +1,41 @@
 package cn.lihu.jh.module.ecg.controller.admin.room;
 
-import cn.lihu.jh.framework.common.enums.CommonStatusEnum;
-import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomPageReqVO;
-import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomRespVO;
-import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomSaveReqVO;
-import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO;
-import cn.lihu.jh.module.ecg.service.room.RoomService;
-import cn.lihu.jh.module.system.api.dept.DeptApi;
-import cn.lihu.jh.module.system.api.dept.dto.DeptRespDTO;
-import org.springframework.web.bind.annotation.*;
+import java.util.*;
+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;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.Operation;
 
-import java.util.*;
-import java.io.IOException;
-import java.util.stream.Collectors;
-
+import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomPageReqVO;
+import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomRespVO;
+import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomSaveReqVO;
+import cn.lihu.jh.module.ecg.service.room.RoomService;
+import cn.lihu.jh.module.system.api.dept.DeptApi;
+import cn.lihu.jh.module.system.api.dept.dto.DeptRespDTO;
 import cn.lihu.jh.framework.common.pojo.PageParam;
 import cn.lihu.jh.framework.common.pojo.PageResult;
 import cn.lihu.jh.framework.common.pojo.CommonResult;
 import cn.lihu.jh.framework.common.util.object.BeanUtils;
-import static cn.lihu.jh.framework.common.pojo.CommonResult.success;
-
 import cn.lihu.jh.framework.excel.core.util.ExcelUtils;
-
 import cn.lihu.jh.framework.apilog.core.annotation.ApiAccessLog;
 
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
-
+import static cn.lihu.jh.framework.common.pojo.CommonResult.success;
 import static cn.lihu.jh.framework.apilog.core.enums.OperateTypeEnum.*;
 
 
@@ -45,6 +47,9 @@
 
     @Resource
     private RoomService roomService;
+
+    @Resource
+    private QueueService queueService;
 
     @Resource
     private DeptApi deptApi;
@@ -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));
     }
 
@@ -136,7 +150,7 @@
 
     @GetMapping(value = {"/list-all-bed"})
     @Operation(summary = "鑾峰彇璇婂簥鍒楄〃", description = "涓昏鐢ㄤ簬鍓嶇鐨勫紑璇婄鐞�")
-    public CommonResult<Map<Long, List<RoomRespVO>>> getAllBedMap() {
+    public CommonResult<Map<String, List<RoomRespVO>>> getAllBedMap() {
 
         RoomPageReqVO pageReqVO = new RoomPageReqVO();
         pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
@@ -144,14 +158,49 @@
 
         List<RoomRespVO> list2 = BeanUtils.toBean(list, RoomRespVO.class);
 
-        Map<Long, List<RoomRespVO>> map = list2.stream().collect(Collectors.groupingBy(RoomRespVO::getRoomId));
+        Map<String, List<RoomRespVO>> map = list2.stream().collect(Collectors.groupingBy(RoomRespVO::getRoomName));
         return success(map);
     }
 
     @GetMapping(value = {"/list-simple-room"})
     @Operation(summary = "鑾峰彇闂ㄨ瘖瀹ゅ垪琛�", description = "涓昏鐢ㄤ簬鍓嶇鐨勮瘖瀹ら�夋嫨")
-    public CommonResult<List<RoomRespVO>> getSimpleRoomList() {
+    public CommonResult<Map<Long, List<RoomRespVO>>> getSimpleRoomList() {
         List<RoomDO> list = roomService.simpleRoomList();
-        return success(BeanUtils.toBean(list, RoomRespVO.class));
+        List<RoomRespVO> list2 = BeanUtils.toBean(list, RoomRespVO.class);
+
+        Map<Long, List<RoomRespVO>> map = list2.stream().collect(Collectors.groupingBy(RoomRespVO::getRoomId));
+        return success(map);
     }
+
+    @GetMapping(value = {"/reset-room"})
+    @Operation(summary = "閲嶇疆闂ㄨ瘖瀹�", description = "涓昏鐢ㄤ簬姣忓ぉ鍏抽棴宸ヤ綅")
+    public CommonResult<String> resetRoom() {
+        roomService.resetRoom(true);
+        return success("reset room ok");
+    }
+
+    @GetMapping(value = {"/monitor"})
+    @Operation(summary = "鐩戞帶鐘舵�佽幏鍙�", description = "鐩戞帶鐘舵�佽幏鍙� 鐩戞帶鐢�")
+    public CommonResult<MonitorInfoVO> getMonitorInfo() {
+        MonitorInfoVO monitorInfoVO = roomService.getMonitorInfo();
+        return success( monitorInfoVO );
+    }
+
+    @GetMapping("/start-biz")
+    @Operation(summary = "鎵嬪姩寮�璇�")
+    @PreAuthorize("@ss.hasPermission('ecg:room:setting')")
+    public CommonResult<Integer> startBiz() {
+        queueService.startBiz();
+        return success(0);
+    }
+
+    @GetMapping("/close-biz")
+    @Operation(summary = "鎵嬪姩闂瘖")
+    @PreAuthorize("@ss.hasPermission('ecg:room:setting')")
+    public CommonResult<Integer> stopBiz() {
+        queueService.closeBiz();
+        return success(0);
+    }
+
+
 }

--
Gitblit v1.9.3