PreSettlement.cs 3.6 KB

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