| | |
| | | package cn.lihu.jh.module.ecg.controller.admin.callingscreen; |
| | | |
| | | import cn.hutool.extra.servlet.ServletUtil; |
| | | import cn.lihu.jh.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.lihu.jh.framework.common.exception.ErrorCode; |
| | | import cn.lihu.jh.framework.common.pojo.CommonResult; |
| | | import cn.lihu.jh.framework.common.pojo.PageParam; |
| | | import cn.lihu.jh.framework.common.pojo.PageResult; |
| | | import cn.lihu.jh.framework.common.util.object.BeanUtils; |
| | | import cn.lihu.jh.framework.excel.core.util.ExcelUtils; |
| | | import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueuePageReqVO; |
| | | import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueueRespVO; |
| | | import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueueSaveReqVO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO; |
| | | import cn.lihu.jh.module.ecg.enums.QueueStatusEnum; |
| | | import cn.lihu.jh.module.ecg.service.callingscreen.CallingScreenService; |
| | | import cn.lihu.jh.module.ecg.service.config.EcgConfigService; |
| | | import cn.lihu.jh.module.ecg.service.queue.QueueService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.lihu.jh.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.lihu.jh.framework.common.exception.enums.GlobalErrorCodeConstants.SUCCESS; |
| | | import static cn.lihu.jh.framework.common.pojo.CommonResult.error; |
| | | import static cn.lihu.jh.framework.common.pojo.CommonResult.success; |
| | | |
| | |
| | | @Resource |
| | | private EcgConfigService ecgConfigService; |
| | | |
| | | @GetMapping("/calling-data") |
| | | @GetMapping("/big-screen-data") |
| | | @Operation(summary = "大屏叫号数据") |
| | | @PermitAll |
| | | public CommonResult<Map<Integer, List<CallingRespVO>>> callingData() |
| | | public CommonResult<Map<Integer, List<ScreenQueueRespVO>>> callingData() |
| | | { |
| | | Map<Integer, List<QueueDO>> map = callingScreenService.callingData(); |
| | | |
| | | Map<Integer, List<CallingRespVO>> mapVO = new HashMap<>(); |
| | | Map<Integer, List<ScreenQueueRespVO>> mapVO = new HashMap<>(); |
| | | map.keySet().forEach( key -> { |
| | | mapVO.put(key, BeanUtils.toBean(map.get(key), CallingRespVO.class)); |
| | | mapVO.put(key, BeanUtils.toBean(map.get(key), ScreenQueueRespVO.class)); |
| | | }); |
| | | |
| | | return success( mapVO ); |
| | |
| | | @GetMapping("/room-screen-data") |
| | | @Operation(summary = "诊间屏数据") |
| | | @PermitAll |
| | | public CommonResult<Map<Integer, List<CallingRespVO>>> callingDataRoom(HttpServletRequest request) |
| | | public CommonResult<Map<Integer, List<ScreenQueueRespVO>>> callingDataRoom(HttpServletRequest request) |
| | | { |
| | | String reqIp = ServletUtil.getClientIP(request); |
| | | |
| | | List<Byte> queueStatusList = new ArrayList<>(); |
| | | queueStatusList.add(QueueStatusEnum.RECALLED.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.RECALLED_INSTALL.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.READY.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.PASSED.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.PASSED_INSTALL.getStatus()); |
| | | List<QueueDO> queueDOList = callingScreenService.getRoomQueue(reqIp, queueStatusList); |
| | | |
| | | List<QueueDO> passedList = queueDOList.stream().filter(queue -> queue.getStatus() == QueueStatusEnum.PASSED.getStatus()).toList(); |
| | | queueDOList.removeIf(queue -> queue.getStatus() == QueueStatusEnum.PASSED.getStatus()); |
| | | |
| | | Map<Integer, List<CallingRespVO>> mapVO = new HashMap<>(); |
| | | mapVO.put(1, BeanUtils.toBean(queueDOList, CallingRespVO.class)); |
| | | mapVO.put(2, BeanUtils.toBean(passedList, CallingRespVO.class)); |
| | | Map<Integer, List<ScreenQueueRespVO>> mapVO = new HashMap<>(); |
| | | mapVO.put(1, BeanUtils.toBean(queueDOList, ScreenQueueRespVO.class)); |
| | | mapVO.put(2, BeanUtils.toBean(passedList, ScreenQueueRespVO.class)); |
| | | return success( mapVO ); |
| | | } |
| | | |
| | | @GetMapping("/mark-called") |
| | | @Operation(summary = "诊间屏数据") |
| | | @PermitAll |
| | | public CommonResult<Integer> markCalled(@RequestParam("patId") String patId) |
| | | { |
| | | ErrorCode result = callingScreenService.markCalled(patId); |
| | | if (result.equals(SUCCESS)) |
| | | return success(0); |
| | | |
| | | return error(result); |
| | | } |
| | | } |