Skip to content
Snippets Groups Projects
Commit 7cc94546 authored by Brady James Garvin's avatar Brady James Garvin
Browse files

Added support for retrieving a patient's gender.

parent 781b660d
No related branches found
No related tags found
No related merge requests found
......@@ -52,9 +52,10 @@ public class OpenMRSConnection {
String familyName = getString(patientRecord, familyNameInPatientRecord());
String givenName = getString(patientRecord, givenNameInPatientRecord());
LocalDate birthDate = getDate(patientRecord, birthDateInPatientRecord());
char genderCode = getString(patientRecord, genderCodeInPatientRecord()).charAt(0);
Boolean deceased = getBoolean(patientRecord, deceasedFlagInPatientRecord());
String location = getString(visits, patientLocationInVisitDocument(uuid));
return new PatientRecord(uuid, familyName, givenName, birthDate, deceased, location);
return new PatientRecord(uuid, familyName, givenName, birthDate, genderCode, deceased, location);
}
public Set<ObservationRecord> getObservationRecords(String patientUUID) throws IOException {
......
......@@ -88,6 +88,10 @@ public class OpenMRSXPath {
return path(RELATIVE, STRING.labeled("birthdate"));
}
public static String genderCodeInPatientRecord() {
return path(RELATIVE, STRING.labeled("gender"));
}
public static String deceasedFlagInPatientRecord() {
return path(RELATIVE, BOOLEAN.labeled("dead"));
}
......
......@@ -7,15 +7,17 @@ public class PatientRecord {
protected String familyName;
protected String givenName;
protected LocalDate birthDate;
protected char genderCode;
protected Boolean deceased;
protected String location;
public PatientRecord(String uuid, String familyName, String givenName, LocalDate birthDate, Boolean deceased,
String location) {
public PatientRecord(String uuid, String familyName, String givenName, LocalDate birthDate, char genderCode,
Boolean deceased, String location) {
this.uuid = uuid;
this.familyName = familyName;
this.givenName = givenName;
this.birthDate = birthDate;
this.genderCode = genderCode;
this.deceased = deceased;
this.location = location;
}
......@@ -36,6 +38,10 @@ public class PatientRecord {
return birthDate;
}
public char getGenderCode() {
return genderCode;
}
public Boolean getDeceased() {
return deceased;
}
......
......@@ -21,6 +21,7 @@ public class AllPatientDataSystemTest {
System.out.println(" Family Name: " + patientRecord.getFamilyName());
System.out.println(" Given Name: " + patientRecord.getGivenName());
System.out.println(" Birth Date: " + patientRecord.getBirthDate());
System.out.println(" Gender: " + patientRecord.getGenderCode());
System.out.println(" Deceased: " + patientRecord.getDeceased());
System.out.println(" Location: " + patientRecord.getLocation());
for (ObservationRecord observationRecord : connection.getObservationRecords(patientRecord.getUUID())) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment