use of org.hl7.gravity.refimpl.sdohexchange.fhir.query.GoalQueryFactory in project Gravity-SDOH-Exchange-RI by FHIR.
the class ProblemService method addGoalsToConditionBundle.
private Bundle addGoalsToConditionBundle(Bundle responseBundle) {
Bundle goals = new GoalQueryFactory().query(ehrClient, SmartOnFhirContext.get().getPatient()).where(Goal.LIFECYCLE_STATUS.exactly().codes(Goal.GoalLifecycleStatus.ACTIVE.toCode(), Goal.GoalLifecycleStatus.COMPLETED.toCode())).returnBundle(Bundle.class).execute();
if (goals.getLink(IBaseBundle.LINK_NEXT) != null) {
throw new RuntimeException("Multi-page Goal results returned for the List Problems operation. Pagination not supported yet. Make sure " + "there is a small amount of goals in your FHIR store.");
}
Bundle merged = FhirUtil.mergeBundles(ehrClient.getFhirContext(), responseBundle, goals);
return merged;
}
use of org.hl7.gravity.refimpl.sdohexchange.fhir.query.GoalQueryFactory in project Gravity-SDOH-Exchange-RI by FHIR.
the class SupportService method getActiveResources.
// TODO do this in parallel.
public ActiveResourcesDto getActiveResources() {
SmartOnFhirContext smartOnFhirContext = SmartOnFhirContext.get();
IQuery hcQuery = new HealthConcernQueryFactory().query(ehrClient, smartOnFhirContext.getPatient()).where(Condition.CLINICAL_STATUS.exactly().code(ConditionClinicalStatusCodes.ACTIVE.toCode()));
IQuery problemQuery = new ProblemQueryFactory().query(ehrClient, smartOnFhirContext.getPatient()).where(Condition.CLINICAL_STATUS.exactly().code(ConditionClinicalStatusCodes.ACTIVE.toCode()));
IQuery goalQuery = new GoalQueryFactory().query(ehrClient, smartOnFhirContext.getPatient()).where(Goal.LIFECYCLE_STATUS.exactly().code(Goal.GoalLifecycleStatus.ACTIVE.toCode()));
IQuery taskQuery = new TaskQueryFactory().query(ehrClient, smartOnFhirContext.getPatient()).where(Task.STATUS.exactly().codes(Task.TaskStatus.ACCEPTED.toCode(), Task.TaskStatus.DRAFT.toCode(), Task.TaskStatus.INPROGRESS.toCode(), Task.TaskStatus.ONHOLD.toCode(), Task.TaskStatus.READY.toCode(), Task.TaskStatus.RECEIVED.toCode(), Task.TaskStatus.REQUESTED.toCode()));
return new ActiveResourcesDto(getTotal(hcQuery), getTotal(problemQuery), getTotal(goalQuery), getTotal(taskQuery));
}
Aggregations