Skip to content
Partner Developer Portal

Definition

The Carerecord Problemreport model links patient problems with reports through their recorded identifiers. Each association holds a problem-observation identifier, report identifier and patient identifier together with source organisation information, describing the report association recorded against the patient’s problem.

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

carerecord.problemreport with dbo.patient, carerecord.problemobservation and carerecord.report details

Section titled “carerecord.problemreport with dbo.patient, carerecord.problemobservation and carerecord.report details”

Return records alongside descriptive values from the related tables.

SELECT
m."_primary_key",
m."patientid",
p1."displayname" AS "patient_displayname",
m."problemobservationid",
p2."linktype" AS "problemobservation_linktype",
m."reportid",
p3."associatedtext" AS "report_associatedtext"
FROM carerecord.problemreport AS m
LEFT JOIN dbo.patient AS p1
ON p1."patientid" = m."patientid"
AND p1."organisation" = m."organisation"
LEFT JOIN carerecord.problemobservation AS p2
ON p2."problemobservationid" = m."problemobservationid"
AND p2."organisation" = m."organisation"
LEFT JOIN carerecord.report AS p3
ON p3."reportid" = m."reportid"
AND p3."organisation" = m."organisation";

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

SELECT
p."displayname" AS "patient_displayname",
COUNT(*) AS row_count
FROM carerecord.problemreport 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;

Row count by carerecord.problemobservation linktype

Section titled “Row count by carerecord.problemobservation linktype”

Count carerecord.problemreport records for each carerecord.problemobservation value, joined on problemobservationid.

SELECT
p."linktype" AS "problemobservation_linktype",
COUNT(*) AS row_count
FROM carerecord.problemreport AS m
INNER JOIN carerecord.problemobservation AS p
ON p."problemobservationid" = m."problemobservationid"
AND p."organisation" = m."organisation"
GROUP BY p."linktype"
ORDER BY row_count DESC;