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):