mirror of
https://github.com/pcvolkmer/onkostar-plugin-dnpm.git
synced 2025-07-03 01:32:55 +00:00
Alternative Implementierung des Mappings Prozedur zu Protokollauszug
Diese Implementierung basiert auf der Zuordnung zum Formularnamen. Unbekannte Formulare werden zum leeren String gemappt.
This commit is contained in:
@ -1,40 +1,32 @@
|
||||
package DNPM.services.mtb;
|
||||
|
||||
import DNPM.services.SettingsService;
|
||||
import de.itc.onkostar.api.Procedure;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Standardimplementierung des MtbService
|
||||
*
|
||||
* @since 0.0.2
|
||||
*/
|
||||
public class DefaultMtbService implements MtbService {
|
||||
|
||||
private final SettingsService settingsService;
|
||||
|
||||
public DefaultMtbService(final SettingsService settingsService) {
|
||||
this.settingsService = settingsService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProtocol(List<Procedure> procedures) {
|
||||
ProcedureToProtocolMapper mapper = null;
|
||||
var sid = settingsService.getSID();
|
||||
return procedures.stream()
|
||||
.sorted(Comparator.comparing(Procedure::getStartDate))
|
||||
.map(procedure -> {
|
||||
var mapper = MtbService.procedureToProtocolMapper(procedure);
|
||||
return mapper.apply(procedure);
|
||||
})
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get)
|
||||
.distinct()
|
||||
.collect(Collectors.joining("\n\n"));
|
||||
|
||||
if (sid.isPresent()) {
|
||||
switch (sid.get()) {
|
||||
case "2011":
|
||||
case "20119":
|
||||
mapper = new OsTumorkonferenzVarianteUkwToProtocolMapper();
|
||||
default:
|
||||
if (!settingsService.multipleMtbsInMtbEpisode()) {
|
||||
mapper = new OsTumorkonferenzToProtocolMapper();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null == mapper) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return mapper.apply(procedures).orElse("");
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user