private PatientKioskPatientVo populatePatientKioskFromBookingAppointment(PatientRefVo patient) { if(patient == null || patient.getID_Patient() == null) return null; DomainFactory factory = getDomainFactory(); ims.core.patient.domain.objects.Patient doPatient = (Patient) factory.getDomainObject(Patient.class, patient.getID_Patient()); PatientShort patientShort = PatientShortAssembler.create(doPatient); if(patientShort != null) { PatientKioskPatientVo newPatient = new PatientKioskPatientVo(); newPatient.setID(patientShort.getID_Patient()); newPatient.setSurname(patientShort.getNameIsNotNull() ? patientShort.getName().getSurname() : null); newPatient.setDOB(patientShort.getDob() != null ? patientShort.getDob().toDate() : null); newPatient.setDisplayName(patientShort.getNameIsNotNull() ? patientShort.getName().toString() : null); newPatient.setGender(patientShort.getSex()); newPatient.setPostCode(patientShort.getAddress() != null ? removeString(patientShort.getAddress().getPostCode(), " ") : null); return newPatient; } return null; }
private void addNewPatientKioskBooking(PatientKioskBookingVoCollection patientKioskBookingCol, Booking_AppointmentVo booking_AppointmentVo) { if(patientKioskBookingCol == null) throw new CodingRuntimeException("Cannot add on a null collection!"); if(booking_AppointmentVo == null) return; PatientKioskPatientVo newPatient = null; if(booking_AppointmentVo.getPatientIsNotNull()) { newPatient = populatePatientKioskFromBookingAppointment(booking_AppointmentVo.getPatient()); } if(newPatient != null) { PatientKioskAppointmentVoCollection newAppointmentCol = new PatientKioskAppointmentVoCollection(); PatientKioskAppointmentVo newAppointment = new PatientKioskAppointmentVo(); newAppointment.setName(booking_AppointmentVo.getSessionIsNotNull() ? booking_AppointmentVo.getSession().getName() : null); newAppointment.setDate(booking_AppointmentVo.getAppointmentDate()); newAppointment.setTime(booking_AppointmentVo.getApptStartTime()); newAppointment.setID(booking_AppointmentVo.getID_Booking_Appointment()); newAppointmentCol.add(newAppointment); PatientKioskBookingVo newPatientKiosBooking = new PatientKioskBookingVo(); newPatientKiosBooking.setPatient(newPatient); newPatientKiosBooking.setAppointments(newAppointmentCol); patientKioskBookingCol.add(newPatientKiosBooking); } }