ЕСОЗ - публічна документація
RC_Create Program medication (Admin CDB)
Purpose
This WS allows to create new medication program participant
Key points
This is a graphQl method used in Administration panel only
Only authenticated and authorized NHS employee with appropriate scope can create a Program medication.
Program medication can be created only for medical program with type MEDICATION.
Specification
Authorization
Verify the validity of access token
in case of error - 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 = 'program_medication:write')
return 403 (“Your scope does not allow to access this resource. Missing allowances: program_medication:read”) in case of invalid scope(s)
Validate legal entity
Extract client_id from token.
Check client scopes in order to perform this action (scope = 'program_medication:write')
in case of error - return 403 (“Your scope does not allow to access this resource. Missing allowances: program_medication:write”)
Validate request
Check medicalProgramId:
exists in DB
in case of error - return 404 ('not_found')
has type = MEDICATION
in case of error - return 409 ('MedicalProgram type should be MEDICATION')
is_active = true
in case of error - return 409 ('Medical program is not active')
Check start_date < end_date
in case of error - return 422 ('must be earlier than the end date')
Validate reimbursement:
If reimbursement type = FIXED, than reimbursementAmount field required
If reimbursement type = PERCENTAGE, percentageDiscount field required
in case of error - return 422 ('can't be blank')
If percentageDiscount submitted in the reimbursement structure:
Check it’s value in range from 0 to 100
in case of error - return 422 ('expected the value to be <= 100')
Validate medicationId:
Check it is active and it’s type is BRAND
in case of error - return 409 ('Medication is not active')
Service logic
Create new program medication entity: store input into program_medications table (prm). Also, set:
medication_request_allowed = true
is_active = true
inserted_at, updated_at = user_id (from token)
inserted_at, updated_at = current date and time
ЕСОЗ - публічна документація