public EncounterListItem(Encounter encounter) {

    if (encounter != null) {
      encounterId = encounter.getEncounterId();
      encounterDateTime = encounter.getEncounterDatetime();
      encounterDateString = Format.format(encounter.getEncounterDatetime());
      PersonName pn = encounter.getPatient().getPersonName();
      if (pn != null) {
        personName = "";
        if (pn.getGivenName() != null) {
          personName += pn.getGivenName();
        }
        if (pn.getMiddleName() != null) {
          personName += " " + pn.getMiddleName();
        }
        if (pn.getFamilyName() != null) {
          personName += " " + pn.getFamilyName();
        }
      }
      if (encounter.getProvider() != null) {
        providerName = encounter.getProvider().getPersonName().getFullName();
      }
      if (encounter.getLocation() != null) {
        location = encounter.getLocation().getName();
      }
      if (encounter.getEncounterType() != null) {
        encounterType = encounter.getEncounterType().getName();
      }
      if (encounter.getForm() != null) {
        formName = encounter.getForm().getName();
        formId = encounter.getForm().getFormId();
      }
      voided = encounter.isVoided();
      if (encounter.getCreator() != null) {
        PersonName entererPersonName = encounter.getCreator().getPersonName();
        if (entererPersonName != null) {
          entererName = "";
          if (entererPersonName.getGivenName() != null) {
            entererName += entererPersonName.getGivenName();
          }
          if (entererPersonName.getMiddleName() != null) {
            entererName += " " + entererPersonName.getMiddleName();
          }
          if (entererPersonName.getFamilyName() != null) {
            entererName += " " + entererPersonName.getFamilyName();
          }
        }
      }
    }
  }
 public void printEncounterCreated() {
   if (encounterCreated == null) {
     System.out.println("No encounter created");
   } else {
     System.out.println("=== Encounter created ===");
     System.out.println(
         "Created: "
             + encounterCreated.getDateCreated()
             + "  Edited: "
             + encounterCreated.getDateChanged());
     System.out.println("Date: " + encounterCreated.getEncounterDatetime());
     System.out.println("Location: " + encounterCreated.getLocation().getName());
     System.out.println("Provider: " + encounterCreated.getProvider().getPersonName());
     System.out.println("    (obs)");
     Collection<Obs> obs = encounterCreated.getAllObs(false);
     if (obs == null) {
       System.out.println("None");
     } else {
       for (Obs o : obs) {
         System.out.println(
             o.getConcept().getName() + " -> " + o.getValueAsString(Context.getLocale()));
       }
     }
   }
 }