• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Quantity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.hl7.fhir.dstu3.model.Quantity的典型用法代码示例。如果您正苦于以下问题:Java Quantity类的具体用法?Java Quantity怎么用?Java Quantity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Quantity类属于org.hl7.fhir.dstu3.model包,在下文中一共展示了Quantity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:cerner,项目名称:bunsen,代码行数:24,代码来源:TestData.java


示例2: mapValueToFHIRType

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
private static Type mapValueToFHIRType(Object value, String unit) {
  if (value == null) {
    return null;
    
  } else if (value instanceof Condition) {
    Code conditionCode = ((HealthRecord.Entry) value).codes.get(0);
    return mapCodeToCodeableConcept(conditionCode, SNOMED_URI);
    
  } else if (value instanceof Code) {
    return mapCodeToCodeableConcept((Code) value, SNOMED_URI);
    
  } else if (value instanceof String) {
    return new StringType((String) value);
    
  } else if (value instanceof Number) {
    return new Quantity().setValue(((Number) value).doubleValue())
        .setCode(unit).setSystem(UNITSOFMEASURE_URI)
        .setUnit(unit);
    
  } else {
    throw new IllegalArgumentException("unexpected observation value class: "
        + value.getClass().toString() + "; " + value);
  }
}
 
开发者ID:synthetichealth,项目名称:synthea_java,代码行数:25,代码来源:FhirStu3.java


示例3: bigDecimal

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
@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);
}
 
开发者ID:cerner,项目名称:bunsen,代码行数:17,代码来源:FhirEncodersTest.java


示例4: findAddCode

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
@Override
public ConceptEntity findAddCode(Quantity quantity) {
    Coding code = new Coding().setCode(quantity.getCode()).setSystem(quantity.getSystem());
    ConceptEntity conceptEntity = findCode(code);

    // 12/Jan/2018 KGM to cope with LOINC codes and depreciated SNOMED codes.
    if (conceptEntity == null) {
        CodeSystemEntity system = codeSystemRepository.findBySystem(quantity.getSystem());
        if (system !=null) {
            conceptEntity = new ConceptEntity();
            conceptEntity.setCode(quantity.getCode());
            conceptEntity.setDescription(quantity.getUnit());
            conceptEntity.setDisplay(quantity.getUnit());
            conceptEntity.setCodeSystem(system);
            em.persist(conceptEntity);
        } else {
            throw new IllegalArgumentException("Unsupported system "+quantity.getSystem());
        }
    }
    return conceptEntity;
}
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:22,代码来源:ConceptDao.java


示例5: getMaxDeliveryVolume

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
public Quantity getMaxDeliveryVolume()
{
   List<org.hl7.fhir.dstu3.model.Extension> extensions = adaptedClass
         .getExtensionsByUrl("http://hl7.org/fhir/StructureDefinition/pharmacy-core-maxDeliveryVolume");
   if (extensions == null || extensions.size() <= 0)
   {
      return null;
   }
   else if (extensions.size() == 1)
   {
      return (org.hl7.fhir.dstu3.model.Quantity) extensions.get(0)
            .getValue();
   }
   else
   {
      throw new RuntimeException(
            "More than one extension exists for maxDeliveryVolume");
   }
}
 
开发者ID:cqframework,项目名称:qicore_model,代码行数:20,代码来源:qicoremedicationrequestDosageInstructionAdapter.java


示例6: getDetailQuantity

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
public Quantity getDetailQuantity()
{
   List<org.hl7.fhir.dstu3.model.Extension> extensions = rootObjectExtension
         .getExtensionsByUrl("http://hl7.org/fhir/StructureDefinition/goal-target#detail");
   if (extensions == null || extensions.size() <= 0)
   {
      return null;
   }
   else if (extensions.size() == 1)
   {
      return (org.hl7.fhir.dstu3.model.Quantity) extensions.get(0)
            .getValue();
   }
   else
   {
      throw new RuntimeException(
            "More than one extension exists for detail");
   }
}
 
