Table of Contents | ||
---|---|---|
|
...
Validate request by schema and return 422 error code with the list of validation errors in case of fails. User fills following fields in the request:
1. Status reason
1.1. Validate value in the field $.status_reason, CodeableConcept type, required.
Check that value is in allowed values from COMPOSITION_MARK_IN_ERROR_REASONS dictionary.
in case of error - return 422 ('value is not allowed in enum')
1.2. Validate value in the field $.status_reason corresponds to the config
Get config parameter COMPOSITION_MARK_IN_ERROR_STATUS_REASON, where Configuration.type=Composition.type and Configuration.category=Composition.catergory
Check that value is in allowed values from COMPOSITION_MARK_IN_ERROR_STATUS_REASON
in case of error - return 422 ('Invalid status reason for such composition type and category').
2. Status
The target status value must be submitted in the order of display in the signed content (media storage)
...
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_withinform_with is submitted - use it as patient’s authentication method