Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<query xmlns="http://labkey.org/data/xml/query">
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="encounter_participants_summary" tableDbType="TABLE">
<titleColumn>participants</titleColumn>
<tableTitle>Encounter Participants</tableTitle>
<columns>
<column columnName="parentid">
<nullable>false</nullable>
<columnTitle>Encounter Id</columnTitle>
<isKeyField>true</isKeyField>
<fk>
<fkDbSchema>study</fkDbSchema>
<fkTable>Clinical Encounters</fkTable>
<fkColumnName>objectid</fkColumnName>
</fk>
</column>
<column columnName="participants">
<columnTitle>Participants</columnTitle>
<displayWidth>350</displayWidth>
<facetingBehavior>ALWAYS_OFF</facetingBehavior>
</column>

</columns>
</table>
</tables>
</metadata>
</query>
22 changes: 22 additions & 0 deletions onprc_ehr/resources/queries/ehr/encounter_participants_summary.sql
Original file line number Diff line number Diff line change
@@ -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