diff --git a/apps/drug_template/views.py b/apps/drug_template/views.py index 188b08c..7c49a34 100644 --- a/apps/drug_template/views.py +++ b/apps/drug_template/views.py @@ -85,7 +85,13 @@ def bind_tmp_input_db(): if drug_obj: return jsonify(Utils.false_return(msg="该药剂已被锁定")) else: - drug_info = eval(tmp_content) + content_tmp = json.loads(tmp_content) + drug_info = {} + for k, v in content_tmp.items(): + if v is None or v == "" or v == "null": + continue + else: + drug_info[k] = v # user_info = BllUser().findEntity('4cea74ee-0d8b-11ed-943e-f47b094925e1') user_info = g.current_user diff --git a/demo.py b/demo.py index 6226159..98e03ab 100644 --- a/demo.py +++ b/demo.py @@ -308,17 +308,17 @@ object_type=1 查询权限id -def get_month(num): - import arrow - month_list = [] - a = arrow.now() # 当前本地时间 - for i in range(0, num + 1): - yearmonth = a.shift(hours=-i).format("YYYY-MM-DD HH:mm:ss") - month_list.append(yearmonth) - month_list.sort() - return month_list - -print(get_month(48)) +# def get_month(num): +# import arrow +# month_list = [] +# a = arrow.now() # 当前本地时间 +# for i in range(0, num + 1): +# yearmonth = a.shift(hours=-i).format("YYYY-MM-DD HH:mm:ss") +# month_list.append(yearmonth) +# month_list.sort() +# return month_list + +# print(get_month(48)) """ 添加后排序 @@ -338,4 +338,17 @@ print(get_month(48)) -""" \ No newline at end of file +tmplate_content: {"bar_code":"789654","by_user_date":null,"by_user_id":null,"by_user_name":null,"cas_number":"106-24-7","cell_position_code":null,"client_code":null,"client_id":"1c39cb24-07f8-11ed-abd4-f47b094925e1","customer_id":"","distributor":null,"english_name":"","expiration_date":null,"flow_position_code":null,"inventory_warning_value":10,"is_add":0,"is_supervise":0,"is_weigh":0,"manufacturer":"国药","medicament_id":"12dec478-186b-11ed-b2c3-9adf5e32e162","name":"乙酸酐","net_weight":null,"net_weight_unit":null,"place":null,"price":"0","production_date":"2022-03-01","purity":"AR","put_in_date":"2022-08-10 13:12:47","put_in_user_id":"4cea74ee-0d8b-11ed-943e-f47b094925e1","put_in_user_name":"12334","remain":"749","remark1":"","remark10":"","remark11":null,"remark12":null,"remark13":null,"remark14":null,"remark15":null,"remark16":null,"remark17":null,"remark18":null,"remark19":null,"remark2":"","remark20":null,"remark21":null,"remark22":null,"remark23":null,"remark24":null,"remark25":null,"remark26":null,"remark27":null,"remark28":null,"remark29":null,"remark3":"危化品","remark30":null,"remark4":"","remark5":"","remark6":"瓶","remark7":null,"remark8":"","remark9":"烷基汞","shelf_life":0,"shelf_life_warning_value":10,"speci":"500","total":null,"tp":null,"use_days_warning_value":10,"user_auditing":null,"variety_id":"f37c5780-1869-11ed-8ac1-9adf5e32e162","weigh_flag":0,"num":12} +bar_code: 124879 +client_id: 1c39cb24-07f8-11ed-abd4-f47b094925e1 + + + + +""" +dic = {"bar_code":"789654","by_user_date":"","by_user_id":"","by_user_name":"","cas_number":"106-24-7","cell_position_code":"","client_code":"","client_id":"1c39cb24-07f8-11ed-abd4-f47b094925e1","customer_id":"","distributor":"","english_name":"","expiration_date":"","flow_position_code":"","inventory_warning_value":10,"is_add":0,"is_supervise":0,"is_weigh":0,"manufacturer":"国药","medicament_id":"12dec478-186b-11ed-b2c3-9adf5e32e162","name":"乙酸酐","net_weight":"","net_weight_unit":"","place":"","price":"0","production_date":"2022-03-01","purity":"AR","put_in_date":"2022-08-10 13:12:47","put_in_user_id":"4cea74ee-0d8b-11ed-943e-f47b094925e1","put_in_user_name":"12334","remain":"749","remark1":"","remark10":"","remark11":"","remark12":"","remark13":"","remark14":"","remark15":"","remark16":"","remark17":"","remark18":"","remark19":"","remark2":"","remark20":"","remark21":"","remark22":"","remark23":"","remark24":"","remark25":"","remark26":"","remark27":"","remark28":"","remark29":"","remark3":"危化品","remark30":"","remark4":"","remark5":"","remark6":"瓶","remark7":"","remark8":"","remark9":"烷基汞","shelf_life":0,"shelf_life_warning_value":10,"speci":"500","total":"","tp":"","use_days_warning_value":10,"user_auditing":"","variety_id":"f37c5780-1869-11ed-8ac1-9adf5e32e162","weigh_flag":0,"num":12} + +# for k,v in dic.items(): +# if v == "": +# dic.pop(k) +# print(dic) \ No newline at end of file