| | |
| | | package cn.lihu.jh.module.ecg.controller.admin.room; |
| | | |
| | | 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 org.springframework.web.bind.annotation.*; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | 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.dal.dataobject.queue.QueueDO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO; |
| | | import cn.lihu.jh.module.ecg.service.queue.QueueService; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | |
| | | 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; |
| | | import cn.lihu.jh.framework.common.pojo.PageParam; |
| | | import cn.lihu.jh.framework.common.pojo.PageResult; |
| | | import cn.lihu.jh.framework.common.pojo.CommonResult; |
| | | import cn.lihu.jh.framework.common.util.object.BeanUtils; |
| | | import static cn.lihu.jh.framework.common.pojo.CommonResult.success; |
| | | |
| | | import cn.lihu.jh.framework.excel.core.util.ExcelUtils; |
| | | |
| | | import cn.lihu.jh.framework.apilog.core.annotation.ApiAccessLog; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | |
| | | import static cn.lihu.jh.framework.common.pojo.CommonResult.success; |
| | | import static cn.lihu.jh.framework.apilog.core.enums.OperateTypeEnum.*; |
| | | |
| | | |
| | |
| | | |
| | | @Resource |
| | | private RoomService roomService; |
| | | |
| | | @Resource |
| | | private QueueService queueService; |
| | | |
| | | @Resource |
| | | private DeptApi deptApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "创建诊室和诊疗床") |
| | |
| | | return success(BeanUtils.toBean(room, RoomRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/get-room-by-ip") |
| | | @Operation(summary = "获得诊室和诊疗床") |
| | | @PermitAll |
| | | public CommonResult<RoomRespVO> getRoomByIP(HttpServletRequest request) { |
| | | String reqIp = ServletUtil.getClientIP(request); |
| | | RoomDO room = roomService.getRoomByIP(reqIp); |
| | | return success(BeanUtils.toBean(room, RoomRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得诊室和诊疗床分页") |
| | | @PreAuthorize("@ss.hasPermission('clinic:room:query')") |
| | |
| | | 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); |
| | | } |
| | | |
| | | @GetMapping(value = {"/list-all-bed"}) |
| | | @Operation(summary = "获取诊床列表", description = "主要用于前端的开诊管理") |
| | | public CommonResult<Map<String, List<RoomRespVO>>> getAllBedMap() { |
| | | |
| | | RoomPageReqVO pageReqVO = new RoomPageReqVO(); |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<RoomDO> list = roomService.getRoomPage(pageReqVO).getList(); |
| | | |
| | | List<RoomRespVO> list2 = BeanUtils.toBean(list, RoomRespVO.class); |
| | | |
| | | Map<String, List<RoomRespVO>> map = list2.stream().collect(Collectors.groupingBy(RoomRespVO::getRoomName)); |
| | | return success(map); |
| | | } |
| | | |
| | | @GetMapping(value = {"/list-simple-room"}) |
| | | @Operation(summary = "获取门诊室列表", description = "主要用于前端的诊室选择") |
| | | public CommonResult<Map<Long, List<RoomRespVO>>> getSimpleRoomList() { |
| | | List<RoomDO> list = roomService.simpleRoomList(); |
| | | List<RoomRespVO> list2 = BeanUtils.toBean(list, RoomRespVO.class); |
| | | |
| | | Map<Long, List<RoomRespVO>> map = list2.stream().collect(Collectors.groupingBy(RoomRespVO::getRoomId)); |
| | | return success(map); |
| | | } |
| | | |
| | | @GetMapping(value = {"/reset-room"}) |
| | | @Operation(summary = "重置门诊室", description = "主要用于每天关闭工位") |
| | | public CommonResult<String> resetRoom() { |
| | | roomService.resetRoom(true); |
| | | return success("reset room ok"); |
| | | } |
| | | |
| | | @GetMapping(value = {"/monitor"}) |
| | | @Operation(summary = "监控状态获取", description = "监控状态获取 监控用") |
| | | public CommonResult<MonitorInfoVO> getMonitorInfo() { |
| | | MonitorInfoVO monitorInfoVO = roomService.getMonitorInfo(); |
| | | return success( monitorInfoVO ); |
| | | } |
| | | |
| | | @GetMapping("/start-biz") |
| | | @Operation(summary = "手动开诊") |
| | | @PreAuthorize("@ss.hasPermission('ecg:room:setting')") |
| | | public CommonResult<Integer> startBiz() { |
| | | queueService.startBiz(); |
| | | return success(0); |
| | | } |
| | | |
| | | @GetMapping("/close-biz") |
| | | @Operation(summary = "手动闭诊") |
| | | @PreAuthorize("@ss.hasPermission('ecg:room:setting')") |
| | | public CommonResult<Integer> stopBiz() { |
| | | queueService.closeBiz(); |
| | | return success(0); |
| | | } |
| | | |
| | | |
| | | } |