Search in sources :

Example 71 with DateType

use of org.hl7.fhir.r5.model.DateType in project org.hl7.fhir.core by hapifhir.

the class ClaimResponse method setProperty.

@Override
public void setProperty(String name, Base value) throws FHIRException {
    if (name.equals("identifier"))
        this.getIdentifier().add(castToIdentifier(value));
    else if (name.equals("request"))
        // Reference
        this.request = castToReference(value);
    else if (name.equals("ruleset"))
        // Coding
        this.ruleset = castToCoding(value);
    else if (name.equals("originalRuleset"))
        // Coding
        this.originalRuleset = castToCoding(value);
    else if (name.equals("created"))
        // DateTimeType
        this.created = castToDateTime(value);
    else if (name.equals("organization"))
        // Reference
        this.organization = castToReference(value);
    else if (name.equals("requestProvider"))
        // Reference
        this.requestProvider = castToReference(value);
    else if (name.equals("requestOrganization"))
        // Reference
        this.requestOrganization = castToReference(value);
    else if (name.equals("outcome"))
        // Enumeration<RemittanceOutcome>
        this.outcome = new RemittanceOutcomeEnumFactory().fromType(value);
    else if (name.equals("disposition"))
        // StringType
        this.disposition = castToString(value);
    else if (name.equals("payeeType"))
        // Coding
        this.payeeType = castToCoding(value);
    else if (name.equals("item"))
        this.getItem().add((ItemsComponent) value);
    else if (name.equals("addItem"))
        this.getAddItem().add((AddedItemComponent) value);
    else if (name.equals("error"))
        this.getError().add((ErrorsComponent) value);
    else if (name.equals("totalCost"))
        // Money
        this.totalCost = castToMoney(value);
    else if (name.equals("unallocDeductable"))
        // Money
        this.unallocDeductable = castToMoney(value);
    else if (name.equals("totalBenefit"))
        // Money
        this.totalBenefit = castToMoney(value);
    else if (name.equals("paymentAdjustment"))
        // Money
        this.paymentAdjustment = castToMoney(value);
    else if (name.equals("paymentAdjustmentReason"))
        // Coding
        this.paymentAdjustmentReason = castToCoding(value);
    else if (name.equals("paymentDate"))
        // DateType
        this.paymentDate = castToDate(value);
    else if (name.equals("paymentAmount"))
        // Money
        this.paymentAmount = castToMoney(value);
    else if (name.equals("paymentRef"))
        // Identifier
        this.paymentRef = castToIdentifier(value);
    else if (name.equals("reserved"))
        // Coding
        this.reserved = castToCoding(value);
    else if (name.equals("form"))
        // Coding
        this.form = castToCoding(value);
    else if (name.equals("note"))
        this.getNote().add((NotesComponent) value);
    else if (name.equals("coverage"))
        this.getCoverage().add((CoverageComponent) value);
    else
        super.setProperty(name, value);
}
Also used : RemittanceOutcomeEnumFactory(org.hl7.fhir.dstu2.model.Enumerations.RemittanceOutcomeEnumFactory)

Example 72 with DateType

use of org.hl7.fhir.r5.model.DateType in project org.hl7.fhir.core by hapifhir.

the class PatientRenderer method describe.

public void describe(XhtmlNode x, ResourceWrapper pat) throws UnsupportedEncodingException, IOException {
    Identifier id = null;
    PropertyWrapper pw = getProperty(pat, "identifier");
    for (BaseWrapper t : pw.getValues()) {
        id = chooseId(id, (Identifier) t.getBase());
    }
    pw = getProperty(pat, "name");
    HumanName n = null;
    for (BaseWrapper t : pw.getValues()) {
        n = chooseName(n, (HumanName) t.getBase());
    }
    String gender = null;
    pw = getProperty(pat, "gender");
    if (valued(pw)) {
        gender = pw.value().getBase().primitiveValue();
    }
    DateType dt = null;
    pw = getProperty(pat, "birthDate");
    if (valued(pw)) {
        dt = (DateType) pw.value().getBase();
    }
    describe(x, n, gender, dt, id);
}
Also used : PropertyWrapper(org.hl7.fhir.r5.renderers.utils.BaseWrappers.PropertyWrapper) HumanName(org.hl7.fhir.r5.model.HumanName) BaseWrapper(org.hl7.fhir.r5.renderers.utils.BaseWrappers.BaseWrapper) Identifier(org.hl7.fhir.r5.model.Identifier) DateType(org.hl7.fhir.r5.model.DateType)

