ReadCardInSSMPProcess.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using Newtonsoft.Json.Linq;
  2. using PTMedicalInsurance.Common;
  3. using PTMedicalInsurance.Variables;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace PTMedicalInsurance.Business.SelfServiceMachine
  10. {
  11. class ReadCardInSSMPProcess:ReadCardProcess
  12. {
  13. public override CallResult Process(JObject input)
  14. {
  15. JObject joCardInfo = new JObject();
  16. JObject joRtn = new JObject();
  17. JObject joInput = new JObject();
  18. try
  19. {
  20. Global.pat.certType = "01";
  21. int rtn = 0;
  22. //电子凭证
  23. if (Global.ssmp.cardType == "02")
  24. {
  25. Global.pat.mdtrtcertType = "01";
  26. //Global.businessType = cc.businessType;
  27. }
  28. //身份证
  29. if (Global.ssmp.cardType == "04")
  30. {
  31. Global.pat.mdtrtcertType = "02";
  32. }
  33. //社保卡
  34. if (Global.ssmp.cardType == "03")
  35. {
  36. Global.pat.mdtrtcertType = "03";
  37. }
  38. YinHaiSafeCtrl safeCtrl = new YinHaiSafeCtrl();
  39. if (Global.pat.admType == 1)
  40. {
  41. if (Global.pat.mdtrtcertType == "03")
  42. {
  43. rtn = safeCtrl.Prepare(Global.pat.mdtrtcertType, "1101", out outParam);
  44. if (rtn != 0)
  45. {
  46. return Exception("调用安全控件", outParam);
  47. }
  48. //重定向
  49. if (Global.ssmp.isNeedRedirect)
  50. {
  51. if (hBus.Redirect(Global.inf.originalInterfaceDr, out outParam) != 0)
  52. {
  53. return Exception(-2, "Redirect", outParam);
  54. }
  55. }
  56. //再次调用门诊 2207A,否则后面无法结算
  57. rtn = safeCtrl.Prepare(Global.pat.mdtrtcertType, "2207A", out outParam);
  58. if (rtn != 0)
  59. {
  60. return Exception("调用安全控件", outParam);
  61. }
  62. }
  63. //电子凭证
  64. if (Global.pat.mdtrtcertType == "01")
  65. {
  66. rtn = safeCtrl.Prepare(Global.pat.mdtrtcertType, "2207A", out outParam);
  67. if (rtn != 0)
  68. {
  69. return Exception("调用安全控件", outParam);
  70. }
  71. //重定向
  72. if (Global.ssmp.isNeedRedirect)
  73. {
  74. if (hBus.Redirect(Global.inf.originalInterfaceDr, out outParam) != 0)
  75. {
  76. return Exception(-2, "Redirect", outParam);
  77. }
  78. }
  79. }
  80. }
  81. else
  82. {
  83. rtn = safeCtrl.Prepare(Global.pat.mdtrtcertType, "1101", out outParam);
  84. if (rtn != 0)
  85. {
  86. return Exception("调用安全控件", outParam);
  87. }
  88. //重定向
  89. if (Global.ssmp.isNeedRedirect)
  90. {
  91. if (hBus.Redirect(Global.inf.originalInterfaceDr, out outParam) != 0)
  92. {
  93. return Exception(-2, "Redirect", outParam);
  94. }
  95. }
  96. }
  97. if (rtn == 0)
  98. {
  99. rtn = trade1101(out outParam);
  100. }
  101. if (rtn == 0)
  102. {
  103. return Success();
  104. }
  105. return Exception(-1, "读卡", outParam);
  106. }
  107. catch (Exception ex)
  108. {
  109. return Error("异常:" + ex.Message);
  110. }
  111. }
  112. }
  113. }