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; @Tag(name = "叫号屏 ") @RestController @RequestMapping("/ecg/screen") @Validated public class CallingScreenController { @Resource private CallingScreenService callingScreenService; @Resource private EcgConfigService ecgConfigService; @GetMapping("/calling-data") @Operation(summary = "大屏叫号数据") @PermitAll public CommonResult>> callingData() { Map> map = callingScreenService.callingData(); Map> mapVO = new HashMap<>(); map.keySet().forEach( key -> { mapVO.put(key, BeanUtils.toBean(map.get(key), CallingRespVO.class)); }); return success( mapVO ); } @GetMapping("/room-screen-data") @Operation(summary = "诊间屏数据") @PermitAll public CommonResult> callingDataRoom(HttpServletRequest request) { String reqIp = ServletUtil.getClientIP(request); List queueStatusList = new ArrayList<>(); queueStatusList.add(QueueStatusEnum.READY.getStatus()); queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus()); queueStatusList.add(QueueStatusEnum.PASSED.getStatus()); List queueDOList = callingScreenService.getRoomQueue(reqIp, queueStatusList); return success(BeanUtils.toBean(queueDOList, CallingRespVO.class)); } @GetMapping("/mark-called") @Operation(summary = "诊间屏数据") @PermitAll public CommonResult markCalled(@RequestParam("patId") String patId) { ErrorCode result = callingScreenService.markCalled(patId); if (result.equals(SUCCESS)) return success(0); return error(result); } }