use of ca.uhn.fhir.rest.param.DateParam in project openmrs-module-fhir2 by openmrs.
the class DiagnosticReportSearchQueryTest method searchForDiagnosticReports_shouldReturnEmptyCollectionByWrongIssueDate.
@Test
public void searchForDiagnosticReports_shouldReturnEmptyCollectionByWrongIssueDate() {
DateRangeParam issueDate = new DateRangeParam(new DateParam(DIAGNOSTIC_REPORT_WRONG_DATETIME));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.DATE_RANGE_SEARCH_HANDLER, issueDate);
IBundleProvider diagnosticReports = search(theParams);
assertThat(diagnosticReports, notNullValue());
assertThat(diagnosticReports.size(), equalTo(0));
List<DiagnosticReport> resultList = get(diagnosticReports);
assertThat(resultList, empty());
}
use of ca.uhn.fhir.rest.param.DateParam in project openmrs-module-fhir2 by openmrs.
the class DiagnosticReportSearchQueryTest method searchForDiagnosticReports_shouldReturnDiagnosticReportByIssueDate.
@Test
public void searchForDiagnosticReports_shouldReturnDiagnosticReportByIssueDate() {
DateRangeParam issueDate = new DateRangeParam(new DateParam(DIAGNOSTIC_REPORT_DATETIME));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.DATE_RANGE_SEARCH_HANDLER, issueDate);
IBundleProvider diagnosticReports = search(theParams);
List<DiagnosticReport> resultList = get(diagnosticReports);
assertThat(diagnosticReports, notNullValue());
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(resultList.get(0).getIssued().toString(), equalTo(DIAGNOSTIC_REPORT_DATE));
}
use of ca.uhn.fhir.rest.param.DateParam in project openmrs-module-fhir2 by openmrs.
the class ObservationSearchQueryTest method searchForObs_shouldSearchForObsByValueDate.
@Test
public void searchForObs_shouldSearchForObsByValueDate() {
SearchParameterMap theParams = new SearchParameterMap();
theParams.addParameter(FhirConstants.DATE_RANGE_SEARCH_HANDLER, "valueDatetime", new DateRangeParam(new DateParam(VALUE_DATE)));
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), equalTo(1));
List<IBaseResource> resultList = get(results);
assertThat(resultList, not(empty()));
assertThat(resultList, hasItem(hasProperty("id", equalTo(OBS_VALUE_CONCEPT_UUID))));
assertThat(((Observation) resultList.get(0)).getIssued().toString(), startsWith(VALUE_DATE));
}
use of ca.uhn.fhir.rest.param.DateParam in project openmrs-module-fhir2 by openmrs.
the class ObservationSearchQueryTest method searchForObs_shouldSearchByObsDateAndTime.
@Test
public void searchForObs_shouldSearchByObsDateAndTime() {
SearchParameterMap theParams = new SearchParameterMap();
theParams.addParameter(FhirConstants.DATE_RANGE_SEARCH_HANDLER, "obsDatetime", new DateRangeParam(new DateParam(OBS_DATE_AND_TIME)));
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), equalTo(12));
List<IBaseResource> resultList = get(results);
assertThat(resultList, not(empty()));
assertThat(resultList.size(), equalTo(10));
assertThat(resultList, hasItem(hasProperty("id", equalTo(OBS_VALUE_CONCEPT_UUID))));
assertThat(((Observation) resultList.get(0)).getEffectiveDateTimeType().getValue().toString(), equalTo(EXPECTED_OBS_DATE_AND_TIME));
}
use of ca.uhn.fhir.rest.param.DateParam in project openmrs-module-fhir2 by openmrs.
the class PatientSearchQueryTest method searchForPatients_shouldSearchForPatientsByBirthDate.
@Test
public void searchForPatients_shouldSearchForPatientsByBirthDate() {
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.DATE_RANGE_SEARCH_HANDLER, "birthdate", new DateRangeParam(new DateParam(PATIENT_BIRTHDATE)));
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), greaterThanOrEqualTo(1));
List<Patient> resultList = get(results);
assertThat(resultList, not(empty()));
assertThat(resultList, hasItem(hasProperty("id", equalTo(PATIENT_BIRTHDATE_PATIENT_UUID))));
}
Aggregations