use of org.hl7.gravity.refimpl.sdohexchange.dto.converter.GoalToInfoDtoConverter in project Gravity-SDOH-Exchange-RI by FHIR.
the class SupportService method listGoals.
public List<GoalInfoDto> listGoals() {
Assert.notNull(SmartOnFhirContext.get().getPatient(), "Patient id cannot be null.");
Bundle goalsBundle = ehrClient.search().forResource(Goal.class).sort().descending(Constants.PARAM_LASTUPDATED).where(Goal.PATIENT.hasId(SmartOnFhirContext.get().getPatient())).where(new StringClientParam(Constants.PARAM_PROFILE).matches().value(SDOHProfiles.GOAL)).where(Goal.LIFECYCLE_STATUS.exactly().code(Goal.GoalLifecycleStatus.ACTIVE.toCode())).returnBundle(Bundle.class).execute();
return FhirUtil.getFromBundle(goalsBundle, Goal.class).stream().map(goal -> new GoalToInfoDtoConverter().convert(goal)).collect(Collectors.toList());
}
Aggregations