private static Calendar setAppointmentDateTime(
      EctConsultationFormRequestForm thisForm, ConsultationRequest consult) {
    Calendar cal = Calendar.getInstance();

    Date date1 = consult.getAppointmentDate();
    Date date2 = consult.getAppointmentTime();

    if (date1 == null || date2 == null) {
      cal.set(1970, 0, 1, 1, 0, 0);
      thisForm.setAppointmentDay(String.valueOf(cal.get(Calendar.DAY_OF_MONTH)));
      thisForm.setAppointmentMonth(String.valueOf(cal.get(Calendar.MONTH) + 1));
      thisForm.setAppointmentYear(String.valueOf(cal.get(Calendar.YEAR)));
      Integer hr = cal.get(Calendar.HOUR_OF_DAY);
      hr = hr == 0 ? 12 : hr;
      hr = hr > 12 ? hr - 12 : hr;
      thisForm.setAppointmentHour(String.valueOf(hr));
      thisForm.setAppointmentMinute(String.valueOf(cal.get(Calendar.MINUTE)));
      String appointmentPm;
      if (cal.get(Calendar.HOUR_OF_DAY) > 11) {
        appointmentPm = "PM";
      } else {
        appointmentPm = "AM";
      }
      thisForm.setAppointmentPm(appointmentPm);
    } else {
      cal.setTime(date1);
      thisForm.setAppointmentDay(String.valueOf(cal.get(Calendar.DAY_OF_MONTH)));
      thisForm.setAppointmentMonth(String.valueOf(cal.get(Calendar.MONTH) + 1));
      thisForm.setAppointmentYear(String.valueOf(cal.get(Calendar.YEAR)));

      cal.setTime(date2);
      Integer hr = cal.get(Calendar.HOUR_OF_DAY);
      hr = hr == 0 ? 12 : hr;
      hr = hr > 12 ? hr - 12 : hr;
      thisForm.setAppointmentHour(String.valueOf(hr));
      thisForm.setAppointmentMinute(String.valueOf(cal.get(Calendar.MINUTE)));

      String appointmentPm;
      if (cal.get(Calendar.HOUR_OF_DAY) > 11) {
        appointmentPm = "PM";
      } else {
        appointmentPm = "AM";
      }
      thisForm.setAppointmentPm(appointmentPm);
    }
    return cal;
  }
  public static void fillFormValues(
      EctConsultationFormRequestForm thisForm, EctConsultationFormRequestUtil consultUtil) {
    thisForm.setAllergies(consultUtil.allergies);
    thisForm.setReasonForConsultation(consultUtil.reasonForConsultation);
    thisForm.setClinicalInformation(consultUtil.clinicalInformation);
    thisForm.setCurrentMedications(consultUtil.currentMedications);
    thisForm.setReferalDate(consultUtil.referalDate);
    thisForm.setSendTo(consultUtil.sendTo);
    thisForm.setService(consultUtil.service);
    thisForm.setStatus(consultUtil.status);
    thisForm.setAppointmentDay(consultUtil.appointmentDay);
    thisForm.setAppointmentMonth(consultUtil.appointmentMonth);
    thisForm.setAppointmentYear(consultUtil.appointmentYear);
    thisForm.setAppointmentHour(consultUtil.appointmentHour);
    thisForm.setAppointmentMinute(consultUtil.appointmentMinute);
    thisForm.setAppointmentPm(consultUtil.appointmentPm);
    thisForm.setConcurrentProblems(consultUtil.concurrentProblems);
    thisForm.setAppointmentNotes(consultUtil.appointmentNotes);
    thisForm.setUrgency(consultUtil.urgency);
    thisForm.setPatientWillBook(consultUtil.pwb);

    if (consultUtil.sendTo != null && !consultUtil.teamVec.contains(consultUtil.sendTo)) {
      consultUtil.teamVec.add(consultUtil.sendTo);
    }

    // ---

    thisForm.setPatientAddress(consultUtil.patientAddress);
    thisForm.setPatientDOB(consultUtil.patientDOB);
    thisForm.setPatientHealthNum(consultUtil.patientHealthNum);
    thisForm.setPatientHealthCardVersionCode(consultUtil.patientHealthCardVersionCode);
    thisForm.setPatientHealthCardType(consultUtil.patientHealthCardType);
    thisForm.setPatientFirstName(consultUtil.patientFirstName);
    thisForm.setPatientLastName(consultUtil.patientLastName);
    thisForm.setPatientPhone(consultUtil.patientPhone);
    thisForm.setPatientSex(consultUtil.patientSex);
    thisForm.setPatientWPhone(consultUtil.patientWPhone);
    thisForm.setPatientEmail(consultUtil.patientEmail);
    thisForm.setPatientAge(consultUtil.patientAge);

    thisForm.setProviderName(consultUtil.getProviderName(consultUtil.providerNo));

    thisForm.seteReferral(false);
  }