Search in sources :

Example 81 with DIAGNOSTICREPORT

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.DIAGNOSTICREPORT in project openmrs-module-fhir2 by openmrs.

the class DiagnosticReportResourceProviderIntegrationTest method shouldReturnExistingDiagnosticReportAsJson.

@Test
public void shouldReturnExistingDiagnosticReportAsJson() throws Exception {
    MockHttpServletResponse response = get("/DiagnosticReport/" + DIAGNOSTIC_REPORT_UUID).accept(FhirMediaTypes.JSON).go();
    assertThat(response, isOk());
    assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));
    assertThat(response.getContentAsString(), notNullValue());
    DiagnosticReport diagnosticReport = readResponse(response);
    assertThat(diagnosticReport, notNullValue());
    assertThat(diagnosticReport.getIdElement().getIdPart(), equalTo(DIAGNOSTIC_REPORT_UUID));
    assertThat(diagnosticReport.hasCategory(), is(true));
    assertThat(diagnosticReport.getCategory().getCodingFirstRep().getCode(), equalTo("LAB"));
    assertThat(diagnosticReport.hasSubject(), is(true));
    assertThat(diagnosticReport.getSubject().getReference(), equalTo("Patient/5946f880-b197-400b-9caa-a3c661d23041"));
    assertThat(diagnosticReport.hasContext(), is(true));
    assertThat(diagnosticReport.getContext().getReference(), equalTo("Encounter/6519d653-393b-4118-9c83-a3715b82d4ac"));
    assertThat(diagnosticReport.hasCode(), is(true));
    assertThat(diagnosticReport.getCode().getCoding(), hasItem(hasProperty("code", equalTo(DIAGNOSTIC_REPORT_CONCEPT_UUID))));
    assertThat(diagnosticReport.hasIssued(), is(true));
    assertThat(diagnosticReport.getIssued(), equalTo(Date.from(LocalDateTime.of(2008, 7, 1, 0, 0, 0).atZone(ZoneId.systemDefault()).toInstant())));
    assertThat(diagnosticReport.hasResult(), is(true));
    assertThat(diagnosticReport.getResult(), hasSize(2));
    assertThat(diagnosticReport.getResult(), hasItem(hasProperty("reference", equalTo("Observation/6f16bb57-12bc-4077-9f49-ceaa9b928669"))));
    assertThat(diagnosticReport, validResource());
}
Also used : DiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Test(org.junit.Test)

Example 82 with DIAGNOSTICREPORT

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.DIAGNOSTICREPORT in project openmrs-module-fhir2 by openmrs.

the class DiagnosticReportResourceProviderIntegrationTest method shouldReturnCountForDiagonosticReportAsJson.

@Test
public void shouldReturnCountForDiagonosticReportAsJson() throws Exception {
    MockHttpServletResponse response = get("/DiagnosticReport?patient.given=Collet&_summary=count").accept(FhirMediaTypes.JSON).go();
    assertThat(response, isOk());
    assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));
    assertThat(response.getContentAsString(), notNullValue());
    Bundle result = readBundleResponse(response);
    assertThat(result, notNullValue());
    assertThat(result.getType(), equalTo(Bundle.BundleType.SEARCHSET));
    assertThat(result, hasProperty("total", equalTo(2)));
}
Also used : Bundle(org.hl7.fhir.dstu3.model.Bundle) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Test(org.junit.Test)

Example 83 with DIAGNOSTICREPORT

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.DIAGNOSTICREPORT in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeDiagnosticReport.

