Settlement.cs 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using Newtonsoft.Json.Linq;
  2. using PTMedicalInsurance.Business.MetalKeyboard.JustTideEPP;
  3. using PTMedicalInsurance.Common;
  4. using PTMedicalInsurance.Helper;
  5. using PTMedicalInsurance.Variables;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace PTMedicalInsurance.Business.Core.SelfServiceMachine.Process.OutPat
  13. {
  14. class Settlement : AbstractProcess
  15. {
  16. public override CallResult Process(JObject input)
  17. {
  18. #region【门诊正式结算前调用社保卡验密】
  19. //if ((Global.pat.mdtrtcertType == "03") && (Global.pat.insuplc_admdvs.Substring(0, 2) == "62"))
  20. //{
  21. // CardReader_GS CardRead_GS = new CardReader_GS();
  22. // if (CardRead_GS.VerifyPIN(out outParam) != 0)
  23. // {
  24. // outParam = JsonHelper.setExceptionJson(-1, "社保卡验密异常iVerifyPIN失败 ", outParam).ToString();
  25. // return Exception(-1, "", outParam);
  26. // }
  27. //}
  28. #endregion
  29. //正式结算
  30. JObject joData = new JObject();
  31. JObject joSettlement = (JObject)input.DeepClone();
  32. joData.Add("data", joSettlement);
  33. //打开金属键盘,并等待输入
  34. MetalKeypadPasswordReader reader = new MetalKeypadPasswordReader();
  35. reader.OpenKeyboard();
  36. JObject joRtn = invoker.invokeCenterService(TradeEnum.OutpatientSettlement, joData);
  37. reader.CloseKeyboard();
  38. if (JsonHelper.parseCenterRtnValue(joRtn, out errMsg) != 0)
  39. {
  40. outParam = JsonHelper.setExceptionJson(-1, "结算失败", errMsg).ToString();
  41. return Exception(-1, "", outParam);
  42. }
  43. else
  44. {
  45. //返回给云医保平台结算信息
  46. if (mIS.saveSettlement(joRtn, out errMsg) != 0)
  47. {
  48. outParam = JsonHelper.setExceptionJson(-1, "结算成功,但云医保平台保存失败", errMsg).ToString();
  49. return Exception(-1, "", outParam);
  50. }
  51. //返回给云医保平台结算明细信息
  52. if (mIS.saveSettlementDetail(joRtn, out errMsg) != 0)
  53. {
  54. outParam = JsonHelper.setExceptionJson(-1, "云医保平台保存结算明细失败", errMsg).ToString();
  55. return Exception(-1, "", outParam);
  56. }
  57. //返回给HIS
  58. JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(joRtn, "output.setlinfo"));
  59. if (hIS.returnOutpatSettlementInfo(joSettlement, joSetlinfo, out outParam) != 0)
  60. {
  61. outParam = JsonHelper.setExceptionJson(-1, "返回结算信息给HIS", outParam).ToString();
  62. return Exception(-1, "", outParam);
  63. }
  64. else
  65. {
  66. JObject joHisServieRtn = JObject.Parse(outParam);
  67. hBus.returnToFrontEndAfterSettlement(joRtn, joHisServieRtn, out outParam);
  68. outParam = JsonHelper.setIrisReturnValue(0, "结算成功", JObject.Parse(outParam)).ToString();
  69. return Success();
  70. }
  71. }
  72. }
  73. }
  74. }