Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directly Assign Pharmacy #24

Merged
merged 8 commits into from
Jun 19, 2021
Prev Previous commit
Added logging to see what field is problematic
  • Loading branch information
xbarrelet committed Jun 17, 2021
commit 7f1f1c2b0367dcd019f80c4ecd8e9604a8f74e23
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,6 @@ public BundleWithAccessCodeOrThrowable createERezeptOnPrescriptionServer(String
* @param task
*/
public void updateERezeptTask(String bearerToken, Task task, String accessCode, byte[] signedBytes) {


Parameters parameters = new Parameters();
ParametersParameterComponent ePrescriptionParameter = new ParametersParameterComponent();
ePrescriptionParameter.setName("ePrescription");
Expand All @@ -318,13 +316,17 @@ public void updateERezeptTask(String bearerToken, Task task, String accessCode,
binary.setContent(signedBytes);
ePrescriptionParameter.setResource(binary);
parameters.addParameter(ePrescriptionParameter);

Response response = client.target(prescriptionserverUrl).path("/Task")
.path("/" + task.getIdElement().getIdPart()).path("/$activate").request()
.header("User-Agent", userAgent)
.header("Authorization", "Bearer " + bearerToken).header("X-AccessCode", accessCode)
.post(Entity.entity(fhirContext.newXmlParser().encodeResourceToString(parameters),
"application/fhir+xml; charset=UTF-8"));

String taskString = response.readEntity(String.class);
log.info("Response when trying to activate the task:" + taskString);

if (Response.Status.Family.familyOf(response.getStatus()) != Response.Status.Family.SUCCESSFUL) {
// OperationOutcome operationOutcome =
// fhirContext.newXmlParser().parseResource(OperationOutcome.class, new
Expand Down