Search in sources :

Example 11 with EncounterParticipantComponent

use of org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent in project openmrs-module-fhir2 by openmrs.

the class EncounterParticipantTranslatorImplTest method setUp.

@Before
public void setUp() {
    participantTranslator = new EncounterParticipantTranslatorImpl();
    participantTranslator.setPractitionerDao(practitionerDao);
    encounterProvider = new EncounterProvider();
    provider = new Provider();
    provider.setUuid(PROVIDER_UUID);
    encounterProvider.setProvider(provider);
    encounterParticipantComponent = new Encounter.EncounterParticipantComponent();
    Reference reference = new Reference(PROVIDER_URI);
    encounterParticipantComponent.setIndividual(reference);
    Practitioner practitioner = new Practitioner();
    practitioner.setId(PROVIDER_UUID);
}
Also used : EncounterProvider(org.openmrs.EncounterProvider) Practitioner(org.hl7.fhir.r4.model.Practitioner) Reference(org.hl7.fhir.r4.model.Reference) Encounter(org.hl7.fhir.r4.model.Encounter) EncounterProvider(org.openmrs.EncounterProvider) Provider(org.openmrs.Provider) Before(org.junit.Before)

Example 12 with EncounterParticipantComponent

use of org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent in project summary-care-record-api by NHSDigital.

the class ParticipantAgentMapper method mapAuthor1.

public static Participant.Author1 mapAuthor1(Bundle bundle, EncounterParticipantComponent encounterParticipant) {
    var author = new Participant.Author1();
    author.setTime(formatDateToHl7(encounterParticipant.getPeriod().getStartElement()));
    var practitionerRoleReference = encounterParticipant.getIndividual().getReference();
    var practitionerRole = getResourceByReference(bundle, practitionerRoleReference, PractitionerRole.class).orElseThrow(() -> new FhirValidationException(String.format("Bundle is missing PractitionerRole %s that is linked to Encounter", practitionerRoleReference)));
    if (StringUtils.isNotBlank(practitionerRole.getOrganization().getReference())) {
        setAgentDevice(bundle, practitionerRole.getOrganization(), author);
    } else if (StringUtils.isNotBlank(practitionerRole.getPractitioner().getReference())) {
        setParticipantAgents(bundle, practitionerRole.getPractitioner(), author);
    }
    return author;
}
Also used : PractitionerRole(org.hl7.fhir.r4.model.PractitionerRole) FhirValidationException(uk.nhs.adaptors.scr.exceptions.FhirValidationException)

Example 13 with EncounterParticipantComponent

use of org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent in project summary-care-record-api by NHSDigital.

the class DiagnosisMapper method mapInformant.

private void mapInformant(List<Resource> resources, Encounter encounter, Node informant) {
    DateTimeType time = parseDate(xmlUtils.getValueByXPath(informant, DIAGNOSIS_PARTICIPANT_TIME_XPATH), DateTimeType.class);
    participantMapper.map(informant).stream().peek(it -> resources.add(it)).filter(it -> it instanceof PractitionerRole || it instanceof RelatedPerson).forEach(it -> encounter.addParticipant(new EncounterParticipantComponent().setPeriod(new Period().setStartElement(time)).addType(getParticipationType("INF", "informant")).setIndividual(new Reference(it))));
}
Also used : SneakyThrows(lombok.SneakyThrows) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) RequiredArgsConstructor(lombok.RequiredArgsConstructor) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Autowired(org.springframework.beans.factory.annotation.Autowired) Condition(org.hl7.fhir.r4.model.Condition) Reference(org.hl7.fhir.r4.model.Reference) ArrayList(java.util.ArrayList) RelatedPerson(org.hl7.fhir.r4.model.RelatedPerson) Encounter(org.hl7.fhir.r4.model.Encounter) Node(org.w3c.dom.Node) CodedEntryMapper(uk.nhs.adaptors.scr.mappings.from.hl7.common.CodedEntryMapper) Observation(org.hl7.fhir.r4.model.Observation) NodeList(org.w3c.dom.NodeList) Period(org.hl7.fhir.r4.model.Period) Resource(org.hl7.fhir.r4.model.Resource) FINISHED(org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED) PractitionerRole(org.hl7.fhir.r4.model.PractitionerRole) EncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent) Component(org.springframework.stereotype.Component) List(java.util.List) XmlToFhirMapper.parseDate(uk.nhs.adaptors.scr.mappings.from.hl7.XmlToFhirMapper.parseDate) Coding(org.hl7.fhir.r4.model.Coding) FhirHelper.randomUUID(uk.nhs.adaptors.scr.utils.FhirHelper.randomUUID) Optional(java.util.Optional) XmlUtils(uk.nhs.adaptors.scr.utils.XmlUtils) Annotation(org.hl7.fhir.r4.model.Annotation) CodedEntry(uk.nhs.adaptors.scr.mappings.from.hl7.common.CodedEntry) EncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) Reference(org.hl7.fhir.r4.model.Reference) Period(org.hl7.fhir.r4.model.Period) PractitionerRole(org.hl7.fhir.r4.model.PractitionerRole) RelatedPerson(org.hl7.fhir.r4.model.RelatedPerson)

