| | |
| | | package cn.lihu.jh.module.ecg.service.queue; |
| | | |
| | | import cn.lihu.jh.framework.common.exception.ErrorCode; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.queue.BedQueueStatisticDO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueStatisticDO; |
| | | import java.util.*; |
| | | import java.util.concurrent.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import javax.annotation.Resource; |
| | | |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO; |
| | | 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.ErrorCodeConstants; |
| | | import cn.lihu.jh.module.ecg.enums.QueueStatusEnum; |
| | | import cn.lihu.jh.module.infra.api.config.ConfigApi; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | 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.infra.api.config.ConfigApi; |
| | | 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 javax.annotation.Resource; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | import static cn.lihu.jh.framework.common.exception.enums.GlobalErrorCodeConstants.SUCCESS; |
| | | import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.lihu.jh.module.ecg.Constants.ECG_OPENING_TIME_KEY; |
| | | import static cn.lihu.jh.module.ecg.Constants.ECG_QUEUE_READY_MAX_KEY; |
| | | 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.*; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @Override |
| | | public CommonResult<RoomRespVO> getRoom(Long roomId, String bedNo, Long docId) { |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | if (null == bedQueueBO) { |
| | | return error(QUEUE_BED_ABNORMAL); |
| | | } |
| | | |
| | | RoomDO roomDO = roomMapper.getRoom(roomId, bedNo, docId); |
| | | if (null == roomDO) { |
| | | return error(ECG_INNER_ERROR); |
| | | } |
| | | |
| | | RoomRespVO roomRespVO = BeanUtils.toBean(roomDO, RoomRespVO.class); |
| | | return success(roomRespVO); |
| | | } |
| | | |
| | | @Override |
| | | public ErrorCode bedDoctorPause(Long roomId, String bedNo, Long docId, String docName) { |
| | | BedQueueBO bedQueueBO = mapBedVsQueue.get(String.format("%09d%s", roomId, bedNo)); |
| | | if (null == bedQueueBO) |
| | |
| | | |
| | | // DB update |
| | | List statusList = new ArrayList<BedStatusEnum>(); |
| | | statusList.add(BedStatusEnum.DOCTOR_ON); |
| | | statusList.add(BedStatusEnum.PAUSE); |
| | | Integer updateNum = roomMapper.setBedDoctorPause(roomId, bedNo, docId, docName, |
| | | BedStatusEnum.PAUSE, statusList); |
| | | BedStatusEnum.DOCTOR_ON, statusList); |
| | | if ( null==updateNum || 0 == updateNum ) |
| | | return ROOM_INVALID_STATUS; |
| | | |