input) {
- var procedureId = AnalyzerUtils.getRequiredId(input, "id");
-
- if (procedureId.isEmpty()) {
- return List.of();
- }
-
- var procedure = onkostarApi.getProcedure(procedureId.get());
- if (null == procedure) {
- return List.of();
- }
-
- if (permissionEvaluator.hasPermission(SecurityContextHolder.getContext().getAuthentication(), procedure, PermissionType.READ)) {
- return molekulargenetikFormService.getVariants(procedure);
- } else {
- logger.error("Security: No permission to access procedure '{}'", procedure.getId());
- return List.of();
- }
- }
-
- /**
- * Übergibt alle Studien, deren (Kurz-)Beschreibung oder NCT-Nummer den übergebenen Eingabewert q enthält
- *
- * Wurde der Eingabewert nicht angegeben oder ist leer, werden alle Studien übergeben.
- *
- *
Beispiel zur Nutzung in einem Formularscript
- *
- * executePluginMethod(
- * 'TherapieplanAnalyzer',
- * 'getStudien',
- * { q: 'NCT-12', inactive: true },
- * (response) => console.log(response),
- * false
- * );
- *
- *
- * @param input Map mit Eingabewerten
- * @return Liste mit Studien
- */
- public List getStudien(Map input) {
- var query = AnalyzerUtils.getRequiredValue(input, "q", String.class);
- var inactive = AnalyzerUtils.getRequiredValue(input, "inactive", Boolean.class).orElse(false);
-
- if (query.isEmpty() || query.get().isBlank()) {
- if (inactive) {
- return studienService.findAll();
- }
- return studienService.findActive();
- }
- if (inactive) {
- return studienService.findByQuery(query.get());
- }
- return studienService.findActiveByQuery(query.get());
- }
-
-}
diff --git a/src/main/java/dev/dnpm/analyzer/FollowUpAnalyzer.java b/src/main/java/dev/dnpm/analyzer/FollowUpAnalyzer.java
deleted file mode 100644
index 26d70e3..0000000
--- a/src/main/java/dev/dnpm/analyzer/FollowUpAnalyzer.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * This file is part of onkostar-plugin-dnpm
- *
- * Copyright (c) 2025 the original author or authors.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package dev.dnpm.analyzer;
-
-import de.itc.onkostar.api.Disease;
-import de.itc.onkostar.api.IOnkostarApi;
-import de.itc.onkostar.api.Item;
-import de.itc.onkostar.api.Procedure;
-import de.itc.onkostar.api.analysis.AnalyseTriggerEvent;
-import de.itc.onkostar.api.analysis.AnalyzerRequirement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-import java.util.Set;
-
-/**
- * Diese Klasse implementiert ein Plugin, welches Aktionen nach Bearbeitung eines FollowUps durchführt.
- *
- * @since 0.0.2
- */
-@Component
-public class FollowUpAnalyzer extends Analyzer {
-
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- private final IOnkostarApi onkostarApi;
-
- public FollowUpAnalyzer(IOnkostarApi onkostarApi) {
- this.onkostarApi = onkostarApi;
- }
-
- @Override
- public String getDescription() {
- return "Aktualisiert verknüpfte Formulare nach Änderungen im FollowUp-Formular";
- }
-
- /**
- * @deprecated
- */
- @Override
- public boolean isRelevantForDeletedProcedure() {
- return false;
- }
-
- @Override
- public boolean isRelevantForAnalyzer(Procedure procedure, Disease disease) {
- return null != procedure && procedure.getFormName().equals("DNPM FollowUp");
- }
-
- @Override
- public boolean isSynchronous() {
- return false;
- }
-
- @Override
- public AnalyzerRequirement getRequirement() {
- return AnalyzerRequirement.PROCEDURE;
- }
-
- @Override
- public Set getTriggerEvents() {
- return Set.of(
- AnalyseTriggerEvent.EDIT_SAVE,
- AnalyseTriggerEvent.EDIT_LOCK,
- AnalyseTriggerEvent.REORG
- );
- }
-
- @Override
- public void analyze(Procedure procedure, Disease disease) {
- backlinkToEinzelempfehlung(procedure);
- }
-
- /**
- * Verlinke aktuelles FollowUp in angegebener Einzelempfehlung
- *
- * @param procedure Das FollowUp
- */
- private void backlinkToEinzelempfehlung(Procedure procedure) {
- if (null == procedure.getValue("LinkTherapieempfehlung")) {
- return;
- }
-
- var referencedProcedureId = procedure.getValue("LinkTherapieempfehlung");
- if (null == referencedProcedureId || referencedProcedureId.getInt() == 0) {
- // Alles gut, es ist keine Einzelempfehlung angegeben
- return;
- }
-
- var referencedProcedure = onkostarApi.getProcedure(referencedProcedureId.getInt());
- if (null == referencedProcedure) {
- logger.error("Referenzierte Einzelempfehlung wurde nicht gefunden: {}", referencedProcedureId);
- return;
- }
-
- referencedProcedure.setValue("refdnpmfollowup", new Item("ref_dnpm_followup", procedure.getId()));
-
- try {
- onkostarApi.saveProcedure(referencedProcedure);
- } catch (Exception e) {
- logger.error("FollowUp konnte nicht mit Einzelempfehlung verknüpft werden", e);
- }
- }
-}
diff --git a/src/main/java/dev/dnpm/analyzer/IPluginPart.java b/src/main/java/dev/dnpm/analyzer/IPluginPart.java
deleted file mode 100644
index 43fee31..0000000
--- a/src/main/java/dev/dnpm/analyzer/IPluginPart.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of onkostar-plugin-dnpm
- *
- * Copyright (c) 2025 the original author or authors.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package dev.dnpm.analyzer;
-
-import de.itc.onkostar.api.analysis.IProcedureAnalyzer;
-
-public interface IPluginPart extends IProcedureAnalyzer {
-
- default String getVersion() {
- return "0.4.0";
- }
-
- default String getName() {
- return "DNPM Plugin";
- }
-
- default String getDescription() {
- return String.format("Plugin-Bestandteil '%s'", this.getClass().getSimpleName());
- }
-
-}
diff --git a/src/main/java/dev/dnpm/analyzer/Merkmalskatalog.java b/src/main/java/dev/dnpm/analyzer/Merkmalskatalog.java
deleted file mode 100644
index 313af31..0000000
--- a/src/main/java/dev/dnpm/analyzer/Merkmalskatalog.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * This file is part of onkostar-plugin-dnpm
- *
- * Copyright (c) 2025 the original author or authors.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package dev.dnpm.analyzer;
-
-import de.itc.onkostar.api.Disease;
-import de.itc.onkostar.api.IOnkostarApi;
-import de.itc.onkostar.api.Procedure;
-import de.itc.onkostar.api.analysis.AnalyzerRequirement;
-import org.hibernate.SQLQuery;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.type.StandardBasicTypes;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.Map;
-
-public class Merkmalskatalog extends BackendService {
-
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- private final IOnkostarApi onkostarApi;
-
- public Merkmalskatalog(final IOnkostarApi onkostarApi) {
- this.onkostarApi = onkostarApi;
- }
-
- @Override
- public String getDescription() {
- return "Methoden für Merkmalskataloge";
- }
-
- @Override
- public boolean isRelevantForDeletedProcedure() {
- return false;
- }
-
- @Override
- public boolean isSynchronous() {
- return true;
- }
-
- @Override
- public AnalyzerRequirement getRequirement() {
- return AnalyzerRequirement.PROCEDURE;
- }
-
- @Override
- public boolean isRelevantForAnalyzer(Procedure procedure, Disease currentDisease) {
- return false;
- }
-
- public List getMerkmalskatalog(final Map input) {
- var merkmalskatalog = AnalyzerUtils.getRequiredValue(input, "Merkmalskatalog", String.class);
- var spalten = AnalyzerUtils.getRequiredValue(input, "Spalten", String.class);
-
- if (merkmalskatalog.isEmpty()) {
- logger.error("Kein Merkmalskatalog angegeben!");
- return null;
- }
-
- if (spalten.isEmpty()) {
- logger.error("Keine Spalten angegeben!");
- return null;
- }
-
- String[] spaltenArray = spalten.get().split("\\s*,\\s*");
-
- try {
- SQLQuery query = getSqlQuery(merkmalskatalog.get());
-
- for (String s : spaltenArray) {
- query.addScalar(s, StandardBasicTypes.STRING);
- }
-
- @SuppressWarnings("unchecked")
- List rows = query.list();
- return rows;
- } catch (Exception e) {
- logger.error("Fehler bei der Ausführung von getMerkmalskatalog()", e);
- return null;
- }
- }
-
- private SQLQuery getSqlQuery(String merkmalskatalog) {
- SessionFactory sessionFactory = onkostarApi.getSessionFactory();
- Session session = sessionFactory.getCurrentSession();
-
- String sql = "SELECT p.id, p.code, p.shortdesc, p.description, p.note, p.synonyms "
- + "FROM property_catalogue "
- + "LEFT JOIN property_catalogue_version ON property_catalogue_version.datacatalog_id = property_catalogue.id "
- + "LEFT JOIN property_catalogue_version_entry p ON p.property_version_id = property_catalogue_version.id "
- + "WHERE name = '" + merkmalskatalog + "' AND aktiv = 1 "
- + "ORDER BY position ASC";
-
- return session.createSQLQuery(sql);
- }
-}
diff --git a/src/main/java/dev/dnpm/analyzer/TherapieMitEcogAnalyzer.java b/src/main/java/dev/dnpm/analyzer/TherapieMitEcogAnalyzer.java
deleted file mode 100644
index eb08173..0000000
--- a/src/main/java/dev/dnpm/analyzer/TherapieMitEcogAnalyzer.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * This file is part of onkostar-plugin-dnpm
- *
- * Copyright (c) 2025 the original author or authors.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package dev.dnpm.analyzer;
-
-import dev.dnpm.dto.EcogStatusWithDate;
-import dev.dnpm.services.strahlentherapie.StrahlentherapieService;
-import dev.dnpm.services.systemtherapie.SystemtherapieService;
-import de.itc.onkostar.api.Disease;
-import de.itc.onkostar.api.IOnkostarApi;
-import de.itc.onkostar.api.Item;
-import de.itc.onkostar.api.Procedure;
-import de.itc.onkostar.api.analysis.AnalyseTriggerEvent;
-import de.itc.onkostar.api.analysis.AnalyzerRequirement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-import java.text.SimpleDateFormat;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * Diese Klasse implementiert ein Plugin, welches Aktionen nach Bearbeitung eines Formulars zur Systemtherapie durchführt.
- *
- * @since 0.6.0
- */
-@Component
-public class TherapieMitEcogAnalyzer extends Analyzer {
-
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- private final IOnkostarApi onkostarApi;
-
- private final StrahlentherapieService strahlentherapieService;
- private final SystemtherapieService systemtherapieService;
-
- public TherapieMitEcogAnalyzer(
- final IOnkostarApi onkostarApi,
- final StrahlentherapieService strahlentherapieService,
- final SystemtherapieService systemtherapieService
- ) {
- this.onkostarApi = onkostarApi;
- this.strahlentherapieService = strahlentherapieService;
- this.systemtherapieService = systemtherapieService;
- }
-
- @Override
- public String getDescription() {
- return "Aktualisiert verknüpfte Formulare nach Änderungen in Formularen vom Typ Strahlen-/Systemtherapie mit ECOG-Status";
- }
-
- /**
- * @deprecated
- */
- @Override
- public boolean isRelevantForDeletedProcedure() {
- return true;
- }
-
- @Override
- public boolean isRelevantForAnalyzer(Procedure procedure, Disease disease) {
- return null != procedure && null != disease && (
- procedure.getFormName().equals("OS.Strahlentherapie")
- || procedure.getFormName().equals("OS.Strahlentherapie.VarianteUKW")
- || procedure.getFormName().equals("OS.Systemische Therapie")
- || procedure.getFormName().equals("OS.Systemische Therapie.VarianteUKW")
- );
- }
-
- @Override
- public boolean isSynchronous() {
- return false;
- }
-
- @Override
- public AnalyzerRequirement getRequirement() {
- return AnalyzerRequirement.PROCEDURE;
- }
-
- @Override
- public Set getTriggerEvents() {
- return Set.of(
- AnalyseTriggerEvent.EDIT_SAVE,
- AnalyseTriggerEvent.EDIT_LOCK,
- AnalyseTriggerEvent.REORG
- );
- }
-
- @Override
- public void analyze(Procedure procedure, Disease disease) {
- var date = procedure.getStartDate();
- var status = procedure.getValue("ECOGvorTherapie");
-
- if (null == date || null == status) {
- // Ignore
- return;
- }
-
- var ecog = strahlentherapieService.ecogStatus(procedure.getPatient())
- .stream()
- .filter(ecogStatusWithDate -> ecogStatusWithDate.getDate().after(disease.getDiagnosisDate()))
- .collect(Collectors.toList());
-
- ecog.addAll(systemtherapieService.ecogStatus(procedure.getPatient())
- .stream()
- .filter(ecogStatusWithDate -> ecogStatusWithDate.getDate().after(disease.getDiagnosisDate()))
- .collect(Collectors.toList()));
-
-
- if (ecog.isEmpty()) {
- // Nothing to do
- return;
- }
-
- procedure.getPatient().getDiseases().stream()
- .flatMap(d -> onkostarApi.getProceduresForDiseaseByForm(d.getId(), "DNPM Klinik/Anamnese").stream())
- .forEach(p -> {
- var ufEcog = p.getValue("ECOGVerlauf");
- if (null != ufEcog && ufEcog.getValue() instanceof List) {
- updateExistingEcogVerlauf(p, ecog, ufEcog);
- } else {
- newEcogverlauf(p, ecog);
- }
- });
- }
-
- private void updateExistingEcogVerlauf(Procedure p, List ecogFromCompleted, Item ufEcog) {
- var shouldSave = false;
- var existingDates = ufEcog.>>getValue().stream()
- .map(v -> v.get("Datum"))
- .collect(Collectors.toList());
- for (var ecog : ecogFromCompleted) {
- var formattedDate = new SimpleDateFormat("yyyy-MM-dd").format(ecog.getDate());
- if (!existingDates.contains(formattedDate)) {
- var newSubProcedure = new Procedure(onkostarApi);
- newSubProcedure.setStartDate(ecog.getDate());
- newSubProcedure.setValue("Datum", new Item("Datum", ecog.getDate()));
- newSubProcedure.setValue("ECOG", new Item("ECOG", ecog.getStatus()));
- p.addSubProcedure("ECOGVerlauf", newSubProcedure);
- shouldSave = true;
- }
- }
- if (shouldSave) {
- try {
- onkostarApi.saveProcedure(p, true);
- } catch (Exception e) {
- logger.error("Cannot update ECOG for procedure '{}'", p.getId());
- }
- }
- }
-
- private void newEcogverlauf(Procedure p, List ecogFromCompleted) {
- p.setValue("ECOGVerlauf", new Item("ECOGVerlauf", List.of()));
- for (var ecog : ecogFromCompleted) {
- var newSubProcedure = new Procedure(onkostarApi);
- newSubProcedure.setStartDate(ecog.getDate());
- newSubProcedure.setValue("Datum", new Item("Datum", ecog.getDate()));
- newSubProcedure.setValue("ECOG", new Item("ECOG", ecog.getStatus()));
- p.addSubProcedure("ECOGVerlauf", newSubProcedure);
- }
- try {
- onkostarApi.saveProcedure(p, true);
- } catch (Exception e) {
- logger.error("Create update ECOG for procedure '{}'", p.getId());
- }
- }
-
-}
diff --git a/src/main/java/dev/dnpm/analyzer/TherapieplanAnalyzer.java b/src/main/java/dev/dnpm/analyzer/TherapieplanAnalyzer.java
deleted file mode 100644
index 8241f58..0000000
--- a/src/main/java/dev/dnpm/analyzer/TherapieplanAnalyzer.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * This file is part of onkostar-plugin-dnpm
- *
- * Copyright (c) 2025 the original author or authors.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package dev.dnpm.analyzer;
-
-import dev.dnpm.security.DelegatingDataBasedPermissionEvaluator;
-import dev.dnpm.security.PermissionType;
-import dev.dnpm.services.mtb.MtbService;
-import dev.dnpm.services.therapieplan.TherapieplanServiceFactory;
-import de.itc.onkostar.api.Disease;
-import de.itc.onkostar.api.Procedure;
-import de.itc.onkostar.api.analysis.AnalyseTriggerEvent;
-import de.itc.onkostar.api.analysis.AnalyzerRequirement;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.stereotype.Component;
-
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Diese Klasse implementiert ein Plugin, welches Aktionen nach Bearbeitung eines Therapieplans durchführt.
- *
- * @since 0.0.2
- */
-@Component
-public class TherapieplanAnalyzer extends Analyzer {
-
- private final TherapieplanServiceFactory therapieplanServiceFactory;
-
- private final MtbService mtbService;
-
- private final DelegatingDataBasedPermissionEvaluator permissionEvaluator;
-
- public TherapieplanAnalyzer(
- final TherapieplanServiceFactory therapieplanServiceFactory,
- final MtbService mtbService,
- final DelegatingDataBasedPermissionEvaluator permissionEvaluator
- ) {
- this.therapieplanServiceFactory = therapieplanServiceFactory;
- this.mtbService = mtbService;
- this.permissionEvaluator = permissionEvaluator;
- }
-
- @Override
- public String getDescription() {
- return "Aktualisiert Unterformulare nach Änderungen im Therapieplan-Formular";
- }
-
- /**
- * @deprecated
- */
- @Override
- public boolean isRelevantForDeletedProcedure() {
- return false;
- }
-
- @Override
- public boolean isRelevantForAnalyzer(Procedure procedure, Disease disease) {
- return null != procedure && procedure.getFormName().equals("DNPM Therapieplan");
- }
-
- @Override
- public boolean isSynchronous() {
- return false;
- }
-
- @Override
- public AnalyzerRequirement getRequirement() {
- return AnalyzerRequirement.PROCEDURE;
- }
-
- @Override
- public Set getTriggerEvents() {
- return Set.of(
- AnalyseTriggerEvent.EDIT_SAVE,
- AnalyseTriggerEvent.EDIT_LOCK,
- AnalyseTriggerEvent.REORG
- );
- }
-
- @Override
- public void analyze(Procedure procedure, Disease disease) {
- therapieplanServiceFactory.currentUsableInstance().updateRequiredMtbEntries(procedure);
- }
-
- /**
- * Übergibt den Text der referenzierten MTBs für den Protokollauszug
- *
- * Wurde der Eingabewert id nicht übergeben, wird ein leerer String zurück gegeben.
- *
- *
Beispiel zur Nutzung in einem Formularscript
- *
- * executePluginMethod(
- * 'TherapieplanAnalyzer',
- * 'getProtokollauszug',
- * { id: 12345 },
- * (response) => console.log(response),
- * false
- * );
- *
- *
- * @param input Map mit Eingabewerten
- * @return Zeichenkette mit Protokollauszug
- */
- public String getProtokollauszug(Map input) {
- var procedureId = AnalyzerUtils.getRequiredId(input, "id");
-
- if (procedureId.isEmpty()) {
- return "";
- }
-
- if (
- permissionEvaluator.hasPermission(
- SecurityContextHolder.getContext().getAuthentication(),
- procedureId.get(),
- Procedure.class.getSimpleName(),
- PermissionType.READ
- )
- ) {
- return mtbService.getProtocol(
- therapieplanServiceFactory
- .currentUsableInstance()
- .findReferencedMtbs(procedureId.get())
- );
- }
-
- return "";
- }
-
-}
--
cgit v1.2.3