Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Commit 0521126

Browse files
committed
Merge remote-tracking branch 'origin/issues/26_dnr_consent' into develop
2 parents 4b12c71 + 513e01c commit 0521126

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

  • codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/ReadData.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public class ReadData extends AbstractServiceDelegate
5858
{
5959
private static final String NUM_CODEX_STRUCTURE_DEFINITION_PREFIX = "https://www.netzwerk-universitaetsmedizin.de/fhir/StructureDefinition";
6060
private static final String MII_LAB_STRUCTURED_DEFINITION = "https://www.medizininformatik-initiative.de/fhir/core/modul-labor/StructureDefinition/ObservationLab";
61+
private static final String NUM_CODEX_DO_NOT_RESUSCITAT_ORDER = "https://www.netzwerk-universitaetsmedizin.de/fhir/StructureDefinition/do-not-resuscitate-order";
6162

6263
private static final Logger logger = LoggerFactory.getLogger(ReadData.class);
6364

@@ -249,6 +250,35 @@ else if (resource instanceof Condition)
249250
+ c.getRecordedDateElement().getValueAsString() + "&patient:identifier="
250251
+ ConstantsDataTransfer.NAMING_SYSTEM_NUM_CODEX_DIC_PSEUDONYM + "|" + pseudonym;
251252
}
253+
else if (resource instanceof Consent)
254+
{
255+
Consent c = (Consent) resource;
256+
String profileUrl = getProfileUrl(resource, v -> v.startsWith(NUM_CODEX_STRUCTURE_DEFINITION_PREFIX));
257+
258+
if (NUM_CODEX_DO_NOT_RESUSCITAT_ORDER.equals(profileUrl))
259+
{
260+
boolean scopePresent = c.getScope().getCoding().stream().filter(co -> co.hasSystem())
261+
.filter(co -> "http://terminology.hl7.org/CodeSystem/consentscope".equals(co.getSystem()))
262+
.filter(co -> co.hasCode()).filter(co -> "adr".equals(co.getCode())).findAny().isPresent();
263+
boolean categoryPresent = c.getCategory().stream().flatMap(coc -> coc.getCoding().stream())
264+
.filter(co -> co.hasSystem())
265+
.filter(co -> "http://terminology.hl7.org/CodeSystem/consentcategorycodes"
266+
.equals(co.getSystem()))
267+
.filter(co -> co.hasCode()).filter(co -> "dnr".equals(co.getCode())).findAny().isPresent();
268+
269+
if (scopePresent && categoryPresent)
270+
return "Consent?_profile=" + profileUrl
271+
+ "&scope=http://terminology.hl7.org/CodeSystem/consentscope|adr"
272+
+ "&category=http://terminology.hl7.org/CodeSystem/consentcategorycodes|dnr"
273+
+ "&patient:identifier=" + ConstantsDataTransfer.NAMING_SYSTEM_NUM_CODEX_DIC_PSEUDONYM + "|"
274+
+ pseudonym;
275+
else
276+
throw new RuntimeException("Resource of type Consent with profile " + profileUrl
277+
+ " is missing scope: http://terminology.hl7.org/CodeSystem/consentscope|adr and/or category: http://terminology.hl7.org/CodeSystem/consentcategorycodes|dnr");
278+
}
279+
else
280+
throw new RuntimeException("Resource of type Consent with profile " + profileUrl + " not supported");
281+
}
252282
else if (resource instanceof DiagnosticReport)
253283
{
254284
DiagnosticReport dr = (DiagnosticReport) resource;

0 commit comments

Comments
 (0)