/// <summary> /// 显示列表 /// </summary> private void ShowDate() { try { flgView.Clear(); SetTable(); string date = dtpDate.Value.ToString("yyyy-MM-dd"); //显示一个病区的病人 string PatintInfoSql = @"select a.id,patient_name,case when gender_code=0 then '男' else '女' end gender_code,birthday,a.pid,sick_doctor_id," + @"sick_doctor_name,sick_area_id,sick_area_name,section_id,section_name,a.in_time,a.state,a.sick_bed_id,a.SICK_BED_NO from t_in_patient a " + @"inner join t_inhospital_action b on a.id=b.patient_id inner join t_sickbedinfo c on a.sick_bed_id=c.bed_id where a.SICK_AREA_ID=" + App.UserAccount.CurrentSelectRole.Sickarea_Id + " and b.action_state=4 and a.SICK_BED_NO is not null and b.id in (select max(id) from t_inhospital_action group by patient_id) order by sick_bed_no "; DataSet dsPatint = App.GetDataSet(PatintInfoSql); //查询所有的血糖监测单 //string sql = "select * from v_periphery_bg_record where 日期='" + date + "'"; string sql = "select pat.sick_bed_no as 床号,pat.patient_name as 病人姓名,ITEM_VALUE as 血糖值," + " to_char(tpg.record_time,'yyyy-mm-dd') as 日期,to_char(tpg.record_time,'HH24:mi') as 时间," + "tpg.patient_id as 住院号,pat.section_name as 科别,pat.sick_area_name as 病区,pat.in_time as 入院时间 " + " from T_PERIPHERY_BG_RECORD tpg left join T_IN_PATIENT pat on tpg.patient_id=pat.id " + " where pat.sick_bed_no is not null and tpg.record_time is not null and to_char(tpg.record_time,'yyyy-mm-dd')='" + date + "'"; DataSet ds = App.GetDataSet(sql); if (dsPatint != null) { /* * 显示所有的本病区的病人信息 */ for (int i = 0; i < dsPatint.Tables[0].Rows.Count; i++) { flgView.Rows.Add(); Class_ucBlood_SugarRecord temp = new Class_ucBlood_SugarRecord(); temp.Bed = dsPatint.Tables[0].Rows[i]["SICK_BED_NO"].ToString(); temp.Pid_name = dsPatint.Tables[0].Rows[i]["patient_name"].ToString(); temp.Pid = dsPatint.Tables[0].Rows[i]["pid"].ToString(); temp.Section_name = dsPatint.Tables[0].Rows[i]["section_name"].ToString(); temp.Sickarea_name = dsPatint.Tables[0].Rows[i]["sick_area_name"].ToString(); temp.In_time = dsPatint.Tables[0].Rows[i]["in_time"].ToString(); temp.Patient_id = dsPatint.Tables[0].Rows[i]["id"].ToString(); flgView[1 + i, 0] = temp.Bed; flgView[1 + i, 1] = temp.Pid_name; flgView[1 + i, 11] = temp.Pid; flgView[1 + i, 12] = temp.Section_name; flgView[1 + i, 13] = temp.Sickarea_name; flgView[1 + i, 14] = temp.In_time; flgView[1 + i, 17] = temp.Patient_id; /* * 根据条件给相应的病人绑定数据 */ if (ds != null) { DataRow[] rows = ds.Tables[0].Select("住院号='" + temp.Patient_id + "'"); if (rows.Length > 0) { for (int k = 0; k < rows.Length; k++) { if (rows[k]["时间"].ToString() == "07:00") { temp.Values_7 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "09:30") { temp.Values_9 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "11:00") { temp.Values_11 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "14:00") { temp.Values_14 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "17:00") { temp.Values_17 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "20:00") { temp.Values_20 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "22:00") { temp.Values_22 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "00:00") { temp.Values_00 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "03:00") { temp.Values_03 = rows[k]["血糖值"].ToString(); } if (rows[k]["日期"].ToString() != "") { temp.Date = rows[k]["日期"].ToString(); } } flgView[1 + i, 2] = isExNot(temp.Values_7); flgView[1 + i, 3] = isExNot(temp.Values_9); flgView[1 + i, 4] = isExNot(temp.Values_11); flgView[1 + i, 5] = isExNot(temp.Values_14); flgView[1 + i, 6] = isExNot(temp.Values_17); flgView[1 + i, 7] = isExNot(temp.Values_20); flgView[1 + i, 8] = isExNot(temp.Values_22); flgView[1 + i, 9] = isExNot(temp.Values_00); flgView[1 + i, 10] = isExNot(temp.Values_03); flgView[1 + i, 11] = isExNot(temp.Pid); flgView[1 + i, 12] = isExNot(temp.Section_name); flgView[1 + i, 13] = isExNot(temp.Sickarea_name); flgView[1 + i, 14] = isExNot(temp.In_time); flgView[1 + i, 15] = isExNot(temp.Date); flgView[1 + i, 17] = temp.Patient_id; } } } //单元格合并和设置 CellUnit(); for (int i = 1; i < flgView.Rows.Count; i++) { /* * 打印图标 */ CellRange rg1 = flgView.GetCellRange(i, 16); rg1.Image = imageList1.Images[0]; /* * 住院号和病人姓名变成蓝色 */ CellRange rg = flgView.GetCellRange(i, 0); rg.StyleNew.ForeColor = Color.Blue; CellRange rg2 = flgView.GetCellRange(i, 1); rg2.StyleNew.ForeColor = Color.Blue; } //单元格线条加粗 flgView.Cols[0].StyleNew.Border.Color = Color.Black; flgView.Cols[1].StyleNew.Border.Color = Color.Black; flgView.Cols[2].StyleNew.Border.Color = Color.Black; flgView.Cols[3].StyleNew.Border.Color = Color.Black; flgView.Cols[4].StyleNew.Border.Color = Color.Black; flgView.Cols[5].StyleNew.Border.Color = Color.Black; flgView.Cols[6].StyleNew.Border.Color = Color.Black; flgView.Cols[7].StyleNew.Border.Color = Color.Black; flgView.Cols[8].StyleNew.Border.Color = Color.Black; flgView.Cols[9].StyleNew.Border.Color = Color.Black; flgView.Cols[10].StyleNew.Border.Color = Color.Black; flgView.Cols[11].StyleNew.Border.Color = Color.Black; flgView.Cols[12].StyleNew.Border.Color = Color.Black; flgView.Cols[13].StyleNew.Border.Color = Color.Black; flgView.Cols[14].StyleNew.Border.Color = Color.Black; flgView.Cols[15].StyleNew.Border.Color = Color.Black; flgView.Cols[16].StyleNew.Border.Color = Color.Black; flgView.Cols[17].StyleNew.Border.Color = Color.Black; } } catch { } }
public static DataSet GETDaes(string PID) { ArrayList lists = new ArrayList(); lists.Clear(); DataSet dsBlood = Class_Blood.GetDate(PID); if (dsBlood != null) { if (dsBlood.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsBlood.Tables[0].Rows.Count; i++) { string date = dsBlood.Tables[0].Rows[i]["日期"].ToString(); //DataRow[] rows = dst.Tables[0].Select("日期='" + date + "'"); DataSet dst = Class_Blood.getBlood_resful(PID, date); if (dst.Tables[0].Rows.Count > 0) { Class_ucBlood_SugarRecord temp = new Class_ucBlood_SugarRecord(); temp.Bed = dst.Tables[0].Rows[0]["床号"].ToString(); temp.Pid_name = dst.Tables[0].Rows[0]["病人姓名"].ToString(); for (int k = 0; k < dst.Tables[0].Rows.Count; k++) { temp.Bed = dst.Tables[0].Rows[k]["床号"].ToString(); temp.Pid_name = dst.Tables[0].Rows[k]["病人姓名"].ToString(); if (dst.Tables[0].Rows[k]["时间"].ToString() == "07:00") { temp.Values_7 = dst.Tables[0].Rows[k]["血糖值"].ToString(); } else if (dst.Tables[0].Rows[k]["时间"].ToString() == "09:30") { temp.Values_9 = dst.Tables[0].Rows[k]["血糖值"].ToString(); } else if (dst.Tables[0].Rows[k]["时间"].ToString() == "11:00") { temp.Values_11 = dst.Tables[0].Rows[k]["血糖值"].ToString(); } else if (dst.Tables[0].Rows[k]["时间"].ToString() == "14:00") { temp.Values_14 = dst.Tables[0].Rows[k]["血糖值"].ToString(); } else if (dst.Tables[0].Rows[k]["时间"].ToString() == "17:00") { temp.Values_17 = dst.Tables[0].Rows[k]["血糖值"].ToString(); } else if (dst.Tables[0].Rows[k]["时间"].ToString() == "20:00") { temp.Values_20 = dst.Tables[0].Rows[k]["血糖值"].ToString(); } else if (dst.Tables[0].Rows[k]["时间"].ToString() == "22:00") { temp.Values_22 = dst.Tables[0].Rows[k]["血糖值"].ToString(); } else if (dst.Tables[0].Rows[k]["时间"].ToString() == "00:00") { temp.Values_00 = dst.Tables[0].Rows[k]["血糖值"].ToString(); } else if (dst.Tables[0].Rows[k]["时间"].ToString() == "03:00") { temp.Values_03 = dst.Tables[0].Rows[k]["血糖值"].ToString(); } if (dst.Tables[0].Rows[k]["日期"].ToString() != "") { temp.Date = dst.Tables[0].Rows[k]["日期"].ToString(); } } lists.Add(temp); } } } } Class_ucBlood_SugarRecord[] Bgrecode_objs = new Class_ucBlood_SugarRecord[lists.Count]; for (int i = 0; i < lists.Count; i++) { Bgrecode_objs[i] = new Class_ucBlood_SugarRecord(); Bgrecode_objs[i] = (Class_ucBlood_SugarRecord)lists[i]; } return(App.ObjectArrayToDataSet(Bgrecode_objs)); }
//显示表格数据 public void ShowGrid() { //Bgrecode.Clear(); //SetTable(); #region //string sql = "select * from v_periphery_bg_record where PID='"+Pid+"' order by 日期 asc"; //DataSet ds = App.GetDataSet(sql); //if (ds != null) //{ // DataTable dt = ds.Tables[0]; // if (dt != null) // { // for (int i = 0; i < dt.Rows.Count; i++) // { // Class_Bgrecode temp = new Class_Bgrecode(); // temp.Date = Convert.ToDateTime(dt.Rows[i]["日期"]).ToString("yyyy-MM-dd HH:mm"); // temp.Limosis = dt.Rows[i]["空腹"].ToString(); // temp.Limosis_tosign = dt.Rows[i]["空腹签名"].ToString(); // temp.Breakfast = dt.Rows[i]["早餐后2小时"].ToString(); // temp.Breakfast_tosign = dt.Rows[i]["早餐后2小时签名"].ToString(); // temp.Lunch = dt.Rows[i]["午餐后2小时"].ToString(); // temp.Lunch_tosign = dt.Rows[i]["午餐后2小时签名"].ToString(); // temp.Evening_meal = dt.Rows[i]["晚餐后2小时"].ToString(); // temp.Evening_meal_tosign = dt.Rows[i]["晚餐后2小时签名"].ToString(); // temp.Remarks = dt.Rows[i]["备注"].ToString(); // temp.Remarks_tosign = dt.Rows[i]["备注签名"].ToString(); // temp.Limosis = isExNot(temp.Limosis); // temp.Limosis_tosign = isExNot(temp.Limosis_tosign); // temp.Breakfast = isExNot(temp.Breakfast); // temp.Breakfast_tosign = isExNot(temp.Breakfast_tosign); // temp.Lunch = isExNot(temp.Lunch); // temp.Lunch_tosign = isExNot(temp.Lunch_tosign); // temp.Evening_meal = isExNot(temp.Evening_meal); // temp.Evening_meal_tosign = isExNot(temp.Evening_meal_tosign); // temp.Remarks = isExNot(temp.Remarks); // temp.Remarks_tosign = isExNot(temp.Remarks_tosign); // Bgrecode.Add(temp); // } // //日期 // string TempDate = null; // Class_Bgrecode[] Cbgrecode = new Class_Bgrecode[Bgrecode.Count]; // for (int j = 0; j < Bgrecode.Count; j++) // { // Cbgrecode[j] = new Class_Bgrecode(); // Cbgrecode[j] = (Class_Bgrecode)Bgrecode[j]; // TempDate = Cbgrecode[j].Date; // } // try // { // if (Cbgrecode.Length!=0) // { // App.ArrayToGrid(flgView, Cbgrecode, cols, 2); // } // } // catch // { // } // CellUnit(); // flgView.Cols[0].TextAlign =TextAlignEnum.CenterCenter; // flgView.Cols[1].TextAlign = TextAlignEnum.CenterCenter; // flgView.Cols[2].TextAlign = TextAlignEnum.CenterCenter; // flgView.Cols[3].TextAlign = TextAlignEnum.CenterCenter; // flgView.Cols[4].TextAlign = TextAlignEnum.CenterCenter; // flgView.Cols[5].TextAlign = TextAlignEnum.CenterCenter; // flgView.Cols[6].TextAlign = TextAlignEnum.CenterCenter; // flgView.Cols[7].TextAlign = TextAlignEnum.CenterCenter; // flgView.Cols[8].TextAlign = TextAlignEnum.CenterCenter; // flgView.Cols[9].TextAlign = TextAlignEnum.CenterCenter; // flgView.Cols[10].TextAlign = TextAlignEnum.CenterCenter; // //flgView.Cols[11].TextAlign = TextAlignEnum.CenterCenter; // } //} #endregion try { flgView.Clear(); SetTable(); //string date = dtpDate.Value.ToString("yyyy-MM-dd"); //显示一个病区的病人 string PatintInfoSql = "select distinct to_char(record_time,'yyyy-mm-dd') as 日期,patient_id as 住院号 from T_PERIPHERY_BG_RECORD where patient_id=" + Pid_ids + " order by to_char(record_time,'yyyy-mm-dd')"; DataSet dsPatint = App.GetDataSet(PatintInfoSql); //查询所有的血糖监测单 //string sql = "select * from v_periphery_bg_record where 日期='" + date + "'"; and to_char(tpg.record_time,'yyyy-mm-dd')='" + date + "' string sql = "select pat.sick_bed_no as 床号,pat.patient_name as 病人姓名,ITEM_VALUE as 血糖值," + " to_char(tpg.record_time,'yyyy-mm-dd') as 日期,to_char(tpg.record_time,'HH24:mi') as 时间," + "tpg.patient_id as 住院号,pat.section_name as 科别,pat.sick_area_name as 病区,pat.in_time as 入院时间 " + " from T_PERIPHERY_BG_RECORD tpg left join T_IN_PATIENT pat on tpg.patient_id=pat.id " + " where pat.sick_bed_no is not null and tpg.record_time is not null"; DataSet ds = App.GetDataSet(sql); if (dsPatint != null) { /* * 显示所有的本病区的病人信息 */ for (int i = 0; i < dsPatint.Tables[0].Rows.Count; i++) { flgView.Rows.Add(); Class_ucBlood_SugarRecord temp = new Class_ucBlood_SugarRecord(); temp.Date = dsPatint.Tables[0].Rows[i]["日期"].ToString(); /* * 根据条件给相应的病人绑定数据 */ if (ds != null) { DataRow[] rows = ds.Tables[0].Select("住院号='" + Pid_ids + "' and 日期='" + temp.Date + "'"); if (rows.Length > 0) { for (int k = 0; k < rows.Length; k++) { if (rows[k]["时间"].ToString() == "07:00") { temp.Values_7 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "09:30") { temp.Values_9 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "11:00") { temp.Values_11 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "14:00") { temp.Values_14 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "17:00") { temp.Values_17 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "20:00") { temp.Values_20 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "22:00") { temp.Values_22 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "00:00") { temp.Values_00 = rows[k]["血糖值"].ToString(); } else if (rows[k]["时间"].ToString() == "03:00") { temp.Values_03 = rows[k]["血糖值"].ToString(); } if (rows[k]["日期"].ToString() != "") { temp.Date = rows[k]["日期"].ToString(); } } flgView[1 + i, 0] = temp.Date; flgView[1 + i, 1] = isExNot(temp.Values_7); flgView[1 + i, 2] = isExNot(temp.Values_9); flgView[1 + i, 3] = isExNot(temp.Values_11); flgView[1 + i, 4] = isExNot(temp.Values_14); flgView[1 + i, 5] = isExNot(temp.Values_17); flgView[1 + i, 6] = isExNot(temp.Values_20); flgView[1 + i, 7] = isExNot(temp.Values_22); flgView[1 + i, 8] = isExNot(temp.Values_00); flgView[1 + i, 9] = isExNot(temp.Values_03); //flgView[1 + i, 10] = isExNot(temp.Pid); //flgView[1 + i, 11] = isExNot(temp.Section_name); //flgView[1 + i, 12] = isExNot(temp.Sickarea_name); //flgView[1 + i, 13] = isExNot(temp.In_time); ////flgView[1 + i, 15] = isExNot(temp.Date); //flgView[1 + i, 14] = temp.Patient_id; } //Bgrecode.Add(temp); } } //单元格合并和设置 CellUnit(); //for (int i = 1; i < flgView.Rows.Count; i++) //{ // /* // * 打印图标 // */ // CellRange rg1 = flgView.GetCellRange(i, 16); // rg1.Image = imageList1.Images[0]; // /* // * 住院号和病人姓名变成蓝色 // */ // CellRange rg = flgView.GetCellRange(i, 0); // rg.StyleNew.ForeColor = Color.Blue; // CellRange rg2 = flgView.GetCellRange(i, 1); // rg2.StyleNew.ForeColor = Color.Blue; //} //单元格线条加粗 flgView.Cols[0].StyleNew.Border.Color = Color.Black; flgView.Cols[1].StyleNew.Border.Color = Color.Black; flgView.Cols[2].StyleNew.Border.Color = Color.Black; flgView.Cols[3].StyleNew.Border.Color = Color.Black; flgView.Cols[4].StyleNew.Border.Color = Color.Black; flgView.Cols[5].StyleNew.Border.Color = Color.Black; flgView.Cols[6].StyleNew.Border.Color = Color.Black; flgView.Cols[7].StyleNew.Border.Color = Color.Black; flgView.Cols[8].StyleNew.Border.Color = Color.Black; flgView.Cols[9].StyleNew.Border.Color = Color.Black; //flgView.Cols[10].StyleNew.Border.Color = Color.Black; //flgView.Cols[11].StyleNew.Border.Color = Color.Black; //flgView.Cols[12].StyleNew.Border.Color = Color.Black; //flgView.Cols[13].StyleNew.Border.Color = Color.Black; //flgView.Cols[14].StyleNew.Border.Color = Color.Black; } } catch { } }