123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391 |
- CREATE OR REPLACE PROCEDURE shanglifeecif.init_individual_0( individual_count OUT int)
- IS
- BEGIN
-
-
- insert into shanglifeecif.individual (
- indid,
- custid,
- scustid,
- name,
- gender,
- birthday,
- idcard,
- custtype,
- created_time,
- created_by
- )
- SELECT
- row_number()over(),
- 'CP'||lpad(row_number()over(),10,'0'),
- scustid ,
- name,
- gender ,
- birthday,
- idcard ,
- max(custtype) AS custtype,
- sysdate,
- 'admin'
- FROM (
- SELECT
- customerno AS scustid,
- name AS name,
- sex AS gender,
- birthday AS birthday,
- idtype AS idtype ,
- idno AS idcard,
- "投保人" AS custtype
- FROM
- policy_information
- WHERE customerno IS NOT NULL AND idtype=0
- UNION
- SELECT
- insuredno AS scustid,
- insuredname AS name,
- insuredsex AS gender,
- insuredbirthday AS birthday,
- insuredidtype AS idtype ,
- insuredidno AS idcard,
- "被保人" AS custtype
- FROM
- policy_information
- WHERE insuredno IS NOT NULL AND insuredidtype=0
- ) tmpTable GROUP BY scustid ,name,gender,birthday,idcard
-
- select count(0) into individual_count from shanglifeecif.individual
- END;
- /
- CREATE OR REPLACE PROCEDURE shanglifeecif.init_individual_1(individual_count INOUT int)
- IS
- BEGIN
-
-
- insert into shanglifeecif.individual (
- indid,
- custid,
-
- scustid,
- name,
- gender,
- birthday,
- passport,
- custtype,
-
- created_time,
- created_by
- )
- SELECT
- row_number()over()+individual_count,
- 'CP'||lpad(row_number()over()+individual_count,10,'0'),
- scustid ,
- name,
- gender ,
- birthday,
- idcard ,
- max(custtype) as custtype,
- sysdate,
- 'admin'
- FROM (
- SELECT
- customerno AS scustid,
- name AS name,
- sex AS gender,
- birthday AS birthday,
- idtype AS idtype ,
- idno AS idcard,
- "投保人" as custtype
- FROM
- policy_information
- WHERE customerno IS NOT NULL AND idtype=1
- UNION
- SELECT
- insuredno AS scustid,
- insuredname AS name,
- insuredsex AS gender,
- insuredbirthday AS birthday,
- insuredidtype AS idtype ,
- insuredidno AS idcard,
- "被保人" as custtype
- FROM
- policy_information
- WHERE insuredno IS NOT NULL AND insuredidtype=1
- ) tmpTable GROUP BY scustid ,name,gender ,birthday,idcard
-
- select count(0) into individual_count from shanglifeecif.individual
- END;
- /
- CREATE OR REPLACE PROCEDURE shanglifeecif.init_individual_3(individual_count INOUT int)
- IS
- BEGIN
-
-
- insert into shanglifeecif.individual(
- indid,
- custid,
- scustid,
- name,
- gender,
- birthday,
- dlicense,
- custtype,
- created_time,
- created_by
- )
- SELECT
- row_number()over()+individual_count,
- 'CP'||lpad(row_number()over()+individual_count,10,'0'),
-
- scustid ,
- name,
- gender ,
- birthday,
- idcard ,
- max(custtype) as custtype,
- sysdate,
- 'admin'
- FROM (
- SELECT
- customerno AS scustid,
- name AS name,
- sex AS gender,
- birthday AS birthday,
- idtype AS idtype ,
- idno AS idcard,
- "投保人" as custtype
- FROM
- policy_information
- WHERE customerno IS NOT NULL AND idtype=3
- UNION
- SELECT
- insuredno AS scustid,
- insuredname AS name,
- insuredsex AS gender,
- insuredbirthday AS birthday,
- insuredidtype AS idtype ,
- insuredidno AS idcard,
- "被保人" as custtype
- FROM
- policy_information
- WHERE insuredno IS NOT NULL AND insuredidtype=3
- ) tmpTable GROUP BY scustid ,name,gender ,birthday,idcard
-
- select count(0) into individual_count from shanglifeecif.individual
- END;
- /
- CREATE OR REPLACE PROCEDURE shanglifeecif.init_individual_other(individual_count INOUT int)
- IS
- BEGIN
-
-
- insert into shanglifeecif.individual(
- indid,
- custid,
-
- scustid,
- name,
- gender,
- birthday,
-
-
- created_time,
- created_by
- )
- SELECT
- row_number()over()+individual_count,
- 'CP'||lpad(row_number()over()+individual_count,10,'0'),
- scustid ,
- name,
- gender ,
- birthday,
- sysdate,
- 'admin'
- FROM (
- SELECT
- customerno AS scustid,
- name AS name,
- sex AS gender,
- birthday AS birthday,
- idtype AS idtype ,
- idno AS idcard,
- "投保人" as custtype
- FROM
- policy_information
- WHERE customerno IS NOT NULL AND idtype not in (0,1,3)
- UNION
- SELECT
- insuredno AS scustid,
- insuredname AS name,
- insuredsex AS gender,
- insuredbirthday AS birthday,
- insuredidtype AS idtype ,
- insuredidno AS idcard,
- "被保人" as custtype
- FROM
- policy_information
- WHERE insuredno IS NOT NULL AND insuredidtype in (0,1,3)
- ) tmpTable GROUP BY scustid ,name,gender ,birthday,idcard
-
- select count(0) into individual_count from shanglifeecif.individual
- END;
- /
- CREATE OR REPLACE PROCEDURE shanglifeecif.up_t_customers_class_1()
- IS
- BEGIN
- UPDATE shanglifeecif.individual a SET (
- CustClass ,
- ConValue ,
- Awarded3 ,
- Awarded2 ,
- Awarded1 ,
- SOValue ,
- EndDate,
- Height,
- Weight,
- BMI,
- PIncome,
- FIncome,
- IncomeSource,
- SIStatus,
- Ethnic,
- Nation,
- MaritalStat,
- Employer,
- Education,
- Dday,
- regtype,
- ZIPCODE,
- HPhone,
- PMPhone,
- email,
- RAL
- ) = (
- select
- CLASS_VALUE ,
- CONTRIBUTION_VALUE ,
- AWARDED3,
- AWARDED2,
- AWARDED1,
- TOTAL_VALUE,
- END_DATE,
- STATURE,
- AVOIRDUPOIS,
- BMI,
- YEARINCOME,
- FAMILYYEARSALARY,
- INCOMESOURCE,
- SOCIALINSUFLAG,
- NATIONALITY,
- NATIVEPLACE,
- MARRIAGE,
- GRPNAME,
- DEGREE,
- DEATHDATE,
- DENTYPE,
- ZIPCODE,
- PHONE,
- MOBILE,
- EMAIL,
- POSTALADDRESS
-
- from t_customer_class b
- where b.CUSTOMER_ID = a.scustid
- ) WHERE 1=1 ;
- END;
- /
- CREATE OR REPLACE PROCEDURE shanglifeecif.up_health_insurance_listing_1()
- IS
- BEGIN
-
- delete shanglifeecif.occupation_tmp;
-
- insert into shanglifeecif.occupation_tmp(
- scustid,
- OccupationId,
- Occupation,
- HomeAdress
- )
- select
- appntno,
- appntoccupationcode ,
- appntoccupationname ,
- APPNTHOMEADDRESS
- from HEALTH_INSURANCE_LISTING
- WHERE appntoccupationcode is not null
- and appntoccupationname is not null
- group by appntno,appntoccupationcode,appntoccupationname,APPNTHOMEADDRESS
-
- UPDATE shanglifeecif.individual a SET (
- OccupationId ,
- Occupation,
- HomeAdress
- ) = (
- select
- OccupationId ,
- Occupation,
- HomeAdress
- from shanglifeecif.occupation_tmp b
- where b.scustid = a.scustid
- ) WHERE 1=1 ;
-
-
- END;
- /
- CREATE OR REPLACE PROCEDURE shanglifeecif.init_individual_main()
- IS
- DECLARE
- individual_count int
- strsql string
- BEGIN
-
-
- shanglifeecif.init_individual_0(individual_count);
-
- individual_count:=individual_count+1;
- shanglifeecif.init_individual_1(individual_count);
-
- individual_count:=individual_count+1;
- shanglifeecif.init_individual_3(individual_count);
-
- individual_count:=individual_count+1;
- shanglifeecif.init_individual_other(individual_count);
-
-
- shanglifeecif.up_t_customers_class_1();
-
-
- shanglifeecif.up_health_insurance_listing_1();
- END;
- /
- BEGIN
- shanglifeecif.init_individual_main();
- end ;
|