From 996e5ad76859d715702fdde9469be969a35d1cfc Mon Sep 17 00:00:00 2001 From: mozzy11 Date: Fri, 20 Jun 2025 12:23:49 +0300 Subject: [PATCH] switch from IsantePlus ID to Isante ID --- .../api/LabIntegrationReportsConstants.java | 2 +- .../api/reports/LabResultDataSetEvaluator.java | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/org/openmrs/module/labintegration/api/LabIntegrationReportsConstants.java b/api/src/main/java/org/openmrs/module/labintegration/api/LabIntegrationReportsConstants.java index 27637b6..bd39113 100644 --- a/api/src/main/java/org/openmrs/module/labintegration/api/LabIntegrationReportsConstants.java +++ b/api/src/main/java/org/openmrs/module/labintegration/api/LabIntegrationReportsConstants.java @@ -10,7 +10,7 @@ public final class LabIntegrationReportsConstants { public static final String LOCATION_ISANTE_CODE_UUID = "0e52924e-4ebb-40ba-9b83-b198b532653b"; - public static final String ISANTEPLUS_IDENDTIFIER_TYPE_UUID = "05a29f94-c0ed-11e2-94be-8c13b969e334"; + public static final String ISANTEPLUS_IDENDTIFIER_TYPE_UUID = "0e0c7cc2-3491-4675-b705-746e372ff346"; private LabIntegrationReportsConstants() { } diff --git a/api/src/main/java/org/openmrs/module/labintegration/api/reports/LabResultDataSetEvaluator.java b/api/src/main/java/org/openmrs/module/labintegration/api/reports/LabResultDataSetEvaluator.java index ccdb62c..e4a5f02 100644 --- a/api/src/main/java/org/openmrs/module/labintegration/api/reports/LabResultDataSetEvaluator.java +++ b/api/src/main/java/org/openmrs/module/labintegration/api/reports/LabResultDataSetEvaluator.java @@ -99,7 +99,10 @@ public DataSet evaluate(DataSetDefinition dataSetDefinition, EvaluationContext e value = obs.getPerson().getPersonName().getFullName(); break; case COLUMN_ISANTEPLUS_ID: - value = getPatientIdentifier(obs.getPersonId()); + String locationCode = locationCodeCache.containsKey(obs.getEncounter().getLocation()) + ? locationCodeCache.get(obs.getEncounter().getLocation()) + : ""; + value = getPatientIdentifier(obs.getPersonId(), locationCode); break; case COLUMN_DATE_ORDERED: value = obs.getEncounter().getEncounterDatetime(); @@ -147,12 +150,12 @@ protected String extractLocationCode(Obs obs, Map locationCode return null; } - protected String getPatientIdentifier(Integer personId) { + 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() : ""; + return pid != null ? pid.getIdentifier() : locationCode + '4' + personId; } }