Skip to content

Commit

Permalink
Changes to automated blood charges (#710)
Browse files Browse the repository at this point in the history
* group up the blood draws if they are done at the same time

* remove count from comment

* comment sql
  • Loading branch information
csebranek committed Feb 4, 2025
1 parent 8f9759d commit ec535e7
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ SELECT
Id,
date,
project,
coalesce(account, project.account.alias) AS debitedAccount,
coalesce(account, project.account.alias) as debitedAccount,
coalesce(a.tier_rate.tierRate, project.account.tier_rate.tierRate) as otherRate,
objectid AS sourceRecord,
('Blood Draws ' || Id) AS comment,
CAST(1 as DOUBLE) AS quantity,
taskId,
performedby
group_concat(objectid,';') as objectids,
('Blood Draws ' || Id ) as comment,
CAST(1 AS DOUBLE) AS quantity,
group_concat(taskid, ';') as taskids,
group_concat(performedby, ';') as performedby
FROM studyLinked.BloodSchedule bloodSch
LEFT JOIN ehr_billing.aliases a ON bloodSch.account = a.alias
WHERE
billedBy.value = 'c' AND
qcstate.publicdata = true
qcstate.publicdata = true

--group blood draws drawn on the same date with same project
GROUP BY id, date, project, coalesce(account, project.account.alias), coalesce(a.tier_rate.tierRate, project.account.tier_rate.tierRate);

0 comments on commit ec535e7

Please sign in to comment.