Search in sources :

Example 1 with NewSocialRiskTaskRequestDto

use of org.hl7.gravity.refimpl.sdohexchange.dto.request.patienttask.NewSocialRiskTaskRequestDto in project Gravity-SDOH-Exchange-RI by FHIR.

the class PatientTaskService method newTask.

public String newTask(NewPatientTaskRequestDto taskRequest, UserDto user) {
    Assert.notNull(SmartOnFhirContext.get().getPatient(), "Patient id cannot be null.");
    PatientTaskBundleFactory taskBundleFactory;
    if (taskRequest instanceof NewMakeContactTaskRequestDto) {
        taskBundleFactory = createMakeContactTaskBundleFactory(user, (NewMakeContactTaskRequestDto) taskRequest);
    } else if (taskRequest instanceof NewSocialRiskTaskRequestDto) {
        taskBundleFactory = createSocialRiskTaskBundleFactory(user, (NewSocialRiskTaskRequestDto) taskRequest);
    } else if (taskRequest instanceof NewFeedbackTaskRequestDto) {
        taskBundleFactory = createFeedbackTaskBundleFactory(user, (NewFeedbackTaskRequestDto) taskRequest);
    } else {
        throw new IllegalArgumentException(taskRequest.getClass().getSimpleName() + " instances not supported yet.");
    }
    Bundle taskCreateBundle = ehrClient.transaction().withBundle(taskBundleFactory.createBundle()).execute();
    return FhirUtil.getFromResponseBundle(taskCreateBundle, Task.class).getIdPart();
}
Also used : Task(org.hl7.fhir.r4.model.Task) NewFeedbackTaskRequestDto(org.hl7.gravity.refimpl.sdohexchange.dto.request.patienttask.NewFeedbackTaskRequestDto) Bundle(org.hl7.fhir.r4.model.Bundle) NewSocialRiskTaskRequestDto(org.hl7.gravity.refimpl.sdohexchange.dto.request.patienttask.NewSocialRiskTaskRequestDto) NewMakeContactTaskRequestDto(org.hl7.gravity.refimpl.sdohexchange.dto.request.patienttask.NewMakeContactTaskRequestDto) PatientTaskBundleFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.patienttask.PatientTaskBundleFactory)

Example 2 with NewSocialRiskTaskRequestDto

use of org.hl7.gravity.refimpl.sdohexchange.dto.request.patienttask.NewSocialRiskTaskRequestDto in project Gravity-SDOH-Exchange-RI by FHIR.

the class PatientTaskService method createSocialRiskTaskBundleFactory.

private PatientSocialRiskTaskBundleFactory createSocialRiskTaskBundleFactory(UserDto user, NewSocialRiskTaskRequestDto socialRiskTaskRequest) {
    PatientSocialRiskTaskPrepareBundleFactory taskPrepareBundleFactory = new PatientSocialRiskTaskPrepareBundleFactory(SmartOnFhirContext.get().getPatient(), user.getId(), socialRiskTaskRequest.getQuestionnaireId());
    Bundle taskRelatedResources = ehrClient.transaction().withBundle(taskPrepareBundleFactory.createPrepareBundle()).execute();
    PatientSocialRiskTaskPrepareBundleExtractor.PatientSocialRiskTaskPrepareInfoHolder taskPrepareInfoHolder = new PatientSocialRiskTaskPrepareBundleExtractor().extract(taskRelatedResources);
    PatientSocialRiskTaskBundleFactory taskBundleFactory = new PatientSocialRiskTaskBundleFactory();
    taskBundleFactory.setName(socialRiskTaskRequest.getName());
    taskBundleFactory.setPatient(taskPrepareInfoHolder.getPatient());
    taskBundleFactory.setPriority(socialRiskTaskRequest.getPriority());
    taskBundleFactory.setOccurrence(socialRiskTaskRequest.getOccurrence());
    taskBundleFactory.setRequester(taskPrepareInfoHolder.getPerformer());
    taskBundleFactory.setComment(socialRiskTaskRequest.getComment());
    taskBundleFactory.setUser(user);
    taskBundleFactory.setQuestionniare(taskPrepareInfoHolder.getQuestionnaire());
    return taskBundleFactory;
}
Also used : PatientSocialRiskTaskPrepareBundleFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.patienttask.PatientSocialRiskTaskPrepareBundleFactory) PatientSocialRiskTaskBundleFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.patienttask.PatientSocialRiskTaskBundleFactory) Bundle(org.hl7.fhir.r4.model.Bundle) PatientSocialRiskTaskPrepareBundleExtractor(org.hl7.gravity.refimpl.sdohexchange.fhir.extract.patienttask.PatientSocialRiskTaskPrepareBundleExtractor)

Aggregations

Bundle (org.hl7.fhir.r4.model.Bundle)2 Task (org.hl7.fhir.r4.model.Task)1 NewFeedbackTaskRequestDto (org.hl7.gravity.refimpl.sdohexchange.dto.request.patienttask.NewFeedbackTaskRequestDto)1 NewMakeContactTaskRequestDto (org.hl7.gravity.refimpl.sdohexchange.dto.request.patienttask.NewMakeContactTaskRequestDto)1 NewSocialRiskTaskRequestDto (org.hl7.gravity.refimpl.sdohexchange.dto.request.patienttask.NewSocialRiskTaskRequestDto)1 PatientSocialRiskTaskPrepareBundleExtractor (org.hl7.gravity.refimpl.sdohexchange.fhir.extract.patienttask.PatientSocialRiskTaskPrepareBundleExtractor)1 PatientSocialRiskTaskBundleFactory (org.hl7.gravity.refimpl.sdohexchange.fhir.factory.patienttask.PatientSocialRiskTaskBundleFactory)1 PatientSocialRiskTaskPrepareBundleFactory (org.hl7.gravity.refimpl.sdohexchange.fhir.factory.patienttask.PatientSocialRiskTaskPrepareBundleFactory)1 PatientTaskBundleFactory (org.hl7.gravity.refimpl.sdohexchange.fhir.factory.patienttask.PatientTaskBundleFactory)1