Search in sources :

Example 1 with AssessmentBundleToDtoConverter

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

the class AssessmentService method search.

public AssessmentDto search(String questionnaireUrl) {
    Assert.notNull(SmartOnFhirContext.get().getPatient(), "Patient id cannot be null.");
    Bundle responseBundle = searchAssessmentQuery().where(QuestionnaireResponse.QUESTIONNAIRE.hasId(questionnaireUrl)).returnBundle(Bundle.class).execute();
    responseBundle = addQuestionnairesToAssessmentBundle(responseBundle);
    return new AssessmentBundleToDtoConverter().convert(responseBundle).stream().findFirst().orElseThrow(() -> new ResourceNotFoundException(String.format("Resource of type QuestionnaireResponse with " + "questionnaire url '%s' is not known", questionnaireUrl)));
}
Also used : AssessmentBundleToDtoConverter(org.hl7.gravity.refimpl.sdohexchange.dto.converter.AssessmentBundleToDtoConverter) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) Bundle(org.hl7.fhir.r4.model.Bundle) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)

Example 2 with AssessmentBundleToDtoConverter

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

the class AssessmentService method listCompleted.

public List<AssessmentDto> listCompleted() {
    Assert.notNull(SmartOnFhirContext.get().getPatient(), "Patient id cannot be null.");
    Bundle responseBundle = searchAssessmentQuery().where(QuestionnaireResponse.STATUS.exactly().code(QuestionnaireResponseStatus.COMPLETED.toCode())).returnBundle(Bundle.class).execute();
    responseBundle = addQuestionnairesToAssessmentBundle(responseBundle);
    return new AssessmentBundleToDtoConverter().convert(responseBundle);
}
Also used : AssessmentBundleToDtoConverter(org.hl7.gravity.refimpl.sdohexchange.dto.converter.AssessmentBundleToDtoConverter) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) Bundle(org.hl7.fhir.r4.model.Bundle)

Aggregations

IBaseBundle (org.hl7.fhir.instance.model.api.IBaseBundle)2 Bundle (org.hl7.fhir.r4.model.Bundle)2 AssessmentBundleToDtoConverter (org.hl7.gravity.refimpl.sdohexchange.dto.converter.AssessmentBundleToDtoConverter)2 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)1