Search in sources :

Example 31 with Immunization

use of org.hl7.fhir.r4.model.Immunization in project openmrs-module-fhir2 by openmrs.

the class ImmunizationFhirResourceProviderIntegrationTest method shouldReturnNotFoundWhenDeletingNonExistentImmunizationAsXML.

@Test
public void shouldReturnNotFoundWhenDeletingNonExistentImmunizationAsXML() throws Exception {
    MockHttpServletResponse response = delete("/Immunization/" + UNKNOWN_IMMUNIZATION_UUID).accept(FhirMediaTypes.XML).go();
    assertThat(response, isNotFound());
    assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));
    assertThat(response.getContentAsString(), notNullValue());
    OperationOutcome operationOutcome = readOperationOutcome(response);
    assertThat(operationOutcome, notNullValue());
    assertThat(operationOutcome.hasIssue(), is(true));
}
Also used : OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Test(org.junit.Test)

Example 32 with Immunization

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

the class RdfParser method composeImmunizationImmunizationPractitionerComponent.

protected void composeImmunizationImmunizationPractitionerComponent(Complex parent, String parentType, String name, Immunization.ImmunizationPractitionerComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "practitioner", name, element, index);
    if (element.hasRole())
        composeCodeableConcept(t, "Immunization", "role", element.getRole(), -1);
    if (element.hasActor())
        composeReference(t, "Immunization", "actor", element.getActor(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 33 with Immunization

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

the class RdfParser method composeImmunizationImmunizationExplanationComponent.

protected void composeImmunizationImmunizationExplanationComponent(Complex parent, String parentType, String name, Immunization.ImmunizationExplanationComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "explanation", name, element, index);
    for (int i = 0; i < element.getReason().size(); i++) composeCodeableConcept(t, "Immunization", "reason", element.getReason().get(i), i);
    for (int i = 0; i < element.getReasonNotGiven().size(); i++) composeCodeableConcept(t, "Immunization", "reasonNotGiven", element.getReasonNotGiven().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 34 with Immunization

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

the class RdfParser method composeImmunizationImmunizationReactionComponent.

protected void composeImmunizationImmunizationReactionComponent(Complex parent, String parentType, String name, Immunization.ImmunizationReactionComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "reaction", name, element, index);
    if (element.hasDateElement())
        composeDateTime(t, "Immunization", "date", element.getDateElement(), -1);
    if (element.hasDetail())
        composeReference(t, "Immunization", "detail", element.getDetail(), -1);
    if (element.hasReportedElement())
        composeBoolean(t, "Immunization", "reported", element.getReportedElement(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 35 with Immunization

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

the class RdfParser method composeImmunizationImmunizationVaccinationProtocolComponent.

protected void composeImmunizationImmunizationVaccinationProtocolComponent(Complex parent, String parentType, String name, Immunization.ImmunizationVaccinationProtocolComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "vaccinationProtocol", name, element, index);
    if (element.hasDoseSequenceElement())
        composePositiveInt(t, "Immunization", "doseSequence", element.getDoseSequenceElement(), -1);
    if (element.hasDescriptionElement())
        composeString(t, "Immunization", "description", element.getDescriptionElement(), -1);
    if (element.hasAuthority())
        composeReference(t, "Immunization", "authority", element.getAuthority(), -1);
    if (element.hasSeriesElement())
        composeString(t, "Immunization", "series", element.getSeriesElement(), -1);
    if (element.hasSeriesDosesElement())
        composePositiveInt(t, "Immunization", "seriesDoses", element.getSeriesDosesElement(), -1);
    for (int i = 0; i < element.getTargetDisease().size(); i++) composeCodeableConcept(t, "Immunization", "targetDisease", element.getTargetDisease().get(i), i);
    if (element.hasDoseStatus())
        composeCodeableConcept(t, "Immunization", "doseStatus", element.getDoseStatus(), -1);
    if (element.hasDoseStatusReason())
        composeCodeableConcept(t, "Immunization", "doseStatusReason", element.getDoseStatusReason(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Aggregations

Immunization (org.hl7.fhir.r4.model.Immunization)47 Test (org.junit.Test)27 Test (org.junit.jupiter.api.Test)22 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)18 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)15 Resource (org.hl7.fhir.r4.model.Resource)13 OperationOutcome (org.hl7.fhir.r4.model.OperationOutcome)8 Bundle (org.hl7.fhir.r4.model.Bundle)7 Organization (org.hl7.fhir.r4.model.Organization)7 BaseFhirProvenanceResourceTest (org.openmrs.module.fhir2.providers.BaseFhirProvenanceResourceTest)6 Date (java.util.Date)5 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)5 IdType (org.hl7.fhir.r4.model.IdType)5 Observation (org.hl7.fhir.r4.model.Observation)5 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)5 InputStream (java.io.InputStream)4 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)4 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)4 Obs (org.openmrs.Obs)4 FhirContext (ca.uhn.fhir.context.FhirContext)3