123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- CREATE OR REPLACE PROCEDURE shanglifeecif.data_cleaning() -- 创建主存储过程
- IS
- DECLARE
- BEGIN
-
- --姓名 sametype:3
- INSERT INTO shanglifeecif.samecustomer(
- sid,
- scustid,
- name,
- gender,
- birthday,
- idcard,
- OtherIdNumber,
- sameType
- )
- SELECT
- reflect("java.util.UUID", "randomUUID"),
- t.customer_id,
- t.customer_name,
- t.gender,
- to_char(t.birthdate,"yyyy-MM-dd") birthdate,
- CASE t.id_type WHEN '0' THEN t.id_no END AS idcard,
- CASE WHEN t.id_type <> '0' THEN t.id_no END AS otherIdnumber,
- 3
- FROM dsj.t_customer_class t WHERE t.customer_name RLIKE '^.*[!$^|\=`]{1,}.*$' OR t.customer_name RLIKE '^.*[0-9]{1,}.*$' ;
- --性别 sametype:4
- INSERT INTO shanglifeecif.samecustomer(
- sid,
- scustid,
- name,
- gender,
- birthday,
- idcard,
- OtherIdNumber,
- sameType
- )
- SELECT
- reflect("java.util.UUID", "randomUUID"),
- t.customer_id,
- t.customer_name,
- t.gender,
- to_char(t.birthdate,"yyyy-MM-dd") birthdate,
- CASE t.id_type WHEN '0' THEN t.id_no END AS idcard,
- CASE WHEN t.id_type <> '0' THEN t.id_no END AS otherIdnumber,
- 4
- FROM dsj.t_customer_class t WHERE t.gender IS NULL AND t.customer_id IN (SELECT p.customerno FROM dsj.policy_information p WHERE p.sex IS null );
- --证件号码 sametype:6
- INSERT INTO shanglifeecif.samecustomer(
- sid,
- scustid,
- name,
- gender,
- birthday,
- idcard,
- sameType
- )
- SELECT
- reflect("java.util.UUID", "randomUUID"),
- si.scustid,
- si.name,
- si.gender,
- si.birthday,
- si.idcard,
- 6
- FROM shanglifeecif.individual si WHERE length(si.idcard)<18 AND si.custtype LIKE '%投保人%' AND si.idcard IS NOT null;
- --出生日期 sametype:7
- INSERT INTO shanglifeecif.samecustomer(
- sid,
- scustid,
- name,
- gender,
- birthday,
- idcard,
- OtherIdNumber,
- sameType
- )
- SELECT
- reflect("java.util.UUID", "randomUUID"),
- t.customer_id,
- t.customer_name,
- t.gender,
- to_char(t.birthdate,"yyyy-MM-dd") birthdate,
- CASE t.id_type WHEN '0' THEN t.id_no END AS idcard,
- CASE WHEN t.id_type <> '0' THEN t.id_no END AS otherIdnumber,
- 7
- FROM dsj.t_customer_class t WHERE t.birthdate IS NULL AND t.customer_id IN (SELECT p.customerno FROM dsj.policy_information p WHERE p.birthday IS null UNION SELECT i.insuredno FROM dsj.policy_information i WHERE i.insuredbirthday IS null);
- --手机号 sametype:8
- INSERT INTO shanglifeecif.samecustomer(
- sid,
- scustid,
- name,
- gender,
- birthday,
- idcard,
- OtherIdNumber,
- mobile,
- sameType
- )
- SELECT
- reflect("java.util.UUID", "randomUUID"),
- t.customer_id,
- t.customer_name,
- t.gender,
- to_char(t.birthdate,"yyyy-MM-dd") birthdate,
- CASE t.id_type WHEN '0' THEN t.id_no END AS idcard,
- CASE WHEN t.id_type <> '0' THEN t.id_no END AS otherIdnumber,
- t.mobile,
- 8
- FROM dsj.t_customer_class t WHERE t.mobile NOT RLIKE '^1[0-9]{10}$' AND t.customer_id IN (SELECT p.customerno FROM dsj.policy_information p);
- --邮编 sametype:9
- INSERT INTO shanglifeecif.samecustomer(
- sid,
- scustid,
- name,
- gender,
- birthday,
- idcard,
- zipcode,
- sameType
- )
- SELECT
- reflect("java.util.UUID", "randomUUID"),
- si.scustid,
- si.name,
- si.gender,
- si.birthday,
- si.idcard,
- si.zipcode,
- 9
- FROM shanglifeecif.individual si WHERE (length(si.zipcode)>0 and length(si.zipcode)<6) OR length(si.zipcode)>6;
- --主被保险人性别异常数据 sametype:11
- INSERT INTO shanglifeecif.samecustomer(
- sid,
- scustid,
- name,
- gender,
- birthday,
- idcard,
- OtherIdNumber,
- sameType
- )
- SELECT
- reflect("java.util.UUID", "randomUUID"),
- t.customer_id,
- t.customer_name,
- t.gender,
- to_char(t.birthdate,"yyyy-MM-dd") birthdate,
- CASE t.id_type WHEN '0' THEN t.id_no END AS idcard,
- CASE WHEN t.id_type <> '0' THEN t.id_no END AS otherIdnumber,
- 11
- FROM dsj.t_customer_class t WHERE (t.gender IS NULL OR t.gender = '2') AND t.customer_id IN (SELECT p.insuredno FROM dsj.policy_information p WHERE p.insuredsex IS null);
- --邮箱 sametype:14
- INSERT INTO shanglifeecif.samecustomer(
- sid,
- scustid,
- name,
- gender,
- birthday,
- idcard,
- OtherIdNumber,
- email,
- sameType
- )
- SELECT
- reflect("java.util.UUID", "randomUUID"),
- t.customer_id,
- t.customer_name,
- t.gender,
- to_char(t.birthdate,"yyyy-MM-dd") birthdate,
- CASE t.id_type WHEN '0' THEN t.id_no END AS idcard,
- CASE WHEN t.id_type <> '0' THEN t.id_no END AS otherIdnumber,
- t.email,
- 14
- FROM dsj.t_customer_class t WHERE t.email not RLIKE '^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4})*$' AND t.customer_id IN (SELECT p.customerno FROM dsj.policy_information p UNION SELECT pi.insuredno FROM dsj.policy_information pi);
- --主被保险人手机异常数据 sametype:16
- INSERT INTO shanglifeecif.samecustomer(
- sid,
- scustid,
- name,
- gender,
- birthday,
- idcard,
- OtherIdNumber,
- mobile,
- sameType
- )
- SELECT
- reflect("java.util.UUID", "randomUUID"),
- t.customer_id,
- t.customer_name,
- t.gender,
- to_char(t.birthdate,"yyyy-MM-dd") birthdate,
- CASE t.id_type WHEN '0' THEN t.id_no END AS idcard,
- CASE WHEN t.id_type <> '0' THEN t.id_no END AS otherIdnumber,
- t.mobile,
- 16
- FROM dsj.t_customer_class t WHERE t.mobile NOT RLIKE '^1[0-9]{10}$' AND t.customer_id IN (SELECT p.insuredno FROM dsj.policy_information p);
- --主被保险人证件号码 sametype:17
- INSERT INTO shanglifeecif.samecustomer(
- sid,
- scustid,
- name,
- gender,
- birthday,
- idcard,
- sameType
- )
- SELECT
- reflect("java.util.UUID", "randomUUID"),
- si.scustid,
- si.name,
- si.gender,
- si.birthday,
- si.idcard,
- 17
- FROM shanglifeecif.individual si WHERE length(si.idcard)<18 AND si.custtype LIKE '%被保人%' AND si.idcard IS NOT null;
- --业务员没错 sametype:18
- INSERT INTO shanglifeecif.samecustomer(
- sid,
- scustid,
- name,
- gender,
- birthday,
- idcard,
- OtherIdNumber,
- agentname,
- sameType
- )
- SELECT
- reflect("java.util.UUID", "randomUUID"),
- t.customer_id,
- t.customer_name,
- t.gender,
- to_char(t.birthdate,"yyyy-MM-dd") birthdate,
- CASE t.id_type WHEN '0' THEN t.id_no END AS idcard,
- CASE WHEN t.id_type <> '0' THEN t.id_no END AS otherIdnumber,
- p.agentname,
- 18
- FROM dsj.t_customer_class t,dsj.policy_information p WHERE t.customer_id = p.customerno and p.agentname not RLIKE '^[\u4e00-\u9fa5]|[^\x00-\xff]$';
- --业绩归属 sametype:19
- INSERT INTO shanglifeecif.samecustomer(
- sid,
- scustid,
- name,
- gender,
- birthday,
- idcard,
- OtherIdNumber,
- salecomname,
- sameType
- )
- SELECT
- reflect("java.util.UUID", "randomUUID"),
- t.customer_id,
- t.customer_name,
- t.gender,
- to_char(t.birthdate,"yyyy-MM-dd") birthdate,
- CASE t.id_type WHEN '0' THEN t.id_no END AS idcard,
- CASE WHEN t.id_type <> '0' THEN t.id_no END AS otherIdnumber,
- p.salecomname,
- 19
- FROM dsj.t_customer_class t,dsj.policy_information p WHERE t.customer_id = p.customerno and p.salecomname not RLIKE '^[\u4e00-\u9fa5]|[^\x00-\xff]$';
- dbms_output.put_line('data_cleaning函数跑批完成!');
- END;
|