var sql = "select t1.registno,t1.accidentno,t1.policyno,t2.casetype as caseflag from ods_new.ods_car_lregist t1 left join ods_new.ods_car_lclaim t2 on t1.accidentno = t2.accidentno and t1.policyno = t2.policyno"
var claimDf = spark.sql(sql)
saveDf(claimDf, "tmp_claim")
// 理赔 join 报案
sql = "select t1.*,t2.frameno,t2.licenseno,t2.reportormobile as reportorMobilenumber,t2.comcode,t2.accidentno,t2.policyno,t2.damagetypedesc as damagetypename,t2.otherareaflag as isLocal, t2.firstsiteflag as isFirstScene from tmp_claim t1 left join ods_new.ods_car_lregist t2 on t1.accidentno = t2.accidentno and t1.registno = t2.registno";
claimDf = makeJsonDf(sql, "incident")
saveDf(claimDf, "tmp_claim")
claimDf.show(10, false)
// 查勘 join 车辆信息
sql = "select t1.accidentno,t1.accidenttype,t1.damagetypecode,t1.surveyorname,t2.licenseno,t2.engineno,t2.drivername,t2.drivinglicenseno,t2.insuredcarflag from ods_new.ODS_CAR_LSURVEY t1 left join ods_new.ODS_CAR_LSURVEY_CAR t2 on t1.accidentno = t2.accidentno"
val investigationDf = makeJsonDf(sql, "vehicleLossList")
saveDf(investigationDf, "tmp_investigation")
// 理赔 join 查勘
sql = "select t1.*,t2.accidentno,t2.accidenttype,t2.damagetypecode,t2.surveyorname as checkerName,t2.vehicleLossList from tmp_claim t1 left join tmp_investigation t2 on t1.accidentno = t2.accidentno"
claimDf = makeJsonDf(sql, "investigation")
saveDf(claimDf, "tmp_claim")
claimDf.show(10, false)
中间表慎用同一张表,一旦重新计算,就会出现结果为空的情况