Skip to content
Partner Developer Portal

Definition

The Professionalcontact Patientprofessionalcontact model records associations between patients and professional contacts, including the recorded contact type. It holds effective-from and effective-until dates with their date-part values and a current flag, alongside patient, contact and association identifiers and organisation information.

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

professionalcontact.patientprofessionalcontact with professionalcontact.contact, dbo.patient and professionalcontact.professionalcontacttype details

Section titled “professionalcontact.patientprofessionalcontact with professionalcontact.contact, dbo.patient and professionalcontact.professionalcontacttype details”

Return records alongside descriptive values from the related tables.

SELECT
m."patientprofessionalcontactid",
m."contactid",
p1."title" AS "contact_title",
m."patientid",
p2."displayname" AS "patient_displayname",
m."professionalcontacttypeid",
p3."professionalcontacttypename" AS "professionalcontacttypename"
FROM professionalcontact.patientprofessionalcontact AS m
LEFT JOIN professionalcontact.contact AS p1
ON p1."contactid" = m."contactid"
AND p1."organisation" = m."organisation"
LEFT JOIN dbo.patient AS p2
ON p2."patientid" = m."patientid"
AND p2."organisation" = m."organisation"
LEFT JOIN professionalcontact.professionalcontacttype AS p3
ON p3."professionalcontacttypeid" = m."professionalcontacttypeid"
AND p3."organisation" = m."organisation";

Row count by professionalcontact.contact title

Section titled “Row count by professionalcontact.contact title”

Count professionalcontact.patientprofessionalcontact records for each professionalcontact.contact value, joined on contactid.

SELECT
p."title" AS "contact_title",
COUNT(*) AS row_count
FROM professionalcontact.patientprofessionalcontact AS m
INNER JOIN professionalcontact.contact AS p
ON p."contactid" = m."contactid"
AND p."organisation" = m."organisation"
GROUP BY p."title"
ORDER BY row_count DESC;

Count professionalcontact.patientprofessionalcontact records for each dbo.patient value, joined on patientid.

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