diff --git a/bundles/at.medevit.elexis.bluemedication.core/.classpath b/bundles/at.medevit.elexis.bluemedication.core/.classpath index 6f98681011..2d0e2c59f2 100644 --- a/bundles/at.medevit.elexis.bluemedication.core/.classpath +++ b/bundles/at.medevit.elexis.bluemedication.core/.classpath @@ -8,7 +8,7 @@ - + diff --git a/bundles/at.medevit.elexis.bluemedication.core/lib/openapi-java-client-1.7.0-sources.jar b/bundles/at.medevit.elexis.bluemedication.core/lib/openapi-java-client-1.7.0-sources.jar index 48460b1c46..e889ed61dd 100644 Binary files a/bundles/at.medevit.elexis.bluemedication.core/lib/openapi-java-client-1.7.0-sources.jar and b/bundles/at.medevit.elexis.bluemedication.core/lib/openapi-java-client-1.7.0-sources.jar differ diff --git a/bundles/at.medevit.elexis.bluemedication.core/lib/openapi-java-client-1.7.0.jar b/bundles/at.medevit.elexis.bluemedication.core/lib/openapi-java-client-1.7.0.jar index 1fc25560b0..546605b034 100644 Binary files a/bundles/at.medevit.elexis.bluemedication.core/lib/openapi-java-client-1.7.0.jar and b/bundles/at.medevit.elexis.bluemedication.core/lib/openapi-java-client-1.7.0.jar differ diff --git a/bundles/at.medevit.elexis.bluemedication.core/src/at/medevit/elexis/bluemedication/core/BlueMedicationService.java b/bundles/at.medevit.elexis.bluemedication.core/src/at/medevit/elexis/bluemedication/core/BlueMedicationService.java index 656eb18118..fb9cb679c2 100644 --- a/bundles/at.medevit.elexis.bluemedication.core/src/at/medevit/elexis/bluemedication/core/BlueMedicationService.java +++ b/bundles/at.medevit.elexis.bluemedication.core/src/at/medevit/elexis/bluemedication/core/BlueMedicationService.java @@ -70,6 +70,15 @@ public default Result uploadDocument(IPatient patient, File docume */ public Result downloadPdf(UploadResult uploadResult); + /** + * Download the results of upload and user interaction on the browser. The + * result is the original pdf extended with the extracted emediplan. + * + * @param uploadResult + * @return + */ + public Result downloadExtendedPdf(UploadResult uploadResult); + /** * Add a pending {@link UploadResult} to the map of pending results. One object * can only have one {@link UploadResult}. @@ -104,4 +113,5 @@ public default Result uploadDocument(IPatient patient, File docume * @param onSuccess */ public void startPollForResult(Object object, UploadResult uploadResult, Consumer onSuccess); + } diff --git a/bundles/at.medevit.elexis.bluemedication.core/src/at/medevit/elexis/bluemedication/core/internal/BlueMedicationServiceImpl.java b/bundles/at.medevit.elexis.bluemedication.core/src/at/medevit/elexis/bluemedication/core/internal/BlueMedicationServiceImpl.java index 1571901e72..16741f2647 100644 --- a/bundles/at.medevit.elexis.bluemedication.core/src/at/medevit/elexis/bluemedication/core/internal/BlueMedicationServiceImpl.java +++ b/bundles/at.medevit.elexis.bluemedication.core/src/at/medevit/elexis/bluemedication/core/internal/BlueMedicationServiceImpl.java @@ -428,6 +428,28 @@ public Result downloadPdf(UploadResult uploadResult) { } } + @Override + public Result downloadExtendedPdf(UploadResult uploadResult) { + initProxyOrOauth(); + try { + ExtractionAndConsolidationApi apiInstance = new ExtractionAndConsolidationApi(); + configureApiClient(apiInstance.getApiClient()); + ApiResponse response = apiInstance + .downloadIdExtractionExtendedpdfGetWithHttpInfo(uploadResult.getId(), true); + if (response.getStatusCode() >= 300) { + return Result.ERROR("Response status code was [" + response.getStatusCode() + "]"); + } + if (response.getData() == null) { + return Result.ERROR("Response has no data"); + } + return Result.OK(response.getData().getAbsolutePath()); + } catch (ApiException e) { + hinAuthHandleException(e); + logger.error("Error downloading Document Pdf", e); + return Result.ERROR(e.getMessage()); + } + } + @Override public void addPendingUploadResult(Object object, UploadResult uploadResult) { pendingUploadResults.put(object, uploadResult); diff --git a/bundles/at.medevit.elexis.bluemedication.ui/src/at/medevit/elexis/bluemedication/ui/handler/BlueMedicationDownloadHandler.java b/bundles/at.medevit.elexis.bluemedication.ui/src/at/medevit/elexis/bluemedication/ui/handler/BlueMedicationDownloadHandler.java index 54859162bc..36f5960e0b 100644 --- a/bundles/at.medevit.elexis.bluemedication.ui/src/at/medevit/elexis/bluemedication/ui/handler/BlueMedicationDownloadHandler.java +++ b/bundles/at.medevit.elexis.bluemedication.ui/src/at/medevit/elexis/bluemedication/ui/handler/BlueMedicationDownloadHandler.java @@ -64,7 +64,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException { } private void downloadAndImportPdf(IDocumentHandle docHandle, UploadResult uploadResult) { - Result pdf = BlueMedicationServiceHolder.getService().downloadPdf(uploadResult); + Result pdf = BlueMedicationServiceHolder.getService().downloadExtendedPdf(uploadResult); if (pdf.isOK()) { DocumentStore documentsService = DocumentStoreServiceHolder.getService(); // debug code, save to new document