IPPreSettlementProcess.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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 IPPreSettlementProcess : AbstractProcess
  14. {
  15. public IPPreSettlementProcess() {
  16. }
  17. public override CallResult Process(JObject input)
  18. {
  19. //JObject joSettlement = new JObject();
  20. outParam = "";
  21. string outPar = "";
  22. #region 调用IRIS获取医保各项金额
  23. if (mIS.getSumFee(out outPar) != 0)
  24. {
  25. return Exception(-1, "获取医保费用各项汇总金额", outPar);
  26. }
  27. JObject joSumFee = JObject.Parse(outPar);
  28. if ((JsonHelper.getDestValue(joSumFee, "data.Sumamt") == "") || (JsonHelper.getDestValue(joSumFee, "data.Sumamt") == "0"))
  29. {
  30. return Exception(-1,"结算提示","请先右击选择【医保费用上传】!");
  31. }
  32. int type = 1; //住院预结算
  33. if (mIS.queryRegisterInfo(type, out outParam) != 0)
  34. {
  35. return Exception(-1, "查询患者云平台登记信息", outParam);
  36. }
  37. JObject joReg = JObject.Parse(outParam);
  38. Global.pat.medType = JsonHelper.getDestValue(joReg, "data.MedicalType");
  39. Global.pat.insuType = JsonHelper.getDestValue(joReg, "data.InsuType");
  40. Global.pat.mdtrtcertType = JsonHelper.getDestValue(joReg, "data.CertificateType");
  41. Global.pat.mdtrtcertNO = JsonHelper.getDestValue(joReg, "data.CertificateNO");
  42. //Global.pat.certNO = Global.pat.mdtrtcertNO;
  43. if (Global.pat.mdtrtcertType=="03")
  44. Global.pat.card.NO = tools.getDestPosStrBySpliterCardInfo(Global.pat.mdtrtcertNO, 1);
  45. else
  46. Global.pat.card.NO = Global.pat.mdtrtcertNO;
  47. Global.pat.psn_no = JsonHelper.getDestValue(joReg, "data.PersonalNO");
  48. Global.pat.certType = JsonHelper.getDestValue(joReg, "data.CertificateType");
  49. Global.pat.insuplc_admdvs = JsonHelper.getDestValue(joReg, "data.InsuranceAreaCode");
  50. Global.pat.psn_type = Global.pat.insuType; //后面再改
  51. Global.pat.ExpContent = JsonHelper.getDestValue(joReg, "data.ExpContent");
  52. if ((Global.pat.RYorCY == "2"))
  53. {
  54. Global.pat.DiseasecCode = JsonHelper.getDestValue(joReg, "data.DiseasecCode");
  55. Global.pat.DiseasecName = JsonHelper.getDestValue(joReg, "data.DiseasecName");
  56. }
  57. #endregion
  58. #region 事中分析
  59. string errMsg;
  60. if (Global.curEvt.ext.isOpenAnalysis)
  61. {
  62. if (hBus.InProcessAnalysis(out errMsg) != 0)
  63. {
  64. return Exception(-1, "InProcessAnalysis", errMsg);
  65. }
  66. }
  67. #endregion
  68. #region 出院登记
  69. //调用服务获取门诊诊断信息
  70. string diagnoses;
  71. if (hIS.getPatDiagnoses(Global.pat, out diagnoses) != 0)
  72. {
  73. return Exception(-1, "getPatDiagnoses", diagnoses);
  74. }
  75. JObject joDiagnoses = JObject.Parse(diagnoses);
  76. //展示出院登记界面,选择结算方式等
  77. if (hBus.showDischargeRegisterForm(TradeEnum.InpatientPreSettlement, joSumFee, joDiagnoses, out outParam) != 0)
  78. {
  79. return Exception(-1, "展示出院预结算界面", outParam);
  80. }
  81. JObject joRtn = JObject.Parse(outParam);
  82. #endregion
  83. #region 预结算
  84. //JObject jo2303Inpar = JObject.Parse(JsonHelper.getDestValue(joRtn, "Settlement"));
  85. //jo2303Inpar["mdtrt_cert_no"] = Global.pat.card.NO;
  86. JObject jo2303Inpar = JObject.Parse(JsonHelper.getDestValue(joRtn, "Settlement"));
  87. if (Global.pat.mdtrtcertType == "03")
  88. jo2303Inpar["mdtrt_cert_no"] = Global.pat.card.NO;
  89. JObject jo2303Data = new JObject();
  90. jo2303Data.Add("data", jo2303Inpar);
  91. JObject jo2303Rtn = invoker.invokeCenterService(TradeEnum.InpatientPreSettlement, jo2303Data);
  92. if (JsonHelper.parseCenterRtnValue(jo2303Rtn, out outParam) != 0)
  93. {
  94. return Exception(-1, "出院预结算", outParam);
  95. }
  96. //预结算结果传给HIS进行HIS判断
  97. //返回给HIS
  98. JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(jo2303Rtn, "output.setlinfo"));
  99. JObject joParam = new JObject();
  100. joParam.Add("admID", Global.pat.adm_Dr);
  101. joParam.Add("recordID", Global.pat.recordID);
  102. joParam.Add("billID", Global.pat.billID);
  103. if (hIS.preSettlementInfo(joParam, joSetlinfo, out outParam) != 0)
  104. {
  105. return Exception(-1, "出院预结算", outParam);
  106. }
  107. //编码转换
  108. if (mIS.convertSettlementWithInsuCode(jo2303Rtn, out outParam) != 0)
  109. {
  110. return Exception(-1, "结算信息转换", outParam);
  111. }
  112. //展示结算信息
  113. JObject joConverted = JObject.Parse(outParam);
  114. #region 济南扩展
  115. #endregion
  116. if (hBus.showSettlementForm(joConverted, out outParam) != 0)
  117. {
  118. //取消结算?
  119. new IPSettlementCancelProcess().Process(input);
  120. return Exception(-1, "结算信息展示", outParam);
  121. }
  122. //joSettlement = (JObject)joRtn.DeepClone();
  123. outParam = joRtn.ToString();
  124. #endregion
  125. return Success();
  126. }
  127. }
  128. }