/// <summary> /// WebService获取结果 /// </summary> /// <param name="SID"></param> /// <returns></returns> public DataTable GetReport(string SID, List <string> msglist, string RequestCode) { DataTable dt = new DataTable(); string[] objReport = new string[] { SID, RequestCode }; //string[] strReport = WebServiceUtils.Execute(config.Address, "GetReportAuto", objReport).Split('|'); string[] strReport = WebServiceUtils.ExecuteMethod("GetReportAuto", objReport).Split('|'); if (strReport[0] == "0") { msglist.Add(string.Format("获取报告失败:{0}", strReport[1])); } else { DataSet ds = XMLHelper.CXmlToDataSet(strReport[1]); if (ds.Tables.Count > 0) { dt = ds.Tables[0]; } else { msglist.Add("获取报告失败:没有报告数据"); } } return(dt); }
private void button1_Click(object sender, EventArgs e) { #region >>>> zhouy 获取组合对应关系 DataTable cacheGroupTestdetail = new DataTable(); string[] testItemInfo = WebServiceUtils.ExecuteMethod("GetTestGroupDetail", new string[] { SystemConfig.UserInfo.SID }).Split('|'); if (testItemInfo[0] == "0") { string[] par = new string[] { SystemConfig.Config.Sitecode, SystemConfig.Config.Username, SystemConfig.Config.Password, SystemConfig.UserInfo.UserName }; //返回登录验证信息:1|SID,0|errorMsg string[] loginMsg = WebServiceUtils.ExecuteMethod("Login", par).Split('|'); if (loginMsg[0] == "0") //登录失败 { ShowMessageHelper.ShowBoxMsg("登录达安服务器失败" + loginMsg[1].ToString()); } else { SystemConfig.UserInfo.SID = loginMsg[1]; testItemInfo = WebServiceUtils.ExecuteMethod("GetTestGroupDetail", new string[] { SystemConfig.UserInfo.SID }).Split('|'); } } if (testItemInfo[0] == "1") { cacheGroupTestdetail = XMLHelper.CXmlToDataSet(testItemInfo[1]).Tables[0]; } else { ShowMessageHelper.ShowBoxMsg("远程连接失败,不能设置!"); return; } #endregion //弹出设置窗体 FrmItemHospitalAndDaanSetting2 settingFrm = new FrmItemHospitalAndDaanSetting2(cacheGroupTestdetail); settingFrm.StartPosition = FormStartPosition.CenterParent; settingFrm.ShowDialog(); BindData(); }
/// <summary> /// 插入结果 /// </summary> /// <param name="resultxml">结果XML字符串</param> /// <returns></returns> private bool ImportResult(string resultxml, List <string> msglist, ref int itemtype, string requestcode, string model) { //执行的SQL集合 SortedList SQLlist = new SortedList(new MySort()); bool b = true; string errormsg = ""; try { DataSet ds = XMLHelper.CXmlToDataSet(resultxml); DataTable dthead = ds.Tables["data_row"];//基本信息 //是否获得结果数据 bool notdata = false; if (dthead != null) { //获取结果类型 if (dthead.Columns.Contains("ItemType") && dthead.Rows[0]["ItemType"] != DBNull.Value) { itemtype = Convert.ToInt32(dthead.Rows[0]["ItemType"]);//更新条件 } //组合对接 if (model == "1") { DataTable dtGroupTest = ds.Tables["BarcodeGroupTest"];//完成检验的组合项目 UpdateOutSpecimentest(SQLlist, dtGroupTest, dthead.Rows[0]); notdata = dtGroupTest == null; }//单项对接 操作明细 else { DataTable dtResults = ds.Tables["Testresults"]; //常规 DataTable dtMicantiResults = ds.Tables["AntiResult"]; //药敏-抗生素 DataTable dtMicorgResults = ds.Tables["OrgResult"]; //细菌 DataTable dtPathologyResults = ds.Tables["PathologyResult"]; //病理 DataTable dtImages = ds.Tables["Images"]; //图片 InsertMicorgresult(SQLlist, dtMicorgResults, dtMicantiResults, dthead.Rows[0]); InsertResult(SQLlist, dtResults, dthead.Rows[0]); InsertPathologyResult(SQLlist, dtPathologyResults, dthead.Rows[0]); InsertLisPicture(SQLlist, dtImages, dthead.Rows[0]); notdata = dtResults == null && dtPathologyResults == null; } ds.Dispose(); //删除报告 SQLlist.Add(new Hashtable() { { "DELETE", "DeleteDAReportByRequestCode" } }, requestcode); //改报告状态 Hashtable ht = new Hashtable(); ht.Add("RequestCode", requestcode); ht.Add("Status", 2); SQLlist.Add(new Hashtable() { { "UPDATE", "UpdateDAOutspecimenByRequestCode" } }, ht); b = service.ExecuteSqlTran(SQLlist, ref errormsg); } //没有结果 if (notdata) { throw new Exception("没有获取到结果数据"); } } catch (Exception ex) { b = false; errormsg = ex.Message; } //错误信息添加到集合 if (!b) { msglist.Add(errormsg); } return(b); }
//开始同步 private void DoSynchro() { try { if (SystemConfig.Config != null && SystemConfig.UserInfo != null) { string strSideCode = SystemConfig.Config.Sitecode; string strUrl = SystemConfig.Config.Address; //调用webservice地址 string username = SystemConfig.Config.Username; //登录用户名 string password = SystemConfig.Config.Password; //登录用户密码 string sid = SystemConfig.UserInfo.SID; //如果SID为空,调用Login方法重新获取SID if (sid == null || sid == string.Empty) { //设置调用webservice登录方法的参数 string[] par = new string[] { strSideCode, username, password, SystemConfig.UserInfo.UserName }; //返回登录验证信息:1|SID,0|errorMsg string[] loginMsg = WebServiceUtils.ExecuteMethod("Login", par).Split('|'); if (loginMsg[0] == "0") //登录失败 { //ShowMessageHelper.ShowBoxMsg("同步失败,请检查系统配置!" + loginMsg[1].ToString()); } sid = loginMsg[1].ToString(); //保存新的SID LoginUserInfo loginuserInfo = new LoginUserInfo(); loginuserInfo = SystemConfig.UserInfo; loginuserInfo.SID = sid; SystemConfig.UserInfo = loginuserInfo; } //设置SID为调用webservice获取项目方法的参数 //返回信息 string[] testItemInfo = WebServiceUtils.ExecuteMethod("GetDictTestItem", new string[] { sid }).Split('|'); if (testItemInfo.Length == 1) { //ShowMessageHelper.ShowBoxMsg("同步失败,请检查系统配置!" + testItemInfo[1].ToString()); } DataSet ds = XMLHelper.CXmlToDataSet(testItemInfo[1].ToString()); if (ds == null || ds.Tables.Count <= 0) { //return; } DataTable dtdatarow = ds.Tables["DATA_ROW"]; Hashtable ht = new Hashtable(); ht["DATA_ROW"] = dtdatarow; bool result = dicttestitemBll.InsertDADicttestitem(ht); if (result) { isSync = true; //ShowMessageHelper.ShowBoxMsg("数据同步成功!"); } else { //ShowMessageHelper.ShowBoxMsg("数据同步失败!"); } } else { //ShowMessageHelper.ShowBoxMsg("同步失败,请检查服务端系统参数配置!"); } } catch { //ShowMessageHelper.ShowBoxMsg("同步的过程中发生了异常!"); } }