Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public final class LabIntegrationReportsConstants {

public static final String LOCATION_ISANTE_CODE_UUID = "0e52924e-4ebb-40ba-9b83-b198b532653b";

public static final String ST_CODE_IDENTIFIER_TYPE_UUID = "d059f6d0-9e42-4760-8de1-8316b48bc5f1";

public static final String ISANTEPLUS_IDENDTIFIER_TYPE_UUID = "05a29f94-c0ed-11e2-94be-8c13b969e334";

private LabIntegrationReportsConstants() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.Map;

import static org.openmrs.module.labintegration.api.LabIntegrationReportsConstants.LOCATION_ISANTE_CODE_UUID;
import static org.openmrs.module.labintegration.api.LabIntegrationReportsConstants.ST_CODE_IDENTIFIER_TYPE_UUID;
import static org.openmrs.module.labintegration.api.LabIntegrationReportsConstants.ISANTEPLUS_IDENDTIFIER_TYPE_UUID;

@Handler(supports = LabResultDataSetDefinition.class)
Expand All @@ -39,6 +40,8 @@ public class LabResultDataSetEvaluator implements DataSetEvaluator {

private final String COLUMN_CLINIC_CODE = "Clinic Code";

private final String COLUMN_ST_CODE = "ST Code";

private final String COLUMN_ISANTEPLUS_ID = "ISantePlus ID";

private final String COLUMN_PATIENT_NAME = "Patient Name";
Expand Down Expand Up @@ -71,6 +74,7 @@ public DataSet evaluate(DataSetDefinition dataSetDefinition, EvaluationContext e
List<DataSetColumn> columns = Arrays.asList(
new DataSetColumn(COLUMN_NUMBER, MessageUtil.translate("labintegration.results.clinic.no"), String.class),
new DataSetColumn(COLUMN_CLINIC_CODE, MessageUtil.translate("labintegration.results.clinic.code"), String.class),
new DataSetColumn(COLUMN_ST_CODE, MessageUtil.translate("labintegration.results.st.code"), String.class),
new DataSetColumn(COLUMN_ISANTEPLUS_ID, MessageUtil.translate("labintegration.results.isanteplus.id"),
String.class),
new DataSetColumn(COLUMN_PATIENT_NAME, MessageUtil.translate("labintegration.results.patient.name"),
Expand All @@ -96,6 +100,9 @@ public DataSet evaluate(DataSetDefinition dataSetDefinition, EvaluationContext e
case COLUMN_CLINIC_CODE:
value = extractLocationCode(obs, locationCodeCache);
break;
case COLUMN_ST_CODE:
value = getStCode(obs.getPersonId());
break;
case COLUMN_PATIENT_NAME:
value = obs.getPerson().getPersonName().getFullName();
break;
Expand Down Expand Up @@ -155,11 +162,18 @@ protected String getPatientIdentifier(Integer personId, String locationCode) {
PatientService patientService = Context.getPatientService();
Patient patient = patientService.getPatient(personId);
PatientIdentifierType pit = patientService.getPatientIdentifierTypeByUuid(ISANTEPLUS_IDENDTIFIER_TYPE_UUID);
patient.getPatientIdentifier(pit);
PatientIdentifier pid = patient.getPatientIdentifier(pit);
return pid != null ? pid.getIdentifier() : locationCode + '4' + personId;
}

protected String getStCode(Integer personId) {
PatientService patientService = Context.getPatientService();
Patient patient = patientService.getPatient(personId);
PatientIdentifierType pit = patientService.getPatientIdentifierTypeByUuid(ST_CODE_IDENTIFIER_TYPE_UUID);
PatientIdentifier pid = patient.getPatientIdentifier(pit);
return pid != null ? pid.getIdentifier() : "";
}

protected String getUnits(Obs obs) {
ConceptNumeric conceptNumeric = Context.getConceptService().getConceptNumeric(obs.getConcept().getId());
return conceptNumeric != null && obs.getValueNumeric() != null ? " " + conceptNumeric.getUnits() : "";
Expand Down
1 change: 1 addition & 0 deletions api/src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ labintegration.results.report.description=LNSP Report for Viral Load and EID Lab
labintegration.results.report.dataset=LNSP Results DataSet
labintegration.results.clinic.no=No.
labintegration.results.clinic.code=Clinic Code
labintegration.results.st.code=ST Code
labintegration.results.isanteplus.id=ISantePlus ID
labintegration.results.patient.name=Patient Name
labintegration.results.date.ordered=Date Ordered
Expand Down
1 change: 1 addition & 0 deletions api/src/main/resources/messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ labintegration.results.report.description=Informe LNSP para laboratorios de carg
labintegration.results.report.dataset=Conjunto de datos de resultados LNSP
labintegration.results.clinic.no=N.º
labintegration.results.clinic.code=Código de la clínica
labintegration.results.st.code=Código ST
labintegration.results.isanteplus.id=ID de ISantePlus
labintegration.results.patient.name=Nombre del paciente
labintegration.results.date.ordered=Fecha de solicitud
Expand Down
1 change: 1 addition & 0 deletions api/src/main/resources/messages_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ labintegration.results.report.description=Rapport LNSP pour les laboratoires de
labintegration.results.report.dataset=Jeu de données des résultats LNSP
labintegration.results.clinic.no=N°
labintegration.results.clinic.code=Code de la clinique
labintegration.results.st.code=Code ST
labintegration.results.isanteplus.id=ID ISantePlus
labintegration.results.patient.name=Nom du patient
labintegration.results.date.ordered=Date de la commande
Expand Down