OPPreSettlementProcess.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 OPPreSettlementProcess : AbstractProcess
  14. {
  15. /// <summary>
  16. /// 返回预结算结果
  17. /// </summary>
  18. /// <param name="joReg">基本信息含挂号、就诊、诊断、结算等入参</param>
  19. /// <returns></returns>
  20. public override CallResult Process(JObject joReg)
  21. {
  22. ////事中分析
  23. string errMsg = "";
  24. if (Global.curEvt.ext.isOpenAnalysis)
  25. {
  26. if (hBus.InProcessAnalysis("7", out errMsg) != 0) //事前事中:门诊挂号1 门诊收费登记2 住院登记3 住院收费登记4 住院执行医嘱5 门诊结算6 门诊预结算7 住院结算8 住院预结算9 购药划卡10
  27. {
  28. //rtnResult = JsonHelper.setExceptionJson(-1, "事前分析", errMsg).ToString();
  29. //return rtnResult;
  30. DialogResult dr = MessageBox.Show("【3102】医保明细审核事前分析服务医保中心返回结果:" + errMsg + "!是否继续?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  31. if (dr != DialogResult.OK)
  32. {
  33. return Exception(-1, "事中分析", JsonHelper.setExceptionJson(-1, "【3102】医保明细审核事中分析服务调用失败:", errMsg).ToString());
  34. }
  35. }
  36. }
  37. JObject joRtn = new JObject();
  38. //调用IRIS获取医保各项金额
  39. if (mIS.getSumFee(out outParam) != 0)
  40. {
  41. return Error(-1, "获取医保费用各项汇总金额");
  42. }
  43. JObject joSumFee = JObject.Parse(outParam);
  44. JObject joSettlement = JObject.Parse(JsonHelper.getDestValue(joReg, "settlement"));
  45. //修改joSettlement的就诊ID ,总金额等
  46. joSettlement["mdtrt_id"] = Global.pat.mdtrtID;
  47. joSettlement["mdtrt_cert_no"] = Utils.ConvertMdtrtcertNo(false); //预结算不需要转换
  48. joSettlement["medfee_sumamt"] = JsonHelper.getDestValue(joSumFee, "data.Sumamt");
  49. // 个性化(济南),费用不单独上传
  50. //joSettlement["patient"] = joReg;
  51. //joSettlement.Add("psn_name", Global.pat.name);
  52. //joSettlement.Add("gend", ("1".Equals(Global.pat.gend)?"男":"女"));
  53. //joSettlement.Add("cardno", Global.pat.card.NO);
  54. //joSettlement["admNo"] = Global.pat.adm_Dr; // 病历号
  55. // 异地就医标志
  56. //string otherAreaFlag = "10";
  57. //if (!Utils.isOtherCity() || Global.inf.interfaceDr == 28)
  58. //{
  59. // otherAreaFlag = "01"; //本地
  60. //}
  61. //joSettlement.Add("other_area_flag", otherAreaFlag);
  62. //var ret = hBus.getFeeDetail();
  63. //if (ret.code < 0)
  64. //{
  65. // return Error(ret.code,ret.data.ToString());
  66. //}
  67. //JArray jaFeeDetail = (JArray)ret.data;
  68. //joSettlement["feeDetail"] = jaFeeDetail;
  69. //预结算
  70. JObject jo2206Data = new JObject();
  71. jo2206Data.Add("data", joSettlement);
  72. JObject jo2206Rtn = invoker.invokeCenterService(TradeEnum.OutpatientPreSettlement, jo2206Data);
  73. if (JsonHelper.parseCenterRtnValue(jo2206Rtn, out outParam) != 0)
  74. {
  75. return Exception(-1, "出院预结算", outParam);
  76. }
  77. //返回给HIS进行预结算判断
  78. JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(jo2206Rtn, "output.setlinfo"));
  79. if (hIS.preSettlement(joSettlement, joSetlinfo, out outParam) != 0)
  80. {
  81. return Exception(-1, "返回结算信息给HIS", outParam);
  82. }
  83. //编码转换
  84. if (mIS.convertSettlementWithInsuCode(jo2206Rtn, out outParam) != 0)
  85. {
  86. return Exception(-1, "结算信息转换", outParam);
  87. }
  88. errMsg = "";
  89. JObject joRtnSettle =JObject.Parse(JsonHelper.getDestValue(jo2206Rtn, "output.setlinfo"));
  90. //判断勾稽关系是否平
  91. if (hIS.sumInsuRtnSettlInfo(joRtnSettle, out joSumFee, out errMsg) != 0)
  92. {
  93. return Exception(-1, "勾稽关系不符合标准,请联系管理员!",errMsg);
  94. }
  95. //展示结算信息
  96. JObject joConverted = JObject.Parse(outParam);
  97. if (hBus.showSettlementForm(joConverted, out outParam) != 0)
  98. {
  99. return Exception(-1, "结算信息展示", outParam);
  100. }
  101. // 返回结算参数+返回
  102. joRtn = (JObject)joSettlement.DeepClone();
  103. //济南扩展
  104. //string useAccountFlag = JsonHelper.getDestValue(joSettlement, "acct_used_flag");
  105. //string acctPay = Global.Set.acctPay;
  106. //if (!"1".Equals(useAccountFlag))
  107. //{
  108. // //不使用个人账户
  109. // acctPay = "0";
  110. //}
  111. //JObject joDataExp = new JObject();
  112. //joDataExp.Add("acct_payamt", acctPay);
  113. //joRtnSettle["exp_content"] = joDataExp;
  114. joRtn.Add("setlinfo", joRtnSettle);
  115. //结算需要转换
  116. joRtn["mdtrt_cert_no"] = Utils.ConvertMdtrtcertNo();
  117. outParam = joRtn.ToString();
  118. return Success();
  119. }
  120. }
  121. }