Definition
Information
Section titled “Information”The Carerecord Problemdeletionhistory model records patient problem deletion history, including the action, reason, timestamp and user-in-role identifier. It also holds deleted-problem and corrected-problem information in XML and a correction-code identifier, together with identifiers for the patient and history record.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”carerecord.problemdeletionhistory with dbo.patient and dbo.userinrole details
Section titled “carerecord.problemdeletionhistory with dbo.patient and dbo.userinrole details”Return records alongside descriptive values from the related tables.
SELECT m."problemdeletionhistoryid", m."patientid", p1."displayname" AS "patient_displayname", m."userinroleid", p2."contractualrelationship" AS "userinrole_contractualrelationship"FROM carerecord.problemdeletionhistory AS mLEFT JOIN dbo.patient AS p1 ON p1."patientid" = m."patientid" AND p1."organisation" = m."organisation"LEFT JOIN dbo.userinrole AS p2 ON p2."userinroleid" = m."userinroleid" AND p2."organisation" = m."organisation";Row count by dbo.patient displayname
Section titled “Row count by dbo.patient displayname”Count carerecord.problemdeletionhistory records for each dbo.patient value, joined on patientid.
SELECT p."displayname" AS "patient_displayname", COUNT(*) AS row_countFROM carerecord.problemdeletionhistory 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;Row count by dbo.userinrole contractualrelationship
Section titled “Row count by dbo.userinrole contractualrelationship”Count carerecord.problemdeletionhistory records for each dbo.userinrole value, joined on userinroleid.
SELECT p."contractualrelationship" AS "userinrole_contractualrelationship", COUNT(*) AS row_countFROM carerecord.problemdeletionhistory AS mINNER JOIN dbo.userinrole AS p ON p."userinroleid" = m."userinroleid" AND p."organisation" = m."organisation"GROUP BY p."contractualrelationship"ORDER BY row_count DESC;