From 4137c545886c214b45c7b48b55ba77b1d5c2abf6 Mon Sep 17 00:00:00 2001 From: zlwu <704541015@qq.com> Date: Wed, 20 May 2026 06:27:40 +0800 Subject: [PATCH] feat(qc): add SQLAlchemy models for QC material and usage --- backend/app/models/models.py | 98 +++++++++++++++++++++++++++++++ backend/app/models/qc_material.py | 50 ++++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 backend/app/models/qc_material.py diff --git a/backend/app/models/models.py b/backend/app/models/models.py index e9f96663..34e08e00 100644 --- a/backend/app/models/models.py +++ b/backend/app/models/models.py @@ -2371,4 +2371,102 @@ class BizProductionTaskOutput(Base): del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记") +class BizProtocolFullmoonTodo(Base): + """新生儿满月待办 biz_protocol_fullmoon_todo""" + + __tablename__ = "biz_protocol_fullmoon_todo" + + id = Column(String(64), primary_key=True, comment="主键ID") + collection_protocol_id = Column(String(64), nullable=False, comment="采集协议单ID") + todo_status = Column(CHAR(1), nullable=False, default="0", comment="1已办报销 0未办保险") + handle_date = Column(CHAR(8), nullable=True, comment="办理日期") + handle_remark = Column(String(512), nullable=True, comment="办理备注") + insurance_attachments = Column(String(4000), nullable=True, comment="保险附件逗号分隔") + insurance_company_id = Column(String(64), nullable=True, comment="保险公司ID") + insurance_company_name = Column(String(200), nullable=True, comment="保险公司名称") + insurance_type = Column(String(200), nullable=True, comment="保险险种") + insurance_policy_no = Column(String(100), nullable=True, comment="保险单号") + insurance_effective_date = Column(CHAR(8), nullable=True, comment="保险单生效时间YYYYMMDD") + insurance_expiry_date = Column(CHAR(8), nullable=True, comment="保险单失效时间YYYYMMDD") + insurance_subscribed = Column(CHAR(1), nullable=True, default="0", comment="是否已订购保险") + insurance_fee = Column(Numeric(18, 2), nullable=True, comment="保单费用(元)") + tenant_no = Column(String(64), nullable=False, default="zkxw", comment="租户编号") + order_num = Column(Integer, nullable=True, comment="排序号") + remark = Column(String(512), nullable=True, comment="备注") + create_by = Column(String(64), nullable=True, comment="创建人id") + create_dept_id = Column(String(64), nullable=False, default="", comment="创建人部门ID") + create_time = Column(DateTime, nullable=False, default=datetime.now, comment="创建时间") + update_by = Column(String(64), nullable=True, comment="更新人id") + update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间") + del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记") + + +class BizInsuranceCompany(Base): + """保险公司 biz_insurance_company""" + + __tablename__ = "biz_insurance_company" + + id = Column(String(64), primary_key=True, comment="主键ID") + company_name = Column(String(200), nullable=False, comment="保险公司名称") + company_address = Column(String(512), nullable=True, comment="公司地址") + contact_name = Column(String(100), nullable=True, comment="联系人") + contact_phone = Column(String(32), nullable=True, comment="联系电话") + status = Column(CHAR(1), nullable=False, default="1", comment="1正常 0停用") + tenant_no = Column(String(64), nullable=False, default="zkxw", comment="租户编号") + order_num = Column(Integer, nullable=True, comment="排序号") + remark = Column(String(512), nullable=True, comment="备注") + create_by = Column(String(64), nullable=True, comment="创建人id") + create_dept_id = Column(String(64), nullable=False, default="", comment="创建人部门ID") + create_time = Column(DateTime, nullable=False, default=datetime.now, comment="创建时间") + update_by = Column(String(64), nullable=True, comment="更新人id") + update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间") + del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记") + + +class BizInsuranceCompanyInvoice(Base): + """保险公司开票信息 biz_insurance_company_invoice""" + + __tablename__ = "biz_insurance_company_invoice" + + id = Column(String(64), primary_key=True, comment="主键ID") + insurance_company_id = Column(String(64), nullable=False, comment="保险公司ID") + company_name = Column(String(200), nullable=False, comment="单位名称") + tax_no = Column(String(64), nullable=True, comment="税号") + company_address = Column(String(512), nullable=True, comment="单位地址") + company_phone = Column(String(64), nullable=True, comment="电话") + bank_name = Column(String(200), nullable=True, comment="开户银行") + bank_account = Column(String(64), nullable=True, comment="银行账号") + tenant_no = Column(String(64), nullable=False, default="zkxw", comment="租户编号") + order_num = Column(Integer, nullable=True, comment="排序号") + remark = Column(String(512), nullable=True, comment="备注") + create_by = Column(String(64), nullable=True, comment="创建人id") + create_dept_id = Column(String(64), nullable=False, default="", comment="创建人部门ID") + create_time = Column(DateTime, nullable=False, default=datetime.now, comment="创建时间") + update_by = Column(String(64), nullable=True, comment="更新人id") + update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间") + del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记") + + +class BizInsuranceProjectPrice(Base): + """保险项目价格 biz_insurance_project_price""" + + __tablename__ = "biz_insurance_project_price" + + id = Column(String(64), primary_key=True, comment="主键ID") + insurance_company_id = Column(String(64), nullable=False, comment="保险公司ID") + project_name = Column(String(200), nullable=False, comment="项目名称") + project_fee = Column(Numeric(18, 2), nullable=True, comment="项目费用(元)") + status = Column(CHAR(1), nullable=False, default="1", comment="1正常 0停用") + tenant_no = Column(String(64), nullable=False, default="zkxw", comment="租户编号") + order_num = Column(Integer, nullable=True, comment="排序号") + remark = Column(String(512), nullable=True, comment="备注") + create_by = Column(String(64), nullable=True, comment="创建人id") + create_dept_id = Column(String(64), nullable=False, default="", comment="创建人部门ID") + create_time = Column(DateTime, nullable=False, default=datetime.now, comment="创建时间") + update_by = Column(String(64), nullable=True, comment="更新人id") + update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间") + del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记") + + from app.models.qc_param import BizQcItemParam, BizQcTaskResult # noqa: E402,F401 +from app.models.qc_material import BizQcMaterial, BizQcMaterialUsage # noqa: E402,F401 diff --git a/backend/app/models/qc_material.py b/backend/app/models/qc_material.py new file mode 100644 index 00000000..32d6f545 --- /dev/null +++ b/backend/app/models/qc_material.py @@ -0,0 +1,50 @@ +from datetime import datetime + +from sqlalchemy import Column, DateTime, Integer, Numeric, SmallInteger, String + +from app.core.database import Base + + +class BizQcMaterial(Base): + __tablename__ = "biz_qc_material" + + id = Column(String(64), primary_key=True, comment="主键ID") + material_code = Column(String(64), nullable=False, comment="物料编码") + material_name = Column(String(200), nullable=False, comment="物料名称") + spec_model = Column(String(200), nullable=True, comment="规格型号") + unit = Column(String(32), nullable=True, comment="单位") + stock_qty = Column(Numeric(18, 4), nullable=False, default=0, comment="当前库存量") + warning_qty = Column(Numeric(18, 4), nullable=False, default=0, comment="预警库存量") + status = Column(String(1), nullable=False, default="1", comment="1-启用 0-停用") + tenant_no = Column(String(64), nullable=False, default="zkxw", comment="租户编号") + order_num = Column(Integer, nullable=True, comment="排序号") + remark = Column(String(512), nullable=True, comment="备注") + create_by = Column(String(64), nullable=True, comment="创建人id") + create_dept_id = Column(String(64), nullable=False, default="", comment="创建人部门ID") + create_time = Column(DateTime, nullable=False, default=datetime.now, comment="创建时间") + update_by = Column(String(64), nullable=True, comment="更新人id") + update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间") + del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记") + + +class BizQcMaterialUsage(Base): + __tablename__ = "biz_qc_material_usage" + + id = Column(String(64), primary_key=True, comment="主键ID") + material_id = Column(String(64), nullable=False, comment="物料ID") + material_code = Column(String(64), nullable=True, comment="物料编码快照") + material_name = Column(String(200), nullable=True, comment="物料名称快照") + change_type = Column(String(16), nullable=False, comment="变动类型:use使用 / in入库") + change_qty = Column(Numeric(18, 4), nullable=False, comment="变动数量") + stock_after = Column(Numeric(18, 4), nullable=False, comment="变动后库存量") + qc_task_id = Column(String(64), nullable=True, comment="关联质检任务ID") + qc_task_no = Column(String(32), nullable=True, comment="质检任务号快照") + source_type = Column(String(16), nullable=False, comment="来源类型:task_complete / manual_in") + tenant_no = Column(String(64), nullable=False, default="zkxw", comment="租户编号") + remark = Column(String(512), nullable=True, comment="备注") + create_by = Column(String(64), nullable=True, comment="创建人id") + create_dept_id = Column(String(64), nullable=False, default="", comment="创建人部门ID") + create_time = Column(DateTime, nullable=False, default=datetime.now, comment="创建时间") + update_by = Column(String(64), nullable=True, comment="更新人id") + update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间") + del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记")