开发者ID:cqframework,项目名称:qicore_model,代码行数:20,代码来源:qicoregoalTargetAdapter.java


示例7: 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
		}
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:19,代码来源:FhirTerserDstu3Test.java


示例8: 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;		
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:23,代码来源:Convert.java


示例9: getComponents

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
public List<ObservationComponent> getComponents(DomainResource resource){
	org.hl7.fhir.dstu3.model.Observation fhirObservation =
		(org.hl7.fhir.dstu3.model.Observation) resource;
	List<ObservationComponent> components = new ArrayList<>();
	
	for (ObservationComponentComponent o : fhirObservation.getComponent()) {
		ObservationComponent component = new ObservationComponent(o.getId());
		CodeableConcept codeableConcept = o.getCode();
		if (codeableConcept != null) {
			component.setCoding(ModelUtil.getCodingsFromConcept(codeableConcept));
			component.setExtensions(getExtensions(o));
			
			if (o.hasValueQuantity()) {
				Quantity quantity = (Quantity) o.getValue();
				component.setNumericValue(quantity.getValue());
				component.setNumericValueUnit(quantity.getUnit());
			} else if (o.hasValueStringType()) {
				StringType stringType = (StringType) o.getValue();
				component.setStringValue(stringType.getValue());
			}
		}
		components.add(component);
	}
	return components;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:26,代码来源:ObservationAccessor.java


示例10: setMaxDeliveryVolume

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
public qicoremedicationrequestDosageInstructionAdapter setMaxDeliveryVolume(
      Quantity param)
{
   adaptedClass
         .addExtension()
         .setUrl("http://hl7.org/fhir/StructureDefinition/pharmacy-core-maxDeliveryVolume")
         .setValue(param);
   return this;
}
 
开发者ID:cqframework,项目名称:qicore_model,代码行数:10,代码来源:qicoremedicationrequestDosageInstructionAdapter.java


示例11: getValueQuantity

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
public Quantity getValueQuantity()
{
   try
   {
      return adaptedClass.getValueQuantity();
   }
   catch (Exception e)
   {
      throw new RuntimeException("Error getting ValueQuantity", e);
   }
}
 
开发者ID:cqframework,项目名称:qicore_model,代码行数:12,代码来源:qicoreobservationAdapter.java


示例12: setDetail

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
public qicoregoalTargetAdapter setDetail(Quantity param)
{
   rootObjectExtension
         .addExtension()
         .setUrl("http://hl7.org/fhir/StructureDefinition/goal-target#detail")
         .setValue(param);
   return this;
}
 
开发者ID:cqframework,项目名称:qicore_model,代码行数:9,代码来源:qicoregoalTargetAdapter.java


示例13: setMaxDeliveryVolume

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
public qicoremedicationdispenseDosageInstructionAdapter setMaxDeliveryVolume(
      Quantity param)
{
   adaptedClass
         .addExtension()
         .setUrl("http://hl7.org/fhir/StructureDefinition/pharmacy-core-maxDeliveryVolume")
         .setValue(param);
   return this;
}
 
开发者ID:cqframework,项目名称:qicore_model,代码行数:10,代码来源:qicoremedicationdispenseDosageInstructionAdapter.java


示例14: testCloneIntoComposite

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
@Test
public void testCloneIntoComposite() {
	Quantity source = new Quantity();
	source.setCode("CODE");
	Money target = new Money();

	ourCtx.newTerser().cloneInto(source, target, true);

	assertEquals("CODE", target.getCode());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:11,代码来源:FhirTerserDstu3Test.java


示例15: 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);
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:32,代码来源:ObservationAccessor.java


示例16: 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);
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:9,代码来源:ObservationAccessor.java


