mirror of
https://github.com/pcvolkmer/onkostar-plugin-dnpm.git
synced 2025-07-02 01:02:55 +00:00
Issue #29: Backend-Service für ECOG-Status hinzugefügt
This commit is contained in:
@ -45,7 +45,7 @@ public class DNPMHelper implements IProcedureAnalyzer {
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "0.3.0";
|
||||
return "0.4.0";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -249,4 +249,21 @@ public class DNPMHelper implements IProcedureAnalyzer {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO Achtung, keine Sicherheitsprüfung, darüber kann für jeden Patienten die Liste mit ECOG-Status abgerufen werden!
|
||||
public List<SystemtherapieService.EcogStatusWithDate> getEcogStatus(final Map<String, Object> input) {
|
||||
var pid = AnalyzerUtils.getRequiredId(input, "PatientId");
|
||||
if (pid.isEmpty()) {
|
||||
logger.error("Kein Parameter 'PatientId' angegeben, gebe leere Liste zurück");
|
||||
return List.of();
|
||||
}
|
||||
|
||||
var patient = onkostarApi.getPatient(pid.get());
|
||||
if (null == patient) {
|
||||
logger.error("Patient nicht gefunden, gebe leere Liste zurück");
|
||||
return List.of();
|
||||
}
|
||||
|
||||
return systemtherapieService.ecogSatus(patient);
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package DNPM;
|
||||
import DNPM.services.systemtherapie.SystemtherapieService;
|
||||
import de.itc.onkostar.api.IOnkostarApi;
|
||||
import de.itc.onkostar.api.Item;
|
||||
import de.itc.onkostar.api.Patient;
|
||||
import de.itc.onkostar.api.Procedure;
|
||||
import org.hibernate.SQLQuery;
|
||||
import org.hibernate.Session;
|
||||
@ -245,6 +246,23 @@ class DNPMHelperTest {
|
||||
assertThat(argumentCaptor.getValue()).contains("WHERE patient_id = 2 AND geloescht = 0");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testShouldReturnEcogStatusList() {
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
var patient = new Patient(onkostarApi);
|
||||
patient.setId(id);
|
||||
return patient;
|
||||
}).when(onkostarApi).getPatient(anyInt());
|
||||
|
||||
dnpmHelper.getEcogStatus(Map.of("PatientId", 42));
|
||||
|
||||
var argumentCaptor = ArgumentCaptor.forClass(Patient.class);
|
||||
verify(systemtherapieService, times(1)).ecogSatus(argumentCaptor.capture());
|
||||
assertThat(argumentCaptor.getValue()).isNotNull();
|
||||
assertThat(argumentCaptor.getValue().getId()).isEqualTo(42);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user