Skip to content

Commit

Permalink
[26218] add nutrition multiplicator to preference and optifier
Browse files Browse the repository at this point in the history
  • Loading branch information
huthomas committed Mar 6, 2024
1 parent fae5bd7 commit ebeba34
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Bundle-Vendor: %providerName
Bundle-Localization: plugin
Automatic-Module-Name: ch.elexis.base.ch.arzttarife.model
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: ch.elexis.base.ch.arzttarife.complementary,
Export-Package: ch.elexis.base.ch.arzttarife,
ch.elexis.base.ch.arzttarife.complementary,
ch.elexis.base.ch.arzttarife.complementary.impl,
ch.elexis.base.ch.arzttarife.complementary.util,
ch.elexis.base.ch.arzttarife.nutrition,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package ch.elexis.base.ch.arzttarife;

public class ArzttarifeConstants {

public static final String NUTRITION_MULTIPLICATOR_NAME = "NUT";
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.apache.commons.lang3.StringUtils;

import ch.elexis.base.ch.arzttarife.ArzttarifeConstants;
import ch.elexis.base.ch.arzttarife.model.service.CoreModelServiceHolder;
import ch.elexis.base.ch.arzttarife.nutrition.INutritionLeistung;
import ch.elexis.core.jpa.model.adapter.AbstractIdDeleteModelAdapter;
Expand All @@ -17,6 +18,7 @@
import ch.elexis.core.model.Identifiable;
import ch.elexis.core.model.billable.AbstractOptifier;
import ch.elexis.core.model.billable.DefaultVerifier;
import ch.elexis.core.services.holder.BillingServiceHolder;
import ch.elexis.core.services.holder.ContextServiceHolder;
import ch.elexis.core.services.holder.XidServiceHolder;
import ch.elexis.core.types.VatInfo;
Expand All @@ -42,7 +44,12 @@ public synchronized IBillableOptifier<NutritionLeistung> getOptifier() {

@Override
protected void setPrice(NutritionLeistung billable, IBilled billed) {
billed.setFactor(1.0);
Optional<IBillingSystemFactor> factor = getFactor(billed.getEncounter());
if (factor.isPresent()) {
billed.setFactor(factor.get().getFactor());
} else {
billed.setFactor(1.0);
}
int points = 0;
if (billable.getTP() != null) {
try {
Expand All @@ -56,7 +63,8 @@ protected void setPrice(NutritionLeistung billable, IBilled billed) {

@Override
public Optional<IBillingSystemFactor> getFactor(IEncounter encounter) {
return Optional.empty();
return BillingServiceHolder.get().getBillingSystemFactor(
ArzttarifeConstants.NUTRITION_MULTIPLICATOR_NAME, encounter.getDate());
}
};
}
Expand Down
6 changes: 6 additions & 0 deletions bundles/ch.elexis.base.ch.arzttarife/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
id="ch.elexis.arzttarife_ch.complementary"
name="Komplementärmedizin">
</page>
<page
category="ch.elexis.Leistungscodes"
class="ch.elexis.tarmedprefs.NutritionPrefs"
id="ch.elexis.arzttarife_ch.nutrition"
name="Ernährungsberatung">
</page>
</extension>
<extension
point="org.eclipse.ui.views">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@ public class Messages {
public static String TarmedRequirements_Law = ch.elexis.core.l10n.Messages.Core_Law_Name;
public static String TarmedRequirements_NifName = ch.elexis.core.l10n.Messages.Core_NIF;
public static String TarmedRequirements_SSNName = ch.elexis.core.l10n.Messages.TarmedRequirements_SSNName;
public static String Preferences_pleaseEnterMultiplier = ch.elexis.core.l10n.Messages.Preferences_pleaseEnterMultiplier;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*******************************************************************************
* Copyright (c) 2006, G. Weirich and Elexis
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* G. Weirich - initial implementation
*
*******************************************************************************/

package ch.elexis.tarmedprefs;

import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

import ch.elexis.base.ch.arzttarife.ArzttarifeConstants;
import ch.elexis.core.ui.preferences.ConfigServicePreferenceStore;
import ch.elexis.core.ui.preferences.ConfigServicePreferenceStore.Scope;
import ch.elexis.core.ui.preferences.inputs.MultiplikatorEditor;
import ch.elexis.core.ui.util.SWTHelper;

public class NutritionPrefs extends PreferencePage implements IWorkbenchPreferencePage {

@Override
public void init(IWorkbench workbench) {
setPreferenceStore(new ConfigServicePreferenceStore(Scope.MANDATOR));
setTitle("Ernährungsberatung");
}

@Override
protected Control createContents(Composite parent) {
Composite ret = new Composite(parent, SWT.NONE);
ret.setLayout(new GridLayout());
new Label(ret, SWT.NONE).setText(Messages.Preferences_pleaseEnterMultiplier);
MultiplikatorEditor me = new MultiplikatorEditor(ret, ArzttarifeConstants.NUTRITION_MULTIPLICATOR_NAME);
me.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));

return ret;
}

}

0 comments on commit ebeba34

Please sign in to comment.