ЕСОЗ - публічна документація
DEPRECATED - Release Service Request
Requirements
Specification
Validation
Authorization
- Verify the validity of access token
- Return (401, 'unauthorized') in case of validation fails
- Verify that token is not expired
- in case of error - return (401, 'unauthorized')
- Check user scopes in order to perform this action (scope = 'service_request:use')
- Return (403, 'invalid scopes') in case of invalid scope(s)
Validate transition
Only active and used service request can be released
- Get service request by ID
- Service request must be active
- $.status == "active"
- in case of error return 409 "Invalid service request status"
- $.status == "active"
Check for related episodes and encounters
Service request can be released only if there is no related episodes and encounters
Search for episode of care related to this service request.Medical Events DB: patient[<patient_id>].episodes[*].incoming_referrals = Request: service_request_idStatus in (active, closed)If there is at least one episode of care - return 409, "Service request cannot be released due to related episodes of care"
Search for encounters related to this service request.Medical Events DB: patient[<patient_id>].encounters[*].incoming_referrals = Request: service_request_idStatus in (finished)If there is at least one encounter - return 409, "Service request cannot be released due to related encounters"
Service logic
- Update service request attributes. Erase used_by_legal_entity
- Set Medical Events DB: service_requests[<id>].used_by_legal_entity to NULL
Notes
Валидация: обязательно проверка, что на реферрал не ссылается какой-нибудь эпизод с энкаунтером - это означает, что пациент уже приходил на прием к другому врачу. Исключением может быть энтеред ин эррор или клоузд но с каким-то ризоном особенным
ЕСОЗ - публічна документація