Table of Contents |
---|
...
Input parameters
- name
- start_at
- route
- container_dosage info
- package_qty
- package_min_qty
- code_ATX
- manufacturer_name_country info
- certificate
- expired_certificate_date
- ingridients 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 Innm by $.ingridients[].innm_id.
if invalid - return 422 error (message: "Innm in ingridients not found!")
...
Check exist any Denum unit from Dosage ($.ingridients[].dosage.denumerator_unit) with Denum unit Container dosage ($.container_dosage.denumerator_unit).
if invalid - return 422 error (message: "Denum unit from Dosage ingridients must be is equal Denum unit from Container dosage medication!")
...
- Vaildate multiplicity (Mod == 0) $.package_qty Mod $.package_min_qty == 0
- if result NOT 0 - return 409 eror (message: "Only a multiplicity request package quantity for the minimum quantity of leave a innms + form use can create a medication requestpackage quantity !")
Create new Medication
- Create new record in Medications
- Fill data
Destination | Source |
---|---|
id | |
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 |
- Save temp variable from medication.id
- Create new records in Ingridients (array)
Destination | Source |
---|---|
id | |
medication_id | medication.id |
innm_id | $.ingridients[].innm_id |
is_active_substance | $.ingridients[].is_active_substance |
dosage | $.ingridients[].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
- ingridients.dosage.description
- ingridients.innm info