Skip to content
Partner Developer Portal

Definition

The Appointment Slotstatus model records statuses associated with appointment slots and their recorded dates and times. Each entry holds the slot identifier, status identifier and status timestamp together with source organisation information describing the context of the status record.

_deleted indicates whether the record has been deleted in the source system.

appointment.slotstatus with appointment.slot and appointment.status details

Section titled “appointment.slotstatus with appointment.slot and appointment.status details”

Return records alongside descriptive values from the related tables.

SELECT
m."_primary_key",
m."slotid",
p1."patientname" AS "slot_patientname",
m."statusid",
p2."description" AS "status_description"
FROM appointment.slotstatus AS m
LEFT JOIN appointment.slot AS p1
ON p1."slotid" = m."slotid"
AND p1."organisation" = m."organisation"
LEFT JOIN appointment.status AS p2
ON p2."statusid" = m."statusid"
AND p2."organisation" = m."organisation";

Count appointment.slotstatus records for each appointment.slot value, joined on slotid.

SELECT
p."patientname" AS "slot_patientname",
COUNT(*) AS row_count
FROM appointment.slotstatus AS m
INNER JOIN appointment.slot AS p
ON p."slotid" = m."slotid"
AND p."organisation" = m."organisation"
GROUP BY p."patientname"
ORDER BY row_count DESC;

Row count by appointment.status description

Section titled “Row count by appointment.status description”

Count appointment.slotstatus records for each appointment.status value, joined on statusid.

SELECT
p."description" AS "status_description",
COUNT(*) AS row_count
FROM appointment.slotstatus AS m
INNER JOIN appointment.status AS p
ON p."statusid" = m."statusid"
AND p."organisation" = m."organisation"
GROUP BY p."description"
ORDER BY row_count DESC;