Search in sources :

Example 1 with HealthcareService

use of org.hl7.fhir.dstu3.model.HealthcareService in project integration-adaptor-111 by nhsconnect.

the class ReferralRequestMapperTest method setup.

@BeforeEach
public void setup() {
    healthcareServiceList = new ArrayList<>();
    healthcareServiceList.add(healthcareService);
    encounter = new Encounter();
    String encounterId = "Encounter/1";
    encounter.setServiceProvider(serviceProviderRef).setSubject(patientRef).setId(encounterId);
    TS ts = TS.Factory.newInstance();
    ts.setValue(AUTHOR_TIME);
    POCDMT000002UK01Author[] authorArray = new POCDMT000002UK01Author[1];
    authorArray[0] = author;
    TS effectiveTime = TS.Factory.newInstance();
    effectiveTime.setValue("20220304");
    when(procedureRequestMapper.mapProcedureRequest(any(), any(), any())).thenReturn(procedureRequest);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    when(resourceUtil.createReference(encounter)).thenReturn(new Reference(encounter));
    when(resourceUtil.createReference(procedureRequest)).thenReturn(new Reference(procedureRequest));
    when(resourceUtil.createReference(practitioner)).thenReturn(new Reference(practitioner));
    when(author.getTime()).thenReturn(ts);
    when(author.getTypeCode()).thenReturn("AUT");
    when(clinicalDocument.getAuthorArray()).thenReturn(authorArray);
    when(clinicalDocument.getParticipantArray()).thenReturn(new POCDMT000002UK01Participant1[] { participantREFT, participantCALLBCK });
    when(clinicalDocument.getEffectiveTime()).thenReturn(effectiveTime);
    when(participantREFT.getTypeCode()).thenReturn(PARTICIPANT_TYPE_CODE_REFT);
    when(participantCALLBCK.getTypeCode()).thenReturn(PARTICIPANT_TYPE_CODE_CALLBCK);
    when(participantREFT.getAssociatedEntity()).thenReturn(associatedEntity);
    when(practitionerMapper.mapPractitioner(associatedEntity)).thenReturn(practitioner);
    when(periodMapper.mapPeriod(effectiveTime)).thenReturn(occurrence);
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) Encounter(org.hl7.fhir.dstu3.model.Encounter) POCDMT000002UK01Author(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Author) TS(uk.nhs.connect.iucds.cda.ucr.TS) IdType(org.hl7.fhir.dstu3.model.IdType) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with HealthcareService

use of org.hl7.fhir.dstu3.model.HealthcareService in project integration-adaptor-111 by nhsconnect.

the class ReferralRequestMapper method mapReferralRequest.

public ReferralRequest mapReferralRequest(POCDMT000002UK01ClinicalDocument1 clinicalDocument, Encounter encounter, List<HealthcareService> healthcareServiceList, Reference condition, Reference deviceReference) {
    ReferralRequest referralRequest = new ReferralRequest();
    referralRequest.setIdElement(resourceUtil.newRandomUuid());
    referralRequest.setStatus(ACTIVE).setIntent(PLAN).setPriority(ROUTINE).setSubjectTarget(encounter.getSubjectTarget()).setSubject(encounter.getSubject()).setContextTarget(encounter).setContext(resourceUtil.createReference(encounter)).setOccurrence(periodMapper.mapPeriod(clinicalDocument.getEffectiveTime())).setAuthoredOnElement(getAuthoredOn(clinicalDocument)).setRequester(new ReferralRequest.ReferralRequestRequesterComponent().setAgent(deviceReference).setOnBehalfOf(encounter.getServiceProvider())).addReasonReference(condition).addSupportingInfo(resourceUtil.createReference(procedureRequestMapper.mapProcedureRequest(clinicalDocument, encounter.getSubject(), referralRequest)));
    getRecipients(clinicalDocument).forEach(practitioner -> referralRequest.addRecipient(resourceUtil.createReference(practitioner)));
    for (HealthcareService healthcareService : healthcareServiceList) {
        referralRequest.addRecipient(resourceUtil.createReference(healthcareService));
    }
    return referralRequest;
}
Also used : ReferralRequest(org.hl7.fhir.dstu3.model.ReferralRequest) HealthcareService(org.hl7.fhir.dstu3.model.HealthcareService)

Example 3 with HealthcareService

use of org.hl7.fhir.dstu3.model.HealthcareService in project integration-adaptor-111 by nhsconnect.

the class HealthcareServiceMapperTest method shouldMapHealthcareService.

