from fastapi import FastAPI, HTTPException, Depends from pydantic import BaseModel from datetime import datetime from sqlalchemy import create_engine, Column, Integer, String, DateTime, Boolean, Text from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class ReportManagement(Base): __tablename__ = "report_management" id = Column(Integer, primary_key=True, index=True, comment='主键ID') report_id = Column(String(255), unique=True, index=True, comment='填报ID') table_name = Column(String(255), comment='表格名称') data_table_name = Column(String(255), comment='数据表名称') start_time = Column(DateTime, comment='开始时间') end_time = Column(DateTime, comment='结束时间') status = Column(Integer, comment='表格状态:0在用 2废除') issued_status = Column(Integer, comment='下发状态:1待发布 2已发布') collection_status = Column(Integer, comment='收取状态:0待收取 2已收取') collection_time = Column(DateTime, comment='收取时间') period_type = Column(String(255), comment='周期类型') creator_name = Column(String(255), comment='创建人名称') creator_phone = Column(String(255), comment='创建人电话') creator_id = Column(String(255), comment='创建人ID') num_reporters = Column(Integer, comment='需填报人数') created_at = Column(DateTime, default=datetime.utcnow, comment='创建时间') updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, comment='修改时间') class FormSubmission(Base): __tablename__ = 'form_submissions' id = Column(Integer, primary_key=True, index=True, comment='主键ID') report_id = Column(String(255), comment='填报ID') user_id = Column(String(255),comment='用户ID') submission_status = Column(Integer,comment='填报结果')