Search in sources :

Example 81 with DateType

use of org.hl7.fhir.r4.model.DateType in project MobileAccessGateway by i4mi.

the class Iti78RequestConverter method transformDay.

public IVXBTS transformDay(Date date) {
    DateType dt = new DateType(date);
    IVXBTS result = new IVXBTS();
    result.setValue(dt.asStringValue().replace("-", ""));
    return result;
}
Also used : IVXBTS(net.ihe.gazelle.hl7v3.datatypes.IVXBTS) DateType(org.hl7.fhir.r4.model.DateType)

Example 82 with DateType

use of org.hl7.fhir.r4.model.DateType in project MobileAccessGateway by i4mi.

the class BaseQueryResponseConverter method transformToDate.

/**
 * XDS Timestamp -> FHIR Date
 * @param timestamp
 * @return
 */
public DateType transformToDate(Timestamp timestamp) {
    if (timestamp == null)
        return null;
    Date date = Date.from(timestamp.getDateTime().toInstant());
    Precision precision = timestamp.getPrecision();
    TemporalPrecisionEnum fhirPrecision;
    switch(precision) {
        case YEAR:
            fhirPrecision = TemporalPrecisionEnum.YEAR;
            break;
        case DAY:
            fhirPrecision = TemporalPrecisionEnum.DAY;
            break;
        // case SECOND: fhirPrecision = TemporalPrecisionEnum.SECOND;break;
        default:
            fhirPrecision = TemporalPrecisionEnum.DAY;
            break;
    }
    return new DateType(date, fhirPrecision);
}
Also used : Precision(org.openehealth.ipf.commons.ihe.xds.core.metadata.Timestamp.Precision) TemporalPrecisionEnum(ca.uhn.fhir.model.api.TemporalPrecisionEnum) DateType(org.hl7.fhir.r4.model.DateType) Date(java.util.Date)

Aggregations

DateType (org.hl7.fhir.r4.model.DateType)36 Test (org.junit.jupiter.api.Test)21 Date (java.util.Date)17 Coding (org.hl7.fhir.r4.model.Coding)15 Test (org.junit.Test)11 SupportingInformationComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent)10 DateType (org.hl7.fhir.r4b.model.DateType)10 FHIRException (org.hl7.fhir.exceptions.FHIRException)9 ArrayList (java.util.ArrayList)8 DateType (org.hl7.fhir.r5.model.DateType)8 DateType (org.hl7.fhir.dstu3.model.DateType)7 Extension (org.hl7.fhir.r4.model.Extension)6 Calendar (java.util.Calendar)5 DisplayName (org.junit.jupiter.api.DisplayName)5 InvalidRifValueException (gov.cms.bfd.model.rif.parse.InvalidRifValueException)4 DateType (org.hl7.fhir.dstu2016may.model.DateType)4 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)4 DateTimeType (org.hl7.fhir.r4.model.DateTimeType)4 Patient (org.hl7.fhir.r4.model.Patient)4 Reference (org.hl7.fhir.r4.model.Reference)4