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; } } 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") 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; } 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; } 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; } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/room/RoomStatisticsDO.java
ÎļþÒÑɾ³ý 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 " + 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(); 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