Definition
Information
Section titled “Information”The Dbo Patientcontact model holds contact information recorded for patients, together with contact-type and associated primary-contact-type identifiers. It also records a contact-verification identifier and notes, alongside the patient identifier and organisation information associated with that contact entry.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”dbo.patientcontact with dbo.contacttype and dbo.patient details
Section titled “dbo.patientcontact with dbo.contacttype and dbo.patient details”Return records alongside descriptive values from the related tables.
SELECT m."_primary_key", m."contacttypeid", p1."contacttypedescription" AS "contacttypedescription", m."patientid", p2."displayname" AS "patient_displayname"FROM dbo.patientcontact AS mLEFT JOIN dbo.contacttype AS p1 ON p1."contacttypeid" = m."contacttypeid" AND p1."organisation" = m."organisation"LEFT JOIN dbo.patient AS p2 ON p2."patientid" = m."patientid" AND p2."organisation" = m."organisation";Row count by dbo.contacttype contacttypedescription
Section titled “Row count by dbo.contacttype contacttypedescription”Count dbo.patientcontact records for each dbo.contacttype value, joined on contacttypeid.
SELECT p."contacttypedescription" AS "contacttypedescription", COUNT(*) AS row_countFROM dbo.patientcontact AS mINNER JOIN dbo.contacttype AS p ON p."contacttypeid" = m."contacttypeid" AND p."organisation" = m."organisation"GROUP BY p."contacttypedescription"ORDER BY row_count DESC;Row count by dbo.patient displayname
Section titled “Row count by dbo.patient displayname”Count dbo.patientcontact records for each dbo.patient value, joined on patientid.
SELECT p."displayname" AS "patient_displayname", COUNT(*) AS row_countFROM dbo.patientcontact AS mINNER JOIN dbo.patient AS p ON p."patientid" = m."patientid" AND p."organisation" = m."organisation"GROUP BY p."displayname"ORDER BY row_count DESC;