mirror of
https://github.com/pcvolkmer/onkostar-plugin-dnpm.git
synced 2025-07-02 01:02:55 +00:00
Issue #54: Add common EcogService interface
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package DNPM.analyzer;
|
||||
|
||||
import DNPM.dto.EcogStatusWithDate;
|
||||
import DNPM.VerweisVon;
|
||||
import DNPM.security.DelegatingDataBasedPermissionEvaluator;
|
||||
import DNPM.security.IllegalSecuredObjectAccessException;
|
||||
@ -237,7 +238,7 @@ public class DNPMHelper extends BackendService {
|
||||
|
||||
}
|
||||
|
||||
public List<SystemtherapieService.EcogStatusWithDate> getEcogStatus(final Map<String, Object> input) {
|
||||
public List<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");
|
||||
|
@ -1,5 +1,6 @@
|
||||
package DNPM.analyzer;
|
||||
|
||||
import DNPM.dto.EcogStatusWithDate;
|
||||
import DNPM.services.systemtherapie.SystemtherapieService;
|
||||
import de.itc.onkostar.api.Disease;
|
||||
import de.itc.onkostar.api.IOnkostarApi;
|
||||
@ -111,7 +112,7 @@ public class SystemtherapieAnalyzer extends Analyzer {
|
||||
});
|
||||
}
|
||||
|
||||
private void updateExistingEcogVerlauf(Procedure p, List<SystemtherapieService.EcogStatusWithDate> ecogFromCompleted, Item ufEcog) {
|
||||
private void updateExistingEcogVerlauf(Procedure p, List<EcogStatusWithDate> ecogFromCompleted, Item ufEcog) {
|
||||
var shouldSave = false;
|
||||
var existingDates = ufEcog.<List<Map<String, String>>>getValue().stream()
|
||||
.map(v -> v.get("Datum"))
|
||||
@ -136,7 +137,7 @@ public class SystemtherapieAnalyzer extends Analyzer {
|
||||
}
|
||||
}
|
||||
|
||||
private void newEcogverlauf(Procedure p, List<SystemtherapieService.EcogStatusWithDate> ecogFromCompleted) {
|
||||
private void newEcogverlauf(Procedure p, List<EcogStatusWithDate> ecogFromCompleted) {
|
||||
p.setValue("ECOGVerlauf", new Item("ECOGVerlauf", List.of()));
|
||||
for (var ecog : ecogFromCompleted) {
|
||||
var newSubProcedure = new Procedure(onkostarApi);
|
||||
|
68
src/main/java/DNPM/dto/EcogStatusWithDate.java
Normal file
68
src/main/java/DNPM/dto/EcogStatusWithDate.java
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* 2023 Comprehensive Cancer Center Mainfranken
|
||||
*
|
||||
* 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 DNPM.dto;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Datenklasse zum Abbilden des ECOG-Status und Datum
|
||||
*/
|
||||
public class EcogStatusWithDate {
|
||||
private Date date;
|
||||
private String status;
|
||||
|
||||
public EcogStatusWithDate(Date date, String status) {
|
||||
Assert.notNull(date, "Date cannot be null");
|
||||
Assert.hasText(status, "Status cannot be empty String");
|
||||
Assert.isTrue(isValidEcogCode(status), "Not a valid ADT.LeistungszustandECOG code");
|
||||
this.date = date;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
private boolean isValidEcogCode(String status) {
|
||||
switch (status) {
|
||||
case "0":
|
||||
case "1":
|
||||
case "2":
|
||||
case "3":
|
||||
case "4":
|
||||
case "5":
|
||||
case "U":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
}
|
30
src/main/java/DNPM/services/TherapieMitEcogService.java
Normal file
30
src/main/java/DNPM/services/TherapieMitEcogService.java
Normal file
@ -0,0 +1,30 @@
|
||||
package DNPM.services;
|
||||
|
||||
import DNPM.dto.EcogStatusWithDate;
|
||||
import de.itc.onkostar.api.Patient;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Schnittstelle zum Ermitteln von ECOG-Statusinformationen
|
||||
*
|
||||
* @since 0.6.0
|
||||
*/
|
||||
public interface TherapieMitEcogService {
|
||||
|
||||
/**
|
||||
* Ermittelt den letzten bekannten ECOG-Status aus allen Therapieformularen des Patienten
|
||||
* @param patient Der zu verwendende Patient
|
||||
* @return Der ECOG-Status als String oder leeres Optional
|
||||
*/
|
||||
Optional<String> latestEcogStatus(Patient patient);
|
||||
|
||||
/**
|
||||
* Ermittelt jeden bekannten ECOG-Status aus allen Therapieformularen des Patienten
|
||||
* @param patient Der zu verwendende Patient
|
||||
* @return Eine Liste mit Datum und ECOG-Status als String
|
||||
*/
|
||||
List<EcogStatusWithDate> ecogStatus(Patient patient);
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package DNPM.services.strahlentherapie;
|
||||
|
||||
import DNPM.dto.EcogStatusWithDate;
|
||||
import DNPM.services.SettingsService;
|
||||
import de.itc.onkostar.api.IOnkostarApi;
|
||||
import de.itc.onkostar.api.Patient;
|
||||
|
@ -1,70 +1,10 @@
|
||||
package DNPM.services.strahlentherapie;
|
||||
|
||||
import de.itc.onkostar.api.Patient;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import DNPM.services.TherapieMitEcogService;
|
||||
|
||||
/**
|
||||
* Service für Systemtherapieformulare
|
||||
*
|
||||
* @since 0.6.0
|
||||
*/
|
||||
public interface StrahlentherapieService {
|
||||
|
||||
/**
|
||||
* Ermittelt den letzten bekannten ECOG-Status aus allen Systemtherapieformularen des Patienten
|
||||
* @param patient Der zu verwendende Patient
|
||||
* @return Der ECOG-Status als String oder leeres Optional
|
||||
*/
|
||||
Optional<String> latestEcogStatus(Patient patient);
|
||||
|
||||
/**
|
||||
* Ermittelt jeden bekannten ECOG-Status aus allen Strahlentherapieformularen des Patienten
|
||||
* @param patient Der zu verwendende Patient
|
||||
* @return Eine Liste mit Datum und ECOG-Status als String
|
||||
*/
|
||||
List<EcogStatusWithDate> ecogStatus(Patient patient);
|
||||
|
||||
/**
|
||||
* Datenklasse zum Abbilden des ECOG-Status und Datum
|
||||
*/
|
||||
class EcogStatusWithDate {
|
||||
private Date date;
|
||||
private String status;
|
||||
|
||||
public EcogStatusWithDate(Date date, String status) {
|
||||
Assert.notNull(date, "Date cannot be null");
|
||||
Assert.hasText(status, "Status cannot be empty String");
|
||||
Assert.isTrue(isValidEcogCode(status), "Not a valid ADT.LeistungszustandECOG code");
|
||||
this.date = date;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
private boolean isValidEcogCode(String status) {
|
||||
switch (status) {
|
||||
case "0":
|
||||
case "1":
|
||||
case "2":
|
||||
case "3":
|
||||
case "4":
|
||||
case "5":
|
||||
case "U":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public interface StrahlentherapieService extends TherapieMitEcogService {}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package DNPM.services.systemtherapie;
|
||||
|
||||
import DNPM.dto.EcogStatusWithDate;
|
||||
import DNPM.services.SettingsService;
|
||||
import de.itc.onkostar.api.IOnkostarApi;
|
||||
import de.itc.onkostar.api.Patient;
|
||||
|
@ -1,20 +1,17 @@
|
||||
package DNPM.services.systemtherapie;
|
||||
|
||||
import de.itc.onkostar.api.Patient;
|
||||
import DNPM.services.TherapieMitEcogService;
|
||||
import de.itc.onkostar.api.Procedure;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Service für Systemtherapieformulare
|
||||
*
|
||||
* @since 0.2.0
|
||||
*/
|
||||
public interface SystemtherapieService {
|
||||
public interface SystemtherapieService extends TherapieMitEcogService {
|
||||
/**
|
||||
* Ermittelt eine Zusammenfassung der systemischen Therapien für eine Erkrankung
|
||||
* @param diseaseId Die ID der Erkrankung
|
||||
@ -29,57 +26,4 @@ public interface SystemtherapieService {
|
||||
*/
|
||||
ProzedurToProzedurwerteMapper prozedurToProzedurwerteMapper(Procedure procedure);
|
||||
|
||||
/**
|
||||
* Ermittelt den letzten bekannten ECOG-Status aus allen Systemtherapieformularen des Patienten
|
||||
* @param patient Der zu verwendende Patient
|
||||
* @return Der ECOG-Status als String oder leeres Optional
|
||||
*/
|
||||
Optional<String> latestEcogStatus(Patient patient);
|
||||
|
||||
/**
|
||||
* Ermittelt jeden bekannten ECOG-Status aus allen Systemtherapieformularen des Patienten
|
||||
* @param patient Der zu verwendende Patient
|
||||
* @return Eine Liste mit Datum und ECOG-Status als String
|
||||
*/
|
||||
List<EcogStatusWithDate> ecogStatus(Patient patient);
|
||||
|
||||
/**
|
||||
* Datenklasse zum Abbilden des ECOG-Status und Datum
|
||||
*/
|
||||
class EcogStatusWithDate {
|
||||
private Date date;
|
||||
private String status;
|
||||
|
||||
public EcogStatusWithDate(Date date, String status) {
|
||||
Assert.notNull(date, "Date cannot be null");
|
||||
Assert.hasText(status, "Status cannot be empty String");
|
||||
Assert.isTrue(isValidEcogCode(status), "Not a valid ADT.LeistungszustandECOG code");
|
||||
this.date = date;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
private boolean isValidEcogCode(String status) {
|
||||
switch (status) {
|
||||
case "0":
|
||||
case "1":
|
||||
case "2":
|
||||
case "3":
|
||||
case "4":
|
||||
case "5":
|
||||
case "U":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package DNPM.analyzer;
|
||||
|
||||
import DNPM.dto.EcogStatusWithDate;
|
||||
import DNPM.services.systemtherapie.SystemtherapieService;
|
||||
import de.itc.onkostar.api.*;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@ -54,7 +55,7 @@ class SystemtherapieAnalyzerTest {
|
||||
final var ecogDate = daysPassed(1);
|
||||
final var procedureDate = daysPassed(1);
|
||||
|
||||
doAnswer(invocationOnMock -> List.of(new SystemtherapieService.EcogStatusWithDate(ecogDate, "0")))
|
||||
doAnswer(invocationOnMock -> List.of(new EcogStatusWithDate(ecogDate, "0")))
|
||||
.when(systemtherapieService).ecogStatus(any(Patient.class));
|
||||
|
||||
var patient = new Patient(onkostarApi);
|
||||
@ -114,7 +115,7 @@ class SystemtherapieAnalyzerTest {
|
||||
final var ecogDate = daysPassed(28);
|
||||
final var procedureDate = daysPassed(1);
|
||||
|
||||
doAnswer(invocationOnMock -> List.of(new SystemtherapieService.EcogStatusWithDate(ecogDate, "0")))
|
||||
doAnswer(invocationOnMock -> List.of(new EcogStatusWithDate(ecogDate, "0")))
|
||||
.when(systemtherapieService).ecogStatus(any(Patient.class));
|
||||
|
||||
var patient = new Patient(onkostarApi);
|
||||
|
Reference in New Issue
Block a user