本文整理汇总了Java中org.hl7.fhir.dstu3.model.Quantity.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java Quantity.setValue方法的具体用法?Java Quantity.setValue怎么用?Java Quantity.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hl7.fhir.dstu3.model.Quantity
的用法示例。
在下文中一共展示了Quantity.setValue方法的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: 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;
}
示例3: addComponent
import org.hl7.fhir.dstu3.model.Quantity; //导入方法依赖的package包/类
public void addComponent(DomainResource resource, ObservationComponent iComponent){
org.hl7.fhir.dstu3.model.Observation fhirObservation =
(org.hl7.fhir.dstu3.model.Observation) resource;
ObservationComponentComponent observationComponentComponent =
new ObservationComponentComponent();
observationComponentComponent.setId(UUID.randomUUID().toString());
CodeableConcept codeableConcept = observationComponentComponent.getCode();
if (codeableConcept == null) {
codeableConcept = new CodeableConcept();
}
ModelUtil.setCodingsToConcept(codeableConcept, iComponent.getCoding());
observationComponentComponent.setCode(codeableConcept);
setExtensions(iComponent, observationComponentComponent);
if (iComponent.getStringValue().isPresent()) {
StringType stringType = new StringType();
stringType.setValue(iComponent.getStringValue().get());
observationComponentComponent.setValue(stringType);
} else if (iComponent.getNumericValue().isPresent()
|| iComponent.getNumericValueUnit().isPresent()) {
Quantity quantity = new Quantity();
quantity.setValue(iComponent.getNumericValue().isPresent()
? iComponent.getNumericValue().get() : null);
iComponent.getNumericValueUnit()
.ifPresent(item -> quantity.setUnit(iComponent.getNumericValueUnit().get()));
observationComponentComponent.setValue(quantity);
}
fhirObservation.addComponent(observationComponentComponent);
}
示例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);
}