use of org.hl7.fhir.r5.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.r5.model.Quantity in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method createExtensionQuantity.
/**
* @param ccwVariable the {@link CcwCodebookInterface} being mapped
* @param quantityValue the value to use for {@link Coding#getCode()} for the resulting {@link
* Coding}
* @return the output {@link Extension}, with {@link Extension#getValue()} set to represent the
* specified input values
*/
static Extension createExtensionQuantity(CcwCodebookInterface ccwVariable, Optional<? extends Number> quantityValue) {
if (!quantityValue.isPresent())
throw new IllegalArgumentException();
Quantity quantity;
if (quantityValue.get() instanceof BigDecimal)
quantity = new Quantity().setValue((BigDecimal) quantityValue.get());
else
throw new BadCodeMonkeyException();
String extensionUrl = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
Extension extension = new Extension(extensionUrl, quantity);
return extension;
}
use of org.hl7.fhir.r5.model.Quantity in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method addExtensionValueQuantity.
/**
* Adds an {@link Extension} to the specified {@link DomainResource}. {@link Extension#getValue()}
* will be set to a {@link Quantity} with the specified system and value.
*
* @param fhirElement the FHIR element to add the {@link Extension} to
* @param extensionUrl the {@link Extension#getUrl()} to use
* @param quantitySystem the {@link Quantity#getSystem()} to use
* @param quantityValue the {@link Quantity#getValue()} to use
*/
static void addExtensionValueQuantity(IBaseHasExtensions fhirElement, String extensionUrl, String quantitySystem, BigDecimal quantityValue) {
IBaseExtension<?, ?> extension = fhirElement.addExtension();
extension.setUrl(extensionUrl);
extension.setValue(new Quantity().setSystem(extensionUrl).setValue(quantityValue));
// CodeableConcept codeableConcept = new CodeableConcept();
// extension.setValue(codeableConcept);
//
// Coding coding = codeableConcept.addCoding();
// coding.setSystem(codingSystem).setCode(codingCode);
}
use of org.hl7.fhir.r5.model.Quantity in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsV2 method createExtensionQuantity.
/**
* @param ccwVariable the {@link CcwCodebookInterface} being mapped
* @param quantityValue the value to use for {@link Coding#getCode()} for the resulting {@link
* Coding}
* @return the output {@link Extension}, with {@link Extension#getValue()} set to represent the
* specified input values
*/
static Extension createExtensionQuantity(CcwCodebookInterface ccwVariable, Optional<? extends Number> quantityValue) {
if (!quantityValue.isPresent()) {
throw new IllegalArgumentException();
}
Quantity quantity;
if (quantityValue.get() instanceof BigDecimal) {
quantity = new Quantity().setValue((BigDecimal) quantityValue.get());
} else {
throw new BadCodeMonkeyException();
}
String extensionUrl = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
Extension extension = new Extension(extensionUrl, quantity);
return extension;
}
use of org.hl7.fhir.r5.model.Quantity in project beneficiary-fhir-data by CMSgov.
the class OutpatientClaimTransformerV2Test method shouldHaveLineItemQuantity.
@Test
public void shouldHaveLineItemQuantity() {
Quantity quantity = eob.getItemFirstRep().getQuantity();
Quantity compare = new Quantity(77);
assertTrue(compare.equalsDeep(quantity));
}
Aggregations