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,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() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -147,12 +150,12 @@ protected String extractLocationCode(Obs obs, Map<Location, String> 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;
}
}