if(ifnull(f.OCCUPATIONAL_DISEASE_FLAG,1) != 1 and ifnull(f.INFECTIOUS_DISEASE_FLAG,1) != 1 and ifnull(f.DISABILITY_FLAG,1) != 1 and ifnull(f.OTHER_FLAG,1) != 1,'1',null) as disabilityFlag,
if(ifnull(b.REMARK,1) != 1,'1',null) as badRecordFlag,
if(c.count >0,'1',null) as educationFlag,
if(g.count >0,'1',null) as familyFlag
from
t_employee_project a
left join (
select
ee.ID,
ee.EMP_SEX,
ee.VALIDITY_START,
ee.VALIDITY_END,
ee.EMP_BIRTHDAY,
ee.EMP_AGE,
ee.EMP_MARRI_STATUS,
ee.EMP_NATIONAL,
ee.POLITICAL_STATUS,
ee.EMP_PHONE,
ee.EMP_REGIS_TYPE,
ee.FILE_PROVINCE,
ee.FILE_CITY,
ee.IS_COLLEGE,
ee.HIGN_EDUCATION,
ee.SCHOOL,
ee.MAJOR,
ee.ADMISSION_DATE,
ee.GRADUTION_DATE,
ee.CONTACT_ADDRESS,
ee.FIRST_WORK_FLAG,
ee.HAVE_QUALIFICATION
from t_employee_info ee
left join t_atta_info tt on ee.id = tt.DOMAIN_ID and tt.RELATION_TYPE = '9'
left join t_atta_info yy on ee.id = yy.DOMAIN_ID and yy.RELATION_TYPE = '10'
where ee.DELETE_FLAG = '0' and ee.FILE_STATUS = 0 and tt.id is not null and yy.id is not null
group by ee.ID
) e on a.EMP_ID = e.ID
left join t_emp_bad_record b on a.EMP_IDCARD = b.EMP_IDCARD
left join (select EMP_ID,sum(if(ifnull(HIGH_IDENTIFICATION,-1) != -1 and ifnull(SCHOOL,-1) != -1 and ifnull(MAJOR,-1) != -1 and ifnull(TYPE,-1) != -1 and ifnull(ENTRY_DATE,-1) != -1 and ifnull(GRADUTION_DATE,-1) != -1,1,0)) as count from t_emp_education a left join t_atta_info b on a.id = b.domain_id where a.DELETE_FLAG = '0' and b.RELATION_TYPE = '0' group by a.EMP_ID) c on a.EMP_ID = c.EMP_ID
left join t_emp_contact_info d on a.EMP_IDCARD = d.EMP_IDCARD
left join t_emp_disability_info f on a.EMP_ID = f.EMP_ID and f.DELETE_FLAG = '1'
left join (select EMP_ID,sum(if(ifnull(RELATIONSHIP_SELF,-1) != -1 and ifnull(FAMILY_NAME,-1) != -1 and ifnull(CONTRACT_TEL,-1) != -1,1,0)) as count from t_emp_family where DELETE_FLAG = '1' group by EMP_ID) g on a.EMP_ID = g.EMP_ID
where a.DELETE_FLAG = '0' and a.PROJECT_STATUS = 0
<iftest="deptNo != null and deptNo.trim() != ''">
and a.DEPT_NO = #{deptNo}
</if>
group by a.ID
</select>
<!--删除所有监控数据-->
<updateid="deleteAllMonitorInfo">
TRUNCATE t_complete_monitor
</update>
<!--根据项目编码删除监控数据-->
<deleteid="deleteMonitorInfoByDeptNo">
delete from t_complete_monitor WHERE DEPT_NO = #{deptNo}
select concat(d.id,'_1_',#{parentId}) id,#{parentId} PARENT_ID,d.CERT_NUM,d.EMP_NAME,d.SOCIAL_SECURITY_ACCOUNT,d.INSURANCE_TYPE,'该员工的姓名、社保户与派单不一致' ERROR_INFO from t_auto_payment_detail d where d.CREATE_MONTH = DATE_FORMAT(now(),'%Y%m')
and not EXISTS (
select 1 from t_payment_info_2024 p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
select 1 from <includerefid="get_t_payment_info_"/> p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
and p.SOCIAL_HOUSEHOLD = d.SOCIAL_SECURITY_ACCOUNT
and p.EMP_NAME = d.EMP_NAME
and p.EMP_IDCARD = d.CERT_NUM
...
...
@@ -345,7 +345,7 @@
from t_auto_payment_detail d where d.CREATE_MONTH = DATE_FORMAT(now(),'%Y%m')
and d.INSURANCE_TYPE = '职工基本养老保险(单位缴纳)'
and not EXISTS (
select 1 from t_payment_info_2024 p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
select 1 from <includerefid="get_t_payment_info_"/> p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
and p.SOCIAL_HOUSEHOLD = d.SOCIAL_SECURITY_ACCOUNT and p.EMP_NAME = d.EMP_NAME and p.EMP_IDCARD = d.CERT_NUM
and p.UNIT_PENSION_MONEY > 0
)
...
...
@@ -367,7 +367,7 @@
select concat(d.id,'_3_', #{parentId}) id, #{parentId} PARENT_ID,d.CERT_NUM,d.EMP_NAME,d.SOCIAL_SECURITY_ACCOUNT,d.INSURANCE_TYPE,'该险种无此派单或该险种已减员' ERROR_INFO from t_auto_payment_detail d where d.CREATE_MONTH = DATE_FORMAT(now(),'%Y%m')
and d.INSURANCE_TYPE = '职工基本养老保险(个人缴纳)'
and not EXISTS (
select 1 from t_payment_info_2024 p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
select 1 from <includerefid="get_t_payment_info_"/> p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
and p.SOCIAL_HOUSEHOLD = d.SOCIAL_SECURITY_ACCOUNT and p.EMP_NAME = d.EMP_NAME and p.EMP_IDCARD = d.CERT_NUM
and p.PERSONAL_PENSION_MONEY > 0
)
...
...
@@ -389,7 +389,7 @@
select concat(d.id,'_4_', #{parentId}) id, #{parentId} PARENT_ID,d.CERT_NUM,d.EMP_NAME,d.SOCIAL_SECURITY_ACCOUNT,d.INSURANCE_TYPE,'该险种无此派单或该险种已减员' ERROR_INFO from t_auto_payment_detail d where d.CREATE_MONTH = DATE_FORMAT(now(),'%Y%m')
and d.INSURANCE_TYPE = '失业保险(单位缴纳)'
and not EXISTS (
select 1 from t_payment_info_2024 p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
select 1 from <includerefid="get_t_payment_info_"/> p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
and p.SOCIAL_HOUSEHOLD = d.SOCIAL_SECURITY_ACCOUNT and p.EMP_NAME = d.EMP_NAME and p.EMP_IDCARD = d.CERT_NUM
and p.UNIT_UNEMPLOYMENT_MONEY > 0
)
...
...
@@ -411,7 +411,7 @@
select concat(d.id,'_5_', #{parentId}) id, #{parentId} PARENT_ID,d.CERT_NUM,d.EMP_NAME,d.SOCIAL_SECURITY_ACCOUNT,d.INSURANCE_TYPE,'该险种无此派单或该险种已减员' ERROR_INFO from t_auto_payment_detail d where d.CREATE_MONTH = DATE_FORMAT(now(),'%Y%m')
and d.INSURANCE_TYPE = '失业保险(个人缴纳)'
and not EXISTS (
select 1 from t_payment_info_2024 p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
select 1 from <includerefid="get_t_payment_info_"/> p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
and p.SOCIAL_HOUSEHOLD = d.SOCIAL_SECURITY_ACCOUNT and p.EMP_NAME = d.EMP_NAME and p.EMP_IDCARD = d.CERT_NUM
and p.PERSONAL_UNEMPLOYMENT_MONEY > 0
)
...
...
@@ -433,7 +433,7 @@
select concat(d.id,'_6_', #{parentId}) id, #{parentId} PARENT_ID,d.CERT_NUM,d.EMP_NAME,d.SOCIAL_SECURITY_ACCOUNT,d.INSURANCE_TYPE,'该险种无此派单或该险种已减员' ERROR_INFO from t_auto_payment_detail d where d.CREATE_MONTH = DATE_FORMAT(now(),'%Y%m')
and d.INSURANCE_TYPE = '职工基本医疗保险(个人缴纳)'
and not EXISTS (
select 1 from t_payment_info_2024 p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
select 1 from <includerefid="get_t_payment_info_"/> p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
and p.SOCIAL_HOUSEHOLD = d.SOCIAL_SECURITY_ACCOUNT and p.EMP_NAME = d.EMP_NAME and p.EMP_IDCARD = d.CERT_NUM
and p.PERSONAL_MEDICAL_MONEY > 0
)
...
...
@@ -455,7 +455,7 @@
select concat(d.id,'_7_', #{parentId}) id, #{parentId} PARENT_ID,d.CERT_NUM,d.EMP_NAME,d.SOCIAL_SECURITY_ACCOUNT,d.INSURANCE_TYPE,'该险种无此派单或该险种已减员' ERROR_INFO from t_auto_payment_detail d where d.CREATE_MONTH = DATE_FORMAT(now(),'%Y%m')
and d.INSURANCE_TYPE = '职工基本医疗保险(单位缴纳)'
and not EXISTS (
select 1 from t_payment_info_2024 p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
select 1 from <includerefid="get_t_payment_info_"/> p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
and p.SOCIAL_HOUSEHOLD = d.SOCIAL_SECURITY_ACCOUNT and p.EMP_NAME = d.EMP_NAME and p.EMP_IDCARD = d.CERT_NUM
and p.UNIT_MEDICAL_MONEY > 0
)
...
...
@@ -477,7 +477,7 @@
select concat(d.id,'_8_', #{parentId}) id, #{parentId} PARENT_ID,d.CERT_NUM,d.EMP_NAME,d.SOCIAL_SECURITY_ACCOUNT,d.INSURANCE_TYPE,'该险种无此派单或该险种已减员' ERROR_INFO from t_auto_payment_detail d where d.CREATE_MONTH = DATE_FORMAT(now(),'%Y%m')
and d.INSURANCE_TYPE = '工伤保险'
and not EXISTS (
select 1 from t_payment_info_2024 p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
select 1 from <includerefid="get_t_payment_info_"/> p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
and p.SOCIAL_HOUSEHOLD = d.SOCIAL_SECURITY_ACCOUNT and p.EMP_NAME = d.EMP_NAME and p.EMP_IDCARD = d.CERT_NUM
and p.UNIT_INJURY_MONEY > 0
)
...
...
@@ -499,7 +499,7 @@
select concat(d.id,'_9_', #{parentId}) id, #{parentId} PARENT_ID,d.CERT_NUM,d.EMP_NAME,d.SOCIAL_SECURITY_ACCOUNT,d.INSURANCE_TYPE,'该险种无此派单或该险种已减员' ERROR_INFO from t_auto_payment_detail d where d.CREATE_MONTH = DATE_FORMAT(now(),'%Y%m')
and d.INSURANCE_TYPE = '单位大病救助金'
and not EXISTS (
select 1 from t_payment_info_2024 p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
select 1 from <includerefid="get_t_payment_info_"/> p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
and p.SOCIAL_HOUSEHOLD = d.SOCIAL_SECURITY_ACCOUNT and p.EMP_NAME = d.EMP_NAME and p.EMP_IDCARD = d.CERT_NUM
and p.UNIT_BIGMAILMENT_MONEY > 0
)
...
...
@@ -521,7 +521,7 @@
select concat(d.id,'_10_', #{parentId}) id, #{parentId} PARENT_ID,d.CERT_NUM,d.EMP_NAME,d.SOCIAL_SECURITY_ACCOUNT,d.INSURANCE_TYPE,'该险种无此派单或该险种已减员' ERROR_INFO from t_auto_payment_detail d where d.CREATE_MONTH = DATE_FORMAT(now(),'%Y%m')
and d.INSURANCE_TYPE = '个人大病救助金'
and not EXISTS (
select 1 from t_payment_info_2024 p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
select 1 from <includerefid="get_t_payment_info_"/> p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
and p.SOCIAL_HOUSEHOLD = d.SOCIAL_SECURITY_ACCOUNT and p.EMP_NAME = d.EMP_NAME and p.EMP_IDCARD = d.CERT_NUM
and p.PERSONAL_BIGMAILMENT_MONEY > 0
)
...
...
@@ -544,7 +544,7 @@
select concat(d.id,'_11_', #{parentId}) id, #{parentId} PARENT_ID,d.CERT_NUM,d.EMP_NAME,d.SOCIAL_SECURITY_ACCOUNT,d.INSURANCE_TYPE,'该险种无此派单或该险种已减员' ERROR_INFO from t_auto_payment_detail d where d.CREATE_MONTH = DATE_FORMAT(now(),'%Y%m')
and d.INSURANCE_TYPE = '单位生育'
and not EXISTS (
select 1 from t_payment_info_2024 p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
select 1 from <includerefid="get_t_payment_info_"/> p where p.SOCIAL_CREATE_MONTH = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 MONTH),'%Y%m')
and p.SOCIAL_HOUSEHOLD = d.SOCIAL_SECURITY_ACCOUNT and p.EMP_NAME = d.EMP_NAME and p.EMP_IDCARD = d.CERT_NUM