STA.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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.Common;
  9. using PTMedicalInsurance.Entity;
  10. using PTMedicalInsurance.Forms;
  11. using PTMedicalInsurance.Helper;
  12. using PTMedicalInsurance.Variables;
  13. namespace PTMedicalInsurance.Business
  14. {
  15. class STA
  16. {
  17. //设置业务实例
  18. CenterBusiness cBus = new CenterBusiness();
  19. HisMainBusiness hBus = new HisMainBusiness();
  20. HisIrisServices hIS = new HisIrisServices();
  21. MIIrisServices mIS = new MIIrisServices();
  22. InvokeHelper invoker = new InvokeHelper();
  23. private XmlHelper xmler = new XmlHelper();
  24. public delegate void callBack(string errMsg);
  25. [STAThread]
  26. public void ReadCard(object o)
  27. {
  28. string outParam = "";
  29. ChooseCard cc = new ChooseCard();
  30. try
  31. {
  32. IntPtr hwnd = WinApi.GetWindowsHandle("prBrowser");
  33. if (cc.ShowDialog(new WindowWrapper(hwnd)) == DialogResult.OK)
  34. {
  35. Global.pat.card.ecBizType = cc.businessType;
  36. }
  37. else
  38. {
  39. ((object[])o)[0] = -1;
  40. ((object[])o)[1] = "收款员取消结算!";
  41. }
  42. InvokeComCenter carder = new InvokeComCenter();
  43. JObject joInput = new JObject();
  44. joInput.Add("akb020", "H65010200152");
  45. joInput.Add("psnNo", "111111");
  46. string input = joInput.ToString();
  47. if (carder.Business("1401", ref input, ref outParam) != 0)
  48. {
  49. ((object[])o)[0] = -1;
  50. ((object[])o)[1] = outParam;
  51. }
  52. else
  53. {
  54. Resp1101 info = JsonHelper.getOutput<Resp1101>(JObject.Parse(outParam));
  55. Global.pat.card.NO = info.data.cardNo;
  56. Global.pat.card.SN = info.data.cardSn;
  57. Global.pat.mdtrtcertType = info.data.mdtrtCertType;
  58. Global.pat.mdtrtcertNO = info.data.mdtrtCertNo;
  59. Global.pat.certNO = info.data.certNo;
  60. Global.pat.certType = info.data.psnCertType;
  61. Global.pat.name = info.data.psnName;
  62. Global.pat.insuplc_admdvs = info.data.insuplcAdmdvs;
  63. ((object[])o)[0] = 0;
  64. ((object[])o)[1] = outParam;
  65. }
  66. }
  67. catch (Exception ex)
  68. {
  69. outParam = JsonHelper.setIrisReturnValue(-1, "门诊结算异常:" + ex.Message, null).ToString();
  70. ((object[])o)[0] = -1;
  71. ((object[])o)[1] = outParam;
  72. }
  73. }
  74. public void CallBack(string errMsg)
  75. {
  76. MessageBox.Show(errMsg);
  77. }
  78. [STAThread]
  79. public void Exception(object o)
  80. {
  81. try
  82. {
  83. //显示异常处理界面
  84. HandleException frmEX = new HandleException();
  85. frmEX.WindowState = FormWindowState.Maximized;
  86. frmEX.ShowDialog();
  87. }
  88. catch (Exception ex)
  89. {
  90. CallBack(ex.Message);
  91. }
  92. }
  93. [STAThread]
  94. public void CheckAndClearing(object o)
  95. {
  96. try
  97. {
  98. //显示对账界面
  99. Clearing frm = new Clearing();
  100. frm.WindowState = FormWindowState.Maximized;
  101. frm.ShowDialog();
  102. }
  103. catch (Exception ex)
  104. {
  105. CallBack(ex.Message);
  106. }
  107. }
  108. [STAThread]
  109. public void BasicData(object o)
  110. {
  111. try
  112. {
  113. //显示异常处理界面
  114. BasicData frm = new BasicData();
  115. frm.WindowState = FormWindowState.Maximized;
  116. frm.ShowDialog();
  117. }
  118. catch (Exception ex)
  119. {
  120. CallBack(ex.Message);
  121. }
  122. }
  123. [STAThread]
  124. public void PrescribeCirculation(object o)
  125. {
  126. try
  127. {
  128. //显示处方上传
  129. PrescriptionCirculation PresCir = new PrescriptionCirculation("");
  130. //PresCir.WindowState = FormWindowState.Minimized;
  131. PresCir.ShowDialog();
  132. }
  133. catch (Exception ex)
  134. {
  135. CallBack(ex.Message);
  136. }
  137. }
  138. }
  139. public class WindowWrapper : System.Windows.Forms.IWin32Window
  140. {
  141. public WindowWrapper(IntPtr handle)
  142. {
  143. _hwnd = handle;
  144. }
  145. public IntPtr Handle
  146. {
  147. get { return _hwnd; }
  148. }
  149. private IntPtr _hwnd;
  150. }
  151. }