Compare commits

...

2 Commits

Author SHA1 Message Date
tangxuan 3ffb823cc4 对照品同步更改
2 years ago
tangxuan f724d0e926 2.开瓶有效期规则变化,手动设置每个分类的开瓶有效期延长时间
2 years ago

@ -594,3 +594,22 @@ def print_select_drug_code():
obj = CreateBarcode() obj = CreateBarcode()
obj.create_drug_lobel_code(**new_dict) obj.create_drug_lobel_code(**new_dict)
return jsonify(Utils.true_return(msg="打印完成")) return jsonify(Utils.true_return(msg="打印完成"))
@drug_router.route("/calculate_volume_weight", methods=["POST"])
@token_auth.login_required
def calculate_volume_weight():
"""
计算体积转化为质量 M = P * V
:param variety_id: 类别ID
:param input_volume: 输入体积
:return:
"""
variety_id = request.values.get("variety_id")
input_volume = request.values.get("input_volume")
medicament_variety_obj = BllMedicamentVariety().findEntity(
EntityMedicamentVariety.variety_id == variety_id)
weight = float(input_volume) * float(medicament_variety_obj.density)
return jsonify(Utils.true_return(msg="完成", data={"weight": Utils.reserve_decimal(weight)}))

@ -74,11 +74,11 @@ def user_apply_log():
if client_obj: if client_obj:
i["client_name"]=client_obj.client_name i["client_name"]=client_obj.client_name
else: else:
i["client_name"]='' i["client_name"]=''
use_content =json.dumps(data_obj) use_content =json.dumps(data_obj)
solve_user_id_sh ="-" solve_user_id_sh ="-"
if tag ==1: if tag ==1:
solve_user_id_sh = '' solve_user_id_sh = ''
obj = EntityUserApply( obj = EntityUserApply(
user_id=g.current_user.user_id, user_id=g.current_user.user_id,
user_id_pt=user_id_pt, user_id_pt=user_id_pt,
@ -92,7 +92,7 @@ def user_apply_log():
func_type=func_type, func_type=func_type,
# client_code=client_code, # client_code=client_code,
use_doc=use_doc use_doc=use_doc
) )
BllUserApply().insert(obj) BllUserApply().insert(obj)
return jsonify(Utils.true_return()) 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 = 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'] = user_dict.get(i_dict["user_id"])
i_dict["user_name_pt"] = user_dict.get(i_dict["user_id_pt"]) 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_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"] =='-': if i_dict["solve_user_id_sh"] =='-':
i_dict["solve_user_sh_name"]='-' i_dict["solve_user_sh_name"]='-'
data_list.append(i_dict) data_list.append(i_dict)
return jsonify(Utils.true_return(data={"data_list": data_list, "total_count": page_param.totalRecords})) 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") # user_id_pt = request.values.get("user_id_pt")
t = request.values.get("t") t = request.values.get("t")
obj = BllUserApply().findEntity(EntityUserApply.id == apply_id) obj = BllUserApply().findEntity(EntityUserApply.id == apply_id)
if obj.is_solve == 1: if obj.is_solve == 1 or obj.is_solve == 2:
return jsonify(Utils.false_return(msg="已受理,无需重复受理")) msg = "驳回" if obj.is_solve == 2 else "受理"
# obj.is_solve = 1 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": if str(request.values.get('result')) == "0":
obj.information = request.values.get("information") obj.information = request.values.get("information")
obj.is_solve = 2 obj.is_solve = 2
else: else:
if user_id == obj.user_id: if obj.solve_user_id_pt:
return jsonify(Utils.false_return(msg="申请人与审批人不能为同一人")) obj.is_solve = 1
if not obj.solve_user_id_sh: obj.time_hour = t
obj.solve_user_id_sh = user_id BllUserTemporaryAuth().create_temporary_auth(user_ids=[obj.user_id, obj.user_id_pt], auth_type=2, t=t)
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)
obj.solve_date = Utils.get_str_datetime() 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) BllUserApply().update(obj)
return jsonify(Utils.true_return()) return jsonify(Utils.true_return())
@ -244,7 +241,7 @@ def set_register():
if int(is_empty) ==0: if int(is_empty) ==0:
setattr(obj, "status", 2) setattr(obj, "status", 2)
else: else:
setattr(obj, "status", 3) setattr(obj, "status", 3)
BllMedicament().update(obj) BllMedicament().update(obj)
# 登记 # 登记
BllUserApply().update_use_content(client_id=obj.client_id, user=g.current_user, drug_info=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: if i["bar_code"] ==bar_code:
print('5555') print('5555')
i["info"] =info i["info"] =info
obj.use_content =json.dumps(data_obj) obj.use_content =json.dumps(data_obj)
BllUserApply().update(obj) BllUserApply().update(obj)
return jsonify(Utils.true_return(data=obj)) return jsonify(Utils.true_return(data=obj))

@ -572,7 +572,7 @@ class BllMedicament(Repository):
select a.*,b.client_name from ( select a.*,b.client_name from (
select select
name, english_name,bar_code,manufacturer,speci,remain,purity,production_date,shelf_life,expiration_date,put_in_date,put_in_user_name, name, english_name,bar_code,manufacturer,speci,remain,purity,production_date,shelf_life,expiration_date,put_in_date,put_in_user_name,
status,by_user_name,client_id status,by_user_name,client_id, is_packing, is_label, is_aspect
from rms_medicament {filter_base} from rms_medicament {filter_base}
) a LEFT JOIN( ) a LEFT JOIN(
select client_id,client_name from rms_client {filter_base1} select client_id,client_name from rms_client {filter_base1}
@ -962,13 +962,10 @@ class BllMedicament(Repository):
:param drug_entry: :param drug_entry:
:return: :return:
""" """
expiration_dict = { # 从分类表中获取时间年份
"ml": 1, medicament_variety_obj = BllMedicamentVariety().findEntity(
"g": 5, EntityMedicamentVariety.variety_id == drug_entry.variety_id)
"mg": 5, add_year = int(medicament_variety_obj.remark5) if medicament_variety_obj.remark5 else 1
}
unit = drug_entry.net_weight_unit
add_year = expiration_dict.get(unit) if expiration_dict.get(unit) else 2
date_now = datetime.datetime.now() date_now = datetime.datetime.now()
add_expiration_date = (date_now + relativedelta(years=add_year)).strftime("%Y-%m-%d %H:%M:%S") add_expiration_date = (date_now + relativedelta(years=add_year)).strftime("%Y-%m-%d %H:%M:%S")
if add_expiration_date > drug_entry.expiration_date: if add_expiration_date > drug_entry.expiration_date:

@ -7,7 +7,7 @@ import sys
sys.path.append('.') sys.path.append('.')
# from common.utils import Utils # from common.utils import Utils
from sqlalchemy import Column, String, Integer, Text, Float, inspect from sqlalchemy import Column, String, Integer, Text, Float, inspect, SmallInteger
from models.models_base import Base, get_uuid from models.models_base import Base, get_uuid
# from sqlalchemy.ext.declarative import declarative_base # from sqlalchemy.ext.declarative import declarative_base
@ -125,7 +125,7 @@ class EntityMedicamentTemplate(Base):
template_id = Column(String(50), primary_key=True, comment="模板ID", default=get_uuid) template_id = Column(String(50), primary_key=True, comment="模板ID", default=get_uuid)
# 试剂管理、标准品管理、危化品、试剂耗材 # 试剂管理、标准品管理、危化品、试剂耗材
func_type = Column(String(50), comment="功能分类") func_type = Column(String(50), comment="功能分类")
customer_id = Column(String(50), comment="客户ID") customer_id = Column(String(50), comment="客户ID")
client_id = Column(String(50), comment="终端ID") client_id = Column(String(50), comment="终端ID")
client_name = Column(String(50), comment="终端名称") client_name = Column(String(50), comment="终端名称")
@ -208,12 +208,16 @@ class EntityMedicamentVariety(Base):
create_user_id = Column(String(50), comment="创建用户ID") create_user_id = Column(String(50), comment="创建用户ID")
create_user_name = Column(String(50), comment="创建用户名称") create_user_name = Column(String(50), comment="创建用户名称")
is_add = Column(Integer, comment="", default=0) is_add = Column(Integer, comment="", default=0)
# 1是 0否
is_packing = Column(SmallInteger, default=1, comment="包装是否完好 1是 0否")
is_label = Column(SmallInteger, default=1, comment="标签是否清晰 1是 0否")
is_aspect = Column(SmallInteger, default=1, comment="外观是否符合要求 1是 0否")
remark1 = Column(String(50), comment='扩展字段1') remark1 = Column(String(50), comment='扩展字段1 func_type类型')
remark2 = Column(String(50), comment='扩展字段2') remark2 = Column(String(50), comment='扩展字段2')
remark3 = Column(String(50), comment='扩展字段3') remark3 = Column(String(50), comment='扩展字段3')
remark4 = Column(String(50), comment='扩展字段4') remark4 = Column(String(50), comment='扩展字段4')
remark5 = Column(String(50), comment='扩展字段5') remark5 = Column(String(50), comment='扩展字段5 试剂有效期年份')
remark6 = Column(String(50), comment='扩展字段6') remark6 = Column(String(50), comment='扩展字段6')
remark7 = Column(String(50), comment='扩展字段7') remark7 = Column(String(50), comment='扩展字段7')
remark8 = Column(String(50), comment='扩展字段8') remark8 = Column(String(50), comment='扩展字段8')

Loading…
Cancel
Save