Definition
Information
Section titled “Information”The Carerecord Problemdiary model links patient problems with diary entries through their recorded identifiers. Each association holds a problem-observation identifier, diary identifier and patient identifier together with source organisation information, describing the diary association recorded against the patient’s problem.
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.problemdiary with carerecord.diary, dbo.patient and carerecord.problemobservation details
Section titled “carerecord.problemdiary with carerecord.diary, dbo.patient and carerecord.problemobservation details”Return records alongside descriptive values from the related tables.
SELECT m."_primary_key", m."diaryid", p1."associatedtext" AS "diary_associatedtext", m."patientid", p2."displayname" AS "patient_displayname", m."problemobservationid", p3."linktype" AS "problemobservation_linktype"FROM carerecord.problemdiary AS mLEFT JOIN carerecord.diary AS p1 ON p1."diaryid" = m."diaryid" AND p1."organisation" = m."organisation"LEFT JOIN dbo.patient AS p2 ON p2."patientid" = m."patientid" AND p2."organisation" = m."organisation"LEFT JOIN carerecord.problemobservation AS p3 ON p3."problemobservationid" = m."problemobservationid" AND p3."organisation" = m."organisation";Row count by carerecord.diary associatedtext
Section titled “Row count by carerecord.diary associatedtext”Count carerecord.problemdiary records for each carerecord.diary value, joined on diaryid.
SELECT p."associatedtext" AS "diary_associatedtext", COUNT(*) AS row_countFROM carerecord.problemdiary AS mINNER JOIN carerecord.diary AS p ON p."diaryid" = m."diaryid" AND p."organisation" = m."organisation"GROUP BY p."associatedtext"ORDER BY row_count DESC;Row count by dbo.patient displayname
Section titled “Row count by dbo.patient displayname”Count carerecord.problemdiary records for each dbo.patient value, joined on patientid.
SELECT p."displayname" AS "patient_displayname", COUNT(*) AS row_countFROM carerecord.problemdiary 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;