use of org.hisp.dhis.api.mobile.model.Beneficiary in project dhis2-core by dhis2.
the class ActivityReportingServiceImpl method getBeneficiaryModel.
private Beneficiary getBeneficiaryModel(TrackedEntityInstance patient) {
Beneficiary beneficiary = new Beneficiary();
List<org.hisp.dhis.api.mobile.model.PatientAttribute> patientAtts = new ArrayList<>();
beneficiary.setId(patient.getId());
beneficiary.setName(patient.getName());
// Set attribute which is used to group beneficiary on mobile (only if
// there is attribute which is set to be group factor)
org.hisp.dhis.api.mobile.model.PatientAttribute beneficiaryAttribute = null;
if (groupByAttribute != null) {
beneficiaryAttribute = new org.hisp.dhis.api.mobile.model.PatientAttribute();
beneficiaryAttribute.setName(groupByAttribute.getName());
TrackedEntityAttributeValue value = attValueService.getTrackedEntityAttributeValue(patient, groupByAttribute);
beneficiaryAttribute.setValue(value == null ? "Unknown" : value.getValue());
beneficiary.setGroupAttribute(beneficiaryAttribute);
}
beneficiary.setPatientAttValues(patientAtts);
return beneficiary;
}
Aggregations