Skip to content

Commit

Permalink
[26327] Spotlight PatientDetailComposite workaround for postgres problem
Browse files Browse the repository at this point in the history
  • Loading branch information
col-panic committed Jun 24, 2024
1 parent 4e081f2 commit 224ac6e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
7 changes: 4 additions & 3 deletions bundles/ch.elexis.core.spotlight.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ Bundle-RequiredExecutionEnvironment: JavaSE-11
Import-Package: ch.elexis.core.documents,
javax.inject;version="1.0.0",
org.eclipse.e4.ui.services,
org.eclipse.persistence.exceptions;version="2.7.10",
org.slf4j;version="1.6.6"
Automatic-Module-Name: ch.elexis.core.spotlight.ui
Bundle-ActivationPolicy: lazy
Export-Package: ch.elexis.core.spotlight.ui
Service-Component: OSGI-INF/ch.elexis.core.spotlight.ui.internal.SpotlightResultEntryDetailCompositeService.xml,
OSGI-INF/ch.elexis.core.spotlight.ui.internal.ready.SpotlightReadyService.xml,
OSGI-INF/ch.elexis.core.spotlight.ui.controls.detail.PatientSpotlightResultEntryDetailCompositeContributor.xml
Service-Component: OSGI-INF/ch.elexis.core.spotlight.ui.controls.detail.PatientSpotlightResultEntryDetailCompositeContributor.xml,
OSGI-INF/ch.elexis.core.spotlight.ui.internal.SpotlightResultEntryDetailCompositeService.xml,
OSGI-INF/ch.elexis.core.spotlight.ui.internal.ready.SpotlightReadyService.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.eclipse.persistence.exceptions.DatabaseException;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

Expand Down Expand Up @@ -95,18 +97,23 @@ String getFormattedInsurance(IModelService coreModelService, IPatient patient) {

String getFormattedPatientBalance(IModelService coreModelService, IPatient patient) {
if (patient != null) {
INamedQuery<Number> namedQuery = coreModelService.getNamedQuery(Number.class, IAccountTransaction.class,
true, "balance.patient");
List<Number> balanceResult = namedQuery
.executeWithParameters(namedQuery.getParameterMap("patient", patient));
List<Number> balanceResult = Collections.emptyList();
try {
INamedQuery<Number> namedQuery = coreModelService.getNamedQuery(Number.class, IAccountTransaction.class,
true, "balance.patient");
balanceResult = namedQuery.executeWithParameters(namedQuery.getParameterMap("patient", patient));
} catch (DatabaseException sqle) {
// #26327 workaround for non-postgres-support in Elexis < 3.13
sqle.printStackTrace();
}
if (!balanceResult.isEmpty()) {
int _balance = balanceResult.get(0).intValue();
return "CHF " + new Money(_balance);
}
}
return "-";
}

String getFormattedFixedMedication(IModelService coreModelService, IPatient patient) {
if (patient != null) {
List<IPrescription> fixedMedication = patient.getMedication(Arrays.asList(EntryType.FIXED_MEDICATION));
Expand Down

0 comments on commit 224ac6e

Please sign in to comment.