Skip to content

Commit

Permalink
Merge pull request #686 from lantanagroup/patient-list-fix
Browse files Browse the repository at this point in the history
Fix POI creation in bulk acquisition
  • Loading branch information
smailliwcs committed Jan 31, 2024
2 parents fbc0189 + 1191e46 commit aa5d68d
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Identifier;
import org.hl7.fhir.r4.model.Patient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -243,8 +244,13 @@ public void getResultSetFromBulkResultAndLoadPatientData(
if(entry.getResource() instanceof Patient){
Patient patient = (Patient)entry.getResource();
PatientId patientId = new PatientId();
patientId.setIdentifier(patient.getId());
patientId.setReference(patient.getIdentifier().stream().findFirst().get().getSystem() + "|" + patient.getIdentifier().stream().findFirst().get().getValue());
patientId.setReference(patient.getIdElement().toUnqualifiedVersionless().getValue());
Identifier identifier = patient.getIdentifierFirstRep();
if (identifier != null && identifier.hasValue()) {
patientId.setIdentifier(identifier.hasSystem()
? String.format("%s|%s", identifier.getSystem(), identifier.getValue())
: identifier.getValue());
}
patientList.getPatients().add(patientId);
}
});
Expand Down

0 comments on commit aa5d68d

Please sign in to comment.