Settlement.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. namespace PTMedicalInsurance.Business.Core.SelfServiceMachine.Process.OutPat
  11. {
  12. class Settlement : AbstractProcess
  13. {
  14. public override CallResult Process(JObject input)
  15. {
  16. #region【门诊正式结算前调用社保卡验密】
  17. //if ((Global.pat.mdtrtcertType == "03") && (Global.pat.insuplc_admdvs.Substring(0, 2) == "62"))
  18. //{
  19. // CardReader_GS CardRead_GS = new CardReader_GS();
  20. // if (CardRead_GS.VerifyPIN(out outParam) != 0)
  21. // {
  22. // outParam = JsonHelper.setExceptionJson(-1, "社保卡验密异常iVerifyPIN失败 ", outParam).ToString();
  23. // return Exception(-1, "", outParam);
  24. // }
  25. //}
  26. #endregion
  27. //正式结算
  28. JObject joData = new JObject();
  29. JObject joSettlement = (JObject)input.DeepClone();
  30. joData.Add("data", joSettlement);
  31. JObject joRtn = invoker.invokeCenterService(TradeEnum.OutpatientSettlement, joData);
  32. if (JsonHelper.parseCenterRtnValue(joRtn, out errMsg) != 0)
  33. {
  34. outParam = JsonHelper.setExceptionJson(-1, "结算失败", errMsg).ToString();
  35. return Exception(-1, "", outParam);
  36. }
  37. else
  38. {
  39. //返回给云医保平台结算信息
  40. if (mIS.saveSettlement(joRtn, out errMsg) != 0)
  41. {
  42. outParam = JsonHelper.setExceptionJson(-1, "结算成功,但云医保平台保存失败", errMsg).ToString();
  43. return Exception(-1, "", outParam);
  44. }
  45. //返回给云医保平台结算明细信息
  46. if (mIS.saveSettlementDetail(joRtn, out errMsg) != 0)
  47. {
  48. outParam = JsonHelper.setExceptionJson(-1, "云医保平台保存结算明细失败", errMsg).ToString();
  49. return Exception(-1, "", outParam);
  50. }
  51. //返回给HIS
  52. JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(joRtn, "output.setlinfo"));
  53. if (hIS.returnOutpatSettlementInfo(joSettlement, joSetlinfo, out outParam) != 0)
  54. {
  55. outParam = JsonHelper.setExceptionJson(-1, "返回结算信息给HIS", outParam).ToString();
  56. return Exception(-1, "", outParam);
  57. }
  58. else
  59. {
  60. JObject joHisServieRtn = JObject.Parse(outParam);
  61. hBus.returnToFrontEndAfterSettlement(joRtn, joHisServieRtn, out outParam);
  62. outParam = JsonHelper.setIrisReturnValue(0, "结算成功", JObject.Parse(outParam)).ToString();
  63. return Success();
  64. }
  65. }
  66. }
  67. }
  68. }