Search in sources :

Example 16 with HealthcareService

use of org.hl7.fhir.r4.model.HealthcareService in project Gravity-SDOH-Exchange-RI by FHIR.

the class PatientTaskService method createMakeContactTaskBundleFactory.

private PatientMakeContactTaskBundleFactory createMakeContactTaskBundleFactory(UserDto user, NewMakeContactTaskRequestDto makeContactTaskRequest) {
    PatientMakeContactTaskPrepareBundleFactory taskPrepareBundleFactory = new PatientMakeContactTaskPrepareBundleFactory(SmartOnFhirContext.get().getPatient(), user.getId(), makeContactTaskRequest.getHealthcareServiceId(), makeContactTaskRequest.getReferralTaskId());
    Bundle taskRelatedResources = ehrClient.transaction().withBundle(taskPrepareBundleFactory.createPrepareBundle()).execute();
    PatientMakeContactTaskPrepareBundleExtractor.PatientMakeContactTaskPrepareInfoHolder taskPrepareInfoHolder = new PatientMakeContactTaskPrepareBundleExtractor().extract(taskRelatedResources);
    PatientMakeContactTaskBundleFactory taskBundleFactory = new PatientMakeContactTaskBundleFactory();
    taskBundleFactory.setName(makeContactTaskRequest.getName());
    taskBundleFactory.setPatient(taskPrepareInfoHolder.getPatient());
    taskBundleFactory.setPriority(makeContactTaskRequest.getPriority());
    taskBundleFactory.setOccurrence(makeContactTaskRequest.getOccurrence());
    taskBundleFactory.setRequester(taskPrepareInfoHolder.getPerformer());
    // TODO verify whether the passed Task instance is related to the Patient
    taskBundleFactory.setReferralTask(taskPrepareInfoHolder.getReferralTask());
    taskBundleFactory.setComment(makeContactTaskRequest.getComment());
    taskBundleFactory.setUser(user);
    // TODO verify whether the passed HealthcareService instance is related to the task
    taskBundleFactory.setContactInfo(taskPrepareInfoHolder.getHealthcareService());
    return taskBundleFactory;
}
Also used : PatientMakeContactTaskBundleFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.patienttask.PatientMakeContactTaskBundleFactory) Bundle(org.hl7.fhir.r4.model.Bundle) PatientMakeContactTaskPrepareBundleFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.patienttask.PatientMakeContactTaskPrepareBundleFactory) PatientMakeContactTaskPrepareBundleExtractor(org.hl7.gravity.refimpl.sdohexchange.fhir.extract.patienttask.PatientMakeContactTaskPrepareBundleExtractor)

Example 17 with HealthcareService

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

the class EncounterReportBundleService method createEncounterBundle.

public Bundle createEncounterBundle(POCDMT000002UK01ClinicalDocument1 clinicalDocument, ItkReportHeader header, String messageId) throws XmlException {
    Bundle bundle = createBundle(clinicalDocument);
    MessageHeader messageHeader = messageHeaderService.createMessageHeader(header, messageId, clinicalDocument.getEffectiveTime().getValue());
    List<HealthcareService> healthcareServiceList = healthcareServiceMapper.mapHealthcareService(clinicalDocument);
    List<PractitionerRole> authorPractitionerRoles = practitionerRoleMapper.mapAuthorRoles(clinicalDocument.getAuthorArray());
    Optional<PractitionerRole> responsibleParty = practitionerRoleMapper.mapResponsibleParty(clinicalDocument);
    Encounter encounter = encounterMapper.mapEncounter(clinicalDocument, authorPractitionerRoles, responsibleParty, messageHeader.getEvent());
    Consent consent = consentMapper.mapConsent(clinicalDocument, encounter);
    List<QuestionnaireResponse> questionnaireResponseList = pathwayUtil.getQuestionnaireResponses(clinicalDocument, encounter.getSubject(), resourceUtil.createReference(encounter));
    Condition condition = conditionMapper.mapCondition(clinicalDocument, encounter, questionnaireResponseList);
    List<CarePlan> carePlans = carePlanMapper.mapCarePlan(clinicalDocument, encounter, condition);
    Device device = deviceMapper.mapDevice();
    ReferralRequest referralRequest = referralRequestMapper.mapReferralRequest(clinicalDocument, encounter, healthcareServiceList, resourceUtil.createReference(condition), resourceUtil.createReference(device));
    Composition composition = compositionMapper.mapComposition(clinicalDocument, encounter, carePlans, questionnaireResponseList, referralRequest, authorPractitionerRoles);
    List<Observation> observations = observationMapper.mapObservations(clinicalDocument, encounter);
    RelatedPerson relatedPerson = relatedPersonMapper.createEmergencyContactRelatedPerson(clinicalDocument, encounter);
    addMessageHeader(bundle, messageHeader);
    addEncounter(bundle, encounter);
    addServiceProvider(bundle, encounter);
    addParticipants(bundle, encounter);
    addLocation(bundle, encounter);
    addSubject(bundle, encounter);
    addHealthcareService(bundle, healthcareServiceList);
    addIncomingReferral(bundle, referralRequest);
    addAppointment(bundle, encounter);
    addEntry(bundle, composition);
    addCarePlan(bundle, carePlans);
    addEntry(bundle, consent);
    addEntry(bundle, condition);
    addQuestionnaireResponses(bundle, questionnaireResponseList);
    addObservations(bundle, observations);
    addPractitionerRoles(bundle, authorPractitionerRoles, responsibleParty);
    addRelatedPerson(bundle, relatedPerson);
    addEntry(bundle, device);
    ListResource listResource = getReferenceFromBundle(bundle, clinicalDocument, encounter, device);
    addEntry(bundle, listResource);
    return bundle;
}
Also used : Condition(org.hl7.fhir.dstu3.model.Condition) ReferralRequest(org.hl7.fhir.dstu3.model.ReferralRequest) Composition(org.hl7.fhir.dstu3.model.Composition) Bundle(org.hl7.fhir.dstu3.model.Bundle) Device(org.hl7.fhir.dstu3.model.Device) HealthcareService(org.hl7.fhir.dstu3.model.HealthcareService) PractitionerRole(org.hl7.fhir.dstu3.model.PractitionerRole) QuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse) RelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson) CarePlan(org.hl7.fhir.dstu3.model.CarePlan) Consent(org.hl7.fhir.dstu3.model.Consent) Observation(org.hl7.fhir.dstu3.model.Observation) Encounter(org.hl7.fhir.dstu3.model.Encounter) MessageHeader(org.hl7.fhir.dstu3.model.MessageHeader) ListResource(org.hl7.fhir.dstu3.model.ListResource)

