/// <summary> /// 自动上传 /// 2016-01-25 /// 吴海龙 /// </summary> public static void AutomaticUploaded() { string _strExePath = Application.StartupPath + @"\MessagePlatform.exe"; Process.Start(_strExePath); RemoteMessage.InitClient(); while (true) { string _strSQL = uctlBaseConfig.GetConfig("AdapterSQL"); PublicVar.m_dtPatients = CommonFunction.OleExecuteBySQL(_strSQL, "", "EMR"); //每24小时执行一次 //Thread t1 = new Thread(new ThreadStart(GrabInfo.GetPatientData)); //t1.Start(); GrabInfo.GetPatientData(); string _strTimeSpan = uctlBaseConfig.GetConfig("TimeSpan"); if (_strTimeSpan == "1天") { Thread.Sleep(1000 * 60 * 60 * 24); } else if (_strTimeSpan == "1小时") { Thread.Sleep(1000 * 60 * 60); } else if (_strTimeSpan == "1分钟") { Thread.Sleep(1000 * 60); } else { Thread.Sleep(1000 * 60); } } }
private void button11_Click(object sender, EventArgs e) { string _strExePath = Application.StartupPath + @"\MessagePlatform.exe"; Process.Start(_strExePath); RemoteMessage.InitClient(); richTextBox1.Text = GrabInfo.GrabPatientInfoFromFile(textBox3.Text, textBox1.Text, textBox2.Text); }
/// <summary> /// 导出指定病人的指定对象 /// </summary> /// <param name="p_strObjectName"></param> /// <param name="p_strPatientId"></param> /// <param name="p_strVisitId"></param> public void ExportOnePatInfoForOneObj(string p_strObjectName, string p_strPatientId, string p_strVisitId) { //GrabInfo.InitPatDBInfo(p_strPatientId, p_strVisitId); DataSet _dsOnePatInfo = GrabInfo.GrabPatientInfo(p_strObjectName, p_strPatientId, p_strVisitId); DataTable _dt = ConversionData.ExchangeData(_dsOnePatInfo.Tables[0]); //GrabInfo.ExeExport(_dt.DataSet, p_strObjectName, p_strPatientId, p_strVisitId); ExportXml ie = new ExportXml(_dsOnePatInfo, p_strObjectName, p_strPatientId, p_strVisitId); ie.Export(); }
/// <summary> /// 获取由sql查询到的病人信息 /// </summary> /// <param name="dql">sql集</param> /// <returns>病人信息</returns> public static void GetPatientData() { PublicVar.m_strExportType = uctlBaseConfig.GetConfig("ExportType"); PublicVar.m_nSuccessCount = 0; PublicVar.m_nFalseCount = 0; string _strSQL = string.Format("select FIELD_NAME,LOCAL_VALUE,TARGET_VALUE FROM pt_comparison "); PublicVar.m_dtFieldDict = CommonFunction.OleExecuteBySQL(_strSQL, "", "EMR"); InitFieldDict(PublicVar.m_dtFieldDict); DataTable _dtSql = GrabInfo.GetConfigSQL(); foreach (DataRow dr in _dtSql.Rows) { PublicVar.m_strCurrentObj = dr["table_name"].ToString(); CommonFunction.WriteLog("开始导出对象" + dr["table_name"].ToString()); PublicVar.m_nObjSuccessCount = 0; PublicVar.m_nObjFalseCount = 0; foreach (DataRow drpat in PublicVar.m_dtPatients.Rows) { if (PublicVar.m_strExportType == "XML") { ExportXml ie = new ExportXml(PublicVar.m_dtPatients); ie.Export(); } else { _strSQL = string.Format(dr["sql"].ToString().Replace("@PATIENT_ID", drpat["PATIENT_ID"].ToString()).Replace("@VISIT_ID", drpat["VISIT_ID"].ToString())); RemoteMessage.SendMessage("查询病人信息" + dr["TABLE_NAME"].ToString() + "---" + drpat["PATIENT_ID"].ToString() + "---" + drpat["VISIT_ID"].ToString()); DataTable _dtOnePatOneObj = CommonFunction.OleExecuteBySQL(_strSQL, dr["TABLE_NAME"].ToString(), "EMR"); _dtOnePatOneObj = ConversionData.ExchangeData(_dtOnePatOneObj); ExeExport(_dtOnePatOneObj); } } CommonFunction.WriteLog("成功" + PublicVar.m_nObjSuccessCount + "失败" + PublicVar.m_nObjFalseCount); } string _strMess = "总共导入成功:" + PublicVar.m_nSuccessCount + " 导入失败:" + PublicVar.m_nFalseCount; RemoteMessage.SendMessage(_strMess); CommonFunction.WriteLog(_strMess); }