本文整理汇总了Java中ca.uhn.fhir.model.dstu2.resource.Observation.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java Observation.setValue方法的具体用法?Java Observation.setValue怎么用?Java Observation.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.uhn.fhir.model.dstu2.resource.Observation
的用法示例。
在下文中一共展示了Observation.setValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import ca.uhn.fhir.model.dstu2.resource.Observation; //导入方法依赖的package包/类
public static void main(String[] args) {
datatypes();
// START SNIPPET: observation
Observation observation = new Observation();
// Create a quantity datatype
QuantityDt q = new QuantityDt();
q.setValue(185);
q.setSystem("http://unitsofmeasure.org");
q.setCode("lbs");
// Put the datatype in the observation
observation.setValue(q);
// Set the reference range
observation.getReferenceRangeFirstRep().setLow(new QuantityDt(100));
observation.getReferenceRangeFirstRep().setHigh(new QuantityDt(200));
// END SNIPPET: observation
}
示例2: testPersistSearchParamQuantity
import ca.uhn.fhir.model.dstu2.resource.Observation; //导入方法依赖的package包/类
@Test
public void testPersistSearchParamQuantity() {
Observation obs = new Observation();
obs.getCode().addCoding().setSystem("foo").setCode("testPersistSearchParamQuantity");
obs.setValue(new QuantityDt(111));
ourObservationDao.create(obs);
List<Observation> found = toList(ourObservationDao.search("value-quantity", new QuantityDt(111)));
assertEquals(1, found.size());
found = toList(ourObservationDao.search("value-quantity", new QuantityDt(112)));
assertEquals(1, found.size());
found = toList(ourObservationDao.search("value-quantity", new QuantityDt(212)));
assertEquals(0, found.size());
}
示例3: testChoiceParamConcept
import ca.uhn.fhir.model.dstu2.resource.Observation; //导入方法依赖的package包/类
@Test
public void testChoiceParamConcept() {
Observation o1 = new Observation();
o1.getCode().addCoding().setSystem("foo").setCode("testChoiceParam01");
o1.setValue(new CodeableConceptDt("testChoiceParam01CCS", "testChoiceParam01CCV"));
IdDt id1 = ourObservationDao.create(o1).getId();
{
IBundleProvider found = ourObservationDao.search(Observation.SP_VALUE_CONCEPT, new TokenParam("testChoiceParam01CCS", "testChoiceParam01CCV"));
assertEquals(1, found.size());
assertEquals(id1, found.getResources(0, 1).get(0).getId());
}
}
示例4: testChoiceParamDate
import ca.uhn.fhir.model.dstu2.resource.Observation; //导入方法依赖的package包/类
@Test
public void testChoiceParamDate() {
Observation o2 = new Observation();
o2.getCode().addCoding().setSystem("foo").setCode("testChoiceParam02");
o2.setValue(new PeriodDt().setStart(new DateTimeDt("2001-01-01")).setEnd(new DateTimeDt("2001-01-03")));
IdDt id2 = ourObservationDao.create(o2).getId();
{
IBundleProvider found = ourObservationDao.search(Observation.SP_VALUE_DATE, new DateParam("2001-01-02"));
assertEquals(1, found.size());
assertEquals(id2, found.getResources(0, 1).get(0).getId());
}
}
示例5: testChoiceParamString
import ca.uhn.fhir.model.dstu2.resource.Observation; //导入方法依赖的package包/类
@Test
public void testChoiceParamString() {
Observation o4 = new Observation();
o4.getCode().addCoding().setSystem("foo").setCode("testChoiceParam04");
o4.setValue(new StringDt("testChoiceParam04Str"));
IdDt id4 = ourObservationDao.create(o4).getId();
{
IBundleProvider found = ourObservationDao.search(Observation.SP_VALUE_STRING, new StringParam("testChoiceParam04Str"));
assertEquals(1, found.size());
assertEquals(id4, found.getResources(0, 1).get(0).getId());
}
}
示例6: testPersistSearchParamObservationString
import ca.uhn.fhir.model.dstu2.resource.Observation; //导入方法依赖的package包/类
@Test
public void testPersistSearchParamObservationString() {
Observation obs = new Observation();
obs.getCode().addCoding().setSystem("foo").setCode("testPersistSearchParamQuantity");
obs.setValue(new StringDt("AAAABBBB"));
ourObservationDao.create(obs);
List<Observation> found = toList(ourObservationDao.search("value-string", new StringDt("AAAABBBB")));
assertEquals(1, found.size());
found = toList(ourObservationDao.search("value-string", new StringDt("AAAABBBBCCC")));
assertEquals(0, found.size());
}
示例7: testSearchValueQuantity
import ca.uhn.fhir.model.dstu2.resource.Observation; //导入方法依赖的package包/类
@Test
public void testSearchValueQuantity() {
String methodName = "testSearchValueQuantity";
QuantityParam param;
Set<Long> found;
param = new QuantityParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), null, null);
found = ourObservationDao.searchForIds("value-quantity", param);
int initialSize = found.size();
Observation o = new Observation();
o.getCode().addCoding().setSystem("urn:foo").setCode(methodName + "code");
QuantityDt q = new QuantityDt().setSystem("urn:bar:" + methodName).setCode(methodName + "units").setValue(100);
o.setValue(q);
ourObservationDao.create(o);
param = new QuantityParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), null, null);
found = ourObservationDao.searchForIds("value-quantity", param);
assertEquals(1 + initialSize, found.size());
param = new QuantityParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), null, methodName + "units");
found = ourObservationDao.searchForIds("value-quantity", param);
assertEquals(1, found.size());
param = new QuantityParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), "urn:bar:" + methodName, null);
found = ourObservationDao.searchForIds("value-quantity", param);
assertEquals(1, found.size());
param = new QuantityParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), "urn:bar:" + methodName, methodName + "units");
found = ourObservationDao.searchForIds("value-quantity", param);
assertEquals(1, found.size());
}
示例8: main
import ca.uhn.fhir.model.dstu2.resource.Observation; //导入方法依赖的package包/类
public static void main(String[] args) {
tmp();
datatypes();
// START SNIPPET: observation
// Create an Observation instance
Observation observation = new Observation();
// Give the observation a status
observation.setStatus(ObservationStatusEnum.FINAL);
// Give the observation a code (what kind of observation is this)
CodingDt coding = observation.getCode().addCoding();
coding.setCode("29463-7").setSystem("http://loinc.org").setDisplay("Body Weight");
// Create a quantity datatype
QuantityDt value = new QuantityDt();
value.setValue(83.9).setSystem("http://unitsofmeasure.org").setCode("kg");
observation.setValue(value);
// Set the reference range
SimpleQuantityDt low = new SimpleQuantityDt();
low.setValue(45).setSystem("http://unitsofmeasure.org").setCode("kg");
observation.getReferenceRangeFirstRep().setLow(low);
SimpleQuantityDt high = new SimpleQuantityDt();
low.setValue(90).setSystem("http://unitsofmeasure.org").setCode("kg");
observation.getReferenceRangeFirstRep().setHigh(high);
// END SNIPPET: observation
}
示例9: testCloneIntoValues
import ca.uhn.fhir.model.dstu2.resource.Observation; //导入方法依赖的package包/类
/**
* See #369
*/
@Test
public void testCloneIntoValues() {
Observation obs = new Observation();
obs.setValue(new StringDt("AAA"));
obs.setComments("COMMENTS");
Observation target = new Observation();
ourCtx.newTerser().cloneInto(obs, target, false);
assertEquals("AAA", ((StringDt)obs.getValue()).getValue());
assertEquals("COMMENTS", obs.getComments());
}