Browse Source

目前环境使用sql整理

kouchengxing 4 years ago
parent
commit
2715247d08
23 changed files with 5505 additions and 47 deletions
  1. 155 0
      sql-achievement/存储过程/人寿测试环境使用sql整理/个体关系信息.sql
  2. 23 0
      sql-achievement/存储过程/人寿测试环境使用sql整理/保单件数分布统计.sql
  3. 269 0
      sql-achievement/存储过程/人寿测试环境使用sql整理/保单信息.sql
  4. 380 0
      sql-achievement/存储过程/人寿测试环境使用sql整理/客户信息.sql
  5. 767 0
      sql-achievement/存储过程/人寿测试环境使用sql整理/客户标签koucx20210126.sql
  6. 25 0
      sql-achievement/存储过程/人寿测试环境使用sql整理/年龄段性别分布统计.sql
  7. 96 0
      sql-achievement/存储过程/人寿测试环境使用sql整理/接触信息.sql
  8. 114 0
      sql-achievement/存储过程/人寿测试环境使用sql整理/理赔信息.sql
  9. 53 0
      sql-achievement/存储过程/人寿测试环境使用sql整理/险种大类统计.sql
  10. 25 25
      sql-achievement/存储过程/参与方事件.sql
  11. 380 0
      sql-achievement/存储过程/增量数据处理/客户信息.sql
  12. 364 0
      sql-achievement/存储过程/洛阳测试环境使用sql整理/csv建表语句.sql
  13. 904 0
      sql-achievement/存储过程/洛阳测试环境使用sql整理/es建表语句.sql
  14. 176 0
      sql-achievement/存储过程/洛阳测试环境使用sql整理/个体关系存储过程.sql
  15. 23 0
      sql-achievement/存储过程/洛阳测试环境使用sql整理/保单件数分布统计.sql
  16. 268 0
      sql-achievement/存储过程/洛阳测试环境使用sql整理/保单信息存储过程.sql
  17. 390 0
      sql-achievement/存储过程/洛阳测试环境使用sql整理/客户信息存储过程.sql
  18. 767 0
      sql-achievement/存储过程/洛阳测试环境使用sql整理/客户标签koucx20210126.sql
  19. 25 0
      sql-achievement/存储过程/洛阳测试环境使用sql整理/年龄段性别分布统计.sql
  20. 125 0
      sql-achievement/存储过程/洛阳测试环境使用sql整理/接触信息存储过程.sql
  21. 110 0
      sql-achievement/存储过程/洛阳测试环境使用sql整理/理赔信息储存过程.sql
  22. 53 0
      sql-achievement/存储过程/洛阳测试环境使用sql整理/险种大类统计.sql
  23. 13 22
      sql-achievement/存储过程/理赔qxp.sql

+ 155 - 0
sql-achievement/存储过程/人寿测试环境使用sql整理/个体关系信息.sql

@@ -0,0 +1,155 @@
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_indrelationship_tmp( ) 
+IS
+DECLARE
+	strsql string 
+BEGIN
+	--删除数据
+	DELETE shanglifeecif.indrelationship_tmp;
+	--插入数据
+	INSERT INTO shanglifeecif.indrelationship_tmp(
+		id,
+		RSType,
+		SCustID1,
+		Name1,
+		sex1,
+		IDCard1,
+		Role1,
+		SCustID2,
+		Name2,
+		sex2,
+		IDCard2,
+		RSSTime,
+		Role2
+		)
+	SELECT 
+		row_number()over() AS IRSID,
+		max(RELATIONTOAPPNT) AS RSType,
+		CUSTOMERNO AS IndID1,
+		max(NAME) AS Name1,
+		max(sex) AS sex1,
+		max(IDNO) AS IDCard1,
+		CASE max(RELATIONTOAPPNT) 
+			WHEN '子女' 
+				THEN CASE max(sex) 
+					WHEN 1 THEN '母亲' 
+					WHEN 0 THEN '父亲' 
+				END
+		    WHEN '父母' 
+		    	THEN CASE max(sex) 
+		    		WHEN 1 THEN '女儿' 
+		    		WHEN 0 THEN '儿子' 
+		    	END
+		    WHEN '配偶' 
+		    	THEN CASE max(sex) 
+		    		WHEN 1 THEN '妻子' 
+		    		WHEN 0 THEN '丈夫' 
+		    	END
+		    WHEN '祖父母、外祖父母' 
+		    	THEN CASE max(sex) 
+		    		WHEN 1 THEN '(外)孙女' 
+		    		WHEN 0 THEN '(外)祖孙' 
+		    	END
+		    WHEN '祖孙、外祖孙' 
+		    	THEN CASE max(sex) 
+		    		WHEN 1 THEN '(外)祖母' 
+		    		WHEN 0 THEN '(外)祖父' 
+		    	END
+			ELSE max(RELATIONTOAPPNT) 
+		END AS Role1,
+		INSUREDNO AS IndID2,
+		max(INSUREDNAME) AS Name2,
+		max(insuredsex) AS sex2,
+		max(INSUREDIDNO) AS IDCard2,
+		min(CUSTOMGETPOLDATE) AS RSSTime,
+		CASE max(RELATIONTOAPPNT) 
+			WHEN '子女' 
+				THEN CASE max(INSUREDSEX) 
+					WHEN 1 THEN '女儿' 
+					WHEN 0 THEN '儿子' 
+				END
+		    WHEN '父母' 
+		    	THEN CASE max(INSUREDSEX) 
+		    		WHEN 1 THEN '母亲' 
+		    		WHEN 0 THEN '父亲' 
+		    	END
+		    WHEN '配偶' 
+		    	THEN CASE max(INSUREDSEX) 
+		    		WHEN 1 THEN '妻子' 
+		    		WHEN 0 THEN '丈夫' 
+		    	END
+		    WHEN '祖父母、外祖父母' 
+		    	THEN CASE max(INSUREDSEX) 
+		    		WHEN 1 THEN '(外)祖母' 
+		    		WHEN 0 THEN '(外)祖父' 
+		    	END
+		    WHEN '祖孙、外祖孙' 
+		    	THEN CASE max(INSUREDSEX) 
+		    		WHEN 1 THEN '(外)孙女' 
+		    		WHEN 0 THEN '(外)祖孙' 
+		    	END
+			ELSE max(RELATIONTOAPPNT) 
+		END AS Role2
+	FROM POLICY_INFORMATION 
+	WHERE RELATIONTOAPPNT<>'本人' AND RELATIONTOAPPNT IS NOT NULL
+	GROUP BY CUSTOMERNO,INSUREDNO;
+	
+
+	--更新临时表的indid1 indid2
+	UPDATE shanglifeecif.indrelationship_tmp a set indid1 = 
+		(SELECT b.indid FROM (select 
+			indid,row_number() over(partition by scustid) rn ,SCustID
+		from shanglifeecif.individual) b where a.SCustID1 = b.SCustID AND b.rn = 1);
+	UPDATE shanglifeecif.indrelationship_tmp a set indid2 = 
+		(SELECT b.indid FROM (select 
+			indid,row_number() over(partition by scustid) rn ,SCustID
+		from shanglifeecif.individual) b where a.SCustID2 = b.SCustID AND b.rn = 1);
+
+END;
+
+/
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_indrelationship( ) 
+IS
+DECLARE
+BEGIN
+	
+	DELETE FROM shanglifeecif.indrelationship;
+	--插入数据
+	INSERT INTO shanglifeecif.indrelationship(
+		IRSID, --'个体关系ID' 
+		RSType, --'关系类型 其他、配偶、祖父母、外祖父母、祖孙、外祖孙、本人、父母子女' ,
+		IndID1, --'个体1' ,
+		Name1, --个体1名称
+	
+		IDCard1, --个体1证件号码
+		Role1,--个体1角色 父亲、母亲、儿子、女儿、妻子、丈夫
+		IndID2,--个体2
+		Name2,--个体2名称	sex2,--个体2手机
+		IDCard2,--个体2证件号码
+		Role2,--个体2角色 父亲、母亲、儿子、女儿、妻子、丈夫
+		RSSTime,--开始时间
+		CREATED_BY,--创建人
+		CREATED_TIME--
+		)
+	SELECT 
+		id,
+		RSType,
+		indid1,
+		Name1,
+		IDCard1,
+		Role1,
+		indid2,
+		Name2,
+		IDCard2,
+		Role2,
+		RSSTime,
+		'admin',
+		sysdate
+	FROM shanglifeecif.indrelationship_tmp where indid1 is not null and indid2 is not null
+
+	
+END;
+/
+BEGIN
+	shanglifeecif.init_indrelationship_tmp();
+	shanglifeecif.init_indrelationship();
+end 

+ 23 - 0
sql-achievement/存储过程/人寿测试环境使用sql整理/保单件数分布统计.sql

@@ -0,0 +1,23 @@
+CREATE TABLE shanglifeecif.bdnum_distribution(
+    id string,
+    labelName string  DEFAULT NULL COMMENT '保单件数名称',
+    bdnum string DEFAULT NULL COMMENT '保单件数'
+) COMMENT '保单件数分布'
+STORED AS ES
+with shard number 10
+replication 1;
+
+CREATE OR REPLACE PROCEDURE shanglifeecif.bdnum_distribution() IS
+DECLARE
+BEGIN
+	delete from shanglifeecif.bdnum_distribution;
+	insert into shanglifeecif.bdnum_distribution (
+		id,
+		labelName,
+		bdnum
+	) SELECT row_number()over(),t.labelName,t.bdnum FROM (
+		SELECT si.label25 labelName,count(1) bdnum FROM shanglifeecif.individual si GROUP BY si.label25 
+	) t
+	
+	
+END	;

+ 269 - 0
sql-achievement/存储过程/人寿测试环境使用sql整理/保单信息.sql

