| | |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import javax.annotation.Resource; |
| | | |
| | | import cn.lihu.jh.module.ecg.controller.admin.room.vo.MonitorInfoVO; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import cn.lihu.jh.framework.common.exception.enums.GlobalErrorCodeConstants; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO; |
| | | import cn.lihu.jh.framework.common.exception.ErrorCode; |
| | | import cn.lihu.jh.framework.common.pojo.CommonResult; |
| | | import cn.lihu.jh.module.ecg.controller.admin.room.vo.RoomRespVO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.queue.BedQueueStatisticDO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueStatisticDO; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.room.RoomMapper; |
| | | import cn.lihu.jh.module.ecg.enums.BedStatusEnum; |
| | | import cn.lihu.jh.module.ecg.enums.QueueStatusEnum; |
| | | import cn.lihu.jh.module.ecg.controller.admin.queue.vo.*; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO; |
| | | import cn.lihu.jh.framework.common.pojo.PageResult; |
| | | import cn.lihu.jh.framework.common.util.object.BeanUtils; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.queue.queueMapper; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.queue.QueueMapper; |
| | | import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*; |
| | | import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.lihu.jh.framework.common.pojo.CommonResult.error; |
| | |
| | | private OAuth2TokenApi oAuth2TokenApi; |
| | | |
| | | @Resource |
| | | private queueMapper queueMapper; |
| | | private QueueMapper queueMapper; |
| | | |
| | | @Resource |
| | | private RoomMapper roomMapper; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void startHurryUp() { |
| | | public void startHurryUpOneBed(Long roomId, String bedNo) { |
| | | singleThreadExecutor.execute( () -> { |
| | | queueServiceTxFunctions.hurryup(); |
| | | queueServiceTxFunctions.hurryupOneBed(roomId, bedNo); |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void startHurryUpOneCheckType(Integer checkType) { |
| | | singleThreadExecutor.execute( () -> { |
| | | queueServiceTxFunctions.hurryupOneCheckType( checkType ); |
| | | }); |
| | | } |
| | | |
| | |
| | | public void startBedReload() { |
| | | singleThreadExecutor.execute( () -> { |
| | | queueServiceTxFunctions.bedReload(); |
| | | queueServiceTxFunctions.hurryup(); |
| | | queueServiceTxFunctions.hurryupAllBed(); |
| | | queueServiceTxFunctions.monitorInfo(); |
| | | }); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public CommonResult<RoomRespVO> getRoom(Long roomId, String bedNo, Long docId) { |
| | | RoomDO roomDO = roomMapper.getRoom(roomId, bedNo, docId); |
| | | RoomDO roomDO = roomMapper.getRoomByRoomBedDoc(roomId, bedNo, docId); |
| | | if (null == roomDO) { |
| | | return error(ROOM_NOT_SIT); |
| | | } |
| | |
| | | devRent.setState( DevRentStateEnum.FREE.getState() ); |
| | | devRentMapper.insert(devRent); |
| | | |
| | | startHurryUp(); |
| | | startHurryUpOneCheckType( queue.getBookCheckType() ); |
| | | } |
| | | |
| | | // 常规检查 叫号 |
| | | @Override |
| | | public void finishNextPatient(Long roomId, String bedNo) { |
| | | // 从 DB 把 就诊中的人 设置为就诊完成 |
| | | Integer ret = queueMapper.updateQueueStatus(roomId, bedNo, |
| | | QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.FINISH.getStatus()); |
| | | |
| | | startNextPatient(roomId, bedNo); |
| | | } |
| | | |
| | | // 领用 叫号 |
| | | @Override |
| | | public void finishReceiveNextPatient(Long roomId, String bedNo) { |
| | | // 从 DB 把 就诊中的人 设置为就诊完成 |
| | | Integer ret = queueMapper.updateQueueStatus(roomId, bedNo, |
| | | QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.RECEIVED.getStatus()); |
| | | |
| | | startNextPatient(roomId, bedNo); |
| | | } |
| | | |
| | | // 装机 叫号 |
| | | @Override |
| | | public void finishInstallNextPatient(Long roomId, String bedNo) { |
| | | // 从 DB 把 就诊中的人 设置为就诊完成 |
| | | Integer ret = queueMapper.updateQueueStatus(roomId, bedNo, |
| | | QueueStatusEnum.ONSTAGE.getStatus(), QueueStatusEnum.FINISH.getStatus()); |
| | |
| | | return patientStatisticVO; |
| | | } |
| | | |
| | | @Override |
| | | public void setQueueReadyMax(Integer max) { |
| | | queueServiceTxFunctions.setQueueReadyMax( max ); |
| | | public void initCheckType() { |
| | | queueServiceTxFunctions.initCheckType( ); |
| | | } |
| | | |
| | | public void startBiz() { |
| | |
| | | public Integer recallPatient(Long roomId, String bedNo, String patId) { |
| | | Integer updateNum = queueMapper.recallPassedPatient(roomId, bedNo, patId, |
| | | QueueStatusEnum.PASSED.getStatus(), QueueStatusEnum.RECALLED.getStatus()); |
| | | startHurryUp(); |
| | | startHurryUpOneBed(roomId, bedNo); |
| | | return updateNum; |
| | | } |
| | | |
| | | @Override |
| | | public Integer patientJump(String patId, Byte jumped) { |
| | | Integer updateNum = queueMapper.queueJump(patId, QueueStatusEnum.WAITING.getStatus(), jumped); |
| | | startHurryUp(); |
| | | |
| | | QueueDO queueDO = queueMapper.getQueueByPatId(patId); |
| | | startHurryUpOneCheckType(Integer.valueOf(queueDO.getBookCheckType())); |
| | | return updateNum; |
| | | } |
| | | |