Example 73 with DateType

use of org.hl7.fhir.r5.model.DateType in project org.hl7.fhir.core by hapifhir.

the class QuestionnaireBuilder method convertType.

@SuppressWarnings("unchecked")
private Type convertType(Base value, QuestionnaireItemType af, ValueSet vs, String path) throws FHIRException {
    switch(af) {
        // simple cases
        case BOOLEAN:
            if (value instanceof BooleanType)
                return (Type) value;
            break;
        case DECIMAL:
            if (value instanceof DecimalType)
                return (Type) value;
            break;
        case INTEGER:
            if (value instanceof IntegerType)
                return (Type) value;
            break;
        case DATE:
            if (value instanceof DateType)
                return (Type) value;
            break;
        case DATETIME:
            if (value instanceof DateTimeType)
                return (Type) value;
            break;
        case TIME:
            if (value instanceof TimeType)
                return (Type) value;
            break;
        case STRING:
            if (value instanceof StringType)
                return (Type) value;
            else if (value instanceof UriType)
                return new StringType(((UriType) value).asStringValue());
            break;
        case TEXT:
            if (value instanceof StringType)
                return (Type) value;
            break;
        case QUANTITY:
            if (value instanceof Quantity)
                return (Type) value;
            break;
        // ? QuestionnaireItemTypeAttachment: ...?
        case CHOICE:
        case OPENCHOICE:
            if (value instanceof Coding)
                return (Type) value;
            else if (value instanceof Enumeration) {
                Coding cc = new Coding();
                cc.setCode(((Enumeration<Enum<?>>) value).asStringValue());
                cc.setSystem(getSystemForCode(vs, cc.getCode(), path));
                return cc;
            } else if (value instanceof StringType) {
                Coding cc = new Coding();
                cc.setCode(((StringType) value).asStringValue());
                cc.setSystem(getSystemForCode(vs, cc.getCode(), path));
                return cc;
            }
            break;
        case REFERENCE:
            if (value instanceof Reference)
                return (Type) value;
            else if (value instanceof StringType) {
                Reference r = new Reference();
                r.setReference(((StringType) value).asStringValue());
            }
            break;
        default:
            break;
    }
    throw new FHIRException("Unable to convert from '" + value.getClass().toString() + "' for Answer Format " + af.toCode() + ", path = " + path);
}
Also used : Enumeration(org.hl7.fhir.r4.model.Enumeration) StringType(org.hl7.fhir.r4.model.StringType) Reference(org.hl7.fhir.r4.model.Reference) BooleanType(org.hl7.fhir.r4.model.BooleanType) Quantity(org.hl7.fhir.r4.model.Quantity) FHIRException(org.hl7.fhir.exceptions.FHIRException) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) TimeType(org.hl7.fhir.r4.model.TimeType) UriType(org.hl7.fhir.r4.model.UriType) IntegerType(org.hl7.fhir.r4.model.IntegerType) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) Coding(org.hl7.fhir.r4.model.Coding) DecimalType(org.hl7.fhir.r4.model.DecimalType) DateType(org.hl7.fhir.r4.model.DateType)

Example 74 with DateType

use of org.hl7.fhir.r5.model.DateType in project org.hl7.fhir.core by hapifhir.

the class DateTypeNullTest method equalsShallow.

@Test
@DisplayName("Test null value equalsShallow()")
void equalsShallow() {
    DateType nullDate = new DateType();
    DateType validDate = new DateType("1969-07-20");
    Assertions.assertFalse(nullDate.equalsShallow(validDate));
}
Also used : DateType(org.hl7.fhir.r4b.model.DateType) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 75 with DateType

use of org.hl7.fhir.r5.model.DateType in project org.hl7.fhir.core by hapifhir.

the class DateTypeNullTest method typedCopy.

@Test
@DisplayName("Test null value typedCopy()")
void typedCopy() {
    DateType nullDate = new DateType();
    DateType copyDate = (DateType) nullDate.typedCopy();
    Assertions.assertNull(copyDate.getValue());
}
Also used : DateType(org.hl7.fhir.r4b.model.DateType) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

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