本文整理汇总了Java中org.hl7.fhir.dstu3.model.DateType类的典型用法代码示例。如果您正苦于以下问题:Java DateType类的具体用法?Java DateType怎么用?Java DateType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DateType类属于org.hl7.fhir.dstu3.model包,在下文中一共展示了DateType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: testDateType
import org.hl7.fhir.dstu3.model.DateType; //导入依赖的package包/类
@Test
public void testDateType() {
DateType birthDate = new DateType(1974, 11, 25);
assertThat(birthDate.getYear(), is(1974));
assertThat(birthDate.getMonth(), is(11));
assertThat(birthDate.getDay(), is(25));
}
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:8,代码来源:DateTypeTest.java
示例17: read
import org.hl7.fhir.dstu3.model.DateType; //导入依赖的package包/类
@Read()
public MyPatientWithExtensions read(@IdParam IdType theIdParam) {
MyPatientWithExtensions p0 = new MyPatientWithExtensions();
p0.setId(theIdParam);
p0.setDateExt(new DateType("2011-01-01"));
return p0;
}
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:8,代码来源:CreateDstu3Test.java
示例18: main
import org.hl7.fhir.dstu3.model.DateType; //导入依赖的package包/类
public static void main(String[] args) {
// START SNIPPET: usage
// Create a context. Note that we declare the custom types we'll be using
// on the context before actually using them
FhirContext ctx = FhirContext.forDstu3();
ctx.registerCustomType(CustomResource.class);
ctx.registerCustomType(CustomDatatype.class);
// Now let's create an instance of our custom resource type
// and populate it with some data
CustomResource res = new CustomResource();
// Add some values, including our custom datatype
DateType value0 = new DateType("2015-01-01");
res.getTelevision().add(value0);
CustomDatatype value1 = new CustomDatatype();
value1.setDate(new DateTimeType(new Date()));
value1.setKittens(new StringType("FOO"));
res.getTelevision().add(value1);
res.setDogs(new StringType("Some Dogs"));
// Now let's serialize our instance
String output = ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(res);
System.out.println(output);
// END SNIPPET: usage
}
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:31,代码来源:CustomUsage.java
示例19: makeDateFromTS
import org.hl7.fhir.dstu3.model.DateType; //导入依赖的package包/类
public DateType makeDateFromTS(Element ts) throws Exception {
if (ts == null)
return null;
String v = ts.getAttribute("value");
if (Utilities.noString(v))
return null;
DateType d = DateType.parseV3(v);
return d;
}
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:11,代码来源:Convert.java
示例20: createBasicTestConsent
import org.hl7.fhir.dstu3.model.DateType; //导入依赖的package包/类
/**
* createBasicTestConsent(UUID identifier)
*
* @return Consent containing a basic consent
*/
private Consent createBasicTestConsent(UUID identifier)
{
Consent consent = new Consent();
consent.setId((identifier != null) ? identifier.toString()
: null);
DateTime testDocId = DateTime.now(DateTimeZone.UTC);
consent.getIdentifier().setSystem(uriPrefix + iExHubDomainOid)
.setValue("2.25." + Long.toString(testDocId.getMillis()));
consent.getCategoryFirstRep().addCoding().setSystem("urn:oid:2.16.840.1.113883.5.4").setCode("IDSCL");
consent.addPurpose(new Coding()
.setSystem("http://hl7.org/fhir/contractsubtypecodes")
.setCode("TREAT")
.setDisplay("Consent for TREAT"));
consent.setDateTime(new Date());
// specify the covered entity authorized to disclose
// add source resource and authority reference
consent.getContained().add(sourceOrganizationResource);
consent.addRecipient(new Reference().setReference("#" + sourceOrganizationId));
//This is required if the organization was not already added as a "contained" resource reference by the Patient
//consent.getContained().getContainedResources().add(sourceOrganizationResource);
// specify the provider who authored the data
consent.addRecipient(new Reference().setReference("#" + sourcePractitionerId));
consent.getContained().add(sourcePractitionerResource);
// specify the patient identified in the consent
/*
consent.getSignerFirstRep().setType(new CodingDt("http://hl7.org/fhir/contractsignertypecodes","1.2.840.10065.1.12.1.7"));
consent.getSignerFirstRep().setParty(patientReference);
*/
Reference consentSignature = new Reference();
consentSignature.setDisplay(testPatientResource.getNameFirstRep().getNameAsSingleString());
consentSignature.setReference("#" + testPatientResource.getId());
consent.getConsentor().add(consentSignature);
//add test patient as a contained resource rather than external reference
consent.getContained().add(testPatientResource);
// set terms of consent and intended recipient(s)
consent.getPeriod().setStart(new DateType("2015-10-10").toCalendar().getTime());
consent.getPeriod().setEnd(new DateType("2016-10-10").toCalendar().getTime());
// list all recipients
consent.getRecipient().add(new Reference().setReference("#" + recipientPractitionerId));
consent.getContained().add(recipientPractitionerResource);
consent.getConsentorFirstRep().setDisplay("description of the consent terms");
return consent;
}
开发者ID:bhits,项目名称:iexhub,代码行数:52,代码来源:ConsentDstu3Test.java
注:本文中的org.hl7.fhir.dstu3.model.DateType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论