/// <summary> /// 将本地不标准的数据格式化为中间库标准数据 /// 2015-10-20 /// 吴海龙 /// </summary> /// <param name="_dtDictDetail"></param> public static DataTable ExchangeData(DataTable p_dtOnePatInfo) { try { DataTable _dtDict = PublicVar.m_dtFieldDict; foreach (DataColumn _dcColumn in p_dtOnePatInfo.Columns) { DataRow _drTemp = p_dtOnePatInfo.Rows[0]; DataRow[] _arrDataRow = _dtDict.Select("FIELD_NAME = '" + _dcColumn.Caption.ToUpper().Trim() + "'"); foreach (DataRow _drDict in _arrDataRow) { if (_drTemp[_dcColumn].ToString().Trim() == _drDict["LOCAL_VALUE"].ToString().Trim()) { RemoteMessage.SendMessage("正在转换字典[" + _dcColumn.Caption.PadRight(30, '.') + "]:" + _drTemp[_dcColumn].ToString().PadRight(5, ' ') + _drDict["TARGET_VALUE"].ToString()); _drTemp[_dcColumn] = _drDict["TARGET_VALUE"].ToString(); } } } return(p_dtOnePatInfo); } catch (Exception exp) { CommonFunction.WriteError("异常ExchangeData" + exp.Message); return(p_dtOnePatInfo); } }
/// <summary> /// 将DataTable导出为Excel(OleDb 方式操作) /// </summary> /// <param name="dataTable">表</param> /// <param name="fileName">导出默认文件名</param> public static void InsertExcel(DataTable p_dtSource, string p_strTempletFullName) { string _strFileName = p_strTempletFullName.Substring(p_strTempletFullName.LastIndexOf('\\') + 1); string _strTarget = CommonFunction.GetConfig("ExcelOutPutDir") + "\\" + _strFileName; if (!File.Exists(_strTarget)) { CommonFunction.CopyFile(p_strTempletFullName, _strTarget, false); } string strColumn = GetColumnStr(_strTarget); //存放要插入的字段名 DataTable dtColumn = ReadExcel(_strTarget); //存放要插入的字段名 int _icount = 0; foreach (DataRow dr in p_dtSource.Rows) { _icount++; string _strSQL = "insert into [sheet1$]( ";//sql的开头 _strSQL += strColumn; _strSQL += ") values ("; _strSQL += ReturnStrValues(dr, dtColumn); _strSQL += ")"; //CommonFunction.WriteLog("SQL:" + _strSQL); if (1 == WriteExcel(_strTarget, _strSQL)) { PublicVar.m_nSuccessCount++; RemoteMessage.SendMessage("插入成功..."); } else { PublicVar.m_nFalseCount++; RemoteMessage.SendMessage("插入失败..."); } } }
/// <summary> /// 构造生成插入表 的列 /// 并赋值给m_strColumns /// </summary> /// <returns></returns> public string CombineColumns(string p_strTableName) { string m_strTableName = p_strTableName; string m_strColumns = string.Empty; RemoteMessage.SendMessage("正在拼接[" + m_strTableName + "]的列"); DataTable m_dtColumns = GetTargetTable(p_strTableName); foreach (DataColumn drColumnName in m_dtColumns.Columns)//拼接插入的列 { m_strColumns += drColumnName.ToString() + ","; } if ("SQLSERVER" == m_strDbType) { m_strColumns = m_strColumns.Trim(','); m_strColumns = m_strColumns.Remove(0, 4); } else { m_strColumns = m_strColumns.Trim(','); } this.m_strColumns = m_strColumns; return(m_strColumns); //RemoteMessage.SendMessage("拼接完成[" + m_strColumns + "]"); }
/// <summary> /// 获取平台配置的sql /// </summary> /// <returns>返回sql列表</returns> public void GetConfigSQL() { string strSQL = string.Format("select * from pt_sql a,pt_tables_dict b where a.table_id = b.id and b.exportflag ='TRUE' "); m_dsSQL = DALUse.Query(strSQL); RemoteMessage.SendMessage("===加载配置语句\nSQL:" + strSQL); }
/// <summary> /// 执行插入语句 /// </summary> /// <param name="p_dtPatObj"></param> public static void DoImport(DataTable p_dtPatObj) { try { m_strTableName = p_dtPatObj.TableName; m_strColumns = CombineColumns(m_strTableName); foreach (DataRow drValue in p_dtPatObj.Rows) { string m_strValues = CombineValues(drValue); if (!ExeCuteSQL(m_strTableName, m_strColumns, m_strValues)) { RemoteMessage.SendMessage("[执行]======================================[FALSE]"); PublicVar.m_nFalseCount++; PublicVar.m_nObjFalseCount++; WritLog(); } else { RemoteMessage.SendMessage("[执行]======================================[TRUE]"); PublicVar.m_nSuccessCount++; PublicVar.m_nObjSuccessCount++; } } } catch (Exception exp) { RemoteMessage.SendMessage(exp.Message + "DoImport"); } }
/// <summary> /// 获取dataset中过滤的表 /// 没有返回null /// 2015-11-21今天是周日 /// </summary> /// <param name="p_strTableName"></param> /// <returns></returns> public static DataTable GetPatTable(string p_strTableName) { if (m_dsPatDBInfo.Tables.Contains(p_strTableName)) { return(m_dsPatDBInfo.Tables[p_strTableName]); } RemoteMessage.SendMessage("数据集中无所描述表" + p_strTableName); return(null); }
/// <summary> /// 获取表中字段值 /// </summary> /// <param name="p_dtTable"></param> /// <param name="p_strName"></param> /// <returns></returns> public static string GetPatItemInfo(DataTable p_dtTable, string p_strName) { if (p_dtTable != null && p_dtTable.Rows.Count == 1 && p_dtTable.Columns.Contains(p_strName)) { return(p_dtTable.Rows[0][p_strName].ToString()); } RemoteMessage.SendMessage("表为空|行不为1|表中无此列" + p_strName); return(""); }
public void GetPats() { m_dsPtas = new DataSet(); string sql = string.Format("select m.PATIENT_ID,m.VISIT_ID ,n.NAME from pat_visit m ,pat_master_index n where {0} >'{1}' and {0}< '{2}' and m.patient_id = n.patient_id", "DISCHARGE_DATE_TIME", DateTime.Today.AddDays(-1), DateTime.Today); m_dsPtas = DALUse.Query(sql); ExportDB.m_strTimeRange = "[时间]:" + DateTime.Today.AddDays(-1).ToString() + "至" + DateTime.Today; RemoteMessage.SendMessage("===加载病人列表\nSQL:" + sql + "\n===共" + m_dsPtas.Tables[0].Rows.Count.ToString() + "人"); }
/// <summary> /// 将字典装载到dict中 key 为fieldname+localvalue(大写) value 为targetvalue /// 2016-02-17 /// 吴海龙 /// </summary> /// <param name="p_dtFieldDict"></param> public static void InitFieldDict(DataTable p_dtFieldDict) { foreach (DataRow var in p_dtFieldDict.Rows) { string _strKey = var["FIELD_NAME"].ToString() + var["LOCAL_VALUE"].ToString().Trim().ToUpper(); string _strValue = var["TARGET_VALUE"].ToString().Trim(); if (!PublicVar.m_dictFieldDict.ContainsKey(_strKey)) { PublicVar.m_dictFieldDict.Add(_strKey, _strValue); } } RemoteMessage.SendMessage("初始化字典完成共" + PublicVar.m_dictFieldDict.Keys.Count + "项....."); }
/// <summary> /// 获取平台配置的sql /// </summary> /// <returns>返回sql列表</returns> public static DataTable GetConfigSQL() { string _strSQL = string.Format("select table_name,MS,'' sql from pt_tables_dict b where b.exportflag ='TRUE'"); RemoteMessage.SendMessage("正在获取配置SQL:" + _strSQL); DataTable _dtSQL = CommonFunction.OleExecuteBySQL(_strSQL, "", "EMR"); foreach (DataRow var in _dtSQL.Rows) { var["sql"] = GetSQL(var["table_name"].ToString()); } return(_dtSQL); }
/// <summary> /// 获取配置信息 /// </summary> /// <returns>导出类型</returns> public void CheckOutPutType() { Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); m_strExportType = config.AppSettings.Settings["ExportType"].Value; m_strDbfPath = config.AppSettings.Settings["DbfPath"].Value; m_strExcelPath = config.AppSettings.Settings["ExcelPath"].Value; m_strXmlPath = config.AppSettings.Settings["XmlPath"].Value; RemoteMessage.SendMessage( "===加载系统配置信息\n===导出类型:" + m_strExportType + "\n===ExcelPath:" + m_strXmlPath + "\n===DbfPath:" + m_strDbfPath + "\n===XmlPath:" + m_strXmlPath); }
/// <summary> /// 获取单行病人信息 /// </summary> /// <param name="p_dtObjectReflect"></param> /// <param name="p_strPatientId"></param> /// <param name="p_strVisitId"></param> /// <returns></returns> public static DataTable GrabSimplePatientInfo(DataTable p_dtObjectReflect, string p_strPatientId, string p_strVisitId, string p_strObjectName) { DataTable _dtObjecDetail = GetChapterDescription(p_strObjectName); DataTable _dtObjectReflect = p_dtObjectReflect; DataRow _drObjectReflect = _dtObjectReflect.NewRow(); string _strPatientId = p_strPatientId; string _strVisitId = p_strVisitId; foreach (DataColumn _dcObjectReflect in _dtObjectReflect.Columns) { DataRow[] _arrObjectReflect = _dtObjecDetail.Select(string.Format("CHAPTER_NAME = '{0}'", _dcObjectReflect)); if (_arrObjectReflect.Length == 1) { string _strClass = _arrObjectReflect[0]["CLASS"].ToString(); string _strTableName = _arrObjectReflect[0]["TABLE_NAME"].ToString(); string _strChapterName = _arrObjectReflect[0]["CHAPTER_NAME"].ToString(); string _strDataDatail = _arrObjectReflect[0]["DATA_DETAIL"].ToString(); string _strTempValue = string.Empty; if ("DB" == _strClass) { //if (_strDataDatail.StartsWith("@")) //{ _strTempValue = GrabPatientInfoFromDBBySQL(_strDataDatail, _strPatientId, _strVisitId); //} //else //{ // _strTempValue = GrabPatientInfoFromDBByParam(_strDataDatail, _strPatientId, _strVisitId); //} } else if ("FILE" == _strClass) { _strTempValue = GrabPatientInfoFromFile(_strDataDatail, _strPatientId, _strVisitId); } else { continue; } _drObjectReflect[_strChapterName] = _strTempValue; string _strField = _strPatientId + "|" + _strVisitId + "|" + _strChapterName; RemoteMessage.SendMessage(_strField.PadRight(30, '.') + _strTempValue); } } _drObjectReflect["PATIENT_ID"] = _strPatientId; _drObjectReflect["VISIT_ID"] = _strVisitId; _dtObjectReflect.Rows.Add(_drObjectReflect); return(_dtObjectReflect); }
/// <summary> /// 执行拼接的sql /// </summary> /// <returns></returns> public bool ExeCuteSQL(string p_strTableName, string p_strColumns, string p_strValues) { //RemoteMessage.SendMessage("开始执行插入"); string m_strSQL = string.Format("insert into {0} ({1}) values ({2})", p_strTableName, p_strColumns, p_strValues); if (CommonFunction.OleExecuteNonQuery(m_strSQL, "TARGET") == 1) { RemoteMessage.SendMessage("[执行]:" + m_strSQL + "......TRUE"); return(true); } RemoteMessage.SendMessage("[执行]:" + m_strSQL + "......FALSE"); CommonFunction.WriteError("执行异常[SQL]:" + m_strSQL); return(false); }
/// <summary> /// 获取表样式病人信息 /// </summary> /// <param name="p_dtObjectReflect"></param> /// <param name="p_strPatientId"></param> /// <param name="p_strVisitId"></param> /// <returns></returns> public static DataTable GrabMultiPatientInfo(DataTable p_dtObjectReflect, string p_strPatientId, string p_strVisitId, string p_strObjectName) { DataTable _dtObjecDetail = GetChapterDescription(p_strObjectName); DataTable _dtObjectReflect = p_dtObjectReflect; //DataRow _drObjectReflect = _dtObjectReflect.NewRow(); string _strPatientId = p_strPatientId; string _strVisitId = p_strVisitId; string _strClass = string.Empty; string _strTableName = string.Empty; string _strChapterName = p_dtObjectReflect.TableName.Replace("TABLE_", ""); string _strDataDatail = string.Empty; DataRow[] _arrObjectReflect = _dtObjecDetail.Select(string.Format("CHAPTER_NAME = '{0}'", _strChapterName)); if (_arrObjectReflect.Length == 1) { _strClass = _arrObjectReflect[0]["CLASS"].ToString(); _strTableName = _arrObjectReflect[0]["TABLE_NAME"].ToString(); _strChapterName = _arrObjectReflect[0]["CHAPTER_NAME"].ToString(); _strDataDatail = _arrObjectReflect[0]["DATA_DETAIL"].ToString(); } //foreach (DataColumn _dcObjectReflect in _dtObjectReflect.Columns) //{ //DataRow[] _arrObjectReflect = _dtObjecDetail.Select(string.Format("CHAPTER_NAME = '{0}'", _dcObjectReflect.Caption)); //if (_arrObjectReflect.Length == 1) //{ if ("TABLE" == _strClass) { DataTable _dtTemp = GrabPatientTableInfoFromDB(_strDataDatail, _strPatientId, _strVisitId); foreach (DataRow _drSubPatInfo in _dtTemp.Rows) { _dtObjectReflect.Rows.Add(_drSubPatInfo.ItemArray); } } //else //{ // continue; //} string _strField = _strPatientId + "|" + _strVisitId + "|" + p_strObjectName; RemoteMessage.SendMessage(_strField.PadRight(30, '.') + "TABLE_DATE"); //} //} return(_dtObjectReflect); }
/// <summary> /// 构造生成插入表 的列 /// 并赋值给m_strValues /// </summary> /// <returns></returns> public static string CombineValues(DataRow p_drSource) { m_strValues = string.Empty; DataRow _drValue = p_drSource; DataTable m_dtColumns = GetTargetTable(m_strTableName); foreach (string dcItem in m_strColumns.Split(',')) { if (p_drSource.Table.Columns.Contains(dcItem)) { string _strValue = string.Empty; if (_drValue[dcItem].ToString().StartsWith("@")) { string _strPatientId = _drValue["PATIENT_ID"].ToString(); int _iVisitId = int.Parse(_drValue["VISIT_ID"].ToString()); RemoteMessage.SendMessage("[调取模板]" + _strPatientId + "||" + _iVisitId.ToString() + "||" + _drValue[dcItem].ToString()); try { _strValue = CallMrInfo2(_strPatientId, _iVisitId, _drValue[dcItem].ToString()); } catch (Exception exp) { RemoteMessage.SendMessage("[获取模板信息错误]" + exp.Message); m_strValues += "无,"; } RemoteMessage.SendMessage("[值]" + _strValue); } else { _strValue = _drValue[dcItem].ToString(); } string type = m_dtColumns.Columns[dcItem].DataType.Name.ToString(); m_strValues += FixDateTime.makeInsertvalue(_strValue, false, m_strTargetDBType, type); RemoteMessage.SendMessage(dcItem.PadRight(25, '.') + _strValue); } else { m_strValues += "NULL,"; } } m_strValues = m_strValues.Trim(','); return(m_strValues); //RemoteMessage.SendMessage("拼接完成[" + m_strValues + "]"); }
/// <summary> /// 获取由sql查询到的病人信息 /// </summary> /// <param name="dql">sql集</param> /// <returns>病人信息</returns> public void GetPatientData() { m_dsAllPatsInfo = new DataSet(); foreach (DataRow dr in m_dsSQL.Tables[0].Rows) { DataTable _dtPatsInfo = new DataTable(); foreach (DataRow drpat in m_dsPtas.Tables[0].Rows) { string _strPatientId = drpat["PATIENT_ID"].ToString(); string _strVisitId = drpat["VISIT_ID"].ToString(); string _strSql = string.Format(dr["sql"].ToString().Replace("@PATIENT_ID", _strPatientId).Replace("@VISIT_ID", _strVisitId)); _dtPatsInfo.Merge(DALUse.Query(_strSql).Tables[0]); RemoteMessage.SendMessage("===查询病人信息\nSQL:" + _strSql); } DataTable _dt = _dtPatsInfo.Copy(); _dt.TableName = "@" + dr["SQL_NAME"].ToString() + "@" + dr["table_id"].ToString(); m_dsAllPatsInfo.Tables.Add(_dt); } }
/// <summary> /// 接口内容替换 /// </summary> /// <param name="p_strXml"></param> /// <param name="p_dtSource"></param> /// <returns></returns> public string DoInterfaceReplace(string p_strXml, string p_strOldValue, string p_strPatientId, string p_strVisitId) { try { string _strXml = p_strXml; string _strNewValue = SingleObjectDBExport.CallMrInfo2(p_strPatientId, int.Parse(p_strVisitId), p_strOldValue); if (_strXml.IndexOf(p_strOldValue) > 0) { _strNewValue = ConversionData.ExchangeData(p_strOldValue, _strNewValue); _strXml = _strXml.Replace(p_strOldValue, _strNewValue); RemoteMessage.SendMessage(p_strOldValue + "....................." + _strNewValue); } return(_strXml); } catch (Exception ex) { CommonFunction.WriteError("DoInterfaceReplace" + ex.Message); } return(null); }
/// <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); }
/// <summary> /// 单个元素替换 /// </summary> /// <param name="p_strXml"></param> /// <param name="p_dtSource"></param> /// <returns></returns> public string DoDBReplace(string p_strXml, string p_strOldValue, string p_strSQL, string p_strPatientId, string p_strVisitId) { try { string _strXml = p_strXml; string _strSQL = p_strSQL.Replace("@PATIENT_ID", p_strPatientId).Replace("@VISIT_ID", p_strVisitId); string _strNewValue = CommonFunction.OleExecuteBySQL(_strSQL, "", "EMR").Rows[0][0].ToString(); _strNewValue = ConversionData.ExchangeData(p_strOldValue, _strNewValue); if (_strXml.IndexOf(p_strOldValue) > 0) { _strXml = _strXml.Replace(p_strOldValue, _strNewValue); RemoteMessage.SendMessage(p_strOldValue + "....................." + _strNewValue); } return(_strXml); } catch (Exception ex) { CommonFunction.WriteError("DoDBReplace" + ex.Message); } return(null); }
/// <summary> /// 下载数据集中病人的所有文件 /// </summary> /// <param name="p_dsPats"></param> public void PreDownLoadFile() { string _strTimeKind = uctlBaseConfig.GetConfig("TimeKind"); string _strSQL = string.Format(@"select n.patient_id,n.visit_id,n.file_name from pat_visit m,mr_file_index n where m.patient_id = n.patient_id and m.visit_id = n.visit_id and m.{2} >TO_DATE('{0}','yyyy-MM-dd') and m.{2}< TO_DATE('{1}','yyyy-MM-dd')", m_strStart, m_strEnd, _strTimeKind); DataTable m_dtPats = CommonFunction.OleExecuteBySQL(_strSQL, "", PublicVar.m_strEmrConnection); foreach (DataRow var in m_dtPats.Rows) { m_strPatientId = var["PATIENT_ID"].ToString(); string _strVisitId = var["VISIT_ID"].ToString(); m_strFileName = var["FILE_NAME"].ToString(); string _strLocalPath = EmrInfoManagement.GetLocalFilePath(m_strPatientId, m_strFileName); File.Delete(_strLocalPath); EmrInfoManagement.RedirectSavePath(m_strPatientId, _strVisitId, m_strFileName); DoDownLoad(m_strPatientId, m_strFileName); //DoDownLoad(); //Thread t = new Thread(DoDownLoad); //t.Start(); } RemoteMessage.SendMessage("文件导出完毕"); }
/// <summary> /// 2015-01-14 吴海龙 向dbf文件插入数据 /// </summary> /// <param name="dt">数据源</param> /// <param name="strFileName">文件路径</param> /// <returns>插入是否成功</returns> public bool InsertDBF(DataTable p_dtSource, string p_strTempletFileFullName) { try { string _strFileName = p_strTempletFileFullName.Substring(p_strTempletFileFullName.LastIndexOf('\\') + 1); string _strTarget = CommonFunction.GetConfig("DbfOutPutDir") + "\\" + _strFileName; CommonFunction.CopyFile(p_strTempletFileFullName, _strTarget, false); string strColumn = GetColumnStr(_strTarget); //存放要插入的字段名 DataTable dtColumn = ReadDBF(_strTarget); //存放要插入的字段名 CommonFunction cf = new CommonFunction(); foreach (DataRow dr in p_dtSource.Rows) { string strsql = "insert into TableName( ";//sql的开头 strsql += strColumn; strsql += ") values ("; strsql += ReturnStrValues(dr, dtColumn); //strsql += ReturnStrValues(dr, strColumn); strsql += ")"; if (WriteDBF(_strTarget, strsql)) { PublicVar.m_nSuccessCount++; RemoteMessage.SendMessage("插入成功..."); } else { PublicVar.m_nFalseCount++; RemoteMessage.SendMessage("插入失败..."); } } //string mess = "" + DateTime.Now.ToString() + "数据导出完成\n导出成功" + successcount.ToString() + "条; \n 导出失败" + falsecount.ToString() + "条; \n 详情信息查看Errorlog.txt!"; //CommonFunction.WriteError(mess + "\n"); //ToolFunction.uctlMessageBox.frmDisappearShow(mess); } catch (Exception ex) { CommonFunction.WriteError(ex.Message); } return(true); }
/// <summary> /// 将字典内容转换 /// </summary> /// <param name="p_strClassName">章节名称</param> /// <param name="p_strClassValue">章节值</param> /// <returns>章节字典值</returns> public static string ExchangeData(string p_strClassName, string p_strClassValue) { try { DataTable _dtDict = PublicVar.m_dtFieldDict; DataRow[] _arrDataRow = _dtDict.Select("FIELD_NAME = '" + p_strClassName.ToUpper().Trim() + "'"); foreach (DataRow _drDict in _arrDataRow) { if (p_strClassValue == _drDict["LOCAL_VALUE"].ToString().Trim()) { RemoteMessage.SendMessage("正在转换字典[" + p_strClassName.PadRight(30, '.') + "]:" + p_strClassValue.PadRight(5, ' ') + _drDict["TARGET_VALUE"].ToString()); p_strClassValue = _drDict["TARGET_VALUE"].ToString(); } } return(p_strClassValue); } catch (Exception exp) { CommonFunction.WriteError("异常ExchangeData" + exp.Message); return(null); } }
public static void Insert(DataSet p_dsSource) { CommonFunction.WriteLog("=====================" + m_strTimeRange + "====================="); try { m_dsSource = p_dsSource; //修改人:吴海龙;修改时间2014-07-19;修改原因:从pt_tables_dict 设置那些表导出 m_strSQL = string.Format("select * from pt_tables_dict where exportflag = 'TRUE'"); DataTable _dtTarget = CommonFunction.OleExecuteBySQL(m_strSQL, "", "EMR"); foreach (DataRow drTarget in _dtTarget.Rows) { RemoteMessage.SendMessage("开启" + drTarget["TABLE_NAME"].ToString() + "数据上传线程"); SingleObjectDBExport p = new SingleObjectDBExport(drTarget["TABLE_NAME"].ToString(), p_dsSource); p.DoProcess(); //Thread t = new Thread(new ThreadStart(p.DoProcess)); //t.Start(); } } catch (Exception exp) { RemoteMessage.SendMessage("[异常]:" + exp.Message); } }
/// <summary> /// 将本地不标准的数据格式化为中间库标准数据 /// 2015-10-20 /// 吴海龙 /// </summary> /// <param name="_dtDictDetail"></param> public static void ExchangeData() { string _strSQL = string.Format("select FIELD_NAME,LOCAL_VALUE,TARGET_VALUE FROM pt_comparison "); DataTable _dtDict = CommonFunction.OleExecuteBySQL(_strSQL, "", "EMR"); foreach (DataTable _dtTemp in PublicVar.ExportData.Tables) { foreach (DataColumn _dcColumn in _dtTemp.Columns) { foreach (DataRow _drTemp in _dtTemp.Rows) { DataRow[] _arrDataRow = _dtDict.Select("FIELD_NAME = '" + _dcColumn.Caption + "'"); foreach (DataRow _drDict in _arrDataRow) { if (_drTemp[_dcColumn].ToString() == _drDict["LOCAL_VALUE"].ToString()) { RemoteMessage.SendMessage("convert dict [" + _dcColumn.Caption + "]".PadRight(20, '.') + _drTemp[_dcColumn].ToString().PadRight(5, ' ') + _drDict["TARGET_VALUE"].ToString()); _drTemp[_dcColumn] = _drDict["TARGET_VALUE"].ToString(); } } } } } }