mirror of
https://github.com/pcvolkmer/onkostar-plugin-dnpm.git
synced 2025-07-03 01:32:55 +00:00
Issue #20: Kein Consent-Update, wenn kein Datum oder Wert angegeben
closes #20
This commit is contained in:
@ -15,7 +15,7 @@ import java.util.Comparator;
|
|||||||
*/
|
*/
|
||||||
public class UkwConsentManagerService implements ConsentManagerService {
|
public class UkwConsentManagerService implements ConsentManagerService {
|
||||||
|
|
||||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
private final IOnkostarApi onkostarApi;
|
private final IOnkostarApi onkostarApi;
|
||||||
|
|
||||||
@ -48,10 +48,10 @@ public class UkwConsentManagerService implements ConsentManagerService {
|
|||||||
.ifPresent(lastConsent -> {
|
.ifPresent(lastConsent -> {
|
||||||
var date = lastConsent.getStartDate();
|
var date = lastConsent.getStartDate();
|
||||||
var status = lastConsent.getValue("status");
|
var status = lastConsent.getValue("status");
|
||||||
if (null == status) {
|
if (null == date || null == status || status.getString().isBlank()) {
|
||||||
logger.warn("Kein DNPM-Einwilligungstatus angegeben");
|
logger.warn("Kein DNPM-Einwilligungstatus angegeben");
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
dnpmKlinikAnamnese.setValue("ConsentStatusEinwilligungDNPM", new Item("Einwilligung", status.getString()));
|
dnpmKlinikAnamnese.setValue("ConsentStatusEinwilligungDNPM", new Item("Einwilligung", status.getString()));
|
||||||
dnpmKlinikAnamnese.setValue("ConsentDatumEinwilligungDNPM", new Item("DatumEinwilligung", date));
|
dnpmKlinikAnamnese.setValue("ConsentDatumEinwilligungDNPM", new Item("DatumEinwilligung", date));
|
||||||
|
@ -51,6 +51,58 @@ public class UkwConsentManagerServiceTest {
|
|||||||
verify(onkostarApi, times(0)).saveProcedure(any(Procedure.class), anyBoolean());
|
verify(onkostarApi, times(0)).saveProcedure(any(Procedure.class), anyBoolean());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testShouldSkipUpdateRelatedDnpmKlinikAnamneseFormIfNoConsentDateAvailable() throws Exception {
|
||||||
|
|
||||||
|
var consentSubForm = new Procedure(this.onkostarApi);
|
||||||
|
consentSubForm.setId(1);
|
||||||
|
consentSubForm.setPatientId(123);
|
||||||
|
consentSubForm.setValue("status", new Item("status", "accepted"));
|
||||||
|
|
||||||
|
|
||||||
|
var excelForm = new Procedure(this.onkostarApi);
|
||||||
|
excelForm.setId(111);
|
||||||
|
excelForm.setPatientId(123);
|
||||||
|
excelForm.setValue("refdnpmklinikanamnese", new Item("refdnpmklinikanamnese", 2));
|
||||||
|
excelForm.addSubProcedure("ufdnpmconsent", consentSubForm);
|
||||||
|
|
||||||
|
var dnpmKlinikAnamneseForm = new Procedure(this.onkostarApi);
|
||||||
|
dnpmKlinikAnamneseForm.setId(2);
|
||||||
|
dnpmKlinikAnamneseForm.setPatientId(123);
|
||||||
|
|
||||||
|
when(onkostarApi.getProcedure(anyInt())).thenReturn(dnpmKlinikAnamneseForm);
|
||||||
|
|
||||||
|
this.service.applyConsent(excelForm);
|
||||||
|
|
||||||
|
verify(onkostarApi, times(0)).saveProcedure(any(Procedure.class), anyBoolean());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testShouldSkipUpdateRelatedDnpmKlinikAnamneseFormIfNoConsentValueAvailable() throws Exception {
|
||||||
|
|
||||||
|
var consentSubForm = new Procedure(this.onkostarApi);
|
||||||
|
consentSubForm.setId(1);
|
||||||
|
consentSubForm.setPatientId(123);
|
||||||
|
consentSubForm.setStartDate(Date.from(Instant.parse("2023-04-03T12:00:00Z")));
|
||||||
|
consentSubForm.setValue("datum", new Item("datum", Date.from(Instant.parse("2023-04-03T12:00:00Z"))));
|
||||||
|
|
||||||
|
var excelForm = new Procedure(this.onkostarApi);
|
||||||
|
excelForm.setId(111);
|
||||||
|
excelForm.setPatientId(123);
|
||||||
|
excelForm.setValue("refdnpmklinikanamnese", new Item("refdnpmklinikanamnese", 2));
|
||||||
|
excelForm.addSubProcedure("ufdnpmconsent", consentSubForm);
|
||||||
|
|
||||||
|
var dnpmKlinikAnamneseForm = new Procedure(this.onkostarApi);
|
||||||
|
dnpmKlinikAnamneseForm.setId(2);
|
||||||
|
dnpmKlinikAnamneseForm.setPatientId(123);
|
||||||
|
|
||||||
|
when(onkostarApi.getProcedure(anyInt())).thenReturn(dnpmKlinikAnamneseForm);
|
||||||
|
|
||||||
|
this.service.applyConsent(excelForm);
|
||||||
|
|
||||||
|
verify(onkostarApi, times(0)).saveProcedure(any(Procedure.class), anyBoolean());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testShouldUpdateRelatedDnpmKlinikAnamneseFormOnFormSave() throws Exception {
|
void testShouldUpdateRelatedDnpmKlinikAnamneseFormOnFormSave() throws Exception {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user