use of org.hl7.fhir.dstu3.model.ProcedureRequest in project BridgeServer2 by Sage-Bionetworks.
the class CRCController method postProcedureRequest.
@PutMapping("/v1/cuimc/procedurerequests")
public ResponseEntity<StatusMessage> postProcedureRequest() {
App app = httpBasicAuthentication();
IParser parser = FHIR_CONTEXT.newJsonParser();
JsonNode data = parseJson(JsonNode.class);
ProcedureRequest procedure = parser.parseResource(ProcedureRequest.class, data.toString());
String userId = findUserId(procedure.getSubject());
int status = writeReportAndUpdateState(app, userId, data, PROCEDURE_REPORT, AccountStates.TESTS_COLLECTED, true);
if (status == 200) {
return ResponseEntity.ok(new StatusMessage("ProcedureRequest updated."));
}
return ResponseEntity.created(URI.create("/v1/cuimc/procedurerequests/" + userId)).body(new StatusMessage("ProcedureRequest created."));
}
use of org.hl7.fhir.dstu3.model.ProcedureRequest in project cqf-ruler by DBCG.
the class ActivityDefinitionApplyProviderIT method testActivityDefinitionApply.
@Test
public void testActivityDefinitionApply() throws Exception {
DomainResource activityDefinition = (DomainResource) activityDefinitions.get("opioidcds-risk-assessment-request");
// Patient First
Map<String, IBaseResource> resources = uploadTests("test/activitydefinition/Patient");
IBaseResource patient = resources.get("ExamplePatient");
Resource applyResult = activityDefinitionApplyProvider.apply(new SystemRequestDetails(), activityDefinition.getIdElement(), patient.getIdElement().getIdPart(), null, null, null, null, null, null, null, null);
assertTrue(applyResult instanceof ProcedureRequest);
assertEquals("454281000124100", ((ProcedureRequest) applyResult).getCode().getCoding().get(0).getCode());
}
use of org.hl7.fhir.dstu3.model.ProcedureRequest in project BridgeServer2 by Sage-Bionetworks.
the class CRCControllerTest method makeProcedureRequest.
private String makeProcedureRequest() {
ProcedureRequest procedure = new ProcedureRequest();
Identifier id = new Identifier();
id.setSystem(USER_ID_VALUE_NS);
id.setValue(TEST_USER_ID);
Reference ref = new Reference();
ref.setIdentifier(id);
procedure.setSubject(ref);
return FHIR_CONTEXT.newJsonParser().encodeResourceToString(procedure);
}
use of org.hl7.fhir.dstu3.model.ProcedureRequest in project BridgeServer2 by Sage-Bionetworks.
the class CRCControllerTest method procedureWrongIdentifier.
@Test(expectedExceptions = BadRequestException.class, expectedExceptionsMessageRegExp = "Could not find Bridge user ID.")
public void procedureWrongIdentifier() throws Exception {
when(mockRequest.getHeader(AUTHORIZATION)).thenReturn(AUTHORIZATION_HEADER_VALUE);
when(mockAccountService.authenticate(any(), any())).thenReturn(account);
when(mockAccountService.getAccount(ACCOUNT_ID)).thenReturn(Optional.of(account));
Identifier identifier = new Identifier();
identifier.setSystem("wrong-system");
identifier.setValue(TEST_USER_ID);
ProcedureRequest procedure = new ProcedureRequest();
procedure.addIdentifier(identifier);
String json = FHIR_CONTEXT.newJsonParser().encodeResourceToString(procedure);
mockRequestBody(mockRequest, json);
controller.postProcedureRequest();
}
use of org.hl7.fhir.dstu3.model.ProcedureRequest in project elexis-server by elexis.
the class ServiceRequestResourceProvider method createProcedureRequest.
@Create
public MethodOutcome createProcedureRequest(@ResourceParam ServiceRequest procedureRequest) {
MethodOutcome outcome = new MethodOutcome();
Optional<IProcedureRequest> exists = getTransformer().getLocalObject(procedureRequest);
if (exists.isPresent()) {
outcome.setCreated(false);
outcome.setId(new IdType(procedureRequest.getId()));
} else {
Optional<IProcedureRequest> created = getTransformer().createLocalObject(procedureRequest);
if (created.isPresent()) {
outcome.setCreated(true);
outcome.setId(new IdType(created.get().getId()));
} else {
throw new InternalErrorException("Creation failed");
}
}
return outcome;
}
Aggregations