private void setParentId(Patient patient, Relationship motherRelationship) { Person mother = motherRelationship.getPersonA(); if (mother != null && !mother.getNames().isEmpty()) { List<Patient> patients = allPatients.search(mother.getNames().iterator().next().getFullName(), null); if (patients != null && !patients.isEmpty()) { patient.parentId(getParentId(mother, patients)); } } }
public List<Patient> search(String name, String motechId) { return allPatients.search(emptyToNull(name), emptyToNull(motechId)); }