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());
}
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;
}
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;
}
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());
}
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;
}
Aggregations