接触信息.sql 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. CREATE OR REPLACE PROCEDURE shanglifeecif.init_communication() IS
  2. DECLARE
  3. BEGIN
  4. DELETE FROM shanglifeecif.communication;
  5. insert into shanglifeecif.communication (
  6. CommID,
  7. CPName,
  8. CPPhone,
  9. PolicyNo,
  10. CommTime,
  11. Reason,
  12. CommChannel,
  13. created_by ,-- '创建人',
  14. created_time -- '创建时间',
  15. ) select
  16. row_number()over(),
  17. econtactsName,
  18. econtactsPhone,
  19. contNos,
  20. startTime,
  21. reasonSecondName,
  22. '最近呼入' AS CommChannel,
  23. 'admin',
  24. sysdate()
  25. from cc_record_main WHERE contNos IS NOT null;
  26. END ;
  27. /
  28. CREATE OR REPLACE PROCEDURE shanglifeecif.init_communication_sp01() IS
  29. DECLARE
  30. BEGIN
  31. UPDATE shanglifeecif.communication sc set(
  32. sc.RSOApplicant,
  33. sc.CompLink,
  34. sc.CompReason,
  35. sc.ProcedureResult
  36. ) = (SELECT
  37. temp.complaintsRelation,
  38. temp.complaintsLink,
  39. temp.resultClassification,
  40. temp.procedureResult
  41. FROM (
  42. SELECT
  43. (CASE scac.complaintsRelation --201 本人 202 子女 203 配偶 204 父母 205 其他
  44. WHEN '201' THEN '本人'
  45. WHEN '202' THEN '子女'
  46. WHEN '203' THEN '配偶'
  47. WHEN '204' THEN '父母'
  48. WHEN '205' THEN '其他'
  49. END) AS complaintsRelation,
  50. (CASE scac.complaintsLink --:承保环节 : 211 销售环节 :212 、回访环节:213 、保全变更环节: 214 、理赔环节: 215 、售后服务环节: 216
  51. WHEN '211' THEN '承保环节'
  52. WHEN '212' THEN '销售环节'
  53. WHEN '213' THEN '回访环节'
  54. WHEN '214' THEN '保全变更环节'
  55. WHEN '215' THEN '理赔环节'
  56. WHEN '216' THEN '售后服务环节'
  57. END) AS complaintsLink,
  58. (CASE scac.resultClassification --:销售误导:101 代签名:102 理赔争议:103 服务人员态度:104 售后服务不满:105 售前服务不满:106 外部陌电骚扰:107
  59. WHEN '101' THEN '销售误导'
  60. WHEN '102' THEN '代签名'
  61. WHEN '103' THEN '理赔争议'
  62. WHEN '104' THEN '服务人员态度'
  63. WHEN '105' THEN '售后服务不满'
  64. WHEN '106' THEN '售前服务不满'
  65. WHEN '107' THEN '外部陌电骚扰'
  66. END) AS resultClassification,
  67. scac.procedureResult,
  68. row_number() over(partition by scac.productNos) rn,
  69. scac.productNos,
  70. scac.complaintsName
  71. FROM
  72. cc_action_complaints scac
  73. ) temp
  74. WHERE sc.PolicyNo = temp.productNos AND sc.CPName = temp.complaintsName AND temp.rn = 1)
  75. END ;
  76. /
  77. CREATE OR REPLACE PROCEDURE shanglifeecif.init_communication_sp02() IS
  78. DECLARE
  79. BEGIN
  80. UPDATE shanglifeecif.communication sc SET(
  81. IndID,
  82. CPCertID
  83. ) = (
  84. SELECT
  85. ApplicantID,
  86. AppCertID
  87. FROM
  88. shanglifeecif.InsuranceArrangement sia
  89. WHERE sia.PolicyNo = sc.PolicyNo AND sc.RSOApplicant = '本人'
  90. )
  91. END ;