Search in sources :

Example 1 with BaseQuantityDt

use of ca.uhn.fhir.model.base.composite.BaseQuantityDt in project eCRNow by drajer-health.

the class Dstu2CdaFhirUtilities method getStringForIDataType.

public static String getStringForIDataType(IDatatype dt) {
    if (dt != null) {
        logger.info(" Printing the class name " + dt.getClass());
        String val = "";
        if (dt instanceof CodingDt) {
            CodingDt cd = (CodingDt) dt;
            if (cd.getCodeElement() != null && cd.getSystemElement() != null) {
                val += cd.getSystemElement().getValue() + CdaGeneratorConstants.PIPE + cd.getCodeElement().getValue();
            }
        } else if (dt instanceof BaseQuantityDt) {
            QuantityDt qt = (QuantityDt) dt;
            if (qt.getValueElement() != null && qt.getSystemElement() != null && qt.getUnit() != null) {
                val += qt.getValueElement().getValueAsString() + CdaGeneratorConstants.PIPE + qt.getSystemElement().getValueAsString() + CdaGeneratorConstants.PIPE + qt.getUnit();
            }
        } else if (dt instanceof DateTimeDt) {
            DateTimeDt d = (DateTimeDt) dt;
            val += d.getValueAsString();
        } else if (dt instanceof PeriodDt) {
            PeriodDt pt = (PeriodDt) dt;
            if (pt.getStart() != null && pt.getEnd() != null) {
                val += pt.getStart().toString() + CdaGeneratorConstants.PIPE + pt.getEnd().toString();
            } else if (pt.getStart() != null) {
                val += pt.getStart().toString();
            }
        } else if (dt instanceof CodeDt) {
            CodeDt cd = (CodeDt) dt;
            val += cd.getValue();
        }
        return val;
    }
    return CdaGeneratorConstants.UNKNOWN_VALUE;
}
Also used : BaseQuantityDt(ca.uhn.fhir.model.base.composite.BaseQuantityDt) CodeDt(ca.uhn.fhir.model.primitive.CodeDt) BoundCodeDt(ca.uhn.fhir.model.primitive.BoundCodeDt) DateTimeDt(ca.uhn.fhir.model.primitive.DateTimeDt) PeriodDt(ca.uhn.fhir.model.dstu2.composite.PeriodDt) CodingDt(ca.uhn.fhir.model.dstu2.composite.CodingDt) QuantityDt(ca.uhn.fhir.model.dstu2.composite.QuantityDt) BaseQuantityDt(ca.uhn.fhir.model.base.composite.BaseQuantityDt)

Aggregations

BaseQuantityDt (ca.uhn.fhir.model.base.composite.BaseQuantityDt)1 CodingDt (ca.uhn.fhir.model.dstu2.composite.CodingDt)1 PeriodDt (ca.uhn.fhir.model.dstu2.composite.PeriodDt)1 QuantityDt (ca.uhn.fhir.model.dstu2.composite.QuantityDt)1 BoundCodeDt (ca.uhn.fhir.model.primitive.BoundCodeDt)1 CodeDt (ca.uhn.fhir.model.primitive.CodeDt)1 DateTimeDt (ca.uhn.fhir.model.primitive.DateTimeDt)1