Table of Contents | ||||
---|---|---|---|---|
|
...
Only authenticated and authorized user with employee_type from the list ofCARE_PLAN_AUTHOR_EMPLOYEE_TYPES_ALLOWED
config with appropriate speciality pointed inCARE_PLAN_<category>_SPECIALITIES_ALLOWED config can create a Care plan.Care plan can be created from MSP, PRIMARY_CARE or OUTPATIENT legal entity.
Care plan can be created for persons and prepersons.
Care plan should be signed with DS.
Care plan creates in async way as all MEs.
Activities are added to a Care plan using Create Care Plan activity method. Thus, Care plan is being initially created without activities.
...
PROVIDING_CONDITION
Request structure
See on Apiary
Example:
Expand | ||
---|---|---|
| ||
|
...
Expand | |||||
---|---|---|---|---|---|
| |||||
|
...
Request to process the request using a token in the headers
Headers
Наприклад:
Content-Type:application/json
Authorization:Bearer {{access_token}}
API-key:{{mis_client_secret}}
...
Extract user_id from token. Check that author belongs to one of the user’s employee.
in case of error - return 422 ('User is not allowed to create care plan for the employee')
Check that author is an active and approved employee and related to the legal entity (client_id from token).
in case of error - return 403 ('Access denied')
for employees with employee_type from CARE_PLAN_AUTHOR_ROLE_CHECK_EMPLOYEE_TYPESconfig:
Сheck it has at least one employee role that:
is active and has active status
refers to healthcare service with providing_conditions=$.terms_of_service value
in case of error - return 422 ('Employee does not have active role that correspond to the submitted terms of service')
If DOCTOR, then no additional validations needed
Check author’s speciality (speciality_officio == true) pointed in config for a corresponding care plan category.
in case of error - return 409 (“Invalid employee speciality”)
...
Check the value is valid reference on another Care plan resource
Validate referenced care plan:
Check it belongs to the same patient ($.subject)
Return 422 ('Care plan with such id is not found')
Validate status of referenced care plan:
Check it is one of COMPLETED OR ACTIVE OR TERMINATED:
in case of error return 422 ('Care plan in status "<care_plan.status>" can not be referenced')
9. Part of
Validate value in the field $.part_of, if submitted
...
Save signed content to media storage
Save data to care_plans collection in DB according to https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/17347479634/RC+REHAB+Care+plan+data+model
Fill field managing_organization with data from token of the user (details.client_id)
Save link from media storage to the $.signed_content_links field in care plans collection
Create job and return it’s id.
...
Expand | |||||
---|---|---|---|---|---|
| |||||
|
...