fix date operations problem
This commit is contained in:
parent
e692665790
commit
eb0c4d8d93
|
@ -2750,7 +2750,9 @@ public class FHIRPathEngine {
|
|||
result.add(new DecimalType(new BigDecimal(l.primitiveValue()).add(new BigDecimal(r.primitiveValue()))));
|
||||
} else if ((l.isDateTime() || l.hasType("Date")) && r.hasType("Quantity")) {
|
||||
if (l.hasType("Date")) {
|
||||
result.add(dateAdd((BaseDateTimeType) l, (Quantity) r, false, expr));
|
||||
BaseDateTimeType dt = l instanceof BaseDateTimeType ? (BaseDateTimeType) l : TypeConvertor.castToDateTime(l);
|
||||
Quantity qty = r instanceof Quantity ? (Quantity) r : TypeConvertor.castToQuantity(r);
|
||||
result.add(dateAdd(dt, qty, false, expr));
|
||||
} else {
|
||||
DateTimeType dl = l instanceof DateTimeType ? (DateTimeType) l : new DateTimeType(l.primitiveValue());
|
||||
result.add(dateAdd(dl, (Quantity) r, false, expr));
|
||||
|
@ -3019,7 +3021,9 @@ public class FHIRPathEngine {
|
|||
}
|
||||
} else if ((l.isDateTime() || l.hasType("Date")) && r.hasType("Quantity")) {
|
||||
if (l.hasType("Date")) {
|
||||
result.add(dateAdd((BaseDateTimeType) l, (Quantity) r, true, expr));
|
||||
BaseDateTimeType dt = l instanceof BaseDateTimeType ? (BaseDateTimeType) l : TypeConvertor.castToDateTime(l);
|
||||
Quantity qty = r instanceof Quantity ? (Quantity) r : TypeConvertor.castToQuantity(r);
|
||||
result.add(dateAdd(dt, qty, true, expr));
|
||||
} else {
|
||||
DateTimeType dl = l instanceof DateTimeType ? (DateTimeType) l : new DateTimeType(l.primitiveValue());
|
||||
result.add(dateAdd(dl, (Quantity) r, true, expr));
|
||||
|
|
|
@ -161,7 +161,7 @@ public class TypeConvertor {
|
|||
|
||||
if (b instanceof DateTimeType)
|
||||
return (DateTimeType) b;
|
||||
else if (b.fhirType().equals("dateTime"))
|
||||
else if (Utilities.existsInList(b.fhirType(), "dateTime", "date", "instant"))
|
||||
return new DateTimeType(b.primitiveValue());
|
||||
else
|
||||
throw new FHIRException("Unable to convert a "+b.fhirType()+"("+b.getClass().getName()+") to a DateTime");
|
||||
|
|
Loading…
Reference in New Issue