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;
}
Aggregations