PreSettlement.cs 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. if (Global.pat.feeCount > 1)
  27. {
  28. joSettlement["med_type"] = "11"; //当费用明细数量>1时,医疗类别不能传12
  29. }
  30. ////预结算2206
  31. //if (hBus.preSettlement_OutPat(joSettlement, out outParam) != 0)
  32. //{
  33. // outParam = JsonHelper.setExceptionJson(-1, "结算信息展示", outParam).ToString();
  34. // return Exception(-1, "", outParam);
  35. //}
  36. //return Success();
  37. //-----------------------------------------------
  38. //预结算
  39. JObject jo2206Data = new JObject();
  40. jo2206Data.Add("data", joSettlement);
  41. JObject jo2206Rtn = invoker.invokeCenterService(TradeEnum.OutpatientPreSettlement, jo2206Data);
  42. if (JsonHelper.parseCenterRtnValue(jo2206Rtn, out outParam) != 0)
  43. {
  44. outParam = JsonHelper.setExceptionJson(-1, "出院预结算", outParam).ToString();
  45. return Exception(-1, "", outParam);
  46. }
  47. //返回给HIS进行预结算判断
  48. JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(jo2206Rtn, "output.setlinfo"));
  49. if (hIS.preSettlement(joSettlement, joSetlinfo, out outParam) != 0)
  50. {
  51. outParam = JsonHelper.setExceptionJson(-1, "返回结算信息给HIS", outParam).ToString();
  52. return Exception(-1, "", outParam);
  53. }
  54. //编码转换
  55. if (mIS.convertSettlementWithInsuCode(jo2206Rtn, out outParam) != 0)
  56. {
  57. outParam = JsonHelper.setExceptionJson(-1, "结算信息转换", outParam).ToString();
  58. return Exception(-1, "", outParam);
  59. }
  60. joSumFee = new JObject();
  61. string errMsg = "";
  62. //判断勾稽关系是否平
  63. if (hIS.sumInsuRtnSettlInfo(JObject.Parse(JsonHelper.getDestValue(jo2206Rtn, "output.setlinfo")), out joSumFee, out errMsg) != 0)
  64. {
  65. outParam = "勾稽关系不符合标准,请联系管理员!" + errMsg;
  66. return Exception(-1, "", outParam);
  67. }
  68. ////展示结算信息
  69. //JObject joConverted = JObject.Parse(outParam);
  70. //if (showSettlementForm(joConverted, out outParam) != 0)
  71. //{
  72. // outParam = JsonHelper.setExceptionJson(-1, "结算信息展示", outParam).ToString();
  73. // return -1;
  74. //}
  75. //else
  76. //{
  77. // return 0;
  78. //}
  79. // 返回结算参数+返回
  80. outParam = joSettlement.ToString();
  81. return Success();
  82. }
  83. }
  84. }