diff --git a/demo.py b/demo.py index 433dbe7..22e18fd 100644 --- a/demo.py +++ b/demo.py @@ -1,409 +1,11 @@ -""" -# 试剂进行入库时已绑定柜体id,不考虑相同试剂多柜体的情况 +#!/usr/bin/env python +# -*- encoding: utf-8 -*- +''' +@Date:2022/09/08 13:42:28 +''' +import sys +sys.path.append('.') -试剂id、柜体id、 +from werkzeug.security import check_password_hash, generate_password_hash -## 主概览 - -根据试剂记录展示入库/领用/归还/未归还 - -预警信息 ? - -## 报表统计---库存信息--总库存减去已绑定柜体的试剂数 - -库存信息总览 展示库存内试剂信息 根据所属终端分组去重 - -入库信息 展示入库试剂信息 -试剂信息 根据试剂名称、规格、纯度进行去重展示 并分页 - -试剂使用统计 根据试剂记录展示信息 - -## 实际入库---未对试剂和柜体进行绑定 - -展示上传excle表格数据/新增模板实际数据 - -选择试剂入库 展示已入库试剂信息---选择按钮,进行编辑试剂信息 - -绑定入库,绑定操作根据前端传递参数进行入库操作 - -新增模板,保存模板基本信息和模板内试剂json字符串信息入库 - -打印条码,? - -导入入库模板,根据柜体,模板名称进行解析模板内试剂json字符串进行柜体试剂绑定 - -删除模板, - -试剂归还,根据前端传递参数进行记录数据入库,展示待归还数据列表 -试剂称重, ... - -## 库存盘点 - -库存盘点,展示试剂库存信息, -录入库存,添加试剂数量,根据管理人员确定展示校验结果 -历史记录, ? - -## 试剂管理 - -展示, ? - - -报表统计: - 库存信息总览: 分组 - 在库剩余数量:count(id) - 剩余总量:sum(remain) - - 入库信息查询: - 默认展示 - - - 试剂信息详情: - 根据名称、纯度、规格、分组展示 - 余量? - - - - 库存消耗: rms_medicament? rms_medicament_variety? - 入库数量 记录表record_type = 1 数量 - 借出 记录表record_type = 2 数量 - 借出 记录表record_type = 2 数量 - 当前库存总量: - rms_medicament_record record_type=1的 count(id)? - 当前库存数量: status=1的count(id)? - 当前借出数量: status=2的count(id)? - 消耗数量: ? - - 试剂用量消耗: - 库存量 表rms_medicament count(id) status=1 - 使用次数 表rms_medicament_record count(record_type=2) 数量 - 总用量 表rms_medicament_record sum(use_quantity) record_type=3 - - - -""" - - -# Remark1 = Column(String(50)) # 备注1 -# Remark2 = Column(String(50)) # 备注2 -# Remark3 = Column(String(50)) # 备注3 -# Remark4 = Column(String(50)) -# Remark5 = Column(String(50)) -# Remark6 = Column(String(50)) -# Remark7 = Column(String(50)) -# Remark8 = Column(String(50)) -# Remark9 = Column(String(50)) -# Remark10 = Column(String(50)) - -# for i in range(30): -# print(f"remark{i+1} = Column(String(50), comment='扩展字段{i+1}')") -# import random -# from string import digits, ascii_letters, punctuation - -# aaa = digits + ascii_letters+ punctuation -# # ccc = 'l4wu&yj@=ed^ybmwm&vh0cglcqwagu8&($r5@qsmf(bb93=' -# # print(len(ccc)) -# print(aaa) -# a = '' - -# # while True: -# # c = random.choice(aaa) -# # if c in ["'", '"', ",", ";", "."]: -# # continue -# # # print(c) -# # a += c -# # # print(a) -# # if len(a) >= 50: -# # break -# # print(a) -# import random - -# # print(random.choice([1,2,3])) - - -# a = """12342525436 %s freqwrqwercqwe""" - -# b = '' -# if b: -# a = a % f"ccccc{b}ccccccc" -# else: -# a = a % '' -# print(a) - - -# def mysqlfinds_list(data, finds): -# return [dict(zip(finds, i)) for i in data] - - -# fin = ["id", "name", "age"] -# da = [(1, "a", 10), (2, "b", 11),(3, "c", 12)] - -# print(mysqlfinds_list(da, fin)) - -def model_name_loer(db_model): - for i in db_model.split("\n"): - base = i.split(" = ") - if len(base) < 2: - continue - # print(base) - name = "" - base_name = base[0].replace(" ", '') - for k, v in enumerate(base_name): - if k != 0 and name and v.isupper(): - name += '_' - if v.isupper(): - name += v.lower() - else: - name += v - base_d = base[1].replace(" ", '') - comment = base_d.split("#") - try: - db_comment = comment[1] - except IndexError: - db_comment = '' - - comment_name = comment[0][:-1] + f', comment="{db_comment}")' - print(f"{name} = {comment_name}") - -# import json -# tes_li_bse = [{"VarietyId": "f8442a6e-9950-11ec-a502-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u6613\u5236\u6bd2", "Remark4": "", "Name": "\u7532\u82ef", "EnglishName": "", "Purity": "AR\uff08\u6caa\u8bd5\uff09\uff0c\u2265 99.5%", "CASNumber": "108-88-3", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "1", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "683", "Manufacturer": "\u56fd\u836f", "Remark8": "", "Remark9": "\u70f7\u57fa\u6c5e", "Remark10": ""}, {"VarietyId": "f8442a6f-9950-11ec-9253-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u5371\u5316\u54c1", "Remark4": "", "Name": "\u82ef\u915a", "EnglishName": "", "Purity": "AR\uff08\u6caa\u8bd5\uff09\uff0c\u2265 99.0%", "CASNumber": "108-95-2", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "1", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "848", "Manufacturer": "\u56fd\u836f", "Remark8": "", "Remark9": "\u6325\u53d1\u915a", "Remark10": ""}, {"VarietyId": "f8442a70-9950-11ec-a157-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u5371\u5316\u54c1", "Remark4": "", "Name": "\u82ef", "EnglishName": "", "Purity": "AR\uff08\u6caa\u8bd5\uff09\uff0c\u2265 99.5%", "CASNumber": "71-43-2", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "1", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "640", "Manufacturer": "\u56fd\u836f", "Remark8": "", "Remark9": "\u6cb9", "Remark10": ""}, {"VarietyId": "f8442a71-9950-11ec-9894-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u5371\u5316\u54c1", "Remark4": "", "Name": "\u4e59\u9178\uff0836%\uff09", "EnglishName": "", "Purity": "AR", "CASNumber": "64-19-7", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "1", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "734", "Manufacturer": "\u56fd\u836f", "Remark8": "", "Remark9": "\u70f7\u57fa\u6c5e", "Remark10": ""}, {"VarietyId": "f84451a6-9950-11ec-8925-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u5371\u5316\u54c1", "Remark4": "", "Name": "\u4e59\u9178\u9150", "EnglishName": "", "Purity": "AR", "CASNumber": "106-24-7", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "1", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "749", "Manufacturer": "\u56fd\u836f", "Remark8": "", "Remark9": "\u70f7\u57fa\u6c5e", "Remark10": ""}, {"VarietyId": "f84451a7-9950-11ec-9b4e-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u5371\u5316\u54c1", "Remark4": "", "Name": "\u56db\u6c2f\u4e59\u70ef", "EnglishName": "", "Purity": "\u73af\u4fdd\u7ea7", "CASNumber": "127-18-4", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "28", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "1207", "Manufacturer": "\u5929\u6d25\u50b2\u7136", "Remark8": "", "Remark9": "\u6cb9", "Remark10": ""}, {"VarietyId": "f84451a8-9950-11ec-96ca-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u5371\u5316\u54c1", "Remark4": "", "Name": "\u56db\u6c2f\u5316\u78b3", "EnglishName": "", "Purity": "\u7ea2\u5916\u6d4b\u6cb9\u4eea\u4e13\u7528", "CASNumber": "56-23-5", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "31", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "1126", "Manufacturer": "\u5b89\u8c31", "Remark8": "", "Remark9": "\u77ff\u7269\u6cb9", "Remark10": ""}] -# new_li = [] -# for i in tes_li_bse: -# dic = {} -# for k, v in i.items(): -# bse_key = "" -# for index, va in enumerate(k): -# if index != 0 and bse_key and va.isupper(): -# bse_key += '_' -# if va.isupper(): -# bse_key += va.lower() -# else: -# bse_key += va -# bse_key = bse_key if bse_key != "c_a_s_number" else "cas_number" -# dic[bse_key] = v -# new_li.append(dic) -# print(json.dumps(new_li)) - -""" -[ - {"variety_id": "f8442a6e-9950-11ec-a502-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u6613\u5236\u6bd2", "remark4": "", "name": "\u7532\u82ef", "english_name": "", "purity": "AR\uff08\u6caa\u8bd5\uff09\uff0c\u2265 99.5%", "cas_number": "108-88-3", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "1", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "683", "manufacturer": "\u56fd\u836f", "remark8": "", "remark9": "\u70f7\u57fa\u6c5e", "remark10": ""}, - {"variety_id": "f8442a6f-9950-11ec-9253-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u5371\u5316\u54c1", "remark4": "", "name": "\u82ef\u915a", "english_name": "", "purity": "AR\uff08\u6caa\u8bd5\uff09\uff0c\u2265 99.0%", "cas_number": "108-95-2", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "1", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "848", "manufacturer": "\u56fd\u836f", "remark8": "", "remark9": "\u6325\u53d1\u915a", "remark10": ""}, - {"variety_id": "f8442a70-9950-11ec-a157-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u5371\u5316\u54c1", "remark4": "", "name": "\u82ef", "english_name": "", "purity": "AR\uff08\u6caa\u8bd5\uff09\uff0c\u2265 99.5%", "cas_number": "71-43-2", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "1", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "640", "manufacturer": "\u56fd\u836f", "remark8": "", "remark9": "\u6cb9", "remark10": ""}, - {"variety_id": "f8442a71-9950-11ec-9894-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u5371\u5316\u54c1", "remark4": "", "name": "\u4e59\u9178\uff0836%\uff09", "english_name": "", "purity": "AR", "cas_number": "64-19-7", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "1", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "734", "manufacturer": "\u56fd\u836f", "remark8": "", "remark9": "\u70f7\u57fa\u6c5e", "remark10": ""}, - {"variety_id": "f84451a6-9950-11ec-8925-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u5371\u5316\u54c1", "remark4": "", "name": "\u4e59\u9178\u9150", "english_name": "", "purity": "AR", "cas_number": "106-24-7", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "1", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "749", "manufacturer": "\u56fd\u836f", "remark8": "", "remark9": "\u70f7\u57fa\u6c5e", "remark10": ""}, - {"variety_id": "f84451a7-9950-11ec-9b4e-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u5371\u5316\u54c1", "remark4": "", "name": "\u56db\u6c2f\u4e59\u70ef", "english_name": "", "purity": "\u73af\u4fdd\u7ea7", "cas_number": "127-18-4", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "28", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "1207", "manufacturer": "\u5929\u6d25\u50b2\u7136", "remark8": "", "remark9": "\u6cb9", "remark10": ""}, - {"variety_id": "f84451a8-9950-11ec-96ca-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u5371\u5316\u54c1", "remark4": "", "name": "\u56db\u6c2f\u5316\u78b3", "english_name": "", "purity": "\u7ea2\u5916\u6d4b\u6cb9\u4eea\u4e13\u7528", "cas_number": "56-23-5", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "31", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "1126", "manufacturer": "\u5b89\u8c31", "remark8": "", "remark9": "\u77ff\u7269\u6cb9", "remark10": ""}] - -""" -# import datetime -# data_list = [ -# {'ModuleId': '06508334-2507-49c4-be5c-8e8d9775bc56', 'ModuleType': '1', 'ModuleCode': 'MyDrug', 'ModuleName': '我的药剂', 'Icon': None, 'UrlAddress': None, 'SortIndex': 4, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, 'Description': None, -# 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '0b87a3a3-e09d-4f71-a6e4-b4df8b092683', 'ModuleType': '1', 'ModuleCode': 'About', 'ModuleName': '关于系统', 'Icon': None, 'UrlAddress': None, 'SortIndex': 13, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, 'Description': None, -# 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '0c9144a7-13b0-4a0e-8364-42a783488b36', 'ModuleType': '2', 'ModuleCode': 'DrugScanBarCode', 'ModuleName': '扫码查询', 'Icon': None, 'UrlAddress': None, 'SortIndex': 15, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '18dfe869-1811-4af5-bfcf-48e14319a862', 'ModuleType': '2', 'ModuleCode': 'UserIndex', 'ModuleName': '用户管理', 'Icon': None, 'UrlAddress': None, 'SortIndex': 52, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '198654be-cdc7-4581-9476-1607ebb067cf', 'ModuleType': '2', 'ModuleCode': 'CabinetIndex', 'ModuleName': '柜体管理', 'Icon': None, 'UrlAddress': None, 'SortIndex': 26, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '2deee6c6-8ee0-4f10-bbc2-76e355c47dde', 'ModuleType': '1', 'ModuleCode': 'WarningData', 'ModuleName': '预警管理', 'Icon': None, 'UrlAddress': None, 'SortIndex': 7, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, 'Description': None, -# 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '2e1cbd6d-d550-4f9c-bf3b-7baa206d5e16', 'ModuleType': '1', 'ModuleCode': 'WarningConfig', 'ModuleName': '系统设置', 'Icon': None, 'UrlAddress': None, 'SortIndex': 12, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, -# 'Description': None, 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '3461016c-d8f5-11e8-95b1-7427eac89794', 'ModuleType': '1', 'ModuleCode': 'RemoteManage', 'ModuleName': '远程管理', 'Icon': None, 'UrlAddress': None, 'SortIndex': 10, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, -# 'Description': None, 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '4d354993-6977-4a2e-b11c-7f1993875284', 'ModuleType': '2', 'ModuleCode': 'DrugUseView', 'ModuleName': '试剂领用', 'Icon': None, 'UrlAddress': None, 'SortIndex': 18, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '4d8a2e05-86e5-4a44-8167-fbbd76ae9dca', 'ModuleType': '2', 'ModuleCode': 'DrugReturnView', 'ModuleName': '试剂归还', 'Icon': None, 'UrlAddress': None, 'SortIndex': 20, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '5b216724-cfff-4032-9e82-4f2e4c7aa085', 'ModuleType': '1', 'ModuleCode': 'DrugView', 'ModuleName': '药剂查询', 'Icon': None, 'UrlAddress': None, 'SortIndex': 5, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, 'Description': None, -# 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'ModifyUserId': 'rererttrtryty', 'ModifyUserName': '系统维护员', 'IsAdd': None}, -# {'ModuleId': '60013b06-d8f5-11e8-983e-7427eac89794', 'ModuleType': '1', 'ModuleCode': 'quitSystem', 'ModuleName': '退出系统', 'Icon': None, 'UrlAddress': None, 'SortIndex': 13, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, 'Description': None, -# 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '66b8da23-37b3-4b68-b05f-7c67385d8d1a', 'ModuleType': '2', 'ModuleCode': 'HumitureIndex', 'ModuleName': '温度记录', 'Icon': None, 'UrlAddress': None, 'SortIndex': 36, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '6fa6fa4b-f9ba-4624-85f8-30326e58596e', 'ModuleType': '2', 'ModuleCode': 'DrugWeigh', 'ModuleName': '试剂称重', 'Icon': None, 'UrlAddress': None, 'SortIndex': 22, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '6fdf7f81-e8f4-4b33-90cc-9682f0c181ba', 'ModuleType': '1', 'ModuleCode': 'UserManage', 'ModuleName': '用户管理', 'Icon': None, 'UrlAddress': None, 'SortIndex': 9, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, 'Description': None, -# 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '74eed32c-adc0-4bff-8dd0-1b6312a2110a', 'ModuleType': '1', 'ModuleCode': 'Camera', 'ModuleName': '视频监控', 'Icon': None, 'UrlAddress': None, 'SortIndex': 8, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, 'Description': None, -# 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '7c4503bb-4f30-42a3-8ebf-e97be4a5dae9', 'ModuleType': '1', 'ModuleCode': 'DrugWeigh', 'ModuleName': '药剂称重', 'Icon': None, 'UrlAddress': None, 'SortIndex': 0, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, 'Description': None, -# 'CreateDate': datetime.datetime(2019, 12, 8, 15, 52, 11), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2019, 12, 8, 15, 52, 16), 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '84baf3f0-1933-41c8-8778-cc8db716cd25', 'ModuleType': '2', 'ModuleCode': 'DrugTypeIndex', 'ModuleName': '试剂类别', 'Icon': None, 'UrlAddress': None, 'SortIndex': 30, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '8596d10d-f24f-4ea1-816a-7fe66e0b57f4', 'ModuleType': '2', 'ModuleCode': 'UserRoleIndex', 'ModuleName': '角色管理', 'Icon': None, 'UrlAddress': None, 'SortIndex': 56, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '85b29cd3-c6ef-485c-8ddf-8517bdf35fe1', 'ModuleType': '2', 'ModuleCode': 'StockTakingIndex', 'ModuleName': '库存盘点', 'Icon': None, 'UrlAddress': None, 'SortIndex': 50, 'ModuleWeight': 5, 'ParentId': '0', -# 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': '8f4e0f8d-4334-44cc-8374-a8cb2c805e83', 'ModuleType': '2', 'ModuleCode': 'WarningIndex', 'ModuleName': '预警信息', 'Icon': None, 'UrlAddress': None, 'SortIndex': 32, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': 'a465f95a-8b67-4a01-b958-68ba0f1a635d', 'ModuleType': '2', 'ModuleCode': 'DrugTemplateIndex', 'ModuleName': '试剂入库', 'Icon': None, 'UrlAddress': None, 'SortIndex': 16, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': 'a5fccba3-2a73-439b-a619-19dec121a44b', 'ModuleType': '1', 'ModuleCode': 'DrugReturn', 'ModuleName': '药剂归还', 'Icon': None, 'UrlAddress': None, 'SortIndex': 2, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, 'Description': None, -# 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'ModifyUserId': 'rererttrtryty', 'ModifyUserName': '系统维护员', 'IsAdd': None}, -# {'ModuleId': 'a98db670-b1d9-4655-83d1-6e285691d567', 'ModuleType': '2', 'ModuleCode': 'DataReportIndex', 'ModuleName': '报表统计', 'Icon': None, 'UrlAddress': None, 'SortIndex': 38, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': 'c826c343-945b-4ba0-91f2-c3effd3865d0', 'ModuleType': '2', 'ModuleCode': 'DrugIndex', 'ModuleName': '试剂数据', 'Icon': None, 'UrlAddress': None, 'SortIndex': 28, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': 'd314dcd7-c23c-4117-a1a2-9304ae8eb7ed', 'ModuleType': '1', 'ModuleCode': 'SysSetting', 'ModuleName': '运行日志', 'Icon': None, 'UrlAddress': None, 'SortIndex': 11, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, 'Description': None, -# 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': 'ec10a7d2-ece7-4122-9b54-a87fb4d56b65', 'ModuleType': '1', 'ModuleCode': 'DrugPutIn', 'ModuleName': '药剂入库', 'Icon': None, 'UrlAddress': None, 'SortIndex': 3, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, 'Description': None, -# 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 25), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 25), 'ModifyUserId': 'rererttrtryty', 'ModifyUserName': '系统维护员', 'IsAdd': None}, -# {'ModuleId': 'ec1637ca-e813-437e-9651-5d75761a634d', 'ModuleType': '1', 'ModuleCode': 'DrugUse', 'ModuleName': '药剂领用', 'Icon': None, 'UrlAddress': None, 'SortIndex': 1, 'ModuleWeight': 10, 'ParentId': '0', 'IsEnabled': 1, 'Description': None, -# 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'ModifyUserId': 'rererttrtryty', 'ModifyUserName': '系统维护员', 'IsAdd': None}, -# {'ModuleId': 'f132f6ad-fb46-4293-be2d-c69fe93bcfbe', 'ModuleType': '2', 'ModuleCode': 'LogIndex', 'ModuleName': '日志数据', 'Icon': None, 'UrlAddress': None, 'SortIndex': 58, 'ModuleWeight': 5, -# 'ParentId': '0', 'IsEnabled': 1, 'Description': None, 'CreateDate': None, 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': None, 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None}, -# {'ModuleId': 'fb1130d3-a487-46e1-84cb-05c25a1cca8d', 'ModuleType': '1', 'ModuleCode': 'DataReport', 'ModuleName': '报表数据', 'Icon': None, 'UrlAddress': None, 'SortIndex': 6, 'ModuleWeight': 5, 'ParentId': '0', 'IsEnabled': 1, 'Description': None, -# 'CreateDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'CreateUserId': None, 'CreateUserName': None, 'ModifyDate': datetime.datetime(2017, 6, 16, 14, 26, 18), 'ModifyUserId': None, 'ModifyUserName': None, 'IsAdd': None} - -# ] - - - -""" -SELECT - c.ModuleId, - c.ModuleCode, - c.SortIndex, - c.ModuleName -FROM - ( -SELECT - a.ModuleId, - b.ModuleCode, - b.SortIndex, - b.ModuleName -FROM - `RMS_ModuleRelation` AS a - LEFT JOIN RMS_Module AS b ON a.ModuleId = b.ModuleId -WHERE - ObjectId = : user_id - AND ObjectType = 2 UNION -SELECT - a.ModuleId, - b.ModuleCode, - b.SortIndex, - b.ModuleName -FROM - `RMS_ModuleRelation` AS a - LEFT JOIN RMS_Module AS b ON a.ModuleId = b.ModuleId -WHERE - ObjectId = : role_id - AND ObjectType = 1 - ) AS c -ORDER BY - c.SortIndex ASC - - -object_type=2 查询用户id -object_type=1 查询权限id - - - -出库超期预警:用户 12345 已领用 甲烷(123123123)3天,超过预警线, 1天 -药剂保质期预警:药剂 甲烷(123123123)超过保质期预警线, 当前时间:%Y-%m-%d %H:%M:%S;设定警戒线:10天;位置:11号柜1-2-3 -""" - - - - -# 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)) - -""" -添加后排序 - -删除后填充之前的空缺 - - - -需要字段 前端展示中文名称,字段描述,字段长度 - -添加权重,根据权重排序进行展示 - - -展示位置,报表-试剂详情 -试剂管理 -入库 - - - -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) -# data_list = [{"t1":0, "t2":2, "t3": 1}, {"t1":None, "t2":1, "t3": 1}] -# new_data_list = [] -# for i in data_list: -# new_dic = {} -# for k, v in i.items(): -# if not v: -# v = 0 -# new_dic[k] = v -# new_li = list(new_dic.values()) -# new_dic.update(**{ -# "t4": int(new_li[1]) - int(new_li[2]) -# }) -# new_data_list.append(new_dic) -# print(new_data_list) - -a = 0 - -class BaseStatus(object): - - status = None - def __init__(self, status=0) -> None: - self.status = status - - -import threading -class WriteTxt(object): - - status_obj = None - - def __init__(self) -> None: - self.status_obj = BaseStatus() - - def write1(self): - self.status_obj.status = 1 - fileName = 'note.txt' - for i in range(100): - with open(fileName, 'a', encoding='utf-8')as file: - file.write(str(self.status_obj.status)+"\n") - - def write2(self): - self.status_obj.status = 2 - fileName = 'note1.txt' - for i in range(100): - with open(fileName, 'a', encoding='utf-8')as file: - file.write(str(self.status_obj.status) + "\n") - - def start(self): - p = threading.Thread(target=self.write1) - p.start() - p1 = threading.Thread(target=self.write2) - p1.start() - -if __name__ == '__main__': - aaa = WriteTxt() - aaa.start() \ No newline at end of file +print(generate_password_hash("11111111"))