{
  "resourceType" : "StructureMap",
  "id" : "ERPTPrescriptionStructureMapMedication",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap ERPTPrescriptionStructureMapMedication</b></p><a name=\"ERPTPrescriptionStructureMapMedication\"> </a><a name=\"hcERPTPrescriptionStructureMapMedication\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedication<span style=\"color: navy\">&quot; = &quot;</span>ERPTPrescriptionStructureMapMedication<span style=\"color: navy\">&quot;\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Router-Mapping zur Auswahl der korrekten Medication-Transformation basierend auf dem KBV/gematik Profil</span>\r\n\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/medication.html\" title=\"Medication\">http://hl7.org/fhir/StructureDefinition/Medication</a><span style=\"color: navy\">&quot; </span><b>alias </b>srcMedication <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/medication.html\" title=\"Medication\">http://hl7.org/fhir/StructureDefinition/Medication</a><span style=\"color: navy\">&quot; </span><b>alias </b>tgtMedication <b>as </b><b>target</b>\r\n\r\n<b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-ERPTPrescriptionStructureMapGEMMedication.html\" title=\"E-T-Rezept Structure Map for Medication\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapGEMMedication</a><span style=\"color: navy\">&quot;\r\n</span><b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-ERPTPrescriptionStructureMapKBVCompoundingMedication.html\" title=\"E-T-Rezept Structure Map for KBV Compounding Medication\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVCompoundingMedication</a><span style=\"color: navy\">&quot;\r\n</span><b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-ERPTPrescriptionStructureMapKBVPZNMedication.html\" title=\"E-T-Rezept Structure Map for KBV PZN Medication\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVPZNMedication</a><span style=\"color: navy\">&quot;\r\n</span><b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-ERPTPrescriptionStructureMapKBVFreeTextMedication.html\" title=\"E-T-Rezept Structure Map for KBV FreeText Medication\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVFreeTextMedication</a><span style=\"color: navy\">&quot;\r\n</span><b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-ERPTPrescriptionStructureMapKBVIngredientMedication.html\" title=\"E-T-Rezept Structure Map for KBV Ingredient Medication\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVIngredientMedication</a><span style=\"color: navy\">&quot;\r\n</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Router-Mapping zur Auswahl der korrekten Medication-Transformation basierend auf dem KBV/gematik Profil</span>\r\n<b>group </b>ERPTPrescriptionStructureMapMedication<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcMedication</span><span style=\"color: navy\"> : </span>srcMedication, <b>target</b> <span style=\"color: maroon\">tgtMedication</span><span style=\"color: navy\"> : </span>tgtMedication<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcMedication<b> as </b><span style=\"color: maroon\">srcPZN</span><b> where </b>meta.profile.contains('KBV_PR_ERP_Medication_PZN')<b> then</b><span style=\"color: navy\"> {\r\n</span>    srcPZN<b> then </b>ERPTPrescriptionStructureMapKBVPZNMedication<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcMedication</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMedication</span><span style=\"color: navy\">)</span> <i>&quot;mapPZN&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die Transformation für PZN-Medikamente durch (Fertigarzneimittel mit Pharmazentralnummer)</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;decideOnMedicationPZN&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erkennt PZN-basierte Medikamente und leitet an spezialisiertes PZN-Mapping weiter</span>\r\n  srcMedication<b> as </b><span style=\"color: maroon\">srcFreeText</span><b> where </b>meta.profile.contains('KBV_PR_ERP_Medication_FreeText')<b> then</b><span style=\"color: navy\"> {\r\n</span>    srcFreeText<b> then </b>ERPTPrescriptionStructureMapKBVFreeTextMedication<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcMedication</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMedication</span><span style=\"color: navy\">)</span> <i>&quot;mapFreeText&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die Transformation für Freitext-Medikamente durch (nicht standardisierte Arzneimittelangaben)</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;decideOnMedicationFreeText&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erkennt Freitext-Medikamente und leitet an spezialisiertes FreeText-Mapping weiter</span>\r\n  srcMedication<b> as </b><span style=\"color: maroon\">srcIngredient</span><b> where </b>meta.profile.contains('KBV_PR_ERP_Medication_Ingredient')<b> then</b><span style=\"color: navy\"> {\r\n</span>    srcIngredient<b> then </b>ERPTPrescriptionStructureMapKBVIngredientMedication<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcMedication</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMedication</span><span style=\"color: navy\">)</span> <i>&quot;mapIngredient&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die Transformation für wirkstoffbasierte Medikamente durch (Rezeptur nach Wirkstoffen)</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;decideOnMedicationIngredient&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erkennt wirkstoffbasierte Medikamente und leitet an spezialisiertes Ingredient-Mapping weiter</span>\r\n  srcMedication<b> as </b><span style=\"color: maroon\">srcCompounding</span><b> where </b>meta.profile.contains('KBV_PR_ERP_Medication_Compounding')<b> then</b><span style=\"color: navy\"> {\r\n</span>    srcCompounding<b> then </b>ERPTPrescriptionStructureMapKBVCompoundingMedication<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcMedication</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMedication</span><span style=\"color: navy\">)</span> <i>&quot;mapCompounding&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die Transformation für Rezeptur-Medikamente durch (individuell hergestellte Arzneimittel)</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;decideOnMedicationCompounding&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erkennt Rezeptur-Medikamente und leitet an spezialisiertes Compounding-Mapping weiter</span>\r\n  srcMedication<b> as </b><span style=\"color: maroon\">srcGemMed</span><b> where </b>meta.profile.contains('GEM_ERP_PR_Medication')<b> then</b><span style=\"color: navy\"> {\r\n</span>    srcGemMed<b> then </b>ERPTPrescriptionStructureMapGEMMedication<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcMedication</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMedication</span><span style=\"color: navy\">)</span> <i>&quot;mapGemMed&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die Transformation für gematik-Medikamente durch (abgegebene Arzneimittel aus der Apotheke)</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;decideOnMedicationGematik&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erkennt gematik-Medikamente und leitet an spezialisiertes gematik-Mapping weiter</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
  },
  "url" : "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedication",
  "version" : "2.0.0-ballot.1",
  "name" : "ERPTPrescriptionStructureMapMedication",
  "title" : "E-T-Rezept Structure Map for Medication",
  "status" : "draft",
  "experimental" : false,
  "date" : "2026-05-26",
  "publisher" : "gematik GmbH",
  "contact" : [{
    "name" : "gematik GmbH",
    "telecom" : [{
      "system" : "url",
      "value" : "https://gematik.de"
    },
    {
      "system" : "email",
      "value" : "erp-umsetzung@gematik.de"
    }]
  }],
  "description" : "Router-Mapping zur Auswahl der korrekten Medication-Transformation basierend auf dem KBV/gematik Profil",
  "jurisdiction" : [{
    "coding" : [{
      "system" : "urn:iso:std:iso:3166",
      "code" : "DE",
      "display" : "Germany"
    }]
  }],
  "structure" : [{
    "url" : "http://hl7.org/fhir/StructureDefinition/Medication",
    "mode" : "source",
    "alias" : "srcMedication"
  },
  {
    "url" : "http://hl7.org/fhir/StructureDefinition/Medication",
    "mode" : "target",
    "alias" : "tgtMedication"
  }],
  "import" : ["https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapGEMMedication",
  "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVCompoundingMedication",
  "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVPZNMedication",
  "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVFreeTextMedication",
  "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVIngredientMedication"],
  "group" : [{
    "name" : "ERPTPrescriptionStructureMapMedication",
    "typeMode" : "none",
    "documentation" : "Router-Mapping zur Auswahl der korrekten Medication-Transformation basierend auf dem KBV/gematik Profil",
    "input" : [{
      "name" : "srcMedication",
      "type" : "srcMedication",
      "mode" : "source"
    },
    {
      "name" : "tgtMedication",
      "type" : "tgtMedication",
      "mode" : "target"
    }],
    "rule" : [{
      "name" : "decideOnMedicationPZN",
      "source" : [{
        "context" : "srcMedication",
        "variable" : "srcPZN",
        "condition" : "meta.profile.contains('KBV_PR_ERP_Medication_PZN')"
      }],
      "rule" : [{
        "name" : "mapPZN",
        "source" : [{
          "context" : "srcPZN"
        }],
        "dependent" : [{
          "name" : "ERPTPrescriptionStructureMapKBVPZNMedication",
          "variable" : ["srcMedication",
          "tgtMedication"]
        }],
        "documentation" : "Führt die Transformation für PZN-Medikamente durch (Fertigarzneimittel mit Pharmazentralnummer)"
      }],
      "documentation" : "Erkennt PZN-basierte Medikamente und leitet an spezialisiertes PZN-Mapping weiter"
    },
    {
      "name" : "decideOnMedicationFreeText",
      "source" : [{
        "context" : "srcMedication",
        "variable" : "srcFreeText",
        "condition" : "meta.profile.contains('KBV_PR_ERP_Medication_FreeText')"
      }],
      "rule" : [{
        "name" : "mapFreeText",
        "source" : [{
          "context" : "srcFreeText"
        }],
        "dependent" : [{
          "name" : "ERPTPrescriptionStructureMapKBVFreeTextMedication",
          "variable" : ["srcMedication",
          "tgtMedication"]
        }],
        "documentation" : "Führt die Transformation für Freitext-Medikamente durch (nicht standardisierte Arzneimittelangaben)"
      }],
      "documentation" : "Erkennt Freitext-Medikamente und leitet an spezialisiertes FreeText-Mapping weiter"
    },
    {
      "name" : "decideOnMedicationIngredient",
      "source" : [{
        "context" : "srcMedication",
        "variable" : "srcIngredient",
        "condition" : "meta.profile.contains('KBV_PR_ERP_Medication_Ingredient')"
      }],
      "rule" : [{
        "name" : "mapIngredient",
        "source" : [{
          "context" : "srcIngredient"
        }],
        "dependent" : [{
          "name" : "ERPTPrescriptionStructureMapKBVIngredientMedication",
          "variable" : ["srcMedication",
          "tgtMedication"]
        }],
        "documentation" : "Führt die Transformation für wirkstoffbasierte Medikamente durch (Rezeptur nach Wirkstoffen)"
      }],
      "documentation" : "Erkennt wirkstoffbasierte Medikamente und leitet an spezialisiertes Ingredient-Mapping weiter"
    },
    {
      "name" : "decideOnMedicationCompounding",
      "source" : [{
        "context" : "srcMedication",
        "variable" : "srcCompounding",
        "condition" : "meta.profile.contains('KBV_PR_ERP_Medication_Compounding')"
      }],
      "rule" : [{
        "name" : "mapCompounding",
        "source" : [{
          "context" : "srcCompounding"
        }],
        "dependent" : [{
          "name" : "ERPTPrescriptionStructureMapKBVCompoundingMedication",
          "variable" : ["srcMedication",
          "tgtMedication"]
        }],
        "documentation" : "Führt die Transformation für Rezeptur-Medikamente durch (individuell hergestellte Arzneimittel)"
      }],
      "documentation" : "Erkennt Rezeptur-Medikamente und leitet an spezialisiertes Compounding-Mapping weiter"
    },
    {
      "name" : "decideOnMedicationGematik",
      "source" : [{
        "context" : "srcMedication",
        "variable" : "srcGemMed",
        "condition" : "meta.profile.contains('GEM_ERP_PR_Medication')"
      }],
      "rule" : [{
        "name" : "mapGemMed",
        "source" : [{
          "context" : "srcGemMed"
        }],
        "dependent" : [{
          "name" : "ERPTPrescriptionStructureMapGEMMedication",
          "variable" : ["srcMedication",
          "tgtMedication"]
        }],
        "documentation" : "Führt die Transformation für gematik-Medikamente durch (abgegebene Arzneimittel aus der Apotheke)"
      }],
      "documentation" : "Erkennt gematik-Medikamente und leitet an spezialisiertes gematik-Mapping weiter"
    }]
  }]
}