Skip to content
Partner Developer Portal

Definition

The Prescribing Authorisedissueshistory model records medication issue authorisation history, including the number of issues authorised, authorisation date and review date. It also holds entering and authorising user identifiers, entry timing and identifiers for the patient, drug record and history entry.

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

prescribing.authorisedissueshistory with prescribing.drugrecord and dbo.patient details

Section titled “prescribing.authorisedissueshistory with prescribing.drugrecord and dbo.patient details”

Return records alongside descriptive values from the related tables.

SELECT
m."authorisedissueshistoryid",
m."drugrecordid",
p1."originalterm" AS "drugrecord_originalterm",
m."patientid",
p2."displayname" AS "patient_displayname"
FROM prescribing.authorisedissueshistory AS m
LEFT 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";

Row count by prescribing.drugrecord originalterm

Section titled “Row count by prescribing.drugrecord originalterm”

Count prescribing.authorisedissueshistory records for each prescribing.drugrecord value, joined on drugrecordid.

SELECT
p."originalterm" AS "drugrecord_originalterm",
COUNT(*) AS row_count
FROM prescribing.authorisedissueshistory AS m
INNER JOIN prescribing.drugrecord AS p
ON p."drugrecordid" = m."drugrecordid"
AND p."organisation" = m."organisation"
GROUP BY p."originalterm"
ORDER BY row_count DESC;

Count prescribing.authorisedissueshistory records for each dbo.patient value, joined on patientid.

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