use of org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent in project integration-adaptor-111 by nhsconnect.
the class ParticipantMapper method mapEncounterRelatedPerson.
public Encounter.EncounterParticipantComponent mapEncounterRelatedPerson(POCDMT000002UK01Informant12 informant, Encounter encounter) {
RelatedPerson relatedPerson = relatedPersonMapper.mapRelatedPerson(informant, encounter);
Encounter.EncounterParticipantComponent encounterParticipantComponent = new Encounter.EncounterParticipantComponent().setType(Collections.singletonList(new CodeableConcept().setText(PARTICIPANT_TYPE_CODE_MAP.get(informant.getTypeCode())))).setIndividual(resourceUtil.createReference(relatedPerson)).setIndividualTarget(relatedPerson);
if (informant.isSetRelatedEntity()) {
if (informant.getRelatedEntity().isSetEffectiveTime()) {
encounterParticipantComponent.setPeriod(periodMapper.mapPeriod(informant.getRelatedEntity().getEffectiveTime()));
}
}
return encounterParticipantComponent;
}
use of org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent in project eCRNow by drajer-health.
the class R4ResourcesData method loadPractitionersLocationAndOrganization.
public void loadPractitionersLocationAndOrganization(FhirContext context, IGenericClient client, LaunchDetails launchDetails, R4FhirData r4FhirData, Encounter encounter, Bundle bundle, Date start, Date end) {
if (encounter != null) {
// Load Practitioners
if (encounter.getParticipant() != null) {
List<Practitioner> practitionerList = new ArrayList<>();
Map<String, String> practitionerMap = new HashMap<>();
List<EncounterParticipantComponent> participants = encounter.getParticipant();
for (EncounterParticipantComponent participant : participants) {
if (participant.getIndividual() != null) {
Reference practitionerReference = participant.getIndividual();
String practitionerID = practitionerReference.getReferenceElement().getIdPart();
if (!practitionerMap.containsKey(practitionerID)) {
Practitioner practitioner = (Practitioner) fhirContextInitializer.getResouceById(launchDetails, client, context, "Practitioner", practitionerID);
if (practitioner != null) {
practitionerList.add(practitioner);
practitionerMap.put(practitionerID, practitioner.getResourceType().name());
BundleEntryComponent practitionerEntry = new BundleEntryComponent().setResource(practitioner);
bundle.addEntry(practitionerEntry);
}
}
}
}
if (!practitionerList.isEmpty()) {
r4FhirData.setPractitionersList(practitionerList);
}
}
// Load Location
if (Boolean.TRUE.equals(encounter.hasServiceProvider())) {
Reference organizationReference = encounter.getServiceProvider();
if (organizationReference.hasReferenceElement()) {
Organization organization = (Organization) fhirContextInitializer.getResouceById(launchDetails, client, context, "Organization", organizationReference.getReferenceElement().getIdPart());
if (organization != null) {
BundleEntryComponent organizationEntry = new BundleEntryComponent().setResource(organization);
bundle.addEntry(organizationEntry);
r4FhirData.setOrganization(organization);
}
}
}
if (Boolean.TRUE.equals(encounter.hasLocation())) {
List<Location> locationList = new ArrayList<>();
List<EncounterLocationComponent> enocunterLocations = encounter.getLocation();
for (EncounterLocationComponent location : enocunterLocations) {
if (location.getLocation() != null) {
Reference locationReference = location.getLocation();
Location locationResource = (Location) fhirContextInitializer.getResouceById(launchDetails, client, context, "Location", locationReference.getReferenceElement().getIdPart());
if (locationResource != null) {
locationList.add(locationResource);
BundleEntryComponent locationEntry = new BundleEntryComponent().setResource(locationResource);
bundle.addEntry(locationEntry);
}
}
}
r4FhirData.setLocationList(locationList);
}
} else {
logger.debug("Encounter is null, cannot fetch Practitioners");
}
}
use of org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent in project nia-patient-switching-standard-adaptor by NHSDigital.
the class EncounterMapper method getPerformer.
private EncounterParticipantComponent getPerformer(RCMRMT030101UK04Participant2 participant2) {
var performer = new EncounterParticipantComponent();
var coding = new Coding();
coding.setSystem(PERFORMER_SYSTEM).setCode(PERFORMER_CODE).setDisplay(PERFORMER_DISPLAY);
return performer.addType(new CodeableConcept(coding)).setIndividual(new Reference(PRACTITIONER_REFERENCE_PREFIX + participant2.getAgentRef().getId().getRoot()));
}
use of org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent in project nia-patient-switching-standard-adaptor by NHSDigital.
the class EncounterMapper method getRecorder.
private EncounterParticipantComponent getRecorder(RCMRMT030101UK04Author author) {
var recorder = new EncounterParticipantComponent();
var coding = new Coding(RECORDER_SYSTEM, RECORDER_CODE, RECORDER_DISPLAY);
return recorder.addType(new CodeableConcept(coding)).setIndividual(new Reference(PRACTITIONER_REFERENCE_PREFIX + author.getAgentRef().getId().getRoot()));
}
Aggregations