Example 14 with EncounterParticipantComponent

use of org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent in project summary-care-record-api by NHSDigital.

the class FindingMapper method mapInformant.

private void mapInformant(List<Resource> resources, Encounter encounter, Node informant) {
    DateTimeType time = parseDate(xmlUtils.getValueByXPath(informant, FINDING_PARTICIPANT_TIME_XPATH), DateTimeType.class);
    participantMapper.map(informant).stream().peek(it -> resources.add(it)).filter(it -> it instanceof PractitionerRole || it instanceof RelatedPerson).map(Reference::new).forEach(it -> encounter.addParticipant(new EncounterParticipantComponent().setPeriod(new Period().setStartElement(time)).addType(getParticipationType("INF", "informant")).setIndividual(it)));
}
Also used : SneakyThrows(lombok.SneakyThrows) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Identifier(org.hl7.fhir.r4.model.Identifier) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Autowired(org.springframework.beans.factory.annotation.Autowired) Reference(org.hl7.fhir.r4.model.Reference) ArrayList(java.util.ArrayList) RelatedPerson(org.hl7.fhir.r4.model.RelatedPerson) FINAL(org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL) Encounter(org.hl7.fhir.r4.model.Encounter) ENTEREDINERROR(org.hl7.fhir.r4.model.Observation.ObservationStatus.ENTEREDINERROR) Node(org.w3c.dom.Node) CodedEntryMapper(uk.nhs.adaptors.scr.mappings.from.hl7.common.CodedEntryMapper) Meta(org.hl7.fhir.r4.model.Meta) Observation(org.hl7.fhir.r4.model.Observation) NodeList(org.w3c.dom.NodeList) Period(org.hl7.fhir.r4.model.Period) Resource(org.hl7.fhir.r4.model.Resource) FINISHED(org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED) PractitionerRole(org.hl7.fhir.r4.model.PractitionerRole) EncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent) Component(org.springframework.stereotype.Component) List(java.util.List) XmlToFhirMapper.parseDate(uk.nhs.adaptors.scr.mappings.from.hl7.XmlToFhirMapper.parseDate) Coding(org.hl7.fhir.r4.model.Coding) PerformerParticipationMode.getParticipationModeDisplay(uk.nhs.adaptors.scr.mappings.from.hl7.PerformerParticipationMode.getParticipationModeDisplay) FhirHelper.randomUUID(uk.nhs.adaptors.scr.utils.FhirHelper.randomUUID) Optional(java.util.Optional) XmlUtils(uk.nhs.adaptors.scr.utils.XmlUtils) CodedEntry(uk.nhs.adaptors.scr.mappings.from.hl7.common.CodedEntry) EncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) Period(org.hl7.fhir.r4.model.Period) PractitionerRole(org.hl7.fhir.r4.model.PractitionerRole) RelatedPerson(org.hl7.fhir.r4.model.RelatedPerson)

Example 15 with EncounterParticipantComponent

use of org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent in project integration-adaptor-111 by nhsconnect.

the class ParticipantMapper method mapEncounterParticipant.

public Encounter.EncounterParticipantComponent mapEncounterParticipant(POCDMT000002UK01Participant1 encounterParticipant) {
    Practitioner practitioner = practitionerMapper.mapPractitioner(encounterParticipant.getAssociatedEntity());
    Encounter.EncounterParticipantComponent encounterParticipantComponent = new Encounter.EncounterParticipantComponent().setType(retrieveTypeFromITK(encounterParticipant)).setIndividual(resourceUtil.createReference(practitioner)).setIndividualTarget(practitioner);
    if (encounterParticipant.isSetTime()) {
        encounterParticipantComponent.setPeriod(periodMapper.mapPeriod(encounterParticipant.getTime()));
    }
    return encounterParticipantComponent;
}
Also used : Practitioner(org.hl7.fhir.dstu3.model.Practitioner) Encounter(org.hl7.fhir.dstu3.model.Encounter)

Aggregations

EncounterParticipantComponent (org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent)11 Encounter (org.hl7.fhir.r4.model.Encounter)10 ArrayList (java.util.ArrayList)9 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)8 Coding (org.hl7.fhir.r4.model.Coding)8 Reference (org.hl7.fhir.r4.model.Reference)8 List (java.util.List)7 Observation (org.hl7.fhir.r4.model.Observation)7 Period (org.hl7.fhir.r4.model.Period)7 PractitionerRole (org.hl7.fhir.r4.model.PractitionerRole)7 Resource (org.hl7.fhir.r4.model.Resource)7 Optional (java.util.Optional)6 Component (org.springframework.stereotype.Component)6 RequiredArgsConstructor (lombok.RequiredArgsConstructor)5 SneakyThrows (lombok.SneakyThrows)5 DateTimeType (org.hl7.fhir.r4.model.DateTimeType)5 FINISHED (org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED)5 RelatedPerson (org.hl7.fhir.r4.model.RelatedPerson)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 Node (org.w3c.dom.Node)5