| | |
| | | import cn.lihu.jh.framework.common.pojo.CommonResult; |
| | | import cn.lihu.jh.framework.common.util.object.BeanUtils; |
| | | import cn.lihu.jh.framework.security.core.util.SecurityFrameworkUtils; |
| | | import cn.lihu.jh.module.ecg.controller.admin.call.vo.CallSaveReqVO; |
| | | import cn.lihu.jh.module.ecg.controller.admin.queue.vo.PatientStatisticVO; |
| | | import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueueRespVO; |
| | | import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomRespVO; |
| | | 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.call.CallService; |
| | | 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 lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | 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; |
| | | import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.ECG_INNER_ERROR; |
| | | |
| | | @Tag(name = "管理后台 - 医生叫号") |
| | | @RestController |
| | | @RequestMapping("/ecg/doctor") |
| | | @Validated |
| | | @Slf4j |
| | | public class DoctorController { |
| | | |
| | | @Resource |
| | | private QueueService queueService; |
| | | |
| | | @Resource |
| | | private CallService callService; |
| | | |
| | | @GetMapping("/bed-doctor-pause") |
| | | @Operation(summary = "医生暂停") |
| | |
| | | queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.PASSED.getStatus()); |
| | | List<QueueDO> queueDOList = queueService.getDoctorQueueByStatus(roomId, bedNo, queueStatusList); |
| | | |
| | | // 过滤出 就诊中的,准备叫号 |
| | | QueueDO onStageItem = queueDOList.stream().filter(item -> Objects.equals(item.getStatus(), QueueStatusEnum.ONSTAGE.getStatus())).findFirst().orElse(null); |
| | | if (null != onStageItem) { |
| | | CallSaveReqVO callSaveReqVO = BeanUtils.toBean(onStageItem, CallSaveReqVO.class); |
| | | callSaveReqVO.setId(null); |
| | | callService.createCall(callSaveReqVO); |
| | | } |
| | | |
| | | return success(BeanUtils.toBean(queueDOList, QueueRespVO.class)); |
| | | } |
| | | |
| | |
| | | queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.PASSED.getStatus()); |
| | | List<QueueDO> queueDOList = queueService.getDoctorQueueByStatus(roomId, bedNo, queueStatusList); |
| | | |
| | | // 过滤出 就诊中的,准备叫号 |
| | | QueueDO onStageItem = queueDOList.stream().filter(item -> Objects.equals(item.getStatus(), QueueStatusEnum.ONSTAGE.getStatus())).findFirst().orElse(null); |
| | | if (null != onStageItem) { |
| | | CallSaveReqVO callSaveReqVO = BeanUtils.toBean(onStageItem, CallSaveReqVO.class); |
| | | callSaveReqVO.setId(null); |
| | | callService.createCall(callSaveReqVO); |
| | | } |
| | | |
| | | return success(BeanUtils.toBean(queueDOList, QueueRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/call-again") |
| | | @Operation(summary = "重叫、患者") |
| | | @Parameter(name = "roomId", description = "诊室编号", required = true, example = "116") |
| | | @Parameter(name = "bedNo", description = "工位编号", required = true, example = "B2") |
| | | @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") |
| | | public CommonResult<String> callAgainPatient( |
| | | @RequestParam("roomId") Long roomId, |
| | | @RequestParam("bedNo") String bedNo) |
| | | { |
| | | List<Byte> queueStatusList = new ArrayList<>(); |
| | | queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus()); |
| | | List<QueueDO> queueDOList = queueService.getDoctorQueueByStatus(roomId, bedNo, queueStatusList); |
| | | |
| | | if (queueDOList.isEmpty()) |
| | | return success("无就诊中患者"); |
| | | |
| | | if (queueDOList.size() > 1) { |
| | | log.error("room {} bed {} have {} 就诊中患者", roomId, bedNo, queueDOList.size()); |
| | | return error(ECG_INNER_ERROR); |
| | | } |
| | | |
| | | QueueDO onStageItem = queueDOList.get(0); |
| | | CallSaveReqVO callSaveReqVO = BeanUtils.toBean(onStageItem, CallSaveReqVO.class); |
| | | callSaveReqVO.setId(null); |
| | | callService.callAgain(callSaveReqVO); |
| | | |
| | | return success("操作成功"); |
| | | } |
| | | |
| | | @GetMapping("/get-patient-list") |
| | | @Operation(summary = "取患者列表") |
| | | @Parameter(name = "roomId", description = "诊室编号", required = true, example = "116") |