Example 18 with HealthcareService

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

the class HealthcareServiceMapper method mapSingleHealthcareService.

private HealthcareService mapSingleHealthcareService(POCDMT000002UK01InformationRecipient informationRecipient) {
    POCDMT000002UK01IntendedRecipient intendedRecipient = informationRecipient.getIntendedRecipient();
    HealthcareService healthcareService = new HealthcareService().setActive(true);
    healthcareService.setIdElement(resourceUtil.newRandomUuid());
    Organization organization = new Organization();
    if (intendedRecipient.isSetReceivedOrganization()) {
        POCDMT000002UK01Organization receivedOrganization = intendedRecipient.getReceivedOrganization();
        organization = organizationMapper.mapOrganization(informationRecipient);
        healthcareService.setProvidedBy(resourceUtil.createReference(organization));
        healthcareService.setProvidedByTarget(organization);
        if (receivedOrganization.sizeOfNameArray() > 0) {
            ON name = receivedOrganization.getNameArray(0);
            healthcareService.setName(nodeUtil.getAllText(name.getDomNode()));
        }
    }
    Location location = locationMapper.mapRecipientToLocation(intendedRecipient, organization);
    healthcareService.addLocation(resourceUtil.createReference(location));
    if (intendedRecipient.sizeOfTelecomArray() > 0) {
        for (TEL tel : intendedRecipient.getTelecomArray()) {
            healthcareService.addTelecom(contactPointMapper.mapContactPoint(tel));
        }
    }
    return healthcareService;
}
Also used : Organization(org.hl7.fhir.dstu3.model.Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) POCDMT000002UK01IntendedRecipient(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01IntendedRecipient) HealthcareService(org.hl7.fhir.dstu3.model.HealthcareService) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) ON(uk.nhs.connect.iucds.cda.ucr.ON) Location(org.hl7.fhir.dstu3.model.Location)

Example 19 with HealthcareService

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

the class ListMapperTest method setUp.

@BeforeEach
public void setUp() {
    effectiveTime.setValue(EFFECTIVE_DATE);
    HealthcareService healthcareService = new HealthcareService();
    healthcareService.setId("123456");
    QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse();
    questionnaireResponse.setId("654321");
    resourcesCreated = asList(healthcareService, questionnaireResponse);
    when(clinicalDocument.getSetId()).thenReturn(ii);
    when(ii.getRoot()).thenReturn("411910CF-1A76-4330-98FE-C345DDEE5553");
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    when(clinicalDocument.getEffectiveTime()).thenReturn(effectiveTime);
}
Also used : HealthcareService(org.hl7.fhir.dstu3.model.HealthcareService) QuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse) IdType(org.hl7.fhir.dstu3.model.IdType) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 20 with HealthcareService

use of org.hl7.fhir.r4.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.hasProvidedBy())
        composeReference(t, "HealthcareService", "providedBy", element.getProvidedBy(), -1);
    if (element.hasServiceCategory())
        composeCodeableConcept(t, "HealthcareService", "serviceCategory", element.getServiceCategory(), -1);
    for (int i = 0; i < element.getServiceType().size(); i++) composeCodeableConcept(t, "HealthcareService", "serviceType", element.getServiceType().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.hasServiceNameElement())
        composeString(t, "HealthcareService", "serviceName", element.getServiceNameElement(), -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.hasPublicKeyElement())
        composeString(t, "HealthcareService", "publicKey", element.getPublicKeyElement(), -1);
    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);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.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 Location (org.hl7.fhir.r4.model.Location)2 Test (org.junit.jupiter.api.Test)2 Operation (ca.uhn.fhir.rest.annotation.Operation)1 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