PreSettlement.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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.Core.SelfServiceMachine.Process.OutPat
  12. {
  13. class PreSettlement : AbstractProcess
  14. {
  15. public override CallResult Process(JObject input)
  16. {
  17. //调用IRIS获取医保各项金额
  18. if (mIS.getSumFee(out outParam) != 0)
  19. {
  20. outParam = JsonHelper.setExceptionJson(-1, "获取医保费用各项汇总金额", outParam).ToString();
  21. return Exception(-1, "", outParam);
  22. }
  23. JObject joSumFee = JObject.Parse(outParam);
  24. JObject joSettlement = JObject.Parse(JsonHelper.getDestValue(input, "settlement"));
  25. //修改joSettlement的就诊ID ,总金额等
  26. joSettlement["mdtrt_id"] = Global.pat.mdtrtID;
  27. joSettlement["medfee_sumamt"] = JsonHelper.getDestValue(joSumFee, "data.Sumamt");
  28. ////预结算2206
  29. //if (hBus.preSettlement_OutPat(joSettlement, out outParam) != 0)
  30. //{
  31. // outParam = JsonHelper.setExceptionJson(-1, "结算信息展示", outParam).ToString();
  32. // return Exception(-1, "", outParam);
  33. //}
  34. //return Success();
  35. //-----------------------------------------------
  36. //预结算
  37. JObject jo2206Data = new JObject();
  38. jo2206Data.Add("data", joSettlement);
  39. JObject jo2206Rtn = invoker.invokeCenterService(TradeEnum.OutpatientPreSettlement.GetCode(), JsonHelper.setCenterInpar("2206", jo2206Data));
  40. if (JsonHelper.parseCenterRtnValue(jo2206Rtn, out outParam) != 0)
  41. {
  42. outParam = JsonHelper.setExceptionJson(-1, "出院预结算", outParam).ToString();
  43. return Exception(-1, "", outParam);
  44. }
  45. //返回给HIS进行预结算判断
  46. JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(jo2206Rtn, "output.setlinfo"));
  47. Global.Set.acctPay = joSetlinfo["acct_pay"].ToString();
  48. if (hIS.preSettlement(joSettlement, joSetlinfo, out outParam) != 0)
  49. {
  50. outParam = JsonHelper.setExceptionJson(-1, "返回结算信息给HIS", outParam).ToString();
  51. return Exception(-1, "", outParam);
  52. }
  53. //编码转换
  54. if (mIS.convertSettlementWithInsuCode(jo2206Rtn, out outParam) != 0)
  55. {
  56. outParam = JsonHelper.setExceptionJson(-1, "结算信息转换", outParam).ToString();
  57. return Exception(-1, "", outParam);
  58. }
  59. joSumFee = new JObject();
  60. string errMsg = "";
  61. //判断勾稽关系是否平
  62. if (hIS.sumInsuRtnSettlInfo(JObject.Parse(JsonHelper.getDestValue(jo2206Rtn, "output.setlinfo")), out joSumFee, out errMsg) != 0)
  63. {
  64. outParam = "勾稽关系不符合标准,请联系管理员!" + errMsg;
  65. return Exception(-1, "", outParam);
  66. }
  67. ////展示结算信息
  68. //JObject joConverted = JObject.Parse(outParam);
  69. //if (showSettlementForm(joConverted, out outParam) != 0)
  70. //{
  71. // outParam = JsonHelper.setExceptionJson(-1, "结算信息展示", outParam).ToString();
  72. // return -1;
  73. //}
  74. //else
  75. //{
  76. // return 0;
  77. //}
  78. // 返回结算参数+返回
  79. outParam = joSettlement.ToString();
  80. return Success();
  81. }
  82. }
  83. }