duty_base.py 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. # -*- coding: utf-8 -*-
  2. from sqlalchemy import String, Column, Integer,DateTime,Text,BigInteger,Boolean,PrimaryKeyConstraint,Index,UniqueConstraint,CHAR,LargeBinary,TIMESTAMP
  3. from sqlalchemy.dialects.mysql import TINYINT
  4. from sqlalchemy.sql import func
  5. from database import Base
  6. from datetime import datetime
  7. class DutyShift(Base):
  8. """
  9. 值班日历
  10. """
  11. __tablename__ = 'duty_shift'
  12. shift_id = Column(Integer, primary_key=True, autoincrement=True, comment='ID')
  13. shift_date = Column(DateTime, nullable=False, comment="班次日期")
  14. start_time = Column(DateTime, nullable=False, comment="开始时间")
  15. end_time = Column(DateTime, nullable=False, comment="结束时间")
  16. leader_id = Column(Integer, nullable=False, comment="领导ID")
  17. primary_staff_id = Column(Integer, nullable=False, comment="主班人员ID")
  18. secondary_staff_id = Column(Integer, nullable=False, comment="副班人员ID")
  19. standby_staff_id = Column(Integer, nullable=False, comment="备班人员ID")
  20. duty_type = Column(String, default='', server_default='', comment="值班类型")
  21. shift_status = Column(Integer, default='0', server_default='0', comment="值班状态 0 默认 1已交班 2已接班")
  22. handover_user_id = Column(Integer, comment="交班人员ID")
  23. handover_time = Column(DateTime, comment="交班时间")
  24. dept_id = Column(Integer, nullable=False, comment="部门ID")
  25. area_code = Column(String, default='', server_default='', comment="行政区划代码")
  26. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  27. book_id = Column(Integer, default='0', server_default='0', comment="导入值班表ID")
  28. onduty_user = Column(String, default='', server_default='', comment='值班人员')
  29. onduty_leader = Column(String, default='', server_default='', comment='带班领导')
  30. takeover_user_id = Column(Integer, comment="接班人员ID")
  31. takeover_time = Column(DateTime, comment="接班时间")
  32. class Config:
  33. orm_mode = True
  34. class DutyNotify(Base):
  35. """
  36. 值班事项提醒
  37. """
  38. __tablename__ = 'duty_notify'
  39. id = Column(Integer, primary_key=True, autoincrement=True, comment='ID')
  40. shift_id = Column(Integer, default='0', server_default='0', comment="班次ID")
  41. notify_content = Column(String, default='', server_default='', comment="提示内容")
  42. notify_type = Column(String, default='0', server_default='0', comment="1 待办事项 2 提醒事项")
  43. create_time = Column(DateTime, default=datetime.now, comment='数据创建时间')
  44. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  45. recorded_by = Column(Integer, default=0, server_default='0', comment='记录用户ID')
  46. class Config:
  47. orm_mode = True
  48. class DutyBook(Base):
  49. """
  50. 值班表
  51. """
  52. __tablename__ = 'duty_book'
  53. id = Column(Integer, primary_key=True, autoincrement=True, comment='ID')
  54. year = Column(String, default='', server_default='', comment="年份")
  55. month = Column(String, default='', server_default='', comment="月份")
  56. area_code = Column(String, default='0', server_default='0', comment="区划代码")
  57. create_time = Column(DateTime, default=datetime.now, comment='数据创建时间')
  58. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  59. recorded_by = Column(Integer, default=0, server_default='0', comment='记录用户ID')
  60. class DutyFile(Base):
  61. __tablename__ = 'duty_file'
  62. id = Column(Integer, autoincrement=True, primary_key=True)
  63. file_name = Column(String(255), nullable=False, comment='文件名称')
  64. storage_file_name = Column(String(255), nullable=False, comment='文件名称原名')
  65. file_path = Column(String(255), comment='文件存储路径')
  66. file_size = Column(String(50), comment='文件大小')
  67. status = Column(String(50), comment='文件状态')
  68. foreign_key = Column(String(50), comment='文件外键 --技术字段')
  69. from_scenario = Column(String(50), comment='对应标识 --技术字段')
  70. create_time = Column(DateTime, default=datetime.now, comment='数据创建时间')
  71. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='数据更新时间')
  72. create_dept = Column(Integer, default=None, comment='创建部门')
  73. create_by = Column(Integer, default=None, comment='创建者')
  74. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  75. class Config:
  76. orm_mode = True
  77. class EmergencyContactDepartment(Base):
  78. __tablename__ = 'tp_emergency_contact_department'
  79. id = Column(Integer, primary_key=True, autoincrement=True, comment='主键')
  80. parent_department_id = Column(Integer, comment='父部门id')
  81. department_name = Column(String(255), nullable=False, comment='部门名称')
  82. regionPath = Column(Text, comment='部门路径')
  83. yzy_unitid = Column(String(100), comment='粤政易机构节点 ID')
  84. yzy_regionPath = Column(Text, comment='粤政易部门路径')
  85. display_order = Column(Integer, comment='显示排序')
  86. del_flag = Column(CHAR(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  87. create_by = Column(BigInteger, default=None, comment='创建者')
  88. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  89. update_by = Column(BigInteger, default=None, comment='更新者')
  90. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  91. area_code = Column(String, default='', server_default='', comment="行政区划代码")
  92. class Config:
  93. orm_mode = True
  94. class EmergencyContactUser(Base):
  95. __tablename__ = 'tp_emergency_contact_user'
  96. id = Column(Integer, primary_key=True, autoincrement=True, comment='主键')
  97. name = Column(String(255), nullable=False, comment='姓名')
  98. position = Column(String(255), comment='职务')
  99. mobile_phone = Column(String(20), comment='手机号')
  100. office_phone = Column(String(20), comment='办公电话')
  101. department_id = Column(Integer, comment='所属部门')
  102. display_order = Column(Integer, comment='显示排序')
  103. yzy_unitid = Column(String(100), comment='粤政易机构节点 ID')
  104. userid = Column(String(32), comment='粤政易用户 ID')
  105. del_flag = Column(CHAR(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  106. create_by = Column(BigInteger, default=None, comment='创建者')
  107. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  108. update_by = Column(BigInteger, default=None, comment='更新者')
  109. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  110. class Config:
  111. orm_mode = True
  112. class DutyPosition(Base):
  113. __tablename__ = 'tp_duty_position'
  114. id = Column(Integer, primary_key=True, autoincrement=True, comment='主键')
  115. sort_number = Column(Integer, comment='排序编号')
  116. position_name = Column(String(255), nullable=False, comment='岗位名称')
  117. type = Column(String(100), comment='类型')
  118. del_flag = Column(CHAR(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  119. create_by = Column(BigInteger, default=None, comment='创建者')
  120. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  121. update_by = Column(BigInteger, default=None, comment='更新者')
  122. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  123. class Config:
  124. orm_mode = True
  125. class DutySchedule(Base):
  126. __tablename__ = 'tp_duty_schedule'
  127. id = Column(Integer, primary_key=True, autoincrement=True, comment='主键')
  128. start_time = Column(DateTime, nullable=False, comment='开始时间')
  129. end_time = Column(DateTime, nullable=False, comment='结束时间')
  130. duty_date = Column(DateTime, nullable=False, comment='值班日期')
  131. shift_type = Column(String(50), nullable=False, comment='班次类型(白班、夜班、全日)')
  132. duty_unit = Column(Integer, nullable=False, comment='值班单位')
  133. duty_type = Column(String(50), nullable=False, comment='值班类型(值班排班、自定义排班)')
  134. del_flag = Column(CHAR(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  135. create_by = Column(BigInteger, default=None, comment='创建者')
  136. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  137. update_by = Column(BigInteger, default=None, comment='更新者')
  138. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  139. class Config:
  140. orm_mode = True
  141. class DutyPersonnelArrangement(Base):
  142. __tablename__ = 'tp_duty_personnel_arrangement'
  143. id = Column(Integer, primary_key=True, autoincrement=True, comment='主键')
  144. duty_id = Column(Integer, nullable=False, comment='值班id')
  145. position_id = Column(Integer, nullable=False, comment='岗位id')
  146. personnel_id = Column(Integer, nullable=False, comment='人员id')
  147. del_flag = Column(CHAR(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  148. create_by = Column(BigInteger, default=None, comment='创建者')
  149. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  150. update_by = Column(BigInteger, default=None, comment='更新者')
  151. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  152. class Config:
  153. orm_mode = True