mirror of
https://github.com/pcvolkmer/onkostar-plugin-dnpm.git
synced 2025-07-03 01:32:55 +00:00
Issue #11: Methode zum Auffinden referenzierter MTBs hinzugefügt
This commit is contained in:
@ -2,6 +2,8 @@ package DNPM.config;
|
|||||||
|
|
||||||
import DNPM.database.SettingsRepository;
|
import DNPM.database.SettingsRepository;
|
||||||
import DNPM.services.*;
|
import DNPM.services.*;
|
||||||
|
import DNPM.services.mtb.DefaultMtbService;
|
||||||
|
import DNPM.services.mtb.MtbService;
|
||||||
import de.itc.onkostar.api.IOnkostarApi;
|
import de.itc.onkostar.api.IOnkostarApi;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
@ -35,6 +37,11 @@ public class PluginConfiguration {
|
|||||||
return new SettingsService(settingsRepository);
|
return new SettingsService(settingsRepository);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public MtbService mtbService(final SettingsService settingsService) {
|
||||||
|
return new DefaultMtbService(settingsService);
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public TherapieplanServiceFactory therapieplanServiceFactory(
|
public TherapieplanServiceFactory therapieplanServiceFactory(
|
||||||
final IOnkostarApi onkostarApi,
|
final IOnkostarApi onkostarApi,
|
||||||
|
@ -6,6 +6,7 @@ import de.itc.onkostar.api.Procedure;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static DNPM.services.FormService.hasValue;
|
import static DNPM.services.FormService.hasValue;
|
||||||
@ -36,6 +37,40 @@ public class DefaultTherapieplanService implements TherapieplanService {
|
|||||||
this.updateMtbInSubforms(procedure);
|
this.updateMtbInSubforms(procedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finde verlinkte MTBs in Hauptformular und Unterformularen
|
||||||
|
*
|
||||||
|
* @param procedure Die Prozedur mit Hauptformular
|
||||||
|
* @return Liste mit verlinkten MTBs
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Procedure> findReferencedMtbs(Procedure procedure) {
|
||||||
|
if (!hasValue(procedure, "referstemtb")) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
var mtbProcedure = this.onkostarApi.getProcedure(procedure.getValue("referstemtb").getInt());
|
||||||
|
if (null == mtbProcedure) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
return List.of(mtbProcedure);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finde verlinkte MTBs in Hauptformular und Unterformularen
|
||||||
|
*
|
||||||
|
* @param procedureId ID der Prozedur mit Hauptformular
|
||||||
|
* @return Liste mit verlinkten MTBs
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Procedure> findReferencedMtbs(int procedureId) {
|
||||||
|
var procedure = this.onkostarApi.getProcedure(procedureId);
|
||||||
|
if (null == procedure) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
return findReferencedMtbs(procedure);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateMtbInSections(Procedure procedure) {
|
private void updateMtbInSections(Procedure procedure) {
|
||||||
if (!isYes(procedure, "humangenberatung") && !isYes(procedure, "reevaluation")) {
|
if (!isYes(procedure, "humangenberatung") && !isYes(procedure, "reevaluation")) {
|
||||||
return;
|
return;
|
||||||
|
@ -1,12 +1,75 @@
|
|||||||
package DNPM.services;
|
package DNPM.services;
|
||||||
|
|
||||||
|
import de.itc.onkostar.api.IOnkostarApi;
|
||||||
import de.itc.onkostar.api.Procedure;
|
import de.itc.onkostar.api.Procedure;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static DNPM.services.FormService.hasValue;
|
||||||
|
import static DNPM.services.FormService.isYes;
|
||||||
|
|
||||||
public class MultipleMtbTherapieplanService implements TherapieplanService {
|
public class MultipleMtbTherapieplanService implements TherapieplanService {
|
||||||
|
|
||||||
|
private final IOnkostarApi onkostarApi;
|
||||||
|
|
||||||
|
private final FormService formService;
|
||||||
|
|
||||||
|
public MultipleMtbTherapieplanService(final IOnkostarApi onkostarApi, final FormService formService) {
|
||||||
|
this.onkostarApi = onkostarApi;
|
||||||
|
this.formService = formService;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateRequiredMtbEntries(Procedure procedure) {
|
public void updateRequiredMtbEntries(Procedure procedure) {
|
||||||
// No action required
|
// No action required
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Procedure> findReferencedMtbs(Procedure procedure) {
|
||||||
|
var procedureIds = new ArrayList<Integer>();
|
||||||
|
|
||||||
|
var mtbReference = procedure.getValue("referstemtb").getInt();
|
||||||
|
procedureIds.add(mtbReference);
|
||||||
|
|
||||||
|
if (isYes(procedure, "humangenberatung") && hasValue(procedure, "reftkhumangenber")) {
|
||||||
|
procedureIds.add(procedure.getValue("reftkhumangenber").getInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isYes(procedure, "reevaluation") && hasValue(procedure, "reftkreevaluation")) {
|
||||||
|
procedureIds.add(procedure.getValue("reftkreevaluation").getInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
formService.getSubFormProcedureIds(procedure.getId()).stream()
|
||||||
|
.map(onkostarApi::getProcedure)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.forEach(subform -> {
|
||||||
|
if (subform.getFormName().equals("DNPM UF Einzelempfehlung")) {
|
||||||
|
procedureIds.add(subform.getValue("mtb").getInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subform.getFormName().equals("DNPM UF Rebiopsie")) {
|
||||||
|
procedureIds.add(subform.getValue("reftumorkonferenz").getInt());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return procedureIds.stream()
|
||||||
|
.distinct()
|
||||||
|
.map(onkostarApi::getProcedure)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.sorted(Comparator.comparing(Procedure::getStartDate))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Procedure> findReferencedMtbs(int procedureId) {
|
||||||
|
var procedure = this.onkostarApi.getProcedure(procedureId);
|
||||||
|
if (null == procedure) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
return findReferencedMtbs(procedure);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public class SettingsService {
|
|||||||
* @return Übergibt <code>true</code>, wenn <code>mehrere_mtb_in_mtbepisode</code> auf "Ja" gesetzt ist.
|
* @return Übergibt <code>true</code>, wenn <code>mehrere_mtb_in_mtbepisode</code> auf "Ja" gesetzt ist.
|
||||||
*/
|
*/
|
||||||
public boolean multipleMtbsInMtbEpisode() {
|
public boolean multipleMtbsInMtbEpisode() {
|
||||||
var setting = getSetting("SID");
|
var setting = getSetting("mehrere_mtb_in_mtbepisode");
|
||||||
return setting.isPresent() && setting.get().equals("true");
|
return setting.isPresent() && setting.get().equals("true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package DNPM.services;
|
|||||||
|
|
||||||
import de.itc.onkostar.api.Procedure;
|
import de.itc.onkostar.api.Procedure;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface TherapieplanService {
|
public interface TherapieplanService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,4 +14,20 @@ public interface TherapieplanService {
|
|||||||
*/
|
*/
|
||||||
void updateRequiredMtbEntries(Procedure procedure);
|
void updateRequiredMtbEntries(Procedure procedure);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finde verlinkte MTBs in Hauptformular und Unterformularen
|
||||||
|
*
|
||||||
|
* @param procedure Die Prozedur mit Hauptformular
|
||||||
|
* @return Liste mit verlinkten MTBs
|
||||||
|
*/
|
||||||
|
List<Procedure> findReferencedMtbs(Procedure procedure);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finde verlinkte MTBs in Hauptformular und Unterformularen
|
||||||
|
*
|
||||||
|
* @param procedureId ID der Prozedur mit Hauptformular
|
||||||
|
* @return Liste mit verlinkten MTBs
|
||||||
|
*/
|
||||||
|
List<Procedure> findReferencedMtbs(int procedureId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ public class TherapieplanServiceFactory {
|
|||||||
|
|
||||||
public TherapieplanService currentUsableInstance() {
|
public TherapieplanService currentUsableInstance() {
|
||||||
if (settingsService.multipleMtbsInMtbEpisode()) {
|
if (settingsService.multipleMtbsInMtbEpisode()) {
|
||||||
return new MultipleMtbTherapieplanService();
|
return new MultipleMtbTherapieplanService(onkostarApi, formService);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DefaultTherapieplanService(onkostarApi, formService);
|
return new DefaultTherapieplanService(onkostarApi, formService);
|
||||||
|
Reference in New Issue
Block a user