| | |
| | | import cn.lihu.jh.framework.common.util.date.DateUtils; |
| | | import cn.lihu.jh.framework.common.util.date.LocalDateTimeUtils; |
| | | import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueueSaveReqVO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.checktype.CheckTypeDO; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.patient.PatDetails; |
| | | import cn.lihu.jh.module.ecg.feign.RemoteDataService; |
| | | import cn.lihu.jh.module.ecg.feign.RestApiReqBodyVo; |
| | | import cn.lihu.jh.module.ecg.feign.RestApiResult; |
| | | import cn.lihu.jh.module.ecg.feign.dto.AppointmentExternal; |
| | | import cn.lihu.jh.module.ecg.service.config.EcgConfigService; |
| | | import cn.lihu.jh.module.ecg.service.queue.QueueService; |
| | | import cn.lihu.jh.module.ecg.service.queue.QueueServiceTxFunctions; |
| | | import cn.lihu.jh.module.ecg.service.queuesequence.QueueSequenceService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.dao.DuplicateKeyException; |
| | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.lihu.jh.framework.common.pojo.CommonResult.error; |
| | |
| | | if (null == appointment) |
| | | throw exception(PATIENT_NOT_EXISTS); |
| | | |
| | | // 手动预约,直接设置预约日期为当天 |
| | | if (confirmReqVO.getIsVip() == 1) { |
| | | appointment.setBookDate( LocalDate.now() ); |
| | | } |
| | | |
| | | if ( !DateUtils.isToday(appointment.getBookDate()) ) |
| | | throw exception( APPOINTMENT_NOT_TODAY); |
| | | |
| | |
| | | queueSaveReqVO.setPatName(appointment.getPatName()); |
| | | queueSaveReqVO.setPatGender(appointment.getPatGender()); |
| | | queueSaveReqVO.setBookDate(appointment.getBookDate()); |
| | | queueSaveReqVO.setBookTimeslot(appointment.getBookTimeslot()); |
| | | queueSaveReqVO.setBookTimeslot( confirmReqVO.getBookTimeslot() ); /*appointment.getBookTimeslot()*/ |
| | | queueSaveReqVO.setBookCheckType(appointment.getBookCheckType()); |
| | | queueSaveReqVO.setBookSeqNum( newSeqNo ); |
| | | queueSaveReqVO.setIsVip( confirmReqVO.getIsVip() ); |
| | | queueSaveReqVO.setPassed((byte) 0); |
| | | queueSaveReqVO.setExpired((byte) 0); |
| | | queueSaveReqVO.setPatDetails( appointment.getPatDeptDesc() + "-" + appointment.getPatWardDesc() + "-" + appointment.getPatBedNo()); |
| | | queueSaveReqVO.setPatDetails( getPatDetails(appointment) ); |
| | | queueService.queue(queueSaveReqVO); |
| | | } catch (DuplicateKeyException duplicateKeyException) { |
| | | throw exception(APPOINTMENT_HAVE_QUEUED); |
| | |
| | | |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | private PatDetails getPatDetails(AppointmentDO appointment) { |
| | | PatDetails patDetails = new PatDetails(); |
| | | patDetails.setId( appointment.getPatId() ); |
| | | patDetails.setName( appointment.getPatName() ); |
| | | patDetails.setMobile( appointment.getPatMobile() ); |
| | | patDetails.setDeptCode( appointment.getPatDeptCode() ); |
| | | patDetails.setDeptDesc( appointment.getPatDeptDesc() ); |
| | | patDetails.setWardCode( appointment.getPatWardCode() ); |
| | | patDetails.setWardDesc( appointment.getPatWardDesc() ); |
| | | patDetails.setBedNo( appointment.getPatBedNo() ); |
| | | return patDetails; |
| | | } |
| | | } |
| | | |