using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Newtonsoft.Json.Linq; using PTMedInsuInterface.Helper; using PTMedInsuInterface; using PTMedInsuInterface.Common; using PTMedInsuInterface.Variables; using System.Reflection; using System.IO; using PTMedInsuInterface.Forms; namespace PTMedInsuInterface.Business { class ShellBusiness { MIIrisServices mis = new MIIrisServices(); public bool isExistConfig() { return File.Exists(Global.curEvt.path + @"\INSUConfigure.ini"); } /// /// 获取HIS的IRIS配置信息 /// /// public void getHisConfingue(out IrisConfigue con) { IniFile ini = new IniFile(Global.curEvt.path + @"\INSUConfigure.ini"); con.ip = ini.ReadValue("HIS", "ip"); con.url = ini.ReadValue("HIS", "url"); con.authorization = ini.ReadValue("HIS", "authorization"); } /// /// 获取医保平台的iris配置信息 /// /// public void getInsuConfingue(out IrisConfigue con) { IniFile ini = new IniFile(Global.curEvt.path + @"\INSUConfigure.ini"); con.ip = ini.ReadValue("INSU", "ip"); con.url = ini.ReadValue("INSU", "url"); con.authorization = ini.ReadValue("INSU", "authorization"); Global.curEvt.MIVer = ini.ReadValue("Ver", "MIVer"); } public void getDLLInfo(out DllInfo dll) { dll = new DllInfo(); dll.nameSpace = "PTMedicalInsurance"; dll.className = "InsuBusiness"; } public void getDLLInfo(JObject joIn) { Global.dll.name = joIn["DLLName"].ToString(); } /// //获取当前环境信息 /// /// public void getCurrentEnvironmentInfo() { //Global.curEvt.path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Global.curEvt.path = tools.GetPath(); ComputerInfo comp = new ComputerInfo(); Global.curEvt.mac = comp.GetMAC(); Global.curEvt.ip = comp.GetIP(); } public JObject showInterfaceChooseForm() { dynamic joInterface = new JObject(); dynamic joRtn = new JObject(); try { joInterface = mis.getInterface(); JArray jaInterface = JArray.Parse(JsonHelper.getDestValue(joInterface, "result.data")); //有且仅有一条则不显示弹窗,并直接返回该条接口 if (jaInterface.Count == 1) { joInterface.errorCode = 0; joInterface.errorMessage = ""; dynamic joTmp = new JObject(); joTmp.HospitalNO = jaInterface[0]["HospitalNO"]; joTmp.DLLName = jaInterface[0]["DLLName"]; joTmp.CenterURL = jaInterface[0]["CenterURL"]; joTmp.CenterURL2 = jaInterface[0]["CenterURL2"]; joTmp.AreaCode = jaInterface[0]["AreaCode"]; joTmp.HospitalDr = jaInterface[0]["HospitalDr"]; joTmp.HospitalName = jaInterface[0]["HospitalName"]; joTmp.InterfaceID = jaInterface[0]["InterfaceID"]; joTmp.HospitalLevel = jaInterface[0]["HospitalLevel"]; joTmp.ID = jaInterface[0]["ID"]; joTmp.operatorNO = Global.user.ID; joTmp.operatorName = Global.user.name; if (Global.curEvt.MIVer == "2") joTmp.insuRegionInterfaceDr = jaInterface[0]["InsuRegionDr"]; joTmp.InsuCurrencyCataLogue = jaInterface[0]["InsuCurrencyCataLogue"]; joRtn = JsonHelper.setIrisReturnValue(0, "", joTmp); } else { InterfaceChooser frmInterface = new InterfaceChooser(jaInterface); if (tools.ShowAppDiaglog(frmInterface) == DialogResult.OK) { if (frmInterface.drSelectedInterface["ID"] != "") { joInterface.errorCode = 0; joInterface.errorMessage = ""; dynamic joTmp = new JObject(); joTmp.HospitalNO = frmInterface.drSelectedInterface["HospitalNO"]; joTmp.DLLName = frmInterface.drSelectedInterface["DLLName"]; joTmp.CenterURL = frmInterface.drSelectedInterface["CenterURL"]; joTmp.CenterURL2 = frmInterface.drSelectedInterface["CenterURL2"]; joTmp.AreaCode = frmInterface.drSelectedInterface["AreaCode"]; joTmp.HospitalDr = frmInterface.drSelectedInterface["HospitalDr"]; joTmp.HospitalName = frmInterface.drSelectedInterface["HospitalName"]; joTmp.InterfaceID = frmInterface.drSelectedInterface["InterfaceID"]; joTmp.HospitalLevel = jaInterface[0]["HospitalLevel"]; joTmp.ID = frmInterface.drSelectedInterface["ID"]; joTmp.operatorNO = Global.user.ID; joTmp.operatorName = Global.user.name; if (Global.curEvt.MIVer == "2") joTmp.insuRegionInterfaceDr = frmInterface.drSelectedInterface["InsuRegionDr"]; joTmp.InsuCurrencyCataLogue = jaInterface[0]["InsuCurrencyCataLogue"]; joRtn = JsonHelper.setIrisReturnValue(0, "", joTmp); } else { joRtn = JsonHelper.setExceptionJson(-100, "接口选择界面", "返回的接口为空,请联系管理员!"); } } else { joRtn = JsonHelper.setExceptionJson(-100, "接口选择界面", "收款员取消选择!"); } } return joRtn; } catch (Exception ex) { joRtn = JsonHelper.setExceptionJson(-100, "接口选择界面", ex.Message); return joRtn; } finally { Global.writeLog("showInterfaceChooseForm", Global.inf.hospitalDr.ToString(),joRtn.ToString()); } } } }