Посилання на ресурс, наприклад: /api/persons/create
Scope
drugs:read
Scope для доступу
Components
Drugs and Program medications
Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription
Microservices
API paragraph not found
Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC
Protocol type
REST
Тип протоколу, який використовується запитом, наприклад: SOAP | REST
Request type
GET
Тип запиту API, наприклад: GET, POST, PATCH…
Sync/Async
Sync
Метод є синхронним чи асинхронним?
Public/Private/Internal
Public
Logic
Service returns all medications (with type innm_dosage) filtered by submitted parameters:
1. Get all medications (PRM database):
SELECT DISTINCT
I.id, I.sctid, I.name, I.name_original,
MI.id, MI.form, I_1.dosage, I_1.is_primary,
MED.container, MED.package_qty, MED.package_min_qty
FROM innms I -- 1st level: Innm
INNER JOIN ingredients I_1 -- Ingredients for INNM_DOSAGE
ON I_1.innm_child_id = I.id
INNER JOIN medications MI -- 2nd level: Medication (type = INNM_DOSAGE)
ON MI.type == INNM_DOSAGE
AND MI.id == I_1.parent_id
INNER JOIN ingredients I_2 -- Ingredients for INNM_DOSAGE
ON I_2.medication_child_id = MI.id
AND I_2.is_primary == TRUE
INNER JOIN medications MED -- 3rd level: Medication (type = BRAND)
ON MED.type == BRAND
AND MED.id == I_2.parent_id
LEFT JOIN program_medications PM -- optional filter by medical_program
on MED.id = pm.medication_id
AND PM.is_active = TRUE
LEFT JOIN medical_programs MP
on PM.medical_program_id = MP.id
AND MP.is_active = TRUE
WHERE I.is_active == TRUE
AND MI.is_active == TRUE
AND MED.is_active == TRUE
AND (I.id = $.innm_id OR $.innm_id IS NULL)
AND (I.sctid = $.innm_sctid OR $.innm_sctid IS NULL)
AND (I.name = $.innm_name OR $.innm_name IS NULL)
AND (MI.id = $.innm_dosage_id OR $.innm_dosage_id IS NULL)
AND (MED.code_atc = $.medication_code_atc OR $.medication_code_atc IS NULL)
AND (MI.name = $.innm_dosage_name OR $.innm_dosage_name IS NULL)
AND (MI.form = $.innm_dosage_form OR $.innm_dosage_form IS NULL)
AND (MP.id = $.medical_program_id OR $.medical_program_id IS NULL)
AND (MI.mr_blank_type = $.mr_form_type OR $.mr_blank_type IS NULL)
AND (MI.dosage_form_is_dosed = $.dosage_form_is_dosed OR $.dosage_form_is_dosed IS NULL)
AND (PM.care_plan_activity_allowed = $.care_plan_activity_allowed OR $.care_plan_activity_allowed IS NULL)
AND (PM.medication_request_allowed = $.medication_request_allowed OR $.medication_request_allowed IS NULL)
2. Filter list above by submitted search parameters.
3. Render a response according to specification with found medications entities.