diff --git a/db_logic/medicament.py b/db_logic/medicament.py index 28dd38f..846a1c1 100644 --- a/db_logic/medicament.py +++ b/db_logic/medicament.py @@ -965,6 +965,8 @@ class BllMedicament(Repository): # 从分类表中获取时间年份 medicament_variety_obj = BllMedicamentVariety().findEntity( EntityMedicamentVariety.variety_id == drug_entry.variety_id) + if not medicament_variety_obj: + return add_year = int(medicament_variety_obj.remark5) if medicament_variety_obj.remark5 else 1 date_now = datetime.datetime.now() add_expiration_date = (date_now + relativedelta(years=add_year)).strftime("%Y-%m-%d %H:%M:%S")