Search in sources :

Example 16 with PractitionerRole

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

the class PractitionerRoleMapper method mapAuthorRoles.

public List<PractitionerRole> mapAuthorRoles(POCDMT000002UK01Author[] authors) {
    List<PractitionerRole> roles = new ArrayList<>();
    stream(authors).filter(it -> it.getTypeCode().equals(AUTHOR_TYPE_CODE)).map(author -> {
        PractitionerRole role = new PractitionerRole();
        role.setIdElement(resourceUtil.newRandomUuid());
        POCDMT000002UK01AssignedAuthor assignedAuthor = author.getAssignedAuthor();
        role.setCode(asList(getCode(assignedAuthor.getCode())));
        Organization organization = organizationMapper.mapOrganization(assignedAuthor.getRepresentedOrganization());
        role.setOrganization(resourceUtil.createReference(organization));
        role.setOrganizationTarget(organization);
        Practitioner practitioner = practitionerMapper.mapPractitioner(assignedAuthor);
        role.setPractitioner(resourceUtil.createReference(practitioner));
        role.setPractitionerTarget(practitioner);
        return role;
    }).forEach(roles::add);
    return roles;
}
Also used : Optional.empty(java.util.Optional.empty) Practitioner(org.hl7.fhir.dstu3.model.Practitioner) POCDMT000002UK01AssignedAuthor(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedAuthor) CE(uk.nhs.connect.iucds.cda.ucr.CE) Coding(org.hl7.fhir.dstu3.model.Coding) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) ArrayList(java.util.ArrayList) POCDMT000002UK01Author(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Author) Organization(org.hl7.fhir.dstu3.model.Organization) List(java.util.List) Component(org.springframework.stereotype.Component) POCDMT000002UK01Component1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component1) Arrays.asList(java.util.Arrays.asList) ResourceUtil(uk.nhs.adaptors.oneoneone.cda.report.util.ResourceUtil) POCDMT000002UK01ClinicalDocument1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ClinicalDocument1) Optional(java.util.Optional) POCDMT000002UK01ResponsibleParty(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ResponsibleParty) POCDMT000002UK01AssignedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedEntity) AllArgsConstructor(lombok.AllArgsConstructor) Arrays.stream(java.util.Arrays.stream) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole) POCDMT000002UK01AssignedAuthor(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssignedAuthor) Practitioner(org.hl7.fhir.dstu3.model.Practitioner) Organization(org.hl7.fhir.dstu3.model.Organization) ArrayList(java.util.ArrayList) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole)

Example 17 with PractitionerRole

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

the class EncounterMapperTest method mapEncounterWithMultipleParticipantTypes.

@Test
public void mapEncounterWithMultipleParticipantTypes() {
    Encounter encounter = encounterMapper.mapEncounter(clinicalDocument, newArrayList(new PractitionerRole()), Optional.of(new PractitionerRole()), DISCHARGE_DETAILS.toCoding());
    verifyEncounter(encounter);
    verifyParticipants(encounter);
}
Also used : Encounter(org.hl7.fhir.dstu3.model.Encounter) POCDMT000002UK01EncompassingEncounter(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01EncompassingEncounter) POCDMT000002UK01Encounter(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole) Test(org.junit.jupiter.api.Test)

Example 18 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.hasPractitioner())
        composeReference(t, "PractitionerRole", "practitioner", element.getPractitioner(), -1);
    if (element.hasOrganization())
        composeReference(t, "PractitionerRole", "organization", element.getOrganization(), -1);
    for (int i = 0; i < element.getRole().size(); i++) composeCodeableConcept(t, "PractitionerRole", "role", element.getRole().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);
    if (element.hasPeriod())
        composePeriod(t, "PractitionerRole", "period", element.getPeriod(), -1);
    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);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 19 with PractitionerRole

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

the class RdfParser method composePractitionerRolePractitionerRoleNotAvailableComponent.

protected void composePractitionerRolePractitionerRoleNotAvailableComponent(Complex parent, String parentType, String name, PractitionerRole.PractitionerRoleNotAvailableComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "notAvailable", name, element, index);
    if (element.hasDescriptionElement())
        composeString(t, "PractitionerRole", "description", element.getDescriptionElement(), -1);
    if (element.hasDuring())
        composePeriod(t, "PractitionerRole", "during", element.getDuring(), -1);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 20 with PractitionerRole

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

the class RdfParser method composePractitionerRolePractitionerRoleAvailableTimeComponent.

protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(Complex parent, String parentType, String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "availableTime", name, element, index);
    for (int i = 0; i < element.getDaysOfWeek().size(); i++) composeEnum(t, "PractitionerRole", "daysOfWeek", element.getDaysOfWeek().get(i), i);
    if (element.hasAllDayElement())
        composeBoolean(t, "PractitionerRole", "allDay", element.getAllDayElement(), -1);
    if (element.hasAvailableStartTimeElement())
        composeTime(t, "PractitionerRole", "availableStartTime", element.getAvailableStartTimeElement(), -1);
    if (element.hasAvailableEndTimeElement())
        composeTime(t, "PractitionerRole", "availableEndTime", element.getAvailableEndTimeElement(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

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