IPSettlementProcess.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using Newtonsoft.Json.Linq;
  2. using PTMedicalInsurance.Common;
  3. using PTMedicalInsurance.Helper;
  4. using PTMedicalInsurance.Variables;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace PTMedicalInsurance.Business
  12. {
  13. class IPSettlementProcess : AbstractProcess
  14. {
  15. public IPSettlementProcess()
  16. {
  17. }
  18. public IPSettlementProcess(JObject orginal)
  19. {
  20. this.OrginalInput = orginal;
  21. }
  22. public override CallResult Process(JObject input)
  23. {
  24. string errMsg = "";
  25. #region 住院结算之前调用3102
  26. if (hBus.ShouldExecutePreAndInProcess("IPPreSetTrigScen"))
  27. {
  28. if (hBus.InProcessAnalysis(Global.pat.preAndInPro.IPPreSetTrigScen, out errMsg) != 0)
  29. {
  30. if (MessageBox.Show("医保明细审核事前分析服务调用失败!是否继续结算?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  31. {
  32. }
  33. else
  34. {
  35. return Error(-1, $"医保明细审核事前分析服务调用失败:{errMsg}");
  36. }
  37. }
  38. }
  39. #endregion
  40. #region 正式出院结算
  41. //在正式结算前读一次卡
  42. #region 结算前统一读卡核验身份
  43. //CallResult card = new ReadCardProcess().Process(input);
  44. //if (card.Code != 0)
  45. //{
  46. // return Exception(-1, "读卡失败,请确认是否社保卡是否正常!", card.Data);
  47. //}
  48. #endregion
  49. //读完卡后用新卡串
  50. //Global.pat.mdtrtcertNO = "";
  51. //input["Settlement"]["mdtrt_cert_no"] = Utils.ConvertMdtrtcertNo();
  52. JObject joSettlement = joSettlement = JObject.Parse(JsonHelper.getDestValue(input, "Settlement"));
  53. //基线版扩展
  54. JObject joDataExp = (JObject)joSettlement["exp_content"] ?? new JObject();
  55. //joDataExp.Add("cardtoken", Global.pat.card.Cardtoken);
  56. joDataExp.Add("elec_bill_code", "");
  57. joDataExp.Add("elec_billno_code", "");
  58. joDataExp.Add("elec_bill_chkcode", "");
  59. joSettlement["exp_content"] = joDataExp;
  60. joSettlement.Add("data", joSettlement);
  61. JObject jo2304Rtn = invoker.invokeCenterService(TradeEnum.InpatientSettlement, joSettlement);
  62. if (JsonHelper.parseCenterRtnValue(jo2304Rtn, out errMsg) != 0)
  63. {
  64. //取消出院
  65. new InpatientExitCancelProcess().Process(input);
  66. return Exception(-1, "结算失败", errMsg);
  67. }
  68. else
  69. {
  70. JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(jo2304Rtn, "output.setlinfo"));
  71. //济南未返回基金分项,手工拆分
  72. //JArray fundArray = new LocalPayFundSplitService().Split(joSetlinfo);
  73. //if (fundArray?.Count > 0)
  74. //{
  75. // jo2304Rtn["output"]["setldetail"] = fundArray;
  76. //}
  77. Global.pat.admType = 2;
  78. //返回给云医保平台结算信息
  79. if (mIS.saveSettlement(jo2304Rtn, out errMsg) != 0)
  80. {
  81. return Exception(-1, "结算成功,但云医保平台保存失败", errMsg);
  82. }
  83. //返回给云医保平台结算明细信息
  84. if (mIS.saveSettlementDetail(jo2304Rtn, out errMsg) != 0)
  85. {
  86. return Exception(-1, "云医保平台保存结算明细失败", errMsg);
  87. }
  88. //返回给HIS
  89. if (hIS.returnInpatSettlementInfo(OrginalInput, joSetlinfo, out outParam) != 0)
  90. {
  91. return Exception(-1, "返回结算信息给HIS", outParam);
  92. }
  93. else
  94. {
  95. //返回给前端
  96. JObject joHisServieRtn = JObject.Parse(outParam);
  97. hBus.returnToFrontEndAfterSettlement(jo2304Rtn, joHisServieRtn, out outParam);
  98. return IrisReturn("结算成功", JObject.Parse(outParam));
  99. }
  100. }
  101. #endregion
  102. }
  103. }
  104. }