Purpose
This WS is designed to search Procedures grouped by Service Groups. If the user has approval on the Group of Services, he will receive a list of Procedures (short information), which contain service from this Group. To receive full Procedure data user must have the access according to ABAC rules (EN) and use https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/17070096385/Get+Procedures+by+id?search_id=a385f735-e453-4647-884e-84c7bf248d1f endpoint.
Also https://e-health-ua.atlassian.net/wiki/x/lQBrLQE logic includes this method.
Specification
Authorization
Verify the validity of access token
Return (401, 'Invalid access token') in case of validation fails
Verify that token is not expired
in case of error - return (401, 'Invalid access token')
Check user scopes in order to perform this action (scope = 'procedure:read')
Return (403, 'Your scope does not allow to access this resource. Missing allowances: procedure:read') in case of invalid scope(s)
Service logic
Service returns list of short Procedures, which contain services from Groups of Services user has approval on, filtered by submitted parameters:
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 Procedures by person_id from ME.procedures (Mongo DB) where:
code.identifier.value is in
services
list (from previous step)
Filter Procedures by submitted search params (diagnoses_group_id, managing_organization_id…).
Order Proedures by
inserted_at
and render a response according to specification