TIFlow - Datenaustausch BfArM Webdienst
Version 2.0.0-ballot.1 - ci-build

## StructureMap: E-T-Rezept Structure Map for Organization

Official URL: https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapOrganization | Version: 2.0.0-ballot.1
Draft as of 2026-05-26 | Computable Name: ERPTPrescriptionStructureMapOrganization

Mapping-Anweisungen zur Erstellung einer BfArM Organization aus dem VZD SearchSet

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

    // Mapping-Anweisungen zur Erstellung einer BfArM Organization aus dem VZD SearchSet

    uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias vzdSearchSet as source
    uses "http://hl7.org/fhir/StructureDefinition/Organization" alias bfarmOrganization as target

    // Mapping-Anweisungen zur Erstellung einer BfArM Organization aus dem VZD SearchSet
    group ERPTPrescriptionStructureMapOrganization(source vzdSearchSet : vzdSearchSet, target bfarmOrganization : bfarmOrganization) {
      vzdSearchSet.entry as srcEntryOrgVar then {
        srcEntryOrgVar.resource : Organization as srcEntryOrganizationVar where ofType(Organization) then {
          srcEntryOrganizationVar.name as srcOrgNameVar -> bfarmOrganization.name = srcOrgNameVar; // Übernimmt den Namen der Organisation aus dem VZD in die BfArM Organization
          srcEntryOrganizationVar.identifier as srcOrgIdentifierVar where $this.system='https://gematik.de/fhir/sid/telematik-id' -> bfarmOrganization.identifier as bfarmOrganizationIdentifierVar then {
            srcOrgIdentifierVar.value as srcOrgIdentifierValueVar log tgtTidIdentifier ->  bfarmOrganizationIdentifierVar.system = 'https://gematik.de/fhir/sid/telematik-id',  bfarmOrganizationIdentifierVar.value = srcOrgIdentifierValueVar,  bfarmOrganization.id = srcOrgIdentifierValueVar "tidValue"; // Kopiert die Telematik-ID mit korrektem System-Identifier in die Ziel-Organisation
          } "tid"; // Mappt die Telematik-ID der Organisation
        } "entry"; // Verarbeitet jeden Eintrag im SearchSet
      } "mapOrganization"; // Mappt Organization-Einträge aus dem VZD SearchSet
      vzdSearchSet.entry as srcEntryHCSVar then {
        srcEntryHCSVar.resource : HealthcareService as srcEntryHealthcareServiceVar where ofType(HealthcareService) then {
          srcEntryHealthcareServiceVar.telecom as srcHcsTelecomVar -> bfarmOrganization.telecom = srcHcsTelecomVar; // Übernimmt Kontaktinformationen (Telefon, E-Mail) aus dem HealthcareService in die Organisation
        } "entry"; // Verarbeitet HealthcareService-Einträge aus dem SearchSet
      } "mapHealthcareService"; // Mappt HealthcareService-Informationen für Kontaktdaten
      vzdSearchSet.entry as srcEntryHCSVar then {
        srcEntryHCSVar.resource : Location as srcEntryLocationVar where ofType(Location) then {
          srcEntryLocationVar.address as srcLocationAddressVar -> bfarmOrganization.address = srcLocationAddressVar; // Übernimmt die Adressinformationen aus der Location in die Organisation
        } "entry"; // Verarbeitet Location-Einträge aus dem SearchSet
      } "mapLocation"; // Mappt Location-Informationen für Adressdaten
    }