diff --git a/rest_connector/src/main/java/edu/unl/cse/soft160/rest_connector/connector/OpenMRSConnection.java b/rest_connector/src/main/java/edu/unl/cse/soft160/rest_connector/connector/OpenMRSConnection.java index e8ba7163cc47115a28846dd00b65f46dbabedb2f..dfa3b0d05e1542485fa87a20722822185005371f 100644 --- a/rest_connector/src/main/java/edu/unl/cse/soft160/rest_connector/connector/OpenMRSConnection.java +++ b/rest_connector/src/main/java/edu/unl/cse/soft160/rest_connector/connector/OpenMRSConnection.java @@ -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 { diff --git a/rest_connector/src/main/java/edu/unl/cse/soft160/rest_connector/connector/OpenMRSXPath.java b/rest_connector/src/main/java/edu/unl/cse/soft160/rest_connector/connector/OpenMRSXPath.java index 8269d9179911a3340929d95223c8f9a39e85ed1d..a64b02c5c844da1631b04d26d9d212afc3d7297a 100644 --- a/rest_connector/src/main/java/edu/unl/cse/soft160/rest_connector/connector/OpenMRSXPath.java +++ b/rest_connector/src/main/java/edu/unl/cse/soft160/rest_connector/connector/OpenMRSXPath.java @@ -87,6 +87,10 @@ public class OpenMRSXPath { public static String birthDateInPatientRecord() { 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")); diff --git a/rest_connector/src/main/java/edu/unl/cse/soft160/rest_connector/connector/PatientRecord.java b/rest_connector/src/main/java/edu/unl/cse/soft160/rest_connector/connector/PatientRecord.java index 28315ed715d7c402b285f00767bc195e334032c2..238c0f7906a8ec62a29a7e6ca4f757902edd39f1 100644 --- a/rest_connector/src/main/java/edu/unl/cse/soft160/rest_connector/connector/PatientRecord.java +++ b/rest_connector/src/main/java/edu/unl/cse/soft160/rest_connector/connector/PatientRecord.java @@ -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; } @@ -35,6 +37,10 @@ public class PatientRecord { public LocalDate getBirthDate() { return birthDate; } + + public char getGenderCode() { + return genderCode; + } public Boolean getDeceased() { return deceased; diff --git a/rest_connector/src/test/java/edu/unl/cse/soft160/rest_connector/AllPatientDataSystemTest.java b/rest_connector/src/test/java/edu/unl/cse/soft160/rest_connector/AllPatientDataSystemTest.java index eb15162c2fe47170616867d649b4c5d1f3f2d9ec..4d3fcb5ca5b83e2a7015686229ffa9a0c4c29eb5 100644 --- a/rest_connector/src/test/java/edu/unl/cse/soft160/rest_connector/AllPatientDataSystemTest.java +++ b/rest_connector/src/test/java/edu/unl/cse/soft160/rest_connector/AllPatientDataSystemTest.java @@ -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())) {