datafilling_base.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536
  1. from fastapi import FastAPI, HTTPException, Depends
  2. from pydantic import BaseModel
  3. from datetime import datetime
  4. from sqlalchemy import create_engine, Column, Integer, String, DateTime, Boolean, Text
  5. from sqlalchemy.ext.declarative import declarative_base
  6. Base = declarative_base()
  7. class ReportManagement(Base):
  8. __tablename__ = "report_management"
  9. id = Column(Integer, primary_key=True, index=True, comment='主键ID')
  10. report_id = Column(String(255), unique=True, index=True, comment='填报ID')
  11. table_name = Column(String(255), comment='表格名称')
  12. data_table_name = Column(String(255), comment='数据表名称')
  13. start_time = Column(DateTime, comment='开始时间')
  14. end_time = Column(DateTime, comment='结束时间')
  15. status = Column(Integer, comment='表格状态:0在用 2废除')
  16. issued_status = Column(Integer, comment='下发状态:1待发布 2已发布')
  17. collection_status = Column(Integer, comment='收取状态:0待收取 2已收取')
  18. collection_time = Column(DateTime, comment='收取时间')
  19. period_type = Column(String(255), comment='周期类型')
  20. creator_name = Column(String(255), comment='创建人名称')
  21. creator_phone = Column(String(255), comment='创建人电话')
  22. creator_id = Column(String(255), comment='创建人ID')
  23. num_reporters = Column(Integer, comment='需填报人数')
  24. created_at = Column(DateTime, default=datetime.utcnow, comment='创建时间')
  25. updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, comment='修改时间')
  26. class FormSubmission(Base):
  27. __tablename__ = 'form_submissions'
  28. id = Column(Integer, primary_key=True, index=True, comment='主键ID')
  29. report_id = Column(String(255), comment='填报ID')
  30. user_id = Column(String(255),comment='用户ID')
  31. submission_status = Column(Integer,comment='填报结果')