Abfragen erstellen
Hier sind einige Beispiele, die Ihnen helfen, Ihre GraphQL-Abfragen zu erstellen.
Grundlegende Sammlungsabfrage
Rufen Sie die ersten 5 Professionals und deren Namen ab.
query GetProfessionals {
professionalsCollection(first: 5) {
edges {
node {
id
first_name
last_name
title
}
}
}
} Abfragen eines einzelnen Knotens nach ID
Rufen Sie einen bestimmten Professional anhand seiner ID ab.
Ersetzen Sie your-professional-id durch eine tatsächliche ID.
query GetProfessionalById {
professional(id: "your-professional-id") {
id
first_name
last_name
}
} Verwendung von Argumenten und Filtern
Filtern Sie Professionals nach Nachnamen. (Die vollständigen Filterfunktionen finden Sie in der pg_graphql-Dokumentation).
query FilterProfessionals {
professionalsCollection(filter: { last_name: { eq: "Mustermann" } }) {
edges {
node {
id
first_name
last_name
}
}
}
} Abfragen verschachtelter Daten
Rufen Sie Professionals und die zugehörigen Spezialisierungen ab.
query GetProfessionalsWithSpecialisations {
professionalsCollection(first: 2) {
edges {
node {
id
first_name
last_name
specialisationsCollection {
edges {
node {
specialisation {
id
name_de
}
}
}
}
}
}
}
} Verwendung von Variablen
Gestalten Sie Ihre Abfragen dynamisch mithilfe von Variablen.
Query
query GetProfessionalByLastName($lastName: String!) {
professionalsCollection(filter: { last_name: { eq: $lastName } }, first: 5) {
edges {
node {
id
first_name
last_name
}
}
}
} Variables
{
"lastName": "Schmidt"
} Suche nach LANR (Lebenslange Arztnummer)
In diesem Beispiel bauen wir Schritt für Schritt eine Abfrage, um eine Ärztin / einen Arzt anhand der LANR (Lebenslange Arztnummer) zu finden.
-
Wir verwenden die Tabelle
professional_idsCollection, in der verschiedene ID-Arten (z.B. LANR) gespeichert sind. -
In dieser Tabelle filtern wir auf
id_kindmit dem Enum-Wertlanr. -
Zusätzlich filtern wir auf
id_valuemit einer Variable$lanr, damit Sie die LANR dynamisch übergeben können. -
Über die Relation
professionalsholen wir das vollständige Profil der Fachkraft inklusive Spezialisierungen.
Ersetzen Sie den Beispielwert
"123456789" durch
die tatsächliche LANR, nach der Sie suchen möchten.
Query
query GetProfessionalByLanr($lanr: String!) {
professional_idsCollection(
first: 10
filter: {
id_kind: { eq: lanr } # Enum-Wert
id_value: { eq: $lanr } # String
}
) {
edges {
node {
professional_id
id_kind
id_value
professionals {
id
title
first_name
last_name
gender
languages
professional_specialisationsCollection {
edges {
node {
specialisation_id
specialisations {
slug
name_de
}
}
}
}
}
}
}
}
} Variables
{
"lanr": "123456789"
} Suche nach BSNR (Betriebsstättennummer)
In diesem Beispiel suchen wir eine Einrichtung anhand ihrer BSNR (Betriebsstättennummer).
-
Wir verwenden die Tabelle
facility_idsCollection, in der verschiedene Identifikatoren von Einrichtungen gespeichert sind (z. B. BSNR). -
In dieser Tabelle filtern wir auf
id_valuemit einer Variable$bsnr, damit Sie die BSNR dynamisch übergeben können. -
Über die Relation
facilitiesholen wir das zugehörige Einrichtungsprofil inklusive Standortdaten.
Ersetzen Sie den Beispielwert
"123456789" durch
die tatsächliche BSNR der Einrichtung, nach der Sie suchen
möchten.
Query
query GetFacilityByBsnr($bsnr: String!) {
facility_idsCollection(
first: 1
filter: { id_value: { eq: $bsnr } }
) {
edges {
node {
facility_id
id_value
facilities {
facility_type
name
website
email
phone
fax
location_id
locations {
id
street
zip_code
city
state
country
}
}
}
}
}
} Variables
{
"bsnr": "123456789"
} Client-Integration: Einrichtungsprofil (MVZ)
Diese Abfrage ruft ein umfassendes Profil für eine einzelne Einrichtung (z. B. ein medizinisches Versorgungszentrum oder "MVZ") unter Verwendung ihrer eindeutigen ID ab.
Kostenlose Einrichtungs-ID zum Testen: 5d86e14b-704e-4d4d-b851-40f7f0fee716
Query
query GetFacilityProfile($id: UUID!) {
facilitiesCollection(filter: {id: {eq: $id}}) {
edges {
node {
id
name
facility_type
website
email
phone
fax
only_private_patients
active
location: locations { street, zip_code, city, state, country, wheelchair_accessible, latitude, longitude }
opening_hoursCollection { edges { node { weekday, open_time, close_time, notes } } }
professional_facility_rolesCollection { edges { node { role, contact_email, contact_phone, professional: professionals { id, first_name, last_name, title, is_doctor } } } }
facility_idsCollection { edges { node { id_kind, id_value } } }
}
}
}
} Response Preview
{
"data": {
"facilitiesCollection": {
"edges": [ { "node": { "id": "...", "name": "MVZ Musterstadt", ... } } ]
}
}
} Client-Integration: Profil einer Fachkraft (Arzt)
Diese Abfrage ruft ein umfassendes Profil für eine einzelne Fachkraft (z. B. einen Arzt) unter Verwendung ihrer eindeutigen ID ab.
Kostenlose Fachkraft-ID zum Testen: bf9e7cdb-2a18-4a18-b792-f577ef91b25c
Query
query GetProfessionalProfile($id: UUID!) {
professionalsCollection(filter: {id: {eq: $id}}) {
edges {
node {
id, first_name, last_name, title, gender, is_doctor, is_active, languages
professionalIdsCollection { edges { node { id_kind, id_value } } }
professional_specialisationsCollection { edges { node { specialisation: specialisations { name_de, name_en, synonyms_de } } } }
professional_facility_rolesCollection { edges { node { role, contact_email, contact_phone, facility: facilities { id, name, facility_type, website, location: locations { street, zip_code, city } } } } }
}
}
}
} Response Preview
{
"data": {
"professionalsCollection": {
"edges": [ { "node": { "id": "...", "last_name": "Musterfrau", ... } } ]
}
}
}