Search in sources :

Example 51 with PractitionerRole

use of org.hl7.fhir.r4.model.PractitionerRole in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composePractitionerRole.

protected void composePractitionerRole(Complex parent, String parentType, String name, PractitionerRole element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "PractitionerRole", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "PractitionerRole", "identifier", element.getIdentifier().get(i), i);
    if (element.hasActiveElement())
        composeBoolean(t, "PractitionerRole", "active", element.getActiveElement(), -1);
    if (element.hasPeriod())
        composePeriod(t, "PractitionerRole", "period", element.getPeriod(), -1);
    if (element.hasPractitioner())
        composeReference(t, "PractitionerRole", "practitioner", element.getPractitioner(), -1);
    if (element.hasOrganization())
        composeReference(t, "PractitionerRole", "organization", element.getOrganization(), -1);
    for (int i = 0; i < element.getCode().size(); i++) composeCodeableConcept(t, "PractitionerRole", "code", element.getCode().get(i), i);
    for (int i = 0; i < element.getSpecialty().size(); i++) composeCodeableConcept(t, "PractitionerRole", "specialty", element.getSpecialty().get(i), i);
    for (int i = 0; i < element.getLocation().size(); i++) composeReference(t, "PractitionerRole", "location", element.getLocation().get(i), i);
    for (int i = 0; i < element.getHealthcareService().size(); i++) composeReference(t, "PractitionerRole", "healthcareService", element.getHealthcareService().get(i), i);
    for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "PractitionerRole", "telecom", element.getTelecom().get(i), i);
    for (int i = 0; i < element.getAvailableTime().size(); i++) composePractitionerRolePractitionerRoleAvailableTimeComponent(t, "PractitionerRole", "availableTime", element.getAvailableTime().get(i), i);
    for (int i = 0; i < element.getNotAvailable().size(); i++) composePractitionerRolePractitionerRoleNotAvailableComponent(t, "PractitionerRole", "notAvailable", element.getNotAvailable().get(i), i);
    if (element.hasAvailabilityExceptionsElement())
        composeString(t, "PractitionerRole", "availabilityExceptions", element.getAvailabilityExceptionsElement(), -1);
    for (int i = 0; i < element.getEndpoint().size(); i++) composeReference(t, "PractitionerRole", "endpoint", element.getEndpoint().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 52 with PractitionerRole

use of org.hl7.fhir.r4.model.PractitionerRole in project nia-patient-switching-standard-adaptor by NHSDigital.

the class AgentDirectoryMapper method createPractitionerRole.

private PractitionerRole createPractitionerRole(String id, CV code) {
    var practitionerRole = new PractitionerRole();
    practitionerRole.setId(id + PRACT_ROLE_SUFFIX);
    practitionerRole.setMeta(generateMeta(PRACT_ROLE_META_PROFILE));
    practitionerRole.setPractitioner(new Reference(PRACT_PREFIX + id));
    practitionerRole.setOrganization(new Reference(ORG_PREFIX + id + ORG_ID_SUFFIX));
    var text = getText(code);
    if (text != null) {
        practitionerRole.getCode().add(getText(code));
    }
    return practitionerRole;
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole)

Example 53 with PractitionerRole

use of org.hl7.fhir.r4.model.PractitionerRole in project nia-patient-switching-standard-adaptor by NHSDigital.

the class AgentDirectoryMapperTest method mapAgentDirectoryWithAgentPersonAndRepresentedOrganizationNoCode.

@Test
public void mapAgentDirectoryWithAgentPersonAndRepresentedOrganizationNoCode() {
    var agentDirectory = unmarshallAgentDirectoryElement("agent_person_and_represented_org_example.xml");
    List mappedAgents = agentDirectoryMapper.mapAgentDirectory(agentDirectory);
    assertThat(mappedAgents.size()).isEqualTo(THREE_RESOURCES_MAPPED);
    var practitioner = (Practitioner) mappedAgents.get(0);
    assertThat(practitioner.getId()).isEqualTo("94F00D99-0601-4A8E-AD1D-1B564307B0A6");
    assertThat(practitioner.getMeta().getProfile().get(0).getValue()).isEqualTo(PRACT_META_PROFILE);
    assertThat(practitioner.getNameFirstRep().getUse()).isEqualTo(NameUse.OFFICIAL);
    assertThat(practitioner.getNameFirstRep().getFamily()).isEqualTo("Test");
    var organization = (Organization) mappedAgents.get(1);
    assertThat(organization.getId()).isEqualTo("94F00D99-0601-4A8E-AD1D-1B564307B0A6-ORG");
    assertThat(organization.getMeta().getProfile().get(0).getValue()).isEqualTo(ORG_META_PROFILE);
    assertThat(organization.getName()).isEqualTo("TEMPLE SOWERBY MEDICAL PRACTICE");
    assertThat(organization.getType().size()).isEqualTo(0);
    var practitionerRole = (PractitionerRole) mappedAgents.get(2);
    assertThat(practitionerRole.getId()).isEqualTo("94F00D99-0601-4A8E-AD1D-1B564307B0A6-PR");
    assertThat(practitionerRole.getMeta().getProfile().get(0).getValue()).isEqualTo(PRACT_ROLE_META_PROFILE);
    assertThat(practitionerRole.getPractitioner().getReference()).isEqualTo("Practitioner/94F00D99-0601-4A8E-AD1D-1B564307B0A6");
    assertThat(practitionerRole.getOrganization().getReference()).isEqualTo("Organization/94F00D99-0601-4A8E-AD1D-1B564307B0A6-ORG");
    assertThat(practitionerRole.getCode().size()).isEqualTo(0);
}
Also used : Practitioner(org.hl7.fhir.dstu3.model.Practitioner) Organization(org.hl7.fhir.dstu3.model.Organization) List(java.util.List) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole) Test(org.junit.jupiter.api.Test)

