Search in sources :

Example 31 with ProcedureRequest

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

the class RdfParser method composeProcedureRequest.

protected void composeProcedureRequest(Complex parent, String parentType, String name, ProcedureRequest element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "ProcedureRequest", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "ProcedureRequest", "identifier", element.getIdentifier().get(i), i);
    if (element.hasSubject())
        composeReference(t, "ProcedureRequest", "subject", element.getSubject(), -1);
    if (element.hasCode())
        composeCodeableConcept(t, "ProcedureRequest", "code", element.getCode(), -1);
    for (int i = 0; i < element.getBodySite().size(); i++) composeCodeableConcept(t, "ProcedureRequest", "bodySite", element.getBodySite().get(i), i);
    if (element.hasReason())
        composeType(t, "ProcedureRequest", "reason", element.getReason(), -1);
    if (element.hasScheduled())
        composeType(t, "ProcedureRequest", "scheduled", element.getScheduled(), -1);
    if (element.hasEncounter())
        composeReference(t, "ProcedureRequest", "encounter", element.getEncounter(), -1);
    if (element.hasPerformer())
        composeReference(t, "ProcedureRequest", "performer", element.getPerformer(), -1);
    if (element.hasStatusElement())
        composeEnum(t, "ProcedureRequest", "status", element.getStatusElement(), -1);
    for (int i = 0; i < element.getNotes().size(); i++) composeAnnotation(t, "ProcedureRequest", "notes", element.getNotes().get(i), i);
    if (element.hasAsNeeded())
        composeType(t, "ProcedureRequest", "asNeeded", element.getAsNeeded(), -1);
    if (element.hasOrderedOnElement())
        composeDateTime(t, "ProcedureRequest", "orderedOn", element.getOrderedOnElement(), -1);
    if (element.hasOrderer())
        composeReference(t, "ProcedureRequest", "orderer", element.getOrderer(), -1);
    if (element.hasPriorityElement())
        composeEnum(t, "ProcedureRequest", "priority", element.getPriorityElement(), -1);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 32 with ProcedureRequest

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

the class RdfParser method composeProcedureRequestProcedureRequestRequesterComponent.

