| | |
| | | ErrorCode QUEUE_BED_EXIST = new ErrorCode(1_010_003_002, "工位队列已存在"); |
| | | ErrorCode QUEUE_HAVE_PATIENT = new ErrorCode(1_010_003_003, "队列中有患者"); |
| | | ErrorCode QUEUE_NOT_READY_PATIENT = new ErrorCode(1_010_003_004, "没有准备中的患者"); |
| | | ErrorCode QUEUE_RECALL_INSTALL_NOT_CUR_ROOM = new ErrorCode(1_010_003_005, "不能召回其他诊室的安装患者"); |
| | | |
| | | ErrorCode PATIENT_NOT_EXISTS = new ErrorCode(1_010_004_000, "患者不存在"); |
| | | |
| | |
| | | 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; |
| | | import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.PATIENT_NOT_EXISTS; |
| | | import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*; |
| | | |
| | | @Tag(name = "管理后台 - 医生叫号") |
| | | @RestController |
| | |
| | | public CommonResult<String> recallPatient( |
| | | @RequestParam("roomId") Long roomId, |
| | | @RequestParam("bedNo") String bedNo, |
| | | @RequestParam("patId") String patId ) |
| | | @RequestParam("patId") String patId, |
| | | @RequestParam("checkType") Integer checkType, |
| | | @RequestParam("roomId_operator") Long roomId_operator, |
| | | @RequestParam("bedNo_operator") String bedNo_operator ) |
| | | { |
| | | Integer result = queueService.recallPatient(roomId, bedNo, patId); |
| | | Integer result = queueService.recallPatient(roomId, bedNo, patId, checkType); |
| | | if (null == result || 0 == result) |
| | | return error(PATIENT_NOT_EXISTS); |
| | | |
| | |
| | | @Parameter(name = "roomId", description = "诊室编号", required = true, example = "116") |
| | | @Parameter(name = "bedNo", description = "工位编号", required = true, example = "B2") |
| | | @Parameter(name = "patId", description = "患者编号", required = true, example = "B2") |
| | | @Parameter(name = "checkType", description = "检查类型", required = true, example = "100") |
| | | @PreAuthorize("@ss.hasPermission('ecg:doctor:task')") |
| | | public CommonResult<String> recallInstallPatient( |
| | | @RequestParam("roomId") Long roomId, |
| | | @RequestParam("bedNo") String bedNo, |
| | | @RequestParam("patId") String patId ) |
| | | @RequestParam("patId") String patId, |
| | | @RequestParam("checkType") Integer checkType, |
| | | @RequestParam("roomId_operator") Long roomId_operator, |
| | | @RequestParam("bedNo_operator") String bedNo_operator ) |
| | | { |
| | | Integer result = queueService.recallInstallPatient(roomId, bedNo, patId); |
| | | if (roomId != roomId_operator) |
| | | return error(QUEUE_RECALL_INSTALL_NOT_CUR_ROOM); |
| | | |
| | | Integer result = queueService.recallInstallPatient(roomId, bedNo, patId, checkType, bedNo_operator); |
| | | if (null == result || 0 == result) |
| | | return error(PATIENT_NOT_EXISTS); |
| | | |
| | |
| | | "</script>" ) |
| | | QueueDO getFirstItemByRoomAndStatus(@Param("roomId")Long roomId, @Param("curStatusList")List<Integer> curStatusList); |
| | | |
| | | |
| | | /* |
| | | @Select("select * from lihu.queue where room_id = #{roomId} and bed_no = #{bedNo} " + |
| | | " and status = #{curStatus} and pat_id = #{patId} and book_check_type=#{checkType}") |
| | | QueueDO XXX(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, |
| | | @Param("patId")String patId, @Param("checkType")Integer checkType, |
| | | @Param("curStatus")Integer curStatus); |
| | | */ |
| | | |
| | | @Update("update lihu.queue set status = #{newStatus} where status = #{curStatus} and 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 bed_no = #{bedNo} and status = #{curStatus}) a )") |
| | |
| | | |
| | | // 常规检查 或 领用 的患者召回, 原工位处理 |
| | | @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, |
| | | " where room_id = #{roomId} and bed_no = #{bedNo} and status = #{curStatus} and pat_id = #{patId} and book_check_type=#{checkType}") |
| | | Integer recallPassedPatient(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, |
| | | @Param("patId")String patId, @Param("checkType")Integer checkType, |
| | | @Param("curStatus")Integer curStatus, @Param("newStatus")Integer 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, |
| | | " where room_id = #{roomId} and status = #{curStatus} and pat_id = #{patId} and book_check_type=#{checkType}") |
| | | Integer recallPassedInstallPatient(@Param("roomId")Long roomId, @Param("bedNo")String bedNo, |
| | | @Param("patId")String patId, @Param("checkType")Integer checkType, |
| | | @Param("curStatus")Integer curStatus, @Param("newStatus")Integer newStatus); |
| | | |
| | | @Update("update lihu.queue set jump_flag = #{jumped} " + |
| | |
| | | |
| | | PatientStatisticVO getBedDevInstallStatistic(Long roomId, String bedNo); |
| | | |
| | | Integer recallPatient(Long roomId, String bedNo, String patId); |
| | | Integer recallPatient(Long roomId, String bedNo, String patId, Integer checkType); |
| | | |
| | | Integer recallInstallPatient(Long roomId, String bedNo, String patId); |
| | | Integer recallInstallPatient(Long roomId, String bedNo, String patId, Integer checkType, String bedNo_operator); |
| | | |
| | | Integer patientJump(String patId, Byte jumped ); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer recallPatient(Long roomId, String bedNo, String patId) { |
| | | Integer updateNum = queueMapper.recallPassedPatient(roomId, bedNo, patId, |
| | | public Integer recallPatient(Long roomId, String bedNo, String patId, Integer checkType) { |
| | | Integer updateNum = queueMapper.recallPassedPatient(roomId, bedNo, patId, checkType, |
| | | QueueStatusEnum.PASSED.getStatus(), QueueStatusEnum.RECALLED.getStatus()); |
| | | |
| | | // 检查项目.亲和性 不需要在这里处理 |
| | | // 会在 HurryUpOnBed 里面处理 检查项目.亲和性 |
| | | |
| | | startHurryUpOneBed(roomId, bedNo); |
| | | return updateNum; |
| | | } |
| | | |
| | | @Override |
| | | public Integer recallInstallPatient(Long roomId, String bedNo, String patId) { |
| | | Integer updateNum = queueMapper.recallPassedInstallPatient(roomId, bedNo, patId, |
| | | public Integer recallInstallPatient(Long roomId, String bedNo, String patId, Integer checkType, String bedNo_operator) { |
| | | Integer updateNum = queueMapper.recallPassedInstallPatient(roomId, bedNo_operator, patId, checkType, |
| | | QueueStatusEnum.PASSED_INSTALL.getStatus(), QueueStatusEnum.RECALLED_INSTALL.getStatus()); |
| | | // 安装工位 不设计 优先队列 |
| | | |
| | | // 检查项目.亲和性 处理 |
| | | updateAffinityItemsWhenInstallRecall(patId, checkType, bedNo_operator); |
| | | |
| | | // 安装工位 不涉及 优先队列 |
| | | //startHurryUpOneBed(roomId, bedNo); |
| | | return updateNum; |
| | | } |
| | |
| | | return roomDO; |
| | | } |
| | | |
| | | private void updateAffinityItemsWhenInstallRecall(String patId, Integer checkType, String bedNo_operator) { |
| | | CheckTypeDO checkTypeDO = queueServiceTxFunctions.getCheckTypeItem( checkType ); |
| | | if ( checkTypeDO.getAffinityCheckTypes().length > 0) { |
| | | List<QueueDO> affinityItems = queueMapper.getCurPatGivenCheckTypesAndStatus(patId, |
| | | checkTypeDO.getAffinityCheckTypes(), QueueStatusEnum.AFFINITY_RECEIVED.getStatus()); |
| | | for (int i = 0; i < affinityItems.size(); i++) { |
| | | QueueDO queueItem = affinityItems.get(i); |
| | | queueItem.setBedNo( bedNo_operator ); |
| | | //queueItem.setSeqNum( preemptQueueItem.getSeqNum() ); // 装机时 内部序号不变 |
| | | queueMapper.updateById(queueItem); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | bedQueueBO.getRoomId(), |
| | | bedQueueBO.getRoomName(), |
| | | bedQueueBO.getBedNo(), |
| | | curSeqNum.get() + 1, |
| | | curSeqNum.get() + 1, // 过号回来,排到当前的下一位 |
| | | QueueStatusEnum.RECALLED.getStatus(), // 不需要处理 [安装召回], 原因: 安装工位 没有优先队列 |
| | | QueueStatusEnum.READY.getStatus()); |
| | | if (null == updateNum || 0 == updateNum) |
| | | break; |
| | | |
| | | // 召回 [过号] 患者后,处理 检查项目.亲和性 逻辑 |
| | | QueueDO recalledQueueItem = queueMapper.getQueueItemBySeqNum(curSeqNum.get() + 1); |
| | | updateAffinityItemsWhenRecalled( recalledQueueItem ); |
| | | |
| | | curSeqNum.getAndIncrement(); |
| | | |
| | |
| | | } |
| | | |
| | | // 抢到排队患者后,处理 检查项目.亲和性 逻辑 |
| | | QueueDO queueDO = queueMapper.getQueueItemBySeqNum(curSeqNum.get() + 1); |
| | | CheckTypeDO checkTypeDO = getCheckTypeItem( queueDO.getBookCheckType() ); |
| | | if ( checkTypeDO.getAffinityCheckTypes().length > 0) { |
| | | List<QueueDO> affinityItems = queueMapper.getCurPatGivenCheckTypesAndStatus(queueDO.getPatId(), |
| | | checkTypeDO.getAffinityCheckTypes(), QueueStatusEnum.WAITING.getStatus()); |
| | | for (int i = 0; i < affinityItems.size(); i++) { |
| | | QueueDO queueItem = affinityItems.get(i); |
| | | queueItem.setStatus(QueueStatusEnum.AFFINITY_WAITING.getStatus()); //改变 排队状态 |
| | | queueItem.setRoomId(queueDO.getRoomId()); |
| | | queueItem.setRoomName(queueDO.getRoomName()); |
| | | queueItem.setBedNo(queueDO.getBedNo()); |
| | | queueItem.setSeqNum(curSeqNum.get() + 1); // 使用同一个 内部序号 |
| | | queueMapper.updateById(queueItem); |
| | | } |
| | | } |
| | | QueueDO preemptQueueItem = queueMapper.getQueueItemBySeqNum(curSeqNum.get() + 1); |
| | | updateAffinityItemsWhenPreempt( preemptQueueItem ); |
| | | |
| | | curSeqNum.getAndIncrement(); |
| | | |
| | |
| | | log.info(" opening " + openingFlag.get() + " " + monitorInfoVO.getQueueNum() + " " + monitorInfoVO.getActiveQueueNum() + " " + monitorInfoVO.getCheckTypeBedInfo().toString() ); |
| | | } |
| | | |
| | | private void updateAffinityItemsWhenPreempt(QueueDO preemptQueueItem) { |
| | | CheckTypeDO checkTypeDO = getCheckTypeItem( preemptQueueItem.getBookCheckType() ); |
| | | if ( checkTypeDO.getAffinityCheckTypes().length > 0) { |
| | | List<QueueDO> affinityItems = queueMapper.getCurPatGivenCheckTypesAndStatus(preemptQueueItem.getPatId(), |
| | | checkTypeDO.getAffinityCheckTypes(), QueueStatusEnum.WAITING.getStatus()); |
| | | for (int i = 0; i < affinityItems.size(); i++) { |
| | | QueueDO queueItem = affinityItems.get(i); |
| | | queueItem.setStatus(QueueStatusEnum.AFFINITY_WAITING.getStatus()); //改变 排队状态 |
| | | queueItem.setRoomId(preemptQueueItem.getRoomId()); |
| | | queueItem.setRoomName(preemptQueueItem.getRoomName()); |
| | | queueItem.setBedNo(preemptQueueItem.getBedNo()); |
| | | queueItem.setSeqNum( preemptQueueItem.getSeqNum()); // 使用同一个 内部序号 |
| | | queueMapper.updateById(queueItem); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void updateAffinityItemsWhenRecalled(QueueDO recalledQueueItem) { |
| | | CheckTypeDO checkTypeDO = getCheckTypeItem( recalledQueueItem.getBookCheckType() ); |
| | | if ( checkTypeDO.getAffinityCheckTypes().length > 0) { |
| | | List<QueueDO> affinityItems = queueMapper.getCurPatGivenCheckTypesAndStatus(recalledQueueItem.getPatId(), |
| | | checkTypeDO.getAffinityCheckTypes(), QueueStatusEnum.AFFINITY_WAITING.getStatus()); |
| | | for (int i = 0; i < affinityItems.size(); i++) { |
| | | QueueDO queueItem = affinityItems.get(i); |
| | | queueItem.setSeqNum( recalledQueueItem.getSeqNum() ); // 召回后,原内部序号更新 |
| | | queueMapper.updateById(queueItem); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Integer getBedReadyMax(Long roomId, String bedNo) { |
| | | RoomDO roomDO = roomMapper.getRoom(roomId, bedNo); |
| | | Integer[] checkTypes = roomDO.getCheckTypes(); |