Example #1
0
 /// <summary>
 /// 向Datatable中加入出院情况ID、出院情况两列数据
 /// 注:Datatable中需包含iem_mainpage_diagnosis_no列
 /// </summary>
 /// <param name="dt"></param>
 /// <returns></returns>
 public static DataTable AddColsDataToDataTable(DataTable dt)
 {
     try
     {
         if (!dt.Columns.Contains("Status_Id_Out"))
         {
             dt.Columns.Add("Status_Id_Out");
         }
         if (!dt.Columns.Contains("Status_Name_Out"))
         {
             dt.Columns.Add("Status_Name_Out");
         }
         if (null != dt && dt.Rows.Count > 0)
         {
             foreach (DataRow dr in dt.Rows)
             {
                 if (null != dr && null != dr["iem_mainpage_diagnosis_no"] && !string.IsNullOrEmpty(dr["iem_mainpage_diagnosis_no"].ToString().Trim()) && Tool.IsInt(dr["iem_mainpage_diagnosis_no"].ToString().Trim()))
                 {
                     DataTable coditionDT = DS_SqlService.GetOutHosConditonByID(int.Parse(dr["iem_mainpage_diagnosis_no"].ToString().Trim()));
                     if (null != coditionDT && coditionDT.Rows.Count > 0)
                     {
                         dr["Status_Id_Out"]   = coditionDT.Rows[0]["status_id"];
                         dr["Status_Name_Out"] = coditionDT.Rows[0]["Status_Name"];
                     }
                 }
             }
         }
         return(dt);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }