From cce9d33e6c03ab48fb22c62fe5de3d1e902c598f Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期三, 28 八月 2024 14:25:51 +0800
Subject: [PATCH] update

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/queue/queueController.java   |   19 ++++++++-
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java |    1 
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/RoomController.java     |   13 +++---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueServiceImpl.java           |   27 +++++++++++--
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/room/RoomMapper.java                |   20 +++++----
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomServiceImpl.java             |   14 +++----
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/queueService.java               |    5 ++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomService.java                 |    9 ++--
 8 files changed, 71 insertions(+), 37 deletions(-)

diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java
index fa91b33..ab7e56f 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/doctor/DoctorController.java
@@ -117,4 +117,5 @@
         return success("success");
     }
 
+
 }
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 c145fe5..f9edf00 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
@@ -2,6 +2,8 @@
 
 import cn.lihu.jh.framework.common.exception.ErrorCode;
 import cn.lihu.jh.framework.security.core.util.SecurityFrameworkUtils;
+import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomRespVO;
+import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomResVO;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -137,7 +139,7 @@
 
         ErrorCode result = queueService.startBedDoctorPause(roomId, bedNo, userId, userNickname);
         if (result.equals(SUCCESS))
-            return success(0);
+            return success(SUCCESS.getCode());
 
         return error(result);
     }
@@ -154,7 +156,7 @@
 
         ErrorCode result = queueService.startBedDoctorResume(roomId, bedNo, userId, userNickname);
         if (result.equals(SUCCESS))
-            return success(0);
+            return success(SUCCESS.getCode());
 
         return error(result);
     }
@@ -193,6 +195,19 @@
         return error(result);
     }
 
+    @GetMapping("/bed-doctor-get")
+    @Operation(summary = "鍖荤敓宸ヤ綅鑾峰彇")
+    @PreAuthorize("@ss.hasPermission('ecg:queue:bedcontrol')")
+    public CommonResult<RoomRespVO> bedDoctorGet(
+        @RequestParam("roomId") Long roomId,
+        @RequestParam("bedNo") String bedNo)
+    {
+        Long userId = SecurityFrameworkUtils.getLoginUserId();
+
+        CommonResult<RoomRespVO> result = queueService.getRoom(roomId, bedNo, userId);
+        return result;
+    }
+
     @GetMapping("/startbiz")
     @Operation(summary = "鎵嬪姩寮�璇�")
     @PreAuthorize("@ss.hasPermission('ecg:queue:setting')")
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 c52395f..92c5998 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,10 +1,9 @@
 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.dal.dataobject.room.RoomResVO;
 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;
@@ -78,7 +77,7 @@
     @Parameter(name = "id", description = "缂栧彿", required = true, example = "1024")
     @PreAuthorize("@ss.hasPermission('clinic:room:query')")
     public CommonResult<RoomRespVO> getRoom(@RequestParam("id") Integer id) {
-        RoomDO room = roomService.getRoom(id);
+        RoomResVO room = roomService.getRoom(id);
         return success(BeanUtils.toBean(room, RoomRespVO.class));
     }
 
@@ -86,7 +85,7 @@
     @Operation(summary = "鑾峰緱璇婂鍜岃瘖鐤楀簥鍒嗛〉")
     @PreAuthorize("@ss.hasPermission('clinic:room:query')")
     public CommonResult<PageResult<RoomRespVO>> getRoomPage(@Valid RoomPageReqVO pageReqVO) {
-        PageResult<RoomDO> pageResult = roomService.getRoomPage(pageReqVO);
+        PageResult<RoomResVO> pageResult = roomService.getRoomPage(pageReqVO);
         return success(BeanUtils.toBean(pageResult, RoomRespVO.class));
     }
 
