/// <summary> /// Modify by xlb 2013-04-22西医诊断先填充左侧再填充右侧 /// </summary> /// <returns></returns> public DataSet CreateDataTable() { try { DataSet dts = new DataSet(); DataTable outDiagTable = new DataTable(); DataTable newoutDiagTable = null;// new DataTable(); outDiagTable = DS_BaseService.AddColsDataToDataTable(m_IemMainPageEntity.IemDiagInfo.OutDiagTable).Copy(); //if (outDiagTable != null && outDiagTable.Rows.Count > 0) //{ // outDiagTable.Rows.RemoveAt(0); //} if (newoutDiagTable == null) { newoutDiagTable = outDiagTable.Copy();//声明一个用于存放去除了门急诊诊断的数据 add by ywk2012年6月4日 11:52:49 } if (outDiagTable.Rows.Count > 0) { outDiagTable.DefaultView.RowFilter = " Diagnosis_Type_ID<>'13'"; newoutDiagTable = outDiagTable.DefaultView.ToTable().Copy();; } DataTable dtDialog = new DataTable(); dtDialog.TableName = "outDiagTable"; dtDialog.Columns.Add("Diagnosis_NameA"); dtDialog.Columns.Add("Diagnosis_CodeA"); dtDialog.Columns.Add("Status_IdA"); dtDialog.Columns.Add("Diagnosis_NameB"); dtDialog.Columns.Add("Diagnosis_CodeB"); dtDialog.Columns.Add("Status_IdB"); dtDialog.Columns.Add("Status_Id_OutA"); dtDialog.Columns.Add("Status_Id_OutB"); for (int i = 0; i < 9; i++) { DataRow dr = dtDialog.NewRow(); if (i == 0) { dr["Diagnosis_NameA"] = "主要诊断:"; dr["Diagnosis_NameB"] = "其他诊断:"; } else if (i == 1) { dr["Diagnosis_NameA"] = "其他诊断:"; dr["Diagnosis_NameB"] = ""; } dtDialog.Rows.Add(dr); } for (int i = 0; i < newoutDiagTable.Rows.Count; i++) //遍历诊断表 { if (i == 0) //第一行为主要诊断其余则其他诊断 { newoutDiagTable.Rows[i]["Diagnosis_Name"] = "主要诊断:" + newoutDiagTable.Rows[i]["Diagnosis_Name"]; } else if (i == 1 || i == 9) //其他诊断不是每一个都要添加 { newoutDiagTable.Rows[i]["Diagnosis_Name"] = "其他诊断:" + newoutDiagTable.Rows[i]["Diagnosis_Name"]; } if (i <= 8)//1到9行填充左边 { dtDialog.Rows[i]["Diagnosis_NameA"] = newoutDiagTable.Rows[i]["Diagnosis_Name"]; dtDialog.Rows[i]["Diagnosis_CodeA"] = newoutDiagTable.Rows[i]["Diagnosis_Code"]; dtDialog.Rows[i]["Status_IdA"] = newoutDiagTable.Rows[i]["Status_Id"]; dtDialog.Rows[i]["Status_Id_OutA"] = newoutDiagTable.Rows[i]["Status_Id_Out"]; } else if (i <= 17)//10到18行填充右侧,超过则不处理 { dtDialog.Rows[i - 9]["Diagnosis_NameB"] = newoutDiagTable.Rows[i]["Diagnosis_Name"]; dtDialog.Rows[i - 9]["Diagnosis_CodeB"] = newoutDiagTable.Rows[i]["Diagnosis_Code"]; dtDialog.Rows[i - 9]["Status_IdB"] = newoutDiagTable.Rows[i]["Status_Id"]; dtDialog.Rows[i - 9]["Status_Id_OutB"] = newoutDiagTable.Rows[i]["Status_Id_Out"]; } } dts.Tables.Add(dtDialog); DataTable operationTable = m_IemMainPageEntity.IemOperInfo.Operation_Table.Clone(); operationTable.TableName = "operationTable"; DataTable dtOperationTable = m_IemMainPageEntity.IemOperInfo.Operation_Table; //界面只显示八行注原方法有问题xlb 2013-04-22 for (int i = 0; i < 8; i++) { DataRow dataRow = operationTable.NewRow(); operationTable.Rows.Add(dataRow); } if (dtOperationTable != null || dtOperationTable.Rows.Count > 0) { for (int i = 0; i < dtOperationTable.Rows.Count; i++) { if (i <= 7) { operationTable.Rows[i].ItemArray = dtOperationTable.Rows[i].ItemArray; } } } dts.Tables.Add(operationTable); return(dts); } catch (Exception ex) { throw ex; } }