| | |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private RoomService roomService; |
| | | |
| | | @Resource |
| | | private DeptApi deptApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "创建诊室和诊疗床") |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |