Skip to content

Commit

Permalink
fix some IllegalArguments in Allergies
Browse files Browse the repository at this point in the history
  • Loading branch information
mherman22 committed Apr 15, 2024
1 parent d3fc3e7 commit 3376c42
Showing 1 changed file with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -710,18 +710,11 @@ protected <T, U> Optional<Predicate> handleCodeableConcept(OpenmrsFhirCriteriaCo

return handleAndListParamBySystem(criteriaContext.getCriteriaBuilder(), concepts, (system, tokens) -> {
if (system.isEmpty()) {
criteriaContext.getCriteriaBuilder()
.literal(tokensToParams(tokens).map(NumberUtils::toInt).collect(Collectors.toList()));
return Optional
.of(criteriaContext
.getCriteriaBuilder().or(
criteriaContext.getCriteriaBuilder()
.in(conceptAlias.get("conceptId")
.in(criteriaContext.getCriteriaBuilder()
.literal(tokensToParams(tokens).map(NumberUtils::toInt)
.collect(Collectors.toList())))),
criteriaContext.getCriteriaBuilder().in(conceptAlias.get("uuid")
.in(criteriaContext.getCriteriaBuilder().literal(tokensToList(tokens))))));

Predicate inConceptId = criteriaContext.getCriteriaBuilder().in(conceptAlias.get("conceptId")).value(criteriaContext.getCriteriaBuilder().literal(tokensToParams(tokens).map(NumberUtils::toInt).collect(Collectors.toList())));
Predicate inUuid = criteriaContext.getCriteriaBuilder().in(conceptAlias.get("uuid")).value(criteriaContext.getCriteriaBuilder().literal(tokensToList(tokens)));

return Optional.of(criteriaContext.getCriteriaBuilder().or(inConceptId, inUuid));
} else {
Join<?, ?> conceptMapAliasJoin = criteriaContext.addJoin(conceptAlias, "conceptMappings", conceptMapAlias);
criteriaContext.addJoin(conceptMapAliasJoin, "conceptReferenceTerm", conceptReferenceTermAlias);
Expand Down Expand Up @@ -1279,7 +1272,7 @@ protected <T, U> OpenmrsFhirCriteriaContext<T, U> createCriteriaContext(Class<?
CriteriaQuery<U> cq = (CriteriaQuery<U>) cb.createQuery(rootType);
@SuppressWarnings("unchecked")
Root<T> root = (Root<T>) cq.from(rootType);

return new OpenmrsFhirCriteriaContext<>(em, cb, cq, root);
}

Expand Down

0 comments on commit 3376c42

Please sign in to comment.