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