Implementation Guide
E-T-Rezept Datenaustausch
Version 1.1.0-ballot-1 - ballot

StructureMap: E-T-Rezept Structure Map for Medication

Official URL: https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedication Version: 1.1.0-ballot-1
Draft as of 2025-07-07 Computable Name: ERPTPrescriptionStructureMapMedication

Router-Mapping zur Auswahl der korrekten Medication-Transformation basierend auf dem KBV/gematik Profil

map "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedication" = "ERPTPrescriptionStructureMapMedication"

// Router-Mapping zur Auswahl der korrekten Medication-Transformation basierend auf dem KBV/gematik Profil

uses "http://hl7.org/fhir/StructureDefinition/Medication" alias srcMedication as source
uses "http://hl7.org/fhir/StructureDefinition/Medication" alias tgtMedication as target

imports "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapGEMMedication"
imports "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVCompoundingMedication"
imports "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVPZNMedication"
imports "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVFreeTextMedication"
imports "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVIngredientMedication"

// Router-Mapping zur Auswahl der korrekten Medication-Transformation basierend auf dem KBV/gematik Profil
group ERPTPrescriptionStructureMapMedication(source srcMedication : srcMedication, target tgtMedication : tgtMedication) {
  srcMedication as srcPZN where meta.profile.contains('KBV_PR_ERP_Medication_PZN') then {
    srcPZN then ERPTPrescriptionStructureMapKBVPZNMedication(srcMedication, tgtMedication) "mapPZN"; // Führt die Transformation für PZN-Medikamente durch (Fertigarzneimittel mit Pharmazentralnummer)
  } "decideOnMedicationPZN"; // Erkennt PZN-basierte Medikamente und leitet an spezialisiertes PZN-Mapping weiter
  srcMedication as srcFreeText where meta.profile.contains('KBV_PR_ERP_Medication_FreeText') then {
    srcFreeText then ERPTPrescriptionStructureMapKBVFreeTextMedication(srcMedication, tgtMedication) "mapFreeText"; // Führt die Transformation für Freitext-Medikamente durch (nicht standardisierte Arzneimittelangaben)
  } "decideOnMedicationFreeText"; // Erkennt Freitext-Medikamente und leitet an spezialisiertes FreeText-Mapping weiter
  srcMedication as srcIngredient where meta.profile.contains('KBV_PR_ERP_Medication_Ingredient') then {
    srcIngredient then ERPTPrescriptionStructureMapKBVIngredientMedication(srcMedication, tgtMedication) "mapIngredient"; // Führt die Transformation für wirkstoffbasierte Medikamente durch (Rezeptur nach Wirkstoffen)
  } "decideOnMedicationIngredient"; // Erkennt wirkstoffbasierte Medikamente und leitet an spezialisiertes Ingredient-Mapping weiter
  srcMedication as srcCompounding where meta.profile.contains('KBV_PR_ERP_Medication_Compounding') then {
    srcCompounding then ERPTPrescriptionStructureMapKBVCompoundingMedication(srcMedication, tgtMedication) "mapCompounding"; // Führt die Transformation für Rezeptur-Medikamente durch (individuell hergestellte Arzneimittel)
  } "decideOnMedicationCompounding"; // Erkennt Rezeptur-Medikamente und leitet an spezialisiertes Compounding-Mapping weiter
  srcMedication as srcGemMed where meta.profile.contains('GEM_ERP_PR_Medication') then {
    srcGemMed then ERPTPrescriptionStructureMapGEMMedication(srcMedication, tgtMedication) "mapGemMed"; // Führt die Transformation für gematik-Medikamente durch (abgegebene Arzneimittel aus der Apotheke)
  } "decideOnMedicationGematik"; // Erkennt gematik-Medikamente und leitet an spezialisiertes gematik-Mapping weiter
}