Definition
Information
Section titled “Information”The Dbo Patientassociate model holds demographic and contact details for patient associates, including names, birth and death dates, sex, address identifiers, telephone numbers and email addresses. It also records carer-authorisation information, a linked-patient identifier and carer-display and patient-merge flags.
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.patientassociate with dbo.organisation details
Section titled “dbo.patientassociate with dbo.organisation details”Return records alongside descriptive values from the related dbo.organisation record.
SELECT m."patientassociateid", m."organisationid", p1."organisationdisplayname" AS "organisationdisplayname"FROM dbo.patientassociate AS mLEFT JOIN dbo.organisation AS p1 ON p1."organisationid" = m."organisationid" AND p1."organisation" = m."organisation";audit.careraudit count per dbo.patientassociate
Section titled “audit.careraudit count per dbo.patientassociate”Count related audit.careraudit records for each dbo.patientassociate record, joined on patientassociateid.
SELECT m."patientassociateid", m."displayname", COUNT(c."patientassociateid") AS careraudit_countFROM dbo.patientassociate AS mLEFT JOIN audit.careraudit AS c ON m."patientassociateid" = c."patientassociateid" AND m."organisation" = c."organisation"GROUP BY m."patientassociateid", m."displayname"ORDER BY careraudit_count DESC;Row count by dbo.organisation organisationdisplayname
Section titled “Row count by dbo.organisation organisationdisplayname”Count dbo.patientassociate records for each dbo.organisation value, joined on organisationid.
SELECT p."organisationdisplayname" AS "organisationdisplayname", COUNT(*) AS row_countFROM dbo.patientassociate AS mINNER JOIN dbo.organisation AS p ON p."organisationid" = m."organisationid" AND p."organisation" = m."organisation"GROUP BY p."organisationdisplayname"ORDER BY row_count DESC;