当前位置: 首页>>代码示例>>Java>>正文


Java Quantity类代码示例

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


Quantity类属于org.hl7.fhir.dstu3.model包,在下文中一共展示了Quantity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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