试剂模板相关

duizhaopin
apan 3 years ago
parent 6826648699
commit 12cfcd6bed

@ -53,13 +53,15 @@ class Utils(object):
#将sqlAlchemy Sql执行数据对象列表转换为实体列表
def mysqlTable2Model(dataList):
# mac = uuid.UUID(int=uuid.getnode()).hex[-12:]
#return [dict(zip(result.keys(), result.values())) for result in dataList]
return [dict(zip(result.keys(), [(x if x is not None else '') for x in result.values()])) for result in dataList]
# 根据自定义字段及数据顺序进行返回
def mysqlfinds_list(data, finds):
return [dict(zip(finds, i)) for i in data]
# sqlalchemy 原生sql转换实体列表
def msyql_table_model(data_list):
return[i._mapping for i in data_list]
#生成统一格式接口数据
def resultData(status, message, data=""):

@ -0,0 +1,130 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Date:2022/07/25 14:57:23
'''
import time
import json
import uuid
import datetime
from string import ascii_uppercase
from openpyxl import load_workbook
class ReadExcel:
def __init__(self, excelName):
self.wb = load_workbook(excelName)
self.ws = self.wb.active
self.template_list = []
def read(self):
max_lines = self.ws.max_row
if self.ws['C1'].value == 'template_content':
for key in range(2, max_lines + 1):
value = self.ws['{}'.format('C' + str(key))].value
self.template_list.append(value)
return self.template_list
elif self.ws['A1'].value == '申购单编号' and self.ws['B1'].value == '采购单编号':
drug_list = []
# lineIndex = 0
try:
for line in range(2, max_lines + 1):
# 局部方法,传递字符和默认值返回方法调用,简化代码量
value_func = lambda x,y='': str(self.ws[f"{x}{line}"].value or y)
# 声明一个字典存放每一行的数据 每遍历一次字典重置一次
drug_template_dict = {
"variety_id": str(uuid.uuid1()),
}
key_list = [
"remark1", "remark2", "remark3", "remark4", "name",
"english_name", "purity", "cas_number", "remark5", "net_weight",
"net_weight_unit", "export_count", "remark6"
]
# 采用列表和字母对应的两个列表,进行循环的方式写入字典,简化代码量
v_list = list("ABCDEFGHIJKLM")
for i in range(len(key_list)):
drug_template_dict[key_list[i]] = value_func(v_list[i])
if key_list[i] == "name" and drug_template_dict.get("name") == "":
self.template_list.append(json.dumps(drug_list))
return self.template_list
# 时间判断逻辑较为凌乱,采用原思路进行重写
# 定义当前时间对象
pDate = datetime.datetime.now()
# 局部性时间字符串,共用
str_tim = "%Y-%m-%d %H:%M:%S"
# 定义公共方法,处理时间转换
date_func = lambda x: datetime.datetime.strptime(x, str_tim)
# 和原逻辑一样,简化写法
if not value_func("P"):
if value_func("O"):
pDate = date_func(value_func("N"))
shelf_life = value_func("O", "3650")
else:
if value_func("N"):
pDate = date_func(value_func('N'), str_tim)
shelf_life = self.time_long(
date_func(pDate.strftime(str_tim)), date_func(value_func("P")))
drug_template_dict["production_date"] = pDate.strftime(str_tim)
drug_template_dict["shelf_life"] = shelf_life
# if(not self.ws['P{}'.format(str(line))].value):
# pDate = datetime.datetime.now()
# if(self.ws['O{}'.format(str(line))].value):
# pDate = datetime.datetime.strptime(str(self.ws['N{}'.format(str(line))].value), "%Y-%m-%d %H:%M:%S")
# drug_template_dict['ProductionDate'] = pDate.strftime("%Y-%m-%d")
# drug_template_dict['ShelfLife'] = str(self.ws['O{}'.format(str(line))].value or '3650')
# else:
# pDate = datetime.datetime.now()
# if(self.ws['N{}'.format(str(line))].value):
# pDate = datetime.datetime.strptime(str(self.ws['N{}'.format(str(line))].value), "%Y-%m-%d %H:%M:%S")
# drug_template_dict['ProductionDate'] = pDate.strftime("%Y-%m-%d")
# drug_template_dict['ShelfLife'] = self.time_long(
# datetime.datetime.strptime(pDate.strftime("%Y-%m-%d %H:%M:%S"), "%Y-%m-%d %H:%M:%S"), datetime.datetime.strptime(str(self.ws['P{}'.format(str(line))].value), "%Y-%m-%d %H:%M:%S"))
v_list1 = list("QRSTUVW")
key_list1 = [
"price", "is_supervise", "remain", "manufacturer", "remark8", "remark9", "remark10"
]
for x in range(len(key_list1)):
ex = ''
if key_list1[x] in ["price", "remain"]:
ex = "0"
val = value_func(v_list1[x], ex)
if v_list1[x] == 'R':
if val != "":
value = 0
else:
value = 1
else:
value = val
drug_template_dict[key_list1[x]] = value
drug_list.append(drug_template_dict)
self.template_list.append(json.dumps(drug_list))
return self.template_list
except Exception as e:
raise RuntimeError('{0}行;{1}'.format(str(line), str(e)))
else:
raise RuntimeError('模板格式错误!')
def close(self):
self.wb.close()
def time_long(self, time1, time2, type="day"):
"""
计算时间差
:param time1: 较小的时间datetime类型
:param time2: 较大的时间datetime类型
:param type: 返回结果的时间类型暂时就是返回相差天数
:return: 相差的天数
"""
da = lambda x: time.strptime(str(x), '%Y-%m-%d %H:%M:%S')
if type == 'day':
day_num = (int(time.mktime(da(time2))) - int(time.mktime(da(time1)))) / (
24 * 60 * 60)
return abs(int(day_num))

@ -0,0 +1,123 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Date:2022/07/25 09:32:18
'''
from flask import jsonify, request
from flask import Blueprint
from common.read_excel import ReadExcel
from common.utils import Utils
from db_logic.client import BllClient
from db_logic.user import BllUser
from db_logic.medicament_template import BllMedicamentTemplate
from models.medicament_models import EntityMedicamentTemplate
tmp_router = Blueprint("drug_tmplate", __name__)
# 试剂入库-模板展示
@tmp_router.route("/show_tmp", methods=["GET", "POST"])
def show_template():
client_id = request.values.get("client_id")
data = BllMedicamentTemplate().getAllTemplateList(client_id=client_id)
data = Utils.msyql_table_model(data)
return jsonify(Utils.true_return(data=data))
# 选择药剂入库
# 编辑试剂信息
# # 编辑试剂模板
# @tmp_router.route("/update_tmp", methods=["GET", "POST"])
# def modify_tmp():
# tmp_id = request.values.get("template_id")
# 导入入库模板
@tmp_router.route("/put_in_tmp", methods=["GET", "POST"])
def import_tmplate():
try:
file_path = Utils.getUDiskPath()
if not file_path:
return jsonify(msg="请插入U盘")
else:
client_id = request.values.get("cliet_id", '')
template_name = request.values.get("template_name", '')
user_id = request.values.get("user_id")
read_excel = ReadExcel(file_path + "/" + template_name)
sql_all = """
select bar_code_count, start_bar_code from rms_medicament_template where start_bar_code=(select max(start_bar_code) max_start from rms_medicament_template)
"""
tmp_obj = BllMedicamentTemplate().execute(sql_all).fetchone()
if tmp_obj:
max_barcode = tmp_obj.start_bar_code
bar_code_count = tmp_obj.bar_code_count
max_barcode = int(max_barcode) + int(bar_code_count)
else:
max_barcode = 100001
start_bar_code = max_barcode
result_list = read_excel.read()
client_obj = BllClient().findEntity(client_id)
user_obj = BllUser().findEntity(user_id)
if result_list:
inster_obj_list = []
for value in result_list:
total_count = 0
template_content_list = eval(value)
for template_content in template_content_list:
total_count += int(template_content['export_cout'])
obj = EntityMedicamentTemplate(
customer_id=client_obj.customer_id,
client_id=client_obj.client_id,
client_name=client_obj.client_name,
template_name=f'入库模板_{Utils.getFileName()}',
template_content=value,
is_wait_export = 1,
start_bar_code=str(start_bar_code),
bar_code_count=total_count,
create_date=Utils.get_str_datetime(),
create_user_id=user_obj.user_id,
create_user_name=user_obj.real_name
)
inster_obj_list.append(obj)
status = BllMedicamentTemplate().insert_many(inster_obj_list)
if status:
return jsonify(Utils.true_return(msg='导入成功'))
else:
return jsonify(Utils.false_return(msg="入库单异常,导入失败"))
else:
return jsonify(Utils.false_return(msg="入库单格式不正确,请检查之后重新导入"))
except FileNotFoundError as e:
return jsonify(Utils.false_return(msg='当前U盘下暂无reagentTemplate.xlsx文件'))
except Exception as error:
return jsonify(Utils.false_return(msg=f"模板错误:{error}"))
# 删除模板
@tmp_router.route("/del_tmp", methods=["GET", "POST"])
def remove_tmp():
tmp_id = request.values.get("template_id")
if tmp_id:
BllMedicamentTemplate().delete(EntityMedicamentTemplate.template_id==tmp_id)
return Utils.true_return(msg='删除药剂模板成功')
return Utils.false_return(msg='删除药剂模板失败')

