risk_management.py 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. from sqlalchemy import create_engine, Column, BigInteger, String, Text, DateTime, CHAR,Integer,Float
  2. from database import Base
  3. from datetime import datetime
  4. class RiskManagementInspectionUser(Base):
  5. __tablename__ = 'risk_management_inspection_user'
  6. id = Column(BigInteger, primary_key=True, autoincrement=True, comment='ID')
  7. user_id = Column(BigInteger, nullable=False, comment='用户ID')
  8. dept_id = Column(BigInteger, nullable=True, comment='部门ID')
  9. dept_name = Column(String(30), nullable=True, comment='部门名称')
  10. ancestors_names = Column(Text, nullable=True, comment='部门路径')
  11. user_name = Column(String(30), nullable=False, comment='用户账号')
  12. nick_name = Column(String(30), nullable=False, comment='用户昵称')
  13. phonenumber = Column(String(11), default='', comment='手机号码')
  14. area_code = Column(String(11), default='', comment='责任区划编码')
  15. area = Column(String(11), default='', comment='责任区划')
  16. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  17. create_dept = Column(BigInteger, default=None, comment='创建部门')
  18. create_by = Column(BigInteger, default=None, comment='创建者')
  19. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  20. update_by = Column(BigInteger, default=None, comment='更新者')
  21. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  22. remark = Column(String(500), default=None, comment='备注')
  23. yzy_account = Column(String(50), default=None, comment='粤政易账号')
  24. class GovdataArea(Base):
  25. __tablename__ = 'govdata_area'
  26. id = Column(Integer, primary_key=True, comment='ID')
  27. area_code = Column(String(20), nullable=True, comment='区划编码')
  28. area_name = Column(String(50), nullable=True, comment='区划名称')
  29. parent_code = Column(String(20), nullable=True, comment='父级区划编码')
  30. parent_id = Column(Integer, nullable=True, comment='父级ID')
  31. status = Column(String(2), nullable=True, comment='状态')
  32. create_time = Column(String(255), nullable=True, comment='创建时间')
  33. class RiskManagementInspectionTask(Base):
  34. __tablename__ = 'risk_management_inspection_task'
  35. id = Column(BigInteger, primary_key=True, autoincrement=True, comment='ID')
  36. task_number = Column(String(50), comment='任务编号')
  37. inspection_business = Column(String(255), nullable=True, comment='巡查业务,城市隐患巡查、森林防火巡查、重点危化企业巡查、重点水库水位巡查')
  38. start_time = Column(DateTime, nullable=True, comment='巡查开始时间')
  39. end_time = Column(DateTime, nullable=True, comment='巡查结束时间')
  40. inspection_cycle = Column(String(50), nullable=True, comment='巡查周期,每年、每月、每周、每日、一次')
  41. corn_expression = Column(String(100), nullable=True, comment='corn表达式')
  42. inspection_range = Column(String(50), nullable=True, comment='巡查范围,市级、区县级、镇街级、村居级')
  43. task_status = Column(String(20), nullable=True, comment='任务状态,未开始、进行中、未完成、已完结')
  44. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  45. create_dept = Column(BigInteger, default=None, comment='创建部门')
  46. create_by = Column(BigInteger, default=None, comment='创建者')
  47. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  48. update_by = Column(BigInteger, default=None, comment='更新者')
  49. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  50. remark = Column(String(500), default=None, comment='备注')
  51. class RiskManagementInspectionTaskChildrenTask(Base):
  52. __tablename__ = 'risk_management_inspection_task_children_task'
  53. id = Column(String(50), primary_key=True, comment='ID,uuid')
  54. task_id = Column(BigInteger, nullable=False, comment='ID,任务基础表id')
  55. task_number = Column(String(50), nullable=True, comment='任务编号')
  56. type = Column(String(255), nullable=True, comment='巡查业务,城市隐患巡查、森林防火巡查、重点危化企业巡查、重点水库水位巡查')
  57. tsak_time = Column(DateTime, nullable=True, comment='要求巡查时间')
  58. cycle = Column(String(50), nullable=True, comment='巡查周期,每年、每月、每周、每日、一次')
  59. task_range = Column(String(50), nullable=True, comment='巡查范围,市级、区县级、镇街级、村居级')
  60. task_num = Column(Integer, nullable=False, comment='任务数')
  61. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  62. create_dept = Column(BigInteger, default=None, comment='创建部门')
  63. create_by = Column(BigInteger, default=None, comment='创建者')
  64. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  65. update_by = Column(BigInteger, default=None, comment='更新者')
  66. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  67. remark = Column(String(500), default=None, comment='备注')
  68. class RiskManagementInspectionTaskChildrenTaskLog(Base):
  69. __tablename__ = 'risk_management_inspection_task_children_task_log'
  70. id = Column(String(50), primary_key=True, comment='ID,uuid')
  71. children_task_id = Column(String(50), nullable=False, comment='ID,子任务表id')
  72. area_code = Column(String(50), nullable=True, comment='区划编码')
  73. area = Column(Text, nullable=True, comment='区划')
  74. task_status = Column(String(2), nullable=True, comment='任务进展,已完成、未完成')
  75. user_id = Column(String(50), nullable=True, comment='用户id')
  76. nick_name = Column(String(50), nullable=True, comment='巡查人员')
  77. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  78. create_dept = Column(BigInteger, default=None, comment='创建部门')
  79. create_by = Column(BigInteger, default=None, comment='创建者')
  80. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  81. update_by = Column(BigInteger, default=None, comment='更新者')
  82. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  83. remark = Column(String(500), default=None, comment='备注')
  84. class RiskManagementInspectionTaskChildrenTaskResult(Base):
  85. __tablename__ = 'risk_management_inspection_task_children_task_result'
  86. id = Column(String(50), primary_key=True, comment='ID,uuid')
  87. children_task_id = Column(String(50), nullable=False, comment='ID,子任务表id')
  88. longitude = Column(Float, nullable=True, comment='经度')
  89. latitude = Column(Float, nullable=True, comment='纬度')
  90. inspection_point_name = Column(Text, nullable=True, comment='巡查点')
  91. area_code = Column(String(50), nullable=True, comment='区划编码')
  92. inspection_result = Column(String(2), nullable=True, comment='巡查结果,正常、异常')
  93. user_id = Column(String(50), nullable=True, comment='用户id')
  94. nick_name = Column(String(50), nullable=True, comment='巡查人员')
  95. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  96. create_dept = Column(BigInteger, default=None, comment='创建部门')
  97. create_by = Column(BigInteger, default=None, comment='创建者')
  98. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  99. update_by = Column(BigInteger, default=None, comment='更新者')
  100. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  101. remark = Column(String(500), default=None, comment='备注')
  102. class RiskManagementFile(Base):
  103. __tablename__ = 'risk_management_file'
  104. id = Column(Integer, primary_key=True, autoincrement=True)
  105. file_id = Column(String(50), nullable=False, comment='文件id')
  106. file_name = Column(String(255), nullable=False, comment='文件名称')
  107. file_name_desc = Column(String(255), nullable=False, comment='文件名称原名')
  108. file_path = Column(String(255), nullable=True, comment='文件存储路径')
  109. file_size = Column(String(50), nullable=True, comment='文件大小')
  110. status = Column(String(50), nullable=True, comment='文件状态')
  111. foreign_key = Column(String(50), nullable=True, comment='文件外键 --技术字段')
  112. from_scenario = Column(String(50), nullable=True, comment='对应标识 --技术字段')
  113. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  114. create_dept = Column(BigInteger, default=None, comment='创建部门')
  115. create_by = Column(BigInteger, default=None, comment='创建者')
  116. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  117. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  118. class RiskManagementRiskTask(Base):
  119. __tablename__ = 'risk_management_risk_task'
  120. id = Column(BigInteger, primary_key=True, autoincrement=True, comment='ID')
  121. task_number = Column(String(50), nullable=True, comment='任务编号')
  122. risk_type = Column(String(255), nullable=True, comment='风险源类型,风险源排查、隐患源排查、危险源排查')
  123. start_time = Column(DateTime, nullable=True, comment='排查开始时间')
  124. end_time = Column(DateTime, nullable=True, comment='排查结束时间')
  125. task_cycle = Column(String(50), nullable=True, comment='排查周期,每年、每月、每周、每日、一次')
  126. corn_expression = Column(String(100), nullable=True, comment='corn表达式')
  127. task_range = Column(String(50), nullable=True, comment='巡查范围,市级、区县级、镇街级、村居级')
  128. task_status = Column(String(20), nullable=True, comment='任务状态,未开始、进行中、未完成、已完结')
  129. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  130. create_dept = Column(BigInteger, default=None, comment='创建部门')
  131. create_by = Column(BigInteger, default=None, comment='创建者')
  132. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  133. update_by = Column(BigInteger, default=None, comment='更新者')
  134. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  135. remark = Column(String(500), default=None, comment='备注')
  136. class RiskManagementRiskTaskChildrenTask(Base):
  137. __tablename__ = 'risk_management_risk_task_children_task'
  138. id = Column(String(50), primary_key=True, comment='ID,uuid')
  139. task_id = Column(BigInteger, nullable=False, comment='ID,任务基础表id')
  140. task_number = Column(String(50), nullable=True, comment='任务编号')
  141. type = Column(String(255), nullable=True, comment='排查业务,城市隐患巡查、森林防火巡查、重点危化企业巡查、重点水库水位巡查')
  142. tsak_time = Column(DateTime, nullable=True, comment='要求排查时间')
  143. cycle = Column(String(50), nullable=True, comment='排查周期,每年、每月、每周、每日、一次')
  144. task_range = Column(String(50), nullable=True, comment='排查范围,市级、区县级、镇街级、村居级')
  145. task_num = Column(Integer, nullable=False, comment='任务数')
  146. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  147. create_dept = Column(BigInteger, default=None, comment='创建部门')
  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. remark = Column(String(500), default=None, comment='备注')
  153. class RiskManagementRiskTaskChildrenTaskLog(Base):
  154. __tablename__ = 'risk_management_risk_task_children_task_log'
  155. id = Column(String(50), primary_key=True, comment='ID,uuid')
  156. children_task_id = Column(String(50), nullable=False, comment='ID,子任务表id')
  157. area_code = Column(String(50), nullable=True, comment='区划编码')
  158. area = Column(Text, nullable=True, comment='区划')
  159. task_status = Column(String(2), nullable=True, comment='任务进展,已完成、未完成')
  160. user_id = Column(String(50), nullable=True, comment='用户id')
  161. nick_name = Column(String(50), nullable=True, comment='排查人员')
  162. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  163. create_dept = Column(BigInteger, default=None, comment='创建部门')
  164. create_by = Column(BigInteger, default=None, comment='创建者')
  165. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  166. update_by = Column(BigInteger, default=None, comment='更新者')
  167. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  168. remark = Column(String(500), default=None, comment='备注')
  169. class RiskManagementRiskTaskChildrenTaskResult(Base):
  170. __tablename__ = 'risk_management_risk_task_children_task_result'
  171. id = Column(String(50), primary_key=True, comment='ID,uuid')
  172. children_task_id = Column(String(50), nullable=False, comment='ID,子任务表id')
  173. longitude = Column(Float, nullable=True, comment='经度')
  174. latitude = Column(Float, nullable=True, comment='纬度')
  175. inspection_point_name = Column(Text, nullable=True, comment='巡查点')
  176. area_code = Column(String(50), nullable=True, comment='区划编码')
  177. inspection_result = Column(String(2), nullable=True, comment='排查结果,正常、异常')
  178. user_id = Column(String(50), nullable=True, comment='用户id')
  179. nick_name = Column(String(50), nullable=True, comment='排查人员')
  180. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  181. create_dept = Column(BigInteger, default=None, comment='创建部门')
  182. create_by = Column(BigInteger, default=None, comment='创建者')
  183. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  184. update_by = Column(BigInteger, default=None, comment='更新者')
  185. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  186. remark = Column(String(500), default=None, comment='备注')
  187. class RiskManagementRescueResourcesTask(Base):
  188. __tablename__ = 'risk_management_rescue_resources_task'
  189. id = Column(BigInteger, primary_key=True, autoincrement=True, comment='ID')
  190. task_number = Column(String(50), nullable=True, comment='任务编号')
  191. type = Column(String(255), nullable=True, comment='采集业务,庇护场所、救援队伍、救援设备')
  192. start_time = Column(DateTime, nullable=True, comment='采集开始时间')
  193. end_time = Column(DateTime, nullable=True, comment='采集结束时间')
  194. task_cycle = Column(String(50), nullable=True, comment='采集周期,每年、每月、每周、每日、一次')
  195. corn_expression = Column(String(100), nullable=True, comment='corn表达式')
  196. task_range = Column(String(50), nullable=True, comment='巡查范围,市级、区县级、镇街级、村居级')
  197. task_status = Column(String(20), nullable=True, comment='任务状态,未开始、进行中、未完成、已完结')
  198. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  199. create_dept = Column(BigInteger, default=None, comment='创建部门')
  200. create_by = Column(BigInteger, default=None, comment='创建者')
  201. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  202. update_by = Column(BigInteger, default=None, comment='更新者')
  203. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  204. remark = Column(String(500), default=None, comment='备注')
  205. class RiskManagementRescueResourcesTaskChildrenTask(Base):
  206. __tablename__ = 'risk_management_rescue_resources_task_children_task'
  207. id = Column(String(50), primary_key=True, comment='ID,uuid')
  208. task_id = Column(BigInteger, nullable=False, comment='ID,任务基础表id')
  209. task_number = Column(String(50), nullable=True, comment='任务编号')
  210. type = Column(String(255), nullable=True, comment='采集业务,庇护场所、救援队伍、救援设备')
  211. tsak_time = Column(DateTime, nullable=True, comment='要求采集时间')
  212. cycle = Column(String(50), nullable=True, comment='采集周期,每年、每月、每周、每日、一次')
  213. task_range = Column(String(50), nullable=True, comment='采集范围,市级、区县级、镇街级、村居级')
  214. task_num = Column(Integer, nullable=False, comment='任务数')
  215. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  216. create_dept = Column(BigInteger, default=None, comment='创建部门')
  217. create_by = Column(BigInteger, default=None, comment='创建者')
  218. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  219. update_by = Column(BigInteger, default=None, comment='更新者')
  220. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  221. remark = Column(String(500), default=None, comment='备注')
  222. class RiskManagementRescueResourcesTaskChildrenTaskLog(Base):
  223. __tablename__ = 'risk_management_rescue_resources_task_children_task_log'
  224. id = Column(String(50), primary_key=True, comment='ID,uuid')
  225. children_task_id = Column(String(50), nullable=False, comment='ID,子任务表id')
  226. area_code = Column(String(50), nullable=True, comment='区划编码')
  227. area = Column(Text, nullable=True, comment='区划')
  228. task_status = Column(String(2), nullable=True, comment='任务进展,已完成、未完成')
  229. user_id = Column(String(50), nullable=True, comment='用户id')
  230. nick_name = Column(String(50), nullable=True, comment='采集人员')
  231. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  232. create_dept = Column(BigInteger, default=None, comment='创建部门')
  233. create_by = Column(BigInteger, default=None, comment='创建者')
  234. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  235. update_by = Column(BigInteger, default=None, comment='更新者')
  236. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  237. remark = Column(String(500), default=None, comment='备注')
  238. class RiskManagementRescueResourcesTaskChildrenTaskResult(Base):
  239. __tablename__ = 'risk_management_rescue_resources_task_children_task_result'
  240. id = Column(String(50), primary_key=True, comment='ID,uuid')
  241. children_task_id = Column(String(50), nullable=False, comment='ID,子任务表id')
  242. longitude = Column(Float, nullable=True, comment='经度')
  243. latitude = Column(Float, nullable=True, comment='纬度')
  244. inspection_point_name = Column(Text, nullable=True, comment='巡查点')
  245. area_code = Column(String(50), nullable=True, comment='区划编码')
  246. inspection_result = Column(String(2), nullable=True, comment='采集结果,正常、异常')
  247. user_id = Column(String(50), nullable=True, comment='用户id')
  248. nick_name = Column(String(50), nullable=True, comment='采集人员')
  249. del_flag = Column(String(1), default='0', comment='删除标志(0代表存在 2代表删除)')
  250. create_dept = Column(BigInteger, default=None, comment='创建部门')
  251. create_by = Column(BigInteger, default=None, comment='创建者')
  252. create_time = Column(DateTime, default=datetime.now, comment='创建时间')
  253. update_by = Column(BigInteger, default=None, comment='更新者')
  254. update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
  255. remark = Column(String(500), default=None, comment='备注')