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/devmanage/DeviceController.java |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/DeviceController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/DeviceController.java
index b1fa875..7b6c348 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/DeviceController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devmanage/DeviceController.java
@@ -1,5 +1,9 @@
 package cn.lihu.jh.module.ecg.controller.admin.devmanage;
 
+import cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo.JobRecordPageReqVO;
+import cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo.JobRecordStatisticVO;
+import cn.lihu.jh.module.ecg.dal.dataobject.devmanage.DeviceStatisticDO;
+import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordStatisticDO;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -7,6 +11,7 @@
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.Operation;
 
+import java.time.LocalDate;
 import java.util.*;
 import java.io.IOException;
 
@@ -71,6 +76,25 @@
         return success(BeanUtils.toBean(device, DeviceRespVO.class));
     }
 
+    @GetMapping("/get-by-dev-id")
+    @Operation(summary = "鑾峰緱璁惧")
+    @Parameter(name = "devId", description = "缂栧彿", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
+    public CommonResult<DeviceRespVO> getDevice(@RequestParam("dev-id") String devId) {
+        DeviceDO device = deviceService.getDevice(devId);
+        return success(BeanUtils.toBean(device, DeviceRespVO.class));
+    }
+
+    @PostMapping("/update-dev-state")
+    @Operation(summary = "鏇存柊璁惧鐘舵��")
+    @Parameter(name = "devId", description = "缂栧彿", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('ecg:doctor:task')")
+    public CommonResult<Integer> updateDeviceState(@Valid @RequestBody DeviceSaveReqVO updateReqVO) {
+        updateReqVO.setStateDate( LocalDate.now() );
+        Integer ret =  deviceService.updateDeviceState(updateReqVO);
+        return success(ret);
+    }
+
     @GetMapping("/page")
     @Operation(summary = "鑾峰緱璁惧鍒嗛〉")
     @PreAuthorize("@ss.hasPermission('ecg:device:query')")
@@ -87,9 +111,32 @@
               HttpServletResponse response) throws IOException {
         pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
         List<DeviceDO> list = deviceService.getDevicePage(pageReqVO).getList();
+
+        List<DeviceRespFlattenVO> listFlatten = list.stream().map(deviceDO -> {
+            DeviceRespFlattenVO deviceRespFlattenVO = BeanUtils.toBean(deviceDO, DeviceRespFlattenVO.class);
+            if (null != deviceDO.getPatDetails()) {
+                deviceRespFlattenVO.setPatId(deviceDO.getPatDetails().getId());
+                deviceRespFlattenVO.setPatName(deviceDO.getPatDetails().getName());
+                deviceRespFlattenVO.setPatMobile(deviceDO.getPatDetails().getMobile());
+                deviceRespFlattenVO.setPatDeptCode(deviceDO.getPatDetails().getDeptCode());
+                deviceRespFlattenVO.setPatDeptDesc(deviceDO.getPatDetails().getDeptDesc());
+                deviceRespFlattenVO.setPatWardCode(deviceDO.getPatDetails().getWardCode());
+                deviceRespFlattenVO.setPatWardDesc(deviceDO.getPatDetails().getWardDesc());
+                deviceRespFlattenVO.setPatBedNo(deviceDO.getPatDetails().getBedNo());
+            }
+            return deviceRespFlattenVO;
+        }).toList();
+
         // 瀵煎嚭 Excel
-        ExcelUtils.write(response, "璁惧.xls", "鏁版嵁", DeviceRespVO.class,
-                        BeanUtils.toBean(list, DeviceRespVO.class));
+        ExcelUtils.write(response, "璁惧.xls", "鏁版嵁", DeviceRespFlattenVO.class, listFlatten);
     }
 
-}
\ No newline at end of file
+    @GetMapping("/dev-statistic")
+    @Operation(summary = "璁惧缁熻")
+    @PreAuthorize("@ss.hasPermission('ecg:device:statistic')")
+    public CommonResult<List<DeviceStatisticVO>> getDeviceStatistic(@Valid DevicePageReqVO pageReqVO) {
+        List<DeviceStatisticDO> statisticDOList = deviceService.getDeviceStatistic(pageReqVO);
+        return success(BeanUtils.toBean(statisticDOList, DeviceStatisticVO.class));
+    }
+
+}

--
Gitblit v1.9.3