private void addNewAppointmentToPatient(PatientKioskBookingVoCollection patientKioskBookingCol, Booking_AppointmentVo booking_AppointmentVo) { if(patientKioskBookingCol == null) throw new CodingRuntimeException("Cannot add on a null collection!"); if(booking_AppointmentVo == null) return; for(int i=0; i<patientKioskBookingCol.size(); i++) { if(patientKioskBookingCol.get(i) != null && patientKioskBookingCol.get(i).getPatientIsNotNull() && patientKioskBookingCol.get(i).getPatient().getIDIsNotNull() && booking_AppointmentVo.getPatientIsNotNull() && booking_AppointmentVo.getPatient().getID_PatientIsNotNull() && patientKioskBookingCol.get(i).getPatient().getID() == booking_AppointmentVo.getPatient().getID_Patient()) { 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()); if(patientKioskBookingCol.get(i).getAppointmentsIsNotNull()) { patientKioskBookingCol.get(i).getAppointments().add(newAppointment); } else { PatientKioskAppointmentVoCollection newAppointmentCol = new PatientKioskAppointmentVoCollection(); newAppointmentCol.add(newAppointment); patientKioskBookingCol.get(i).setAppointments(newAppointmentCol); } } } }
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); } }