mirror of
https://github.com/pcvolkmer/onkostar-plugin-dnpm.git
synced 2025-07-03 01:32:55 +00:00
Issue #54: Verwende ECOG nach Update von Strahlen- und Systemtherapieformular
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
package DNPM.analyzer;
|
package DNPM.analyzer;
|
||||||
|
|
||||||
import DNPM.dto.EcogStatusWithDate;
|
import DNPM.dto.EcogStatusWithDate;
|
||||||
|
import DNPM.services.strahlentherapie.StrahlentherapieService;
|
||||||
import DNPM.services.systemtherapie.SystemtherapieService;
|
import DNPM.services.systemtherapie.SystemtherapieService;
|
||||||
import de.itc.onkostar.api.Disease;
|
import de.itc.onkostar.api.Disease;
|
||||||
import de.itc.onkostar.api.IOnkostarApi;
|
import de.itc.onkostar.api.IOnkostarApi;
|
||||||
@ -21,28 +22,31 @@ import java.util.stream.Collectors;
|
|||||||
/**
|
/**
|
||||||
* Diese Klasse implementiert ein Plugin, welches Aktionen nach Bearbeitung eines Formulars zur Systemtherapie durchführt.
|
* Diese Klasse implementiert ein Plugin, welches Aktionen nach Bearbeitung eines Formulars zur Systemtherapie durchführt.
|
||||||
*
|
*
|
||||||
* @since 0.4.0
|
* @since 0.6.0
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class SystemtherapieAnalyzer extends Analyzer {
|
public class TherapieMitEcogAnalyzer extends Analyzer {
|
||||||
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
private final IOnkostarApi onkostarApi;
|
private final IOnkostarApi onkostarApi;
|
||||||
|
|
||||||
|
private final StrahlentherapieService strahlentherapieService;
|
||||||
private final SystemtherapieService systemtherapieService;
|
private final SystemtherapieService systemtherapieService;
|
||||||
|
|
||||||
public SystemtherapieAnalyzer(
|
public TherapieMitEcogAnalyzer(
|
||||||
final IOnkostarApi onkostarApi,
|
final IOnkostarApi onkostarApi,
|
||||||
|
final StrahlentherapieService strahlentherapieService,
|
||||||
final SystemtherapieService systemtherapieService
|
final SystemtherapieService systemtherapieService
|
||||||
) {
|
) {
|
||||||
this.onkostarApi = onkostarApi;
|
this.onkostarApi = onkostarApi;
|
||||||
|
this.strahlentherapieService = strahlentherapieService;
|
||||||
this.systemtherapieService = systemtherapieService;
|
this.systemtherapieService = systemtherapieService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return "Aktualisiert verknüpfte Formulare nach Änderungen im Formularen vom Typ Systemtherapie";
|
return "Aktualisiert verknüpfte Formulare nach Änderungen in Formularen vom Typ Strahlen-/Systemtherapie mit ECOG-Status";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,7 +60,9 @@ public class SystemtherapieAnalyzer extends Analyzer {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isRelevantForAnalyzer(Procedure procedure, Disease disease) {
|
public boolean isRelevantForAnalyzer(Procedure procedure, Disease disease) {
|
||||||
return null != procedure && null != disease && (
|
return null != procedure && null != disease && (
|
||||||
procedure.getFormName().equals("OS.Systemische Therapie")
|
procedure.getFormName().equals("OS.Strahlentherapie")
|
||||||
|
|| procedure.getFormName().equals("OS.Strahlentherapie.VarianteUKW")
|
||||||
|
|| procedure.getFormName().equals("OS.Systemische Therapie")
|
||||||
|| procedure.getFormName().equals("OS.Systemische Therapie.VarianteUKW")
|
|| procedure.getFormName().equals("OS.Systemische Therapie.VarianteUKW")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -90,12 +96,18 @@ public class SystemtherapieAnalyzer extends Analyzer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ecogFromCompleted = systemtherapieService.ecogStatus(procedure.getPatient())
|
var ecog = strahlentherapieService.ecogStatus(procedure.getPatient())
|
||||||
.stream()
|
.stream()
|
||||||
.filter(ecogStatusWithDate -> ecogStatusWithDate.getDate().after(disease.getDiagnosisDate()))
|
.filter(ecogStatusWithDate -> ecogStatusWithDate.getDate().after(disease.getDiagnosisDate()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (ecogFromCompleted.isEmpty()) {
|
ecog.addAll(systemtherapieService.ecogStatus(procedure.getPatient())
|
||||||
|
.stream()
|
||||||
|
.filter(ecogStatusWithDate -> ecogStatusWithDate.getDate().after(disease.getDiagnosisDate()))
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
|
||||||
|
|
||||||
|
if (ecog.isEmpty()) {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -105,9 +117,9 @@ public class SystemtherapieAnalyzer extends Analyzer {
|
|||||||
.forEach(p -> {
|
.forEach(p -> {
|
||||||
var ufEcog = p.getValue("ECOGVerlauf");
|
var ufEcog = p.getValue("ECOGVerlauf");
|
||||||
if (null != ufEcog && ufEcog.getValue() instanceof List) {
|
if (null != ufEcog && ufEcog.getValue() instanceof List) {
|
||||||
updateExistingEcogVerlauf(p, ecogFromCompleted, ufEcog);
|
updateExistingEcogVerlauf(p, ecog, ufEcog);
|
||||||
} else {
|
} else {
|
||||||
newEcogverlauf(p, ecogFromCompleted);
|
newEcogverlauf(p, ecog);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package DNPM.analyzer;
|
package DNPM.analyzer;
|
||||||
|
|
||||||
import DNPM.dto.EcogStatusWithDate;
|
import DNPM.dto.EcogStatusWithDate;
|
||||||
|
import DNPM.services.strahlentherapie.StrahlentherapieService;
|
||||||
import DNPM.services.systemtherapie.SystemtherapieService;
|
import DNPM.services.systemtherapie.SystemtherapieService;
|
||||||
import de.itc.onkostar.api.*;
|
import de.itc.onkostar.api.*;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
@ -20,13 +21,15 @@ import static org.mockito.ArgumentMatchers.anyInt;
|
|||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class SystemtherapieAnalyzerTest {
|
class TherapieMitEcogAnalyzerTest {
|
||||||
|
|
||||||
private IOnkostarApi onkostarApi;
|
private IOnkostarApi onkostarApi;
|
||||||
|
|
||||||
|
private StrahlentherapieService strahlentherapieService;
|
||||||
|
|
||||||
private SystemtherapieService systemtherapieService;
|
private SystemtherapieService systemtherapieService;
|
||||||
|
|
||||||
private SystemtherapieAnalyzer systemtherapieAnalyzer;
|
private TherapieMitEcogAnalyzer therapieMitEcogAnalyzer;
|
||||||
|
|
||||||
private Disease dummyDisease(int id, Date diagnosisDate) {
|
private Disease dummyDisease(int id, Date diagnosisDate) {
|
||||||
var disease = new Disease(onkostarApi);
|
var disease = new Disease(onkostarApi);
|
||||||
@ -42,11 +45,13 @@ class SystemtherapieAnalyzerTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp(
|
void setUp(
|
||||||
@Mock IOnkostarApi onkostarApi,
|
@Mock IOnkostarApi onkostarApi,
|
||||||
|
@Mock StrahlentherapieService strahlentherapieService,
|
||||||
@Mock SystemtherapieService systemtherapieService
|
@Mock SystemtherapieService systemtherapieService
|
||||||
) {
|
) {
|
||||||
this.onkostarApi = onkostarApi;
|
this.onkostarApi = onkostarApi;
|
||||||
|
this.strahlentherapieService = strahlentherapieService;
|
||||||
this.systemtherapieService = systemtherapieService;
|
this.systemtherapieService = systemtherapieService;
|
||||||
this.systemtherapieAnalyzer = new SystemtherapieAnalyzer(onkostarApi, systemtherapieService);
|
this.therapieMitEcogAnalyzer = new TherapieMitEcogAnalyzer(onkostarApi, strahlentherapieService, systemtherapieService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -73,7 +78,7 @@ class SystemtherapieAnalyzerTest {
|
|||||||
|
|
||||||
doAnswer(invocationOnMock -> List.of(procedure)).when(onkostarApi).getProceduresForDiseaseByForm(anyInt(), anyString());
|
doAnswer(invocationOnMock -> List.of(procedure)).when(onkostarApi).getProceduresForDiseaseByForm(anyInt(), anyString());
|
||||||
|
|
||||||
systemtherapieAnalyzer.analyze(procedure, dummyDisease(10, diagnosisDate));
|
therapieMitEcogAnalyzer.analyze(procedure, dummyDisease(10, diagnosisDate));
|
||||||
|
|
||||||
var idCaptor = ArgumentCaptor.forClass(Integer.class);
|
var idCaptor = ArgumentCaptor.forClass(Integer.class);
|
||||||
var formNameCaptor = ArgumentCaptor.forClass(String.class);
|
var formNameCaptor = ArgumentCaptor.forClass(String.class);
|
||||||
@ -103,7 +108,7 @@ class SystemtherapieAnalyzerTest {
|
|||||||
procedure.setPatient(patient);
|
procedure.setPatient(patient);
|
||||||
procedure.setValue("ECOGvorTherapie", new Item("ECOGvorTherapie", 1));
|
procedure.setValue("ECOGvorTherapie", new Item("ECOGvorTherapie", 1));
|
||||||
|
|
||||||
systemtherapieAnalyzer.analyze(procedure, dummyDisease(10, diagnosisDate));
|
therapieMitEcogAnalyzer.analyze(procedure, dummyDisease(10, diagnosisDate));
|
||||||
|
|
||||||
verify(onkostarApi, times(0)).getProceduresForDiseaseByForm(anyInt(), anyString());
|
verify(onkostarApi, times(0)).getProceduresForDiseaseByForm(anyInt(), anyString());
|
||||||
verify(onkostarApi, times(0)).saveProcedure(any(Procedure.class), anyBoolean());
|
verify(onkostarApi, times(0)).saveProcedure(any(Procedure.class), anyBoolean());
|
||||||
@ -129,10 +134,32 @@ class SystemtherapieAnalyzerTest {
|
|||||||
procedure.setPatient(patient);
|
procedure.setPatient(patient);
|
||||||
procedure.setValue("ECOGvorTherapie", new Item("ECOGvorTherapie", 1));
|
procedure.setValue("ECOGvorTherapie", new Item("ECOGvorTherapie", 1));
|
||||||
|
|
||||||
systemtherapieAnalyzer.analyze(procedure, dummyDisease(10, diagnosisDate));
|
therapieMitEcogAnalyzer.analyze(procedure, dummyDisease(10, diagnosisDate));
|
||||||
|
|
||||||
verify(onkostarApi, times(0)).getProceduresForDiseaseByForm(anyInt(), anyString());
|
verify(onkostarApi, times(0)).getProceduresForDiseaseByForm(anyInt(), anyString());
|
||||||
verify(onkostarApi, times(0)).saveProcedure(any(Procedure.class), anyBoolean());
|
verify(onkostarApi, times(0)).saveProcedure(any(Procedure.class), anyBoolean());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldRequestEcogFromStrahlentherapieAndSystemtherapie() {
|
||||||
|
final var diagnosisDate = daysPassed(7);
|
||||||
|
final var procedureDate = daysPassed(1);
|
||||||
|
|
||||||
|
var patient = new Patient(onkostarApi);
|
||||||
|
patient.setId(1);
|
||||||
|
|
||||||
|
var procedure = new Procedure(onkostarApi);
|
||||||
|
procedure.setId(1000);
|
||||||
|
procedure.setStartDate(procedureDate);
|
||||||
|
procedure.setEditState(ProcedureEditStateType.COMPLETED);
|
||||||
|
procedure.setPatientId(1);
|
||||||
|
procedure.setPatient(patient);
|
||||||
|
procedure.setValue("ECOGvorTherapie", new Item("ECOGvorTherapie", 1));
|
||||||
|
|
||||||
|
therapieMitEcogAnalyzer.analyze(procedure, dummyDisease(10, diagnosisDate));
|
||||||
|
|
||||||
|
verify(strahlentherapieService, times(1)).ecogStatus(any());
|
||||||
|
verify(systemtherapieService, times(1)).ecogStatus(any());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user