AbstractProcess.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. using MedicalInsurance.Forms;
  2. using Newtonsoft.Json.Linq;
  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
  12. {
  13. abstract class AbstractProcess
  14. {
  15. protected CenterBusiness cBus = new CenterBusiness();
  16. protected HisMainBusiness hBus = new HisMainBusiness();
  17. protected HisIrisServices hIS = new HisIrisServices();
  18. protected MIIrisServices mIS = new MIIrisServices();
  19. protected InvokeHelper invoker = new InvokeHelper();
  20. protected string outParam = "";
  21. public JObject OrginalInput { set; get; }
  22. /// <summary>
  23. /// 使用原始参数
  24. /// </summary>
  25. public bool UseOrginal {
  26. get;set;
  27. }
  28. /// <summary>
  29. /// 返回成功信息
  30. /// </summary>
  31. /// <returns></returns>
  32. protected CallResult Success()
  33. {
  34. return Success("成功");
  35. }
  36. protected CallResult Success(string msg)
  37. {
  38. return new CallResult(0, msg, outParam);
  39. }
  40. /// <summary>
  41. /// 返回失败信息
  42. /// </summary>
  43. /// <param name="code"></param>
  44. /// <param name="errMsg"></param>
  45. /// <returns></returns>
  46. protected CallResult Error(int code, string errMsg)
  47. {
  48. return Exception(code, errMsg, outParam);
  49. }
  50. protected CallResult Exception(int code, string errMsg,string param)
  51. {
  52. outParam = JsonHelper.setExceptionJson(code, errMsg, param).ToString();
  53. return new CallResult(code, errMsg, outParam,param);
  54. }
  55. protected CallResult Exception(string errMsg, string param)
  56. {
  57. return Exception(-1, errMsg, param);
  58. }
  59. protected CallResult IrisReturn(string msg,JObject obj)
  60. {
  61. outParam = JsonHelper.setIrisReturnValue(0, msg, obj).ToString();
  62. return new CallResult(0, msg, outParam,obj);
  63. }
  64. /// <summary>
  65. /// 返回失败信息
  66. /// </summary>
  67. /// <param name="errMsg"></param>
  68. /// <returns></returns>
  69. protected CallResult Error(string errMsg)
  70. {
  71. return new CallResult(-1, errMsg, outParam);
  72. }
  73. /// <summary>
  74. /// 业务过程
  75. /// </summary>
  76. /// <param name="input"></param>
  77. /// <returns></returns>
  78. public abstract CallResult Process(JObject input);
  79. /// <summary>
  80. /// 根据是否需要使用共济支付重新计算结算数据
  81. /// </summary>
  82. /// <param name="setlInfo"></param>
  83. /// <returns></returns>
  84. protected JObject MutualAidPay(string setlInfo)
  85. {
  86. JObject joRtn = JObject.Parse(setlInfo);
  87. if (Global.pat.mutualAidFlag)
  88. {
  89. try
  90. {
  91. decimal psnCashPay = decimal.Parse(JsonHelper.getDestValue(joRtn, "psn_cash_pay"));
  92. if (psnCashPay == 0)
  93. {
  94. MessageBox.Show("该患者自付金额为0,不需要进行共济支付!");
  95. }
  96. else
  97. {
  98. //开启自付界面,因涉及到多次自付
  99. MutualAid frmMA = new MutualAid(joRtn);
  100. if (frmMA.dtSettlInfo.Rows.Count != 0)
  101. {
  102. frmMA.WindowState = FormWindowState.Maximized;
  103. if (frmMA.ShowDialog() == DialogResult.OK)
  104. {
  105. joRtn = JObject.Parse(frmMA.finalSettlementInfo);
  106. }
  107. else
  108. {
  109. MessageBox.Show("开启共济支付失败,原因为收款员取消共济支付!");
  110. }
  111. }
  112. else
  113. {
  114. MessageBox.Show("开启共济支付失败,原因为未检测到有效的被共济人的医保结算数据!");
  115. }
  116. }
  117. }
  118. catch (Exception ex)
  119. {
  120. MessageBox.Show("共济支付失败:" + ex.Message);
  121. }
  122. }
  123. return joRtn;
  124. }
  125. }
  126. }