diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..031ac9b8 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Dfile.enconding=UTF-8 diff --git a/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/ConditionMapper.java b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/ConditionMapper.java index a3712273..6d116197 100644 --- a/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/ConditionMapper.java +++ b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/ConditionMapper.java @@ -1,6 +1,6 @@ package org.miracum.streams.ume.obdstofhir.mapper.mii; -import de.basisdatensatz.obds.v3.DiagnoseTyp; +import de.basisdatensatz.obds.v3.OBDS; import org.hl7.fhir.r4.model.*; import org.miracum.streams.ume.obdstofhir.FhirProperties; import org.miracum.streams.ume.obdstofhir.mapper.ObdsToFhirMapper; @@ -19,10 +19,23 @@ public ConditionMapper(FhirProperties fhirProperties) { super(fhirProperties); } - public Condition map(DiagnoseTyp diagnose, Reference patient) { + public Condition map(OBDS.MengePatient.Patient.MengeMeldung.Meldung meldung, Reference patient) { var condition = new Condition(); condition.setSubject(patient); condition.getMeta().addProfile(fhirProperties.getProfiles().getMiiPrOnkoDiagnosePrimaertumor()); + var tumorzuordnung = meldung.getTumorzuordnung(); + if (tumorzuordnung == null) { + throw new RuntimeException("tumorzuordnung ist null"); + } + condition.setRecordedDate( + tumorzuordnung.getDiagnosedatum().getValue().toGregorianCalendar().getTime()); + + condition.setCode( + new CodeableConcept( + new Coding( + fhirProperties.getSystems().getIcd10gm(), + tumorzuordnung.getPrimaertumorICD().getCode(), + ""))); return condition; } } diff --git a/src/test/java/org/miracum/streams/ume/obdstofhir/mapper/mii/ConditionMapperTest.java b/src/test/java/org/miracum/streams/ume/obdstofhir/mapper/mii/ConditionMapperTest.java index cf74a1c0..fa3d49c6 100644 --- a/src/test/java/org/miracum/streams/ume/obdstofhir/mapper/mii/ConditionMapperTest.java +++ b/src/test/java/org/miracum/streams/ume/obdstofhir/mapper/mii/ConditionMapperTest.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule; import de.basisdatensatz.obds.v3.OBDS; import java.io.IOException; +import java.util.TimeZone; import org.approvaltests.Approvals; import org.approvaltests.core.Options; import org.hl7.fhir.r4.model.Reference; @@ -29,6 +30,7 @@ class ConditionMapperTest { @Test void map_withGivenObds_shouldCreateValidConditionResource() throws IOException { + TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin")); // TODO: refactor to use a data provider for parameterized tests final var resource = this.getClass().getClassLoader().getResource("obds3/test1.xml"); assertThat(resource).isNotNull(); @@ -45,9 +47,7 @@ void map_withGivenObds_shouldCreateValidConditionResource() throws IOException { var obdsPatient = obds.getMengePatient().getPatient().getFirst(); final var condition = - sut.map( - obdsPatient.getMengeMeldung().getMeldung().getFirst().getDiagnose(), - new Reference("Patient/1")); + sut.map(obdsPatient.getMengeMeldung().getMeldung().getFirst(), new Reference("Patient/1")); var fhirParser = FhirContext.forR4().newJsonParser().setPrettyPrint(true); var fhirJson = fhirParser.encodeResourceToString(condition); diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/ConditionMapperTest.map_withGivenObds_shouldCreateValidConditionResource.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/ConditionMapperTest.map_withGivenObds_shouldCreateValidConditionResource.approved.fhir.json index c381911e..79c40a54 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/ConditionMapperTest.map_withGivenObds_shouldCreateValidConditionResource.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/ConditionMapperTest.map_withGivenObds_shouldCreateValidConditionResource.approved.fhir.json @@ -3,7 +3,14 @@ "meta": { "profile": [ "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-diagnose-primaertumor" ] }, + "code": { + "coding": [ { + "system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm", + "code": "C17.1" + } ] + }, "subject": { "reference": "Patient/1" - } + }, + "recordedDate": "2024-06-10T02:00:00+02:00" }