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 { ...@@ -52,9 +52,10 @@ public class OpenMRSConnection {
String familyName = getString(patientRecord, familyNameInPatientRecord()); String familyName = getString(patientRecord, familyNameInPatientRecord());
String givenName = getString(patientRecord, givenNameInPatientRecord()); String givenName = getString(patientRecord, givenNameInPatientRecord());
LocalDate birthDate = getDate(patientRecord, birthDateInPatientRecord()); LocalDate birthDate = getDate(patientRecord, birthDateInPatientRecord());
char genderCode = getString(patientRecord, genderCodeInPatientRecord()).charAt(0);
Boolean deceased = getBoolean(patientRecord, deceasedFlagInPatientRecord()); Boolean deceased = getBoolean(patientRecord, deceasedFlagInPatientRecord());
String location = getString(visits, patientLocationInVisitDocument(uuid)); 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 { public Set<ObservationRecord> getObservationRecords(String patientUUID) throws IOException {
......
...@@ -88,6 +88,10 @@ public class OpenMRSXPath { ...@@ -88,6 +88,10 @@ public class OpenMRSXPath {
return path(RELATIVE, STRING.labeled("birthdate")); return path(RELATIVE, STRING.labeled("birthdate"));
} }
public static String genderCodeInPatientRecord() {
return path(RELATIVE, STRING.labeled("gender"));
}
public static String deceasedFlagInPatientRecord() { public static String deceasedFlagInPatientRecord() {
return path(RELATIVE, BOOLEAN.labeled("dead")); return path(RELATIVE, BOOLEAN.labeled("dead"));
} }
......
...@@ -7,15 +7,17 @@ public class PatientRecord { ...@@ -7,15 +7,17 @@ public class PatientRecord {
protected String familyName; protected String familyName;
protected String givenName; protected String givenName;
protected LocalDate birthDate; protected LocalDate birthDate;
protected char genderCode;
protected Boolean deceased; protected Boolean deceased;
protected String location; protected String location;
public PatientRecord(String uuid, String familyName, String givenName, LocalDate birthDate, Boolean deceased, public PatientRecord(String uuid, String familyName, String givenName, LocalDate birthDate, char genderCode,
String location) { Boolean deceased, String location) {
this.uuid = uuid; this.uuid = uuid;
this.familyName = familyName; this.familyName = familyName;
this.givenName = givenName; this.givenName = givenName;
this.birthDate = birthDate; this.birthDate = birthDate;
this.genderCode = genderCode;
this.deceased = deceased; this.deceased = deceased;
this.location = location; this.location = location;
} }
...@@ -36,6 +38,10 @@ public class PatientRecord { ...@@ -36,6 +38,10 @@ public class PatientRecord {
return birthDate; return birthDate;
} }
public char getGenderCode() {
return genderCode;
}
public Boolean getDeceased() { public Boolean getDeceased() {
return deceased; return deceased;
} }
......
...@@ -21,6 +21,7 @@ public class AllPatientDataSystemTest { ...@@ -21,6 +21,7 @@ public class AllPatientDataSystemTest {
System.out.println(" Family Name: " + patientRecord.getFamilyName()); System.out.println(" Family Name: " + patientRecord.getFamilyName());
System.out.println(" Given Name: " + patientRecord.getGivenName()); System.out.println(" Given Name: " + patientRecord.getGivenName());
System.out.println(" Birth Date: " + patientRecord.getBirthDate()); System.out.println(" Birth Date: " + patientRecord.getBirthDate());
System.out.println(" Gender: " + patientRecord.getGenderCode());
System.out.println(" Deceased: " + patientRecord.getDeceased()); System.out.println(" Deceased: " + patientRecord.getDeceased());
System.out.println(" Location: " + patientRecord.getLocation()); System.out.println(" Location: " + patientRecord.getLocation());
for (ObservationRecord observationRecord : connection.getObservationRecords(patientRecord.getUUID())) { 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