protected void composeDiagnosticReport(Complex parent, String parentType, String name, DiagnosticReport element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "DiagnosticReport", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "DiagnosticReport", "identifier", element.getIdentifier().get(i), i);
    for (int i = 0; i < element.getBasedOn().size(); i++) composeReference(t, "DiagnosticReport", "basedOn", element.getBasedOn().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "DiagnosticReport", "status", element.getStatusElement(), -1);
    if (element.hasCategory())
        composeCodeableConcept(t, "DiagnosticReport", "category", element.getCategory(), -1);
    if (element.hasCode())
        composeCodeableConcept(t, "DiagnosticReport", "code", element.getCode(), -1);
    if (element.hasSubject())
        composeReference(t, "DiagnosticReport", "subject", element.getSubject(), -1);
    if (element.hasContext())
        composeReference(t, "DiagnosticReport", "context", element.getContext(), -1);
    if (element.hasEffective())
        composeType(t, "DiagnosticReport", "effective", element.getEffective(), -1);
    if (element.hasIssuedElement())
        composeInstant(t, "DiagnosticReport", "issued", element.getIssuedElement(), -1);
    for (int i = 0; i < element.getPerformer().size(); i++) composeDiagnosticReportDiagnosticReportPerformerComponent(t, "DiagnosticReport", "performer", element.getPerformer().get(i), i);
    for (int i = 0; i < element.getSpecimen().size(); i++) composeReference(t, "DiagnosticReport", "specimen", element.getSpecimen().get(i), i);
    for (int i = 0; i < element.getResult().size(); i++) composeReference(t, "DiagnosticReport", "result", element.getResult().get(i), i);
    for (int i = 0; i < element.getImagingStudy().size(); i++) composeReference(t, "DiagnosticReport", "imagingStudy", element.getImagingStudy().get(i), i);
    for (int i = 0; i < element.getImage().size(); i++) composeDiagnosticReportDiagnosticReportImageComponent(t, "DiagnosticReport", "image", element.getImage().get(i), i);
    if (element.hasConclusionElement())
        composeString(t, "DiagnosticReport", "conclusion", element.getConclusionElement(), -1);
    for (int i = 0; i < element.getCodedDiagnosis().size(); i++) composeCodeableConcept(t, "DiagnosticReport", "codedDiagnosis", element.getCodedDiagnosis().get(i), i);
    for (int i = 0; i < element.getPresentedForm().size(); i++) composeAttachment(t, "DiagnosticReport", "presentedForm", element.getPresentedForm().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 84 with DIAGNOSTICREPORT

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.DIAGNOSTICREPORT in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeDiagnosticReportDiagnosticReportImageComponent.

protected void composeDiagnosticReportDiagnosticReportImageComponent(Complex parent, String parentType, String name, DiagnosticReport.DiagnosticReportImageComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "image", name, element, index);
    if (element.hasCommentElement())
        composeString(t, "DiagnosticReport", "comment", element.getCommentElement(), -1);
    if (element.hasLink())
        composeReference(t, "DiagnosticReport", "link", element.getLink(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 85 with DIAGNOSTICREPORT

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.DIAGNOSTICREPORT in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeDiagnosticReportDiagnosticReportImageComponent.

protected void composeDiagnosticReportDiagnosticReportImageComponent(Complex parent, String parentType, String name, DiagnosticReport.DiagnosticReportImageComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "image", name, element, index);
    if (element.hasCommentElement())
        composeString(t, "DiagnosticReport", "comment", element.getCommentElement(), -1);
    if (element.hasLink())
        composeReference(t, "DiagnosticReport", "link", element.getLink(), -1);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Aggregations

Test (org.junit.Test)133 DiagnosticReport (org.hl7.fhir.r4.model.DiagnosticReport)115 FhirDiagnosticReport (org.openmrs.module.fhir2.model.FhirDiagnosticReport)65 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)52 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)50 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)42 Test (org.junit.jupiter.api.Test)39 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)39 DiagnosticReport (org.hl7.fhir.dstu3.model.DiagnosticReport)32 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)29 ReferenceAndListParam (ca.uhn.fhir.rest.param.ReferenceAndListParam)28 ReferenceOrListParam (ca.uhn.fhir.rest.param.ReferenceOrListParam)28 ReferenceParam (ca.uhn.fhir.rest.param.ReferenceParam)28 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)19 Reference (org.hl7.fhir.r4.model.Reference)19 Bundle (org.hl7.fhir.r4.model.Bundle)18 Resource (org.hl7.fhir.r4.model.Resource)18 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)16 Include (ca.uhn.fhir.model.api.Include)12 HashSet (java.util.HashSet)12