@@ -0,0 +1,269 @@
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_insurancearrangement_policy_information() -- 创建主存储过程
+IS    
+BEGIN
+
+INSERT INTO shanglifeecif.insurancearrangement(
+  iaid ,--'保单ID', 
+  policyno ,-- '保险单号 INSURANCEINFO.CONTNO', 
+  pindate ,-- '起保日期 POLICY_INFORMATION.CVALIDATE', 
+  pmdate ,-- '终保日期 POLICY_INFORMATION.ENDDATE', 
+  norenewal ,-- '续保次数 POLICY_INFORMATION.PAYCOUNT', 
+  payment ,-- '缴费方式 POLICY_INFORMATION.PAYINTV', 
+  applicantscustid ,-- '投保人 上游客户号,再找到individualid', 
+  appname ,-- '投保人名称 POLICY_INFORMATION.NAME', 
+  appcertid ,-- '投保人证件号码 POLICY_INFORMATION.IDNO', 
+  insuredscustid ,-- '主被保险人 游客户号', 
+  insname ,-- '主被保险人名称 POLICY_INFORMATION.INSUREDNAME', 
+  inscertid ,-- '主被保险人证件号码 POLICY_INFORMATION.INSUREDIDNO', 
+  productid ,-- '险种代码 POLICY_INFORMATION.RISKCODE', 
+  policybelong ,-- '业绩归属 POLICY_INFORMATION.SALECOM',  
+  payendyear ,-- '缴费年期 POLICY_INFORMATION.PAYENDYEAR', 
+  
+  agrmntage ,--保险期限
+  
+  created_by ,-- '创建人', 
+  created_time -- '创建时间', 
+
+) 
+SELECT 
+	row_number()over(),
+	CONTNO,--policyno ,-- '保险单号 INSURANCEINFO.CONTNO', 
+	CVALIDATE,--pindate ,-- '起保日期 POLICY_INFORMATION.CVALIDATE', 
+	ENDDATE,--pmdate ,-- '终保日期 POLICY_INFORMATION.ENDDATE', 
+	PAYCOUNT,--norenewal ,-- '续保次数 POLICY_INFORMATION.PAYCOUNT', 
+	PAYINTV,--payment ,-- '缴费方式 POLICY_INFORMATION.PAYINTV', 
+	CUSTOMERNO,--applicantid ,-- '投保人 根据POLICY_INFORMATION.CUSTOMERNO关联individual上游客户号,再找到individualid', 
+	NAME,--appname ,-- '投保人名称 POLICY_INFORMATION.NAME', 
+	IDNO,--appcertid ,-- '投保人证件号码 POLICY_INFORMATION.IDNO', 
+	insuredno,--insuredid ,-- '主被保险人 insuredno', 
+	INSUREDNAME,--insname ,-- '主被保险人名称 POLICY_INFORMATION.INSUREDNAME', 
+	INSUREDIDNO,--inscertid ,-- '主被保险人证件号码 POLICY_INFORMATION.INSUREDIDNO', 
+	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
+	end,
+	'admin',
+	sysdate() 
+	FROM policy_information 
+	--更新险种大类
+	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;
+	
+	--更新投保人和被保人id  因为 scustid有重复所以需要去下重
+
+	UPDATE shanglifeecif.insurancearrangement a SET (
+		applicantid --'投保人ID',
+	) = (
+	   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 --'投保人ID',
+	) = (
+	   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 ;
+
+	--更新INSURANCEINFO 表中的信息
+
+	UPDATE shanglifeecif.insurancearrangement a SET (
+		pano ,-- '投保单号 INSURANCEINFO.PRTNO',  
+		pisdate ,-- '签单日期 INSURANCEINFO.SIGNDATE', 
+		padate ,-- '投保日期 INSURANCEINFO.POLAPPLYDATE', 
+		policystate ,--INSURANCEINFO,appflag
+		prem ,-- '总保费 INSURANCEINFO.PREM', 
+		productname ,-- '险种名称	 INSURANCEINFO.RISKNAME'
+		agentchannel -- '代理渠道 INSURANCEINFO.SELLTYPE', 
+	) = (
+		select
+			PRTNO,--pano ,-- '投保单号 INSURANCEINFO.PRTNO',  
+			SIGNDATE,--pisdate ,-- '签单日期 INSURANCEINFO.SIGNDATE', 
+			POLAPPLYDATE,--padate ,-- '投保日期 INSURANCEINFO.POLAPPLYDATE', 
+			appflag,--policystate ,--INSURANCEINFO,appflag
+			PREM,--prem ,-- '总保费 INSURANCEINFO.PREM', 
+			RISKNAME,--productname ,-- '险种名称	 INSURANCEINFO.RISKNAME'
+			SELLTYPE--agentchannel ,-- '代理渠道 INSURANCEINFO.SELLTYPE', 
+		from INSURANCEINFO b
+		where b.contno  = a.policyno
+	) WHERE 1=1 ;
+
+END;
+
+
+/
+DROP TABLE IF EXISTS shanglifeecif.insurancearrangement_health_tmp;
+CREATE TABLE shanglifeecif.insurancearrangement_health_tmp(
+    id string,
+    orderid string  DEFAULT NULL COMMENT '用于分组的排序号',
+    contno string DEFAULT NULL COMMENT '保单号',
+  	AGENTGROUP string DEFAULT NULL COMMENT '承保分公司',--pwcomp ,-- '承保分公司 HEALTH_INSURANCE_LISTING.AGENTGROUPAREA 营业区HEALTH_INSURANCE_LISTING.AGENTGROUP 营业部', 
+	SALECHANNELS string DEFAULT NULL COMMENT '销售渠道',--schannel ,-- '销售渠道 HEALTH_INSURANCE_LISTING.SALECHANNELS 1 2 3 4 5',
+	AMNT string DEFAULT NULL COMMENT '总保额',--risk ,-- '总保额 HEALTH_INSURANCE_LISTING.AMNT(测试环境中,此表保单数据量较其他表如:POLICY_INFORMATION,INSURANCEINFO 缺少至少一个数据量级)', 
+	AGENTCODE  string DEFAULT NULL COMMENT'业务员名称'--spname ,-- '业务员名称 HEALTH_INSURANCE_LISTING.AGENTCODE', 
+) COMMENT '保单处理个险承保清单自助分析 数据临时表 '
+STORED AS ES
+with shard number 10
+replication 1;
+
+
+CREATE OR REPLACE PROCEDURE shanglifeecif.up_insurancearrangement_health_insurance_listing() -- 创建主存储过程
+IS    
+BEGIN
+	--清空临时表数据
+	delete from shanglifeecif.insurancearrangement_health_tmp;
+
+	--初始化临时表
+	insert into shanglifeecif.insurancearrangement_health_tmp (
+		id,
+		orderid,
+		contno,
+		agentgroup,
+		SALECHANNELS,
+		AMNT,
+		AGENTCODE
+	) select 
+		row_number()over(),
+		row_number()over(PARTITION BY contno),
+		contno,
+		agentgroup,
+		SALECHANNELS,
+		AMNT,
+		AGENTCODE
+	from HEALTH_INSURANCE_LISTING
+
+	--根据临时表更新insurancearrangement 表
+	UPDATE shanglifeecif.insurancearrangement a SET (
+		pwcomp ,-- '承保分公司 HEALTH_INSURANCE_LISTING.AGENTGROUPAREA 营业区HEALTH_INSURANCE_LISTING.AGENTGROUP 营业部', 
+		schannel ,-- '销售渠道 HEALTH_INSURANCE_LISTING.SALECHANNELS 1 2 3 4 5',
+		risk ,-- '总保额 HEALTH_INSURANCE_LISTING.AMNT(测试环境中,此表保单数据量较其他表如:POLICY_INFORMATION,INSURANCEINFO 缺少至少一个数据量级)', 
+		spname -- '业务员名称 HEALTH_INSURANCE_LISTING.AGENTCODE', 
+	) = (
+		select
+			b.AGENTGROUP,--pwcomp ,-- '承保分公司 HEALTH_INSURANCE_LISTING.AGENTGROUPAREA 营业区HEALTH_INSURANCE_LISTING.AGENTGROUP 营业部', 
+			b.SALECHANNELS,--schannel ,-- '销售渠道 HEALTH_INSURANCE_LISTING.SALECHANNELS 1 2 3 4 5',
+			b.AMNT,--risk ,-- '总保额 HEALTH_INSURANCE_LISTING.AMNT(测试环境中,此表保单数据量较其他表如:POLICY_INFORMATION,INSURANCEINFO 缺少至少一个数据量级)', 
+			b.AGENTCODE--spname ,-- '业务员名称 HEALTH_INSURANCE_LISTING.AGENTCODE', 
+		from shanglifeecif.insurancearrangement_health_tmp b
+		where b.contno  = a.policyno
+		and b.orderid = 1
+	) 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
+	--根据policy_information 更新保单表
+	shanglifeecif.init_insurancearrangement_policy_information();
+
+	--根据health_insurance_listing 更新相关字段
+	shanglifeecif.up_insurancearrangement_health_insurance_listing();
+
+	--其他标的字段 更新
+	shanglifeecif.up_insurancearrangement_other();
+END;
+/
+BEGIN
+	shanglifeecif.init_insurancearrangement();
+end 

+ 380 - 0
sql-achievement/存储过程/人寿测试环境使用sql整理/客户信息.sql

@@ -0,0 +1,380 @@
+
+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	,--	家庭加分2
+			Awarded2	,--	续期加分
+			Awarded1	,--	保单加分
+			SOValue	,--	总分值
+			EndDate,	--	客户等级失效日期
+			Height,		--身高
+			Weight,		--体重
+			BMI,
+			PIncome,	--个人年收入
+			FIncome,	--家庭年收入
+			IncomeSource,	--收入来源
+			SIStatus,	--社保情况
+			Ethnic,  --民族情况
+			Nation, --国籍
+			MaritalStat, --婚姻
+			Employer,--工作单位
+			Education,--学历
+			Dday, --死亡日期
+			regtype  --户籍类型
+		) = (
+			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
+
+				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 ;
+
+	/*--更新被保人手机号
+	UPDATE shanglifeecif.individual a SET (
+		PMPhone
+	) = (
+		select 
+			INSUREDMOBILE
+			
+		from policy_information b
+		where b.INSUREDNO = a.scustid 
+	) WHERE 1=1 ;*/
+	
+END;
+/
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_individual_main() -- 初始化 数据全部插入
+IS    
+DECLARE
+	individual_count int
+	strsql string
+BEGIN
+	--先验是否一个客户id有多条记录对应不通的证件类别
+	--初始化 身份证 用户
+	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 ;

File diff suppressed because it is too large
+ 767 - 0
sql-achievement/存储过程/人寿测试环境使用sql整理/客户标签koucx20210126.sql


+ 25 - 0
sql-achievement/存储过程/人寿测试环境使用sql整理/年龄段性别分布统计.sql

@@ -0,0 +1,25 @@
+CREATE  TABLE shanglifeecif.age_sex_distribution(
+  id string DEFAULT NULL, 
+  labelname string DEFAULT NULL COMMENT '阶段名称', 
+  gender string DEFAULT NULL COMMENT '性别', 
+  cusnum string DEFAULT NULL COMMENT '客户数量'
+)
+COMMENT '年龄段性别分布'
+STORED AS ES
+with shard number 10
+replication 1;
+
+CREATE OR REPLACE PROCEDURE shanglifeecif.age_sex_distribution() IS
+DECLARE
+BEGIN
+	delete from shanglifeecif.age_sex_distribution;
+	insert into shanglifeecif.age_sex_distribution (
+		id,
+		labelName,
+		gender,
+		cusNum
+	) SELECT row_number()over(),t.labelName,t.gender,t.cusNum FROM (
+	SELECT si.label4 labelName,si.gender,count(1) cusNum FROM shanglifeecif.individual si GROUP BY si.label4,si.gender
+	) t
+			
+END	;

+ 96 - 0
sql-achievement/存储过程/人寿测试环境使用sql整理/接触信息.sql

@@ -0,0 +1,96 @@
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_communication() IS
+DECLARE
+BEGIN
+	DELETE FROM shanglifeecif.communication;
+	insert into shanglifeecif.communication (
+		CommID,
+		CPName,
+		CPPhone,
+		PolicyNo,
+		CommTime,
+		Reason,
+		CommChannel,
+		created_by ,-- '创建人', 
+  		created_time -- '创建时间', 
+	) select 
+   		row_number()over(),
+   		econtactsName,
+		econtactsPhone,
+		contNos,
+		startTime,
+		reasonSecondName,
+		'最近呼入' AS CommChannel,
+		'admin',
+		sysdate()
+	from cc_record_main WHERE contNos IS NOT null;
+	
+END	;
+/
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_communication_sp01() IS
+DECLARE
+BEGIN
+	UPDATE shanglifeecif.communication sc set(
+		sc.RSOApplicant,
+		sc.CompLink,
+		sc.CompReason,
+		sc.ProcedureResult
+	
+	) = (SELECT 
+			temp.complaintsRelation,
+			temp.complaintsLink,
+			temp.resultClassification,
+			temp.procedureResult
+	
+		FROM (
+			
+			SELECT  
+			(CASE scac.complaintsRelation --201  本人 202  子女 203  配偶 204  父母  205 其他
+			WHEN '201' THEN '本人'  
+			WHEN '202' THEN '子女'  
+			WHEN '203' THEN '配偶'  
+			WHEN '204' THEN '父母'  
+			WHEN '205' THEN '其他'  
+			END) AS complaintsRelation,
+			(CASE scac.complaintsLink --:承保环节 : 211 销售环节 :212 、回访环节:213 、保全变更环节: 214 、理赔环节: 215 、售后服务环节: 216
+			WHEN '211' THEN '承保环节'  
+			WHEN '212' THEN '销售环节'  
+			WHEN '213' THEN '回访环节'  
+			WHEN '214' THEN '保全变更环节'  
+			WHEN '215' THEN '理赔环节'  
+			WHEN '216' THEN '售后服务环节'  
+			END) AS complaintsLink,
+			(CASE scac.resultClassification --:销售误导:101  代签名:102  理赔争议:103  服务人员态度:104 售后服务不满:105 售前服务不满:106  外部陌电骚扰:107
+			WHEN '101' THEN '销售误导'  
+			WHEN '102' THEN '代签名'  
+			WHEN '103' THEN '理赔争议'  
+			WHEN '104' THEN '服务人员态度'  
+			WHEN '105' THEN '售后服务不满'  
+			WHEN '106' THEN '售前服务不满'  
+			WHEN '107' THEN '外部陌电骚扰'  
+			END) AS resultClassification,
+			scac.procedureResult,
+			row_number() over(partition by scac.productNos) rn,
+			scac.productNos,
+			scac.complaintsName
+		FROM 
+		cc_action_complaints scac
+		) temp
+		WHERE sc.PolicyNo = temp.productNos AND sc.CPName = temp.complaintsName AND temp.rn = 1)
+	
+END	;
+/
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_communication_sp02() IS
+DECLARE
+BEGIN
+	UPDATE shanglifeecif.communication sc SET(
+	IndID,
+	CPCertID
+	) = (
+	SELECT 
+	ApplicantID,
+	AppCertID
+	FROM 
+	shanglifeecif.InsuranceArrangement sia
+	WHERE sia.PolicyNo = sc.PolicyNo AND sc.RSOApplicant = '本人'
+	)
+END	;

+ 114 - 0
sql-achievement/存储过程/人寿测试环境使用sql整理/理赔信息.sql

@@ -0,0 +1,114 @@
+CREATE OR REPLACE PROCEDURE shanglifeecif.insuranceclaimthread_main() -- 创建主存储过程
+IS    
+BEGIN
+	insert into shanglifeecif.insuranceclaimthread (
+		icthreadid ,--'保险理赔Id',1
+		crno ,--'立案号',2
+		--companyno ,-- '公司代码',
+		policyno ,--'保险单号 INSURANCE_CLAIM.CONTNO',3
+		--applicantid ,--'投保人ID',
+		--appname ,--'投保人名称',
+		--appphone ,--'投保人手机',
+		--appcertid ,--'投保人证件号码 INSURANCE_CLAIM.RISKDATE',
+		cnno ,--'报案号',4
+		losstime ,-- '损失发生时间',5
+		--rpid ,-- '报案人',
+		rpname ,--'报案人名称',6
+		--rpphone ,-- '报案人电话',
+		--lpid ,--'出险人	根据INSURANCE_CLAIM.INSUREDNO获取indid',
+		lpscutid,--'出险人上游客户号7
+		--lpname ,-- '出险人名称',
+		cndate ,--'报案日期 INSURANCE_CLAIM.RPTDATE',
+		lossdescribe ,-- '损失原因 案件发生的原因:INSURANCE_CLAIM.LLOCCURREASON',
+		crdate ,-- '立案日期 INSURANCE_CLAIM.RGTDATE',
+		cndescribe ,--'报案描述 INSURANCE_CLAIM.ACCIDENTDETAIL',
+		claimstatus ,--'理赔状态 案件的状态,例如:录入、已立案等',
+		csdate ,--'理赔状态日期',
+		relationship ,-- '报案人与出险人关系',
+		ccno ,-- '赔案号 AUDIT_CLAIM_INSURANCE.CLMNO',
+		ccstatus ,--'赔案状态',
+		--ccsdate ,-- '赔案状态日期',
+		productid ,--'险种代码	INSURANCE_CLAIM_HEALTH.RISKCODE',
+		productname, --'险种名称	INSURANCE_CLAIM_HEALTH.RISKNAME',
+		ccamt ,--'赔付金额	INSURANCE_CLAIM_HEALTH.realpay',
+		--branchcode,-- '机构代码',
+		claimcasestatus ,--'案件状态INSURANCE_CLAIM_HEALTH.LLCLAIMSTATE',
+		created_by ,
+		created_time 
+		-- updated_time,
+		-- updated_by
+	) select 
+   		row_number()over(),--1
+   		rgtno,--2
+		contno,--3
+		rptno,--报案号4
+		riskdate,--损失发生的时间5
+		rptorname,--报案人名称6
+   		INSUREDNO,--出险人 上游客户号
+   		--lpname,
+		rptdate,
+		lloccurreason,
+		rgtdate,
+		accidentdetail,--报案描述
+		llclaimstate,
+		auditdate,--审批日期
+		relation,
+		clmno,--赔案号
+		llgettype,--赔案状态
+		riskcode,
+		riskname,
+		realpay,
+		llclaimstate,--案件状态
+		'admin',
+		sysdate()
+	from INSURANCE_CLAIM where contno is not null 
+	
+	update shanglifeecif.insuranceclaimthread a set (
+		lpid,
+		lpname
+	) = (SELECT 
+			temp.indid,
+			temp.name
+			FROM (
+				select 
+				b.indid,
+				row_number() over(partition by b.scustid) rn,
+				b.scustid,
+				b.name
+			from shanglifeecif.individual b
+			) temp WHERE a.lpscutid = temp.scustid AND temp.rn = 1);
+
+
+	UPDATE shanglifeecif.insuranceclaimthread a SET (
+			applicantid ,--'投保人ID',
+			appname ,--'投保人名称',
+			appphone ,--'投保人手机',
+			appcertid, --'投保人证件号码 INSURANCE_CLAIM.RISKDATE',
+			branchcode-- '机构代码',
+		) = (
+		
+			SELECT 
+				temp.applicantid ,--'投保人ID',
+				temp.appname ,--'投保人名称',
+				temp.appphone ,--'投保人手机',
+				temp.appcertid, --'投保人证件号码 INSURANCE_CLAIM.RISKDATE',
+				temp.branchcode-- '机构代码',
+			FROM (
+				select 
+				row_number() over(partition by applicantid) rn,
+				applicantid ,--'投保人ID',
+				appname ,--'投保人名称',
+				appphone ,--'投保人手机',
+				appcertid, --'投保人证件号码 INSURANCE_CLAIM.RISKDATE',
+				branchcode,-- '机构代码',
+				policyno
+			from shanglifeecif.insurancearrangement b
+			--where b.policyno  = a.policyno
+			
+			) temp WHERE temp.policyno = a.policyno AND temp.rn = 1);
+
+END;
+/
+BEGIN
+	shanglifeecif.insuranceclaimthread_main();
+end 

+ 53 - 0
sql-achievement/存储过程/人寿测试环境使用sql整理/险种大类统计.sql

@@ -0,0 +1,53 @@
+CREATE TABLE shanglifeecif.riskcode_statistics(
+    id string,
+    kindcode string  DEFAULT NULL COMMENT '险种大类代码',
+    kindNAme string DEFAULT NULL COMMENT '险种大类名称',
+  	khnum string DEFAULT NULL COMMENT '客户数量',--pwcomp ,-- '承保分公司 HEALTH_INSURANCE_LISTING.AGENTGROUPAREA 营业区HEALTH_INSURANCE_LISTING.AGENTGROUP 营业部', 
+	tatolprem string DEFAULT NULL COMMENT '总保额'
+) COMMENT '险种大类统计表'
+STORED AS ES
+with shard number 10
+replication 1;
+
+CREATE OR REPLACE PROCEDURE shanglifeecif.riskcode_statistics() IS
+DECLARE
+BEGIN
+	delete from shanglifeecif.riskcode_statistics;
+	insert into shanglifeecif.riskcode_statistics (
+		id,
+		kindcode,
+		kindNAme,
+		khnum,
+		tatolprem
+	) --险种大类统计
+	SELECT row_number()over(),temp.kindcode,temp.kindname,temp.khnum,temp.totalPrem FROM (
+		SELECT sl.kindcode,
+	(CASE sl.kindcode 
+		WHEN 'A' THEN '意外伤害险' 
+		WHEN 'U' THEN '万能保险' 
+		WHEN 'R' THEN '年金保险' 
+		WHEN 'S' THEN '重疾保险' 
+		WHEN 'L' THEN '人寿保险' 
+		WHEN 'H' THEN '健康险' 
+	END) AS kindname,
+	count(spi.idno) AS khnum,nvl(sum(spi.prem),0) AS totalPrem FROM shanghailifeecif.lmriskapp sl 
+	LEFT JOIN shanghailifeecif.policy_information spi ON spi.riskcode = sl.riskcode
+	GROUP BY sl.kindcode
+	) temp
+	
+	
+	/*SELECT row_number()over(),tt.riskcode,tt.riskname,tt.khnum,tt.totalPrem FROM (
+	SELECT sl.riskcode,sl.riskname,count(spi.idno) AS khnum,sum(spi.prem) AS totalPrem FROM shanghailifeecif.lmriskapp sl 
+	LEFT JOIN shanghailifeecif.policy_information spi ON spi.riskcode = sl.riskcode
+	GROUP BY sl.riskcode,sl.riskname
+	) tt WHERE tt.khnum > 0 AND tt.totalPrem >0*/
+	
+	/*SELECT slk.kindcode,sum(temp.khnum),sum(totalPrem) FROM (
+		SELECT sl.riskcode,sl.riskname,count(spi.idno) AS khnum,sum(spi.prem) AS totalPrem FROM shanghailifeecif.lmriskapp sl 
+	LEFT JOIN shanghailifeecif.policy_information spi ON spi.riskcode = sl.riskcode
+	GROUP BY sl.riskcode,sl.riskname
+	) temp LEFT JOIN shanghailifeecif.lmriskapp slk ON slk.riskcode =  temp.riskcode
+	GROUP BY slk.kindcode*/
+	
+			
+END	;

+ 25 - 25
sql-achievement/存储过程/参与方事件.sql

@@ -47,7 +47,7 @@ COMMENT '保全清单';
 ======================================================================
 =================================目的表结构=================================
 ======================================================================
-CREATE TABLE PartyTimeLine(
+CREATE TABLE shanglifeecif.PartyTimeLine(
     TripID  string NOT NULL  COMMENT '旅程ID' ,
     PartyID string NOT NULL   COMMENT '参与方ID' ,
     Name  string    COMMENT '参与方名称' ,
@@ -74,20 +74,20 @@ replication 1;
 ==================================================初始化数据====================================================================
 
 DROP SEQUENCE IF EXISTS globaleTripID_sequence;
-CREATE OR REPLACE PROCEDURE init_partytimeline_main() -- 创建主存储过程
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_partytimeline_main() -- 创建主存储过程
 IS    
 DECLARE
   partytimeline_count int
   strsql string
 BEGIN
    --1.从保全清单表中初始化 参与事件
-  select count(0) into partytimeline_count from PartyTimeLine;
+  select count(0) into partytimeline_count from shanglifeecif.PartyTimeLine;
   partytimeline_count:=partytimeline_count+1;
   DBMS_OUTPUT.PUT_LINE(partytimeline_count);
   init_PartyTimeLine_edorlist(partytimeline_count)
  
   --2.从保全表中初始化 参与事件
-  select count(0) into partytimeline_count from PartyTimeLine;
+  select count(0) into partytimeline_count from shanglifeecif.PartyTimeLine;
   partytimeline_count:=partytimeline_count+1;
   DBMS_OUTPUT.PUT_LINE(partytimeline_count);
   init_PartyTimeLine_edorinfo(partytimeline_count)
@@ -95,19 +95,19 @@ BEGIN
 
   
   --  3.初始化理赔相关信息
-  select count(0) into partytimeline_count from PartyTimeLine;
+  select count(0) into partytimeline_count from shanglifeecif.PartyTimeLine;
   partytimeline_count:=partytimeline_count+1;
   DBMS_OUTPUT.PUT_LINE(partytimeline_count);
   init_PartyTimeLine_insuranceclaimthread(partytimeline_count)
   
   --  4.初始化投保赔相关信息
-  select count(0) into partytimeline_count from PartyTimeLine;
+  select count(0) into partytimeline_count from shanglifeecif.PartyTimeLine;
   partytimeline_count:=partytimeline_count+1;
   DBMS_OUTPUT.PUT_LINE(partytimeline_count);
   init_PartyTimeLine_InsuranceArrangement(partytimeline_count)
   
   --5.从cc通话中心表中初始化 理赔 保全 咨询 参与事件
-  select count(0) into partytimeline_count from PartyTimeLine;
+  select count(0) into partytimeline_count from shanglifeecif.PartyTimeLine;
   partytimeline_count:=partytimeline_count+1;
   DBMS_OUTPUT.PUT_LINE(partytimeline_count);
   init_PartyTimeLine_cc(partytimeline_count)
@@ -169,7 +169,7 @@ END;
 */
 
 
-CREATE TABLE PartyTimeLine_edor_tmp(
+CREATE TABLE shanglifeecif.PartyTimeLine_edor_tmp(
     id string,
     contno string comment '保单号',
     PartyID string  COMMENT '参与方ID' ,
@@ -191,8 +191,8 @@ CREATE OR REPLACE PROCEDURE init_PartyTimeLine_edorlist(partytimeline_count OUT
 IS    
 BEGIN
   --初始化临时表
-  delete from PartyTimeLine_edor_tmp;
-  insert into PartyTimeLine_edor_tmp(
+  delete from shanglifeecif.PartyTimeLine_edor_tmp;
+  insert into shanglifeecif.PartyTimeLine_edor_tmp(
       id,
       contno,
       appntname,
@@ -207,10 +207,10 @@ BEGIN
     cusappdate,
     edoracceptno,
     edorvalidate
-  from shanghailifeecif.audit_edorlist;
+  from audit_edorlist;
 
   --更新临时表信息
-  UPDATE PartyTimeLine_edor_tmp a SET (
+  UPDATE shanglifeecif.PartyTimeLine_edor_tmp a SET (
       PartyID  ,-- 参与方ID
       PCertID     ,-- 参与方证件号码
       PPhone   
@@ -224,7 +224,7 @@ BEGIN
     ) WHERE 1=1 ;
 
   --更新参与方事件表
-  insert into PartyTimeLine(
+  insert into shanglifeecif.PartyTimeLine(
       TripID,
       PartyID, --参与方id
       Name,
@@ -253,11 +253,11 @@ BEGIN
     edorvalidate,
     'admin',
     sysdate
-  from PartyTimeLine_edor_tmp where PartyID is not null;
+  from shanglifeecif.PartyTimeLine_edor_tmp where PartyID is not null;
 
 
     --已经存在的数据行数
-  select count(0) into partytimeline_count from PartyTimeLine
+  select count(0) into partytimeline_count from shanglifeecif.PartyTimeLine
 
 
   EXCEPTION
@@ -289,12 +289,12 @@ END;
   EDORCVALIDATE     string DEFAULT NULL COMMENT '保全生效日期 '
 */
 
-CREATE OR REPLACE PROCEDURE init_PartyTimeLine_edorinfo(partytimeline_count OUT int) 
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_PartyTimeLine_edorinfo(partytimeline_count OUT int) 
 IS    
 BEGIN
   --初始化临时表
-  delete from PartyTimeLine_edor_tmp;
-  insert into PartyTimeLine_edor_tmp(
+  delete from shanglifeecif.PartyTimeLine_edor_tmp;
+  insert into shanglifeecif.PartyTimeLine_edor_tmp(
       id,
       contno,
       PPhone,
@@ -313,7 +313,7 @@ BEGIN
   from shanghailifeecif.edorinfo;
 
   --更新临时表信息
-  UPDATE PartyTimeLine_edor_tmp a SET (
+  UPDATE shanglifeecif.PartyTimeLine_edor_tmp a SET (
       PartyID  ,-- 参与方ID
       appntname
     ) = (
@@ -325,7 +325,7 @@ BEGIN
     ) WHERE 1=1 ;
 
   --更新参与方事件表
-  insert into PartyTimeLine(
+  insert into shanglifeecif.PartyTimeLine(
       TripID,
       PartyID, --参与方id
       Name,
@@ -354,11 +354,11 @@ BEGIN
     edorvalidate,
     'admin',
     sysdate
-  from PartyTimeLine_edor_tmp where PartyID is not null;
+  from shanglifeecif.PartyTimeLine_edor_tmp where PartyID is not null;
 
 
     --已经存在的数据行数
-  select count(0) into partytimeline_count from PartyTimeLine
+  select count(0) into partytimeline_count from shanglifeecif.PartyTimeLine
 
 
   EXCEPTION
@@ -378,7 +378,7 @@ END;
 CREATE OR REPLACE PROCEDURE init_PartyTimeLine_insuranceclaimthread(partytimeline_count OUT int) 
 IS    
 BEGIN
-  insert into PartyTimeLine(
+  insert into shanglifeecif.PartyTimeLine(
       TripID,
       PartyID, --参与方id
       Name,
@@ -407,10 +407,10 @@ BEGIN
     csdate,
     'admin',
     sysdate
-  from qxp.insuranceclaimthread where applicantid is not null;
+  from shanglifeecif.insuranceclaimthread where applicantid is not null;
 
     --已经存在的数据行数
-  select count(0) into partytimeline_count from PartyTimeLine;
+  select count(0) into partytimeline_count from shanglifeecif.PartyTimeLine;
   
 
 

+ 380 - 0
sql-achievement/存储过程/增量数据处理/客户信息.sql

@@ -0,0 +1,380 @@
+
+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	,--	家庭加分2
+			Awarded2	,--	续期加分
+			Awarded1	,--	保单加分
+			SOValue	,--	总分值
+			EndDate,	--	客户等级失效日期
+			Height,		--身高
+			Weight,		--体重
+			BMI,
+			PIncome,	--个人年收入
+			FIncome,	--家庭年收入
+			IncomeSource,	--收入来源
+			SIStatus,	--社保情况
+			Ethnic,  --民族情况
+			Nation, --国籍
+			MaritalStat, --婚姻
+			Employer,--工作单位
+			Education,--学历
+			Dday, --死亡日期
+			regtype  --户籍类型
+		) = (
+			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
+
+				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 ;
+
+	/*--更新被保人手机号
+	UPDATE shanglifeecif.individual a SET (
+		PMPhone
+	) = (
+		select 
+			INSUREDMOBILE
+			
+		from policy_information b
+		where b.INSUREDNO = a.scustid 
+	) WHERE 1=1 ;*/
+	
+END;
+/
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_individual_main() -- 初始化 数据全部插入
+IS    
+DECLARE
+	individual_count int
+	strsql string
+BEGIN
+	--先验是否一个客户id有多条记录对应不通的证件类别
+	--初始化 身份证 用户
+	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 ;

+ 364 - 0
sql-achievement/存储过程/洛阳测试环境使用sql整理/csv建表语句.sql

@@ -0,0 +1,364 @@
+DROP TABLE IF EXISTS shanghailifeecif.policy_information;
+CREATE TABLE shanghailifeecif.policy_information(
+  contno varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  riskcode varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  riskname varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  riskperiod varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  risktype varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  payintv varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  security varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  payendyear decimal(10,2) DEFAULT NULL, 
+  payendyearflag varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  insuyear decimal(10,2) DEFAULT NULL, 
+  insuyearflag varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  paycount decimal(10,2) DEFAULT NULL, 
+  signdate string DEFAULT NULL, 
+  cvalidate string DEFAULT NULL, 
+  enddate string DEFAULT NULL, 
+  modifydate string DEFAULT NULL, 
+  prem decimal(10,2) DEFAULT NULL, 
+  appflag varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  customerno varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  name varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  sex varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  birthday string DEFAULT NULL, 
+  idtype varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  idno varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  insuredno varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  insuredname varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  insuredsex varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  insuredbirthday string DEFAULT NULL, 
+  insuredidtype varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  insuredidno varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  relationtoappnt varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  salechnl varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  salecom varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  salechannels varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  customgetpoldate string DEFAULT NULL, 
+  prem_js decimal(10,2) DEFAULT NULL, 
+  agentcom varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  paytodate string DEFAULT NULL, 
+  amnt decimal(10,2) DEFAULT NULL, 
+  insuredmobile varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  preservationflag varchar2(2) DEFAULT NULL,  -- dialect: ORACLE
+  newbankcode varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  bankcode varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  insuredbankcode varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  newacctype varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  acctype varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  insuredacctype varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  insert_time string DEFAULT NULL, 
+  modify_time string DEFAULT NULL
+)
+COMMENT 'policy_information'
+STORED AS CSVFILE ;
+
+DROP TABLE IF EXISTS shanghailifeecif.t_customer_class;
+CREATE  TABLE shanghailifeecif.t_customer_class(
+  id int NOT NULL, 
+  customer_id varchar2(200) NOT NULL,  -- dialect: ORACLE
+  customer_name varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  gender varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  birthdate string DEFAULT NULL, 
+  id_type varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  id_no varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  class_value int DEFAULT NULL, 
+  contribution_value decimal(10,2) DEFAULT NULL, 
+  awarded3 decimal(10,2) DEFAULT NULL, 
+  awarded2 decimal(10,2) DEFAULT NULL, 
+  awarded1 decimal(10,2) DEFAULT NULL, 
+  total_value decimal(10,2) DEFAULT NULL, 
+  end_date string DEFAULT NULL, 
+  created_user varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  created_date string DEFAULT NULL, 
+  modified_user varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  modified_date string DEFAULT NULL, 
+  is_delete varchar2(2) DEFAULT NULL,  -- dialect: ORACLE
+  effective_date string DEFAULT NULL, 
+  updateby string DEFAULT NULL, 
+  stature decimal(8,2) DEFAULT NULL, 
+  avoirdupois decimal(8,2) DEFAULT NULL, 
+  dentype varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  yearincome decimal(8,2) DEFAULT NULL, 
+  familyyearsalary decimal(8,2) DEFAULT NULL, 
+  incomesource char(4) DEFAULT NULL,  -- dialect: ORACLE
+  socialinsuflag varchar2(1) DEFAULT NULL,  -- dialect: ORACLE
+  pre_total_value decimal(10,2) DEFAULT NULL, 
+  pre_class_value int DEFAULT NULL, 
+  nationality char(4) DEFAULT NULL,  -- dialect: ORACLE
+  nativeplace char(4) DEFAULT NULL,  -- dialect: ORACLE
+  marriage char(4) DEFAULT NULL,  -- dialect: ORACLE
+  grpname varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  degree char(4) DEFAULT NULL,  -- dialect: ORACLE
+  deathdate string DEFAULT NULL, 
+  zipcode varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  phone varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  postaladdress varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  email varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  mobile varchar2(128) DEFAULT NULL,  -- dialect: ORACLE
+  bmi decimal(8,2) DEFAULT NULL, 
+  insert_time string DEFAULT NULL, 
+  modify_time string DEFAULT NULL
+)
+COMMENT 't_customer_class'
+STORED AS CSVFILE ;
+
+DROP TABLE IF EXISTS shanghailifeecif.insuranceinfo;
+CREATE  TABLE shanghailifeecif.insuranceinfo(
+  contno varchar2(20) DEFAULT NULL,  -- dialect: ORACLE
+  prtno varchar2(20) DEFAULT NULL,  -- dialect: ORACLE
+  prem decimal(10,2) DEFAULT NULL, 
+  riskname varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  riskstyle varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  appflag varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  uwstate varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  agentcom varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  isybt varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  selltype varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  polapplydate string DEFAULT NULL, 
+  scandate string DEFAULT NULL, 
+  scantime varchar2(8) DEFAULT NULL,  -- dialect: ORACLE
+  inputdate string DEFAULT NULL, 
+  inputtime varchar2(8) DEFAULT NULL,  -- dialect: ORACLE
+  signdate string DEFAULT NULL, 
+  signtime varchar2(8) DEFAULT NULL,  -- dialect: ORACLE
+  cvalidate string DEFAULT NULL, 
+  customgetpoldate string DEFAULT NULL, 
+  uwdate string DEFAULT NULL, 
+  uwtime varchar2(8) DEFAULT NULL,  -- dialect: ORACLE
+  appntbirthday string DEFAULT NULL, 
+  isuwpass varchar2(8) DEFAULT NULL,  -- dialect: ORACLE
+  occupationcode varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  occupationname varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  appntage decimal(10,2) DEFAULT NULL, 
+  insuredage decimal(10,2) DEFAULT NULL, 
+  approvedate string DEFAULT NULL, 
+  approvetime varchar2(8) DEFAULT NULL,  -- dialect: ORACLE
+  deliverydate string DEFAULT NULL, 
+  deliverytime varchar2(8) DEFAULT NULL,  -- dialect: ORACLE
+  agentcomname varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  newbankcode varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  username_input varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  username_scan varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  username_approve varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  enteraccdate string DEFAULT NULL, 
+  confmakedate string DEFAULT NULL, 
+  confmaketime varchar2(8) DEFAULT NULL,  -- dialect: ORACLE
+  chargedate string DEFAULT NULL, 
+  chargetime varchar2(8) DEFAULT NULL,  -- dialect: ORACLE
+  isrealtimeflag varchar2(8) DEFAULT NULL,  -- dialect: ORACLE
+  iscleanflag varchar2(8) DEFAULT NULL,  -- dialect: ORACLE
+  isuwstandardflag varchar2(8) DEFAULT NULL,  -- dialect: ORACLE
+  issuetype varchar2(8) DEFAULT NULL,  -- dialect: ORACLE
+  managecom varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  managecomname varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  salechnl varchar2(255) DEFAULT NULL,  -- dialect: ORACLE
+  uwconclusion varchar2(4000) DEFAULT NULL,  -- dialect: ORACLE
+  ins_time string DEFAULT NULL
+)
+COMMENT 'insuranceinfo'
+STORED AS CSVFILE ;
+
+DROP TABLE IF EXISTS shanghailifeecif.personal_insurance;
+CREATE  TABLE shanghailifeecif.personal_insurance(
+  comcode4 varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  comname4 varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  comcode6 varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  comname6 varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  managecom varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  managecomname varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  salesareacode varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  salesareaname varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  branchattr varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  branchattrname varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  salesdepcode varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  salesdepname varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  salesgroupcode varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  salesgroupname varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  agentcode varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  agentname varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  employdate string DEFAULT NULL, 
+  gradename varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  prtno varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  contno varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  riskcode varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  riskname varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  mainattachedriskflag varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  amnt decimal(10,2) DEFAULT NULL, 
+  polapplydate string DEFAULT NULL, 
+  scandate string DEFAULT NULL, 
+  confdate string DEFAULT NULL, 
+  signdate string DEFAULT NULL, 
+  cvalidate string DEFAULT NULL, 
+  customgetpoldate string DEFAULT NULL, 
+  getpoldate string DEFAULT NULL, 
+  overhesitationperiod varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  withdrawaldate string DEFAULT NULL, 
+  wtdate string DEFAULT NULL, 
+  ctdate string DEFAULT NULL, 
+  contstate varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  longpols int DEFAULT NULL, 
+  prem decimal(10,2) DEFAULT NULL, 
+  standprem decimal(10,2) DEFAULT NULL, 
+  annualizedprem decimal(10,2) DEFAULT NULL, 
+  fycryc decimal(10,2) DEFAULT NULL, 
+  payintv varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  payyears int DEFAULT NULL, 
+  polyear int DEFAULT NULL, 
+  conttype varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  contflag varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  calldate string DEFAULT NULL, 
+  agentstate varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  insert_time string DEFAULT NULL, 
+  modify_time string DEFAULT NULL
+)
+COMMENT 'personal_insurance'
+STORED AS CSVFILE ;
+
+DROP TABLE IF EXISTS shanghailifeecif.health_group_listing;
+CREATE TABLE shanghailifeecif.health_group_listing(
+  contno varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  prtno varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  appntno varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  grpname varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  comdocidtype varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  comdocidno varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  validity_date string DEFAULT NULL, 
+  salechnl varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  agentcom varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  agentname varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  riskname varchar2(400) DEFAULT NULL,  -- dialect: ORACLE
+  amnt decimal(10,2) DEFAULT NULL, 
+  paymode varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  chargefeerate decimal(10,2) DEFAULT NULL, 
+  commrate decimal(10,2) DEFAULT NULL, 
+  summanagepremr decimal(10,2) DEFAULT NULL, 
+  prem decimal(10,2) DEFAULT NULL, 
+  peoples3 decimal(10,2) DEFAULT NULL, 
+  cvalidate string DEFAULT NULL, 
+  payenddate string DEFAULT NULL, 
+  signdate string DEFAULT NULL, 
+  sumduepaymoney decimal(10,2) DEFAULT NULL, 
+  nipeople decimal(10,2) DEFAULT NULL, 
+  niprem decimal(10,2) DEFAULT NULL, 
+  ztpeople decimal(10,2) DEFAULT NULL, 
+  ztprem decimal(10,2) DEFAULT NULL, 
+  insert_time string DEFAULT NULL, 
+  modify_time string DEFAULT NULL
+)
+COMMENT 'health_group_listing'
+STORED AS CSVFILE ;
+
+
+DROP TABLE IF EXISTS shanghailifeecif.audit_edorlist;
+CREATE TABLE shanghailifeecif.audit_edorlist(
+  managecom varchar2(64) DEFAULT NULL,  -- dialect: ORACLE
+  managename varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  salechnl varchar2(64) DEFAULT NULL,  -- dialect: ORACLE
+  salechnlname varchar2(64) DEFAULT NULL,  -- dialect: ORACLE
+  selltype varchar2(64) DEFAULT NULL,  -- dialect: ORACLE
+  selltypename varchar2(64) DEFAULT NULL,  -- dialect: ORACLE
+  contno varchar2(64) DEFAULT NULL,  -- dialect: ORACLE
+  riskcodes varchar2(64) DEFAULT NULL,  -- dialect: ORACLE
+  risknames varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  risktypes varchar2(64) DEFAULT NULL,  -- dialect: ORACLE
+  signdate string DEFAULT NULL, 
+  appntname varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  prem decimal(10,2) DEFAULT NULL, 
+  edorname varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  edoracceptno varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  edorno varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  edorvalidate string DEFAULT NULL, 
+  customerhandleflag varchar2(64) DEFAULT NULL,  -- dialect: ORACLE
+  operator varchar2(64) DEFAULT NULL,  -- dialect: ORACLE
+  approveoperator varchar2(64) DEFAULT NULL,  -- dialect: ORACLE
+  getmoney decimal(10,2) DEFAULT NULL, 
+  cusappdate string DEFAULT NULL, 
+  payyears varchar2(64) DEFAULT NULL,  -- dialect: ORACLE
+  agentname varchar2(256) DEFAULT NULL,  -- dialect: ORACLE
+  edorstate varchar2(64) DEFAULT NULL,  -- dialect: ORACLE
+  insert_time string DEFAULT NULL, 
+  modify_time string DEFAULT NULL
+)
+COMMENT 'audit_edorlist'
+STORED AS CSVFILE ;
+
+DROP TABLE IF EXISTS shanghailifeecif.insurance_claim;
+CREATE  TABLE shanghailifeecif.insurance_claim(
+  batno varchar2(40) DEFAULT NULL,  -- dialect: ORACLE
+  contno varchar2(40) DEFAULT NULL,  -- dialect: ORACLE
+  clmno varchar2(40) DEFAULT NULL,  -- dialect: ORACLE
+  cvalidate string DEFAULT NULL, 
+  riskdate string DEFAULT NULL, 
+  ageofdanger decimal(3,0) DEFAULT NULL, 
+  riskcode varchar2(40) DEFAULT NULL,  -- dialect: ORACLE
+  riskname varchar2(512) DEFAULT NULL,  -- dialect: ORACLE
+  lloccurreason varchar2(512) DEFAULT NULL,  -- dialect: ORACLE
+  accresult1 varchar2(512) DEFAULT NULL,  -- dialect: ORACLE
+  accresult2 varchar2(512) DEFAULT NULL,  -- dialect: ORACLE
+  accidentdetail varchar2(512) DEFAULT NULL,  -- dialect: ORACLE
+  llgettype varchar2(512) DEFAULT NULL,  -- dialect: ORACLE
+  realpay decimal(12,2) DEFAULT NULL, 
+  applydate string DEFAULT NULL, 
+  accepteddate string DEFAULT NULL, 
+  rptdate string DEFAULT NULL, 
+  rgtdate string DEFAULT NULL, 
+  auditdate string DEFAULT NULL, 
+  examdate string DEFAULT NULL, 
+  senddate string DEFAULT NULL, 
+  returndate string DEFAULT NULL, 
+  llclaimstate varchar2(512) DEFAULT NULL,  -- dialect: ORACLE
+  operator varchar2(512) DEFAULT NULL,  -- dialect: ORACLE
+  auditper varchar2(512) DEFAULT NULL,  -- dialect: ORACLE
+  examper varchar2(512) DEFAULT NULL,  -- dialect: ORACLE
+  isinvestigated varchar2(10) DEFAULT NULL,  -- dialect: ORACLE
+  idno varchar2(40) DEFAULT NULL,  -- dialect: ORACLE
+  insuredname varchar2(40) DEFAULT NULL,  -- dialect: ORACLE
+  isfromwx varchar2(10) DEFAULT NULL,  -- dialect: ORACLE
+  insuredno varchar2(40) DEFAULT NULL,  -- dialect: ORACLE
+  amnt decimal(12,2) DEFAULT NULL, 
+  managecom varchar2(10) DEFAULT NULL,  -- dialect: ORACLE
+  estimatedreparations varchar2(40) DEFAULT NULL,  -- dialect: ORACLE
+  risktype varchar2(40) DEFAULT NULL,  -- dialect: ORACLE
+  getdutycode varchar2(40) DEFAULT NULL,  -- dialect: ORACLE
+  getdutyname varchar2(512) DEFAULT NULL,  -- dialect: ORACLE
+  salechnl varchar2(40) DEFAULT NULL,  -- dialect: ORACLE
+  accname varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  accidenttype varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  enddate string DEFAULT NULL, 
+  salechnl2 varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  insuredsex varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  insuredjob varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  paystatus varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  rgtno varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  rptno varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  rptorname varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  relation varchar2(200) DEFAULT NULL,  -- dialect: ORACLE
+  accdesc varchar2(2000) DEFAULT NULL,  -- dialect: ORACLE
+  accdentdesc varchar2(2000) DEFAULT NULL,  -- dialect: ORACLE
+  insert_time string DEFAULT NULL, 
+  modify_time string DEFAULT NULL
+)
+COMMENT 'insurance_claim'
+STORED AS CSVFILE ;
+
+
+服务器操作命令  
+	初始化命令      source /home/xinghuan-install/TDH-Client/init.sh   (bash: hdfs: 未找到命令...出现后执行初始化命令)
+	上传文件命令    
+	hdfs dfs -put /home/frontData/policy_information.txt /tmp/myData/
+	hdfs dfs -put /home/frontData/t_customer_class.txt /tmp/myData/
+	hdfs dfs -put /home/frontData/insuranceinfo.txt /tmp/myData/
+	hdfs dfs -put /home/frontData/personal_insurance.txt /tmp/myData/
+	hdfs dfs -put /home/frontData/health_group_listing.txt /tmp/myData/
+	hdfs dfs -put /home/frontData/audit_edorlist.txt /tmp/myData/
+	hdfs dfs -put /home/frontData/insurance_claim.txt /tmp/myData/
+
+数据库操作命令加载数据:
+LOAD DATA INPATH '/tmp/myData/policy_information.txt' OVERWRITE INTO TABLE shanghailifeecif.policy_information;
+LOAD DATA INPATH '/tmp/myData/t_customer_class.txt' OVERWRITE INTO TABLE shanghailifeecif.t_customer_class;
+LOAD DATA INPATH '/tmp/myData/insuranceinfo.txt' OVERWRITE INTO TABLE shanghailifeecif.insuranceinfo;
+LOAD DATA INPATH '/tmp/myData/personal_insurance.txt' OVERWRITE INTO TABLE shanghailifeecif.personal_insurance;
+LOAD DATA INPATH '/tmp/myData/health_group_listing.txt' OVERWRITE INTO TABLE shanghailifeecif.health_group_listing;
+LOAD DATA INPATH '/tmp/myData/audit_edorlist.txt' OVERWRITE INTO TABLE shanghailifeecif.audit_edorlist;
+LOAD DATA INPATH '/tmp/myData/insurance_claim.txt' OVERWRITE INTO TABLE shanghailifeecif.insurance_claim;

+ 904 - 0
sql-achievement/存储过程/洛阳测试环境使用sql整理/es建表语句.sql

@@ -0,0 +1,904 @@
+-- 创建ES表。
+DROP TABLE IF EXISTS shanglifeecif.individual;
+CREATE TABLE shanglifeecif.Individual(
+   
+    IndID STRING  COMMENT '个体ID' ,
+    CustID STRING    COMMENT '客户号 本系统统一生成的全司范围的唯一标识' ,
+    SCustID STRING    COMMENT '上游客户号 上游系统的客户ID' ,
+    Name STRING    COMMENT '名称 T_CUSTOMER_CLASS.CUSTOMER_NAME' ,
+    Birthday STRING    COMMENT '出生日期 T_CUSTOMER_CLASS.BIRTHDATE' ,
+    NOBirth STRING    COMMENT '出生国家' ,
+    SOBirth STRING    COMMENT '出生省份' ,
+    COBirth STRING   COMMENT '出生城市' ,
+    Dday STRING    COMMENT '死亡日期' ,
+    Gender STRING    COMMENT '性别 GB/T 2261.1-2003规定的一位数字代码执行,前三位填充G00: G000:未知的性别; G001:男性; G002:女性 ; G009:未说明的性别 ';
+    Ethnic STRING    COMMENT '民族' ,
+    Nation STRING    COMMENT '国籍' ,
+    HomeAdress STRING    COMMENT '籍贯 UNDERWRITE_REPORT_LIST.POLICY_HOLDER_ADDRESS' ,
+    RegResidence STRING    COMMENT '户口所在地' ,
+    MaritalStat STRING    COMMENT '婚姻状况 一对多' ,
+    MaritalStatDate STRING    COMMENT '婚姻状况日期 一对多' ,
+    Offspring STRING    COMMENT '生育状况' ,
+    Support STRING   COMMENT '赡养状况' ,
+    EmpStat STRING    COMMENT '就业状况 一对多' ,
+    EmpStatDate STRING    COMMENT '就业状况日期 一对多' ,
+    RAID STRING   COMMENT '联系地址' ,
+    RAL STRING    COMMENT '联系地址不分段' ,
+    AL STRING    COMMENT '曾用地址不分段' ,
+    COAdress INT    COMMENT '地址登录数量' ,
+    PMPhone STRING    COMMENT '常用手机 正在使用的手机' ,
+    Mhone1 STRING    COMMENT '曾用手机1' ,
+    Mhone2 STRING    COMMENT '曾用手机2' ,
+    SOPhone INT    COMMENT '手机登录数量' ,
+    Height double    COMMENT '身高' ,
+    Weight double    COMMENT '体重' ,
+    CIllness STRING    COMMENT '当前疾病' ,
+    PIllness STRING    COMMENT '曾患疾病' ,
+    CDiseases STRING    COMMENT '先天性疾病' ,
+    BMI double    COMMENT 'BMI体制指数' ,
+    FMHistory STRING    COMMENT '家族病史' ,
+    EvaDate STRING    COMMENT '健康评估日期' ,
+    COHEvaluation INT    COMMENT '健康评估登录数量' ,
+    HPhone STRING    COMMENT '家庭电话' ,
+    OccupationId STRING    COMMENT '职业代码 UNDERWRITE_REPORT_LIST.POLICY_HOLDER_CODE' ,
+    Occupation STRING    COMMENT '职业名称 UNDERWRITE_REPORT_LIST.POLICY_HOLDER_NAME' ,
+    Odate STRING    COMMENT '职业时间 一对多' ,
+    Employer STRING    COMMENT '工作单位' ,
+    WPhone STRING    COMMENT '工作电话' ,
+    EmpDate STRING    COMMENT '工作单位时间' ,
+    LEmployer STRING    COMMENT '曾经工作单位' ,
+    IDCard STRING    COMMENT '身份证 code	codename' ,
+    Passport STRING    COMMENT '护照' ,
+    Dlicense STRING    COMMENT '驾驶证' ,
+    Education STRING    COMMENT '最高学历' ,
+    University STRING    COMMENT '毕业学校' ,
+    Edate STRING    COMMENT '学历时间' ,
+    Wechat STRING    COMMENT '微信' ,
+    Weibo STRING    COMMENT '微博' ,
+    Email STRING    COMMENT '邮箱' ,
+    QQ STRING    COMMENT 'QQ' ,
+    Tiktok STRING    COMMENT '抖音' ,
+    SAccount1 STRING    COMMENT '社交账号1' ,
+    SA1Cat STRING    COMMENT '社交账号1类别' ,
+    SAccount2 STRING    COMMENT '社交账号2' ,
+    SA2Cat STRING    COMMENT '社交账号2类别' ,
+    CType STRING    COMMENT '首选联系方式 手机,微信,微博,邮箱,QQ,抖音,其他' ,
+    Father STRING    COMMENT '父亲 HEALTH_INSURANCE_LISTING.INSUREDNAME HEALTH_INSURANCE_LISTING.RELATION:投保人与被保人关系' ,
+    Mother STRING    COMMENT '母亲' ,
+    Mate STRING    COMMENT '配偶' ,
+    child1 STRING    COMMENT '子女1' ,
+    child2 STRING    COMMENT '子女2' ,
+    COChild INT    COMMENT '子女登录数量' ,
+    RPID STRING    COMMENT '房产' ,
+    RPDescribe STRING    COMMENT '房产描述' ,
+    CORP INT    COMMENT '房产登录数量' ,
+    VID STRING    COMMENT '车辆' ,
+    VDescribe STRING    COMMENT '车辆描述' ,
+    COVehicle INT    COMMENT '车辆登录数量' ,
+    Anniversary1 STRING    COMMENT '纪念日1' ,
+    A1Describe STRING    COMMENT '纪念日1类型' ,
+    Anniversary2 STRING    COMMENT '纪念日2' ,
+    A2Describe STRING    COMMENT '纪念日2类型' ,
+    SOAnniversary INT    COMMENT '纪念日登录数量' ,
+    CustType STRING    COMMENT '客户类型' ,
+    BankName STRING    COMMENT '开户银行' ,
+    TOBankCard STRING    COMMENT '银行卡类型 如:master、visa、银联等。' ,
+    AccName STRING    COMMENT '账户名' ,
+    BankAccNo STRING    COMMENT '银行帐号' ,
+    COBAccount INT    COMMENT '账户登录数量' ,
+    SOTLIRisk double    COMMENT '传统寿险种保额合计' ,
+    SOAIRisk double    COMMENT '意外类险种保额合计' ,
+    SOSIIRisk double    COMMENT '重疾类险种保额合计' ,
+    SOMCIRisk double    COMMENT '医疗费用类险种保额合计' ,
+    SOMEIRisk double    COMMENT '医疗补贴类险种保额合计' ,
+    SOEFIRisk double    COMMENT '教育金类险种保额合计' ,
+    SOPIRisk double   COMMENT '养老金类险种保额合计' ,
+    SOWMIRisk double    COMMENT '财富管理险种保额合计' ,
+    CustClass INT    COMMENT '客户等级 T_CUSTOMER_CLASS.CLASS_VALUE' ,
+    ConValue INT    COMMENT '贡献度分' ,
+    Awarded3 INT    COMMENT '家庭加分' ,
+    Awarded2 INT    COMMENT '续期加分' ,
+    Awarded1 INT    COMMENT '保单加分' ,
+    SOValue INT    COMMENT '总分值' ,
+    EndDate STRING    COMMENT '客户等级失效日期' ,
+    SystemTag1 STRING    COMMENT '系统标签域1' ,
+    SystemTag2 STRING    COMMENT '系统标签域2' ,
+    SystemTag3 STRING    COMMENT '系统标签域3' ,
+    SystemTag4 STRING    COMMENT '系统标签域4' ,
+    SystemTag5 STRING    COMMENT '系统标签域5' ,
+    COCommunication INT    COMMENT '接触次数' ,
+    LCDate STRING    COMMENT '最近接触时间' ,
+    LCType STRING    COMMENT '最近接触类型 投诉、问询、营销' ,
+    LCMethod STRING    COMMENT '最近接触方式 外呼、呼入' ,
+    COComplaint INT    COMMENT '投诉次数 当前客户投保保单相关投诉,包括非本人投诉' ,
+    LCPTDate STRING    COMMENT '最近投诉时间 当前客户投保保单相关投诉,包括非本人投诉' ,
+    LCPTReason STRING    COMMENT '最近投诉原因 当前客户投保保单相关投诉,包括非本人投诉' ,
+    LCPTLink STRING    COMMENT '最近投诉环节 当前客户投保保单相关投诉,包括非本人投诉' ,
+    LCPTResult STRING    COMMENT '最近投诉处理结果 当前客户投保保单相关投诉,包括非本人投诉' ,
+    LCPTDuration double    COMMENT '最近投诉处理时长 当前客户投保保单相关投诉,包括非本人投诉' ,
+    LCPTPerson STRING    COMMENT '最近投诉人' ,
+    SOPPremium double    COMMENT '累计已缴保费' ,
+    LAPPDate STRING    COMMENT '最近投保日期' ,
+    CNDate STRING    COMMENT '最近报案日期' ,
+    CNStatus STRING    COMMENT '最近报案状态' ,
+    COClaim INT    COMMENT '赔付次数' ,
+    SOClaim double   COMMENT '赔付总额' ,
+    COCNotification INT    COMMENT '报案登录数量' ,
+    FADate STRING    COMMENT '首次投保日期 当前客户为投保人时' ,
+    FAChannel STRING    COMMENT '首张保单所属渠道 InsuranceArrangement.AgentChannel' ,
+    FAOrg STRING    COMMENT '首张保单所属机构 InsuranceArrangement.AgentOrg' ,
+    LPNo STRING    COMMENT '最近保险单号 当前客户为投保人时' ,
+    LPState STRING    COMMENT '最近保单状态 当前客户为投保人时' ,
+    LPName STRING    COMMENT '最近投保险种名称 当前客户为投保人时' ,
+    LPChannel STRING    COMMENT '最近保单所属渠道 InsuranceArrangement.AgentChannel' ,
+    LPOrg STRING    COMMENT '最近保单所属机构 InsuranceArrangement.AgentOrg' ,
+    COPolicy INT    COMMENT '保单登录数量' ,
+    LPOSType STRING    COMMENT '最近保全类型 AUDIT_EDORLIST.EDORNAME' ,
+    IAccNo1 STRING    COMMENT '保险账户1' ,
+    IAccName1 STRING    COMMENT '保险账户1名称' ,
+    IAccNo2 STRING    COMMENT '保险账户2' ,
+    IAccName2 STRING    COMMENT '保险账户2名称' ,
+    IAccNo3 STRING    COMMENT '保险账户3' ,
+    IAccName3 STRING    COMMENT '保险账户3名称' ,
+    SOIAccount1 double    COMMENT '保险账户1余额' ,
+    SOIAccount2 double    COMMENT '保险账户2余额' ,
+    SOIAccount3 double    COMMENT '保险账户3余额' ,
+    COIAccount INT    COMMENT '保险账户登录数量' ,
+    HOMEID STRING    COMMENT '家庭号 大数据平台HOME_NETWORK' ,
+    BranchCode STRING    COMMENT '机构代码 数据归属机构,用于权限控制' ,
+    CustState STRING    COMMENT '客户状态 party可能会合并导致当前记录不再可用' ,
+    DataSource STRING    COMMENT '数据来源' ,
+    Smoking STRING    COMMENT '吸烟情况 从不、戒烟、吸烟' ,
+    Drinking STRING    COMMENT '饮酒情况 从不、戒酒、饮酒' ,
+    Pregnancy STRING    COMMENT '怀孕情况' ,
+    Hobby1 STRING    COMMENT '兴趣爱好1' ,
+    Hobby2 STRING    COMMENT '兴趣爱好2' ,
+    Hobby3 STRING    COMMENT '兴趣爱好3' ,
+    PIncome double   COMMENT '个人年收入' ,
+    FIncome double    COMMENT '家庭年收入' ,
+	regtype string    COMMENT '户籍类型', 
+    IncomeSource STRING    COMMENT '收入来源' ,
+    SIStatus STRING    COMMENT '社保情况' ,
+    NOVPolicy INT    COMMENT '有效保单件数' ,
+    NOIVPolicy INT    COMMENT '失效保单件数' ,
+    NOSTInsurance STRING    COMMENT '短意险保单持有情况 仅持有短意险保单,持有短意险保单,无短意险保单' ,
+    NOSPInsurance STRING    COMMENT '趸交保单持有情况 仅持有趸交保单,持有趸交保单,无趸交保单' ,
+    ISelf STRING    COMMENT '本人投保情况 仅本人投保,本人已投保,本人未投保' ,
+    IParent STRING    COMMENT '父母投保情况 仅父母投保,父母已投保,父母未投保' ,
+    IChildren STRING    COMMENT '子女投保情况 仅子女投保,子女已投保,子女未·投保' ,
+    Imate STRING    COMMENT '配偶投保情况 仅配偶投保,配偶已投保,配偶未投保' ,
+	policybelong STRING  COMMENT '业绩归属', 
+     CREATED_BY STRING   COMMENT '创建人' ,
+    CREATED_TIME DATE    COMMENT '创建时间' ,
+    UPDATED_BY STRING    COMMENT '更新人' ,
+    UPDATED_TIME DATE    COMMENT '更新时间' ,
+    Label1 STRING    COMMENT 'Label1' ,
+    Label2 STRING    COMMENT 'Label2' ,
+    Label3 STRING    COMMENT 'Label3' ,
+    Label4 STRING    COMMENT 'Label4' ,
+    Label5 STRING    COMMENT 'Label5' ,
+    Label6 STRING    COMMENT 'Label6' ,
+    Label7 STRING    COMMENT 'Label7' ,
+    Label8 STRING    COMMENT 'Label8' ,
+    Label9 STRING    COMMENT 'Label9' ,
+    Label10 STRING    COMMENT 'Label10' ,
+    Label11 STRING    COMMENT 'Label11' ,
+    Label12 STRING    COMMENT 'Label12' ,
+    Label13 STRING    COMMENT 'Label13' ,
+    Label14 STRING    COMMENT 'Label14' ,
+    Label15 STRING    COMMENT 'Label15' ,
+    Label16 STRING    COMMENT 'Label16' ,
+    Label17 STRING    COMMENT 'Label17' ,
+    Label18 STRING    COMMENT 'Label18' ,
+    Label19 STRING    COMMENT 'Label19' ,
+    Label20 STRING    COMMENT 'Label20' ,
+    Label21 STRING    COMMENT 'Label21' ,
+    Label22 STRING    COMMENT 'Label22' ,
+    Label23 STRING    COMMENT 'Label23' ,
+    Label24 STRING    COMMENT 'Label24' ,
+    Label25 STRING    COMMENT 'Label25' ,
+    Label26 STRING    COMMENT 'Label26' ,
+    Label27 STRING    COMMENT 'Label27' ,
+    Label28 STRING    COMMENT 'Label28' ,
+    Label29 STRING    COMMENT 'Label29' ,
+    Label30 STRING    COMMENT 'Label30' ,
+    Label31 STRING    COMMENT 'Label31' ,
+    Label32 STRING    COMMENT 'Label32' ,
+    Label33 STRING    COMMENT 'Label33' ,
+    Label34 STRING    COMMENT 'Label34' ,
+    Label35 STRING    COMMENT 'Label35' ,
+    Label36 STRING    COMMENT 'Label36' ,
+    Label37 STRING    COMMENT 'Label37' ,
+    Label38 STRING    COMMENT 'Label38' ,
+    Label39 STRING    COMMENT 'Label39' ,
+    Label40 STRING    COMMENT 'Label40' ,
+    Label41 STRING    COMMENT 'Label41' ,
+    Label42 STRING    COMMENT 'Label42' ,
+    Label43 STRING    COMMENT 'Label43' ,
+    Label44 STRING    COMMENT 'Label44' ,
+    Label45 STRING    COMMENT 'Label45' ,
+    Label46 STRING    COMMENT 'Label46' ,
+    Label47 STRING    COMMENT 'Label47' ,
+    Label48 STRING    COMMENT 'Label48' ,
+    Label49 STRING    COMMENT 'Label49' ,
+    Label50 STRING    COMMENT 'Label50' ,
+    Label51 STRING    COMMENT 'Label51' ,
+    Label52 STRING    COMMENT 'Label52' ,
+    Label53 STRING    COMMENT 'Label53' ,
+    Label54 STRING    COMMENT 'Label54' ,
+    Label55 STRING    COMMENT 'Label55' ,
+    Label56 STRING    COMMENT 'Label56' ,
+    Label57 STRING    COMMENT 'Label57' ,
+    Label58 STRING    COMMENT 'Label58' ,
+    Label59 STRING    COMMENT 'Label59' ,
+    Label60 STRING    COMMENT 'Label60' ,
+    Label61 STRING    COMMENT 'Label61' ,
+    Label62 STRING    COMMENT 'Label62' ,
+    Label63 STRING    COMMENT 'Label63' ,
+    Label64 STRING    COMMENT 'Label64' ,
+    Label65 STRING    COMMENT 'Label65' ,
+    Label66 STRING    COMMENT 'Label66' ,
+    Label67 STRING    COMMENT 'Label67' ,
+    Label68 STRING    COMMENT 'Label68' ,
+    Label69 STRING    COMMENT 'Label69' ,
+    Label70 STRING    COMMENT 'Label70' ,
+    Label71 STRING    COMMENT 'Label71' ,
+    Label72 STRING    COMMENT 'Label72' ,
+    Label73 STRING    COMMENT 'Label73' ,
+    Label74 STRING    COMMENT 'Label74' ,
+    Label75 STRING    COMMENT 'Label75' ,
+    Label76 STRING    COMMENT 'Label76' ,
+    Label77 STRING    COMMENT 'Label77' ,
+    Label78 STRING    COMMENT 'Label78' ,
+    Label79 STRING    COMMENT 'Label79' ,
+    Label80 STRING    COMMENT 'Label80' ,
+    Label81 STRING    COMMENT 'Label81' ,
+    Label82 STRING    COMMENT 'Label82' ,
+    Label83 STRING    COMMENT 'Label83' ,
+    Label84 STRING    COMMENT 'Label84' ,
+    Label85 STRING    COMMENT 'Label85' ,
+    Label86 STRING    COMMENT 'Label86' ,
+    Label87 STRING    COMMENT 'Label87' ,
+    Label88 STRING    COMMENT 'Label88' ,
+    Label89 STRING    COMMENT 'Label89' ,
+    Label90 STRING    COMMENT 'Label90' ,
+    Label91 STRING    COMMENT 'Label91' ,
+    Label92 STRING    COMMENT 'Label92' ,
+    Label93 STRING    COMMENT 'Label93' ,
+    Label94 STRING    COMMENT 'Label94' ,
+    Label95 STRING    COMMENT 'Label95' ,
+    Label96 STRING    COMMENT 'Label96' ,
+    Label97 STRING    COMMENT 'Label97' ,
+    Label98 STRING    COMMENT 'Label98' ,
+    Label99 STRING    COMMENT 'Label99' ,
+    Label100 STRING    COMMENT 'Label100' ,
+    Label101 STRING    COMMENT 'Label101' ,
+    Label102 STRING    COMMENT 'Label102' ,
+    Label103 STRING    COMMENT 'Label103' ,
+    Label104 STRING    COMMENT 'Label104' ,
+    Label105 STRING    COMMENT 'Label105' ,
+    Label106 STRING    COMMENT 'Label106' ,
+    Label107 STRING    COMMENT 'Label107' ,
+    Label108 STRING    COMMENT 'Label108' ,
+    Label109 STRING    COMMENT 'Label109' ,
+    Label110 STRING    COMMENT 'Label110' ,
+    Label111 STRING    COMMENT 'Label111' ,
+    Label112 STRING    COMMENT 'Label112' ,
+    Label113 STRING    COMMENT 'Label113' ,
+    Label114 STRING    COMMENT 'Label114' ,
+    Label115 STRING    COMMENT 'Label115' ,
+    Label116 STRING    COMMENT 'Label116' ,
+    Label117 STRING    COMMENT 'Label117' ,
+    Label118 STRING    COMMENT 'Label118' ,
+    Label119 STRING    COMMENT 'Label119' ,
+    Label120 STRING    COMMENT 'Label120' ,
+    PRIMARY KEY (IndID)
+) COMMENT '个人信息 '
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.Adress;
+CREATE  TABLE shanglifeecif.Adress(
+AID	string	DEFAULT NULL COMMENT '	地址ID	',
+PartyID	string		DEFAULT NULL COMMENT '	参与方ID	',
+PartyName	string		DEFAULT NULL COMMENT '	参与方名称	',
+PartyPhone	string		DEFAULT NULL COMMENT '	参与方手机号',
+PartyIDCard	string		DEFAULT NULL COMMENT '	参与方证件号码',
+ACountry	string		DEFAULT NULL COMMENT '	地址_国家	',
+AState	string		DEFAULT NULL COMMENT '	地址_省	',
+ACity	string		DEFAULT NULL COMMENT '	地址_市县	',
+ATown	string		DEFAULT NULL COMMENT '	地址_区镇	',
+AStreet	string		DEFAULT NULL COMMENT '	地址_街道	',
+AStreetNo	string		DEFAULT NULL COMMENT '	地址_门牌号	',
+APostCode	string		DEFAULT NULL COMMENT '	地址_邮政编码	',
+APhone	string		DEFAULT NULL COMMENT '	地址_电话	',
+ADescribe	string		DEFAULT NULL COMMENT '	地址描述	',
+ADate	DATE		DEFAULT NULL COMMENT '	地址时间	',
+Longitude	string		DEFAULT NULL COMMENT '	经度	',
+Latitude	string		DEFAULT NULL COMMENT '	纬度	',
+AType	string	DEFAULT NULL COMMENT '	地址类型	',
+CREATED_BY	string		DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	DATE		DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string		DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	DATE		DEFAULT NULL COMMENT '	更新时间	'
+)
+COMMENT '地址信息'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.Organisation;
+CREATE  TABLE shanglifeecif.Organisation(
+
+OID	string	DEFAULT NULL COMMENT '	团体ID	',
+CustID	string	DEFAULT NULL COMMENT '	客户ID	',
+SCustID	string	DEFAULT NULL COMMENT '	上游客户ID	',
+Name	string	DEFAULT NULL COMMENT '	名称	',
+OCID	string	DEFAULT NULL COMMENT '	联系人	',
+OCName	string	DEFAULT NULL COMMENT '	联系人姓名	',
+OCPhone	string	DEFAULT NULL COMMENT '	联系人电话	',
+OFCID	string	DEFAULT NULL COMMENT '	财务联系人	',
+OFCName	string	DEFAULT NULL COMMENT '	财务联系人姓名	',
+OFCPhone	string	DEFAULT NULL COMMENT '	财务联系人电话	',
+OLevel	string	DEFAULT NULL COMMENT '	组织层级	',
+SCCode	string	DEFAULT NULL COMMENT '	统一社会信用代码	',
+OLPerson	string	DEFAULT NULL COMMENT '	法人	',
+BizType	string	DEFAULT NULL COMMENT '	行业类型	',
+RegDate	DATE	DEFAULT NULL COMMENT '	注册日期	',
+LegalStruct	string	DEFAULT NULL COMMENT '	企业性质	',
+RegAddress	string	DEFAULT NULL COMMENT '	注册地址	',
+RegFun	double	DEFAULT NULL COMMENT '	注册资金	',
+NuOfEmployees	INT	DEFAULT NULL COMMENT '	员工人数	',
+OState	string	DEFAULT NULL COMMENT '	经营状况	',
+OSDate	DATE	DEFAULT NULL COMMENT '	经营状况日期	',
+BranchCode	string	DEFAULT NULL COMMENT '	机构代码	',
+systemtag1 string DEFAULT NULL COMMENT '系统标签域1', 
+systemtag2 string DEFAULT NULL COMMENT '系统标签域2', 
+systemtag3 string DEFAULT NULL COMMENT '系统标签域3', 
+Wechat1	string	DEFAULT NULL COMMENT '	微信公众号	',
+Wechat2	string	DEFAULT NULL COMMENT '	微信服务号	',
+weibo string DEFAULT NULL COMMENT '微博', 
+  email string DEFAULT NULL COMMENT '邮箱', 
+  qq string DEFAULT NULL COMMENT 'QQ', 
+  tiktok string DEFAULT NULL COMMENT '抖音', 
+  saccount1 string DEFAULT NULL COMMENT '社交账号1', 
+  sa1cat string DEFAULT NULL COMMENT '社交账号1类别',  -- dialect: ORACLE
+  saccount2 string DEFAULT NULL COMMENT '社交账号2', 
+  sa2cat string DEFAULT NULL COMMENT '社交账号2类别',  -- dialect: ORACLE
+  ctype string DEFAULT NULL COMMENT '客户类型',  -- dialect: ORACLE
+  bankname string DEFAULT NULL COMMENT '开户银行',  -- dialect: ORACLE
+  tobankcard string DEFAULT NULL COMMENT '银行卡类型',  -- dialect: ORACLE
+  accname string DEFAULT NULL COMMENT '账户名', 
+  bankaccno string DEFAULT NULL COMMENT '银行帐号', 
+  cobaccount INT DEFAULT NULL COMMENT '账户登录数量', 
+  sotlirisk double DEFAULT NULL COMMENT '传统寿险种保额合计', 
+  soairisk double DEFAULT NULL COMMENT '意外类险种保额合计', 
+  sosiirisk double DEFAULT NULL COMMENT '重疾类险种保额合计', 
+  somcirisk double DEFAULT NULL COMMENT '医疗费用类险种保额合计', 
+  someirisk double DEFAULT NULL COMMENT '医疗补贴类险种保额合计', 
+  soefirisk double DEFAULT NULL COMMENT '教育金类险种保额合计', 
+  sopirisk double DEFAULT NULL COMMENT '养老金类险种保额合计', 
+  sowmirisk double DEFAULT NULL COMMENT '财富管理险种保额合计', 
+  custclass INT DEFAULT NULL COMMENT '客户等级', 
+  convalue INT DEFAULT NULL COMMENT '贡献度分', 
+  awarded3 INT DEFAULT NULL COMMENT '家庭加分', 
+  awarded2 INT DEFAULT NULL COMMENT '续期加分', 
+  awarded1 INT DEFAULT NULL COMMENT '保单加分', 
+  sovalue INT DEFAULT NULL COMMENT '总分值', 
+  enddate DATE DEFAULT NULL COMMENT '客户等级失效日期', 
+  cocommunication INT DEFAULT NULL COMMENT '接触次数', 
+  lcdate DATE DEFAULT NULL COMMENT '最近接触时间', 
+  lctype string DEFAULT NULL COMMENT '最近接触类型',  -- dialect: ORACLE
+  cocomplaint INT DEFAULT NULL COMMENT '投诉次数', 
+  lcptdate DATE DEFAULT NULL COMMENT '最近投诉时间', 
+  lcptreason string DEFAULT NULL COMMENT '最近投诉原因',  -- dialect: ORACLE
+  lcptlink string DEFAULT NULL COMMENT '最近投诉环节',  -- dialect: ORACLE
+  lcptresult string DEFAULT NULL COMMENT '最近投诉处理结果',  -- dialect: ORACLE
+  lcptduration double DEFAULT NULL COMMENT '最近投诉处理时长', 
+  lcptperson string DEFAULT NULL COMMENT '最近投诉人',  -- dialect: ORACLE
+  soppremium double DEFAULT NULL COMMENT '累计已缴保费', 
+  lappdate DATE DEFAULT NULL COMMENT '最近投保日期', 
+  cndate DATE DEFAULT NULL COMMENT '最近报案日期', 
+  cnstatus string DEFAULT NULL COMMENT '最近报案状态',  -- dialect: ORACLE
+  cocnotification INT DEFAULT NULL COMMENT '报案登录数量', 
+  fadate DATE DEFAULT NULL COMMENT '首次投保日期', 
+  ladate DATE DEFAULT NULL COMMENT '最近投保日期', 
+  lpno string DEFAULT NULL COMMENT '最近保险单号', 
+  lpstate string DEFAULT NULL COMMENT '最近保单状态',  -- dialect: ORACLE
+  lpname string DEFAULT NULL COMMENT '最近投保险种名称', 
+  copolicy INT DEFAULT NULL COMMENT '保单登录数量', 
+  iaccno1 string DEFAULT NULL COMMENT '保险账户1', 
+  IAccName1 string DEFAULT NULL COMMENT '保险账户名称1', 
+  iaccno2 string DEFAULT NULL COMMENT '保险账户2', 
+  IAccName2 string DEFAULT NULL COMMENT '保险账户名称2', 
+  iaccno3 string DEFAULT NULL COMMENT '保险账户3', 
+  IAccName3 string DEFAULT NULL COMMENT '保险账户名称3', 
+  soiaccount1 double DEFAULT NULL COMMENT '保险账户1余额', 
+  soiaccount2 double DEFAULT NULL COMMENT '保险账户2余额', 
+  soiaccount3 double DEFAULT NULL COMMENT '保险账户3余额', 
+  coiaccount INT DEFAULT NULL COMMENT '保险账户登录数量',
+  CustState string DEFAULT NULL COMMENT '客户状态', 
+  DataSource string DEFAULT NULL COMMENT '数据来源',
+  CREATED_BY	string DEFAULT NULL COMMENT '	创建人	',
+	CREATED_TIME	TIMESTAMP	DEFAULT NULL COMMENT '	创建时间	',
+	UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+	UPDATED_TIME	date DEFAULT NULL COMMENT '	更新时间	'
+)
+COMMENT '团体'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.PrivacyPreferenceInstructions;
+CREATE  TABLE shanglifeecif.PrivacyPreferenceInstructions(
+CREATED_BY	string	DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	date	DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	date	DEFAULT NULL COMMENT '	更新时间	',
+PPIID	string	DEFAULT NULL COMMENT '	偏好ID	',
+IndID	string	DEFAULT NULL COMMENT '	个体ID	',
+IndPhone	string	DEFAULT NULL COMMENT '	个人手机号	',
+IndIDCard	string	DEFAULT NULL COMMENT '	个人证件	',
+IndName	string	DEFAULT NULL COMMENT '	个人名称	',
+Type	string	DEFAULT NULL COMMENT '	类别	',
+W1Stime	string	DEFAULT NULL COMMENT '	周一起始时间	',
+W1Etime	string	DEFAULT NULL COMMENT '	周一结束时间	',
+W2Stime	string	DEFAULT NULL COMMENT '	周二起始时间	',
+W2Etime	string	DEFAULT NULL COMMENT '	周二结束时间	',
+W3Stime	string	DEFAULT NULL COMMENT '	周三起始时间	',
+W3Etime	string	DEFAULT NULL COMMENT '	周三结束时间	',
+W4Stime	string	DEFAULT NULL COMMENT '	周四起始时间	',
+W4Etime	string	DEFAULT NULL COMMENT '	周四结束时间	',
+W5Stime	string	DEFAULT NULL COMMENT '	周五起始时间	',
+W5Etime	string	DEFAULT NULL COMMENT '	周五结束时间	',
+W6Stime	string	DEFAULT NULL COMMENT '	周六起始时间	',
+W6Etime	string	DEFAULT NULL COMMENT '	周六结束时间	',
+W7Stime	string	DEFAULT NULL COMMENT '	周日起始时间	',
+W7Etime	string	DEFAULT NULL COMMENT '	周日结束时间	'
+)
+COMMENT '隐私偏好设定'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.HealthStatus;
+CREATE  TABLE shanglifeecif.HealthStatus(
+CREATED_BY	string	DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	date	DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	date	DEFAULT NULL COMMENT '	更新时间	',
+HSID	string	DEFAULT NULL COMMENT '	健康状况ID	',
+IndID	string	DEFAULT NULL COMMENT '	个体ID	',
+IndName	string	DEFAULT NULL COMMENT '	个人名称	',
+IndPhone	string	DEFAULT NULL COMMENT '	个人手机	',
+IndIDCard	string	DEFAULT NULL COMMENT '	个人证件号码	',
+EvaDate	DATE	DEFAULT NULL COMMENT '	评估日期	',
+Height	double	DEFAULT NULL COMMENT '	身高	',
+Weight	double	DEFAULT NULL COMMENT '	体重	',
+CIllness	string	DEFAULT NULL COMMENT '	当前疾病	',
+PIllness	string	DEFAULT NULL COMMENT '	曾患疾病	',
+BMI	double	DEFAULT NULL COMMENT '	BMI体制指数	'
+)
+COMMENT '健康状况'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.RealProperty;
+CREATE  TABLE shanglifeecif.RealProperty(
+CREATED_BY	string	DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	date	DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	date	DEFAULT NULL COMMENT '	更新时间	',
+RPID	string	DEFAULT NULL COMMENT '	房产ID	',
+IndID	string	DEFAULT NULL COMMENT '	IndID	',
+IndName	string	DEFAULT NULL COMMENT '	个人名称	',
+IndPhone	string	DEFAULT NULL COMMENT '	个人手机	',
+IndIDCard	string	DEFAULT NULL COMMENT '	个人证件号码	',
+RPAID	string	DEFAULT NULL COMMENT '	房产地址	',
+RPAL	string	DEFAULT NULL COMMENT '	房产地址不分段	',
+RPRegNo	string	DEFAULT NULL COMMENT '	产权证号码	',
+BLDGType	string	DEFAULT NULL COMMENT '	房产结构	',
+BLDGStyle	string	DEFAULT NULL COMMENT '	房型	',
+RPType	string	DEFAULT NULL COMMENT '	房产类型	',
+RPOSize	double	DEFAULT NULL COMMENT '	建筑面积	',
+RPTSize	double	DEFAULT NULL COMMENT '	实得面积	',
+RPSTime	DATE	DEFAULT NULL COMMENT '	开始时间	',
+RPETime	DATE	DEFAULT NULL COMMENT '	结束时间	'
+)
+COMMENT '房产'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.Vehicle;
+CREATE  TABLE shanglifeecif.Vehicle(
+CREATED_BY	string	DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	date	DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	date	DEFAULT NULL COMMENT '	更新时间	',
+VID	string	DEFAULT NULL COMMENT '	车辆ID	',
+IndID	string	DEFAULT NULL COMMENT '	个人ID	',
+VMake	string	DEFAULT NULL COMMENT '	车型	',
+VModel	string	DEFAULT NULL COMMENT '	型号	',
+VINNumber	string	DEFAULT NULL COMMENT '	VIN码	',
+VCNumber	string	DEFAULT NULL COMMENT '	车架号	',
+VRNumber	string	DEFAULT NULL COMMENT '	牌照号码	',
+VSTime	DATE	DEFAULT NULL COMMENT '	开始时间	',
+VETime	DATE	DEFAULT NULL COMMENT '	结束时间	'
+)
+COMMENT '车辆'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.IndRelationShip;
+CREATE  TABLE shanglifeecif.IndRelationShip(
+
+IRSID	string	DEFAULT NULL COMMENT '	个体关系ID	',
+RSType	string	DEFAULT NULL COMMENT '	关系类型	',
+IndID1	string	DEFAULT NULL COMMENT '	个体1	',
+Name1	string	DEFAULT NULL COMMENT '	个体1名称	',
+Mphone1	string	DEFAULT NULL COMMENT '	个体1手机	',
+IDCard1	string	DEFAULT NULL COMMENT '	个体1证件号码	',
+Role1	string	DEFAULT NULL COMMENT '	个体1角色	',
+IndID2	string	DEFAULT NULL COMMENT '	个体2	',
+Name2	string	DEFAULT NULL COMMENT '	个体2名称	',
+Mphone2	string	DEFAULT NULL COMMENT '	个体2手机	',
+IDCard2	string	DEFAULT NULL COMMENT '	个体2证件号码	',
+Role2	string	DEFAULT NULL COMMENT '	个体2角色	',
+RSSTime	DATE	DEFAULT NULL COMMENT '	开始时间	',
+RSETime	DATE	DEFAULT NULL COMMENT '	结束时间	',
+RSDescribe	string	DEFAULT NULL COMMENT '	关系描述	',
+CREATED_BY	string	DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	date	DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	date	DEFAULT NULL COMMENT '	更新时间	'
+)
+COMMENT '个体关系'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.IndOrgRelationShip;
+CREATE  TABLE shanglifeecif.IndOrgRelationShip(
+CREATED_BY	string	DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	date	DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	date	DEFAULT NULL COMMENT '	更新时间	',
+IORSID	string	DEFAULT NULL COMMENT '	关系ID	',
+RSType	string	DEFAULT NULL COMMENT '	关系类型	',
+IndID	string	DEFAULT NULL COMMENT '	个体	',
+IndName	string	DEFAULT NULL COMMENT '	个体名称	',
+Mphone	string	DEFAULT NULL COMMENT '	个体手机	',
+IDCard	string	DEFAULT NULL COMMENT '	个体证件号码	',
+IRole	string	DEFAULT NULL COMMENT '	个体角色	',
+OID	string	DEFAULT NULL COMMENT '	团体	',
+SCCode	string	DEFAULT NULL COMMENT '	统一社会信用代码	',
+OrgName	string	DEFAULT NULL COMMENT '	团体名称	',
+OCID	string	DEFAULT NULL COMMENT '	联系人	',
+OCName	string	DEFAULT NULL COMMENT '	联系人姓名	',
+OCPhone	string	DEFAULT NULL COMMENT '	联系人电话	',
+ORole	string	DEFAULT NULL COMMENT '	团体角色	',
+RSSTime	DATE	DEFAULT NULL COMMENT '	开始时间	',
+RSETime	DATE	DEFAULT NULL COMMENT '	结束时间	',
+RSDescribe	string	DEFAULT NULL COMMENT '	关系描述	'
+)
+COMMENT '个人团体关系'
+stored as ES
+with shard number 10
+replication 1;
+
+
+ --创建保单表insurancearrangement
+DROP TABLE IF EXISTS shanglifeecif.InsuranceArrangement;
+CREATE TABLE shanglifeecif.InsuranceArrangement(
+  iaid string NOT NULL COMMENT '保单ID', 
+  policyno string DEFAULT NULL COMMENT '保险单号 INSURANCEINFO.CONTNO', 
+  pano string DEFAULT NULL COMMENT '投保单号 INSURANCEINFO.PRTNO', 
+  agrmntage string DEFAULT NULL COMMENT '保险期限', 
+  pbinst string DEFAULT NULL COMMENT '受益分配方式', 
+  pwcomp string DEFAULT NULL COMMENT '承保分公司 HEALTH_INSURANCE_LISTING.AGENTGROUPAREA 营业区HEALTH_INSURANCE_LISTING.AGENTGROUP 营业部', 
+  pindate string DEFAULT NULL COMMENT '起保日期 POLICY_INFORMATION.CVALIDATE', 
+  pmdate string DEFAULT NULL COMMENT '终保日期 POLICY_INFORMATION.ENDDATE', 
+  pisdate string DEFAULT NULL COMMENT '签单日期 INSURANCEINFO.SIGNDATE', 
+  padate string DEFAULT NULL COMMENT '投保日期 INSURANCEINFO.POLAPPLYDATE', 
+  renewaldate string DEFAULT NULL COMMENT '续保日期', 
+  norenewal int DEFAULT NULL COMMENT '续保次数 POLICY_INFORMATION.PAYCOUNT', 
+  policytype string DEFAULT NULL COMMENT '保单类型 PERSONAL_INSURANCE.CONTTYPE,需上游给出类型枚举值', 
+  schannel string DEFAULT NULL COMMENT '销售渠道 HEALTH_INSURANCE_LISTING.SALECHANNELS 1 2 3 4 5',
+  bsource string DEFAULT NULL COMMENT '业务来源', 
+  policystate string DEFAULT NULL COMMENT '保单状态 保单包括投保单的所处的状态,例如:录入、生效、批单等 INSURANCEINFO.APPFLAG code 0 1 2 4 9 B F',
+  topay string DEFAULT NULL COMMENT '缴费类型', 
+  payment string DEFAULT NULL COMMENT '缴费方式 POLICY_INFORMATION.PAYINTV', 
+  risk double DEFAULT NULL COMMENT '总保额 HEALTH_INSURANCE_LISTING.AMNT(测试环境中,此表保单数据量较其他表如:POLICY_INFORMATION,INSURANCEINFO 缺少至少一个数据量级)', 
+  prem double DEFAULT NULL COMMENT '总保费 INSURANCEINFO.PREM', 
+  currency string DEFAULT NULL COMMENT '币种', 
+  npdate string DEFAULT NULL COMMENT '下次缴费日期', 
+  soinsured int DEFAULT NULL COMMENT '被保人数 HEALTH_GROUP_LISTING.PEOPLES3,团单', 
+  bsinsured double DEFAULT NULL COMMENT '基本保额 比如中国人寿的康宁终身保险就是这样,如果购买的基本保险金额是10万的话,那么大病的保险金额就是基本保险金额的2倍即20万;', 
+  insurvalue double DEFAULT NULL COMMENT '保单价值', 
+  applicantid string DEFAULT NULL COMMENT '投保人 根据POLICY_INFORMATION.CUSTOMERNO关联individual上游客户号,再找到individualid', 
+  applicantscustid string DEFAULT NULL COMMENT '投保人上游客户号', 
+  appname string DEFAULT NULL COMMENT '投保人名称 POLICY_INFORMATION.NAME', 
+  appphone string DEFAULT NULL COMMENT '投保人手机', 
+  appcertid string DEFAULT NULL COMMENT '投保人证件号码 POLICY_INFORMATION.IDNO', 
+  insuredid string DEFAULT NULL COMMENT '主被保险人 客户号', 
+  insuredscustid string DEFAULT NULL COMMENT '主被保险人 上游客户号POLICY_INFORMATION.insuredno', 
+  insname string DEFAULT NULL COMMENT '主被保险人名称 POLICY_INFORMATION.INSUREDNAME', 
+  insphone string DEFAULT NULL COMMENT '主被保险人手机', 
+  inscertid string DEFAULT NULL COMMENT '主被保险人证件号码 POLICY_INFORMATION.INSUREDIDNO', 
+  productid string DEFAULT NULL COMMENT '险种代码 POLICY_INFORMATION.RISKCODE', 
+  productname string DEFAULT NULL COMMENT '险种名称 INSURANCEINFO.RISKNAME', 
+  salesperson string DEFAULT NULL COMMENT '业务员', 
+  spname string DEFAULT NULL COMMENT '业务员名称 HEALTH_INSURANCE_LISTING.AGENTCODE', 
+  iaccount string DEFAULT NULL COMMENT '所属保险账户', 
+  branchcode string DEFAULT NULL COMMENT '机构代码', 
+  policybelong string DEFAULT NULL COMMENT '业绩归属 POLICY_INFORMATION.SALECOM', 
+  agentchannel string DEFAULT NULL COMMENT '代理渠道 INSURANCEINFO.SELLTYPE', 
+  agentorg string DEFAULT NULL COMMENT '代理机构', 
+  regtype string DEFAULT NULL COMMENT '户籍类型', 
+  pincome string DEFAULT NULL COMMENT '个人年收入', 
+  fincome double DEFAULT NULL COMMENT '家庭年收入', 
+  incomesource string DEFAULT NULL COMMENT '收入来源', 
+  socialinsurance string DEFAULT NULL COMMENT '是否有社保', 
+  oipolicy string DEFAULT NULL COMMENT '是否投保其他保险公司', 
+  oicompany string DEFAULT NULL COMMENT '其他保险公司', 
+  oicproduct string DEFAULT NULL COMMENT '其他保险公司险种', 
+  oiamount double DEFAULT NULL COMMENT '其他保险公司保额', 
+  drinking string DEFAULT NULL COMMENT '是否饮酒', 
+  dfavor string DEFAULT NULL COMMENT '饮酒喜好', 
+  poservice string DEFAULT NULL COMMENT '是否保全 投保人持有保单是否在AUDIT_EDORLIST.CONTNO存在', 
+  payendyear int DEFAULT NULL COMMENT '缴费年期 POLICY_INFORMATION.PAYENDYEAR', 
+  loanmoney double DEFAULT NULL COMMENT '保单质押贷款金额 AUDIT_LN_LIST.LNMONEY ',
+  paydate string DEFAULT NULL COMMENT '缴至日期',
+  risk_categories string COMMENT '险种大类代码',
+  risk_categories_name string COMMENT '险种大类名称',
+  created_by string DEFAULT NULL COMMENT '创建人', 
+  created_time date DEFAULT NULL COMMENT '创建时间', 
+  updated_by string DEFAULT NULL COMMENT '更新人', 
+  updated_time date DEFAULT NULL COMMENT '更新时间'
+) 
+COMMENT '保单 确定参与方之间,参与方和保险公司之间的协议,使相关各方能在遵守一定的规则并履行相关义务的前提下进行产品或资源或服务的供给'
+stored as ES
+with shard number 10
+replication 1;
+
+
+
+DROP TABLE IF EXISTS shanglifeecif.IndIARelationShip;
+CREATE  TABLE shanglifeecif.IndIARelationShip(
+CREATED_BY	string	DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	date	DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	date	DEFAULT NULL COMMENT '	更新时间	',
+IIARSID	string	DEFAULT NULL COMMENT '	关系ID	',
+IndID	string	DEFAULT NULL COMMENT '	个人ID	',
+IndName	string	DEFAULT NULL COMMENT '	个人名称	',
+IndPhone	string	DEFAULT NULL COMMENT '	个人手机	',
+IndIDCard	string	DEFAULT NULL COMMENT '	个人证件号码	',
+RolePlayer	string	DEFAULT NULL COMMENT '	角色	',
+ROBeneficiary	double	DEFAULT NULL COMMENT '	受益比例	',
+IAID	string	DEFAULT NULL COMMENT '	保单号	',
+PolicyNo	string	DEFAULT NULL COMMENT '	保险单号	',
+PANo	string	DEFAULT NULL COMMENT '	投保单号	',
+PolicyState	string	DEFAULT NULL COMMENT '	保单状态	',
+RSSTime	DATE	DEFAULT NULL COMMENT '	开始时间	',
+RSEtime	DATE	DEFAULT NULL COMMENT '	结束时间	'
+)
+COMMENT '个人保单关系'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.Communication;
+CREATE  TABLE shanglifeecif.Communication(
+CommID	string	DEFAULT NULL COMMENT '	接触ID	',
+IndID	string	DEFAULT NULL COMMENT '	接触人ID	',
+CPName	string	DEFAULT NULL COMMENT '	接触人名称	',
+CPPhone	string	DEFAULT NULL COMMENT '	接触人手机	',
+CPCertID	string	DEFAULT NULL COMMENT '	接触人证件号码	',
+RSOApplicant	string	DEFAULT NULL COMMENT '	与保单投保人关系	',
+PolicyNo	string	DEFAULT NULL COMMENT '	保险单号	',
+CommType	string	DEFAULT NULL COMMENT '	接触类型	',
+CommChannel	string	DEFAULT NULL COMMENT '	接触渠道	',
+Reason	string	DEFAULT NULL COMMENT '	接触原因	',
+CommTime	string	DEFAULT NULL COMMENT '	接触时间	',
+CommDescribe	string	DEFAULT NULL COMMENT '	接触描述	',
+CompLink	string	DEFAULT NULL COMMENT '	投诉环节	',
+CompReason	string	DEFAULT NULL COMMENT '	投诉原因	',
+ProcedureResult	string	DEFAULT NULL COMMENT '	处理结果	',
+CommLevel	string	DEFAULT NULL COMMENT '	接触等级	',
+RVType	string	DEFAULT NULL COMMENT '	回访类型	',
+RVDate	string	DEFAULT NULL COMMENT '	回访时间	',
+RVDuration	double	DEFAULT NULL COMMENT '	回访时长	',
+CPTDuration	double	DEFAULT NULL COMMENT '	投诉处理时长	',
+CREATED_BY	string	DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	date	DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	date	DEFAULT NULL COMMENT '	更新时间	'
+)
+COMMENT '接触'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.InsuranceClaimThread;
+CREATE  TABLE shanglifeecif.InsuranceClaimThread(
+  icthreadid string NOT NULL  COMMENT '保险理赔Id',
+  crno string DEFAULT NULL COMMENT '立案号',
+  companyno string DEFAULT NULL COMMENT '公司代码',
+  policyno string NOT NULL COMMENT '保险单号 INSURANCE_CLAIM.CONTNO',
+  applicantid string DEFAULT NULL COMMENT '投保人ID',
+  appname string DEFAULT NULL COMMENT '投保人名称',
+  appphone string DEFAULT NULL COMMENT '投保人手机',
+  appcertid string DEFAULT NULL COMMENT '投保人证件号码 INSURANCE_CLAIM.RISKDATE',
+  cnno string DEFAULT NULL COMMENT '报案号',
+  losstime date DEFAULT NULL COMMENT '损失发生时间',
+  rpid string DEFAULT NULL COMMENT '报案人',
+  rpname string DEFAULT NULL COMMENT '报案人名称',
+  rpphone string DEFAULT NULL COMMENT '报案人电话',
+  lpid string DEFAULT NULL COMMENT '出险人	根据INSURANCE_CLAIM.INSUREDNO获取indid',
+  lpscutid string DEFAULT NULL COMMENT '出险人上游客户号	根据INSURANCE_CLAIM',
+  lpname string DEFAULT NULL COMMENT '出险人名称',
+  cndate date DEFAULT NULL COMMENT '报案日期 INSURANCE_CLAIM.RPTDATE',
+  lossdescribe string DEFAULT NULL COMMENT '损失原因 案件发生的原因:INSURANCE_CLAIM.LLOCCURREASON',
+  crdate date DEFAULT NULL COMMENT '立案日期 INSURANCE_CLAIM.RGTDATE',
+  cndescribe string DEFAULT NULL COMMENT '报案描述 INSURANCE_CLAIM.ACCIDENTDETAIL',
+  claimstatus string DEFAULT NULL COMMENT '理赔状态 案件的状态,例如:录入、已立案等',
+  csdate date DEFAULT NULL COMMENT '理赔状态日期',
+  relationship string DEFAULT NULL COMMENT '报案人与出险人关系',
+  ccno string DEFAULT NULL COMMENT '赔案号 AUDIT_CLAIM_INSURANCE.CLMNO',
+  ccstatus string DEFAULT NULL COMMENT '赔案状态',
+  ccsdate date DEFAULT NULL COMMENT '赔案状态日期',
+  productid string DEFAULT NULL COMMENT '险种代码	INSURANCE_CLAIM_HEALTH.RISKCODE',
+  productname string DEFAULT NULL COMMENT '险种代码	INSURANCE_CLAIM_HEALTH.RISKNAME',
+  ccamt double DEFAULT NULL COMMENT '赔付金额	INSURANCE_CLAIM_HEALTH.REALPAY',
+  branchcode string DEFAULT NULL COMMENT '机构代码',
+  claimcasestatus string DEFAULT NULL COMMENT '案件状态INSURANCE_CLAIM_HEALTH.LLCLAIMSTATE',
+  created_by string DEFAULT NULL COMMENT '',
+  created_time date DEFAULT NULL COMMENT '',
+  updated_by string DEFAULT NULL COMMENT '',
+  updated_time date DEFAULT NULL COMMENT ''
+)
+COMMENT '保险理赔'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.Payment;
+CREATE  TABLE shanglifeecif.Payment(
+CREATED_BY	string	DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	date	DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	date	DEFAULT NULL COMMENT '	更新时间	',
+PaymentID	string	DEFAULT NULL COMMENT '	收付交易 ID	',
+IndID	string	DEFAULT NULL COMMENT '	个人ID	',
+PlolicyNo	string	DEFAULT NULL COMMENT '	保险单号	',
+PaymentReason	string	DEFAULT NULL COMMENT '	收付原因	',
+PaymentItem	string	DEFAULT NULL COMMENT '	收付项目	',
+PaymentChannel	string	DEFAULT NULL COMMENT '	收付方式	',
+BankAccNo	string	DEFAULT NULL COMMENT '	银行账号	',
+Currency	string	DEFAULT NULL COMMENT '	币种	',
+SOPayment	double	DEFAULT NULL COMMENT '	收付金额	',
+IndName	string	DEFAULT NULL COMMENT '	个人名称	',
+IndPhone	string	DEFAULT NULL COMMENT '	个人手机	',
+IndIDCard	string	DEFAULT NULL COMMENT '	个人证件号码	',
+DOPPayment	DATE	DEFAULT NULL COMMENT '	计划收付日期	',
+DOAPayment	DATE	DEFAULT NULL COMMENT '	实付日期	'
+)
+COMMENT '收付交易'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.InsuranceAccount;
+CREATE  TABLE shanglifeecif.InsuranceAccount(
+CREATED_BY	string	DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	date	DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	date DEFAULT NULL COMMENT '	更新时间	',
+IAccID	string	DEFAULT NULL COMMENT '	保险账户ID	',
+IndID	string	DEFAULT NULL COMMENT '	个人ID	',
+IndName	string	DEFAULT NULL COMMENT '	个人名称	',
+IndPhone	string	DEFAULT NULL COMMENT '	个人手机	',
+IndIDCard	string	DEFAULT NULL COMMENT '	个人证件号码	',
+RegDate	DATE	DEFAULT NULL COMMENT '	开户日期	',
+UnRegDate	DATE	DEFAULT NULL COMMENT '	销户日期	',
+IAccName	string	DEFAULT NULL COMMENT '	保险账户名称	',
+IAccType	string	DEFAULT NULL COMMENT '	保险账户类型	',
+IAccStatus	string	DEFAULT NULL COMMENT '	保险账户状态	',
+FixedRate	double	DEFAULT NULL COMMENT '	固定利率	',
+AccCDate	DATE	DEFAULT NULL COMMENT '	账户变动日期	',
+AccBalance	double	DEFAULT NULL COMMENT '	账户余额	',
+FrozenCapital	double	DEFAULT NULL COMMENT '	冻结余额	',
+OutstdInterest	double	DEFAULT NULL COMMENT '	未结算利息	',
+LBdate	DATE	DEFAULT NULL COMMENT '	上次结算日期	',
+LABalance	double	DEFAULT NULL COMMENT '	上次结算余额	',
+InterestType	string	DEFAULT NULL COMMENT '	计息类型	',
+SettlementCycle	INT	DEFAULT NULL COMMENT '	结算周期	',
+SettlementTime	date	DEFAULT NULL COMMENT '	结算时点	',
+SettlementType	string	DEFAULT NULL COMMENT '	结算类型	'
+)
+COMMENT '保险账户'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.PartyLabel;
+CREATE  TABLE shanglifeecif.PartyLabel(
+CREATED_BY	string	DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	date	DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	date	DEFAULT NULL COMMENT '	更新时间	',
+LabelID	string	DEFAULT NULL COMMENT '	标签ID	',
+PartyID	string	DEFAULT NULL COMMENT '	参与方ID	',
+LabelName	string	DEFAULT NULL COMMENT '	标签名称	',
+LabelDescribe	string	DEFAULT NULL COMMENT '	标签描述	',
+LabelType	string	DEFAULT NULL COMMENT '	标签类别	',
+LabelLevel	INT	DEFAULT NULL COMMENT '	标签层级	',
+LCDate	date	DEFAULT NULL COMMENT '	标签创建BrancheCode日期	',
+LabelStatus	string	DEFAULT NULL COMMENT '	标签状态	',
+AuthorID	string	DEFAULT NULL COMMENT '	标签创建人	',
+BrancheCode	string	DEFAULT NULL COMMENT '	机构代码	',
+PartyName	string	DEFAULT NULL COMMENT '	参与方名称	',
+PartyIDNumber	string	DEFAULT NULL COMMENT '	参与方证件号码	',
+PartyPhone	string	DEFAULT NULL COMMENT '	参与方电话	',
+LabelCode	string	DEFAULT NULL COMMENT '	标签生成逻辑	'
+)
+COMMENT '参与方标签'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.MergeRelationship;
+CREATE  TABLE shanglifeecif.MergeRelationship(
+CREATED_BY	string	DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	date	DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	date	DEFAULT NULL COMMENT '	更新时间	',
+MRSID	string	DEFAULT NULL COMMENT '	合并关系ID	',
+Party1ID	string	DEFAULT NULL COMMENT '	合并方	',
+Party2ID	string	DEFAULT NULL COMMENT '	被合并方	',
+Party1Name	string	DEFAULT NULL COMMENT '	合并方名称	',
+Party1IDCard	string	DEFAULT NULL COMMENT '	合并方证件号码	',
+Party1Phone	string	DEFAULT NULL COMMENT '	合并方电话	',
+Party2Name	string	DEFAULT NULL COMMENT '	被合并方名称	',
+Party2IDCard	string	DEFAULT NULL COMMENT '	被合并方证件号码	',
+Party2Phone	string	DEFAULT NULL COMMENT '	被合并方电话	',
+MergeDate	date	DEFAULT NULL COMMENT '	合并日期	',
+MergeMethod	string	DEFAULT NULL COMMENT '	合并方式	',
+MergeAuditorID	string	DEFAULT NULL COMMENT '	合并批准人	',
+MergeAuditorName	string	DEFAULT NULL COMMENT '	合并批准人名称	',
+Party1Backup	string	DEFAULT NULL COMMENT '	合并方备份	',
+MRSStatus	string	DEFAULT NULL COMMENT '	合并关系状态	'
+)
+COMMENT '参与方合并关系'
+stored as ES
+with shard number 10
+replication 1;
+
+DROP TABLE IF EXISTS shanglifeecif.PartyTimeLine;
+CREATE  TABLE shanglifeecif.PartyTimeLine(
+CREATED_BY	string	DEFAULT NULL COMMENT '	创建人	',
+CREATED_TIME	date	DEFAULT NULL COMMENT '	创建时间	',
+UPDATED_BY	string	DEFAULT NULL COMMENT '	更新人	',
+UPDATED_TIME	date	DEFAULT NULL COMMENT '	更新时间	',
+TripID	string	DEFAULT NULL COMMENT '	旅程ID	',
+PartyID	string	DEFAULT NULL COMMENT '	参与方ID	',
+Name	string	DEFAULT NULL COMMENT '	参与方名称	',
+PCertID	string	DEFAULT NULL COMMENT '	参与方证件号码	',
+PPhone	string	DEFAULT NULL COMMENT '	参与方手机	',
+PRole	string	DEFAULT NULL COMMENT '	参与方角色	',
+Scenario	string	DEFAULT NULL COMMENT '	场景	',
+SDate	date	DEFAULT NULL COMMENT '	发生日期	',
+ThreadID	string	DEFAULT NULL COMMENT '	关联ID	',
+ParentID	string	DEFAULT NULL COMMENT '	父ID	',
+Describe	string	DEFAULT NULL COMMENT '	描述	',
+Channel	string	DEFAULT NULL COMMENT '	来源	'
+)
+COMMENT '参与方事件'
+stored as ES
+with shard number 10
+replication 1;

+ 176 - 0
sql-achievement/存储过程/洛阳测试环境使用sql整理/个体关系存储过程.sql

@@ -0,0 +1,176 @@
+DROP TABLE IF EXISTS shanglifeecif.indrelationship_tmp;
+CREATE  TABLE shanglifeecif.indrelationship_tmp(
+  id string DEFAULT NULL COMMENT 'id', 
+  rstype string DEFAULT NULL COMMENT '关系类型 其他、配偶、祖父母、外祖父母、祖孙、外祖孙、本人、父母子女', 
+  indid1 string DEFAULT NULL COMMENT '个体1', 
+  scustid1 string DEFAULT NULL COMMENT '个体1上游客户号', 
+  name1 string DEFAULT NULL COMMENT '个体1名称', 
+  sex1 string DEFAULT NULL COMMENT '个体性别1', 
+  mphone1 string DEFAULT NULL COMMENT '个体1手机', 
+  idcard1 string DEFAULT NULL COMMENT '个体1证件号码', 
+  role1 string DEFAULT NULL COMMENT '个体1角色 父亲、母亲、儿子、女儿、妻子、丈夫', 
+  indid2 string DEFAULT NULL COMMENT '个体2', 
+  scustid2 string DEFAULT NULL COMMENT '个体2上游客户号', 
+  name2 string DEFAULT NULL COMMENT '个体2名称', 
+  sex2 string DEFAULT NULL COMMENT '个体性别2', 
+  mphone2 string DEFAULT NULL COMMENT '个体2手机', 
+  idcard2 string DEFAULT NULL COMMENT '个体2证件号码', 
+  role2 string DEFAULT NULL COMMENT '个体2角色 父亲、母亲、儿子、女儿、妻子、丈夫', 
+  rsstime timestamp DEFAULT NULL COMMENT '开始时间', 
+  rsetime timestamp DEFAULT NULL COMMENT '结束时间'
+)
+COMMENT '个体关系临时表'
+stored as ES
+with shard number 10
+replication 1;
+
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_indrelationship_tmp( ) 
+IS
+DECLARE
+	strsql string 
+BEGIN
+	--删除数据
+	DELETE shanglifeecif.indrelationship_tmp;
+	--插入数据
+	INSERT INTO shanglifeecif.indrelationship_tmp(
+		id,
+		RSType,
+		SCustID1,
+		Name1,
+		sex1,
+		IDCard1,
+		Role1,
+		SCustID2,
+		Name2,
+		sex2,
+		IDCard2,
+		RSSTime,
+		Role2
+		)
+	SELECT 
+		row_number()over() AS IRSID,
+		max(RELATIONTOAPPNT) AS RSType,
+		CUSTOMERNO AS IndID1,
+		max(NAME) AS Name1,
+		max(sex) AS sex1,
+		max(IDNO) AS IDCard1,
+		CASE max(RELATIONTOAPPNT) 
+			WHEN '子女' 
+				THEN CASE max(sex) 
+					WHEN 1 THEN '母亲' 
+					WHEN 0 THEN '父亲' 
+				END
+		    WHEN '父母' 
+		    	THEN CASE max(sex) 
+		    		WHEN 1 THEN '女儿' 
+		    		WHEN 0 THEN '儿子' 
+		    	END
+		    WHEN '配偶' 
+		    	THEN CASE max(sex) 
+		    		WHEN 1 THEN '妻子' 
+		    		WHEN 0 THEN '丈夫' 
+		    	END
+		    WHEN '祖父母、外祖父母' 
+		    	THEN CASE max(sex) 
+		    		WHEN 1 THEN '(外)孙女' 
+		    		WHEN 0 THEN '(外)祖孙' 
+		    	END
+		    WHEN '祖孙、外祖孙' 
+		    	THEN CASE max(sex) 
+		    		WHEN 1 THEN '(外)祖母' 
+		    		WHEN 0 THEN '(外)祖父' 
+		    	END
+			ELSE max(RELATIONTOAPPNT) 
+		END AS Role1,
+		INSUREDNO AS IndID2,
+		max(INSUREDNAME) AS Name2,
+		max(insuredsex) AS sex2,
+		max(INSUREDIDNO) AS IDCard2,
+		min(CUSTOMGETPOLDATE) AS RSSTime,
+		CASE max(RELATIONTOAPPNT) 
+			WHEN '子女' 
+				THEN CASE max(INSUREDSEX) 
+					WHEN 1 THEN '女儿' 
+					WHEN 0 THEN '儿子' 
+				END
+		    WHEN '父母' 
+		    	THEN CASE max(INSUREDSEX) 
+		    		WHEN 1 THEN '母亲' 
+		    		WHEN 0 THEN '父亲' 
+		    	END
+		    WHEN '配偶' 
+		    	THEN CASE max(INSUREDSEX) 
+		    		WHEN 1 THEN '妻子' 
+		    		WHEN 0 THEN '丈夫' 
+		    	END
+		    WHEN '祖父母、外祖父母' 
+		    	THEN CASE max(INSUREDSEX) 
+		    		WHEN 1 THEN '(外)祖母' 
+		    		WHEN 0 THEN '(外)祖父' 
+		    	END
+		    WHEN '祖孙、外祖孙' 
+		    	THEN CASE max(INSUREDSEX) 
+		    		WHEN 1 THEN '(外)孙女' 
+		    		WHEN 0 THEN '(外)祖孙' 
+		    	END
+			ELSE max(RELATIONTOAPPNT) 
+		END AS Role2
+	FROM shanghailifeecif.POLICY_INFORMATION 
+	WHERE RELATIONTOAPPNT<>'本人' AND RELATIONTOAPPNT IS NOT NULL
+	GROUP BY CUSTOMERNO,INSUREDNO;
+	
+
+	--更新临时表的indid1 indid2
+	UPDATE shanglifeecif.indrelationship_tmp a set indid1 = 
+		(SELECT b.indid FROM (select 
+			indid,row_number() over(partition by scustid) rn ,SCustID
+		from shanglifeecif.individual) b where a.SCustID1 = b.SCustID AND b.rn = 1);
+	UPDATE shanglifeecif.indrelationship_tmp a set indid2 = 
+		(SELECT b.indid FROM (select 
+			indid,row_number() over(partition by scustid) rn ,SCustID
+		from shanglifeecif.individual) b where a.SCustID2 = b.SCustID AND b.rn = 1);
+
+END;
+
+/
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_indrelationship( ) 
+IS
+DECLARE
+BEGIN
+	
+	DELETE FROM shanglifeecif.indrelationship;
+	--插入数据
+	INSERT INTO shanglifeecif.indrelationship(
+		IRSID, --'个体关系ID' 
+		RSType, --'关系类型 其他、配偶、祖父母、外祖父母、祖孙、外祖孙、本人、父母子女' ,
+		IndID1, --'个体1' ,
+		Name1, --个体1名称
+	
+		IDCard1, --个体1证件号码
+		Role1,--个体1角色 父亲、母亲、儿子、女儿、妻子、丈夫
+		IndID2,--个体2
+		Name2,--个体2名称	sex2,--个体2手机
+		IDCard2,--个体2证件号码
+		Role2,--个体2角色 父亲、母亲、儿子、女儿、妻子、丈夫
+		RSSTime,--开始时间
+		CREATED_BY,--创建人
+		CREATED_TIME--
+		)
+	SELECT 
+		id,
+		RSType,
+		indid1,
+		Name1,
+		IDCard1,
+		Role1,
+		indid2,
+		Name2,
+		IDCard2,
+		Role2,
+		RSSTime,
+		'admin',
+		sysdate
+	FROM shanglifeecif.indrelationship_tmp where indid1 is not null and indid2 is not null
+
+	
+END;

+ 23 - 0
sql-achievement/存储过程/洛阳测试环境使用sql整理/保单件数分布统计.sql

@@ -0,0 +1,23 @@
+CREATE TABLE shanglifeecif.bdnum_distribution(
+    id string,
+    labelName string  DEFAULT NULL COMMENT '保单件数名称',
+    bdnum string DEFAULT NULL COMMENT '保单件数'
+) COMMENT '保单件数分布'
+STORED AS ES
+with shard number 10
+replication 1;
+
+CREATE OR REPLACE PROCEDURE shanglifeecif.bdnum_distribution() IS
+DECLARE
+BEGIN
+	delete from shanglifeecif.bdnum_distribution;
+	insert into shanglifeecif.bdnum_distribution (
+		id,
+		labelName,
+		bdnum
+	) SELECT row_number()over(),t.labelName,t.bdnum FROM (
+		SELECT si.label25 labelName,count(1) bdnum FROM shanglifeecif.individual si GROUP BY si.label25 
+	) t
+	
+	
+END	;

+ 268 - 0
sql-achievement/存储过程/洛阳测试环境使用sql整理/保单信息存储过程.sql

@@ -0,0 +1,268 @@
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_insurancearrangement() -- 创建主存储过程
+IS    
+BEGIN
+	--根据policy_information 更新保单表
+	shanglifeecif.init_insurancearrangement_policy_information();
+
+	--根据health_insurance_listing 更新相关字段
+	shanglifeecif.up_insurancearrangement_health_insurance_listing();
+
+	--其他标的字段 更新
+	shanglifeecif.up_insurancearrangement_other();
+END;
+
+
+
+/
+
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_insurancearrangement_policy_information() -- 创建主存储过程
+IS    
+BEGIN
+
+INSERT INTO shanglifeecif.insurancearrangement(
+  iaid ,--'保单ID', 
+  policyno ,-- '保险单号 INSURANCEINFO.CONTNO', 
+  pindate ,-- '起保日期 POLICY_INFORMATION.CVALIDATE', 
+  pmdate ,-- '终保日期 POLICY_INFORMATION.ENDDATE', 
+  norenewal ,-- '续保次数 POLICY_INFORMATION.PAYCOUNT', 
+  payment ,-- '缴费方式 POLICY_INFORMATION.PAYINTV', 
+  applicantscustid ,-- '投保人 上游客户号,再找到individualid', 
+  appname ,-- '投保人名称 POLICY_INFORMATION.NAME', 
+  appcertid ,-- '投保人证件号码 POLICY_INFORMATION.IDNO', 
+  insuredscustid ,-- '主被保险人 游客户号', 
+  insname ,-- '主被保险人名称 POLICY_INFORMATION.INSUREDNAME', 
+  inscertid ,-- '主被保险人证件号码 POLICY_INFORMATION.INSUREDIDNO', 
+  productid ,-- '险种代码 POLICY_INFORMATION.RISKCODE', 
+  policybelong ,-- '业绩归属 POLICY_INFORMATION.SALECOM',  
+  payendyear ,-- '缴费年期 POLICY_INFORMATION.PAYENDYEAR', 
+  
+  agrmntage ,--保险期限
+  
+  created_by ,-- '创建人', 
+  created_time -- '创建时间', 
+
+) 
+SELECT 
+	row_number()over(),
+	CONTNO,--policyno ,-- '保险单号 INSURANCEINFO.CONTNO', 
+	CVALIDATE,--pindate ,-- '起保日期 POLICY_INFORMATION.CVALIDATE', 
+	ENDDATE,--pmdate ,-- '终保日期 POLICY_INFORMATION.ENDDATE', 
+	PAYCOUNT,--norenewal ,-- '续保次数 POLICY_INFORMATION.PAYCOUNT', 
+	PAYINTV,--payment ,-- '缴费方式 POLICY_INFORMATION.PAYINTV', 
+	CUSTOMERNO,--applicantid ,-- '投保人 根据POLICY_INFORMATION.CUSTOMERNO关联individual上游客户号,再找到individualid', 
+	NAME,--appname ,-- '投保人名称 POLICY_INFORMATION.NAME', 
+	IDNO,--appcertid ,-- '投保人证件号码 POLICY_INFORMATION.IDNO', 
+	insuredno,--insuredid ,-- '主被保险人 insuredno', 
+	INSUREDNAME,--insname ,-- '主被保险人名称 POLICY_INFORMATION.INSUREDNAME', 
+	INSUREDIDNO,--inscertid ,-- '主被保险人证件号码 POLICY_INFORMATION.INSUREDIDNO', 
+	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
+	end,
+	'admin',
+	sysdate() 
+	FROM shanghailifeecif.policy_information 
+	--更新险种大类
+	/*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;*/;
+	--更新投保人和被保人id  因为 scustid有重复所以需要去下重
+
+	UPDATE shanglifeecif.insurancearrangement a SET (
+		applicantid --'投保人ID',
+	) = (
+	   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 --'投保人ID',
+	) = (
+	   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 ;
+
+	--更新INSURANCEINFO 表中的信息
+
+	UPDATE shanglifeecif.insurancearrangement a SET (
+		pano ,-- '投保单号 INSURANCEINFO.PRTNO',  
+		pisdate ,-- '签单日期 INSURANCEINFO.SIGNDATE', 
+		padate ,-- '投保日期 INSURANCEINFO.POLAPPLYDATE', 
+		policystate ,--INSURANCEINFO,appflag
+		prem ,-- '总保费 INSURANCEINFO.PREM', 
+		productname ,-- '险种名称	 INSURANCEINFO.RISKNAME'
+		agentchannel -- '代理渠道 INSURANCEINFO.SELLTYPE', 
+	) = (
+		select
+			PRTNO,--pano ,-- '投保单号 INSURANCEINFO.PRTNO',  
+			SIGNDATE,--pisdate ,-- '签单日期 INSURANCEINFO.SIGNDATE', 
+			POLAPPLYDATE,--padate ,-- '投保日期 INSURANCEINFO.POLAPPLYDATE', 
+			appflag,--policystate ,--INSURANCEINFO,appflag
+			PREM,--prem ,-- '总保费 INSURANCEINFO.PREM', 
+			RISKNAME,--productname ,-- '险种名称	 INSURANCEINFO.RISKNAME'
+			SELLTYPE--agentchannel ,-- '代理渠道 INSURANCEINFO.SELLTYPE', 
+		from shanghailifeecif.INSURANCEINFO b
+		where b.contno  = a.policyno
+	) WHERE 1=1 ;
+
+END;
+/
+
+--临时表
+
+CREATE TABLE shanglifeecif.insurancearrangement_health_tmp(
+    id string,
+    orderid string  DEFAULT NULL COMMENT '用于分组的排序号',
+    contno string DEFAULT NULL COMMENT '保单号',
+  	AGENTGROUP string DEFAULT NULL COMMENT '承保分公司',--pwcomp ,-- '承保分公司 HEALTH_INSURANCE_LISTING.AGENTGROUPAREA 营业区HEALTH_INSURANCE_LISTING.AGENTGROUP 营业部', 
+	SALECHANNELS string DEFAULT NULL COMMENT '销售渠道',--schannel ,-- '销售渠道 HEALTH_INSURANCE_LISTING.SALECHANNELS 1 2 3 4 5',
+	AMNT string DEFAULT NULL COMMENT '总保额',--risk ,-- '总保额 HEALTH_INSURANCE_LISTING.AMNT(测试环境中,此表保单数据量较其他表如:POLICY_INFORMATION,INSURANCEINFO 缺少至少一个数据量级)', 
+	AGENTCODE  string DEFAULT NULL COMMENT'业务员名称'--spname ,-- '业务员名称 HEALTH_INSURANCE_LISTING.AGENTCODE', 
+) COMMENT '保单处理个险承保清单自助分析 数据临时表 '
+STORED AS ES
+with shard number 10
+replication 1;
+
+
+CREATE OR REPLACE PROCEDURE shanglifeecif.up_insurancearrangement_health_insurance_listing() -- 创建主存储过程
+IS    
+BEGIN
+	--清空临时表数据
+	delete from shanglifeecif.insurancearrangement_health_tmp;
+
+	--初始化临时表
+	insert into shanglifeecif.insurancearrangement_health_tmp (
+		id,
+		orderid,
+		contno,
+		agentgroup,
+		SALECHANNELS,
+		AMNT,
+		AGENTCODE
+	) select 
+		row_number()over(),
+		row_number()over(PARTITION BY contno),
+		contno,
+		agentgroup,
+		SALECHANNELS,
+		AMNT,
+		AGENTCODE
+	from shanghailifeecif.HEALTH_INSURANCE_LISTING
+
+	--根据临时表更新insurancearrangement 表
+	UPDATE shanglifeecif.insurancearrangement a SET (
+		pwcomp ,-- '承保分公司 HEALTH_INSURANCE_LISTING.AGENTGROUPAREA 营业区HEALTH_INSURANCE_LISTING.AGENTGROUP 营业部', 
+		schannel ,-- '销售渠道 HEALTH_INSURANCE_LISTING.SALECHANNELS 1 2 3 4 5',
+		risk ,-- '总保额 HEALTH_INSURANCE_LISTING.AMNT(测试环境中,此表保单数据量较其他表如:POLICY_INFORMATION,INSURANCEINFO 缺少至少一个数据量级)', 
+		spname -- '业务员名称 HEALTH_INSURANCE_LISTING.AGENTCODE', 
+	) = (
+		select
+			b.AGENTGROUP,--pwcomp ,-- '承保分公司 HEALTH_INSURANCE_LISTING.AGENTGROUPAREA 营业区HEALTH_INSURANCE_LISTING.AGENTGROUP 营业部', 
+			b.SALECHANNELS,--schannel ,-- '销售渠道 HEALTH_INSURANCE_LISTING.SALECHANNELS 1 2 3 4 5',
+			b.AMNT,--risk ,-- '总保额 HEALTH_INSURANCE_LISTING.AMNT(测试环境中,此表保单数据量较其他表如:POLICY_INFORMATION,INSURANCEINFO 缺少至少一个数据量级)', 
+			b.AGENTCODE--spname ,-- '业务员名称 HEALTH_INSURANCE_LISTING.AGENTCODE', 
+		from shanglifeecif.insurancearrangement_health_tmp b
+		where b.contno  = a.policyno
+		and b.orderid = 1
+	) 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 shanghailifeecif.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 shanghailifeecif.AUDIT_EDORLIST b
+	   where b.contno  = a.policyno
+	) WHERE 1=1 ;
+
+
+	UPDATE shanglifeecif.insurancearrangement a SET (
+		soinsured-- '被保人数', 
+	) = (
+	   SELECT
+	   		PEOPLES3
+	   FROM shanghailifeecif.HEALTH_GROUP_LISTING b
+	   where b.contno  = a.policyno
+	) WHERE 1=1 ;
+
+END;

+ 390 - 0
sql-achievement/存储过程/洛阳测试环境使用sql整理/客户信息存储过程.sql

@@ -0,0 +1,390 @@
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_individual_main() -- 初始化 数据全部插入
+IS    
+DECLARE
+	individual_count int
+	strsql string
+BEGIN
+	--先验是否一个客户id有多条记录对应不通的证件类别
+	--初始化 身份证 用户
+	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;
+
+/
+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
+				shanghailifeecif.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
+				shanghailifeecif.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
+				shanghailifeecif.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
+				shanghailifeecif.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
+				shanghailifeecif.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
+				shanghailifeecif.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
+				shanghailifeecif.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
+				shanghailifeecif.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	,--	家庭加分2
+			Awarded2	,--	续期加分
+			Awarded1	,--	保单加分
+			SOValue	,--	总分值
+			EndDate,	--	客户等级失效日期
+			Height,		--身高
+			Weight,		--体重
+			BMI,
+			PIncome,	--个人年收入
+			FIncome,	--家庭年收入
+			IncomeSource,	--收入来源
+			SIStatus,	--社保情况
+			Ethnic,  --民族情况
+			Nation, --国籍
+			MaritalStat, --婚姻
+			Employer,--工作单位
+			Education,--学历
+			Dday, --死亡日期
+			regtype  --户籍类型
+		) = (
+			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
+
+				from shanghailifeecif.t_customer_class b
+				where b.CUSTOMER_ID = a.scustid
+		) WHERE 1=1 ;
+
+END;
+/
+DROP TABLE IF EXISTS shanglifeecif.occupation_tmp;
+CREATE  TABLE shanglifeecif.occupation_tmp(
+  scustid string not NULL COMMENT '客户号',   
+  OccupationId string DEFAULT NULL COMMENT '名称', 
+  Occupation string DEFAULT NULL COMMENT '出生日期' ,
+   HomeAdress string DEFAULT NULL COMMENT '籍贯'
+  )
+ COMMENT 'occupation_tmp 客户职业临时表' STORED AS ES 
+with shard number 10
+replication 1;
+
+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 shanghailifeecif.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 ;
+
+	/*--更新被保人手机号
+	UPDATE shanglifeecif.individual a SET (
+		PMPhone
+	) = (
+		select 
+			INSUREDMOBILE
+			
+		from shanghailifeecif.policy_information b
+		where b.INSUREDNO = a.scustid 
+	) WHERE 1=1 ;*/
+	
+END;
+/
+BEGIN
+	shanglifeecif.init_individual_main();
+end ;

File diff suppressed because it is too large
+ 767 - 0
sql-achievement/存储过程/洛阳测试环境使用sql整理/客户标签koucx20210126.sql


+ 25 - 0
sql-achievement/存储过程/洛阳测试环境使用sql整理/年龄段性别分布统计.sql

@@ -0,0 +1,25 @@
+CREATE  TABLE shanglifeecif.age_sex_distribution(
+  id string DEFAULT NULL, 
+  labelname string DEFAULT NULL COMMENT '阶段名称', 
+  gender string DEFAULT NULL COMMENT '性别', 
+  cusnum string DEFAULT NULL COMMENT '客户数量'
+)
+COMMENT '年龄段性别分布'
+STORED AS ES
+with shard number 10
+replication 1;
+
+CREATE OR REPLACE PROCEDURE shanglifeecif.age_sex_distribution() IS
+DECLARE
+BEGIN
+	delete from shanglifeecif.age_sex_distribution;
+	insert into shanglifeecif.age_sex_distribution (
+		id,
+		labelName,
+		gender,
+		cusNum
+	) SELECT row_number()over(),t.labelName,t.gender,t.cusNum FROM (
+	SELECT si.label4 labelName,si.gender,count(1) cusNum FROM shanglifeecif.individual si GROUP BY si.label4,si.gender
+	) t
+			
+END	;

+ 125 - 0
sql-achievement/存储过程/洛阳测试环境使用sql整理/接触信息存储过程.sql

@@ -0,0 +1,125 @@
+BEGIN
+	shanglifeecif.init_communication_main();
+END;	
+/
+
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_communication_main() IS
+DECLARE
+BEGIN
+	shanglifeecif.init_communication();
+	shanglifeecif.init_communication_sp01();
+	shanglifeecif.init_communication_sp02();
+END ;
+
+/
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_communication() IS
+DECLARE
+BEGIN
+	DELETE FROM shanglifeecif.communication;
+	insert into shanglifeecif.communication (
+		CommID,
+		CPName,
+		CPPhone,
+		PolicyNo,
+		CommTime,
+		Reason,
+		CommChannel,
+		created_by ,-- '创建人', 
+  		created_time -- '创建时间', 
+	) select 
+   		row_number()over(),
+   		econtactsName,
+		econtactsPhone,
+		contNos,
+		startTime,
+		reasonSecondName,
+		'最近呼入' AS CommChannel,
+		'admin',
+		sysdate()
+	from cc_record_main WHERE contNos IS NOT null;
+	
+END	;
+/
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_communication_sp01() IS
+DECLARE
+BEGIN
+	UPDATE shanglifeecif.communication sc set(
+		sc.RSOApplicant,
+		sc.CompLink,
+		sc.CompReason,
+		sc.ProcedureResult
+	
+	) = (SELECT 
+			temp.complaintsRelation,
+			temp.complaintsLink,
+			temp.resultClassification,
+			temp.procedureResult
+	
+		FROM (
+			
+			SELECT  
+			(CASE scac.complaintsRelation --201  本人 202  子女 203  配偶 204  父母  205 其他
+			WHEN '201' THEN '本人'  
+			WHEN '202' THEN '子女'  
+			WHEN '203' THEN '配偶'  
+			WHEN '204' THEN '父母'  
+			WHEN '205' THEN '其他'  
+			END) AS complaintsRelation,
+			(CASE scac.complaintsLink --:承保环节 : 211 销售环节 :212 、回访环节:213 、保全变更环节: 214 、理赔环节: 215 、售后服务环节: 216
+			WHEN '211' THEN '承保环节'  
+			WHEN '212' THEN '销售环节'  
+			WHEN '213' THEN '回访环节'  
+			WHEN '214' THEN '保全变更环节'  
+			WHEN '215' THEN '理赔环节'  
+			WHEN '216' THEN '售后服务环节'  
+			END) AS complaintsLink,
+			(CASE scac.resultClassification --:销售误导:101  代签名:102  理赔争议:103  服务人员态度:104 售后服务不满:105 售前服务不满:106  外部陌电骚扰:107
+			WHEN '101' THEN '销售误导'  
+			WHEN '102' THEN '代签名'  
+			WHEN '103' THEN '理赔争议'  
+			WHEN '104' THEN '服务人员态度'  
+			WHEN '105' THEN '售后服务不满'  
+			WHEN '106' THEN '售前服务不满'  
+			WHEN '107' THEN '外部陌电骚扰'  
+			END) AS resultClassification,
+			scac.procedureResult,
+			row_number() over(partition by scac.productNos) rn,
+			scac.productNos,
+			scac.complaintsName
+		FROM 
+		cc_action_complaints scac
+		) temp
+		WHERE sc.PolicyNo = temp.productNos AND sc.CPName = temp.complaintsName AND temp.rn = 1)
+	
+END	;
+/
+CREATE OR REPLACE PROCEDURE shanglifeecif.init_communication_sp02() IS
+DECLARE
+BEGIN
+	UPDATE shanglifeecif.communication sc SET(
+	IndID,
+	CPCertID
+	) = (
+		SELECT 
+			ApplicantID,
+			AppCertID
+		FROM (
+			SELECT 
+		ApplicantID,
+		AppCertID,
+		row_number() over(partition by PolicyNo) rn,
+		PolicyNo
+		FROM 
+		shanglifeecif.InsuranceArrangement sia
+		
+		) temp
+	WHERE temp.PolicyNo = sc.PolicyNo AND sc.RSOApplicant = '本人' AND temp.rn = 1)
+END	;
+/
+
+BEGIN
+	shanglifeecif.init_communication();
+	shanglifeecif.init_communication_sp01();
+	shanglifeecif.init_communication_sp02();
+END ;
+

+ 110 - 0
sql-achievement/存储过程/洛阳测试环境使用sql整理/理赔信息储存过程.sql

@@ -0,0 +1,110 @@
+CREATE OR REPLACE PROCEDURE shanglifeecif.insuranceclaimthread_main() -- 创建主存储过程
+IS    
+BEGIN
+	insert into shanglifeecif.insuranceclaimthread (
+		icthreadid ,--'保险理赔Id',1
+		crno ,--'立案号',2
+		--companyno ,-- '公司代码',
+		policyno ,--'保险单号 INSURANCE_CLAIM.CONTNO',3
+		--applicantid ,--'投保人ID',
+		--appname ,--'投保人名称',
+		--appphone ,--'投保人手机',
+		--appcertid ,--'投保人证件号码 INSURANCE_CLAIM.RISKDATE',
+		cnno ,--'报案号',4
+		losstime ,-- '损失发生时间',5
+		--rpid ,-- '报案人',
+		rpname ,--'报案人名称',6
+		--rpphone ,-- '报案人电话',
+		--lpid ,--'出险人	根据INSURANCE_CLAIM.INSUREDNO获取indid',
+		lpscutid,--'出险人上游客户号7
+		--lpname ,-- '出险人名称',
+		cndate ,--'报案日期 INSURANCE_CLAIM.RPTDATE',
+		lossdescribe ,-- '损失原因 案件发生的原因:INSURANCE_CLAIM.LLOCCURREASON',
+		crdate ,-- '立案日期 INSURANCE_CLAIM.RGTDATE',
+		cndescribe ,--'报案描述 INSURANCE_CLAIM.ACCIDENTDETAIL',
+		claimstatus ,--'理赔状态 案件的状态,例如:录入、已立案等',
+		csdate ,--'理赔状态日期',
+		relationship ,-- '报案人与出险人关系',
+		ccno ,-- '赔案号 AUDIT_CLAIM_INSURANCE.CLMNO',
+		ccstatus ,--'赔案状态',
+		--ccsdate ,-- '赔案状态日期',
+		productid ,--'险种代码	INSURANCE_CLAIM_HEALTH.RISKCODE',
+		productname, --'险种名称	INSURANCE_CLAIM_HEALTH.RISKNAME',
+		ccamt ,--'赔付金额	INSURANCE_CLAIM_HEALTH.realpay',
+		--branchcode,-- '机构代码',
+		claimcasestatus ,--'案件状态INSURANCE_CLAIM_HEALTH.LLCLAIMSTATE',
+		created_by ,
+		created_time 
+		-- updated_time,
+		-- updated_by
+	) select 
+   		row_number()over(),--1
+   		rgtno,--2
+		contno,--3
+		rptno,--报案号4
+		riskdate,--损失发生的时间5
+		rptorname,--报案人名称6
+   		INSUREDNO,--出险人 上游客户号
+   		--lpname,
+		rptdate,
+		lloccurreason,
+		rgtdate,
+		accidentdetail,--报案描述
+		llclaimstate,
+		auditdate,--审批日期
+		relation,
+		clmno,--赔案号
+		llgettype,--赔案状态
+		riskcode,
+		riskname,
+		realpay,
+		llclaimstate,--案件状态
+		'admin',
+		sysdate()
+	from shanghailifeecif.INSURANCE_CLAIM where contno is not null 
+	
+	update shanglifeecif.insuranceclaimthread a set (
+		lpid,
+		lpname
+	) = (SELECT 
+			temp.indid,
+			temp.name
+			FROM (
+				select 
+				b.indid,
+				row_number() over(partition by b.scustid) rn,
+				b.scustid,
+				b.name
+			from shanglifeecif.individual b
+			) temp WHERE a.lpscutid = temp.scustid AND temp.rn = 1);
+
+
+	UPDATE shanglifeecif.insuranceclaimthread a SET (
+			applicantid ,--'投保人ID',
+			appname ,--'投保人名称',
+			appphone ,--'投保人手机',
+			appcertid, --'投保人证件号码 INSURANCE_CLAIM.RISKDATE',
+			branchcode-- '机构代码',
+		) = (
+		
+			SELECT 
+				temp.applicantid ,--'投保人ID',
+				temp.appname ,--'投保人名称',
+				temp.appphone ,--'投保人手机',
+				temp.appcertid, --'投保人证件号码 INSURANCE_CLAIM.RISKDATE',
+				temp.branchcode-- '机构代码',
+			FROM (
+				select 
+				row_number() over(partition by applicantid) rn,
+				applicantid ,--'投保人ID',
+				appname ,--'投保人名称',
+				appphone ,--'投保人手机',
+				appcertid, --'投保人证件号码 INSURANCE_CLAIM.RISKDATE',
+				branchcode,-- '机构代码',
+				policyno
+			from shanglifeecif.insurancearrangement b
+			--where b.policyno  = a.policyno
+			
+			) temp WHERE temp.policyno = a.policyno AND temp.rn = 1);
+
+END;

+ 53 - 0
sql-achievement/存储过程/洛阳测试环境使用sql整理/险种大类统计.sql

@@ -0,0 +1,53 @@
+CREATE TABLE shanglifeecif.riskcode_statistics(
+    id string,
+    kindcode string  DEFAULT NULL COMMENT '险种大类代码',
+    kindNAme string DEFAULT NULL COMMENT '险种大类名称',
+  	khnum string DEFAULT NULL COMMENT '客户数量',--pwcomp ,-- '承保分公司 HEALTH_INSURANCE_LISTING.AGENTGROUPAREA 营业区HEALTH_INSURANCE_LISTING.AGENTGROUP 营业部', 
+	tatolprem string DEFAULT NULL COMMENT '总保额'
+) COMMENT '险种大类统计表'
+STORED AS ES
+with shard number 10
+replication 1;
+
+CREATE OR REPLACE PROCEDURE shanglifeecif.riskcode_statistics() IS
+DECLARE
+BEGIN
+	delete from shanglifeecif.riskcode_statistics;
+	insert into shanglifeecif.riskcode_statistics (
+		id,
+		kindcode,
+		kindNAme,
+		khnum,
+		tatolprem
+	) --险种大类统计
+	SELECT row_number()over(),temp.kindcode,temp.kindname,temp.khnum,temp.totalPrem FROM (
+		SELECT sl.kindcode,
+	(CASE sl.kindcode 
+		WHEN 'A' THEN '意外伤害险' 
+		WHEN 'U' THEN '万能保险' 
+		WHEN 'R' THEN '年金保险' 
+		WHEN 'S' THEN '重疾保险' 
+		WHEN 'L' THEN '人寿保险' 
+		WHEN 'H' THEN '健康险' 
+	END) AS kindname,
+	count(spi.idno) AS khnum,nvl(sum(spi.prem),0) AS totalPrem FROM shanghailifeecif.lmriskapp sl 
+	LEFT JOIN shanghailifeecif.policy_information spi ON spi.riskcode = sl.riskcode
+	GROUP BY sl.kindcode
+	) temp
+	
+	
+	/*SELECT row_number()over(),tt.riskcode,tt.riskname,tt.khnum,tt.totalPrem FROM (
+	SELECT sl.riskcode,sl.riskname,count(spi.idno) AS khnum,sum(spi.prem) AS totalPrem FROM shanghailifeecif.lmriskapp sl 
+	LEFT JOIN shanghailifeecif.policy_information spi ON spi.riskcode = sl.riskcode
+	GROUP BY sl.riskcode,sl.riskname
+	) tt WHERE tt.khnum > 0 AND tt.totalPrem >0*/
+	
+	/*SELECT slk.kindcode,sum(temp.khnum),sum(totalPrem) FROM (
+		SELECT sl.riskcode,sl.riskname,count(spi.idno) AS khnum,sum(spi.prem) AS totalPrem FROM shanghailifeecif.lmriskapp sl 
+	LEFT JOIN shanghailifeecif.policy_information spi ON spi.riskcode = sl.riskcode
+	GROUP BY sl.riskcode,sl.riskname
+	) temp LEFT JOIN shanghailifeecif.lmriskapp slk ON slk.riskcode =  temp.riskcode
+	GROUP BY slk.kindcode*/
+	
+			
+END	;

+ 13 - 22
sql-achievement/存储过程/理赔qxp.sql

@@ -111,21 +111,21 @@ CREATE OR REPLACE PROCEDURE insuranceclaimthread_main() -- 创建主存储过程
 IS    
 BEGIN
 	insert into insuranceclaimthread (
-		icthreadid ,--'保险理赔Id',
-		crno ,--'立案号',
+		icthreadid ,--'保险理赔Id',1
+		crno ,--'立案号',2
 		--companyno ,-- '公司代码',
-		policyno ,--'保险单号 INSURANCE_CLAIM.CONTNO',
+		policyno ,--'保险单号 INSURANCE_CLAIM.CONTNO',3
 		--applicantid ,--'投保人ID',
 		--appname ,--'投保人名称',
 		--appphone ,--'投保人手机',
 		--appcertid ,--'投保人证件号码 INSURANCE_CLAIM.RISKDATE',
-		cnno ,--'报案号',
-		losstime ,-- '损失发生时间',
+		cnno ,--'报案号',4
+		losstime ,-- '损失发生时间',5
 		--rpid ,-- '报案人',
-		rpname ,--'报案人名称',
+		rpname ,--'报案人名称',6
 		--rpphone ,-- '报案人电话',
 		--lpid ,--'出险人	根据INSURANCE_CLAIM.INSUREDNO获取indid',
-		lpscutid,--'出险人上游客户号
+		lpscutid,--'出险人上游客户号7
 		--lpname ,-- '出险人名称',
 		cndate ,--'报案日期 INSURANCE_CLAIM.RPTDATE',
 		lossdescribe ,-- '损失原因 案件发生的原因:INSURANCE_CLAIM.LLOCCURREASON',
@@ -147,19 +147,12 @@ BEGIN
 		-- updated_time,
 		-- updated_by
 	) select 
-   		row_number()over(),
-   		rgtno,
-
-		contno,
-
-
-
-		rptno,--报案号
-		riskdate,--损失发生的时间
-
-		rptorname,--报案人名称
-
-
+   		row_number()over(),--1
+   		rgtno,--2
+		contno,--3
+		rptno,--报案号4
+		riskdate,--损失发生的时间5
+		rptorname,--报案人名称6
    		INSUREDNO,--出险人 上游客户号
    		--lpname,
 		rptdate,
@@ -171,11 +164,9 @@ BEGIN
 		relation,
 		clmno,--赔案号
 		llgettype,--赔案状态
-
 		riskcode,
 		riskname,
 		realpay,
-
 		llclaimstate,--案件状态
 		'admin',
 		sysdate()