本文整理汇总了Java中org.hl7.fhir.dstu3.model.Quantity.setUnit方法的典型用法代码示例。如果您正苦于以下问题:Java Quantity.setUnit方法的具体用法?Java Quantity.setUnit怎么用?Java Quantity.setUnit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hl7.fhir.dstu3.model.Quantity
的用法示例。
在下文中一共展示了Quantity.setUnit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newObservation
import org.hl7.fhir.dstu3.model.Quantity; //导入方法依赖的package包/类
/**
* 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;
}
示例2: testCloneIntoCompositeMismatchedFields
import org.hl7.fhir.dstu3.model.Quantity; //导入方法依赖的package包/类
@Test
public void testCloneIntoCompositeMismatchedFields() {
Quantity source = new Quantity();
source.setSystem("SYSTEM");
source.setUnit("UNIT");
Identifier target = new Identifier();
ourCtx.newTerser().cloneInto(source, target, true);
assertEquals("SYSTEM", target.getSystem());
try {
ourCtx.newTerser().cloneInto(source, target, false);
fail();
} catch (DataFormatException e) {
// good
}
}
示例3: makeQuantityFromPQ
import org.hl7.fhir.dstu3.model.Quantity; //导入方法依赖的package包/类
public Quantity makeQuantityFromPQ(Element pq, String units) throws Exception {
if (pq == null)
return null;
Quantity qty = new Quantity();
String n = pq.getAttribute("value").replace(",", "").trim();
try {
qty.setValue(new BigDecimal(n));
} catch (Exception e) {
throw new Exception("Unable to process value '"+n+"'", e);
}
units = Utilities.noString(pq.getAttribute("unit")) ? units : pq.getAttribute("unit");
if (!Utilities.noString(units)) {
if (ucumSvc == null || ucumSvc.validate(units) != null)
qty.setUnit(units);
else {
qty.setCode(units);
qty.setSystem("http://unitsofmeasure.org");
qty.setUnit(ucumSvc.getCommonDisplay(units));
}
}
return qty;
}
示例4: setNumericValue
import org.hl7.fhir.dstu3.model.Quantity; //导入方法依赖的package包/类
public void setNumericValue(DomainResource resource, BigDecimal value, String unit){
org.hl7.fhir.dstu3.model.Observation fhirObservation =
(org.hl7.fhir.dstu3.model.Observation) resource;
Quantity q = new Quantity();
q.setUnit(unit);
q.setValue(value);
fhirObservation.setValue(q);
}