# -*- coding: utf-8 -*- from sqlalchemy import String, Column, Integer,DateTime,Text,BigInteger,Boolean,PrimaryKeyConstraint,Index,UniqueConstraint,CHAR,LargeBinary,TIMESTAMP from sqlalchemy.dialects.mysql import TINYINT from sqlalchemy.sql import func from database import Base from datetime import datetime class DutyShift(Base): """ 值班日历 """ __tablename__ = 'duty_shift' shift_id = Column(Integer, primary_key=True, autoincrement=True, comment='ID') shift_date = Column(DateTime, nullable=False, comment="班次日期") start_time = Column(DateTime, nullable=False, comment="开始时间") end_time = Column(DateTime, nullable=False, comment="结束时间") leader_id = Column(Integer, nullable=False, comment="领导ID") primary_staff_id = Column(Integer, nullable=False, comment="主班人员ID") secondary_staff_id = Column(Integer, nullable=False, comment="副班人员ID") standby_staff_id = Column(Integer, nullable=False, comment="备班人员ID") duty_type = Column(String, default='', server_default='', comment="值班类型") shift_status = Column(Integer, default='0', server_default='0', comment="值班状态 0 默认 1已交班") handover_user_id = Column(Integer, comment="交班人员ID") handover_time = Column(DateTime, comment="交班时间") dept_id = Column(Integer, nullable=False, comment="部门ID") area_code = Column(String, default='', server_default='', comment="行政区划代码") del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)') book_id = Column(Integer, default='0', server_default='0', comment="导入值班表ID") onduty_user = Column(String, default='', server_default='', comment='值班人员') onduty_leader = Column(String, default='', server_default='', comment='带班领导') class Config: orm_mode = True class DutyNotify(Base): """ 值班事项提醒 """ __tablename__ = 'duty_notify' id = Column(Integer, primary_key=True, autoincrement=True, comment='ID') shift_id = Column(Integer, default='0', server_default='0', comment="班次ID") notify_content = Column(String, default='', server_default='', comment="提示内容") notify_type = Column(String, default='0', server_default='0', comment="1 待办事项 2 提醒事项") create_time = Column(DateTime, default=datetime.now, comment='数据创建时间') del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)') recorded_by = Column(Integer, default=0, server_default='0', comment='记录用户ID') class Config: orm_mode = True class DutyBook(Base): """ 值班表 """ __tablename__ = 'duty_book' id = Column(Integer, primary_key=True, autoincrement=True, comment='ID') year = Column(String, default='', server_default='', comment="年份") month = Column(String, default='', server_default='', comment="月份") area_code = Column(String, default='0', server_default='0', comment="区划代码") create_time = Column(DateTime, default=datetime.now, comment='数据创建时间') del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)') recorded_by = Column(Integer, default=0, server_default='0', comment='记录用户ID') class DutyFile(Base): __tablename__ = 'duty_file' id = Column(Integer, autoincrement=True, primary_key=True) file_name = Column(String(255), nullable=False, comment='文件名称') storage_file_name = Column(String(255), nullable=False, comment='文件名称原名') file_path = Column(String(255), comment='文件存储路径') file_size = Column(String(50), comment='文件大小') status = 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='数据更新时间') create_dept = Column(Integer, default=None, comment='创建部门') create_by = Column(Integer, default=None, comment='创建者') del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)') class Config: orm_mode = True class EmergencyContactDepartment(Base): __tablename__ = 'tp_emergency_contact_department' id = Column(Integer, primary_key=True, autoincrement=True, comment='主键') parent_department_id = Column(Integer, comment='父部门id') department_name = Column(String(255), nullable=False, comment='部门名称') regionPath = Column(Text, comment='部门路径') yzy_unitid = Column(String(100), comment='粤政易机构节点 ID') yzy_regionPath = Column(Text, comment='粤政易部门路径') display_order = Column(Integer, comment='显示排序') del_flag = Column(CHAR(1), default='0', comment='删除标志(0代表存在 2代表删除)') create_by = Column(BigInteger, default=None, comment='创建者') create_time = Column(DateTime, default=datetime.now, comment='创建时间') update_by = Column(BigInteger, default=None, comment='更新者') update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间') class EmergencyContactUser(Base): __tablename__ = 'tp_emergency_contact_user' id = Column(Integer, primary_key=True, autoincrement=True, comment='主键') name = Column(String(255), nullable=False, comment='姓名') position = Column(String(255), comment='职务') mobile_phone = Column(String(20), comment='手机号') office_phone = Column(String(20), comment='办公电话') department_id = Column(Integer, comment='所属部门') display_order = Column(Integer, comment='显示排序') yzy_unitid = Column(String(100), comment='粤政易机构节点 ID') userid = Column(String(32), comment='粤政易用户 ID') del_flag = Column(CHAR(1), default='0', comment='删除标志(0代表存在 2代表删除)') create_by = Column(BigInteger, default=None, comment='创建者') create_time = Column(DateTime, default=datetime.now, comment='创建时间') update_by = Column(BigInteger, default=None, comment='更新者') update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间') class DutyPosition(Base): __tablename__ = 'tp_duty_position' id = Column(Integer, primary_key=True, autoincrement=True, comment='主键') sort_number = Column(Integer, comment='排序编号') position_name = Column(String(255), nullable=False, comment='岗位名称') type = Column(String(100), comment='类型') del_flag = Column(CHAR(1), default='0', comment='删除标志(0代表存在 2代表删除)') create_by = Column(BigInteger, default=None, comment='创建者') create_time = Column(DateTime, default=datetime.now, comment='创建时间') update_by = Column(BigInteger, default=None, comment='更新者') update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间') class DutySchedule(Base): __tablename__ = 'tp_duty_schedule' id = Column(Integer, primary_key=True, autoincrement=True, comment='主键') start_time = Column(DateTime, nullable=False, comment='开始时间') end_time = Column(DateTime, nullable=False, comment='结束时间') duty_date = Column(DateTime, nullable=False, comment='值班日期') shift_type = Column(String(50), nullable=False, comment='班次类型(白班、夜班、全日)') duty_unit = Column(Integer, nullable=False, comment='值班单位') duty_type = Column(String(50), nullable=False, comment='值班类型(值班排班、自定义排班)') del_flag = Column(CHAR(1), default='0', comment='删除标志(0代表存在 2代表删除)') create_by = Column(BigInteger, default=None, comment='创建者') create_time = Column(DateTime, default=datetime.now, comment='创建时间') update_by = Column(BigInteger, default=None, comment='更新者') update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间') class DutyPersonnelArrangement(Base): __tablename__ = 'tp_duty_personnel_arrangement' id = Column(Integer, primary_key=True, autoincrement=True, comment='主键') duty_id = Column(Integer, nullable=False, comment='值班id') position_id = Column(Integer, nullable=False, comment='岗位id') personnel_id = Column(Integer, nullable=False, comment='人员id') del_flag = Column(CHAR(1), default='0', comment='删除标志(0代表存在 2代表删除)') create_by = Column(BigInteger, default=None, comment='创建者') create_time = Column(DateTime, default=datetime.now, comment='创建时间') update_by = Column(BigInteger, default=None, comment='更新者') update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')