Browse Source

security ,提取周岁天数判断

chenzhenguo 1 năm trước cách đây
mục cha
commit
811d0c18fc

+ 8 - 23
sql-achievement/存储过程/保单qxp.sql

@@ -187,29 +187,14 @@ SELECT
 	RISKCODE,--productid ,-- '险种代码 POLICY_INFORMATION.RISKCODE', 
 	SALECOM,--policybelong ,-- '业绩归属 POLICY_INFORMATION.SALECOM', 
 	PAYENDYEAR,--payendyear ,-- '缴费年期 POLICY_INFORMATION.PAYENDYEAR', 
-	
-	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
+
+    case
+        when security ='终身' then 42720
+        WHEN security LIKE '%天' THEN CAST(SUBSTR(security, 1, LENGTH(security) - 1) AS INT)
+        WHEN security LIKE '%月' THEN CAST(SUBSTR(security, 1, LENGTH(security) - 1) AS INT) * 30
+        WHEN security LIKE '%年' THEN CAST(SUBSTR(security, 1, LENGTH(security) - 1) AS INT) * 365
+        WHEN security LIKE '%周岁' THEN CAST(SUBSTR(security, 2, LENGTH(security) - 3) AS INT) * 365
+        ELSE 0
 	end,
 	'admin',
 	sysdate() 

+ 7 - 22
sql-achievement/存储过程/测试环境/存储过程.sql

@@ -1637,28 +1637,13 @@ SELECT
 	trim(PRESERVATIONFLAG) as PRESERVATIONFLAG,--保全标志
 	"上海人寿上海分公司",
 	trim(security) as security, --保险期原始值
-	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
+		case
+        when security ='终身' then 42720
+        WHEN security LIKE '%天' THEN CAST(SUBSTR(security, 1, LENGTH(security) - 1) AS INT)
+        WHEN security LIKE '%月' THEN CAST(SUBSTR(security, 1, LENGTH(security) - 1) AS INT) * 30
+        WHEN security LIKE '%年' THEN CAST(SUBSTR(security, 1, LENGTH(security) - 1) AS INT) * 365
+        WHEN security LIKE '%周岁' THEN CAST(SUBSTR(security, 2, LENGTH(security) - 3) AS INT) * 365
+        ELSE 0
 	end,
 	trim(AGENTCODE) as AGENTCODE,--代理人代码
 	trim(AGENTNAME) as AGENTNAME,--代理人名称

+ 7 - 22
sql-achievement/存储过程/生产环境/存储过程.sql

@@ -1072,28 +1072,13 @@ SELECT
 	trim(PRESERVATIONFLAG) as PRESERVATIONFLAG,--保全标志
 	"上海人寿上海分公司",
 	trim(security) as security, --保险期原始值
-	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
+		case
+        when security ='终身' then 42720
+        WHEN security LIKE '%天' THEN CAST(SUBSTR(security, 1, LENGTH(security) - 1) AS INT)
+        WHEN security LIKE '%月' THEN CAST(SUBSTR(security, 1, LENGTH(security) - 1) AS INT) * 30
+        WHEN security LIKE '%年' THEN CAST(SUBSTR(security, 1, LENGTH(security) - 1) AS INT) * 365
+        WHEN security LIKE '%周岁' THEN CAST(SUBSTR(security, 2, LENGTH(security) - 3) AS INT) * 365
+        ELSE 0
 	end,
 	trim(AGENTCODE) as AGENTCODE,--代理人代码
 	trim(AGENTNAME) as AGENTNAME,--代理人名称

+ 8 - 23
sql-achievement/存储过程/生产环境/存储过程——new.sql

@@ -1638,27 +1638,12 @@ SELECT
 	"上海人寿上海分公司",
 	trim(security) as security, --保险期原始值
 	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
+        when security ='终身' then 42720
+        WHEN security LIKE '%天' THEN CAST(SUBSTR(security, 1, LENGTH(security) - 1) AS INT)
+        WHEN security LIKE '%月' THEN CAST(SUBSTR(security, 1, LENGTH(security) - 1) AS INT) * 30
+        WHEN security LIKE '%年' THEN CAST(SUBSTR(security, 1, LENGTH(security) - 1) AS INT) * 365
+        WHEN security LIKE '%周岁' THEN CAST(SUBSTR(security, 2, LENGTH(security) - 3) AS INT) * 365
+        ELSE 0
 	end,
 	trim(AGENTCODE) as AGENTCODE,--代理人代码
 	trim(AGENTNAME) as AGENTNAME,--代理人名称
@@ -2547,7 +2532,7 @@ BEGIN
 		 	salecom,
 		 	salecomname
 		)SELECT row_number()over(),p.customerno,p.contno,p.cvalidate,t.edorappdate ,p.salecom,p.salecomname FROM dsj.lpedoritem t,dsj.policy_information p
-	WHERE t.contno = p.contno and t.edortype='CT' AND t.edorstate = 0 ;
+	WHERE t.contno = p.contno and (t.edortype='CT' OR t.edortype='WT' ) AND t.edorstate = 0 ;
 	dbms_output.put_line('tb_customerinfo函数跑批完成!');
 	EXCEPTION
 			WHEN HIVE_EXCEPTION THEN
@@ -3120,7 +3105,7 @@ BEGIN
 	-- 31. 父母生日提醒	Label78	父亲生日临近 | 母亲生日临近			客户父母生日-当前日期<=5
 	UPDATE shanglifeecif.customerno_salecom_relation si1 SET si1.label78 = (
 		SELECT
-			case max(p.insuredsex)
+			case max(p.insuredsdeleteex)
 				when '0' then '父亲生日临近'
 				when '1' then '母亲生日临近'
 			end as s