Example 54 with PractitionerRole

use of org.hl7.fhir.r4.model.PractitionerRole in project nia-patient-switching-standard-adaptor by NHSDigital.

the class AgentDirectoryMapperTest method mapAgentDirectoryWithAgentPersonAndRepresentedOrganizationWithDisplayName.

@Test
public void mapAgentDirectoryWithAgentPersonAndRepresentedOrganizationWithDisplayName() {
    var agentDirectory = unmarshallAgentDirectoryElement("agent_person_and_represented_org_with_display_name_example.xml");
    List mappedAgents = agentDirectoryMapper.mapAgentDirectory(agentDirectory);
    assertThat(mappedAgents.size()).isEqualTo(THREE_RESOURCES_MAPPED);
    var practitioner = (Practitioner) mappedAgents.get(0);
    assertThat(practitioner.getId()).isEqualTo("94F00D99-0601-4A8E-AD1D-1B564307B0A6");
    assertThat(practitioner.getMeta().getProfile().get(0).getValue()).isEqualTo(PRACT_META_PROFILE);
    assertThat(practitioner.getNameFirstRep().getUse()).isEqualTo(NameUse.OFFICIAL);
    assertThat(practitioner.getNameFirstRep().getFamily()).isEqualTo("Test");
    var organization = (Organization) mappedAgents.get(1);
    assertThat(organization.getId()).isEqualTo("94F00D99-0601-4A8E-AD1D-1B564307B0A6-ORG");
    assertThat(organization.getMeta().getProfile().get(0).getValue()).isEqualTo(ORG_META_PROFILE);
    assertThat(organization.getName()).isEqualTo("TEMPLE SOWERBY MEDICAL PRACTICE");
    assertThat(organization.getType().size()).isEqualTo(0);
    var practitionerRole = (PractitionerRole) mappedAgents.get(2);
    assertThat(practitionerRole.getId()).isEqualTo("94F00D99-0601-4A8E-AD1D-1B564307B0A6-PR");
    assertThat(practitionerRole.getMeta().getProfile().get(0).getValue()).isEqualTo(PRACT_ROLE_META_PROFILE);
    assertThat(practitionerRole.getPractitioner().getReference()).isEqualTo("Practitioner/94F00D99-0601-4A8E-AD1D-1B564307B0A6");
    assertThat(practitionerRole.getOrganization().getReference()).isEqualTo("Organization/94F00D99-0601-4A8E-AD1D-1B564307B0A6-ORG");
    assertThat(practitionerRole.getCodeFirstRep().getText()).isEqualTo("General practice");
}
Also used : Practitioner(org.hl7.fhir.dstu3.model.Practitioner) Organization(org.hl7.fhir.dstu3.model.Organization) List(java.util.List) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole) Test(org.junit.jupiter.api.Test)

