From 48cede54275f807c430e0fd8f0777c2fe9c0a328 Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Mon, 27 May 2024 16:53:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E4=B8=BAwzxphoto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto_generator.py | 17 +++++++++-------- config/mysql.py | 2 +- photo_review/entity/zx_ie_cost.py | 6 +++--- photo_review/entity/zx_ie_cost_detail.py | 23 +++++++++++++++++++++++ photo_review/entity/zx_ie_discharge.py | 7 ++++--- photo_review/entity/zx_ie_settlement.py | 6 +++--- 6 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 photo_review/entity/zx_ie_cost_detail.py diff --git a/auto_generator.py b/auto_generator.py index d9a3dd4..ffcec1d 100644 --- a/auto_generator.py +++ b/auto_generator.py @@ -3,12 +3,13 @@ import subprocess from config.mysql import DB_URL -table = input("请输入表名:") -out_file = f"photo_review/entity/{table}.py" -command = f"sqlacodegen {DB_URL} --outfile={out_file} --tables={table}" +if __name__ == '__main__': + table = input("请输入表名:") + out_file = f"photo_review/entity/{table}.py" + command = f"sqlacodegen {DB_URL} --outfile={out_file} --tables={table}" -try: - subprocess.run(command, shell=True, check=True) - print(f"{table}.py文件生成成功!请手动调整Base的声明!") -except Exception as e: - print(f"生成{table}.py文件时发生错误: {e}") + try: + subprocess.run(command, shell=True, check=True) + print(f"{table}.py文件生成成功!请手动调整Base的声明!") + except Exception as e: + print(f"生成{table}.py文件时发生错误: {e}") diff --git a/config/mysql.py b/config/mysql.py index 93d3826..69931fe 100644 --- a/config/mysql.py +++ b/config/mysql.py @@ -7,7 +7,7 @@ HOSTNAME = '192.168.5.226' # 端口号 PORT = '3308' # 库名 -DATABASE = 'wzxtest' +DATABASE = 'wzxphoto' # 用户名 USERNAME = 'root' # 密码 diff --git a/photo_review/entity/zx_ie_cost.py b/photo_review/entity/zx_ie_cost.py index b67b593..3b994ad 100644 --- a/photo_review/entity/zx_ie_cost.py +++ b/photo_review/entity/zx_ie_cost.py @@ -17,7 +17,7 @@ class ZxIeCost(Base): discharge_date = Column(Date, comment='出院日期') medical_expenses_str = Column(String(255), comment='费用总额字符串') medical_expenses = Column(DECIMAL(18, 2), comment='费用总额') - createtime = Column(DateTime, comment='创建时间') + create_time = Column(DateTime, comment='创建时间') creator = Column(String(255), comment='创建人') - modifiedtime = Column(DateTime, comment='修改时间') - modifier = Column(String(255), comment='修改人') + update_time = Column(DateTime, comment='修改时间') + updater = Column(String(255), comment='修改人') diff --git a/photo_review/entity/zx_ie_cost_detail.py b/photo_review/entity/zx_ie_cost_detail.py new file mode 100644 index 0000000..ea72fdc --- /dev/null +++ b/photo_review/entity/zx_ie_cost_detail.py @@ -0,0 +1,23 @@ +# coding: utf-8 +from sqlalchemy import Column, DECIMAL, DateTime, String +from sqlalchemy.dialects.mysql import INTEGER + +from config.mysql import Base + + +class ZxIeCostDetail(Base): + __tablename__ = 'zx_ie_cost_detail' + + pk_ie_cost_detail = Column(INTEGER(11), primary_key=True, comment='费用明细详情主键') + pk_ie_cost = Column(INTEGER(11), nullable=False, comment='费用明细信息抽取主键') + pk_phhd = Column(INTEGER(11), nullable=False, comment='报销案子主键') + _class = Column('class', String(255), comment='类别') + name = Column(String(255), comment='名称') + specification = Column(String(255), comment='规格') + price = Column(DECIMAL(18, 2), comment='单价') + quantity = Column(INTEGER(11), comment='数量') + amount = Column(DECIMAL(18, 2), comment='金额(单价 * 数量)') + create_time = Column(DateTime, comment='创建时间') + creator = Column(String(30), comment='创建人') + update_time = Column(DateTime, comment='修改时间') + updater = Column(String(30), comment='修改人') diff --git a/photo_review/entity/zx_ie_discharge.py b/photo_review/entity/zx_ie_discharge.py index 6196f2f..464066d 100644 --- a/photo_review/entity/zx_ie_discharge.py +++ b/photo_review/entity/zx_ie_discharge.py @@ -10,6 +10,7 @@ class ZxIeDischarge(Base): pk_ie_discharge = Column(INTEGER(11), primary_key=True, comment='出院记录信息抽取主键') pk_phhd = Column(INTEGER(11), nullable=False, unique=True, comment='报销案子主键') + content = Column(String(5000), comment='详细内容') hospital = Column(String(255), comment='医院') pk_yljg = Column(INTEGER(11), comment='医院主键') department = Column(String(255), comment='科别') @@ -20,7 +21,7 @@ class ZxIeDischarge(Base): discharge_date_str = Column(String(255), comment='出院日期字符串') discharge_date = Column(Date, comment='出院日期') doctor = Column(String(30), comment='主治医师') - createtime = Column(DateTime, comment='创建时间') + create_time = Column(DateTime, comment='创建时间') creator = Column(String(255), comment='创建人') - modifiedtime = Column(DateTime, comment='修改时间') - modifier = Column(String(255), comment='修改人') + update_time = Column(DateTime, comment='修改时间') + updater = Column(String(255), comment='修改人') diff --git a/photo_review/entity/zx_ie_settlement.py b/photo_review/entity/zx_ie_settlement.py index ecfc56b..c0d2c9a 100644 --- a/photo_review/entity/zx_ie_settlement.py +++ b/photo_review/entity/zx_ie_settlement.py @@ -24,7 +24,7 @@ class ZxIeSettlement(Base): personal_funded_amount_str = Column(String(255), comment='自费金额字符串') personal_funded_amount = Column(DECIMAL(18, 2), comment='自费金额') medical_insurance_type = Column(String(255), comment='医保类型') - createtime = Column(DateTime, comment='创建时间') + create_time = Column(DateTime, comment='创建时间') creator = Column(String(255), comment='创建人') - modifiedtime = Column(DateTime, comment='修改时间') - modifier = Column(String(255), comment='修改人') + update_time = Column(DateTime, comment='修改时间') + updater = Column(String(255), comment='修改人')