1
0
mirror of https://github.com/pcvolkmer/mv64e-onkostar-data.git synced 2025-07-02 02:22:54 +00:00

fix: possible NPE if no notes given

This commit is contained in:
2025-06-28 15:12:17 +02:00
parent 3119921ddd
commit c88f36f2ab
2 changed files with 11 additions and 3 deletions

View File

@ -50,11 +50,15 @@ public class TherapieplanDataMapper implements DataMapper<MtbCarePlan> {
.id(therapieplanData.getString("id"))
.patient(getPatientReference(therapieplanData.getString("patient_id")))
.issuedOn(therapieplanData.getDate("datum"))
// TODO see https://github.com/dnpm-dip/mtb-model/issues/8
.notes(List.of(therapieplanData.getString("protokollauszug")))
.medicationRecommendations(einzelempfehlungWirkstoffDataMapper.getByParentId(id))
.procedureRecommendations(einzelempfehlungProzedurDataMapper.getByParentId(id))
;
if (therapieplanData.getString("protokollauszug") != null) {
// TODO see https://github.com/dnpm-dip/mtb-model/issues/8
builder.notes(List.of(therapieplanData.getString("protokollauszug")));
}
return builder.build();
}

View File

@ -46,7 +46,8 @@ class TherapieplanDataMapperTest {
final var testData = Map.of(
"id", "1",
"patient_id", "42",
"wirkstoffe_json", "[{\"code\":\"\",\"name\":\"PARP-Inhibierung\",\"system\":\"UNREGISTERED\"}]"
"wirkstoffe_json", "[{\"code\":\"\",\"name\":\"PARP-Inhibierung\",\"system\":\"UNREGISTERED\"}]",
"protokollauszug", "Das ist ein Protokollauszug"
);
doAnswer(invocationOnMock -> {
@ -69,6 +70,9 @@ class TherapieplanDataMapperTest {
.isEqualTo(Reference.builder().id("42").type("Patient").build());
assertThat(actual.getMedicationRecommendations()).hasSize(1);
assertThat(actual.getNotes()).hasSize(1);
assertThat(actual.getNotes().get(0)).isEqualTo("Das ist ein Protokollauszug");
}
}