Table of Contents | ||||
---|---|---|---|---|
|
...
Verify the validity of access token
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 = 'care_plan:write')
Return (403, 'Your scope does not allow to access this resource. Missing allowances: care_plan:write') in case of invalid scope(s)
Headers
Наприклад:
Content-Type:application/json
...
Check that value is an array with references of condition, observation, diagnostic report or clinical impression types.
in case of error - return 422 ('value is not allowed in enum')
Check that each reference:
is valid ME
belongs to the patient ($.subject)
in case of error - return 422 ('<medical event type> with such ID is not found')
If $.detail.reason_reference=clinical_impression:
Check that clinical impression is valid based on clinical_impression.code.coding.code and CLINICAL_IMPRESSION_PATIENT_CATEGORIES_<CODE.VALUE>_VALIDITY_PERIOD chart parameter: difference between now() and $.clinical_impression.effective_date_time OR $.clinical_impression.effective_period.end date must be less than a value in chart parameter (pointed in config for a corresponding care plan category) for clinical impression code
in case of error - return 422 ("Clinical impression with patient category exceeds validity period")
Check that clinical impression is based on active rule engine rule (exists record in rule_engine_rules collection with is_active=true, code.code=clinical_impression.code.coding.code, code.system=clinical_impression.code.coding.system)
if true - check that clinical impression still corresponds to configured rule
in case of error - return 422 (“Clinical impression with patient category does not correspond to rule engine rule“)
if false - skip rule validation
...
Сheck program exists and active
in case not found or is_active==false return 404 "Program not found"
Validate product is program participant:
If product is medication - validate:
that medication has brand that is an active member of the program (program_medications table)
in case not found or is_active==false return 422 "Medication is not included in the program"
that care_plan_activity_allowed for program medication == true
in case ==false return 422 "Forbidden to create care plan activity for this medication!"
If product is service - validate that service is an active member of the program
in case not found or is_active==false return 422 "Service is not included in the program"
if product is service_group - validate that service group is an active member of the program
in case not found or is_active==false return 422 "Service group is not included in the program"
Validate medical program settings (prm.medical_programs table):
if there is a parameter SPECIALITY_TYPES_ALLOWED:
Check author’s speciality is present in SPECIALITY_TYPES_ALLOWED
in case of error - return 422 “Author’s specialty doesn't allow to create activity with medical program from request”
if there is a parameter CONDITIONS_ICD10_AM_ALLOWED or/and CONDITIONS_ICPC2_ALLOWED:
Check related Care plan has condition codes in
addresses
field that correspond to codes pointed in CONDITIONS_ICD10_AM_ALLOWED or/and CONDITIONS_ICPC2_ALLOWED (depending on dictionary - eHealth/ICD10_AM/condition_codes or eHealth/ICPC2/condition_codes)in case of error - return 422 “Care plan diagnosis is not allowed for the medical program“
If there is a parameter PROVIDING_CONDITIONS_ALLOWED:
Check related Care plan has a value in
terms_of_service
field that is included in the list of PROVIDING_CONDITIONS_ALLOWED parameterin case of error - return 422 “Care plan’s terms of service are not allowed for the medical program“
if there is a parameter patient_categories_allowed:
check that patient_categories_allowed has codes in $.detail.reason_reference.[].clinical_impression.code.[].code that correspond to codes pointed in patient_categories_allowed
in case of error - return 422 "Clinical impression with patient category should be present in request for this medical program".
...
Save signed content to media storage
Save data to care_plan_activities collection in DB according to Care plan data model
for kind = medication_request
add
unit
(and its value) field intoquantity
,daily_amount
, objects based onsystem
,code
out of MEDICATION_UNIT dictionary.add
system
,code
,unit
fields intoremaining_quantity
based onquantity
object
Save link from media storage to the $.signed_content_links field in care plan activities collection
If Care plan has status = new:
Set care plan status = active
Check if patient has another active or/and new Care plans with such condition code in the addresses field and the same terms of service:
If such Care plans found - set these Care plans statuses to TERMINATED (related activities doesn`t change their status)
Create job and return it’s id.
...
Page Properties | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...