Merge remote-tracking branch 'origin/master' into do-20240122-base-engine
This commit is contained in:
commit
18840d616f
|
@ -2748,15 +2748,12 @@ public class FHIRPathEngine {
|
||||||
result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) + Integer.parseInt(r.primitiveValue())));
|
result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) + Integer.parseInt(r.primitiveValue())));
|
||||||
} else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) {
|
} else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) {
|
||||||
result.add(new DecimalType(new BigDecimal(l.primitiveValue()).add(new BigDecimal(r.primitiveValue()))));
|
result.add(new DecimalType(new BigDecimal(l.primitiveValue()).add(new BigDecimal(r.primitiveValue()))));
|
||||||
} else if ((l.isDateTime() || l.hasType("date")) && r.hasType("Quantity")) {
|
} else if (l.hasType("date") && r.hasType("Quantity")) {
|
||||||
if (l.hasType("date")) {
|
DateType dl = l instanceof DateType ? (DateType) l : new DateType(l.primitiveValue());
|
||||||
BaseDateTimeType dt = l instanceof BaseDateTimeType ? (BaseDateTimeType) l : TypeConvertor.castToDateTime(l);
|
result.add(dateAdd(dl, (Quantity) r, false, expr));
|
||||||
Quantity qty = r instanceof Quantity ? (Quantity) r : TypeConvertor.castToQuantity(r);
|
} else if ((l.isDateTime() || l.hasType("dateTime") || l.hasType("instant")) && r.hasType("Quantity")) {
|
||||||
result.add(dateAdd(dt, qty, false, expr));
|
DateTimeType dl = l instanceof DateTimeType ? (DateTimeType) l : new DateTimeType(l.primitiveValue());
|
||||||
} else {
|
result.add(dateAdd(dl, (Quantity) r, false, expr));
|
||||||
DateTimeType dl = l instanceof DateTimeType ? (DateTimeType) l : new DateTimeType(l.primitiveValue());
|
|
||||||
result.add(dateAdd(dl, (Quantity) r, false, expr));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw makeException(expr, I18nConstants.FHIRPATH_OP_INCOMPATIBLE, "+", left.get(0).fhirType(), right.get(0).fhirType());
|
throw makeException(expr, I18nConstants.FHIRPATH_OP_INCOMPATIBLE, "+", left.get(0).fhirType(), right.get(0).fhirType());
|
||||||
}
|
}
|
||||||
|
@ -3001,7 +2998,7 @@ public class FHIRPathEngine {
|
||||||
if (right.size() > 1) {
|
if (right.size() > 1) {
|
||||||
throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE, "-");
|
throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE, "-");
|
||||||
}
|
}
|
||||||
if (!right.get(0).isPrimitive() && !((left.get(0).isDateTime() || left.get(0).hasType("date", "dateTime") || "0".equals(left.get(0).primitiveValue()) || left.get(0).hasType("Quantity")) && right.get(0).hasType("Quantity"))) {
|
if (!right.get(0).isPrimitive() && !((left.get(0).isDateTime() || left.get(0).hasType("date", "dateTime", "instant") || "0".equals(left.get(0).primitiveValue()) || left.get(0).hasType("Quantity")) && right.get(0).hasType("Quantity"))) {
|
||||||
throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "-", right.get(0).fhirType());
|
throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "-", right.get(0).fhirType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3019,15 +3016,12 @@ public class FHIRPathEngine {
|
||||||
Quantity qty = (Quantity) r;
|
Quantity qty = (Quantity) r;
|
||||||
result.add(qty.copy().setValue(qty.getValue().abs()));
|
result.add(qty.copy().setValue(qty.getValue().abs()));
|
||||||
}
|
}
|
||||||
} else if ((l.isDateTime() || l.hasType("date", "dateTime", "instant")) && r.hasType("Quantity")) {
|
} else if (l.hasType("date") && r.hasType("Quantity")) {
|
||||||
if (l.hasType("date")) {
|
DateType dl = l instanceof DateType ? (DateType) l : new DateType(l.primitiveValue());
|
||||||
BaseDateTimeType dt = l instanceof BaseDateTimeType ? (BaseDateTimeType) l : TypeConvertor.castToDateTime(l);
|
result.add(dateAdd(dl, (Quantity) r, true, expr));
|
||||||
Quantity qty = r instanceof Quantity ? (Quantity) r : TypeConvertor.castToQuantity(r);
|
} else if ((l.isDateTime() || l.hasType("dateTime") || l.hasType("instant")) && r.hasType("Quantity")) {
|
||||||
result.add(dateAdd(dt, qty, true, expr));
|
DateTimeType dl = l instanceof DateTimeType ? (DateTimeType) l : new DateTimeType(l.primitiveValue());
|
||||||
} else {
|
result.add(dateAdd(dl, (Quantity) r, true, expr));
|
||||||
DateTimeType dl = l instanceof DateTimeType ? (DateTimeType) l : new DateTimeType(l.primitiveValue());
|
|
||||||
result.add(dateAdd(dl, (Quantity) r, true, expr));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw makeException(expr, I18nConstants.FHIRPATH_OP_INCOMPATIBLE, "-", left.get(0).fhirType(), right.get(0).fhirType());
|
throw makeException(expr, I18nConstants.FHIRPATH_OP_INCOMPATIBLE, "-", left.get(0).fhirType(), right.get(0).fhirType());
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue