...
Select list of employees from PRM.employees related to the current user in the current legal_entity, using data from the token.
Select all active approvals on
service_groups
from ME.approvals (Mongo DB), where these employees referenced asgranted_to
.Get
services
(PRM.service_inclusions DB) byservice_group_id
. Save service toservices
list.Get Diagnostic Reports by person_id from ME.diagnostic_reports (Mongo DB) where:
code.identifier.value is in
services
list (from previous step)
Filter Diagnostic Reports by submitted search params (diagnosesservice_group_id, managing_organization_id…).
Order Diagnostic Reports by
inserted_at
and render a response according to specification