Search in sources :

Example 21 with HealthcareService

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

the class RdfParser method composePractitionerPractitionerPractitionerRoleComponent.

protected void composePractitionerPractitionerPractitionerRoleComponent(Complex parent, String parentType, String name, Practitioner.PractitionerPractitionerRoleComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "practitionerRole", name, element, index);
    if (element.hasOrganization())
        composeReference(t, "Practitioner", "organization", element.getOrganization(), -1);
    if (element.hasRole())
        composeCodeableConcept(t, "Practitioner", "role", element.getRole(), -1);
    for (int i = 0; i < element.getSpecialty().size(); i++) composeCodeableConcept(t, "Practitioner", "specialty", element.getSpecialty().get(i), i);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Practitioner", "identifier", element.getIdentifier().get(i), i);
    for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "Practitioner", "telecom", element.getTelecom().get(i), i);
    if (element.hasPeriod())
        composePeriod(t, "Practitioner", "period", element.getPeriod(), -1);
    for (int i = 0; i < element.getLocation().size(); i++) composeReference(t, "Practitioner", "location", element.getLocation().get(i), i);
    for (int i = 0; i < element.getHealthcareService().size(); i++) composeReference(t, "Practitioner", "healthcareService", element.getHealthcareService().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 22 with HealthcareService

use of org.hl7.fhir.r4.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.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.dstu3.utils.formats.Turtle.Complex)

Example 23 with HealthcareService

use of org.hl7.fhir.r4.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.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 24 with HealthcareService

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

the class RdfParser method composeHealthcareServiceHealthcareServiceEligibilityComponent.

