ALTER TABLE `zh_project_account` ADD `company_id` INT NULL DEFAULT NULL COMMENT '所属参建单位id' AFTER `company`;

ALTER TABLE `zh_datacollect_audit` ADD `company_id` INT NULL DEFAULT NULL COMMENT '参建单位id' AFTER `pid`;

ALTER TABLE `zh_std_gcl_list`
ADD COLUMN `sub_type`  tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '二级分类' AFTER `create_time`;

ALTER TABLE `zh_rpt_tree_node`
ADD COLUMN `source_type`  int(11) UNSIGNED NOT NULL DEFAULT 1 COMMENT '数据源类型' AFTER `last_update_time`;

ALTER TABLE `zh_rpt_tpl`
ADD COLUMN `source_type`  int(11) UNSIGNED NOT NULL DEFAULT 1 COMMENT '数据源类型' AFTER `rpt_content`;

ALTER TABLE `zh_rpt_mapping_field`
ADD COLUMN `source_type`  int(11) UNSIGNED NOT NULL COMMENT '数据源类型' AFTER `items`;

ALTER TABLE `zh_payment_detail_attachment`
ADD COLUMN `safe_id`  varchar(36) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '安全生产费清单id(uuid)(zh_payment_safe_bills.safe_id)' AFTER `extra_upload`;

CREATE TABLE `zh_payment_safe_bills` (
  `id` varchar(36) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'uuid',
  `safe_id` varchar(36) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'uuid（不同期保持统一）',
  `tender_id` int(11) unsigned NOT NULL COMMENT '标段id',
  `detail_id` int(11) unsigned NOT NULL,
  `tree_id` int(11) NOT NULL COMMENT '节点id',
  `tree_pid` int(11) NOT NULL COMMENT '父节点id',
  `tree_level` tinyint(4) NOT NULL COMMENT '层级',
  `tree_order` mediumint(4) NOT NULL COMMENT '同级排序',
  `tree_full_path` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT '层级定位辅助字段parent.full_path.ledger_id',
  `tree_is_leaf` tinyint(4) unsigned NOT NULL DEFAULT '1' COMMENT '是否叶子节点，界面显示辅助字段',
  `b_code` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '编号',
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '名称',
  `unit` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '单位',
  `spec` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '规格',
  `unit_price` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '单价',
  `pre_qty` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '截止上期数量',
  `pre_tp` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '截止上期金额',
  `cur_qty` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '本期数量',
  `cur_tp` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '本期金额',
  `end_qty` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '截止本期数量',
  `end_tp` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '截止本期金额',
  `invoice_code` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '发票号',
  `memo` varchar(1000) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '备注',
  `add_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建人',
  `add_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '最后编辑人',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后编辑时间',
  `cur_read_qty` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '本期数量-只读',
  `cur_read_tp` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '本期金额-只读',
  `cur_his` json DEFAULT NULL COMMENT '本期历史',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;