示例17: getNumericValue

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
public Optional<BigDecimal> getNumericValue(DomainResource resource){
	org.hl7.fhir.dstu3.model.Observation fhirObservation =
		(org.hl7.fhir.dstu3.model.Observation) resource;
	if (fhirObservation.hasValueQuantity()) {
		Quantity quantity = (Quantity) fhirObservation.getValue();
		if (quantity.getValue() != null) {
			return Optional.of(quantity.getValue());
		}
	}
	return Optional.empty();
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:12,代码来源:ObservationAccessor.java


示例18: getNumericValueUnit

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
public Optional<String> getNumericValueUnit(DomainResource resource){
	org.hl7.fhir.dstu3.model.Observation fhirObservation =
		(org.hl7.fhir.dstu3.model.Observation) resource;
	if (fhirObservation.hasValueQuantity()) {
		Quantity quantity = (Quantity) fhirObservation.getValue();
		if (quantity.getUnit() != null) {
			return Optional.of(quantity.getUnit());
		}
	}
	return Optional.empty();
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:12,代码来源:ObservationAccessor.java


示例19: extractValues

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
@Override
public Set<AbstractSearchParam> extractValues(IBaseResource instance, RuntimeSearchParam searchParam) {

	Set<AbstractSearchParam> values = new HashSet<AbstractSearchParam>();

	String path = searchParam.getPath();
	String resourceName = searchParam.getName();
	String paramType = getParamType(searchParam);

	for (Object obj : extractValues(path, instance)) {
		if (obj == null || ((IBase) obj).isEmpty()) {
			continue;
		}

		boolean multiType = false;
		if (path.endsWith("[x]")) {
			multiType = true;
		}

		if (obj instanceof Quantity) {
			Quantity quantity = (Quantity) obj;
			if (quantity.getValueElement().isEmpty()) {
				continue;
			}

			SearchParamQuantity defq = new SearchParamQuantity(resourceName, path,
					SearchParamTypes.valueOf(paramType), quantity.getValueElement().getValue().doubleValue(),
					quantity.getSystemElement().getValueAsString(), quantity.getCode());
			values.add(defq);

		} else {
			if (!multiType) {
				throw new SearchParameterException(
						"Search param " + resourceName + " is of unexpected datatype: " + obj.getClass());
			} else {
				continue;
			}
		}
	}
	return values;
}
 
开发者ID:jmiddleton,项目名称:cassandra-fhir-index,代码行数:42,代码来源:QuantitySearchParameterExtractor.java


示例20: setValue

import org.hl7.fhir.dstu3.model.Quantity; //导入依赖的package包/类
@Override
public void setValue(Object target, String path, Object value) {
    if (target == null) {
        return;
    }

    IBase base = (IBase) target;
    BaseRuntimeElementCompositeDefinition definition;
    if (base instanceof IPrimitiveType) {
        ((IPrimitiveType) target).setValue(fromJavaPrimitive(value, base));
        return;
    }
    else {
        definition = resolveRuntimeDefinition(base);
    }

    BaseRuntimeChildDefinition child = definition.getChildByName(path);
    if (child == null) {
        child = resolveChoiceProperty(definition, path);
    }

    try {
        if (value instanceof Iterable) {
            for (Object val : (Iterable) value) {
                child.getMutator().addValue(base, (IBase) fromJavaPrimitive(val, base));
            }
        }
        else {
            child.getMutator().setValue(base, (IBase) fromJavaPrimitive(value, base));
        }
    } catch (ConfigurationException ce) {
        if (value instanceof Quantity) {
            try {
                value = ((Quantity) value).castToSimpleQuantity((Base) value);
            } catch (FHIRException e) {
                throw new IllegalArgumentException("Unable to cast Quantity to SimpleQuantity");
            }
            child.getMutator().setValue(base, (IBase) fromJavaPrimitive(value, base));
        }
        else {
            throw new ConfigurationException(ce.getMessage());
        }
    }
}
 
开发者ID:DBCG,项目名称:cql_engine,代码行数:45,代码来源:BaseFhirDataProvider.java



注:本文中的org.hl7.fhir.dstu3.model.Quantity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Constant类代码示例发布时间:2022-05-23
下一篇:
Java EnvironmentConfiguration类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap