Skip to content
Merged
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
2 changes: 1 addition & 1 deletion snprc_ehr/resources/queries/study/CulturePivot.query.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<fk>
<fkDbSchema>study</fkDbSchema>
<fkTable>ClinpathRuns</fkTable>
<fkColumnName>message_id</fkColumnName>
<fkColumnName>objectid</fkColumnName>
</fk>
</column>
</columns>
Expand Down
3 changes: 2 additions & 1 deletion snprc_ehr/resources/queries/study/CulturePivot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SELECT
p.date,
p.serviceTestId.testName as TestName,
p.runId.serviceRequested as PanelName,
p.remark,
GROUP_CONCAT(p.qualresult) as QResults

FROM study.labworkResults as p
Expand All @@ -32,7 +33,7 @@ FROM study.labworkResults as p
and lt.ServiceId.Dataset='Culture'

where p.id is not null
group by p.runid, p.Id, p.date,p.serviceTestId.testName, p.runId.serviceRequested
group by p.runid, p.Id, p.date,p.serviceTestId.testName, p.remark, p.runId.serviceRequested
PIVOT QResults by TestName IN
(select t.testName from snprc_ehr.labwork_panels t
where t.includeInPanel = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<fk>
<fkDbSchema>study</fkDbSchema>
<fkTable>ClinpathRuns</fkTable>
<fkColumnName>message_id</fkColumnName>
<fkColumnName>objectid</fkColumnName>
</fk>
</column>
</columns>
Expand Down
3 changes: 2 additions & 1 deletion snprc_ehr/resources/queries/study/ParasitologyPivot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SELECT
p.runid,
p.Id,
p.date,
p.remark,
p.serviceTestId.testName as TestName,
p.runId.serviceRequested as PanelName,
GROUP_CONCAT(p.qualresult) as QResults
Expand All @@ -33,7 +34,7 @@ FROM study.labworkResults as p

where p.id is not null
and p.runId.serviceRequested not in ('OVA & PARASITES','OVA & PARASITES, URINE')
group by p.runid, p.Id, p.date,p.serviceTestId.testName, p.runId.serviceRequested
group by p.runid, p.Id, p.date,p.serviceTestId.testName, p.runId.serviceRequested, p.remark
PIVOT QResults by TestName IN
(select TestName from snprc_ehr.labwork_panels t
where t.includeInPanel = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<fk>
<fkDbSchema>study</fkDbSchema>
<fkTable>ClinpathRuns</fkTable>
<fkColumnName>message_id</fkColumnName>
<fkColumnName>objectid</fkColumnName>
</fk>
</column>
</columns>
Expand Down
3 changes: 2 additions & 1 deletion snprc_ehr/resources/queries/study/ParasitologyPivotOP.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ SELECT
p.date,
p.serviceTestId.testName as TestName,
p.runId.serviceRequested as PanelName,
p.remark,
GROUP_CONCAT(p.qualresult) as QResults

FROM study.labworkResults as p
Expand All @@ -34,7 +35,7 @@ FROM study.labworkResults as p

where p.id is not null
and p.runId.serviceRequested in ('OVA & PARASITES' ,'OVA & PARASITES, URINE')
group by p.runid, p.Id, p.date, p.serviceTestId.testName, p.runId.serviceRequested
group by p.runid, p.Id, p.date,p.remark, p.serviceTestId.testName, p.runId.serviceRequested
PIVOT QResults by TestName IN
(select TestName from snprc_ehr.labwork_panels t
where t.includeInPanel = true
Expand Down
3 changes: 2 additions & 1 deletion snprc_ehr/resources/queries/study/chemPivot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ b.date,
b.runId,
b.panelName,
b.TestName,
b.remark,
MAX(b.result) as results

FROM chemPivotInner b

GROUP BY b.runid,b.id, b.date, b.TestName, b.panelName
GROUP BY b.runid,b.id, b.date, b.TestName, b.panelName, b.remark

PIVOT results BY TestName IN
(select TestName from snprc_ehr.labwork_panels t
Expand Down
1 change: 1 addition & 0 deletions snprc_ehr/resources/queries/study/chemPivotInner.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ SELECT
b.serviceTestId.testName AS TestName,

coalesce(b.runId, b.objectid) as runId,
b.remark,
b.resultoorindicator,
CASE
WHEN b.result IS NULL THEN b.qualresult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<fk>
<fkDbSchema>study</fkDbSchema>
<fkTable>ClinpathRuns</fkTable>
<fkColumnName>message_id</fkColumnName>
<fkColumnName>objectid</fkColumnName>
</fk>
</column>
</columns>
Expand Down
3 changes: 2 additions & 1 deletion snprc_ehr/resources/queries/study/hematologyPivot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ b.date,
b.runid,
b.panelName,
b.TestName,
b.remark,
MAX(b.result) as results

FROM hematologyPivotInner b

GROUP BY b.runid, b.panelName, b.id, b.date, b.TestName
GROUP BY b.runid, b.panelName, b.id, b.date, b.TestName, b.remark

PIVOT results BY TestName IN
(select TestName from snprc_ehr.labwork_panels t
Expand Down
1 change: 1 addition & 0 deletions snprc_ehr/resources/queries/study/hematologyPivotInner.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ SELECT
b.runId.serviceRequested as panelName,
b.serviceTestId.testName AS TestName,
coalesce(b.runId, b.objectid) as runId,
b.remark,
b.resultoorindicator,
CASE
WHEN b.result IS NULL THEN b.qualresult
Expand Down
2 changes: 1 addition & 1 deletion snprc_ehr/resources/queries/study/miscPivot.query.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<fk>
<fkDbSchema>study</fkDbSchema>
<fkTable>ClinpathRuns</fkTable>
<fkColumnName>message_id</fkColumnName>
<fkColumnName>objectid</fkColumnName>
</fk>
</column>
</columns>
Expand Down
4 changes: 2 additions & 2 deletions snprc_ehr/resources/queries/study/miscPivot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ SELECT
b.runId,
b.panelName,
b.TestName,
b.remark,
MAX(b.result) as results,
(select group_concat(a.remark) from study.labworkResults as a where a.runId = b.runId) as remark

FROM miscPivotInner b

GROUP BY b.runid,b.id, b.date, b.TestName, b.panelName
GROUP BY b.runid,b.id, b.date, b.TestName, b.panelName, b.remark

PIVOT results BY TestName IN
(select TestName from snprc_ehr.labwork_panels t
Expand Down
2 changes: 1 addition & 1 deletion snprc_ehr/resources/queries/study/miscPivotInner.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SELECT
b.date,
b.runId.serviceRequested as panelName,
b.serviceTestId.testName AS TestName,

b.remark,
coalesce(b.runId, b.objectid) as runId,
b.resultoorindicator,
CASE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<fk>
<fkDbSchema>study</fkDbSchema>
<fkTable>ClinpathRuns</fkTable>
<fkColumnName>message_id</fkColumnName>
<fkColumnName>objectid</fkColumnName>
</fk>
</column>
</columns>
Expand Down
3 changes: 2 additions & 1 deletion snprc_ehr/resources/queries/study/surveillancePivot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ b.date,
b.runid,
b.panelName,
b.TestName,
b.remark,
MAX(b.result) as results

FROM surveillancePivotInner b

GROUP BY b.runid, b.panelName, b.id, b.date, b.TestName
GROUP BY b.runid, b.panelName, b.id, b.date, b.TestName, b.remark

PIVOT results BY TestName IN
(select TestName from snprc_ehr.labwork_panels t
Expand Down
3 changes: 3 additions & 0 deletions snprc_ehr/resources/queries/study/surveillancePivotInner.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SELECT
b.serviceTestId.testName AS TestName,
coalesce(b.runId, b.objectid) as runId,
b.resultoorindicator,
b.remark,
CASE
WHEN b.result IS NULL THEN b.qualresult
ELSE CAST(CAST(b.result AS float) AS VARCHAR)
Expand All @@ -40,6 +41,7 @@ SELECT
b.serviceTestId.testName AS TestName,
coalesce(b.runId, b.objectid) as runId,
b.resultoorindicator,
b.remark,
CASE
WHEN b.result IS NULL THEN b.qualresult
ELSE CAST(CAST(b.result AS float) AS VARCHAR)
Expand All @@ -56,6 +58,7 @@ SELECT
b.serviceTestId.testName AS TestName,
coalesce(b.runId, cast(b.Sequencenum as varchar)) as runId,
b.resultoorindicator,
b.remark,
CASE
WHEN b.result IS NULL THEN b.qualresult
ELSE CAST(CAST(b.result AS float) AS VARCHAR)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<fk>
<fkDbSchema>study</fkDbSchema>
<fkTable>ClinpathRuns</fkTable>
<fkColumnName>message_id</fkColumnName>
<fkColumnName>objectid</fkColumnName>
</fk>
</column>
</columns>
Expand Down
3 changes: 2 additions & 1 deletion snprc_ehr/resources/queries/study/urinalysisPivot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ SELECT
b.runId,
b.panelName,
b.TestName,
b.remark,
MAX(b.result) as results

FROM urinalysisPivotInner b

GROUP BY b.runid,b.id, b.date, b.TestName, b.panelName
GROUP BY b.runid,b.id, b.date, b.TestName, b.panelName, b.remark

PIVOT results BY TestName IN
(select TestName from snprc_ehr.labwork_panels t
Expand Down
1 change: 1 addition & 0 deletions snprc_ehr/resources/queries/study/urinalysisPivotInner.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ SELECT

coalesce(b.runId, b.objectid) as runId,
b.resultoorindicator,
b.remark,
CASE
WHEN b.result IS NULL THEN b.qualresult
ELSE CAST(CAST(b.result AS float) AS VARCHAR)
Expand Down