Search in sources :

Example 1 with GoalInfoDto

use of org.hl7.gravity.refimpl.sdohexchange.dto.response.GoalInfoDto in project Gravity-SDOH-Exchange-RI by FHIR.

the class ProblemBundleToDtoConverter method conditionInfoToDto.

@Override
protected ProblemDto conditionInfoToDto(ConditionInfoBundleExtractor.ConditionInfoHolder conditionInfo) {
    // TODO refactor this. Avoid manual casting. Refactor the design of a base class instead.
    Assert.isInstanceOf(ProblemInfoBundleExtractor.ProblemInfoHolder.class, conditionInfo, "conditionInfo must be a ProblemInfoHolder.");
    ProblemInfoBundleExtractor.ProblemInfoHolder probleminfo = (ProblemInfoBundleExtractor.ProblemInfoHolder) conditionInfo;
    Condition condition = probleminfo.getCondition();
    ProblemDto problemDto = super.conditionInfoToDto(probleminfo);
    // Onset must be available for the problem list items.
    if (condition.getOnset() != null) {
        problemDto.setStartDate(FhirUtil.toLocalDateTime((DateTimeType) condition.getOnset()));
    } else {
        problemDto.getErrors().add("Condition is a problem-list-item but an onset property is missing or not of a DateTimeType " + "type.");
    }
    problemDto.getTasks().addAll(probleminfo.getTasks().stream().map(t -> new TaskInfoDto(t.getId(), t.getName(), t.getStatus())).collect(Collectors.toList()));
    problemDto.getGoals().addAll(probleminfo.getGoals().stream().map(t -> new GoalInfoDto(t.getId(), t.getName(), t.getStatus())).collect(Collectors.toList()));
    return problemDto;
}
Also used : Condition(org.hl7.fhir.r4.model.Condition) GoalInfoDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.GoalInfoDto) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) TaskInfoDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.TaskInfoDto) ProblemInfoBundleExtractor(org.hl7.gravity.refimpl.sdohexchange.fhir.extract.ProblemInfoBundleExtractor) ProblemDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.ProblemDto)

Example 2 with GoalInfoDto

use of org.hl7.gravity.refimpl.sdohexchange.dto.response.GoalInfoDto 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());
}
Also used : Constants(ca.uhn.fhir.rest.api.Constants) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Autowired(org.springframework.beans.factory.annotation.Autowired) Condition(org.hl7.fhir.r4.model.Condition) UsCoreConditionCategory(org.hl7.gravity.refimpl.sdohexchange.fhir.UsCoreConditionCategory) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) GoalToInfoDtoConverter(org.hl7.gravity.refimpl.sdohexchange.dto.converter.GoalToInfoDtoConverter) Task(org.hl7.fhir.r5.model.Task) TaskQueryFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.query.TaskQueryFactory) Strings(com.google.common.base.Strings) GoalInfoDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.GoalInfoDto) Service(org.springframework.stereotype.Service) GoalQueryFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.query.GoalQueryFactory) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) StringClientParam(ca.uhn.fhir.rest.gclient.StringClientParam) HealthcareServiceBundleToDtoConverter(org.hl7.gravity.refimpl.sdohexchange.dto.converter.HealthcareServiceBundleToDtoConverter) SDOHProfiles(org.hl7.gravity.refimpl.sdohexchange.fhir.SDOHProfiles) HealthConcernQueryFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.query.HealthConcernQueryFactory) HealthcareServiceDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.HealthcareServiceDto) OrganizationDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.OrganizationDto) OrganizationToDtoConverter(org.hl7.gravity.refimpl.sdohexchange.dto.converter.OrganizationToDtoConverter) Goal(org.hl7.fhir.r4.model.Goal) IQuery(ca.uhn.fhir.rest.gclient.IQuery) ConditionClinicalStatusCodes(org.hl7.gravity.refimpl.sdohexchange.fhir.ConditionClinicalStatusCodes) ReferenceDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.ReferenceDto) ActiveResourcesDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.ActiveResourcesDto) Collectors(java.util.stream.Collectors) Organization(org.hl7.fhir.r4.model.Organization) List(java.util.List) SmartOnFhirContext(com.healthlx.smartonfhir.core.SmartOnFhirContext) HealthcareService(org.hl7.fhir.r4.model.HealthcareService) ConditionToDtoConverter(org.hl7.gravity.refimpl.sdohexchange.dto.converter.ConditionToDtoConverter) Bundle(org.hl7.fhir.r4.model.Bundle) ConditionDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.ConditionDto) OrganizationTypeCode(org.hl7.gravity.refimpl.sdohexchange.codes.OrganizationTypeCode) ProblemQueryFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.query.ProblemQueryFactory) Questionnaire(org.hl7.fhir.r4.model.Questionnaire) FhirUtil(org.hl7.gravity.refimpl.sdohexchange.util.FhirUtil) Assert(org.springframework.util.Assert) Goal(org.hl7.fhir.r4.model.Goal) StringClientParam(ca.uhn.fhir.rest.gclient.StringClientParam) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) Bundle(org.hl7.fhir.r4.model.Bundle) GoalToInfoDtoConverter(org.hl7.gravity.refimpl.sdohexchange.dto.converter.GoalToInfoDtoConverter)

Aggregations

Condition (org.hl7.fhir.r4.model.Condition)2 GoalInfoDto (org.hl7.gravity.refimpl.sdohexchange.dto.response.GoalInfoDto)2 Constants (ca.uhn.fhir.rest.api.Constants)1 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)1 IQuery (ca.uhn.fhir.rest.gclient.IQuery)1 StringClientParam (ca.uhn.fhir.rest.gclient.StringClientParam)1 Strings (com.google.common.base.Strings)1 SmartOnFhirContext (com.healthlx.smartonfhir.core.SmartOnFhirContext)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1 IBaseBundle (org.hl7.fhir.instance.model.api.IBaseBundle)1 Bundle (org.hl7.fhir.r4.model.Bundle)1 DateTimeType (org.hl7.fhir.r4.model.DateTimeType)1 Goal (org.hl7.fhir.r4.model.Goal)1 HealthcareService (org.hl7.fhir.r4.model.HealthcareService)1 Organization (org.hl7.fhir.r4.model.Organization)1 Questionnaire (org.hl7.fhir.r4.model.Questionnaire)1 Task (org.hl7.fhir.r5.model.Task)1 OrganizationTypeCode (org.hl7.gravity.refimpl.sdohexchange.codes.OrganizationTypeCode)1