@Test
public void shouldMapHealthcareService() {
    when(informationRecipient.getIntendedRecipient()).thenReturn(intendedRecipient);
    when(intendedRecipient.isSetReceivedOrganization()).thenReturn(true);
    when(intendedRecipient.getReceivedOrganization()).thenReturn(receivedOrganization);
    when(receivedOrganization.sizeOfNameArray()).thenReturn(1);
    when(receivedOrganization.getNameArray(0)).thenReturn(name);
    when(organizationMapper.mapOrganization(informationRecipient)).thenReturn(organization);
    when(locationMapper.mapRecipientToLocation(intendedRecipient, organization)).thenReturn(location);
    when(name.getDomNode()).thenReturn(node);
    when(nodeUtil.getAllText(name.getDomNode())).thenReturn(HEALTHCARE_SERVICE_NAME);
    when(informationRecipient.getTypeCode()).thenReturn(forString(PRCP_TYPE_CODE));
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    List<HealthcareService> healthcareServiceList = healthcareServiceMapper.mapHealthcareService(clinicalDocument);
    HealthcareService healthcareService = healthcareServiceList.get(0);
    assertThat(organization).isEqualTo(healthcareService.getProvidedByTarget());
    assertThat(HEALTHCARE_SERVICE_NAME).isEqualTo(healthcareService.getName());
    assertThat(true).isEqualTo(healthcareService.getActive());
    assertThat(healthcareServiceList).isNotEmpty();
    assertThat(healthcareService.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
}
Also used : HealthcareService(org.hl7.fhir.dstu3.model.HealthcareService) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Example 4 with HealthcareService

use of org.hl7.fhir.dstu3.model.HealthcareService 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 5 with HealthcareService

use of org.hl7.fhir.dstu3.model.HealthcareService in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeHealthcareService.

protected void composeHealthcareService(Complex parent, String parentType, String name, HealthcareService element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "HealthcareService", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "HealthcareService", "identifier", element.getIdentifier().get(i), i);
    if (element.hasActiveElement())
        composeBoolean(t, "HealthcareService", "active", element.getActiveElement(), -1);
    if (element.hasProvidedBy())
        composeReference(t, "HealthcareService", "providedBy", element.getProvidedBy(), -1);
    if (element.hasCategory())
        composeCodeableConcept(t, "HealthcareService", "category", element.getCategory(), -1);
    for (int i = 0; i < element.getType().size(); i++) composeCodeableConcept(t, "HealthcareService", "type", element.getType().get(i), i);
    for (int i = 0; i < element.getSpecialty().size(); i++) composeCodeableConcept(t, "HealthcareService", "specialty", element.getSpecialty().get(i), i);
    for (int i = 0; i < element.getLocation().size(); i++) composeReference(t, "HealthcareService", "location", element.getLocation().get(i), i);
    if (element.hasNameElement())
        composeString(t, "HealthcareService", "name", element.getNameElement(), -1);
    if (element.hasCommentElement())
        composeString(t, "HealthcareService", "comment", element.getCommentElement(), -1);
    if (element.hasExtraDetailsElement())
        composeString(t, "HealthcareService", "extraDetails", element.getExtraDetailsElement(), -1);
    if (element.hasPhoto())
        composeAttachment(t, "HealthcareService", "photo", element.getPhoto(), -1);
    for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "HealthcareService", "telecom", element.getTelecom().get(i), i);
    for (int i = 0; i < element.getCoverageArea().size(); i++) composeReference(t, "HealthcareService", "coverageArea", element.getCoverageArea().get(i), i);
    for (int i = 0; i < element.getServiceProvisionCode().size(); i++) composeCodeableConcept(t, "HealthcareService", "serviceProvisionCode", element.getServiceProvisionCode().get(i), i);
    if (element.hasEligibility())
        composeCodeableConcept(t, "HealthcareService", "eligibility", element.getEligibility(), -1);
    if (element.hasEligibilityNoteElement())
        composeString(t, "HealthcareService", "eligibilityNote", element.getEligibilityNoteElement(), -1);
    for (int i = 0; i < element.getProgramName().size(); i++) composeString(t, "HealthcareService", "programName", element.getProgramName().get(i), i);
    for (int i = 0; i < element.getCharacteristic().size(); i++) composeCodeableConcept(t, "HealthcareService", "characteristic", element.getCharacteristic().get(i), i);
    for (int i = 0; i < element.getReferralMethod().size(); i++) composeCodeableConcept(t, "HealthcareService", "referralMethod", element.getReferralMethod().get(i), i);
    if (element.hasAppointmentRequiredElement())
        composeBoolean(t, "HealthcareService", "appointmentRequired", element.getAppointmentRequiredElement(), -1);
    for (int i = 0; i < element.getAvailableTime().size(); i++) composeHealthcareServiceHealthcareServiceAvailableTimeComponent(t, "HealthcareService", "availableTime", element.getAvailableTime().get(i), i);
    for (int i = 0; i < element.getNotAvailable().size(); i++) composeHealthcareServiceHealthcareServiceNotAvailableComponent(t, "HealthcareService", "notAvailable", element.getNotAvailable().get(i), i);
    if (element.hasAvailabilityExceptionsElement())
        composeString(t, "HealthcareService", "availabilityExceptions", element.getAvailabilityExceptionsElement(), -1);
    for (int i = 0; i < element.getEndpoint().size(); i++) composeReference(t, "HealthcareService", "endpoint", element.getEndpoint().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Aggregations

Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)6 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)5 HealthcareService (org.hl7.fhir.dstu3.model.HealthcareService)5 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)4 IdType (org.hl7.fhir.dstu3.model.IdType)3 Encounter (org.hl7.fhir.dstu3.model.Encounter)2 QuestionnaireResponse (org.hl7.fhir.dstu3.model.QuestionnaireResponse)2 ReferralRequest (org.hl7.fhir.dstu3.model.ReferralRequest)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 Test (org.junit.jupiter.api.Test)2 ArrayList (java.util.ArrayList)1 Bundle (org.hl7.fhir.dstu3.model.Bundle)1 CarePlan (org.hl7.fhir.dstu3.model.CarePlan)1 Composition (org.hl7.fhir.dstu3.model.Composition)1 Condition (org.hl7.fhir.dstu3.model.Condition)1 Consent (org.hl7.fhir.dstu3.model.Consent)1 Device (org.hl7.fhir.dstu3.model.Device)1 ListResource (org.hl7.fhir.dstu3.model.ListResource)1 Location (org.hl7.fhir.dstu3.model.Location)1 MessageHeader (org.hl7.fhir.dstu3.model.MessageHeader)1