@ -46,6 +46,12 @@ class BllMedicament(Repository):
)
return self.queryPage(orm_query, pageParam)
# def get_drug_info_distinct_list(self, seach_word):
# sql_all = """
# sqlect * from
# """
# 药剂入库
def drugPutIn(self, entityDrug=EntityMedicament(), entityClient=EntityClient(), entityUser=EntityUser()):

@ -0,0 +1,86 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Date:2022/07/25 09:38:05
'''
import sys
sys.path.append(".")
from common.utils import Utils
from sqlalchemy import desc, Table
from db_logic.db_base import Repository
from models.medicament_models import EntityMedicamentTemplate
#药剂品种业务逻辑类
class BllMedicamentTemplate(Repository):
def __init__(self, entityType=EntityMedicamentTemplate):
return super().__init__(entityType)
# 获取所有模板列表
def getAllTemplateList(self, client_id):
sql_all = "select * from rms_medicament_template where is_wait_export=1 "
end_sql = "order by create_date desc"
if client_id:
sql_all = sql_all + f"and client_id='{client_id}'"
data = self.execute(sql_all+end_sql).fetchall()
return data
def inster_base_log(self, asss):
import random, json
li_ba = []
for i in range(1, 5):
obj = EntityMedicamentTemplate(
client_id="8db7e540-070f-11ed-a286-f47b094925e1",
client_name="测试机器",
template_name=f"测试模板{i}",
template_content=json.dumps(asss),
is_wait_export=1,
start_bar_code=random.randint(100001, 100111),
bar_code_count=len(asss),
create_date=Utils.get_str_datetime(),
create_user_id="c0858e96-d900-11eb-8209-009027e3906b",
create_user_name="admin",
)
li_ba.append(obj)
self.insert_many(li_ba)
def to_dict(c, data_list):
# li = []
# for i in self.__table__.columns:
# li.append(i.name)
data = []
key_list = [i for i in c.__table__.columns]
for i in data_list:
data.append(
dict(zip(key_list, i))
)
return data
if __name__ == '__main__':
# import json
# data = BllMedicamentTemplate().getAllTemplateList("")
# # data = Utils.resultAlchemyData(json.loads(data))
# # data =BllMedicamentTemplate().entityType.to_dict(data_list=data)
# print(data)
asss = [
{"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": ""}]
rsp = BllMedicamentTemplate().inster_base_log(asss)
print(rsp)

@ -130,11 +130,67 @@
# print(a)
def mysqlfinds_list(data, finds):
return [dict(zip(finds, i)) for i in data]
# 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": ""}]
fin = ["id", "name", "age"]
da = [(1, "a", 10), (2, "b", 11),(3, "c", 12)]
print(mysqlfinds_list(da, fin))
"""

@ -9,7 +9,7 @@ import sys
sys.path.append('.')
# from common.utils import Utils
from sqlalchemy import Column, String, Integer, Text, Float
from sqlalchemy import Column, String, Integer, Text, Float, inspect
from models.models_base import Base, get_uuid
# from sqlalchemy.ext.declarative import declarative_base
@ -104,10 +104,10 @@ class EntityMedicament(Base):
def to_dict(self):
li = []
for i in self.__table__.columns:
li.append(i.name)
return li
# li = []
# for i in self.__table__.columns:
# li.append(i.name)
return [i for i in c.__table__.columns]
# return {c.name: getattr(self, c.name) for c in self.__table__.columns}
@ -136,7 +136,9 @@ class EntityMedicamentTemplate(Base):
create_user_name = Column(String(50), comment="创建用户名")
is_add = Column(Integer, comment="", default=1)
@classmethod
def get_finds(cls):
return inspect(Base.metadata, cls.__tablename__.c.keys())
class EntityMedicamentRecord(Base):
__tablename__ = "rms_medicament_record"
__table_args__ = (

Binary file not shown.
Loading…
Cancel
Save