From 069328ea846a08e673c508725e7e8d019f8a6333 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期日, 30 三月 2025 20:49:09 +0800
Subject: [PATCH] get room profile
---
/dev/null | 10 ---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/RoomController.java | 12 +--
jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/RoomCallingScreenEnum.java | 38 ++++++++++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/room/RoomMapper.java | 4 -
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomProfileRespVO.java | 26 ++++++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomServiceImpl.java | 49 ++++++++++++----
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomDO.java | 5 +
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/room/RoomService.java | 6 -
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomProfile.java | 18 ++++++
9 files changed, 130 insertions(+), 38 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/RoomCallingScreenEnum.java b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/RoomCallingScreenEnum.java
new file mode 100644
index 0000000..0262adb
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/RoomCallingScreenEnum.java
@@ -0,0 +1,38 @@
+package cn.lihu.jh.module.ecg.enums;
+
+import cn.lihu.jh.framework.common.core.IntArrayValuable;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.Arrays;
+
+/**
+ * 閫氱敤鐘舵�佹灇涓�
+ *
+ * @author 鑺嬮亾婧愮爜
+ */
+@Getter
+@AllArgsConstructor
+public enum RoomCallingScreenEnum implements IntArrayValuable {
+ NONE(0, "鏃犲彨鍙峰睆"),
+ CHECK_ONLY(10, "妫�鏌ュ彨鍙峰睆"),
+ INSTALL_ONLY(20, "瀹夎鍙彿灞�"),
+ HYBRID(30, "娣峰悎鍙彿灞�"); // 妫�鏌� + 瀹夎
+
+ public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(RoomCallingScreenEnum::getCallingScreenType).toArray();
+
+ /**
+ * 鐘舵�佸��
+ */
+ private final Integer callingScreenType;
+ /**
+ * 鐘舵�佸悕
+ */
+ private final String name;
+
+ @Override
+ public int[] array() {
+ return ARRAYS;
+ }
+
+}
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 fe94bf3..85a6409 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
@@ -10,9 +10,10 @@
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.controller.admin.room.vo.*;
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.dal.dataobject.room.RoomProfile;
import cn.lihu.jh.module.ecg.service.queue.QueueService;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
@@ -22,9 +23,6 @@
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
-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;
@@ -90,10 +88,10 @@
@GetMapping("/get-room-by-ip")
@Operation(summary = "鑾峰緱璇婂鍜岃瘖鐤楀簥")
@PermitAll
- public CommonResult<RoomRespVO> getRoomByIP(HttpServletRequest request) {
+ public CommonResult<RoomProfileRespVO> getRoomByIP(HttpServletRequest request) {
String reqIp = ServletUtil.getClientIP(request);
- RoomDO room = roomService.getRoomByIP(reqIp);
- return success(BeanUtils.toBean(room, RoomRespVO.class));
+ RoomProfile roomProfile = roomService.getRoomByIP(reqIp);
+ return success(BeanUtils.toBean(roomProfile, RoomProfileRespVO.class));
}
@GetMapping("/page")
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomProfileRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomProfileRespVO.java
new file mode 100644
index 0000000..6fad177
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/room/vo/RoomProfileRespVO.java
@@ -0,0 +1,26 @@
+package cn.lihu.jh.module.ecg.controller.admin.room.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "绠$悊鍚庡彴 - 璇婂鍜岃瘖鐤楀簥 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class RoomProfileRespVO {
+
+ @Schema(description = "璇婂缂栧彿", requiredMode = Schema.RequiredMode.REQUIRED)
+ private Long roomId;
+
+ @Schema(description = "璇婂鍚嶇О", requiredMode = Schema.RequiredMode.REQUIRED)
+ private String roomName;
+
+ @Schema(description = "璇婄枟搴婃暟閲�", requiredMode = Schema.RequiredMode.REQUIRED)
+ private Integer bedNum;
+
+ @Schema(description = "璇婂灞忕被鍨�")
+ private Integer callingScreenType;
+}
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 446d754..49e25fd 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
@@ -64,5 +64,10 @@
@TableField(typeHandler = JacksonTypeHandler.class)
private Integer[] checkTypes;
+ /**
+ * 0 妫�鏌�
+ * 1 棰嗙敤
+ * 2 瑁呮満
+ */
private Integer opType;
}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomProfile.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomProfile.java
new file mode 100644
index 0000000..2c918f4
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomProfile.java
@@ -0,0 +1,18 @@
+package cn.lihu.jh.module.ecg.dal.dataobject.room;
+
+import cn.lihu.jh.module.ecg.enums.RoomCallingScreenEnum;
+import lombok.Data;
+
+@Data
+public class RoomProfile {
+ Long roomId;
+ String roomName;
+
+ // 宸ヤ綅鏁伴噺
+ Integer bedNum;
+
+ /**
+ * @see RoomCallingScreenEnum
+ */
+ Integer callingScreenType;
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomStatisticsDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomStatisticsDO.java
deleted file mode 100644
index d1b16fd..0000000
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomStatisticsDO.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package cn.lihu.jh.module.ecg.dal.dataobject.room;
-
-import lombok.Data;
-
-@Data
-public class RoomStatisticsDO {
- Long roomId;
- String roomName;
- Integer bedNo;
-}
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 4525140..91a56e2 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
@@ -9,7 +9,6 @@
import org.apache.ibatis.annotations.*;
import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomPageReqVO;
-import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomStatisticsDO;
import cn.lihu.jh.module.ecg.enums.BedStatusEnum;
/**
@@ -36,9 +35,6 @@
" where deleted = 0 " +
"</script>")
Integer resetRoom(@Param("newStatus") Integer newStatus);
-
- @Select({ "SELECT room_id, room_name, count(1) as bed_num FROM lihu.clinic_room group by room_id;" })
- List<RoomStatisticsDO> roomStatistic();
@Select("<script> " +
"SELECT * FROM lihu.clinic_room " +
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 e67ed46..4677d4d 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
@@ -7,7 +7,7 @@
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.RoomStatisticsDO;
+import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomProfile;
/**
@@ -47,7 +47,7 @@
*/
RoomDO getRoom(Integer id);
- RoomDO getRoomByIP(String ip);
+ RoomProfile getRoomByIP(String ip);
/**
* 鑾峰緱璇婂鍜岃瘖鐤楀簥鍒嗛〉
@@ -56,8 +56,6 @@
* @return 璇婂鍜岃瘖鐤楀簥鍒嗛〉
*/
PageResult<RoomDO> getRoomPage(RoomPageReqVO pageReqVO);
-
- List<RoomStatisticsDO> roomStatistics();
List<RoomDO> simpleRoomList();
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 c6d02df..68554a7 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,17 +5,16 @@
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.dal.dataobject.room.RoomProfile;
+import cn.lihu.jh.module.ecg.enums.RoomCallingScreenEnum;
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;
import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomSaveReqVO;
-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 cn.lihu.jh.framework.common.util.object.BeanUtils;
@@ -79,24 +78,48 @@
}
@Override
- public RoomDO getRoomByIP(String ip) {
+ public RoomProfile 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;
+
+ RoomProfile roomProfile = new RoomProfile();
+ roomProfile.setBedNum( 0 );
+ roomProfile.setCallingScreenType( RoomCallingScreenEnum.NONE.getCallingScreenType() );
+
+ for (RoomDO roomDO : roomDOList) {
+ roomProfile.setRoomId(roomDO.getRoomId());
+ roomProfile.setRoomName(roomDO.getRoomName());
+ roomProfile.setBedNum( roomProfile.getBedNum() + 1);
+
+ // 璁$畻 璇婇棿灞忕被鍨�
+ if (roomProfile.getCallingScreenType() == RoomCallingScreenEnum.NONE.getCallingScreenType()) {
+ if ( roomDO.getOpType() == 0 || roomDO.getOpType() == 1 ) {
+ roomProfile.setCallingScreenType( RoomCallingScreenEnum.CHECK_ONLY.getCallingScreenType());
+ } else if ( roomDO.getOpType() == 2 ) {
+ roomProfile.setCallingScreenType( RoomCallingScreenEnum.INSTALL_ONLY.getCallingScreenType());
+ }
+ } else if (roomProfile.getCallingScreenType() == RoomCallingScreenEnum.CHECK_ONLY.getCallingScreenType()) {
+ if ( roomDO.getOpType() == 0 || roomDO.getOpType() == 1 ) {
+ // do nothing
+ } else if ( roomDO.getOpType() == 2 ) {
+ roomProfile.setCallingScreenType( RoomCallingScreenEnum.HYBRID.getCallingScreenType());
+ }
+ } else if (roomProfile.getCallingScreenType() == RoomCallingScreenEnum.INSTALL_ONLY.getCallingScreenType()) {
+ if ( roomDO.getOpType() == 0 || roomDO.getOpType() == 1 ) {
+ roomProfile.setCallingScreenType( RoomCallingScreenEnum.HYBRID.getCallingScreenType());
+ } else if ( roomDO.getOpType() == 2 ) {
+ // do nothing
+ }
+ } else if (roomProfile.getCallingScreenType() == RoomCallingScreenEnum.HYBRID.getCallingScreenType()) {
+ // do nothing
+ }
}
- return optionalQueueDO.get();
+ return roomProfile;
}
@Override
public PageResult<RoomDO> getRoomPage(RoomPageReqVO pageReqVO) {
return roomMapper.selectPage(pageReqVO);
- }
-
- @Override
- public List<RoomStatisticsDO> roomStatistics() {
- return roomMapper.roomStatistic();
}
@Override
--
Gitblit v1.9.3