Esempio n. 1
0
  private boolean equals(Identifier a, Identifier b) {
    if ((NullChecker.isNullish(a.getId()))
        || (a.getOrganizationId() == null)
        || (NullChecker.isNullish(b.getId()))
        || (b.getOrganizationId() == null)) {
      return false;
    }

    return a.getId().contentEquals(b.getId())
        && a.getOrganizationId().contentEquals(b.getOrganizationId());
  }
Esempio n. 2
0
  public void Delete(Patient patient, String homeCommunityId) {
    log.info(
        "Attemping to Delete identifiers for community: "
            + homeCommunityId
            + " for patient: "
            + patient.getName().getFirstName()
            + " "
            + patient.getName().getLastName());
    Patients existingPatients = Search(patient, true, true);
    int patIdx = 0;
    int idIdx = 0;

    if (existingPatients.size() > 1) {
      log.info("ERROR: Multiple instances of the patient were found");
    } else if (existingPatients.size() == 1) {
      log.info("Found 1 entry in MPI for the patient");
      for (Patient tmpPatient : getPatients()) {
        if (existingPatients.get(0) == tmpPatient) {
          log.info("Found a match in index " + patIdx);

          for (Identifier id : getPatients().get(patIdx).getIdentifiers()) {
            if (homeCommunityId.contentEquals(id.getOrganizationId())) {
              log.info("Found a match for identifiers in index" + idIdx);
              Identifier result = getPatients().get(patIdx).getIdentifiers().remove(idIdx);
              break;
            }
            idIdx++;
          }
          break;
        }
        patIdx++;
      }
    } else {
      // System.out.println("ERROR: Patient not found in MPI");
      log.info("ERROR: Patient not found in MPI");
    }

    SaveData();
  }