use of org.hl7.fhir.dstu3.model.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());
}
use of org.hl7.fhir.dstu3.model.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)));
}
use of org.hl7.fhir.dstu3.model.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);
}
use of org.hl7.fhir.dstu3.model.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);
}
use of org.hl7.fhir.dstu3.model.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);
}
Aggregations