| | |
| | | private RoomService roomService; |
| | | |
| | | @Resource |
| | | private RemoteDataService remoteDataService; |
| | | |
| | | @Resource |
| | | private DevRentService devRentService; |
| | | |
| | | @Resource |
| | |
| | | BeanUtils.toBean(list, AppointmentRespVO.class)); |
| | | } |
| | | |
| | | // TODO 对接数据平台 |
| | | private void getRemoteAppointment(AppointmentConfirmReqVO confirmReqVO) { |
| | | RestApiReqBodyVo reqBodyVo = new RestApiReqBodyVo(); |
| | | reqBodyVo.setSfzh(confirmReqVO.getPatId()); |
| | | reqBodyVo.setMzzyh("A34343"); |
| | | |
| | | // QueryRisReportList queryEcgRequest |
| | | RestApiResult<Object> result = remoteDataService.httpApi("queryEcgRequest", "ECG", "ECG", reqBodyVo); |
| | | |
| | | List<AppointmentExternal> list = |
| | | result.getRow().stream().map( |
| | | rawItem -> { |
| | | //AppointmentExternal appointmentExternal = JSONObject.parseObject(JSONObject.toJSONString(rawItem), AppointmentExternal.class); |
| | | AppointmentExternal appointmentExternal = BeanUtil.toBeanIgnoreCase( rawItem, AppointmentExternal.class, true); |
| | | |
| | | return appointmentExternal; |
| | | } |
| | | ).collect(Collectors.toList()); |
| | | |
| | | AppointmentExternal appointmentExternal = list.get(0); |
| | | |
| | | QueueSaveReqVO queueSaveReqVO = new QueueSaveReqVO(); |
| | | |
| | | queueSaveReqVO.setPatId( appointmentExternal.getPatientID() ); |
| | | queueSaveReqVO.setPatName( appointmentExternal.getPatName() ); |
| | | queueSaveReqVO.setPatGender( Byte.valueOf(appointmentExternal.getPatgender()) ); |
| | | |
| | | |
| | | DateTimeFormatter ISO_LOCAL_DATE_TIME2 = new DateTimeFormatterBuilder() |
| | | .parseCaseInsensitive() |
| | | .append(ISO_LOCAL_DATE) |
| | | .appendLiteral(' ') |
| | | .append(ISO_LOCAL_TIME) |
| | | .toFormatter(); |
| | | LocalDateTime bookStartTime = LocalDateTime.parse(appointmentExternal.getReqExtBooktime(), ISO_LOCAL_DATE_TIME2); |
| | | LocalDateTime bookEndTime = bookStartTime.plusMinutes(30); |
| | | queueSaveReqVO.setBookTimeslot( |
| | | (bookStartTime.getHour()*100 + bookStartTime.getMinute())*10000 |
| | | + bookEndTime.getHour()*100 + bookEndTime.getMinute() ); |
| | | |
| | | //queueSaveReqVO.setBookCheckType( Byte.valueOf(appointmentExternal.getPlanDefItemList().getPlanDefItem().getPlanDefItemcode()) ); |
| | | queueSaveReqVO.setBookCheckType( 10 ); |
| | | |
| | | queueSaveReqVO.setSeqNum(1); |
| | | queueSaveReqVO.setStatus(QueueStatusEnum.WAITING.getStatus()); |
| | | queueSaveReqVO.setPassed((byte)0); |
| | | queueSaveReqVO.setExpired((byte)0); |
| | | |
| | | queueSaveReqVO.setRoomName("-"); |
| | | queueSaveReqVO.setBedNo("-"); |
| | | |
| | | queueService.createqueue(queueSaveReqVO); |
| | | } |
| | | |
| | | @PostMapping("/confirm") |
| | | @Operation(summary = "预约确认") |
| | | @PreAuthorize("@ss.hasPermission('ecg:appointment:confirm')") |
| | | public CommonResult<String> appointmentConfirm(@RequestBody AppointmentConfirmReqVO confirmReqVO) { |
| | | //TODO 先从预约表取数据,后续对接数据平台查预约数据 |
| | | AppointmentDO appointment = appointmentService.getAppointment(confirmReqVO.getId()); |
| | | if (null == appointment) |
| | | return error(PATIENT_NOT_EXISTS); |
| | | |
| | | if ( !DateUtils.isToday(appointment.getBookDate()) ) |
| | | return error( APPOINTMENT_NOT_TODAY); |
| | | |
| | | try { |
| | | QueueSaveReqVO queueSaveReqVO = new QueueSaveReqVO(); |
| | | queueSaveReqVO.setPatId(appointment.getPatId()); |
| | | queueSaveReqVO.setPatName(appointment.getPatName()); |
| | | queueSaveReqVO.setPatGender(appointment.getPatGender()); |
| | | queueSaveReqVO.setBookDate(appointment.getBookDate()); |
| | | queueSaveReqVO.setBookTimeslot(appointment.getBookTimeslot()); |
| | | queueSaveReqVO.setBookCheckType(appointment.getBookCheckType()); |
| | | queueSaveReqVO.setPassed((byte) 0); |
| | | queueSaveReqVO.setExpired((byte) 0); |
| | | queueSaveReqVO.setPatDetails( appointment.getPatDeptDesc() + "-" + appointment.getPatWardDesc() + "-" + appointment.getPatBedNo()); |
| | | queueService.queue(queueSaveReqVO); |
| | | } catch (DuplicateKeyException duplicateKeyException) { |
| | | return success("您已经在排队中了"); |
| | | } |
| | | |
| | | return success("操作成功"); |
| | | appointmentService.appoitmentConfirm( confirmReqVO ); |
| | | return success("确认成功"); |
| | | } |
| | | |
| | | } |