| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import cn.lihu.jh.module.ecg.controller.admin.room.vo.MonitorInfoVO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.call.CallMapper; |
| | | import cn.lihu.jh.module.ecg.dal.mysql.devrent.DevRentMapper; |
| | | import cn.lihu.jh.module.ecg.enums.DevRentStateEnum; |
| | | import cn.lihu.jh.module.system.api.oauth2.OAuth2TokenApi; |
| | | 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; |
| | | |
| | |
| | | public class QueueServiceImpl implements QueueService { |
| | | |
| | | @Resource |
| | | private OAuth2TokenApi oAuth2TokenApi; |
| | | |
| | | @Resource |
| | | private queueMapper queueMapper; |
| | | |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private CallMapper callMapper; |
| | | |
| | | @Resource |
| | | private DevRentMapper devRentMapper; |
| | | |
| | | AtomicInteger openingFlag = new AtomicInteger(0); |
| | | AtomicInteger curSeqNum = new AtomicInteger(0); |
| | |
| | | singleThreadExecutor.execute( () -> { |
| | | bedReload(); |
| | | hurryup(); |
| | | monitorInfo(); |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void startResetRoom() { |
| | | singleThreadExecutor.execute( () -> { |
| | | resetRoom(); |
| | | bedReload(); |
| | | monitorInfo(); |
| | | }); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * !!开诊期间,不能执行这个方法,否则会有 P0 问题 |
| | | * 1. 每天开诊前 从DB同步工位的患者队列数据到 工位优先队列 |
| | | * 2. 服务运维重启时 |
| | | */ |
| | |
| | | * @param queueSaveReqVO |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public void queue(QueueSaveReqVO queueSaveReqVO) { |
| | | queueSaveReqVO.setStatus(QueueStatusEnum.WAITING.getStatus()); //排队中 |
| | | QueueDO queue = BeanUtils.toBean(queueSaveReqVO, QueueDO.class); |
| | | queueMapper.insert(queue); |
| | | |
| | | DevRentDO devRent = BeanUtils.toBean(queueSaveReqVO, DevRentDO.class); |
| | | devRent.setState( DevRentStateEnum.FREE.getState() ); |
| | | devRentMapper.insert(devRent); |
| | | |
| | | startHurryUp(); |
| | | } |
| | |
| | | + " opening " + openingFlag.get()); |
| | | } |
| | | |
| | | @Override |
| | | public RoomDO getDocRoomInfo(Long docId) { |
| | | return roomMapper.getRoomByDocId(docId); |
| | | } |
| | | |
| | | public void resetRoom() { |
| | | // 踢出在座的医生 |
| | | List<BedStatusEnum> bedStatusEnumList = new ArrayList<BedStatusEnum>(); |
| | | bedStatusEnumList.add(BedStatusEnum.DOCTOR_ON); |
| | | bedStatusEnumList.add(BedStatusEnum.PAUSE); |
| | | List<RoomDO> roomDOList = roomMapper.simpleRoomList(bedStatusEnumList); |
| | | List<Long> userIdList = roomDOList.stream().map(roomDO -> roomDO.getDocId()).toList(); |
| | | oAuth2TokenApi.tick(userIdList); |
| | | |
| | | // 关闭所有工位 |
| | | Integer ret = roomMapper.resetRoom(BedStatusEnum.CLOSED.getStatus()); |
| | | } |
| | | |
| | | } |