use of org.hl7.fhir.dstu3.model.Quantity in project bunsen by cerner.
the class TestData method newObservation.
/**
* Returns a FHIR Observation for testing purposes.
*/
public static Observation newObservation() {
// Observation based on https://www.hl7.org/FHIR/observation-example-bloodpressure.json.html
Observation observation = new Observation();
observation.setId("blood-pressure");
Identifier identifier = observation.addIdentifier();
identifier.setSystem("urn:ietf:rfc:3986");
identifier.setValue("urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281");
observation.setStatus(Observation.ObservationStatus.FINAL);
Quantity quantity = new Quantity();
quantity.setValue(new java.math.BigDecimal("123.45"));
quantity.setUnit("mm[Hg]");
observation.setValue(quantity);
return observation;
}
use of org.hl7.fhir.dstu3.model.Quantity in project bunsen by cerner.
the class FhirEncodersTest method bigDecimal.
@Test
public void bigDecimal() {
BigDecimal originalDecimal = ((Quantity) observation.getValue()).getValue();
// Use compareTo since equals checks scale as well.
Assert.assertTrue(originalDecimal.compareTo((BigDecimal) observationsDataset.select("valueQuantity.value").head().get(0)) == 0);
Assert.assertEquals(originalDecimal.compareTo(((Quantity) decodedObservation.getValue()).getValue()), 0);
}
Aggregations