| | |
| | | PASSED_INSTALL((byte)7, "已过号-安装"), |
| | | WAITING((byte)10, "排队中"), |
| | | RECALLED((byte)15, "已召回"), |
| | | RECALLED_INSTALL((byte)17, "已召回-安装"), |
| | | READY((byte)20, "候诊中"), |
| | | ONSTAGE((byte)30, "就诊中"), // 或 领用中 |
| | | RECEIVED((byte)33, "已领用"), |
| | |
| | | { |
| | | queueService.finishInstallNextPatient(roomId, bedNo); |
| | | |
| | | List<Byte> queueStatusList = new ArrayList<>(); |
| | | queueStatusList.add(QueueStatusEnum.RECEIVED.getStatus()); |
| | | List<QueueDO> queueDOList = queueService.getRoomQueueByStatus(roomId, queueStatusList); |
| | | List<QueueDO> queueDOList = queueService.getToBeInstalledPatient(roomId, bedNo); |
| | | |
| | | queueStatusList.clear(); |
| | | queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus()); |
| | | List<QueueDO> installingQueueDOList = queueService.getBedQueueByStatus(roomId, bedNo, queueStatusList); |
| | | queueDOList.addAll(0, installingQueueDOList ); |
| | | |
| | | List<QueueDO> installingQueueDOList = queueDOList.stream().filter(queueDO -> queueDO.getStatus() == QueueStatusEnum.INSTALLING.getStatus()).toList(); |
| | | // 过滤出 [安装中] 的,准备叫号 该工位应该 最多只有一个 [安装中] |
| | | if (installingQueueDOList.size() > 0) { |
| | | QueueDO onStageItem = installingQueueDOList.getFirst(); |
| | |
| | | return success(BeanUtils.toBean(queueDOList, QueueRespVO.class)); |
| | | } |
| | | |
| | | // 常规检查过号、领用过号 |
| | | @GetMapping("/pass-next-patient") |
| | | @Operation(summary = "过号、下一位患者") |
| | | @Parameter(name = "roomId", description = "诊室编号", required = true, example = "116") |
| | |
| | | { |
| | | queueService.passNextPatient(roomId, bedNo); |
| | | |
| | | List<Byte> queueStatusList = new ArrayList<>(); |
| | | queueStatusList.add(QueueStatusEnum.RECALLED.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.READY.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.PASSED.getStatus()); |
| | | List<QueueDO> queueDOList = queueService.getBedQueueByStatus(roomId, bedNo, queueStatusList); |
| | | List<QueueDO> queueDOList = queueService.getToBeCheckedPatient(roomId, bedNo); |
| | | |
| | | // 过滤出 就诊中的,准备叫号 |
| | | QueueDO onStageItem = queueDOList.stream().filter(item -> Objects.equals(item.getStatus(), QueueStatusEnum.ONSTAGE.getStatus())).findFirst().orElse(null); |
| | |
| | | { |
| | | queueService.passInstallNextPatient(roomId, bedNo); |
| | | |
| | | List<Byte> queueStatusList = new ArrayList<>(); |
| | | queueStatusList.add(QueueStatusEnum.RECEIVED.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.PASSED_INSTALL.getStatus()); |
| | | List<QueueDO> queueDOList = queueService.getRoomQueueByStatus(roomId, queueStatusList); |
| | | |
| | | queueStatusList.clear(); |
| | | queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus()); |
| | | queueDOList.addAll(0, queueService.getBedQueueByStatus(roomId, bedNo, queueStatusList) ); |
| | | List<QueueDO> queueDOList = queueService.getToBeInstalledPatient(roomId, bedNo); |
| | | |
| | | /* |
| | | // 过滤出 就诊中的,准备叫号 |
| | |
| | | return success("操作成功"); |
| | | } |
| | | |
| | | @GetMapping("/get-patient-list") |
| | | @Operation(summary = "取患者列表") |
| | | @GetMapping("/get-to-be-checked-list") |
| | | @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<List<QueueRespVO>> getPatientList( |
| | | public CommonResult<List<QueueRespVO>> getToBeCheckedPatientList( |
| | | @RequestParam("roomId") Long roomId, |
| | | @RequestParam("bedNo") String bedNo) |
| | | { |
| | | List<Byte> queueStatusList = new ArrayList<>(); |
| | | queueStatusList.add(QueueStatusEnum.RECALLED.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.READY.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.PASSED.getStatus()); |
| | | List<QueueDO> queueDOList = queueService.getBedQueueByStatus(roomId, bedNo, queueStatusList); |
| | | List<QueueDO> queueDOList = queueService.getToBeCheckedPatient(roomId, bedNo); |
| | | return success(BeanUtils.toBean(queueDOList, QueueRespVO.class)); |
| | | } |
| | | |
| | |
| | | @RequestParam("roomId") Long roomId, |
| | | @RequestParam("bedNo") String bedNo) |
| | | { |
| | | List<Byte> queueStatusList = new ArrayList<>(); |
| | | queueStatusList.add(QueueStatusEnum.RECEIVED.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.PASSED_INSTALL.getStatus()); |
| | | List<QueueDO> queueDOList = queueService.getRoomQueueByStatus(roomId, queueStatusList); |
| | | |
| | | queueStatusList.clear(); |
| | | queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus()); |
| | | queueDOList.addAll(0, queueService.getBedQueueByStatus(roomId, bedNo, queueStatusList) ); |
| | | List<QueueDO> queueDOList = queueService.getToBeInstalledPatient(roomId, bedNo); |
| | | return success(BeanUtils.toBean(queueDOList, QueueRespVO.class)); |
| | | } |
| | | |
| | |
| | | " (select min(seq_num) as min_seq_num from lihu.queue where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus}) a )") |
| | | Integer updateBedQueueStatus(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus); |
| | | |
| | | // 某个诊室范围内 [已领用]人员 抢占 |
| | | @Update("update lihu.queue set status = #{newStatus}, bed_no = #{bedNo} where seq_num = \n" + |
| | | "(select a.min_seq_num from \n" + |
| | | " (select min(seq_num) as min_seq_num from lihu.queue where room_id = #{roomId} and status = #{curStatus}) a )") |
| | | Integer preemptReceivedPatient(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus); |
| | | // 某个诊室范围内 [已领用] [已召回-安装] 人员 抢占 |
| | | @Update("<script> " + |
| | | "update lihu.queue set status = #{newStatus}, bed_no = #{bedNo} where seq_num = \n" + |
| | | " (select a.min_seq_num from \n" + |
| | | " (select min(seq_num) as min_seq_num from lihu.queue where room_id = #{roomId} " + |
| | | " and status in ( " + |
| | | " <foreach collection='curStatusList' separator=',' item='status'>" + |
| | | " #{status} " + |
| | | " </foreach> )" + |
| | | " ) a " + |
| | | " )" + |
| | | "</script>" |
| | | ) |
| | | Integer preemptToBeInstalledPatient(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("curStatusList")List<Byte> curStatusList, @Param("newStatus")Byte newStatus); |
| | | |
| | | @Update("update lihu.queue set status = #{newStatus} where pat_id = #{patId} and status = #{curStatus}") |
| | | Integer updatePatientQueueStatus(@Param("patId")String patId, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus); |
| | |
| | | @Param("seqNum")Integer seqNum, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus, |
| | | @Param("checkType")Integer checkType); |
| | | |
| | | @Update("update lihu.queue set status = #{newStatus}, seq_num = #{seqNum}, passed = 1 " + |
| | | @Update("update lihu.queue set status = #{newStatus}, seq_num = #{seqNum} " + |
| | | " where id = " + |
| | | " (select a.id from \n" + |
| | | " (select id from lihu.queue where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus} order by seq_num limit 1) a)") |
| | | " (select id from lihu.queue where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus} " + |
| | | " order by seq_num limit 1" + |
| | | " ) a" + |
| | | " )" ) |
| | | Integer queueRecalledPatient(@Param("roomId")Long roomId, @Param("roomName")String roomName, @Param("bedNo")String bedNo, |
| | | @Param("seqNum")Integer seqNum, @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus); |
| | | |
| | | @Update("update lihu.queue set status = #{newStatus} " + |
| | | // 常规检查 或 领用 的患者召回, 原工位处理 |
| | | @Update("update lihu.queue set status = #{newStatus}, passed = 1 " + |
| | | " where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus} and pat_id = #{patId} ") |
| | | Integer recallPassedPatient(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("patId")String patId, |
| | | @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus); |
| | | |
| | | // 装机医生 允许抢占 本科室 [安装过号] 的患者 |
| | | @Update("update lihu.queue set status = #{newStatus}, bed_no = #{bedNo}, passed = 1 " + |
| | | " where room_id = #{roomId} and status = #{curStatus} and pat_id = #{patId} ") |
| | | Integer recallPassedInstallPatient(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, @Param("patId")String patId, |
| | | @Param("curStatus")Byte curStatus, @Param("newStatus")Byte newStatus); |
| | | |
| | | @Update("update lihu.queue set jump_flag = #{jumped} " + |
| | | " where status = #{curStatus} and pat_id = #{patId}") |
| | | Integer queueJump(@Param("patId")String patId, @Param("curStatus")Byte curStatus, @Param("jumped")Byte jumped ); |
| | |
| | | Integer patientJump(String patId, Byte jumped ); |
| | | |
| | | RoomDO getDocRoomInfo(Long docId); |
| | | |
| | | List<QueueDO> getToBeCheckedPatient(Long roomId, String bedNo); |
| | | |
| | | List<QueueDO> getToBeInstalledPatient(Long roomId, String bedNo); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public Integer recallInstallPatient(Long roomId, String bedNo, String patId) { |
| | | Integer updateNum = queueMapper.recallPassedPatient(roomId, bedNo, patId, |
| | | QueueStatusEnum.PASSED_INSTALL.getStatus(), QueueStatusEnum.RECEIVED.getStatus()); |
| | | startHurryUpOneBed(roomId, bedNo); |
| | | Integer updateNum = queueMapper.recallPassedInstallPatient(roomId, bedNo, patId, |
| | | QueueStatusEnum.PASSED_INSTALL.getStatus(), QueueStatusEnum.RECALLED_INSTALL.getStatus()); |
| | | // 安装工位 不设计 优先队列 |
| | | //startHurryUpOneBed(roomId, bedNo); |
| | | return updateNum; |
| | | } |
| | | |
| | |
| | | return roomMapper.getRoomByDocId(docId); |
| | | } |
| | | |
| | | @Override |
| | | public List<QueueDO> getToBeCheckedPatient(Long roomId, String bedNo) { |
| | | List<Byte> queueStatusList = new ArrayList<>(); |
| | | queueStatusList.add(QueueStatusEnum.RECALLED.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.READY.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.PASSED.getStatus()); |
| | | List<QueueDO> queueDOList = getBedQueueByStatus(roomId, bedNo, queueStatusList); |
| | | return queueDOList; |
| | | } |
| | | |
| | | @Override |
| | | public List<QueueDO> getToBeInstalledPatient(Long roomId, String bedNo) { |
| | | List<Byte> queueStatusList = new ArrayList<>(); |
| | | queueStatusList.add(QueueStatusEnum.RECEIVED.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.PASSED_INSTALL.getStatus()); |
| | | List<QueueDO> queueDOList = getRoomQueueByStatus(roomId, queueStatusList); |
| | | |
| | | queueStatusList.clear(); |
| | | queueStatusList.add(QueueStatusEnum.INSTALLING.getStatus()); |
| | | queueStatusList.add(QueueStatusEnum.RECALLED_INSTALL.getStatus()); |
| | | queueDOList.addAll(0, getBedQueueByStatus(roomId, bedNo, queueStatusList) ); |
| | | return queueDOList; |
| | | } |
| | | |
| | | private RoomDO getRoomDO(Long roomId, String bedNo) { |
| | | RoomDO roomDO = mapRoomBed.get( Utils.formatRoomBed(roomId, bedNo) ); |
| | | if ( null == roomDO) |
| | |
| | | // 装机时 医生 取下一位患者 |
| | | public ErrorCode nextInstallPatient(Long roomId, String bedNo) { |
| | | // 从 DB 把 序号最小的 [已领用] 的人 设置为 [安装中] |
| | | Integer updateNum = queueMapper.preemptReceivedPatient(roomId, bedNo, |
| | | QueueStatusEnum.RECEIVED.getStatus(), QueueStatusEnum.INSTALLING.getStatus()); |
| | | Integer updateNum = queueMapper.preemptToBeInstalledPatient(roomId, bedNo, |
| | | List.of(QueueStatusEnum.RECEIVED.getStatus(), QueueStatusEnum.RECALLED_INSTALL.getStatus()), |
| | | QueueStatusEnum.INSTALLING.getStatus()); |
| | | // 该工位 没有 [已领用] 人员 |
| | | if (null == updateNum || 0 == updateNum) { |
| | | return QUEUE_NOT_READY_PATIENT; |
| | |
| | | bedQueueBO.getRoomName(), |
| | | bedQueueBO.getBedNo(), |
| | | curSeqNum.get() + 1, |
| | | QueueStatusEnum.RECALLED.getStatus(), |
| | | QueueStatusEnum.RECALLED.getStatus(), // 不需要处理 [安装召回], 原因: 安装工位 没有优先队列 |
| | | QueueStatusEnum.READY.getStatus()); |
| | | if (null == updateNum || 0 == updateNum) |
| | | break; |