本文整理汇总了Java中org.hl7.fhir.dstu3.model.DateTimeType类的典型用法代码示例。如果您正苦于以下问题:Java DateTimeType类的具体用法?Java DateTimeType怎么用?Java DateTimeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DateTimeType类属于org.hl7.fhir.dstu3.model包,在下文中一共展示了DateTimeType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBirthTime
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
public DateTimeType getBirthTime()
{
List<org.hl7.fhir.dstu3.model.Extension> extensions = adaptedClass
.getExtensionsByUrl("http://hl7.org/fhir/StructureDefinition/patient-birthTime");
if (extensions == null || extensions.size() <= 0)
{
return null;
}
else if (extensions.size() == 1)
{
return (org.hl7.fhir.dstu3.model.DateTimeType) extensions.get(0)
.getValue();
}
else
{
throw new RuntimeException(
"More than one extension exists for birthTime");
}
}
示例2: testGenerateMedicationPrescription
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
@Test
@Ignore
public void testGenerateMedicationPrescription() {
MedicationRequest mp = new MedicationRequest();
mp.setId("12345");
Medication med = new Medication();
med.getCode().setText("ciproflaxin");
Reference medRef = new Reference(med);
mp.setMedication(medRef);
mp.setStatus(MedicationRequestStatus.ACTIVE);
mp.setAuthoredOnElement(new DateTimeType("2014-09-01"));
Narrative narrative = new Narrative();
myGen.generateNarrative(ourCtx, mp, narrative);
assertTrue("Expected medication name of ciprofloaxin within narrative: " + narrative.getDiv().toString(), narrative.getDiv().toString().indexOf("ciprofloaxin") > -1);
assertTrue("Expected string status of ACTIVE within narrative: " + narrative.getDiv().toString(), narrative.getDiv().toString().indexOf("ACTIVE") > -1);
}
示例3: getStart
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
public Optional<String> getStart(DomainResource resource){
org.hl7.fhir.dstu3.model.Condition fhirCondition =
(org.hl7.fhir.dstu3.model.Condition) resource;
try {
if (fhirCondition.hasOnsetDateTimeType()) {
DateTimeType dateTime = fhirCondition.getOnsetDateTimeType();
if (dateTime != null) {
Date date = dateTime.getValue();
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy");
return Optional.of(format.format(date));
}
} else if (fhirCondition.hasOnsetStringType()) {
return Optional.of(fhirCondition.getOnsetStringType().getValue());
}
} catch (FHIRException e) {
LoggerFactory.getLogger(ConditionAccessor.class).error("Could not access start time.",
e);
}
return Optional.empty();
}
示例4: getEnd
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
public Optional<String> getEnd(DomainResource resource){
org.hl7.fhir.dstu3.model.Condition fhirCondition =
(org.hl7.fhir.dstu3.model.Condition) resource;
try {
if (fhirCondition.hasAbatementDateTimeType()) {
DateTimeType dateTime = fhirCondition.getAbatementDateTimeType();
if (dateTime != null) {
Date date = dateTime.getValue();
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy");
return Optional.of(format.format(date));
}
} else if (fhirCondition.hasAbatementStringType()) {
return Optional.of(fhirCondition.getAbatementStringType().getValue());
}
} catch (FHIRException e) {
LoggerFactory.getLogger(ConditionAccessor.class).error("Could not access end.", e);
}
return Optional.empty();
}
示例5: getEffectiveTime
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
public Optional<LocalDateTime> getEffectiveTime(DomainResource resource){
org.hl7.fhir.dstu3.model.Observation fhirObservation =
(org.hl7.fhir.dstu3.model.Observation) resource;
Type effective = fhirObservation.getEffective();
if (effective instanceof DateTimeType) {
return Optional.of(getLocalDateTime(((DateTimeType) effective).getValue()));
} else if (effective instanceof Period) {
Date start = ((Period) effective).getStart();
if (start != null) {
return Optional.of(getLocalDateTime(start));
}
Date end = ((Period) effective).getEnd();
if (end != null) {
return Optional.of(getLocalDateTime(end));
}
}
return Optional.empty();
}
示例6: convertFhirDateTime
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的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);
}
}
示例7: choiceValue
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
@Test
public void choiceValue() {
// Our test condition uses the DateTime choice, so use that type and column.
Assert.assertEquals(((DateTimeType) condition.getOnset()).getValueAsString(),
conditionsDataset.select("onsetDateTime").head().get(0));
Assert.assertEquals(condition.getOnset().toString(),
decodedCondition.getOnset().toString());
}
示例8: newCondition
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
/**
* Returns a FHIR Condition for testing purposes.
*/
public static Condition newCondition() {
Condition condition = new Condition();
// Condition based on example from FHIR:
// https://www.hl7.org/fhir/condition-example.json.html
condition.setId("Condition/example");
condition.setLanguage("en_US");
// Narrative text
Narrative narrative = new Narrative();
narrative.setStatusAsString("generated");
narrative.setDivAsString("This data was generated for test purposes.");
XhtmlNode node = new XhtmlNode();
node.setNodeType(NodeType.Text);
node.setValue("Severe burn of left ear (Date: 24-May 2012)");
condition.setText(narrative);
condition.setSubject(new Reference("Patient/example").setDisplay("Here is a display for you."));
condition.setVerificationStatus(Condition.ConditionVerificationStatus.CONFIRMED);
// Condition code
CodeableConcept code = new CodeableConcept();
code.addCoding()
.setSystem("http://snomed.info/sct")
.setCode("39065001")
.setDisplay("Severe");
condition.setSeverity(code);
// Severity code
CodeableConcept severity = new CodeableConcept();
severity.addCoding()
.setSystem("http://snomed.info/sct")
.setCode("24484000")
.setDisplay("Burn of ear")
.setUserSelected(true);
condition.setSeverity(severity);
// Onset date time
DateTimeType onset = new DateTimeType();
onset.setValueAsString("2012-05-24");
condition.setOnset(onset);
return condition;
}
示例9: getEffectiveDateTimeType
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
public DateTimeType getEffectiveDateTimeType()
{
try
{
return adaptedClass.getEffectiveDateTimeType();
}
catch (Exception e)
{
throw new RuntimeException("Error getting EffectiveDateTimeType", e);
}
}
示例10: getEffectiveDateTimeType
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
public DateTimeType getEffectiveDateTimeType()
{
try
{
return adaptedClass.getEffectiveDateTimeType();
}
catch (Exception e)
{
throw new RuntimeException(
"Error getting EffectiveTimeDateTimeType", e);
}
}
示例11: getAbatementDateTimeType
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
public DateTimeType getAbatementDateTimeType()
{
try
{
return adaptedClass.getAbatementDateTimeType();
}
catch (Exception e)
{
throw new RuntimeException("Error getting AbatementDateTimeType", e);
}
}
示例12: getOnsetDateTimeType
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
public DateTimeType getOnsetDateTimeType()
{
try
{
return adaptedClass.getOnsetDateTimeType();
}
catch (Exception e)
{
throw new RuntimeException("Error getting OnsetDateTimeType", e);
}
}
示例13: getOccurrenceDateTimeType
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
public DateTimeType getOccurrenceDateTimeType()
{
try
{
return adaptedClass.getOccurrenceDateTimeType();
}
catch (Exception e)
{
throw new RuntimeException("Error getting OccurrenceDateTimeType",
e);
}
}
示例14: getScheduledDateTimeType
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
public DateTimeType getScheduledDateTimeType()
{
try
{
return adaptedClass.getScheduledDateTimeType();
}
catch (Exception e)
{
throw new RuntimeException("Error getting ScheduledDateTimeType", e);
}
}
示例15: getDeceasedDateTimeType
import org.hl7.fhir.dstu3.model.DateTimeType; //导入依赖的package包/类
public DateTimeType getDeceasedDateTimeType()
{
try
{
return adaptedClass.getDeceasedDateTimeType();
}
catch (Exception e)
{
throw new RuntimeException("Error getting DeceasedDateTimeType", e);
}
}