12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- from sqlalchemy import Column, Integer, String, DateTime, Float, Boolean,Text
- from database import Base
- from datetime import datetime
- class EventBase(Base):
- __tablename__ = 'event_base'
- id = Column(Integer, autoincrement=True, primary_key=True)
- event_code = Column(String(50), nullable=False, comment='事件编号')
- event_title = Column(String(255), nullable=False, comment='事件标题')
- event_type = Column(String(100), nullable=False, comment='事件类型')
- event_level = Column(String(50), comment='事件等级')
- event_status = Column(String(50), default='active', comment='事件状态')
- event_time = Column(DateTime, comment='事发时间')
- report_time = Column(DateTime, default=datetime.now, comment='上报时间')
- deaths = Column(Integer, default=0, comment='死亡人数')
- injuries = Column(Integer, default=0, comment='受伤人数')
- missing = Column(Integer, default=0, comment='失联人数')
- event_source = Column(String(255), comment='事件来源')
- address = Column(String(255), comment='事发地点')
- longitude = Column(String(20), default='', comment='经度')
- latitude = Column(String(20), default='', comment='纬度')
- event_description = Column(Text, comment='事件概要')
- recorded_by = Column(Integer, nullable=False, comment='记录用户ID')
- del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
- contact = Column(String(50), comment='联系人')
- region_code = Column(String(50), comment='地区代码')
- plan_id = Column(Integer, comment='匹配预案ID')
- casualties = Column(String(1), default='0', comment='伤亡情况上报(0未上报 1已上报)')
- class Config:
- orm_mode = True
- class EventTracking(Base):
- __tablename__ = 'event_tracking'
- id = Column(Integer, autoincrement=True, primary_key=True)
- event_id = Column(Integer, nullable=False, comment='事件ID')
- event_status = Column(String(10), nullable=False, comment='事件状态')
- event_level = Column(String(10), nullable=False, comment='事件等级')
- tracking_time = Column(DateTime, default=datetime.now, comment='事件跟踪时间')
- notes = Column(String(50), default='', comment='备注')
- recorded_by = Column(Integer, nullable=False, comment='记录用户ID')
- del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
- class Config:
- orm_mode = True
- class EventFile(Base):
- __tablename__ = 'event_file'
- id = Column(Integer, autoincrement=True, primary_key=True)
- event_id = Column(Integer, nullable=False, comment='事件ID')
- file_name = Column(String(255), nullable=False, comment='文件名称')
- file_name_desc = Column(String(255), nullable=False, comment='文件名称原名')
- file_path = Column(String(255), nullable=False, comment='文件存储路径')
- file_size = Column(String(50), comment='文件大小')
- foreign_key = Column(String(50), comment='文件外键 --技术字段')
- from_scenario = Column(String(50), comment='对应标识 --技术字段')
- create_time = Column(DateTime, default=datetime.now, comment='数据创建时间')
- update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='数据更新时间')
- del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)') # 更新预案信息的时候 先将原有的进行备注删除
- class Config:
- orm_mode = True
|