Skip to content

Commit

Permalink
EPCT-16 Dead patient info details are not being displayed in Visualiz…
Browse files Browse the repository at this point in the history
…ation (#692)

* EPCT-16 Dead patient info details are not being displayed in Visualization

* Add missing attributes to patient representation

* Update openmrsPatientMapper

* Fix template URL

* Unit test.
  • Loading branch information
ynurmahomed authored and edrisse committed Jul 19, 2018
1 parent 95b3c21 commit eebdb02
Show file tree
Hide file tree
Showing 4 changed files with 663 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/common/patient/components/details/patientDeath.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
patient: '<'
},
controllerAs: 'vm',
templateUrl: '../common/patient/components/details//patientDeath.html',
templateUrl: '../common/patient/components/details/patientDeath.html',
});

})();
5 changes: 4 additions & 1 deletion app/common/patient/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ Poc.Patient.Constants.Errors = {};
'Tipo de teste HIV',
])
.constant('patientRepresentation',
'custom:(uuid,identifiers:(uuid,display,identifier,preferred,identifierType:(uuid,display,required,formatDescription)),person:(auditInfo,birthdate,birthdateEstimated,gender,preferredAddress,preferredName,attributes:(value,attributeType:(name,format))');
'custom:(uuid,dead,deathDate,causeOfDeath,identifiers:(uuid,display,identifier,preferred,' +
'identifierType:(uuid,display,required,formatDescription)),' +
'person:(auditInfo,birthdate,birthdateEstimated,gender,preferredAddress,preferredName,' +
'attributes:(value,attributeType:(name,format))');

})();
15 changes: 8 additions & 7 deletions app/common/patient/mappers/openmrsPatientMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
////////////////

function map(openmrsPatient) {
var patient = patientModel.create(),
birthdate = parseDate(openmrsPatient.person.birthdate);
const patient = patientModel.create(),
birthdate = parseDate(openmrsPatient.person.birthdate);

patient.givenName = openmrsPatient.person.preferredName.givenName;
patient.middleName = openmrsPatient.person.preferredName.middleName;
patient.familyName = openmrsPatient.person.preferredName.familyName;
Expand All @@ -32,11 +33,11 @@
patient.age = birthdate ? age.fromBirthDate(openmrsPatient.person.birthdate) : null;
patient.gender = openmrsPatient.person.gender;
patient.address = mapAddress(openmrsPatient.person.preferredAddress);
patient.dead = openmrsPatient.person.dead,
patient.causeOfDeath = (openmrsPatient.person.dead === true) ? openmrsPatient.person.causeOfDeath : null,
patient.deathDate = (openmrsPatient.person.dead === true) ? openmrsPatient.person.deathDate : null,
//TODO: must get the identifier to display from openmrs configurations
patient.identifier = openmrsPatient.identifiers[0].identifier;
patient.dead = openmrsPatient.dead;
patient.causeOfDeath = (openmrsPatient.dead === true) ? openmrsPatient.causeOfDeath : null;
patient.deathDate = (openmrsPatient.dead === true) ? openmrsPatient.deathDate : null;
//TODO: must get the identifier to display from openmrs configurations
patient.identifier = openmrsPatient.identifiers[0].identifier;
patient.identifierType = openmrsPatient.identifiers[0].identifierType.display;
patient.image = Poc.Patient.Constants.patientImageURL + openmrsPatient.uuid + ".jpeg?q=" + new Date().toISOString();
patient.registrationDate = parseDate(openmrsPatient.person.auditInfo.dateCreated);
Expand Down
Loading

0 comments on commit eebdb02

Please sign in to comment.