SELECT count(1) FROM "tzs_jg_installation_notice" where receive_company_org_code like CONCAT(#{orgCode}, '%') and notice_status = '6616' and date_ge(CAST(handle_date as date),#{dto.beginDate}) and date_le(CAST(handle_date as date),#{dto.endDate})
union all
SELECT count(1) FROM "tz_jyjc_inspection_application" a, tz_base_enterprise_info b where a.inspection_unit_code= b.use_unit_code and b.supervise_org_code like CONCAT(#{orgCode}, '%') and a.status = '6616' and a.biz_type = 'supervise' and date_ge(CAST(a.accept_date as date),#{dto.beginDate}) and date_le(CAST(a.accept_date as date),#{dto.endDate})
SELECT
count(1)
FROM
"tz_jyjc_inspection_application" a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and ((b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{dto.cityCode}, '%')))
and a.status = '6616' and a.biz_type = 'supervise'
and date_ge(CAST(a.accept_date as date),#{dto.beginDate})
and date_le(CAST(a.accept_date as date),#{dto.endDate})
union all
SELECT count(1) FROM "tzs_jg_use_registration" where receive_company_org_code like CONCAT(#{orgCode}, '%') and status = '已完成' and date_ge(CAST(audit_pass_date as date),#{dto.beginDate}) and date_le(CAST(audit_pass_date as date),#{dto.endDate})
union all
SELECT count(1) FROM "tz_jyjc_inspection_application" a, tz_base_enterprise_info b where a.inspection_unit_code= b.use_unit_code and b.supervise_org_code like CONCAT(#{orgCode}, '%') and a.status = '6616' and a.inspection_type = 'DQJY' and date_ge(CAST(a.accept_date as date),#{dto.beginDate}) and date_le(CAST(a.accept_date as date),#{dto.endDate})
SELECT
count(1)
FROM
"tz_jyjc_inspection_application" a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and ((b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{dto.cityCode}, '%')))
and a.status = '6616' and a.inspection_type = 'DQJY'
and date_ge(CAST(a.accept_date as date),#{dto.beginDate})
and date_le(CAST(a.accept_date as date),#{dto.endDate})
union all
select sum(num) from (
select count(1) as num from tzs_jg_change_registration_name a, privilege_company b where a.receive_org_code= b.company_code and b.org_code like CONCAT(#{orgCode}, '%') and a.audit_status = '已完成' and date_ge(CAST(a.audit_pass_date as date),#{dto.beginDate}) and date_le(CAST(a.audit_pass_date as date),#{dto.endDate})
SELECT count(1) FROM "tzs_jg_installation_notice" where receive_company_org_code like CONCAT(#{orgCode}, '%') and notice_status != '6610' and notice_status != '6615' and notice_status != '6617' and notice_status != '6616' and date_ge(CAST(notice_date as date),#{dto.beginDate}) and date_le(CAST(notice_date as date),#{dto.endDate})
union all
SELECT count(1) FROM "tz_jyjc_inspection_application" a, tz_base_enterprise_info b where a.inspection_unit_code= b.use_unit_code and b.supervise_org_code like CONCAT(#{orgCode}, '%') and a.status != '6610' and a.status != '6615' and a.status != '6617' and a.status != '6616' and a.biz_type = 'supervise' and date_ge(CAST(a.application_date as date),#{dto.beginDate}) and date_le(CAST(a.application_date as date),#{dto.endDate})
SELECT
count(1)
FROM
"tz_jyjc_inspection_application" a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and ((b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{dto.cityCode}, '%')))
and a.status != '6610' and a.status != '6615' and a.status != '6617' and a.status != '6616'
and a.biz_type = 'supervise'
and date_ge(CAST(a.application_date as date),#{dto.beginDate})
and date_le(CAST(a.application_date as date),#{dto.endDate})
union all
SELECT count(1) FROM "tzs_jg_use_registration" where receive_company_org_code like CONCAT(#{orgCode}, '%') and status != '使用单位待提交' and status != '使用单位已撤回' and status != '已作废' and status = '已完成' and date_ge(CAST(reg_date as date),#{dto.beginDate}) and date_le(CAST(reg_date as date),#{dto.endDate})
union all
SELECT count(1) FROM "tz_jyjc_inspection_application" a, tz_base_enterprise_info b where a.inspection_unit_code= b.use_unit_code and b.supervise_org_code like CONCAT(#{orgCode}, '%') and a.status != '6610' and a.status != '6615' and a.status != '6617' and a.status != '6616' and a.inspection_type = 'DQJY' and date_ge(CAST(a.application_date as date),#{dto.beginDate}) and date_le(CAST(a.application_date as date),#{dto.endDate})
SELECT
count(1)
FROM
"tz_jyjc_inspection_application" a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and ((b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{dto.cityCode}, '%')))
and a.status != '6610' and a.status != '6615' and a.status != '6617' and a.status != '6616'
and a.inspection_type = 'DQJY'
and date_ge(CAST(a.application_date as date),#{dto.beginDate})
and date_le(CAST(a.application_date as date),#{dto.endDate})
union all
select sum(num) from (
select count(1) as num from tzs_jg_change_registration_name a, privilege_company b where a.receive_org_code= b.company_code and b.org_code like CONCAT(#{orgCode}, '%') and a.audit_status != '使用单位已撤回' and a.audit_status != '使用单位待提交' and a.audit_status !='已作废' and a.audit_status !='已完成' and date_ge(CAST(a.apply_date as date),#{dto.beginDate}) and date_le(CAST(a.apply_date as date),#{dto.endDate})