From 7660fe12273a6b132256a2fa83ca1b11d6b2381f Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 13 八月 2024 17:48:44 +0800
Subject: [PATCH] update

---
 jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/api/dept/DeptApiImpl.java                      |    9 +++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomPageReqVO.java             |    5 +
 jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/dept/DeptServiceImpl.java              |    8 ++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/RoomController.java               |   37 ++++++++++++
 jh-module-system/jh-module-system-api/src/main/java/cn/lihu/jh/module/system/api/dept/DeptApi.java                          |   10 +++
 sql/mysql/jh.sql                                                                                                            |    3 
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java |   35 +++++++++++
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomSaveReqVO.java             |    9 ++
 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/controller/admin/room/vo/RoomRespVO.java                |    6 +
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomDO.java                         |    6 +
 jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/dept/DeptService.java                  |    8 ++
 jh-module-ecg/jh-module-ecg-biz/pom.xml                                                                                     |    5 +
 13 files changed, 136 insertions(+), 7 deletions(-)

diff --git a/jh-module-ecg/jh-module-ecg-biz/pom.xml b/jh-module-ecg/jh-module-ecg-biz/pom.xml
index 7f3765e..42a4ca9 100644
--- a/jh-module-ecg/jh-module-ecg-biz/pom.xml
+++ b/jh-module-ecg/jh-module-ecg-biz/pom.xml
@@ -27,6 +27,11 @@
             <artifactId>jh-module-infra-api</artifactId>
             <version>${revision}</version>
         </dependency>
+        <dependency>
+            <groupId>cn.lihu</groupId>
+            <artifactId>jh-module-system-api</artifactId>
+            <version>${revision}</version>
+        </dependency>
 
         <!-- 涓氬姟缁勪欢 -->
         <dependency>
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
index f43661c..518f1a4 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
@@ -1,6 +1,7 @@
 package cn.lihu.jh.module.ecg.controller.admin.appointment;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.lihu.jh.framework.common.enums.CommonStatusEnum;
 import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueueSaveReqVO;
 import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
 import cn.lihu.jh.module.ecg.feign.RemoteDataService;
@@ -8,6 +9,8 @@
 import cn.lihu.jh.module.ecg.feign.RestApiResult;
 import cn.lihu.jh.module.ecg.feign.dto.AppointmentExternal;
 import cn.lihu.jh.module.ecg.service.queue.QueueService;
+import cn.lihu.jh.module.system.api.dept.DeptApi;
+import cn.lihu.jh.module.system.api.dept.dto.DeptRespDTO;
 import com.alibaba.fastjson.JSONObject;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
@@ -23,6 +26,7 @@
 import java.time.format.ResolverStyle;
 import java.util.*;
 import java.io.IOException;
+import java.util.function.Supplier;
 import java.util.stream.Collectors;
 
 import cn.lihu.jh.framework.common.pojo.PageParam;
@@ -60,6 +64,9 @@
 
     @Resource
     private RemoteDataService remoteDataService;
+
+    @Resource
+    private DeptApi deptApi;
 
     @PostMapping("/create")
     @Operation(summary = "鍒涘缓棰勭害")
@@ -174,6 +181,34 @@
 
         queueService.createqueue(queueSaveReqVO);
 
+
+        // 鑾峰彇鍊欒瘖鍑嗗鐨勯厤缃汉鏁�  锛� 钀ヤ笟鐨勮瘖瀹�
+
+/*
+        List<DeptDO> list = deptService.getDeptList(
+                new DeptListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
+        return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
+*/
+
+        List<DeptRespDTO> deptRespDTOList = deptApi.getSimpleDeptList();
+        Optional<DeptRespDTO> ecgDept = deptRespDTOList.stream()
+                .filter(a -> a.getName().equals("ECG"))
+                .findAny();
+
+        if (ecgDept.isPresent()){
+            System.out.println(ecgDept.get().getName());
+
+            List<DeptRespDTO> list2 = deptRespDTOList.stream()
+                    .filter(a -> Objects.equals(a.getParentId(), ecgDept.get().getId()))
+                    .toList();
+            list2.forEach(System.out::println);
+            list2.size();
+        }
+
+        // 鑾峰彇 姣忎釜钀ヤ笟鐨勮瘖瀹� 鍊欒瘖鍑嗗鐨勫綋鍓嶄汉鏁�  灏辫瘖涓殑褰撳墠浜烘暟
+        // queueService.get
+
+
         return success("hello");
     }
 }
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 cb0abad..16a608f 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,13 @@
 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 org.springframework.validation.annotation.Validated;
@@ -41,6 +44,9 @@
 
     @Resource
     private RoomService roomService;
+
+    @Resource
+    private DeptApi deptApi;
 
     @PostMapping("/create")
     @Operation(summary = "鍒涘缓璇婂鍜岃瘖鐤楀簥")
@@ -96,4 +102,35 @@
                         BeanUtils.toBean(list, RoomRespVO.class));
     }
 
