From 78baf302c288070411e2132b40bbd51f3042e1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=BE=D1=80=D0=BE=D0=B4=D0=B8=D0=BD=20=D0=A0=D0=BE?= =?UTF-8?q?=D0=BC=D0=B0=D0=BD?= Date: Wed, 6 May 2020 19:26:35 +0300 Subject: [PATCH] =?UTF-8?q?=D0=95=D1=89=D1=91=20=D1=87=D0=B0=D1=81=D1=82?= =?UTF-8?q?=D1=8C...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mods/receptions.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mods/receptions.py b/mods/receptions.py index 488cb3c..9d198fe 100644 --- a/mods/receptions.py +++ b/mods/receptions.py @@ -152,6 +152,13 @@ def save_reception_observe(reception, observe_id_list): to_add = list(new_symptoms - exist_symptoms) delete_reception_observe_symptoms(reception, to_del) add_reception_observe_symptoms(reception, to_add) +def save_reception_medicine(reception, medicine_id_list): + exist_medicines = set(map(lambda x: x.medicine.id, get_reception_medicine_items(reception))) + new_medicines = set(medicine_id_list) + to_del = list(exist_medicines - new_medicines) + to_add = list(new_medicines - exist_medicines) + delete_reception_medicines(reception, to_del) + add_reception_medicines(reception, to_add) ################################################################################## def build_reception_row(reception_datetime):