Commit 6ea0371e authored by huyuchen's avatar huyuchen

huych-商险到期提醒优化修改

parent 0d1fe7f4
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
a.DIE_DISABLE_QUOTA, a.DIE_DISABLE_QUOTA,
a.DEPT_ID, a.DEPT_ID,
a.POLICY_NO, a.POLICY_NO,
if(a.POLICY_END >= curdate(),0,1) IS_OVERDUE, IF( a.POLICY_END >= curdate(), 0, 1 ) IS_OVERDUE,
a.REMARK, a.REMARK,
a.CREATE_BY, a.CREATE_BY,
a.DELETE_FLAG, a.DELETE_FLAG,
...@@ -89,10 +89,11 @@ ...@@ -89,10 +89,11 @@
a.CREATE_USER_DEPT_NAME a.CREATE_USER_DEPT_NAME
FROM FROM
t_insurance_detail a t_insurance_detail a
WHERE INNER JOIN (
a.id IN (
SELECT SELECT
l.id h.endTime,
max( l.POLICY_START ) POLICY_START,
l.EMP_IDCARD_NO
FROM FROM
( (
SELECT SELECT
...@@ -101,8 +102,10 @@ ...@@ -101,8 +102,10 @@
FROM FROM
t_insurance_detail b t_insurance_detail b
WHERE WHERE
b.POLICY_START >= date_sub( date_add( curdate(), INTERVAL 1 DAY ), INTERVAL 1 YEAR ) b.POLICY_START BETWEEN date_sub( date_add( curdate(), INTERVAL 1 DAY ), INTERVAL 1 YEAR )
AND b.IS_EFFECT = 0 AND b.DELETE_FLAG = '0' AND curdate()
AND b.IS_EFFECT = 0
AND b.DELETE_FLAG = '0'
AND NOT EXISTS ( AND NOT EXISTS (
SELECT SELECT
1 1
...@@ -122,10 +125,21 @@ ...@@ -122,10 +125,21 @@
b.INSURANCE_COMPANY_NAME, b.INSURANCE_COMPANY_NAME,
b.INSURANCE_TYPE_NAME b.INSURANCE_TYPE_NAME
) h ) h
INNER JOIN t_insurance_detail l ON h.EMP_IDCARD_NO = l.EMP_IDCARD_NO and l.DELETE_FLAG = '0' INNER JOIN t_insurance_detail l ON h.EMP_IDCARD_NO = l.EMP_IDCARD_NO
AND l.DELETE_FLAG = '0'
AND h.endTime = l.POLICY_END AND h.endTime = l.POLICY_END
AND l.POLICY_START BETWEEN date_sub( date_add( curdate(), INTERVAL 1 DAY ), INTERVAL 1 YEAR )
AND curdate()
WHERE WHERE
l.EXPIRE_IGNORE_FLAG = '1' l.EXPIRE_IGNORE_FLAG = '1'
) GROUP BY
l.EMP_IDCARD_NO,
l.INSURANCE_COMPANY_NAME,
l.INSURANCE_TYPE_NAME,
l.POLICY_END
) ll ON ll.EMP_IDCARD_NO = a.EMP_IDCARD_NO
AND ll.POLICY_START = a.POLICY_START
AND ll.endTime = a.POLICY_END
where a.DELETE_FLAG = '0'
</select> </select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment