STA.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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.Forms;
  10. using PTMedicalInsurance.Forms.SettlementWithNopwdApplys;
  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 showOutPatientIntegratedServicesForm(object o)
  27. {
  28. string outParam = "";
  29. OutPatientIntegratedServices opis = new OutPatientIntegratedServices();
  30. opis.StartPosition = FormStartPosition.CenterScreen;
  31. try
  32. {
  33. IntPtr hwnd = WinApi.GetWindowsHandle("prBrowser");
  34. //opis.Owner = ((Form)(new WindowWrapper(hwnd));
  35. //是跨进程还是跨线程?
  36. opis.ShowDialog(new WindowWrapper(hwnd));
  37. ((object[])o)[0] = opis.rtnFlag;
  38. ((object[])o)[2] = opis.rtnMsg;
  39. }
  40. catch (Exception ex)
  41. {
  42. outParam = JsonHelper.setIrisReturnValue(-1, "门诊结算异常:" + ex.Message, null).ToString();
  43. ((object[])o)[0] = -1;
  44. ((object[])o)[2] = outParam;
  45. }
  46. }
  47. public void CallBack(string errMsg)
  48. {
  49. MessageBox.Show(errMsg);
  50. }
  51. [STAThread]
  52. public void print(object o)
  53. {
  54. string outParam = "", errMsg = "";
  55. try
  56. {
  57. //查询结算表
  58. string sqlStr = "SELECT * FROM BS_MedInsuSettlement WHERE billType = 1 and Hospital_Dr=" + Global.inf.hospitalDr
  59. + " and Adm_Dr=" + Global.pat.adm_Dr
  60. + " and MdtrtID='" + Global.pat.mdtrtID + "'"
  61. + " and SettlementID='" + Global.pat.settlID + "'";
  62. JObject joSql = new JObject();
  63. joSql.Add("sqlStr", sqlStr);
  64. JObject joSettlInfo = mIS.QuerySettlementInfo(joSql);
  65. JArray jaSettlInfo = JArray.Parse(JsonHelper.getDestValue(joSettlInfo, "result.data"));
  66. if (jaSettlInfo.Count == 0)
  67. {
  68. outParam = JsonHelper.setIrisReturnValue(-1, "未查询到结算数据", null).ToString();
  69. }
  70. Global.pat.insuplc_admdvs = JsonHelper.getDestValue(joSettlInfo, "result.data[0].insuplc_admdvs");
  71. Global.pat.insuType = JsonHelper.getDestValue(joSettlInfo, "result.data[0].InsuranceType");
  72. Global.pat.medType = JsonHelper.getDestValue(joSettlInfo, "result.data[0].MedicalType");
  73. Global.pat.psn_type = JsonHelper.getDestValue(joSettlInfo, "result.data[0].PersonType");
  74. dynamic joTmp = new JObject();
  75. joTmp.prm_akc190 = Global.pat.mdtrtID;
  76. joTmp.prm_yab003 = Global.pat.insuplc_admdvs;
  77. joTmp.prm_aka130 = Global.pat.medType;
  78. joTmp.prm_akc021 = Global.pat.psn_type;
  79. joTmp.prm_yka103 = Global.pat.settlID;
  80. joTmp.prm_ykb065 = Global.pat.insuType;
  81. joTmp.prm_yabtch = Global.pat.insuplc_admdvs;
  82. if (invoker.invokeYHCom("44", joTmp, out errMsg) != 0)
  83. {
  84. outParam = JsonHelper.setIrisReturnValue(-1, errMsg, null).ToString();
  85. }
  86. else
  87. {
  88. outParam = JsonHelper.setIrisReturnValue(0, "", null).ToString();
  89. }
  90. CallBack(outParam);
  91. }
  92. catch (Exception ex)
  93. {
  94. CallBack(ex.Message);
  95. }
  96. }
  97. [STAThread]
  98. public void MutualAid( object o)
  99. {
  100. string outParam = "", errMsg = "";
  101. try
  102. {
  103. MutualAid frmMA;
  104. if (o != null)
  105. {
  106. object[] s = (object[])o;
  107. string settId = s[0].ToString();
  108. if (settId != "")
  109. frmMA = new MutualAid(settId);
  110. else
  111. frmMA = new MutualAid();
  112. }
  113. else
  114. frmMA = new MutualAid();
  115. frmMA.WindowState = FormWindowState.Maximized;
  116. if (frmMA.ShowDialog() == DialogResult.OK)
  117. {
  118. ((object[])o)[1] = outParam;
  119. }
  120. else
  121. {
  122. outParam = JsonHelper.setIrisReturnValue(-1, "收款员取消共济支付撤销!", null).ToString();
  123. ((object[])o)[1] = outParam;
  124. }
  125. }
  126. catch (Exception ex)
  127. {
  128. outParam = JsonHelper.setIrisReturnValue(-1, "共济支付异常:" + ex.Message, null).ToString();
  129. ((object[])o)[1] = outParam;
  130. MessageBox.Show(ex.Message);
  131. }
  132. }
  133. [STAThread]
  134. public void MutualAid_(object o)
  135. {
  136. string outParam = "", errMsg = "";
  137. try
  138. {
  139. MutualAid frmMA;
  140. if (o != null)
  141. {
  142. object[] s = (object[])o;
  143. string inpar = s[0].ToString();
  144. JObject joInpar = JObject.Parse(inpar);
  145. string settId = JsonHelper.getDestValue(joInpar, "setl_id");
  146. frmMA = new MutualAid(joInpar);
  147. if (frmMA.dtSumumt.Rows.Count != 0)
  148. {
  149. frmMA.WindowState = FormWindowState.Maximized;
  150. if (frmMA.ShowDialog() == DialogResult.OK)
  151. {
  152. JObject joRtn = new JObject();
  153. joRtn.Add("settlRtn",frmMA.joMainSettlInfo);
  154. joRtn.Add("settlInfo", JObject.Parse(frmMA.finalSettlementInfo));
  155. outParam = JsonHelper.setIrisReturnValue(0, "共济支付", joRtn).ToString();
  156. ((object[])o)[1] = outParam;
  157. }
  158. else
  159. {
  160. outParam = JsonHelper.setExceptionJson(-1, "共济支付", "开启共济支付失败,原因为收款员取消共济支付!!").ToString();
  161. ((object[])o)[1] = outParam;
  162. }
  163. }
  164. else
  165. {
  166. outParam = JsonHelper.setExceptionJson(-1, "共济支付" , "开启共济支付失败,原因为未检测到有效的被共济人的医保结算数据!").ToString();
  167. ((object[])o)[1] = outParam;
  168. }
  169. }
  170. else
  171. {
  172. outParam = JsonHelper.setExceptionJson(-1, "MutualAid_", "入参为空!").ToString();
  173. ((object[])o)[1] = outParam;
  174. }
  175. }
  176. catch (Exception ex)
  177. {
  178. outParam = JsonHelper.setIrisReturnValue(-1, "共济支付异常:" + ex.Message, null).ToString();
  179. ((object[])o)[1] = outParam;
  180. }
  181. }
  182. [STAThread]
  183. public void Exception(object o)
  184. {
  185. try
  186. {
  187. //显示异常处理界面
  188. HandleException frmEX = new HandleException();
  189. frmEX.WindowState = FormWindowState.Maximized;
  190. frmEX.ShowDialog();
  191. }
  192. catch (Exception ex)
  193. {
  194. CallBack(ex.Message);
  195. }
  196. }
  197. [STAThread]
  198. public void MaternityInsuranceRegist(object o)
  199. {
  200. try
  201. {
  202. //显示异常处理界面
  203. MaternityInsuranceRegist frm = new MaternityInsuranceRegist();
  204. frm.WindowState = FormWindowState.Maximized;
  205. frm.ShowDialog();
  206. }
  207. catch (Exception ex)
  208. {
  209. CallBack(ex.Message);
  210. }
  211. }
  212. [STAThread]
  213. public void CheckAndClearing(object o)
  214. {
  215. try
  216. {
  217. //显示对账界面
  218. Clearing frm = new Clearing();
  219. frm.ShowDialog();
  220. }
  221. catch (Exception ex)
  222. {
  223. CallBack(ex.Message);
  224. }
  225. }
  226. [STAThread]
  227. public void BasicData(object o)
  228. {
  229. try
  230. {
  231. //显示异常处理界面
  232. BasicData frm = new BasicData();
  233. frm.WindowState = FormWindowState.Maximized;
  234. frm.ShowDialog();
  235. }
  236. catch (Exception ex)
  237. {
  238. CallBack(ex.Message);
  239. }
  240. }
  241. [STAThread]
  242. public void SettlementWithNopwdApply(object o)
  243. {
  244. try
  245. {
  246. //显示异常处理界面
  247. SettlementWithNopwdApply frm = new SettlementWithNopwdApply();
  248. frm.WindowState = FormWindowState.Maximized;
  249. frm.ShowDialog();
  250. }
  251. catch (Exception ex)
  252. {
  253. CallBack(ex.Message);
  254. }
  255. }
  256. }
  257. public class WindowWrapper : System.Windows.Forms.IWin32Window
  258. {
  259. public WindowWrapper(IntPtr handle)
  260. {
  261. _hwnd = handle;
  262. }
  263. public IntPtr Handle
  264. {
  265. get { return _hwnd; }
  266. }
  267. private IntPtr _hwnd;
  268. }
  269. }