STA.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Forms;
  7. using Newtonsoft.Json.Linq;
  8. using PTMedicalInsurance.Forms;
  9. using PTMedicalInsurance.Helper;
  10. using PTMedicalInsurance.Variables;
  11. namespace PTMedicalInsurance.Business
  12. {
  13. class STA
  14. {
  15. //设置业务实例
  16. CenterBusiness cBus = new CenterBusiness();
  17. HisMainBusiness hBus = new HisMainBusiness();
  18. HisIrisServices hIS = new HisIrisServices();
  19. MIIrisServices mIS = new MIIrisServices();
  20. InvokeHelper invoker = new InvokeHelper();
  21. public delegate void callBack(string errMsg);
  22. public void CallBack(string errMsg)
  23. {
  24. MessageBox.Show(errMsg);
  25. }
  26. [STAThread]
  27. public void print(object o)
  28. {
  29. string outParam = "", errMsg = "";
  30. try
  31. {
  32. //查询结算表
  33. string sqlStr = "SELECT * FROM BS_MedInsuSettlement WHERE billType = 1 and Hospital_Dr=" + Global.inf.hospitalDr
  34. + " and Adm_Dr=" + Global.pat.adm_Dr
  35. + " and MdtrtID='" + Global.pat.mdtrtID + "'"
  36. + " and SettlementID='" + Global.pat.settlID + "'";
  37. JObject joSql = new JObject();
  38. joSql.Add("sqlStr", sqlStr);
  39. JObject joSettlInfo = mIS.QuerySettlementInfo(joSql);
  40. JArray jaSettlInfo = JArray.Parse(JsonHelper.getDestValue(joSettlInfo, "result.data"));
  41. if (jaSettlInfo.Count == 0)
  42. {
  43. outParam = JsonHelper.setIrisReturnValue(-1, "未查询到结算数据", null).ToString();
  44. }
  45. Global.pat.insuplc_admdvs = JsonHelper.getDestValue(joSettlInfo, "result.data[0].insuplc_admdvs");
  46. Global.pat.insuType = JsonHelper.getDestValue(joSettlInfo, "result.data[0].InsuranceType");
  47. Global.pat.medType = JsonHelper.getDestValue(joSettlInfo, "result.data[0].MedicalType");
  48. Global.pat.psn_type = JsonHelper.getDestValue(joSettlInfo, "result.data[0].PersonType");
  49. dynamic joTmp = new JObject();
  50. joTmp.prm_akc190 = Global.pat.mdtrtID;
  51. joTmp.prm_yab003 = Global.pat.insuplc_admdvs;
  52. joTmp.prm_aka130 = Global.pat.medType;
  53. joTmp.prm_akc021 = Global.pat.psn_type;
  54. joTmp.prm_yka103 = Global.pat.settlID;
  55. joTmp.prm_ykb065 = Global.pat.insuType;
  56. joTmp.prm_yabtch = Global.pat.insuplc_admdvs;
  57. if (invoker.invokeCenterService("44", joTmp) != 0)
  58. {
  59. outParam = JsonHelper.setIrisReturnValue(-1, errMsg, null).ToString();
  60. }
  61. else
  62. {
  63. outParam = JsonHelper.setIrisReturnValue(0, "", null).ToString();
  64. }
  65. CallBack(outParam);
  66. }
  67. catch (Exception ex)
  68. {
  69. CallBack(ex.Message);
  70. }
  71. }
  72. [STAThread]
  73. public void MutualAid(object o)
  74. {
  75. string outParam = "", errMsg = "";
  76. try
  77. {
  78. //MutualAid frmMA = new MutualAid();
  79. //frmMA.WindowState = FormWindowState.Maximized;
  80. //frmMA.ShowDialog();
  81. CallBack(outParam);
  82. }
  83. catch (Exception ex)
  84. {
  85. CallBack(ex.Message);
  86. }
  87. }
  88. [STAThread]
  89. public void ShowBasicData(object o)
  90. {
  91. try
  92. {
  93. BasicData bd = new BasicData();
  94. bd.ShowDialog();
  95. }
  96. catch (Exception ex)
  97. {
  98. CallBack(ex.Message);
  99. }
  100. }
  101. }
  102. public class WindowWrapper : System.Windows.Forms.IWin32Window
  103. {
  104. public WindowWrapper(IntPtr handle)
  105. {
  106. _hwnd = handle;
  107. }
  108. public IntPtr Handle
  109. {
  110. get { return _hwnd; }
  111. }
  112. private IntPtr _hwnd;
  113. }
  114. }