protected void composeProcedureRequestProcedureRequestRequesterComponent(Complex parent, String parentType, String name, ProcedureRequest.ProcedureRequestRequesterComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "requester", name, element, index);
    if (element.hasAgent())
        composeReference(t, "ProcedureRequest", "agent", element.getAgent(), -1);
    if (element.hasOnBehalfOf())
        composeReference(t, "ProcedureRequest", "onBehalfOf", element.getOnBehalfOf(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 33 with ProcedureRequest

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

the class RdfParser method composeProcedureRequest.

protected void composeProcedureRequest(Complex parent, String parentType, String name, ProcedureRequest element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "ProcedureRequest", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "ProcedureRequest", "identifier", element.getIdentifier().get(i), i);
    for (int i = 0; i < element.getDefinition().size(); i++) composeReference(t, "ProcedureRequest", "definition", element.getDefinition().get(i), i);
    for (int i = 0; i < element.getBasedOn().size(); i++) composeReference(t, "ProcedureRequest", "basedOn", element.getBasedOn().get(i), i);
    for (int i = 0; i < element.getReplaces().size(); i++) composeReference(t, "ProcedureRequest", "replaces", element.getReplaces().get(i), i);
    if (element.hasRequisition())
        composeIdentifier(t, "ProcedureRequest", "requisition", element.getRequisition(), -1);
    if (element.hasStatusElement())
        composeEnum(t, "ProcedureRequest", "status", element.getStatusElement(), -1);
    if (element.hasIntentElement())
        composeEnum(t, "ProcedureRequest", "intent", element.getIntentElement(), -1);
    if (element.hasPriorityElement())
        composeEnum(t, "ProcedureRequest", "priority", element.getPriorityElement(), -1);
    if (element.hasDoNotPerformElement())
        composeBoolean(t, "ProcedureRequest", "doNotPerform", element.getDoNotPerformElement(), -1);
    for (int i = 0; i < element.getCategory().size(); i++) composeCodeableConcept(t, "ProcedureRequest", "category", element.getCategory().get(i), i);
    if (element.hasCode())
        composeCodeableConcept(t, "ProcedureRequest", "code", element.getCode(), -1);
    if (element.hasSubject())
        composeReference(t, "ProcedureRequest", "subject", element.getSubject(), -1);
    if (element.hasContext())
        composeReference(t, "ProcedureRequest", "context", element.getContext(), -1);
    if (element.hasOccurrence())
        composeType(t, "ProcedureRequest", "occurrence", element.getOccurrence(), -1);
    if (element.hasAsNeeded())
        composeType(t, "ProcedureRequest", "asNeeded", element.getAsNeeded(), -1);
    if (element.hasAuthoredOnElement())
        composeDateTime(t, "ProcedureRequest", "authoredOn", element.getAuthoredOnElement(), -1);
    if (element.hasRequester())
        composeProcedureRequestProcedureRequestRequesterComponent(t, "ProcedureRequest", "requester", element.getRequester(), -1);
    if (element.hasPerformerType())
        composeCodeableConcept(t, "ProcedureRequest", "performerType", element.getPerformerType(), -1);
    if (element.hasPerformer())
        composeReference(t, "ProcedureRequest", "performer", element.getPerformer(), -1);
    for (int i = 0; i < element.getReasonCode().size(); i++) composeCodeableConcept(t, "ProcedureRequest", "reasonCode", element.getReasonCode().get(i), i);
    for (int i = 0; i < element.getReasonReference().size(); i++) composeReference(t, "ProcedureRequest", "reasonReference", element.getReasonReference().get(i), i);
    for (int i = 0; i < element.getSupportingInfo().size(); i++) composeReference(t, "ProcedureRequest", "supportingInfo", element.getSupportingInfo().get(i), i);
    for (int i = 0; i < element.getSpecimen().size(); i++) composeReference(t, "ProcedureRequest", "specimen", element.getSpecimen().get(i), i);
    for (int i = 0; i < element.getBodySite().size(); i++) composeCodeableConcept(t, "ProcedureRequest", "bodySite", element.getBodySite().get(i), i);
    for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "ProcedureRequest", "note", element.getNote().get(i), i);
    for (int i = 0; i < element.getRelevantHistory().size(); i++) composeReference(t, "ProcedureRequest", "relevantHistory", element.getRelevantHistory().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 34 with ProcedureRequest

use of org.hl7.fhir.dstu3.model.ProcedureRequest in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ProcedureRequestMapperTest method mapProcedureRequestWithNoOptionalFields.

@Test
public void mapProcedureRequestWithNoOptionalFields() {
    var ehrExtract = unmarshallCodeElement("no_optional_data_example.xml");
    var planStatement = getPlanStatement(ehrExtract);
    ProcedureRequest procedureRequest = procedureRequestMapper.mapToProcedureRequest(ehrExtract, getEhrComposition(ehrExtract), planStatement, SUBJECT, ENCOUNTERS, PRACTISE_CODE);
    assertFixedValues(planStatement, procedureRequest);
    assertThat(procedureRequest.getOccurrence()).isNull();
    assertThat(procedureRequest.getAuthoredOn()).isNull();
    assertThat(procedureRequest.getNoteFirstRep()).isNull();
}
Also used : ProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest) Test(org.junit.jupiter.api.Test)

Example 35 with ProcedureRequest

use of org.hl7.fhir.dstu3.model.ProcedureRequest in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ProcedureRequestMapperTest method mapProcedureRequestWithEhrCompositionAvailabilityTime.

@Test
public void mapProcedureRequestWithEhrCompositionAvailabilityTime() {
    var ehrExtract = unmarshallCodeElement("ehr_composition_availability_time_example.xml");
    var ehrComposition = getEhrComposition(ehrExtract);
    var planStatement = getPlanStatement(ehrExtract);
    setUpCodeableConceptMock();
    ProcedureRequest procedureRequest = procedureRequestMapper.mapToProcedureRequest(ehrExtract, getEhrComposition(ehrExtract), planStatement, SUBJECT, ENCOUNTERS, PRACTISE_CODE);
    assertFixedValues(planStatement, procedureRequest);
    assertThat(procedureRequest.getAuthoredOn()).isEqualTo(DateFormatUtil.parseToDateTimeType(ehrComposition.getAvailabilityTime().getValue()).getValue());
    assertThat(procedureRequest.getReasonCodeFirstRep().getCodingFirstRep().getDisplay()).isEqualTo(planStatement.getCode().getDisplayName());
    assertThat(procedureRequest.getContext().getResource().getIdElement().getValue()).isEqualTo(ENCOUNTER_ID);
}
Also used : ProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest) Test(org.junit.jupiter.api.Test)

Aggregations

ProcedureRequest (org.hl7.fhir.dstu3.model.ProcedureRequest)23 Test (org.junit.jupiter.api.Test)12 Test (org.junit.Test)10 ServiceRequest (org.hl7.fhir.r4.model.ServiceRequest)6 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)6 IdType (org.hl7.fhir.dstu3.model.IdType)5 Reference (org.hl7.fhir.dstu3.model.Reference)5 Bundle (org.hl7.fhir.dstu3.model.Bundle)4 MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)3 Identifier (org.hl7.fhir.dstu3.model.Identifier)2 Resource (org.hl7.fhir.dstu3.model.Resource)2 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)2 Test (org.testng.annotations.Test)2 SystemRequestDetails (ca.uhn.fhir.jpa.partition.SystemRequestDetails)1 IParser (ca.uhn.fhir.parser.IParser)1 Create (ca.uhn.fhir.rest.annotation.Create)1 InternalErrorException (ca.uhn.fhir.rest.server.exceptions.InternalErrorException)1 IProcedureRequest (ch.elexis.core.findings.IProcedureRequest)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 URI (java.net.URI)1