From f724d0e9260b038e0932ca0d054b3c7758e5d5f0 Mon Sep 17 00:00:00 2001 From: tangxuan <2233783319@qq.com> Date: Thu, 30 Mar 2023 11:34:37 +0800 Subject: [PATCH] =?UTF-8?q?2.=E5=BC=80=E7=93=B6=E6=9C=89=E6=95=88=E6=9C=9F?= =?UTF-8?q?=E8=A7=84=E5=88=99=E5=8F=98=E5=8C=96=EF=BC=8C=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=AF=8F=E4=B8=AA=E5=88=86=E7=B1=BB=E7=9A=84?= =?UTF-8?q?=E5=BC=80=E7=93=B6=E6=9C=89=E6=95=88=E6=9C=9F=E5=BB=B6=E9=95=BF?= =?UTF-8?q?=E6=97=B6=E9=97=B4=204.=E5=88=86=E7=B1=BB=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=8F=AA=E8=A6=81=E7=AE=A1=E7=90=86=E5=91=98=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E7=BC=96=E8=BE=91=205.=E6=98=93=E5=88=B6=E6=AF=92=E6=98=93?= =?UTF-8?q?=E5=88=B6=E7=88=86=E5=BD=92=E8=BF=98=E6=97=B6=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E6=9C=AC=E6=AC=A1=E7=94=A8=E9=87=8F=EF=BC=8C=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E6=B6=B2=E4=BD=93=E4=BD=93=E7=A7=AF=E9=87=8F=206..=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=85=B6=E4=B8=AD=E4=B8=80=E4=B8=AA=E4=BA=BA=E9=A9=B3?= =?UTF-8?q?=E5=9B=9E=EF=BC=8C=E5=8F=A6=E5=A4=96=E4=B8=80=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E5=90=8C=E6=84=8F=E7=9B=AE=E5=89=8D=E8=BF=98=E6=98=AF=E6=9C=89?= =?UTF-8?q?=E6=95=88=E7=8A=B6=E6=80=81=207.=E7=94=B3=E8=AF=B7=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E7=AE=A1=E7=90=86=E5=91=98=E8=87=AA=E5=B7=B1=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E9=A9=B3=E5=9B=9E=E8=87=AA=E5=B7=B1=E7=9A=84=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=208.=E7=94=B3=E8=AF=B7=E6=97=B6=E8=A6=81=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E5=A4=9A=E9=80=89=E7=BB=9F=E4=B8=80=E5=A1=AB=E5=86=99?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=90=86=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/temporary_auth/views.py | 65 +++++++++++++++++------------------- db_logic/medicament.py | 11 +++--- models/medicament_models.py | 6 ++-- 3 files changed, 38 insertions(+), 44 deletions(-) diff --git a/apps/temporary_auth/views.py b/apps/temporary_auth/views.py index a720dcf..cc8c954 100644 --- a/apps/temporary_auth/views.py +++ b/apps/temporary_auth/views.py @@ -74,11 +74,11 @@ def user_apply_log(): if client_obj: i["client_name"]=client_obj.client_name else: - i["client_name"]='' - use_content =json.dumps(data_obj) - solve_user_id_sh ="-" - if tag ==1: - solve_user_id_sh = '' + i["client_name"]='' + use_content =json.dumps(data_obj) + solve_user_id_sh ="-" + if tag ==1: + solve_user_id_sh = '' obj = EntityUserApply( user_id=g.current_user.user_id, user_id_pt=user_id_pt, @@ -92,7 +92,7 @@ def user_apply_log(): func_type=func_type, # client_code=client_code, use_doc=use_doc - ) + ) BllUserApply().insert(obj) return jsonify(Utils.true_return()) @@ -142,11 +142,11 @@ def get_info_list(): # i_dict = dict(zip(i.keys(), [(x if x is not None else '') for x in i.values()])) i_dict['user_name'] = user_dict.get(i_dict["user_id"]) i_dict["user_name_pt"] = user_dict.get(i_dict["user_id_pt"]) - i_dict["solve_user_name"] = user_dict.get(i_dict["solve_user_id"], '') + i_dict["solve_user_name"] = user_dict.get(i_dict["solve_user_id"], '') i_dict["solve_user_pt_name"] = user_dict.get(i_dict["solve_user_id_pt"], '') - i_dict["solve_user_sh_name"] = user_dict.get(i_dict["solve_user_id_sh"], '') + i_dict["solve_user_sh_name"] = user_dict.get(i_dict["solve_user_id_sh"], '') if i_dict["solve_user_id_sh"] =='-': - i_dict["solve_user_sh_name"]='-' + i_dict["solve_user_sh_name"]='-' data_list.append(i_dict) return jsonify(Utils.true_return(data={"data_list": data_list, "total_count": page_param.totalRecords})) @@ -172,33 +172,30 @@ def solve_apply(): # user_id_pt = request.values.get("user_id_pt") t = request.values.get("t") obj = BllUserApply().findEntity(EntityUserApply.id == apply_id) - if obj.is_solve == 1: - return jsonify(Utils.false_return(msg="已受理,无需重复受理")) - # obj.is_solve = 1 + if obj.is_solve == 1 or obj.is_solve == 2: + msg = "驳回" if obj.is_solve == 2 else "受理" + return jsonify(Utils.false_return(msg=f"已{msg},无需重复处理")) + if user_id == obj.user_id: + return jsonify(Utils.false_return(msg="申请人与审批人不能为同一人")) + if user_id in [obj.solve_user_id_sh, obj.solve_user_id, obj.solve_user_id_sh]: + return jsonify(Utils.false_return(msg="不能为同一人审批")) + + if not obj.solve_user_id_sh: + obj.solve_user_id_sh = user_id + elif not obj.solve_user_id: + obj.solve_user_id = user_id + else: + obj.solve_user_id_pt = user_id + if str(request.values.get('result')) == "0": obj.information = request.values.get("information") obj.is_solve = 2 else: - if user_id == obj.user_id: - return jsonify(Utils.false_return(msg="申请人与审批人不能为同一人")) - if not obj.solve_user_id_sh: - obj.solve_user_id_sh = user_id - else: - if not obj.solve_user_id: - if user_id == obj.solve_user_id_sh: - return jsonify(Utils.false_return(msg="不能位同一人审批")) - obj.solve_user_id = user_id - else: - if user_id == obj.solve_user_id or user_id == obj.solve_user_id_sh: - return jsonify(Utils.false_return(msg="不能位同一人审批")) - obj.solve_user_id_pt = user_id - obj.is_solve = 1 - obj.time_hour = t - BllUserTemporaryAuth().create_temporary_auth(user_ids=[obj.user_id, obj.user_id_pt], auth_type=2, t=t) + if obj.solve_user_id_pt: + obj.is_solve = 1 + obj.time_hour = t + BllUserTemporaryAuth().create_temporary_auth(user_ids=[obj.user_id, obj.user_id_pt], auth_type=2, t=t) obj.solve_date = Utils.get_str_datetime() - # obj.solve_user_id = user_id - # obj.solve_user_id_pt = user_id_pt - # BllUserTemporaryAuth().create_temporary_auth(user_ids=[obj.user_id, obj.user_pt], auth_type=2) BllUserApply().update(obj) return jsonify(Utils.true_return()) @@ -244,7 +241,7 @@ def set_register(): if int(is_empty) ==0: setattr(obj, "status", 2) else: - setattr(obj, "status", 3) + setattr(obj, "status", 3) BllMedicament().update(obj) # 登记 BllUserApply().update_use_content(client_id=obj.client_id, user=g.current_user, drug_info=obj) @@ -308,6 +305,6 @@ def update_notes(): if i["bar_code"] ==bar_code: print('5555') i["info"] =info - obj.use_content =json.dumps(data_obj) + obj.use_content =json.dumps(data_obj) BllUserApply().update(obj) - return jsonify(Utils.true_return(data=obj)) \ No newline at end of file + return jsonify(Utils.true_return(data=obj)) diff --git a/db_logic/medicament.py b/db_logic/medicament.py index 45c9468..ed0ced3 100644 --- a/db_logic/medicament.py +++ b/db_logic/medicament.py @@ -962,13 +962,10 @@ class BllMedicament(Repository): :param drug_entry: :return: """ - expiration_dict = { - "ml": 1, - "g": 5, - "mg": 5, - } - unit = drug_entry.net_weight_unit - add_year = expiration_dict.get(unit) if expiration_dict.get(unit) else 2 + # 从分类表中获取时间年份 + medicament_variety_obj = BllMedicamentVariety().findEntity( + EntityMedicamentVariety.variety_id == drug_entry.variety_id) + 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") if add_expiration_date > drug_entry.expiration_date: diff --git a/models/medicament_models.py b/models/medicament_models.py index e59db20..8212b3d 100644 --- a/models/medicament_models.py +++ b/models/medicament_models.py @@ -125,7 +125,7 @@ class EntityMedicamentTemplate(Base): template_id = Column(String(50), primary_key=True, comment="模板ID", default=get_uuid) # 试剂管理、标准品管理、危化品、试剂耗材 func_type = Column(String(50), comment="功能分类") - + customer_id = Column(String(50), comment="客户ID") client_id = Column(String(50), comment="终端ID") client_name = Column(String(50), comment="终端名称") @@ -209,11 +209,11 @@ class EntityMedicamentVariety(Base): create_user_name = Column(String(50), comment="创建用户名称") is_add = Column(Integer, comment="", default=0) - remark1 = Column(String(50), comment='扩展字段1') + remark1 = Column(String(50), comment='扩展字段1 func_type类型') remark2 = Column(String(50), comment='扩展字段2') remark3 = Column(String(50), comment='扩展字段3') remark4 = Column(String(50), comment='扩展字段4') - remark5 = Column(String(50), comment='扩展字段5') + remark5 = Column(String(50), comment='扩展字段5 试剂有效期年份') remark6 = Column(String(50), comment='扩展字段6') remark7 = Column(String(50), comment='扩展字段7') remark8 = Column(String(50), comment='扩展字段8')