+    @GetMapping(value = {"/list-all-simple", "/simple-list"})
+    @Operation(summary = "鑾峰彇閮ㄩ棬绮剧畝淇℃伅鍒楄〃", description = "鍙寘鍚寮�鍚殑閮ㄩ棬锛屼富瑕佺敤浜庡墠绔殑涓嬫媺閫夐」")
+    public CommonResult<List<RoomRespVO>> getSimpleDeptList() {
+
+        List<DeptRespDTO> deptRespDTOList = deptApi.getSimpleDeptList();
+        Optional<DeptRespDTO> ecgDept = deptRespDTOList.stream()
+                .filter(a -> a.getName().equals("ECG"))
+                .findAny();
+
+        List<DeptRespDTO> list2 = new ArrayList<DeptRespDTO>();
+        if (ecgDept.isPresent()){
+            System.out.println(ecgDept.get().getName());
+
+            list2 = deptRespDTOList.stream()
+                    .filter(a -> Objects.equals(a.getParentId(), ecgDept.get().getId()))
+                    .toList();
+            list2.forEach(System.out::println);
+            list2.size();
+        }
+
+        List<RoomRespVO> list3 = list2.stream().map(item -> {
+            RoomRespVO roomRespVO = new RoomRespVO();
+            roomRespVO.setRoomId( item.getId() );
+            roomRespVO.setRoomName( item.getName() );
+            return roomRespVO;
+        }).toList();
+
+        //return success(BeanUtils.toBean(list2, RoomRespVO.class));
+        return success(list3);
+    }
+
 }
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomPageReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomPageReqVO.java
index fe50f1f..ec2b93a 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomPageReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomPageReqVO.java
@@ -16,7 +16,10 @@
 public class RoomPageReqVO extends PageParam {
 
     @Schema(description = "璇婂缂栧彿")
-    private String roomNo;
+    private Long roomId;
+
+    @Schema(description = "璇婂鍚嶇О")
+    private String roomName;
 
     @Schema(description = "璇婄枟搴婄紪鍙�")
     private String bedNo;
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomRespVO.java
index 13cde0d..492994e 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomRespVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomRespVO.java
@@ -18,7 +18,11 @@
 
     @Schema(description = "璇婂缂栧彿", requiredMode = Schema.RequiredMode.REQUIRED)
     @ExcelProperty("璇婂缂栧彿")
-    private String roomNo;
+    private Long roomId;
+
+    @Schema(description = "璇婂鍚嶇О", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("璇婂鍚嶇О")
+    private String roomName;
 
     @Schema(description = "璇婄枟搴婄紪鍙�", requiredMode = Schema.RequiredMode.REQUIRED)
     @ExcelProperty("璇婄枟搴婄紪鍙�")
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomSaveReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomSaveReqVO.java
index dcc8700..9f4b412 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomSaveReqVO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomSaveReqVO.java
@@ -3,6 +3,7 @@
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 
+import javax.validation.constraints.Min;
 import javax.validation.constraints.NotEmpty;
 import java.util.*;
 
@@ -14,8 +15,12 @@
     private Integer id;
 
     @Schema(description = "璇婂缂栧彿", requiredMode = Schema.RequiredMode.REQUIRED)
-    @NotEmpty(message = "璇婂缂栧彿涓嶈兘涓虹┖")
-    private String roomNo;
+    @Min(value = 0, message = "璇婂缂栧彿涓嶈兘涓虹┖")
+    private Long roomId;
+
+    @Schema(description = "璇婂鍚嶇О", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotEmpty(message = "璇婂鍚嶇О涓嶈兘涓虹┖")
+    private String roomName;
 
     @Schema(description = "璇婄枟搴婄紪鍙�", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotEmpty(message = "璇婄枟搴婄紪鍙蜂笉鑳戒负绌�")
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomDO.java
index 6ad268c..c67bc71 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomDO.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomDO.java
@@ -30,7 +30,11 @@
     /**
      * 璇婂缂栧彿
      */
-    private String roomNo;
+    private Long roomId;
+    /**
+     * 璇婂鍚嶇О
+     */
+    private String roomName;
     /**
      * 璇婄枟搴婄紪鍙�
      */
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 951d5e9..2696327 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
@@ -20,7 +20,7 @@
 
     default PageResult<RoomDO> selectPage(RoomPageReqVO reqVO) {
         return selectPage(reqVO, new LambdaQueryWrapperX<RoomDO>()
-                .eqIfPresent(RoomDO::getRoomNo, reqVO.getRoomNo())
+                .eqIfPresent(RoomDO::getRoomId, reqVO.getRoomId())
                 .eqIfPresent(RoomDO::getBedNo, reqVO.getBedNo())
                 .betweenIfPresent(RoomDO::getCreateTime, reqVO.getCreateTime())
                 .orderByDesc(RoomDO::getId));
diff --git a/jh-module-system/jh-module-system-api/src/main/java/cn/lihu/jh/module/system/api/dept/DeptApi.java b/jh-module-system/jh-module-system-api/src/main/java/cn/lihu/jh/module/system/api/dept/DeptApi.java
index 89831c2..1255b88 100644
--- a/jh-module-system/jh-module-system-api/src/main/java/cn/lihu/jh/module/system/api/dept/DeptApi.java
+++ b/jh-module-system/jh-module-system-api/src/main/java/cn/lihu/jh/module/system/api/dept/DeptApi.java
@@ -1,11 +1,16 @@
 package cn.lihu.jh.module.system.api.dept;
 
+import cn.lihu.jh.framework.common.enums.CommonStatusEnum;
+import cn.lihu.jh.framework.common.pojo.CommonResult;
 import cn.lihu.jh.framework.common.util.collection.CollectionUtils;
+import cn.lihu.jh.framework.common.util.object.BeanUtils;
 import cn.lihu.jh.module.system.api.dept.dto.DeptRespDTO;
 
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
+
+import static cn.lihu.jh.framework.common.pojo.CommonResult.success;
 
 /**
  * 閮ㄩ棬 API 鎺ュ彛
@@ -58,4 +63,9 @@
      */
     List<DeptRespDTO> getChildDeptList(Long id);
 
+    /**
+     *
+     */
+    List<DeptRespDTO> getSimpleDeptList();
+
 }
diff --git a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/api/dept/DeptApiImpl.java b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/api/dept/DeptApiImpl.java
index 05aa76a..dda35da 100644
--- a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/api/dept/DeptApiImpl.java
+++ b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/api/dept/DeptApiImpl.java
@@ -1,5 +1,6 @@
 package cn.lihu.jh.module.system.api.dept;
 
+import cn.lihu.jh.framework.common.enums.CommonStatusEnum;
 import cn.lihu.jh.framework.common.util.object.BeanUtils;
 import cn.lihu.jh.module.system.api.dept.dto.DeptRespDTO;
 import cn.lihu.jh.module.system.dal.dataobject.dept.DeptDO;
@@ -10,6 +11,8 @@
 import javax.annotation.Resource;
 import java.util.Collection;
 import java.util.List;
+
+import static cn.lihu.jh.framework.common.pojo.CommonResult.success;
 
 /**
  * 閮ㄩ棬 API 瀹炵幇绫�
@@ -45,4 +48,10 @@
         return BeanUtils.toBean(childDeptList, DeptRespDTO.class);
     }
 
+    @Override
+    public List<DeptRespDTO> getSimpleDeptList() {
+        List<DeptDO> depts = deptService.getSimpleDeptList();
+        return BeanUtils.toBean(depts, DeptRespDTO.class);
+    }
+
 }
diff --git a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/dept/DeptService.java b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/dept/DeptService.java
index d4bd334..7d4ccc7 100644
--- a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/dept/DeptService.java
+++ b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/dept/DeptService.java
@@ -64,6 +64,14 @@
     List<DeptDO> getDeptList(DeptListReqVO reqVO);
 
     /**
+     * 鑾峰彇鎵�鏈夊惎鐢ㄩ儴闂ㄧ畝鏄撳垪琛�
+     *
+     * @param
+     * @return 閮ㄩ棬鍒楄〃
+     */
+    List<DeptDO> getSimpleDeptList();
+
+    /**
      * 鑾峰緱鎸囧畾缂栧彿鐨勯儴闂� Map
      *
      * @param ids 閮ㄩ棬缂栧彿鏁扮粍
diff --git a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/dept/DeptServiceImpl.java b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/dept/DeptServiceImpl.java
index 5d82fb5..710b15b 100644
--- a/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/dept/DeptServiceImpl.java
+++ b/jh-module-system/jh-module-system-biz/src/main/java/cn/lihu/jh/module/system/service/dept/DeptServiceImpl.java
@@ -170,6 +170,14 @@
     }
 
     @Override
+    public List<DeptDO> getSimpleDeptList() {
+        DeptListReqVO reqVO = new DeptListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus());
+        List<DeptDO> list = deptMapper.selectList(reqVO);
+        list.sort(Comparator.comparing(DeptDO::getSort));
+        return list;
+    }
+
+    @Override
     public List<DeptDO> getChildDeptList(Long id) {
         List<DeptDO> children = new LinkedList<>();
         // 閬嶅巻姣忎竴灞�
diff --git a/sql/mysql/jh.sql b/sql/mysql/jh.sql
index 792a45d..5ff5473 100644
--- a/sql/mysql/jh.sql
+++ b/sql/mysql/jh.sql
@@ -72,7 +72,8 @@
 DROP TABLE IF EXISTS `clinic_room`;
 CREATE TABLE `clinic_room` (
   `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
-  `room_no` varchar(10) NOT NULL COMMENT '璇婂缂栧彿',
+  `room_id` BIGINT NOT NULL COMMENT '璇婂缂栧彿',
+  `room_name` varchar(10) NOT NULL COMMENT '璇婂鍚嶇О',
   `bed_no` varchar(10) NOT NULL COMMENT '璇婄枟搴婄紪鍙�',
   `tenant_id` int NOT NULL COMMENT '绉熸埛缂栧彿',
   `creator` varchar(10) DEFAULT '' COMMENT '鍒涘缓鑰�',

--
Gitblit v1.9.3