Table of Contents |
---|
...
Input parameters
- id
- name
- start_at
- route
- container_dosage info
- package_qty
- package_min_qty
- code_ATX
- manufacturer_name_country info
- certificate
- expired_certificate_date
- ingridients ingredients info
- innm_id
- dosage info
- is_active_substance
Authorize
- Verify the validity of access token
- Check user scope (scope = 'medication:write') in order to perform this action
- In case error - generate 401 response
...
Check exist Medication by $.id.
if invalid - return 422 error (message: "Medication not found!")
...
Purpose validation: Check on existing Innm in ingridients ingredients
Check exist Innm by $.ingridientsingredients[].innm_id.
if invalid - return 422 error (message: "Innm in ingridients ingredients not found!")
Validate Dosage & Container dosage
...
Check exist any Denum unit from Dosage ($.ingridientsingredients[].dosage.denumerator_unit) with Denum unit Container dosage ($.container_dosage.denumerator_unit).
if invalid - return 422 error (message: "Denum unit from Dosage ingridients ingredients must be is equal Denum unit from Container dosage medication!")
...
- if result NOT 0 - return 409 eror (message: "Only a multiplicity package quantity for the minimum package quantity !")
Create new Medication
- Update (set values) new record in Medications
- Fill data
Destination | Source |
---|---|
name | $.name |
is_active | TRUE |
start_at | $.start_at |
route | $.route |
container_dosage | $.container_dosage |
package_qty | $.package_qty |
package_min_qty | $.package_min_qty |
code_ATX | $.code_ATX |
manufacturer_name_country | $.manufacturer_name_country |
certificate | $.certificate |
expired_certificate_date | $.expired_certificate_date |
inserted_at | :timestamp |
inserted_by | user_id |
updated_at | :timestamp |
updated_by | user_id |
- Delete all child records in Ingridients Ingredients by $.id (it is medication id )
- Create new records in Ingridients Ingredients (array)
Destination | Source |
---|---|
id | |
medication_id | $.id |
innm_id | $.ingridientsingredients[].innm_id |
is_active_substance | $.ingridientsingredients[].is_active_substance |
dosage | $.ingridientsingredients[].dosage |
inserted_at | :timestamp |
inserted_by | user_id |
updated_at | :timestamp |
updated_by | user_id |
Return data structure
- Fill response data structure (Similar input parametrs)
- Additional
- id
- container_dosage.description
- ingridientsingredients.dosage.description
- ingridientsingredients.innm info