Definition
Information
Section titled “Information”The Appointment Patientschedule model records a patient’s scheduled appointment activity, including its date range, reason, notes and recorded location. It also holds predicted travel time and visit duration, cancellation details, and identifiers for the schedule, service, care episode, planned event and slot type.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”appointment.patientschedule with dbo.location, dbo.locationtype and dbo.organisation details
Section titled “appointment.patientschedule with dbo.location, dbo.locationtype and dbo.organisation details”Return records alongside descriptive values from the related tables.
SELECT m."patientscheduleid", m."locationid", p1."locationname" AS "locationname", m."locationtypeid", p2."locationtypedescription" AS "locationtypedescription", m."organisationid", p3."organisationdisplayname" AS "organisationdisplayname"FROM appointment.patientschedule AS mLEFT JOIN dbo.location AS p1 ON p1."locationid" = m."locationid" AND p1."organisation" = m."organisation"LEFT JOIN dbo.locationtype AS p2 ON p2."locationtypeid" = m."locationtypeid" AND p2."organisation" = m."organisation"LEFT JOIN dbo.organisation AS p3 ON p3."organisationid" = m."organisationid" AND p3."organisation" = m."organisation";appointment.assignmentlistpatientschedule count per appointment.patientschedule
Section titled “appointment.assignmentlistpatientschedule count per appointment.patientschedule”Count related appointment.assignmentlistpatientschedule records for each appointment.patientschedule record, joined on patientscheduleid.
SELECT m."patientscheduleid", m."cancelreason", COUNT(c."patientscheduleid") AS assignmentlistpatientschedule_countFROM appointment.patientschedule AS mLEFT JOIN appointment.assignmentlistpatientschedule AS c ON m."patientscheduleid" = c."patientscheduleid" AND m."organisation" = c."organisation"GROUP BY m."patientscheduleid", m."cancelreason"ORDER BY assignmentlistpatientschedule_count DESC;Row count by dbo.location locationname
Section titled “Row count by dbo.location locationname”Count appointment.patientschedule records for each dbo.location value, joined on locationid.
SELECT p."locationname" AS "locationname", COUNT(*) AS row_countFROM appointment.patientschedule AS mINNER JOIN dbo.location AS p ON p."locationid" = m."locationid" AND p."organisation" = m."organisation"GROUP BY p."locationname"ORDER BY row_count DESC;