Search in sources :

Example 1 with ObservationStatus

use of org.hl7.fhir.dstu3.model.Observation.ObservationStatus in project openmrs-module-fhir2 by openmrs.

the class ObservationStatusTranslatorImplTest method shouldMapFhirRepresentationToNull.

@Test
public void shouldMapFhirRepresentationToNull() {
    Obs obs = new Obs();
    Observation.ObservationStatus observationStatus = Observation.ObservationStatus.FINAL;
    Obs result = observationStatusTranslator.toOpenmrsType(obs, observationStatus);
    assertThat(result, notNullValue());
}
Also used : Obs(org.openmrs.Obs) Observation(org.hl7.fhir.r4.model.Observation) Test(org.junit.Test)

Example 2 with ObservationStatus

use of org.hl7.fhir.dstu3.model.Observation.ObservationStatus in project eCRNow by drajer-health.

the class R4ResourcesData method filterObservationByStatus.

private Bundle filterObservationByStatus(Bundle bundle, String observationStatus) {
    Bundle filteredBundle = new Bundle();
    int observationInError = 0;
    List<BundleEntryComponent> filteredEntryComponents = new ArrayList<>();
    for (BundleEntryComponent entryComp : bundle.getEntry()) {
        Observation observation = (Observation) entryComp.getResource();
        if (observation.hasStatus()) {
            if (!observation.getStatus().toCode().equals(observationStatus)) {
                filteredEntryComponents.add(new BundleEntryComponent().setResource(observation));
            } else {
                observationInError++;
            }
        }
    }
    logger.info("Skipped {} Observation with status entered-in-error", observationInError);
    filteredBundle.setEntry(filteredEntryComponents);
    return filteredBundle;
}
Also used : BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)1 Observation (org.hl7.fhir.r4.model.Observation)1 Test (org.junit.Test)1 Obs (org.openmrs.Obs)1