123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 |
- CREATE OR REPLACE PROCEDURE shanglifeecif.init_insurancearrangement_policy_information()
- IS
- BEGIN
- INSERT INTO shanglifeecif.insurancearrangement(
- iaid ,
- policyno ,
- pindate ,
- pmdate ,
- norenewal ,
- payment ,
- applicantscustid ,
- appname ,
- appcertid ,
- insuredscustid ,
- insname ,
- inscertid ,
- productid ,
- productname,
- policybelong ,
- payendyear ,
- policystate,
- prem,
- Risk,
- NPDate,
- PADate,
- pisdate,
- AgentOrg,
- schannel,
- PWComp,
- agrmntage ,
- created_by ,
- created_time
- )
- SELECT
- row_number()over(),
- CONTNO,
- CVALIDATE,
- ENDDATE,
- PAYCOUNT,
- PAYINTV,
- CUSTOMERNO,
- NAME,
- IDNO,
- insuredno,
- INSUREDNAME,
- INSUREDIDNO,
- RISKCODE,
- RISKNAME,
- SALECOM,
- PAYENDYEAR,
- APPFLAG,
- prem,
- AMNT,
- PAYTODATE,
- CUSTOMGETPOLDATE,
- SIGNDATE,
- AGENTCOM,
- SALECHNL,
- "上海人寿上海分公司",
- case
- when security ='终身' then 42720
- when security = '至100周岁' then 36500
- when security = '至80周岁' then 29200
- when security = '70年' then 25550
- when security = '至70周岁' then 25550
- when security = '至65周岁' then 23725
- when security = '至60周岁' then 21900
- when security = '30年' then 10950
- when security = '20年' then 7300
- when security = '10年' then 3650
- when security = '6年' then 2190
- when security = '5年' then 1825
- when security = '1年' then 365
- when security = '180天' then 180
- when security = '6月' then 180
- when security = '90天' then 90
- when security = '3月' then 90
- when security = '1月' then 30
- when security = '30天' then 30
- when security = '15天' then 15
- when security = '7天' then 7
- end,
- 'admin',
- sysdate()
- FROM policy_information;
-
-
-
- UPDATE shanglifeecif.insurancearrangement a SET (
- applicantid
- ) = (
- select
- c.indid
- from (
- select
- row_number()over(PARTITION BY b.scustid) rn,
- b.indid,
- b.scustid
- from shanglifeecif.individual b
- ) c
- WHERE c.scustid = a.applicantscustid and c.rn=1
- ) WHERE 1=1 ;
- UPDATE shanglifeecif.insurancearrangement a SET (
- insuredid
- ) = (
- select
- c.indid
- from (
- select
- row_number()over(PARTITION BY b.scustid) rn,
- b.indid,
- b.scustid
- from shanglifeecif.individual b
- ) c
- WHERE c.scustid = a.insuredscustid and c.rn=1
- ) WHERE 1=1 ;
-
- UPDATE shanglifeecif.insurancearrangement a SET (
- pano ,
-
-
-
-
-
- agentchannel
- ) = (
- select
- PRTNO,
-
-
-
-
-
- SELLTYPE
- from INSURANCEINFO b
- where b.contno = a.policyno
- ) WHERE 1=1 ;
- END;
- /
- CREATE OR REPLACE PROCEDURE shanglifeecif.update_risk_categories()
- IS
- BEGIN
- UPDATE shanglifeecif.insurancearrangement a SET (
- risk_categories,
- risk_categories_name
- ) = (
-
- select
- b.kindcode,
- (CASE b.kindcode
- WHEN 'A' THEN '意外伤害险'
- WHEN 'U' THEN '万能保险'
- WHEN 'R' THEN '年金保险'
- WHEN 'S' THEN '重疾保险'
- WHEN 'L' THEN '人寿保险'
- WHEN 'H' THEN '健康险'
- END) AS kindname
- from lmriskapp b WHERE a.productid = b.riskcode
-
- ) WHERE 1=1;
- END;
- /
- /
- CREATE OR REPLACE PROCEDURE shanglifeecif.up_insurancearrangement_other()
- IS
- BEGIN
-
- UPDATE shanglifeecif.insurancearrangement a SET (
- policytype
- ) = (
- select
- c.CONTTYPE
- from (
- select
- row_number()over(PARTITION BY b.contno) rn,
- b.CONTTYPE,
- b.contno
- from PERSONAL_INSURANCE b
- ) c
- WHERE c.contno = a.policyno and c.rn=1
- ) WHERE 1=1 ;
- UPDATE shanglifeecif.insurancearrangement a SET (
- poservice
- ) = (
- SELECT
- IF(count(b.CONTNO) >0,1,0)
- FROM AUDIT_EDORLIST b
- where b.contno = a.policyno
- ) WHERE 1=1 ;
- UPDATE shanglifeecif.insurancearrangement a SET (
- soinsured
- ) = (
- SELECT
- PEOPLES3
- FROM HEALTH_GROUP_LISTING b
- where b.contno = a.policyno
- ) WHERE 1=1 ;
- END;
- /
- CREATE OR REPLACE PROCEDURE shanglifeecif.init_insurancearrangement()
- IS
- BEGIN
-
- shanglifeecif.init_insurancearrangement_policy_information();
-
- shanglifeecif.up_insurancearrangement_health_insurance_listing();
-
- shanglifeecif.up_insurancearrangement_other();
- END;
- /
- BEGIN
- shanglifeecif.init_insurancearrangement();
- end
|