Example 55 with PractitionerRole

use of org.hl7.fhir.r4.model.PractitionerRole in project nia-patient-switching-standard-adaptor by NHSDigital.

the class AgentDirectoryMapperTest method mapAgentDirectoryWithAgentPersonAndRepresentedOrganizationWithOriginalText.

@Test
public void mapAgentDirectoryWithAgentPersonAndRepresentedOrganizationWithOriginalText() {
    var agentDirectory = unmarshallAgentDirectoryElement("agent_person_and_represented_org_with_original_text_example.xml");
    List mappedAgents = agentDirectoryMapper.mapAgentDirectory(agentDirectory);
    assertThat(mappedAgents.size()).isEqualTo(THREE_RESOURCES_MAPPED);
    var practitioner = (Practitioner) mappedAgents.get(0);
    assertThat(practitioner.getId()).isEqualTo("94F00D99-0601-4A8E-AD1D-1B564307B0A6");
    assertThat(practitioner.getMeta().getProfile().get(0).getValue()).isEqualTo(PRACT_META_PROFILE);
    assertThat(practitioner.getNameFirstRep().getUse()).isEqualTo(NameUse.OFFICIAL);
    assertThat(practitioner.getNameFirstRep().getFamily()).isEqualTo("Test");
    var organization = (Organization) mappedAgents.get(1);
    assertThat(organization.getId()).isEqualTo("94F00D99-0601-4A8E-AD1D-1B564307B0A6-ORG");
    assertThat(organization.getMeta().getProfile().get(0).getValue()).isEqualTo(ORG_META_PROFILE);
    assertThat(organization.getName()).isEqualTo("TEMPLE SOWERBY MEDICAL PRACTICE");
    assertThat(organization.getType().size()).isEqualTo(0);
    var practitionerRole = (PractitionerRole) mappedAgents.get(2);
    assertThat(practitionerRole.getId()).isEqualTo("94F00D99-0601-4A8E-AD1D-1B564307B0A6-PR");
    assertThat(practitionerRole.getMeta().getProfile().get(0).getValue()).isEqualTo(PRACT_ROLE_META_PROFILE);
    assertThat(practitionerRole.getPractitioner().getReference()).isEqualTo("Practitioner/94F00D99-0601-4A8E-AD1D-1B564307B0A6");
    assertThat(practitionerRole.getOrganization().getReference()).isEqualTo("Organization/94F00D99-0601-4A8E-AD1D-1B564307B0A6-ORG");
    assertThat(practitionerRole.getCodeFirstRep().getText()).isEqualTo("Clerical Worker");
}
Also used : Practitioner(org.hl7.fhir.dstu3.model.Practitioner) Organization(org.hl7.fhir.dstu3.model.Organization) List(java.util.List) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole) Test(org.junit.jupiter.api.Test)

Aggregations

PractitionerRole (org.hl7.fhir.r4.model.PractitionerRole)26 Reference (org.hl7.fhir.r4.model.Reference)19 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)16 Coding (org.hl7.fhir.r4.model.Coding)15 Identifier (org.hl7.fhir.r4.model.Identifier)13 ArrayList (java.util.ArrayList)12 Practitioner (org.hl7.fhir.r4.model.Practitioner)12 Resource (org.hl7.fhir.r4.model.Resource)12 List (java.util.List)11 PractitionerRole (org.hl7.fhir.dstu3.model.PractitionerRole)11 RelatedPerson (org.hl7.fhir.r4.model.RelatedPerson)10 Optional (java.util.Optional)9 DateTimeType (org.hl7.fhir.r4.model.DateTimeType)7 EncounterParticipantComponent (org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent)7 Period (org.hl7.fhir.r4.model.Period)7 Test (org.junit.jupiter.api.Test)7 Identifiable (org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable)7 Component (org.springframework.stereotype.Component)7 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)6 RequiredArgsConstructor (lombok.RequiredArgsConstructor)5