Skip to content
Partner Developer Portal

Definition

The Appointment Schedule model holds named appointment schedules and their descriptive details. It records recurrence-pattern information in XML, organisation details and schedule identifiers, together with hidden and deleted flags that describe the settings stored against the schedule.

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

appointment.schedule with dbo.organisation details

Section titled “appointment.schedule with dbo.organisation details”

Return records alongside descriptive values from the related dbo.organisation record.

SELECT
m."scheduleid",
m."organisationid",
p1."organisationdisplayname" AS "organisationdisplayname"
FROM appointment.schedule AS m
LEFT JOIN dbo.organisation AS p1
ON p1."organisationid" = m."organisationid"
AND p1."organisation" = m."organisation";

appointment.patientschedule count per appointment.schedule

Section titled “appointment.patientschedule count per appointment.schedule”

Count related appointment.patientschedule records for each appointment.schedule record, joined on scheduleid.

SELECT
m."scheduleid",
m."description",
COUNT(c."scheduleid") AS patientschedule_count
FROM appointment.schedule AS m
LEFT JOIN appointment.patientschedule AS c
ON m."scheduleid" = c."scheduleid"
AND m."organisation" = c."organisation"
GROUP BY m."scheduleid", m."description"
ORDER BY patientschedule_count DESC;

Row count by dbo.organisation organisationdisplayname

Section titled “Row count by dbo.organisation organisationdisplayname”

Count appointment.schedule records for each dbo.organisation value, joined on organisationid.

SELECT
p."organisationdisplayname" AS "organisationdisplayname",
COUNT(*) AS row_count
FROM appointment.schedule AS m
INNER JOIN dbo.organisation AS p
ON p."organisationid" = m."organisationid"
AND p."organisation" = m."organisation"
GROUP BY p."organisationdisplayname"
ORDER BY row_count DESC;