@@ -97,7 +96,7 @@
     public void exportRoomExcel(@Valid RoomPageReqVO pageReqVO,
               HttpServletResponse response) throws IOException {
         pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
-        List<RoomDO> list = roomService.getRoomPage(pageReqVO).getList();
+        List<RoomResVO> list = roomService.getRoomPage(pageReqVO).getList();
         // 瀵煎嚭 Excel
         ExcelUtils.write(response, "璇婂鍜岃瘖鐤楀簥.xls", "鏁版嵁", RoomRespVO.class,
                         BeanUtils.toBean(list, RoomRespVO.class));
@@ -140,7 +139,7 @@
 
         RoomPageReqVO pageReqVO = new RoomPageReqVO();
         pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
-        List<RoomDO> list = roomService.getRoomPage(pageReqVO).getList();
+        List<RoomResVO> list = roomService.getRoomPage(pageReqVO).getList();
 
         List<RoomRespVO> list2 = BeanUtils.toBean(list, RoomRespVO.class);
 
@@ -151,7 +150,7 @@
     @GetMapping(value = {"/list-simple-room"})
     @Operation(summary = "鑾峰彇闂ㄨ瘖瀹ゅ垪琛�", description = "涓昏鐢ㄤ簬鍓嶇鐨勮瘖瀹ら�夋嫨")
     public CommonResult<Map<String, List<RoomRespVO>>> getSimpleRoomList() {
-        List<RoomDO> list = roomService.simpleRoomList();
+        List<RoomResVO> list = roomService.simpleRoomList();
         List<RoomRespVO> list2 = BeanUtils.toBean(list, RoomRespVO.class);
 
         Map<String, List<RoomRespVO>> map = list2.stream().collect(Collectors.groupingBy(RoomRespVO::getRoomName));
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 786d154..5abba9a 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
@@ -7,7 +7,7 @@
 import cn.lihu.jh.framework.mybatis.core.mapper.BaseMapperX;
 
 import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomPageReqVO;
-import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO;
+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.enums.BedStatusEnum;
 import org.apache.ibatis.annotations.Mapper;
@@ -21,14 +21,14 @@
  * @author 鑺嬮亾婧愮爜
  */
 @Mapper
-public interface RoomMapper extends BaseMapperX<RoomDO> {
+public interface RoomMapper extends BaseMapperX<RoomResVO> {
 
-    default PageResult<RoomDO> selectPage(RoomPageReqVO reqVO) {
-        return selectPage(reqVO, new LambdaQueryWrapperX<RoomDO>()
-                .eqIfPresent(RoomDO::getRoomId, reqVO.getRoomId())
-                .eqIfPresent(RoomDO::getBedNo, reqVO.getBedNo())
-                .betweenIfPresent(RoomDO::getCreateTime, reqVO.getCreateTime())
-                .orderByDesc(RoomDO::getId));
+    default PageResult<RoomResVO> selectPage(RoomPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<RoomResVO>()
+                .eqIfPresent(RoomResVO::getRoomId, reqVO.getRoomId())
+                .eqIfPresent(RoomResVO::getBedNo, reqVO.getBedNo())
+                .betweenIfPresent(RoomResVO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(RoomResVO::getId));
     }
 
     @Select({ "SELECT room_id, room_name, count(1) as bed_num FROM lihu.clinic_room group by room_id;" })
@@ -41,8 +41,10 @@
                     "  #{curStatus.status} " +
                     " </foreach> );" +
             "</script>")
+    List<RoomResVO> simpleRoomList(@Param("curStatusList") List<BedStatusEnum> curStatusList);
 
-    List<RoomDO> simpleRoomList(@Param("curStatusList") List<BedStatusEnum> curStatusList);
+    @Select("SELECT * FROM lihu.clinic_room where room_id=#{roomId} and bed_no=#{bedNo} and doc_id=#{docId}")
+    RoomResVO getRoom(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("docId")Long docId);
 
     @Update("<script> " +
             "update lihu.clinic_room set status=#{newStatus.status} where room_id=#{roomId} and bed_no=#{bedNo} " +
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 d5fc61d..77d85b4 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
@@ -1,9 +1,12 @@
 package cn.lihu.jh.module.ecg.service.queue;
 
 import cn.lihu.jh.framework.common.exception.ErrorCode;
+import cn.lihu.jh.framework.common.pojo.CommonResult;
 import cn.lihu.jh.module.ecg.controller.admin.queue.vo.*;
+import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomRespVO;
 import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
 import cn.lihu.jh.framework.common.pojo.PageResult;
+import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomResVO;
 
 import javax.validation.Valid;
 import java.util.List;
@@ -57,7 +60,7 @@
     ErrorCode bedDoctorResume(Long roomId, String bedNo, Long docId, String docName);
     ErrorCode bedDoctorOn(Long roomId, String bedNo, Long docId, String docName);
     ErrorCode bedDoctorOff(Long roomId, String bedNo, Long docId, String docName);
-
+    CommonResult<RoomRespVO> getRoom(Long roomId, String bedNo, Long docId);
     /**
      * 鑾峰緱鎺掗槦
      *
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 a987611..537c778 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
@@ -1,12 +1,13 @@
 package cn.lihu.jh.module.ecg.service.queue;
 
 import cn.lihu.jh.framework.common.exception.ErrorCode;
+import cn.lihu.jh.framework.common.pojo.CommonResult;
+import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomRespVO;
 import cn.lihu.jh.module.ecg.dal.dataobject.queue.BedQueueStatisticDO;
 import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueStatisticDO;
-import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO;
+import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomResVO;
 import cn.lihu.jh.module.ecg.dal.mysql.room.RoomMapper;
 import cn.lihu.jh.module.ecg.enums.BedStatusEnum;
-import cn.lihu.jh.module.ecg.enums.ErrorCodeConstants;
 import cn.lihu.jh.module.ecg.enums.QueueStatusEnum;
 import cn.lihu.jh.module.infra.api.config.ConfigApi;
 import org.springframework.stereotype.Service;
@@ -27,8 +28,8 @@
 
 import static cn.lihu.jh.framework.common.exception.enums.GlobalErrorCodeConstants.SUCCESS;
 import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception;
-import static cn.lihu.jh.module.ecg.Constants.ECG_OPENING_TIME_KEY;
-import static cn.lihu.jh.module.ecg.Constants.ECG_QUEUE_READY_MAX_KEY;
+import static cn.lihu.jh.framework.common.pojo.CommonResult.error;
+import static cn.lihu.jh.framework.common.pojo.CommonResult.success;
 import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*;
 
 /**
@@ -248,6 +249,22 @@
     }
 
     @Override
+    public CommonResult<RoomRespVO> getRoom(Long roomId, String bedNo, Long docId) {
+        BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo));
+        if (null == bedQueueBO) {
+            return error(QUEUE_BED_ABNORMAL);
+        }
+
+        RoomResVO roomResVO = roomMapper.getRoom(roomId, bedNo, docId);
+        if (null == roomResVO) {
+            return error(ECG_INNER_ERROR);
+        }
+
+        RoomRespVO roomRespVO = BeanUtils.toBean(roomResVO, RoomRespVO.class);
+        return success(roomRespVO);
+    }
+
+    @Override
     public ErrorCode bedDoctorPause(Long roomId, String bedNo, Long docId, String docName) {
         BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo));
         if (null == bedQueueBO)
@@ -355,7 +372,7 @@
         bedStatusEnumList.add(BedStatusEnum.OPENING);
         bedStatusEnumList.add(BedStatusEnum.DOCTOR_ON);
         bedStatusEnumList.add(BedStatusEnum.PAUSE);
-        List<RoomDO> roomDOList = roomMapper.simpleRoomList(bedStatusEnumList);
+        List<RoomResVO> roomDOList = roomMapper.simpleRoomList(bedStatusEnumList);
         List<BedQueueBO> bedQueueBOList = roomDOList.stream().map(item -> BeanUtils.toBean(item, BedQueueBO.class)).toList();
 
         // 浠嶥B 鑾峰彇 闃熷垪涓� 灏辫瘖鍑嗗涓汉鍛樼粺璁� 鍒楄〃
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 bba206e..110e177 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
@@ -2,10 +2,9 @@
 
 import java.util.*;
 import cn.lihu.jh.framework.common.pojo.PageResult;
-import cn.lihu.jh.framework.common.pojo.PageParam;
 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.RoomDO;
+import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomResVO;
 import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomStatisticsDO;
 
 import javax.validation.Valid;
@@ -45,7 +44,7 @@
      * @param id 缂栧彿
      * @return 璇婂鍜岃瘖鐤楀簥
      */
-    RoomDO getRoom(Integer id);
+    RoomResVO getRoom(Integer id);
 
     /**
      * 鑾峰緱璇婂鍜岃瘖鐤楀簥鍒嗛〉
@@ -53,10 +52,10 @@
      * @param pageReqVO 鍒嗛〉鏌ヨ
      * @return 璇婂鍜岃瘖鐤楀簥鍒嗛〉
      */
-    PageResult<RoomDO> getRoomPage(RoomPageReqVO pageReqVO);
+    PageResult<RoomResVO> getRoomPage(RoomPageReqVO pageReqVO);
 
     List<RoomStatisticsDO> roomStatistics();
 
-    List<RoomDO> simpleRoomList();
+    List<RoomResVO> simpleRoomList();
 
 }
\ No newline at end of file
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 f6060ee..f630467 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
@@ -2,17 +2,15 @@
 
 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.RoomDO;
+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 org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
 import cn.lihu.jh.framework.common.pojo.PageResult;
-import cn.lihu.jh.framework.common.pojo.PageParam;
 import cn.lihu.jh.framework.common.util.object.BeanUtils;
 
 import javax.annotation.Resource;
@@ -36,7 +34,7 @@
     @Override
     public Integer createRoom(RoomSaveReqVO createReqVO) {
         // 鎻掑叆
-        RoomDO room = BeanUtils.toBean(createReqVO, RoomDO.class);
+        RoomResVO room = BeanUtils.toBean(createReqVO, RoomResVO.class);
         roomMapper.insert(room);
         // 杩斿洖
         return room.getId();
@@ -47,7 +45,7 @@
         // 鏍¢獙瀛樺湪
         validateRoomExists(updateReqVO.getId());
         // 鏇存柊
-        RoomDO updateObj = BeanUtils.toBean(updateReqVO, RoomDO.class);
+        RoomResVO updateObj = BeanUtils.toBean(updateReqVO, RoomResVO.class);
         roomMapper.updateById(updateObj);
     }
 
@@ -66,12 +64,12 @@
     }
 
     @Override
-    public RoomDO getRoom(Integer id) {
+    public RoomResVO getRoom(Integer id) {
         return roomMapper.selectById(id);
     }
 
     @Override
-    public PageResult<RoomDO> getRoomPage(RoomPageReqVO pageReqVO) {
+    public PageResult<RoomResVO> getRoomPage(RoomPageReqVO pageReqVO) {
         return roomMapper.selectPage(pageReqVO);
     }
 
@@ -81,7 +79,7 @@
     }
 
     @Override
-    public List<RoomDO> simpleRoomList() {
+    public List<RoomResVO> simpleRoomList() {
         List<BedStatusEnum> bedStatusEnumList = new ArrayList<BedStatusEnum>();
         bedStatusEnumList.add(BedStatusEnum.OPENING);
         bedStatusEnumList.add(BedStatusEnum.DOCTOR_ON);

--
Gitblit v1.9.3