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


Java DateType类代码示例

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


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

示例1: testPrecision

import org.hl7.fhir.dstu3.model.DateType; //导入依赖的package包/类
@Test
public void testPrecision() {

	// ourLog.info(""+ new TreeSet<String>(Arrays.asList(TimeZone.getAvailableIDs())));

	final Calendar cal = Calendar.getInstance();
	cal.setTimeZone(TimeZone.getTimeZone("GMT"));
	cal.set(1990, Calendar.JANUARY, 1, 0, 0, 0);
	ourLog.info("Time: {}", cal); // 631152000775

	DateType dateDt = new DateType(cal.getTime());
	long time = dateDt.getValue().getTime();
	ourLog.info("Time: {}", time); // 631152000775
	ourLog.info("Time: {}", dateDt.getValue()); // 631152000775

	dateDt.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
	time = dateDt.getValue().getTime();
	ourLog.info("Time: {}", time); // 631152000775
	ourLog.info("Time: {}", dateDt.getValue()); // 631152000775

	String valueAsString = dateDt.getValueAsString();
	ourLog.info(valueAsString);
	// is 631152000030

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:26,代码来源:DateTypeTest.java

示例2: search

import org.hl7.fhir.dstu3.model.DateType; //导入依赖的package包/类
@Search
public List<IBaseResource> search() {
	ArrayList<IBaseResource> retVal = new ArrayList<IBaseResource>();

	MyPatientWithExtensions p0 = new MyPatientWithExtensions();
	p0.setId(new IdType("Patient/0"));
	p0.setDateExt(new DateType("2011-01-01"));
	retVal.add(p0);

	Patient p1 = new Patient();
	p1.setId(new IdType("Patient/1"));
	p1.addName().setFamily("The Family");
	retVal.add(p1);

	return retVal;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:17,代码来源:CreateDstu3Test.java

示例3: convertFhirDateTime

import org.hl7.fhir.dstu3.model.DateType; //导入依赖的package包/类
/**
 * Convert the timestamp into a FHIR DateType or DateTimeType.
 * 
 * @param datetime
 *          Timestamp
 * @param time
 *          If true, return a DateTime; if false, return a Date.
 * @return a DateType or DateTimeType representing the given timestamp
 */
private static Type convertFhirDateTime(long datetime, boolean time) {
  Date date = new Date(datetime);

  if (time) {
    return new DateTimeType(date);
  } else {
    return new DateType(date);
  }
}
 
开发者ID:synthetichealth,项目名称:synthea_java,代码行数:19,代码来源:FhirStu3.java

示例4: getBirthDateElement

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

示例5: getAssertedDateElement

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

示例6: getStartDateType

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

示例7: getTargetDateType

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

示例8: getStatusDateElement

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

示例9: getExpirationDateElement

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

示例10: getCreatedElement

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

示例11: step3_create_patient

import org.hl7.fhir.dstu3.model.DateType; //导入依赖的package包/类
public static void step3_create_patient() {
	// Create a patient
	Patient newPatient = new Patient();

	// Populate the patient with fake information
	newPatient
		.addName()
			.setFamily("DevDays2015")
			.addGiven("John")
			.addGiven("Q");
	newPatient
		.addIdentifier()
			.setSystem("http://acme.org/mrn")
			.setValue("1234567");
	newPatient.setGender(Enumerations.AdministrativeGender.MALE);
	newPatient.setBirthDateElement(new DateType("2015-11-18"));

	// Create a client
	FhirContext ctx = FhirContext.forDstu3();
	IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu3");

	// Create the resource on the server
	MethodOutcome outcome = client
		.create()
		.resource(newPatient)
		.execute();

	// Log the ID that the server assigned
	IIdType id = outcome.getId();
	System.out.println("Created patient, got ID: " + id);
}
 
开发者ID:furore-fhir,项目名称:fhirstarters,代码行数:32,代码来源:TestApplicationHints.java

示例12: composeDateCore

import org.hl7.fhir.dstu3.model.DateType; //导入依赖的package包/类
protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
  if (value != null && value.hasValue()) {
      prop(name, value.asStringValue());
  }    
  else if (inArray) 
    writeNull(name); 
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:8,代码来源:JsonParser.java

示例13: composeDateExtras

import org.hl7.fhir.dstu3.model.DateType; //导入依赖的package包/类
protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
  if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
    open(inArray ? null : "_"+name);
    composeElement(value);
    close();
  }
  else if (inArray) 
    writeNull(name); 
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:10,代码来源:JsonParser.java

示例14: parseDate

import org.hl7.fhir.dstu3.model.DateType; //导入依赖的package包/类
protected DateType parseDate(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
  DateType res = new DateType(xpp.getAttributeValue(null, "value"));
  parseElementAttributes(xpp, res);
  next(xpp);
  int eventType = nextNoWhitespace(xpp);
  while (eventType != XmlPullParser.END_TAG) {
    if (!parseElementContent(eventType, xpp, res))
      unknownContent(xpp);
    eventType = nextNoWhitespace(xpp);
  }
  next(xpp);
  parseElementClose(res);
  return res;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:15,代码来源:XmlParser.java

示例15: composeDate

import org.hl7.fhir.dstu3.model.DateType; //导入依赖的package包/类
protected void composeDate(String name, DateType value) throws IOException  {
  if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || value.getValue() != null)) {// date
    composeElementAttributes(value);
    if (value.asStringValue() != null) 
      xml.attribute("value", value.asStringValue());
      
    xml.enter(FHIR_NS, name);
    composeElementElements(value);
    composeElementClose(value);
    xml.exit(FHIR_NS, name);
  }    
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:13,代码来源:XmlParser.java


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