Table of Contents |
---|
...
Validations
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:write')
- Return (403, 'invalid scopes') in case of invalid scope(s)
...
- Validate used_by_legal_entity
- ME.service_request.used_by_legal_enity.identifier.value=token.client_id
- in case of error return 409 "Service request is used by another legal entity"
- ME.service_request.used_by_legal_enity.identifier.value=token.client_id
- Validate program_processing_status
- ME.service_request.program_processing_status == "in_progress"
- in case of error return 409 "Invalid program processing status status"
- ME.service_request.program_processing_status == "in_progress"
- Validate completed_with
- $.completed_with as a Reference(encounter| diagnostic_report)
- if ME.service_request.category==Counseling than $.completed_with should contain Encounter
- else - diagnostic report
- Validate program according to Pre-Qualify rules.
- it is an existing service program (type=service)
- in case not found or is_active==false return 422 "Program not found"
- in case type!= service return 422 "Invalid program type"
- service(or service_group) is an active member of the program
- Select request_allowed, is_active from PRM.program_services where service_id(or group_id) == $.signed_content.code.identifier.value and program_id=$.program.identifier.value
- if not found or is_active==false return 422 "Service is not included in the program"if request_allowed==false return 422 "Service request is not allowed for this service(service_group) in this programm"
- Select request_allowed, is_active from PRM.program_services where service_id(or group_id) == $.signed_content.code.identifier.value and program_id=$.program.identifier.value
- it is an existing service program (type=service)
Service logic
- Update program_processing_status to "completed"
- Update status history
- Save completed_with to service_request