Search in sources :

Example 66 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project fhir-bridge by ehrbase.

the class FindProcedureTransactionIT method findProcedureVRead.

@Test
void findProcedureVRead() throws IOException {
    MethodOutcome outcome = create("Procedure/transactions/provide-procedure-create.json");
    IIdType id = outcome.getId();
    Procedure procedure = vread(id.getIdPart(), id.getVersionIdPart(), Procedure.class);
    Assertions.assertNotNull(procedure);
    Assertions.assertNotNull(procedure.getId(), id.getIdPart());
    Assertions.assertNotNull(procedure.getMeta().getVersionId(), id.getVersionIdPart());
    Assertions.assertEquals(PATIENT_ID, procedure.getSubject().getIdentifier().getValue());
}
Also used : Procedure(org.hl7.fhir.r4.model.Procedure) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) IIdType(org.hl7.fhir.instance.model.api.IIdType) Test(org.junit.jupiter.api.Test)

Example 67 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project Gravity-SDOH-Exchange-RI by FHIR.

the class OurTaskPollingService method copyProcedure.

private static Procedure copyProcedure(Procedure cpProcedure, Reference patientReference, Reference serviceRequest, List<Reference> reasonReferences) {
    Procedure resultProc = new Procedure();
    resultProc.getMeta().addProfile(SDOHProfiles.PROCEDURE);
    resultProc.addBasedOn(serviceRequest);
    resultProc.setStatus(cpProcedure.getStatus());
    resultProc.setStatusReason(cpProcedure.getStatusReason());
    resultProc.setCategory(cpProcedure.getCategory());
    resultProc.setCode(cpProcedure.getCode());
    resultProc.setSubject(patientReference);
    resultProc.setPerformed(cpProcedure.getPerformed());
    resultProc.setReasonReference(reasonReferences);
    return resultProc;
}
Also used : Procedure(org.hl7.fhir.r4.model.Procedure)

Example 68 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project Gravity-SDOH-Exchange-RI by FHIR.

the class TaskUpdateBundleFactory method createProcedure.

private Procedure createProcedure(Coding coding) {
    Procedure procedure = new Procedure();
    procedure.getMeta().addProfile(SDOHProfiles.PROCEDURE);
    procedure.setId(IdType.newRandomUuid());
    procedure.setStatus(Procedure.ProcedureStatus.COMPLETED);
    procedure.setCategory(serviceRequest.getCategoryFirstRep());
    procedure.getCode().addCoding(coding);
    procedure.getBasedOn().add(task.getFocus());
    procedure.setSubject(task.getFor());
    procedure.setPerformed(DateTimeType.now());
    procedure.setReasonReference(ServiceRequestReferenceCollector.getConditions(serviceRequest));
    return procedure;
}
Also used : Procedure(org.hl7.fhir.r4.model.Procedure)

Example 69 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project Gravity-SDOH-Exchange-RI by FHIR.

the class TaskService method update.

