Skip to content
Partner Developer Portal

Definition

The Carerecord Problemissuerecord model links patient problems with medication issue records through their recorded identifiers. Each association holds a problem-observation identifier, issue-record identifier and patient identifier together with source organisation information, describing the issue association recorded against the patient’s problem.

_deleted indicates whether the record has been deleted in the source system.

carerecord.problemissuerecord with prescribing.issuerecord, dbo.patient and carerecord.problemobservation details

Section titled “carerecord.problemissuerecord with prescribing.issuerecord, dbo.patient and carerecord.problemobservation details”

Return records alongside descriptive values from the related tables.

SELECT
m."_primary_key",
m."issuerecordid",
p1."originalterm" AS "issuerecord_originalterm",
m."patientid",
p2."displayname" AS "patient_displayname",
m."problemobservationid",
p3."linktype" AS "problemobservation_linktype"
FROM carerecord.problemissuerecord AS m
LEFT JOIN prescribing.issuerecord AS p1
ON p1."issuerecordid" = m."issuerecordid"
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.issuerecord originalterm

Section titled “Row count by prescribing.issuerecord originalterm”

Count carerecord.problemissuerecord records for each prescribing.issuerecord value, joined on issuerecordid.

SELECT
p."originalterm" AS "issuerecord_originalterm",
COUNT(*) AS row_count
FROM carerecord.problemissuerecord AS m
INNER JOIN prescribing.issuerecord AS p
ON p."issuerecordid" = m."issuerecordid"
AND p."organisation" = m."organisation"
GROUP BY p."originalterm"
ORDER BY row_count DESC;

Count carerecord.problemissuerecord records for each dbo.patient value, joined on patientid.

SELECT
p."displayname" AS "patient_displayname",
COUNT(*) AS row_count
FROM carerecord.problemissuerecord AS m
INNER JOIN dbo.patient AS p
ON p."patientid" = m."patientid"
AND p."organisation" = m."organisation"
GROUP BY p."displayname"
ORDER BY row_count DESC;