本文整理汇总了Java中ca.uhn.fhir.model.primitive.DateDt类的典型用法代码示例。如果您正苦于以下问题:Java DateDt类的具体用法?Java DateDt怎么用?Java DateDt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DateDt类属于ca.uhn.fhir.model.primitive包,在下文中一共展示了DateDt类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: tTS2Date
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
public DateDt tTS2Date(TS ts){
DateDt date = (DateDt) tTS2BaseDateTime(ts,DateDt.class);
if(date == null)
return null;
// TimeZone is NOT permitted
if(date.getTimeZone() != null) {
date.setTimeZone(null);
}
// precision should be YEAR, MONTH or DAY. otherwise, set it to DAY
if(date.getPrecision() != TemporalPrecisionEnum.YEAR && date.getPrecision() != TemporalPrecisionEnum.MONTH && date.getPrecision() != TemporalPrecisionEnum.DAY) {
date.setPrecision(TemporalPrecisionEnum.DAY);
}
return date;
}
开发者ID:srdc,项目名称:cda2fhir,代码行数:18,代码来源:DataTypesTransformerImpl.java
示例2: testPatientRulesInheritanceInModel
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
@Test
public void testPatientRulesInheritanceInModel() {
Assert.assertNotNull(kSession);
System.out.println(" ---- Starting testPatientRulesInheritanceInModel() Test ---");
kSession.insert(new AsthmaticPatient()
.setDiagnosedDate(new DateDt(parseDate("2014-06-07")))
.setBirthDateWithDayPrecision(parseDate("1982-01-01"))
.setGender(AdministrativeGenderEnum.MALE)
.addAddress(new AddressDt().setCity("London"))
.setId("Patient/1")
);
Assert.assertEquals(5, kSession.fireAllRules());
System.out.println(" ---- Finished testPatientRulesInheritanceInModel() Test ---");
}
开发者ID:Salaboy,项目名称:drools-workshop,代码行数:17,代码来源:SimpleConditionsRulesJUnitTest.java
示例3: operationHttpGet
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
@SuppressWarnings("unused")
private static void operationHttpGet() {
// START SNIPPET: operationHttpGet
// Create a client to talk to the HeathIntersections server
FhirContext ctx = FhirContext.forDstu2();
IGenericClient client = ctx.newRestfulGenericClient("http://fhir-dev.healthintersections.com.au/open");
client.registerInterceptor(new LoggingInterceptor(true));
// Create the input parameters to pass to the server
Parameters inParams = new Parameters();
inParams.addParameter().setName("start").setValue(new DateDt("2001-01-01"));
inParams.addParameter().setName("end").setValue(new DateDt("2015-03-01"));
// Invoke $everything on "Patient/1"
Parameters outParams = client
.operation()
.onInstance(new IdDt("Patient", "1"))
.named("$everything")
.withParameters(inParams)
.useHttpGet() // Use HTTP GET instead of POST
.execute();
// END SNIPPET: operationHttpGet
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:24,代码来源:GenericClientExample.java
示例4: operation
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
@SuppressWarnings("unused")
private static void operation() {
// START SNIPPET: operation
// Create a client to talk to the HeathIntersections server
FhirContext ctx = FhirContext.forDstu2();
IGenericClient client = ctx.newRestfulGenericClient("http://fhir-dev.healthintersections.com.au/open");
client.registerInterceptor(new LoggingInterceptor(true));
// Create the input parameters to pass to the server
Parameters inParams = new Parameters();
inParams.addParameter().setName("start").setValue(new DateDt("2001-01-01"));
inParams.addParameter().setName("end").setValue(new DateDt("2015-03-01"));
// Invoke $everything on "Patient/1"
Parameters outParams = client
.operation()
.onInstance(new IdDt("Patient", "1"))
.named("$everything")
.withParameters(inParams)
.execute();
// END SNIPPET: operation
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:23,代码来源:GenericClientExample.java
示例5: testOutOfBoundsDate
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
/**
* See issue #50
*/
@Test
public void testOutOfBoundsDate() {
Patient p = new Patient();
p.setBirthDate(new DateDt("2000-15-31"));
String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(p);
ourLog.info(encoded);
assertThat(encoded, StringContains.containsString("2000-15-31"));
p = ourCtx.newXmlParser().parseResource(Patient.class, encoded);
assertEquals("2000-15-31", p.getBirthDateElement().getValueAsString());
assertEquals("2001-03-31", new SimpleDateFormat("yyyy-MM-dd").format(p.getBirthDate()));
ValidationResult result = ourCtx.newValidator().validateWithResult(p);
String resultString = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(result.getOperationOutcome());
ourLog.info(resultString);
assertEquals(2, result.getOperationOutcome().getIssue().size());
assertThat(resultString, StringContains.containsString("cvc-pattern-valid: Value '2000-15-31'"));
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:25,代码来源:ResourceValidatorDstu2Test.java
示例6: testPersistSearchParamDate
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
@Test
public void testPersistSearchParamDate() {
List<Patient> found = toList(ourPatientDao.search(Patient.SP_BIRTHDATE, new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2000-01-01")));
int initialSize2000 = found.size();
found = toList(ourPatientDao.search(Patient.SP_BIRTHDATE, new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2002-01-01")));
int initialSize2002 = found.size();
Patient patient = new Patient();
patient.addIdentifier().setSystem("urn:system").setValue("001");
patient.setBirthDate(new DateDt("2001-01-01"));
ourPatientDao.create(patient);
found = toList(ourPatientDao.search(Patient.SP_BIRTHDATE, new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2000-01-01")));
assertEquals(1 + initialSize2000, found.size());
found = toList(ourPatientDao.search(Patient.SP_BIRTHDATE, new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2002-01-01")));
assertEquals(initialSize2002, found.size());
// If this throws an exception, that would be an acceptable outcome as well..
found = toList(ourPatientDao.search(Patient.SP_BIRTHDATE + "AAAA", new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2000-01-01")));
assertEquals(0, found.size());
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:26,代码来源:FhirResourceDaoDstu2Test.java
示例7: testParametersOkDstu2
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
@Test
public void testParametersOkDstu2() {
Patient patient = new Patient();
patient.addName().addGiven("James");
patient.setBirthDate(new DateDt("2011-02-02"));
Parameters input = new Parameters();
input.addParameter().setName("resource").setResource(patient);
FhirValidator val = ourCtxDstu2.newValidator();
val.registerValidatorModule(ourValidator);
ValidationResult result = val.validateWithResult(input);
ourLog.info(ourCtxDstu2.newJsonParser().setPrettyPrint(true).encodeResourceToString(result.toOperationOutcome()));
assertTrue(result.isSuccessful());
}
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:19,代码来源:FhirInstanceValidatorTest.java
示例8: testParametersWithParameterTwoValues
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
@Test
@Ignore
public void testParametersWithParameterTwoValues() {
Patient patient = new Patient();
patient.addName().addGiven("James");
patient.setBirthDate(new DateDt("2011-02-02"));
Parameters input = new Parameters();
input.addParameter().setName("resource").setResource(patient).setValue(new StringDt("AAA"));
FhirValidator val = ourCtxDstu2.newValidator();
val.registerValidatorModule(ourValidator);
ValidationResult result = val.validateWithResult(input);
String encoded = ourCtxDstu2.newJsonParser().setPrettyPrint(true).encodeResourceToString(result.toOperationOutcome());
ourLog.info(encoded);
assertFalse(result.isSuccessful());
assertThat(encoded, containsString("A parameter must have a value or a resource, but not both"));
}
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:23,代码来源:FhirInstanceValidatorTest.java
示例9: convertFhirDateTime
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
/**
* Convert the timestamp into a FHIR DateType or DateTimeType.
*
* @param datetime
* Timestamp
* @param time
* If true, return a DateTimeDt; if false, return a DateDt.
* @return a DateDt or DateTimeDt representing the given timestamp
*/
private static IDatatype convertFhirDateTime(long datetime, boolean time) {
Date date = new Date(datetime);
if (time) {
return new DateTimeDt(date);
} else {
return new DateDt(date);
}
}
开发者ID:synthetichealth,项目名称:synthea_java,代码行数:19,代码来源:FhirDstu2.java
示例10: patientTypeOperation
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
@Operation(name="$everything", idempotent=true)
public Bundle patientTypeOperation(
@OperationParam(name="start") DateDt theStart,
@OperationParam(name="end") DateDt theEnd) {
Bundle retVal = new Bundle();
// Populate bundle with matching resources
return retVal;
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:10,代码来源:ServerOperations.java
示例11: patientInstanceOperation
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
@Operation(name="$everything", idempotent=true)
public Bundle patientInstanceOperation(
@IdParam IdDt thePatientId,
@OperationParam(name="start") DateDt theStart,
@OperationParam(name="end") DateDt theEnd) {
Bundle retVal = new Bundle();
// Populate bundle with matching resources
return retVal;
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:11,代码来源:ServerOperations.java
示例12: testParseResourceType
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
/**
* See #163
*/
@Test
public void testParseResourceType() {
IParser xmlParser = ourCtx.newXmlParser().setPrettyPrint(true);
// Patient
Patient patient = new Patient();
String patientId = UUID.randomUUID().toString();
patient.setId(new IdDt("Patient", patientId));
patient.addName().addGiven("John").addFamily("Smith");
patient.setGender(AdministrativeGenderEnum.MALE);
patient.setBirthDate(new DateDt("1987-04-16"));
// Bundle
ca.uhn.fhir.model.dstu2.resource.Bundle bundle = new ca.uhn.fhir.model.dstu2.resource.Bundle();
bundle.setType(BundleTypeEnum.COLLECTION);
bundle.addEntry().setResource(patient);
String bundleText = xmlParser.encodeResourceToString(bundle);
ourLog.info(bundleText);
ca.uhn.fhir.model.dstu2.resource.Bundle reincarnatedBundle = xmlParser.parseResource (ca.uhn.fhir.model.dstu2.resource.Bundle.class, bundleText);
Patient reincarnatedPatient = reincarnatedBundle.getAllPopulatedChildElementsOfType(Patient.class).get(0);
assertEquals("Patient", patient.getId().getResourceType());
assertEquals("Patient", reincarnatedPatient.getId().getResourceType());
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:30,代码来源:XmlParserDstu2Test.java
示例13: testParseResourceType
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
/**
* See #163
*/
@Test
public void testParseResourceType() {
IParser jsonParser = ourCtx.newJsonParser().setPrettyPrint(true);
// Patient
Patient patient = new Patient();
String patientId = UUID.randomUUID().toString();
patient.setId(new IdDt("Patient", patientId));
patient.addName().addGiven("John").addFamily("Smith");
patient.setGender(AdministrativeGenderEnum.MALE);
patient.setBirthDate(new DateDt("1987-04-16"));
// Bundle
ca.uhn.fhir.model.dstu2.resource.Bundle bundle = new ca.uhn.fhir.model.dstu2.resource.Bundle();
bundle.setType(BundleTypeEnum.COLLECTION);
bundle.addEntry().setResource(patient);
String bundleText = jsonParser.encodeResourceToString(bundle);
ourLog.info(bundleText);
ca.uhn.fhir.model.dstu2.resource.Bundle reincarnatedBundle = jsonParser.parseResource (ca.uhn.fhir.model.dstu2.resource.Bundle.class, bundleText);
Patient reincarnatedPatient = reincarnatedBundle.getAllPopulatedChildElementsOfType(Patient.class).get(0);
assertEquals("Patient", patient.getId().getResourceType());
assertEquals("Patient", reincarnatedPatient.getId().getResourceType());
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:30,代码来源:JsonParserDstu2Test.java
示例14: testTS2Date
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
@Test
public void testTS2Date() {
//simple instance test yyyymmdd
TS ts=DatatypesFactory.eINSTANCE.createTS();
ts.setValue("20160923");
DateDt date=dtt.tTS2Date(ts);
Assert.assertEquals("TS.value was not transformed","2016-09-23",date.getValueAsString());
// simple instance test 2 yyyymm
TS ts4 = DatatypesFactory.eINSTANCE.createTS();
ts4.setValue("201506");
DateDt date4=dtt.tTS2Date(ts4);
Assert.assertEquals("TS.value was not transformed","2015-06",date4.getValueAsString());
// simple instance test 3 yyyy
TS ts5 = DatatypesFactory.eINSTANCE.createTS();
ts5.setValue("2010");
DateDt date5=dtt.tTS2Date(ts5);
Assert.assertEquals("TS.value was not transformed","2010",date5.getValueAsString());
// simple instance test 4 yyyymmddhhmm
TS ts6 = DatatypesFactory.eINSTANCE.createTS();
ts6.setValue("201305141317");
DateDt date6=dtt.tTS2Date(ts6);
Assert.assertEquals("TS.value was not transformed","2013-05-14",date6.getValueAsString());
// simple instance test 5 yyyymmddhhmmss.s
TS ts7 = DatatypesFactory.eINSTANCE.createTS();
ts7.setValue("20130514131719.6");
DateDt date7=dtt.tTS2Date(ts7);
Assert.assertEquals("TS.value was not transformed","2013-05-14",date7.getValueAsString());
//null instance test
TS ts2=null;
DateDt date2=dtt.tTS2Date(ts2);
Assert.assertNull("TS null was not transformed",date2);
//nullFlavor instance test
TS ts3=DatatypesFactory.eINSTANCE.createTS();
ts3.setNullFlavor(NullFlavor.UNK);
DateDt date3=dtt.tTS2Date(ts3);
Assert.assertNull("TS.nullFlavor was not transformed",date3);
}
开发者ID:srdc,项目名称:cda2fhir,代码行数:45,代码来源:DataTypesTransformerTest.java
示例15: getDiagnosedDate
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
public DateDt getDiagnosedDate() {
return diagnosedDate;
}
开发者ID:Salaboy,项目名称:drools-workshop,代码行数:4,代码来源:AsthmaticPatient.java
示例16: setDiagnosedDate
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
public AsthmaticPatient setDiagnosedDate(DateDt diagnosedDate) {
this.diagnosedDate = diagnosedDate;
return this;
}
开发者ID:Salaboy,项目名称:drools-workshop,代码行数:5,代码来源:AsthmaticPatient.java
示例17: getModExt
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
public DateDt getModExt() {
return myModExt;
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:4,代码来源:MyPatientWithExtensions.java
示例18: setModExt
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
public void setModExt(DateDt theModExt) {
myModExt = theModExt;
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:4,代码来源:MyPatientWithExtensions.java
示例19: setExtAtt3
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
public void setExtAtt3(DateDt theExtAtt3) {
myExtAtt3 = theExtAtt3;
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:4,代码来源:MyPatientWithUnorderedExtensions.java
示例20: getBar11
import ca.uhn.fhir.model.primitive.DateDt; //导入依赖的package包/类
public List<DateDt> getBar11() {
return myBar11;
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:4,代码来源:ResourceWithExtensionsA.java
注:本文中的ca.uhn.fhir.model.primitive.DateDt类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论