diff --git a/onprc_ehr/resources/queries/ehr/encounter_participants_summary.query.xml b/onprc_ehr/resources/queries/ehr/encounter_participants_summary.query.xml new file mode 100644 index 000000000..7fca357ef --- /dev/null +++ b/onprc_ehr/resources/queries/ehr/encounter_participants_summary.query.xml @@ -0,0 +1,28 @@ + + + + + participants + Encounter Participants + + + false + Encounter Id + true + + study + Clinical Encounters + objectid + + + + Participants + 350 + ALWAYS_OFF + + + +
+
+
+
diff --git a/onprc_ehr/resources/queries/ehr/encounter_participants_summary.sql b/onprc_ehr/resources/queries/ehr/encounter_participants_summary.sql new file mode 100644 index 000000000..30caee532 --- /dev/null +++ b/onprc_ehr/resources/queries/ehr/encounter_participants_summary.sql @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2013-2019 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ +SELECT + p2.id, + p2.parentid, + p2.taskid, + GROUP_CONCAT(DISTINCT p2.userrole, '') as participants +FROM ( +SELECT + p.role || ': ' || p.username || ': ' || p.comment || chr(10) as userrole, + p.id, + p.parentid, + p.taskid + +FROM ehr.encounter_participants p +) p2 + +GROUP BY p2.id, p2.parentid, p2.taskid +