protected void composeHealthcareServiceHealthcareServiceEligibilityComponent(Complex parent, String parentType, String name, HealthcareService.HealthcareServiceEligibilityComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "eligibility", name, element, index);
    if (element.hasCode())
        composeCodeableConcept(t, "HealthcareService", "code", element.getCode(), -1);
    if (element.hasCommentElement())
        composeMarkdown(t, "HealthcareService", "comment", element.getCommentElement(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 25 with HealthcareService

use of org.hl7.fhir.r4.model.HealthcareService in project CRD by HL7-DaVinci.

the class CoverageRequirementsDiscoveryOperationHardCodedResponse method coverageRequirementsDiscovery.

/**
 * Submits the CRD request.
 * @param request the request to be submitted
 * @param endpoint the endpoint to submit the request to
 * @param requestQualification what kind of request it is
 * @return the parameters returned from the server
 */
@Operation(name = "$coverage-requirements-discovery", idempotent = true)
public Parameters coverageRequirementsDiscovery(@OperationParam(name = "request") Parameters.ParametersParameterComponent request, @OperationParam(name = "endpoint") Endpoint endpoint, @OperationParam(name = "requestQualification") CodeableConcept requestQualification) {
    logger.debug("coverageRequirementsDiscovery: start");
    Parameters retVal = new Parameters();
    CoverageEligibilityRequest eligibilityRequest = null;
    Patient patient = null;
    Coverage coverage = null;
    Practitioner provider = null;
    Organization insurer = null;
    Location facility = null;
    // supportingInformation
    // serviceInformation
    // grab the list of parameters
    List<Parameters.ParametersParameterComponent> paramList = request.getPart();
    // pull each of the parameters from the list
    for (Parameters.ParametersParameterComponent part : paramList) {
        System.out.println(part.getName());
        switch(part.getName()) {
            case "eligibilityrequest":
                logger.debug("CRD: got eligibilityrequest");
                eligibilityRequest = (CoverageEligibilityRequest) part.getResource();
                break;
            case "patient":
                logger.debug("CRD: got patient");
                patient = (Patient) part.getResource();
                break;
            case "coverage":
                logger.debug("CRD: got coverage");
                coverage = (Coverage) part.getResource();
                break;
            case "provider":
                logger.debug("CRD: got provider");
                provider = (Practitioner) part.getResource();
                break;
            case "insurer":
                logger.debug("CRD: got insurer");
                insurer = (Organization) part.getResource();
                break;
            case "facility":
                logger.debug("CRD: got facility");
                facility = (Location) part.getResource();
                break;
            case "patientContext":
                ResourceType patientContextType = part.getResource().getResourceType();
                switch(patientContextType) {
                    case Condition:
                        logger.debug("CRD: got request.patientContext of type Condition");
                        break;
                    case Device:
                        logger.debug("CRD: got request.patientContext of type Device");
                        break;
                    case Procedure:
                        logger.debug("CRD: got request.patientContext of type Procedure");
                        break;
                    case MedicationStatement:
                        logger.debug("CRD: got request.patientContext of type MedicationStatement");
                        break;
                    case HealthcareService:
                        logger.debug("CRD: got request.patientContext of type HealthcareService");
                        break;
                    default:
                        logger.warn("Warning: unexpected request.patientContext type");
                        break;
                }
                break;
            case "serviceInformationReference":
                ResourceType serviceInformationReferenceType = part.getResource().getResourceType();
                switch(serviceInformationReferenceType) {
                    case Procedure:
                        logger.debug("CRD: got request.serviceInformationReferenceType of type Procedure");
                        break;
                    case HealthcareService:
                        logger.debug("CRD: got request.serviceInformationReferenceType " + "of type HealthcareService");
                        break;
                    case ServiceRequest:
                        logger.debug("CRD: got request.serviceInformationReferenceType " + "of type ServiceRequest");
                        break;
                    case MedicationRequest:
                        logger.debug("CRD: got request.serviceInformationReferenceType " + "of type MedicationRequest");
                        break;
                    case Medication:
                        logger.debug("CRD: got request.serviceInformationReferenceType of type Medication");
                        break;
                    case Device:
                        logger.debug("CRD: got request.serviceInformationReferenceType of type Device");
                        break;
                    case DeviceRequest:
                        logger.debug("CRD: got request.serviceInformationReferenceType " + "of type DeviceRequest");
                        break;
                    default:
                        logger.warn("Warning: unexpected request.serviceInformationReferenceType type");
                        break;
                }
                break;
            default:
                logger.warn("Warning: unexpected parameter part: " + part.getName());
                break;
        }
    }
    // Note: if nothing is set in the reference (even if it was created) it will be null
    if (nullCheck(eligibilityRequest, "eligibilityrequest") || nullCheck(patient, "patient") || nullCheck(coverage, "coverage") || nullCheck(provider, "provider") || nullCheck(insurer, "insurer")) {
        logger.error("ERROR: required information missing!");
        return retVal;
    }
    // print out the patient name
    assert patient != null;
    if (patient.hasName()) {
        logger.debug("CRD: Patient Name: " + patient.getName().get(0).getText());
    } else {
        logger.debug("CRD: No Patient Name provided");
    }
    // start building the response
    CoverageEligibilityResponse eligibilityResponse = new CoverageEligibilityResponse();
    eligibilityResponse.setDisposition("this is a test");
    Endpoint finalEndPoint = new Endpoint();
    finalEndPoint.setAddress("http://www.mitre.org");
    Parameters.ParametersParameterComponent response = retVal.addParameter();
    response.setName("response");
    response.addPart().setName("eligibilityresponse").setResource(eligibilityResponse);
    response.addPart().setName("requestProvider").setResource(provider);
    response.addPart().setName("request").setResource(eligibilityRequest);
    response.addPart().setName("insurer").setResource(insurer);
    response.addPart().setName("coverage").setResource(coverage);
    // add a few service resources to the parameters
    Procedure procedure = new Procedure();
    procedure.setId("procedure-1");
    Device device = new Device();
    device.setModelNumber("LMNOP678");
    response.addPart().setName("service").setResource(procedure);
    response.addPart().setName("service").setResource(device);
    if (finalEndPoint != null) {
        response.addPart().setName("endPoint").setResource(finalEndPoint);
    }
    logger.debug("coverageRequirementsDiscovery: end");
    return retVal;
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) Organization(org.hl7.fhir.r4.model.Organization) Device(org.hl7.fhir.r4.model.Device) CoverageEligibilityResponse(org.hl7.fhir.r4.model.CoverageEligibilityResponse) Patient(org.hl7.fhir.r4.model.Patient) Coverage(org.hl7.fhir.r4.model.Coverage) ResourceType(org.hl7.fhir.r4.model.ResourceType) CoverageEligibilityRequest(org.hl7.fhir.r4.model.CoverageEligibilityRequest) Practitioner(org.hl7.fhir.r4.model.Practitioner) Endpoint(org.hl7.fhir.r4.model.Endpoint) Procedure(org.hl7.fhir.r4.model.Procedure) Location(org.hl7.fhir.r4.model.Location) Operation(ca.uhn.fhir.rest.annotation.Operation)

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