ShellBusiness.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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 PTMedInsuInterface.Helper;
  9. using PTMedInsuInterface;
  10. using PTMedInsuInterface.Common;
  11. using PTMedInsuInterface.Variables;
  12. using System.Reflection;
  13. using System.IO;
  14. using PTMedInsuInterface.Forms;
  15. namespace PTMedInsuInterface.Business
  16. {
  17. class ShellBusiness
  18. {
  19. MIIrisServices mis = new MIIrisServices();
  20. public bool isExistConfig()
  21. {
  22. return File.Exists(Global.curEvt.path + @"\INSUConfigure.ini");
  23. }
  24. /// <summary>
  25. /// 获取HIS的IRIS配置信息
  26. /// </summary>
  27. /// <param name="con"></param>
  28. public void getHisConfingue(out IrisConfigue con)
  29. {
  30. IniFile ini = new IniFile(Global.curEvt.path + @"\INSUConfigure.ini");
  31. con.ip = ini.ReadValue("HIS", "ip");
  32. con.url = ini.ReadValue("HIS", "url");
  33. con.authorization = ini.ReadValue("HIS", "authorization");
  34. }
  35. /// <summary>
  36. /// 获取医保平台的iris配置信息
  37. /// </summary>
  38. /// <param name="con"></param>
  39. public void getInsuConfingue(out IrisConfigue con)
  40. {
  41. IniFile ini = new IniFile(Global.curEvt.path + @"\INSUConfigure.ini");
  42. con.ip = ini.ReadValue("INSU", "ip");
  43. con.url = ini.ReadValue("INSU", "url");
  44. con.authorization = ini.ReadValue("INSU", "authorization");
  45. Global.curEvt.MIVer = ini.ReadValue("Ver", "MIVer");
  46. }
  47. public void getDLLInfo(out DllInfo dll)
  48. {
  49. dll = new DllInfo();
  50. dll.nameSpace = "PTMedicalInsurance";
  51. dll.className = "InsuBusiness";
  52. }
  53. public void getDLLInfo(JObject joIn)
  54. {
  55. Global.dll.name = joIn["DLLName"].ToString();
  56. }
  57. /// <summary>
  58. //获取当前环境信息
  59. /// </summary>
  60. /// <param name="con"></param>
  61. public void getCurrentEnvironmentInfo()
  62. {
  63. //Global.curEvt.path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
  64. Global.curEvt.path = tools.GetPath();
  65. ComputerInfo comp = new ComputerInfo();
  66. Global.curEvt.mac = comp.GetMAC();
  67. Global.curEvt.ip = comp.GetIP();
  68. }
  69. public JObject showInterfaceChooseForm()
  70. {
  71. dynamic joInterface = new JObject();
  72. dynamic joRtn = new JObject();
  73. try
  74. {
  75. joInterface = mis.getInterface();
  76. JArray jaInterface = JArray.Parse(JsonHelper.getDestValue(joInterface, "result.data"));
  77. //有且仅有一条则不显示弹窗,并直接返回该条接口
  78. if (jaInterface.Count == 1)
  79. {
  80. joInterface.errorCode = 0;
  81. joInterface.errorMessage = "";
  82. dynamic joTmp = new JObject();
  83. joTmp.HospitalNO = jaInterface[0]["HospitalNO"];
  84. joTmp.DLLName = jaInterface[0]["DLLName"];
  85. joTmp.CenterURL = jaInterface[0]["CenterURL"];
  86. joTmp.CenterURL2 = jaInterface[0]["CenterURL2"];
  87. joTmp.AreaCode = jaInterface[0]["AreaCode"];
  88. joTmp.HospitalDr = jaInterface[0]["HospitalDr"];
  89. joTmp.HospitalName = jaInterface[0]["HospitalName"];
  90. joTmp.InterfaceID = jaInterface[0]["InterfaceID"];
  91. joTmp.HospitalLevel = jaInterface[0]["HospitalLevel"];
  92. joTmp.ID = jaInterface[0]["ID"];
  93. joTmp.operatorNO = Global.user.ID;
  94. joTmp.operatorName = Global.user.name;
  95. if (Global.curEvt.MIVer == "2")
  96. joTmp.insuRegionInterfaceDr = jaInterface[0]["InsuRegionDr"];
  97. joTmp.InsuCurrencyCataLogue = jaInterface[0]["InsuCurrencyCataLogue"];
  98. joRtn = JsonHelper.setIrisReturnValue(0, "", joTmp);
  99. }
  100. else
  101. {
  102. InterfaceChooser frmInterface = new InterfaceChooser(jaInterface);
  103. if (tools.ShowAppDiaglog(frmInterface) == DialogResult.OK)
  104. {
  105. if (frmInterface.drSelectedInterface["ID"] != "")
  106. {
  107. joInterface.errorCode = 0;
  108. joInterface.errorMessage = "";
  109. dynamic joTmp = new JObject();
  110. joTmp.HospitalNO = frmInterface.drSelectedInterface["HospitalNO"];
  111. joTmp.DLLName = frmInterface.drSelectedInterface["DLLName"];
  112. joTmp.CenterURL = frmInterface.drSelectedInterface["CenterURL"];
  113. joTmp.CenterURL2 = frmInterface.drSelectedInterface["CenterURL2"];
  114. joTmp.AreaCode = frmInterface.drSelectedInterface["AreaCode"];
  115. joTmp.HospitalDr = frmInterface.drSelectedInterface["HospitalDr"];
  116. joTmp.HospitalName = frmInterface.drSelectedInterface["HospitalName"];
  117. joTmp.InterfaceID = frmInterface.drSelectedInterface["InterfaceID"];
  118. joTmp.HospitalLevel = jaInterface[0]["HospitalLevel"];
  119. joTmp.ID = frmInterface.drSelectedInterface["ID"];
  120. joTmp.operatorNO = Global.user.ID;
  121. joTmp.operatorName = Global.user.name;
  122. if (Global.curEvt.MIVer == "2")
  123. joTmp.insuRegionInterfaceDr = frmInterface.drSelectedInterface["InsuRegionDr"];
  124. joTmp.InsuCurrencyCataLogue = jaInterface[0]["InsuCurrencyCataLogue"];
  125. joRtn = JsonHelper.setIrisReturnValue(0, "", joTmp);
  126. }
  127. else
  128. {
  129. joRtn = JsonHelper.setExceptionJson(-100, "接口选择界面", "返回的接口为空,请联系管理员!");
  130. }
  131. }
  132. else
  133. {
  134. joRtn = JsonHelper.setExceptionJson(-100, "接口选择界面", "收款员取消选择!");
  135. }
  136. }
  137. return joRtn;
  138. }
  139. catch (Exception ex)
  140. {
  141. joRtn = JsonHelper.setExceptionJson(-100, "接口选择界面", ex.Message);
  142. return joRtn;
  143. }
  144. finally
  145. {
  146. Global.writeLog("showInterfaceChooseForm", Global.inf.hospitalDr.ToString(),joRtn.ToString());
  147. }
  148. }
  149. }
  150. }