本文整理汇总了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
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
}