public void update(String id, UpdateTaskRequestDto update) throws AuthClientException {
    Server server = serverRepository.findById(update.getServerId()).orElseThrow(() -> new ServerNotFoundException(String.format("No server was found by id '%s'", update.getServerId())));
    IGenericClient fhirClient = fhirContext.newRestfulGenericClient(server.getFhirServerUrl());
    // Doesn't support now
    // fhirClient.registerInterceptor(new BearerTokenAuthInterceptor(
    // authorizationClient.getTokenResponse(URI.create(server.getAuthServerUrl()), server.getClientId(),
    // server.getClientSecret(), SCOPE)
    // .getAccessToken()));
    TaskRepository taskRepository = new TaskRepository(fhirClient, applicationUrl);
    // Validates and converts Procedure codes to Coding
    List<Coding> procedureCodes = Optional.ofNullable(update.getProcedureCodes()).orElse(Collections.emptyList()).stream().map(code -> sdohMappings.findResourceCoding(Procedure.class, code)).collect(Collectors.toList());
    Bundle taskBundle = taskRepository.find(id, Lists.newArrayList(Task.INCLUDE_FOCUS));
    TaskInfoBundleExtractor.TaskInfoHolder taskInfo = new TaskInfoBundleExtractor().extract(taskBundle).stream().findFirst().orElseThrow(() -> new ResourceNotFoundException(new IdType(Task.class.getSimpleName(), id)));
    TaskUpdateBundleFactory bundleFactory = new TaskUpdateBundleFactory();
    bundleFactory.setTask(taskInfo.getTask());
    bundleFactory.setStatus(update.getTaskStatus());
    bundleFactory.setServiceRequest(taskInfo.getServiceRequest());
    bundleFactory.setStatusReason(update.getStatusReason());
    bundleFactory.setComment(update.getComment());
    bundleFactory.setOutcome(update.getOutcome());
    bundleFactory.setProcedureCodes(procedureCodes);
    taskRepository.transaction(bundleFactory.createUpdateBundle());
}
Also used : TaskDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.TaskDto) ServerNotFoundException(org.hl7.gravity.refimpl.sdohexchange.exception.ServerNotFoundException) AuthorizationClient(org.hl7.gravity.refimpl.sdohexchange.auth.AuthorizationClient) TaskUpdateBundleFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.TaskUpdateBundleFactory) ArrayList(java.util.ArrayList) Value(org.springframework.beans.factory.annotation.Value) Procedure(org.hl7.fhir.r4.model.Procedure) Task(org.hl7.fhir.r4.model.Task) FhirContext(ca.uhn.fhir.context.FhirContext) UpdateTaskRequestDto(org.hl7.gravity.refimpl.sdohexchange.dto.request.UpdateTaskRequestDto) Lists(com.google.common.collect.Lists) TaskInfoBundleExtractor(org.hl7.gravity.refimpl.sdohexchange.fhir.extract.TaskInfoBundleExtractor) Service(org.springframework.stereotype.Service) TaskRepository(org.hl7.gravity.refimpl.sdohexchange.dao.TaskRepository) TaskReadException(org.hl7.gravity.refimpl.sdohexchange.exception.TaskReadException) Server(org.hl7.gravity.refimpl.sdohexchange.model.Server) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) RestTemplate(org.springframework.web.client.RestTemplate) AuthClientException(org.hl7.gravity.refimpl.sdohexchange.exception.AuthClientException) TaskBundleToDtoConverter(org.hl7.gravity.refimpl.sdohexchange.dto.converter.TaskBundleToDtoConverter) ServerRepository(org.hl7.gravity.refimpl.sdohexchange.dao.ServerRepository) Collectors(java.util.stream.Collectors) IdType(org.hl7.fhir.r4.model.IdType) Objects(java.util.Objects) List(java.util.List) Coding(org.hl7.fhir.r4.model.Coding) Optional(java.util.Optional) Bundle(org.hl7.fhir.r4.model.Bundle) Collections(java.util.Collections) SDOHMappings(org.hl7.gravity.refimpl.sdohexchange.sdohmappings.SDOHMappings) FhirUtil(org.hl7.gravity.refimpl.sdohexchange.util.FhirUtil) Task(org.hl7.fhir.r4.model.Task) Server(org.hl7.gravity.refimpl.sdohexchange.model.Server) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) Bundle(org.hl7.fhir.r4.model.Bundle) TaskRepository(org.hl7.gravity.refimpl.sdohexchange.dao.TaskRepository) IdType(org.hl7.fhir.r4.model.IdType) Coding(org.hl7.fhir.r4.model.Coding) ServerNotFoundException(org.hl7.gravity.refimpl.sdohexchange.exception.ServerNotFoundException) TaskInfoBundleExtractor(org.hl7.gravity.refimpl.sdohexchange.fhir.extract.TaskInfoBundleExtractor) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) TaskUpdateBundleFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.TaskUpdateBundleFactory)

Example 70 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project Gravity-SDOH-Exchange-RI by FHIR.

the class TaskPollingService method copyProcedure.

private static Procedure copyProcedure(Procedure cpProcedure, Reference patientReference, Reference serviceRequest, List<Reference> reasonReferences) {
    Procedure resultProc = new Procedure();
    resultProc.getMeta().addProfile(SDOHProfiles.PROCEDURE);
    resultProc.addBasedOn(serviceRequest);
    resultProc.setStatus(cpProcedure.getStatus());
    resultProc.setStatusReason(cpProcedure.getStatusReason());
    resultProc.setCategory(cpProcedure.getCategory());
    resultProc.setCode(cpProcedure.getCode());
    resultProc.setSubject(patientReference);
    resultProc.setPerformed(cpProcedure.getPerformed());
    resultProc.setReasonReference(reasonReferences);
    return resultProc;
}
Also used : Procedure(org.hl7.fhir.r4.model.Procedure)

Aggregations

Procedure (org.hl7.fhir.r4.model.Procedure)22 Test (org.junit.jupiter.api.Test)19 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)14 Coding (org.hl7.fhir.r4.model.Coding)14 ArrayList (java.util.ArrayList)12 Bundle (org.hl7.fhir.r4.model.Bundle)11 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)11 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)9 Reference (org.hl7.fhir.r4.model.Reference)9 ExplanationOfBenefit (org.hl7.fhir.dstu3.model.ExplanationOfBenefit)8 Turtle (org.hl7.fhir.dstu3.utils.formats.Turtle)8 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)8 CCWProcedure (gov.cms.bfd.server.war.commons.CCWProcedure)7 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)7 Coding (org.hl7.fhir.dstu3.model.Coding)7 Date (java.util.Date)6 List (java.util.List)6 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)6 Diagnosis (gov.cms.bfd.server.war.commons.Diagnosis)5 Collectors (java.util.stream.Collectors)5