Implementation Guide
TIFlow - Datenaustausch BfArM Webdienst
Version 2.0.0 - release

StructureMap: E-T-Rezept Structure Map for Medication

Official URL: https://gematik.de/fhir/tiflow-bfarm/StructureMap/ERPTPrescriptionStructureMapMedication Version: 2.0.0
Active as of 2026-10-02 Computable Name: ERPTPrescriptionStructureMapMedication

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

map "https://gematik.de/fhir/tiflow-bfarm/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/tiflow-bfarm/StructureMap/ERPTPrescriptionStructureMapGEMMedication"
imports "https://gematik.de/fhir/tiflow-bfarm/StructureMap/ERPTPrescriptionStructureMapKBVCompoundingMedication"
imports "https://gematik.de/fhir/tiflow-bfarm/StructureMap/ERPTPrescriptionStructureMapKBVPZNMedication"
imports "https://gematik.de/fhir/tiflow-bfarm/StructureMap/ERPTPrescriptionStructureMapKBVFreeTextMedication"
imports "https://gematik.de/fhir/tiflow-bfarm/StructureMap/ERPTPrescriptionStructureMapKBVIngredientMedication"

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