use of org.hl7.fhir.dstu2016may.model.Meta in project openmrs-module-fhir2 by openmrs.
the class DiagnosticReportResourceProviderIntegrationTest method shouldReturnSortedAndFilteredSearchResultsForPatientsAsJson.
@Test
public void shouldReturnSortedAndFilteredSearchResultsForPatientsAsJson() throws Exception {
MockHttpServletResponse response = get("/DiagnosticReport?patient.given=Collet&_sort=-_lastUpdated").accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));
assertThat(response.getContentAsString(), notNullValue());
Bundle results = readBundleResponse(response);
assertThat(results, notNullValue());
assertThat(results.getType(), equalTo(Bundle.BundleType.SEARCHSET));
assertThat(results.hasEntry(), is(true));
List<Bundle.BundleEntryComponent> entries = results.getEntry();
assertThat(entries, everyItem(hasResource(hasProperty("subject", hasProperty("reference", equalTo("Patient/5946f880-b197-400b-9caa-a3c661d23041"))))));
assertThat(entries, containsInRelativeOrder(hasResource(hasProperty("meta", hasProperty("lastUpdated", equalTo(Date.from(LocalDateTime.of(2018, 8, 18, 14, 9, 35).atZone(ZoneId.systemDefault()).toInstant()))))), hasResource(hasProperty("meta", hasProperty("lastUpdated", equalTo(Date.from(LocalDateTime.of(2008, 8, 18, 14, 9, 35).atZone(ZoneId.systemDefault()).toInstant())))))));
assertThat(entries, everyItem(hasResource(validResource())));
}
use of org.hl7.fhir.dstu2016may.model.Meta in project openmrs-module-fhir2 by openmrs.
the class DiagnosticReportResourceProviderIntegrationTest method shouldReturnSortedAndFilteredSearchResultsForPatientsAsXML.
@Test
public void shouldReturnSortedAndFilteredSearchResultsForPatientsAsXML() throws Exception {
MockHttpServletResponse response = get("/DiagnosticReport?patient.given=Collet&_sort=-_lastUpdated").accept(FhirMediaTypes.XML).go();
assertThat(response, isOk());
assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));
assertThat(response.getContentAsString(), notNullValue());
Bundle results = readBundleResponse(response);
assertThat(results, notNullValue());
assertThat(results.getType(), equalTo(Bundle.BundleType.SEARCHSET));
assertThat(results.hasEntry(), is(true));
List<Bundle.BundleEntryComponent> entries = results.getEntry();
assertThat(entries, everyItem(hasResource(hasProperty("subject", hasProperty("reference", equalTo("Patient/5946f880-b197-400b-9caa-a3c661d23041"))))));
assertThat(entries, containsInRelativeOrder(hasResource(hasProperty("meta", hasProperty("lastUpdated", equalTo(Date.from(LocalDateTime.of(2018, 8, 18, 14, 9, 35).atZone(ZoneId.systemDefault()).toInstant()))))), hasResource(hasProperty("meta", hasProperty("lastUpdated", equalTo(Date.from(LocalDateTime.of(2008, 8, 18, 14, 9, 35).atZone(ZoneId.systemDefault()).toInstant())))))));
assertThat(entries, everyItem(hasResource(validResource())));
}
use of org.hl7.fhir.dstu2016may.model.Meta in project openmrs-module-fhir2 by openmrs.
the class TaskFhirResourceIntegrationTest method shouldSearchForFilteredAndSortedTasksAsJson.
@Test
public void shouldSearchForFilteredAndSortedTasksAsJson() throws Exception {
MockHttpServletResponse response = get("/Task?status=requested&_sort=_lastUpdated").accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), is(FhirMediaTypes.JSON.toString()));
assertThat(response.getContentAsString(), notNullValue());
Bundle results = readBundleResponse(response);
assertThat(results, notNullValue());
assertThat(results.getType(), is(Bundle.BundleType.SEARCHSET));
assertThat(results.hasEntry(), is(true));
List<Bundle.BundleEntryComponent> entries = results.getEntry();
assertThat(entries, hasSize(2));
assertThat(entries, everyItem(hasResource(hasProperty("status", is(Task.TaskStatus.REQUESTED)))));
assertThat(entries, containsInRelativeOrder(hasResource(hasProperty("meta", hasProperty("lastUpdated", equalTo(Date.from(LocalDateTime.of(2012, 5, 1, 0, 0, 0).atZone(ZoneId.systemDefault()).toInstant()))))), hasResource(hasProperty("meta", hasProperty("lastUpdated", equalTo(Date.from(LocalDateTime.of(2012, 7, 1, 0, 0, 0).atZone(ZoneId.systemDefault()).toInstant())))))));
}
use of org.hl7.fhir.dstu2016may.model.Meta in project openmrs-module-fhir2 by openmrs.
the class TaskFhirResourceIntegrationTest method shouldSearchForFilteredAndSortedTasksAsXML.
@Test
public void shouldSearchForFilteredAndSortedTasksAsXML() throws Exception {
MockHttpServletResponse response = get("/Task?status=requested&_sort=_lastUpdated").accept(FhirMediaTypes.XML).go();
assertThat(response, isOk());
assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));
assertThat(response.getContentAsString(), notNullValue());
Bundle results = readBundleResponse(response);
assertThat(results, notNullValue());
assertThat(results.getType(), is(Bundle.BundleType.SEARCHSET));
assertThat(results.hasEntry(), is(true));
List<Bundle.BundleEntryComponent> entries = results.getEntry();
assertThat(entries, hasSize(2));
assertThat(entries, everyItem(hasResource(hasProperty("status", is(Task.TaskStatus.REQUESTED)))));
assertThat(entries, containsInRelativeOrder(hasResource(hasProperty("meta", hasProperty("lastUpdated", equalTo(Date.from(LocalDateTime.of(2012, 5, 1, 0, 0, 0).atZone(ZoneId.systemDefault()).toInstant()))))), hasResource(hasProperty("meta", hasProperty("lastUpdated", equalTo(Date.from(LocalDateTime.of(2012, 7, 1, 0, 0, 0).atZone(ZoneId.systemDefault()).toInstant())))))));
}
use of org.hl7.fhir.dstu2016may.model.Meta in project org.hl7.fhir.core by hapifhir.
the class CCDAConverter method addReference.
protected String addReference(DomainResource r, String title, String id) throws Exception {
if (r.getText() == null)
r.setText(new Narrative());
if (r.getText().getDiv() == null) {
r.getText().setStatus(NarrativeStatus.GENERATED);
new NarrativeGenerator("", "", context).generate(r);
}
r.setMeta(new Meta().setLastUpdatedElement(InstantType.now()));
r.setId(id);
feed.getEntry().add(new BundleEntryComponent().setResource(r));
return id;
}
Aggregations