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);
}
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;
}
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);
}
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");
}
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");
}
Aggregations