diff options
| author | Paul-Christian Volkmer | 2025-10-23 11:08:10 +0200 |
|---|---|---|
| committer | Paul-Christian Volkmer | 2025-10-23 11:09:54 +0200 |
| commit | 84fb0d829832bf1628112376bba729422b169402 (patch) | |
| tree | 4828674b77105877dccfcccb380da3f7c0f75987 /src/main/java/dev/dnpm/services/mtb | |
| parent | 61e7dfcbe637f401f81ff853e9bd10c90b325acb (diff) | |
refactor: change package name
Diffstat (limited to 'src/main/java/dev/dnpm/services/mtb')
6 files changed, 0 insertions, 402 deletions
diff --git a/src/main/java/dev/dnpm/services/mtb/DefaultMtbService.java b/src/main/java/dev/dnpm/services/mtb/DefaultMtbService.java deleted file mode 100644 index 5237d02..0000000 --- a/src/main/java/dev/dnpm/services/mtb/DefaultMtbService.java +++ /dev/null @@ -1,94 +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.services.mtb; - -import de.itc.onkostar.api.IOnkostarApi; -import de.itc.onkostar.api.Procedure; - -import java.util.Comparator; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * Standardimplementierung des MtbService - * - * @since 0.0.2 - */ -public class DefaultMtbService implements MtbService { - - private final IOnkostarApi onkostarApi; - - public DefaultMtbService(final IOnkostarApi onkostarApi) { - this.onkostarApi = onkostarApi; - } - - /** - * Zusammenfassung der Prozeduren. - * Dabei werden alle Prozeduren sortiert, mit ermitteltem Mapper in {@link Optional} eines {@link String}s - * gewandelt und, wenn dies erfolgreich war, die Zeichenkette extrahiert. - * Im Anschluss wird die Abfolge der Zeichenketten mit den einzelnen Prozedur-Zusammenfassungen in eine - * einzige Zusammenfassung zusammengefügt. - * @param procedures Prozeduren, die zusammen gefasst werden sollen - * @return Text mit Zusammenfassung aller übergebenen Prozeduren - */ - @Override - public String getProtocol(List<Procedure> procedures) { - return this.sortedDistinctProcedureProtocolList(procedures.stream()) - .collect(Collectors.joining("\n\n")); - } - - private Stream<String> sortedDistinctProcedureProtocolList(Stream<Procedure> procedures) { - return procedures - .sorted(Comparator.comparing(Procedure::getStartDate)) - .map(this::selectAndApplyMapper) - .filter(Optional::isPresent) - .map(Optional::get) - .distinct(); - } - - /** - * Übergibt anzuwendenden Mapper für eine Prozedur. - * Wurde keine Implementierung festgelegt, wird ein Mapper zurückgegeben, der eine - * Prozedur in ein leeres {@link Optional} zurück gibt, übergeben. - * @param procedure Prozedur, für die ein Mapper ermittelt werden soll - * @return Mapper für diese Prozedur - */ - @Override - public ProcedureToProtocolMapper procedureToProtocolMapper(Procedure procedure) { - switch (procedure.getFormName()) { - case "OS.Tumorkonferenz": - return new OsTumorkonferenzToProtocolMapper(); - case "OS.Tumorkonferenz.VarianteUKW": - return new OsTumorkonferenzVarianteUkwToProtocolMapper(); - case "MR.MTB_Anmeldung": - return new MrMtbAnmeldungToProtocolMapper(this.onkostarApi); - default: - return p -> Optional.empty(); - } - } - -} diff --git a/src/main/java/dev/dnpm/services/mtb/MrMtbAnmeldungToProtocolMapper.java b/src/main/java/dev/dnpm/services/mtb/MrMtbAnmeldungToProtocolMapper.java deleted file mode 100644 index 203edd7..0000000 --- a/src/main/java/dev/dnpm/services/mtb/MrMtbAnmeldungToProtocolMapper.java +++ /dev/null @@ -1,87 +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.services.mtb; - -import de.itc.onkostar.api.IOnkostarApi; -import de.itc.onkostar.api.Procedure; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.Optional; - -public class MrMtbAnmeldungToProtocolMapper implements ProcedureToProtocolMapper { - - private final IOnkostarApi onkostarApi; - - public MrMtbAnmeldungToProtocolMapper(final IOnkostarApi onkostarApi) { - this.onkostarApi = onkostarApi; - } - - /** - * Wandelt eine Prozedur mit Formularnamen "MR.MTB_Anmeldung" in ein {@link Optional} mit einer - * Zeichenkette oder im Fehlerfall in ein leeres Optional um. - * - * @param procedure Die Prozedur, für die eine Zusammenfassung ermittelt werden soll. - * @return Das {@link Optional} mit, im Erfolgsfall, der Zusammenfassung für die Prozedur. - */ - @Override - public Optional<String> apply(Procedure procedure) { - if ((!procedure.getFormName().equals("MR.MTB_Anmeldung"))) { - throw new AssertionError("Procedure is not of form type 'MR.MTB_Anmeldung'"); - } - - var resultParts = new ArrayList<String>(); - - var fragestellung = procedure.getValue("Fragestellung"); - if (null != fragestellung && !fragestellung.getString().isBlank()) { - resultParts.add(String.format("Fragestellung:%n%s", fragestellung.getString())); - } - - var refEmpfehlung = procedure.getValue("Empfehlung"); - if (null != refEmpfehlung && refEmpfehlung.getInt() > 0) { - var empfehlungsProzedur = onkostarApi.getProcedure(refEmpfehlung.getInt()); - var refEinzelempfehlungen = onkostarApi.getSubprocedures(empfehlungsProzedur.getId()); - - if (null != refEinzelempfehlungen) { - refEinzelempfehlungen.stream() - .sorted(Comparator.comparingInt(proc -> proc.getValue("Prioritaet").getInt())) - .forEach(proc -> { - if (proc.getFormName().equals("MR.MTB_Einzelempfehlung")) { - var empfehlung = proc.getValue("Empfehlung"); - if (null != empfehlung && !empfehlung.getString().isBlank()) { - resultParts.add(String.format("Empfehlung:%n%s", empfehlung.getString())); - } - } - }); - } - } - - if (resultParts.isEmpty()) { - return Optional.empty(); - } - - return Optional.of(String.join("\n\n", resultParts)); - } -} diff --git a/src/main/java/dev/dnpm/services/mtb/MtbService.java b/src/main/java/dev/dnpm/services/mtb/MtbService.java deleted file mode 100644 index a8b8f9d..0000000 --- a/src/main/java/dev/dnpm/services/mtb/MtbService.java +++ /dev/null @@ -1,55 +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.services.mtb; - -import de.itc.onkostar.api.Procedure; - -import java.util.List; -import java.util.Optional; - -public interface MtbService { - /** - * Zusammenfassung der Prozeduren - * @param procedures Prozeduren, die zusammen gefasst werden sollen - * @return Text mit Zusammenfassung der Prozeduren - */ - String getProtocol(List<Procedure> procedures); - - /** - * Übergibt anzuwendenden Mapper für eine Prozedur - * @param procedure Prozedur, für die ein Mapper ermittelt werden soll - * @return Mapper für diese Prozedur - */ - ProcedureToProtocolMapper procedureToProtocolMapper(Procedure procedure); - - /** - * Select mapper using method {@link #procedureToProtocolMapper(Procedure)} and apply procedure - * @param procedure The Procedure to select mapper for and apply - * @return {@link Optional} with protocol or empty {@link Optional} - */ - default Optional<String> selectAndApplyMapper(Procedure procedure) { - return this.procedureToProtocolMapper(procedure).apply(procedure); - } -} diff --git a/src/main/java/dev/dnpm/services/mtb/OsTumorkonferenzToProtocolMapper.java b/src/main/java/dev/dnpm/services/mtb/OsTumorkonferenzToProtocolMapper.java deleted file mode 100644 index 21e056e..0000000 --- a/src/main/java/dev/dnpm/services/mtb/OsTumorkonferenzToProtocolMapper.java +++ /dev/null @@ -1,67 +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.services.mtb; - -import de.itc.onkostar.api.Procedure; - -import java.util.Optional; - - -/** - * Mapper zum Ermitteln des Protokollauszugs für Formular "OS.Tumorkonferenz" - * - * @since 0.0.2 - */ -public class OsTumorkonferenzToProtocolMapper implements ProcedureToProtocolMapper { - - /** - * Wandelt eine Prozedur mit Formularnamen "OS.Tumorkonferenz" in ein {@link Optional} mit einer - * Zeichenkette oder im Fehlerfall in ein leeres Optional um. - * @param procedure Die Prozedur, für die eine Zusammenfassung ermittelt werden soll. - * @return Das {@link Optional} mit, im Erfolgsfall, der Zusammenfassung für die Prozedur. - */ - @Override - public Optional<String> apply(Procedure procedure) { - if ((!procedure.getFormName().equals("OS.Tumorkonferenz"))) { - throw new AssertionError("Procedure is not of form type 'OS.Tumorkonferenz'"); - } - - var fragestellung = procedure.getValue("Fragestellung"); - var empfehlung = procedure.getValue("Empfehlung"); - - if ( - null != fragestellung && !fragestellung.getString().isBlank() - && null != empfehlung && !empfehlung.getString().isBlank() - ) { - return Optional.of(String.format("Fragestellung:%n%s%n%nEmpfehlung:%n%s", fragestellung.getString(), empfehlung.getString())); - } else if (null != fragestellung && !fragestellung.getString().isBlank()) { - return Optional.of(fragestellung.getString()); - } else if (null != empfehlung && !empfehlung.getString().isBlank()) { - return Optional.of(empfehlung.getString()); - } - - return Optional.empty(); - } -} diff --git a/src/main/java/dev/dnpm/services/mtb/OsTumorkonferenzVarianteUkwToProtocolMapper.java b/src/main/java/dev/dnpm/services/mtb/OsTumorkonferenzVarianteUkwToProtocolMapper.java deleted file mode 100644 index a29b580..0000000 --- a/src/main/java/dev/dnpm/services/mtb/OsTumorkonferenzVarianteUkwToProtocolMapper.java +++ /dev/null @@ -1,66 +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.services.mtb; - -import de.itc.onkostar.api.Procedure; - -import java.util.Optional; - -/** - * Mapper zum Ermitteln des Protokollauszugs für Formular "OS.Tumorkonferenz.VarianteUKW" - * - * @since 0.0.2 - */ -public class OsTumorkonferenzVarianteUkwToProtocolMapper implements ProcedureToProtocolMapper { - - /** - * Wandelt eine Prozedur mit Formularnamen "OS.Tumorkonferenz.VarianteUKW" in ein {@link Optional} mit einer - * Zeichenkette oder im Fehlerfall in ein leeres Optional um. - * @param procedure Die Prozedur, für die eine Zusammenfassung ermittelt werden soll. - * @return Das {@link Optional} mit, im Erfolgsfall, der Zusammenfassung für die Prozedur. - */ - @Override - public Optional<String> apply(Procedure procedure) { - if ((!procedure.getFormName().equals("OS.Tumorkonferenz.VarianteUKW"))) { - throw new AssertionError("Procedure is not of form type 'OS.Tumorkonferenz.VarianteUKW'"); - } - - - var fragestellung = procedure.getValue("Fragestellung"); - var empfehlung = procedure.getValue("Empfehlung"); - - if ( - null != fragestellung && !fragestellung.getString().isBlank() - && null != empfehlung && !empfehlung.getString().isBlank() - ) { - return Optional.of(String.format("Fragestellung:%n%s%n%nEmpfehlung:%n%s", fragestellung.getString().trim(), empfehlung.getString().trim())); - } else if (null != fragestellung && !fragestellung.getString().isBlank()) { - return Optional.of(fragestellung.getString().trim()); - } else if (null != empfehlung && !empfehlung.getString().isBlank()) { - return Optional.of(empfehlung.getString().trim()); - } - return Optional.empty(); - } -} diff --git a/src/main/java/dev/dnpm/services/mtb/ProcedureToProtocolMapper.java b/src/main/java/dev/dnpm/services/mtb/ProcedureToProtocolMapper.java deleted file mode 100644 index ce9a514..0000000 --- a/src/main/java/dev/dnpm/services/mtb/ProcedureToProtocolMapper.java +++ /dev/null @@ -1,33 +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.services.mtb; - -import de.itc.onkostar.api.Procedure; - -import java.util.Optional; -import java.util.function.Function; - -@FunctionalInterface -public interface ProcedureToProtocolMapper extends Function<Procedure, Optional<String>> {} |
