...
Only an employee who registered a Composition, employee from the same legal entity, or employee that has an approval to mark the Composition as as entered_in_error are able to perform this action.
Request should be signed with DS.
Composition is marked as entered-_in-_error asynchronously.
Specification
...
Validate Composition mark-in-error term
Get config parameter COMPOSITION_MARK_IN_ERROR_TERM, where Configuration.type=Composition.type and Configuration.category=Composition.catergory
Validate today >= (Composition.date+COMPOSITION_MARK_IN_ERROR_TERM.min)
Validate today <= (Composition.date+COMPOSITION_MARK_IN_ERROR_TERM.max)
Return 422 ("Difference between Composition date and todays date must be in range of <min value> and <max value> days") in case of error
...
Check that value is in allowed values from COMPOSITION_MARK_IN_CANCELLATIONERROR_REASONS dictionary.
in case of error - return 422 ('value is not allowed in enum')
...
Create job and return it’s id.
Update Composition record with following:
status = $.status
status_reason = $.status_reason
explanatory_letter =$.explanatory_letter
updated_at = current datetime
updated_by = user_id from token
Send SMS to patient with composition number via template
MARK_IN_ERROR_{{COMPOSITION_TYPE}}_COMPOSITION_SMS_TEMPLATE
If $.authorize_with is submitted - use it as patient’s authentication methodIf $.authorize_with is not submitted - determine patient's default authentication method as described at
Determination of a default authentication method and return person's active auth_methods