/// <summary> /// 加载通用审核结果 /// </summary> /// <param name="_rcpIDs"></param> private bool comCheckResult(string _rcpIDs, int _startIndx) { DataTable tbl = new DataTable(); //加载审方 if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_COMCHK_BYRCPs, _rcpIDs), ref tbl)) { BLPublic.Dialogs.Error("加载审方结果失败:" + AppConst.db.Error); return(false); } int indx = 0; ExpTPNRecipe item = null; DataRow[] rows = null; for (int i = lvExpTPN.Items.Count - 1; i >= _startIndx; i--) { item = (ExpTPNRecipe)lvExpTPN.Items[i]; if (string.IsNullOrWhiteSpace(item.RecipeID) || string.IsNullOrWhiteSpace(item.BedNo)) { continue; } indx = 0; rows = tbl.Select("RecipeID='" + item.RecipeID + "'"); foreach (DataRow r in rows) { if (0 == indx) { item.IsOK = "否"; } else { item = new ExpTPNRecipe() { PatientCode = item.PatientCode, RecipeID = item.RecipeID, StartTime = item.StartTime }; lvExpTPN.Items.Insert(i + indx, item); } item.NoOKReason = string.Format("{0}({1} {2})超出正常值({3})范围{4}({5}%)", r["ItemName"].ToString(), r["ItemValue"].ToString(), r["Unit"].ToString(), r["NormalValue"].ToString(), r["DeviateValue"].ToString(), Math.Round(((double)r["DeviatePer"]) * 100, 2)); indx++; } } tbl.Clear(); return(true); }
/// <summary> /// 加载审方结果 /// </summary> /// <param name="_rcpIDs"></param> private bool monitorResult(string _rcpIDs, int _startIndx) { DataTable tbl = new DataTable(); //加载审方 if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_TPNMNT_RCPs, _rcpIDs), ref tbl)) { BLPublic.Dialogs.Error("加载审方结果失败:" + AppConst.db.Error); return(false); } int indx = 0; ExpTPNRecipe item = null; DataRow[] rows = null; for (int i = lvExpTPN.Items.Count - 1; i >= _startIndx; i--) { item = (ExpTPNRecipe)lvExpTPN.Items[i]; if (string.IsNullOrWhiteSpace(item.RecipeID) || string.IsNullOrWhiteSpace(item.BedNo)) { continue; } indx = 0; rows = tbl.Select("RecipeID='" + item.RecipeID + "'"); foreach (DataRow r in rows) { if (0 == indx) { item.IsOK = "否"; } else { item = new ExpTPNRecipe() { PatientCode = item.PatientCode, RecipeID = item.RecipeID, StartTime = item.StartTime }; lvExpTPN.Items.Insert(i + indx, item); } item.NoOKReason = r["ResultDesc"].ToString(); indx++; } } tbl.Clear(); return(true); }
private bool exportTPN2Excel(ExcelWorksheet _xslSht) { GridView gv = (GridView)lvExpTPN.View; //标题行 _xslSht.Cells[1, 1].Style.Font.Size = 20; _xslSht.Cells[1, 1].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center; _xslSht.Cells[1, 1].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center; _xslSht.Cells[1, 1].Value = rdoTPN.Content; _xslSht.Row(1).Height = 40; //标题行合并 _xslSht.Cells[1, 1, 1, gv.Columns.Count].Merge = true; //列头 for (int i = 0; i < gv.Columns.Count; i++) { _xslSht.Cells[2, i + 1].Value = gv.Columns[i].Header; _xslSht.Cells[2, i + 1].Style.Font.Bold = true; _xslSht.Cells[2, i + 1].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center; _xslSht.Cells[2, i + 1].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center; _xslSht.Column(i + 1).Width = gv.Columns[i].Width * 0.15f; } _xslSht.Column(16).Width = gv.Columns[15].Width * 0.3f; //内容 ExpTPNRecipe item = null; string prvRcpID = ""; int R = 2, num = 0; for (int i = 0; i < lvExpTPN.Items.Count; i++) { item = (ExpTPNRecipe)lvExpTPN.Items[i]; if (!prvRcpID.Equals(item.RecipeID)) { if ((2 <= num) && (3 <= R)) { _xslSht.Row(R).Height = 18 * num; } prvRcpID = item.RecipeID; R++; num = 1; _xslSht.Row(R).Height = 20; _xslSht.Row(R).CustomHeight = true; _xslSht.Cells[R, 1].Value = item.No; _xslSht.Cells[R, 2].Value = item.WardName; _xslSht.Cells[R, 3].Value = item.BedNo; _xslSht.Cells[R, 4].Value = item.PatientName; _xslSht.Cells[R, 5].Value = item.HospitalNo; _xslSht.Cells[R, 6].Value = item.Sex; _xslSht.Cells[R, 7].Value = item.Age; _xslSht.Cells[R, 8].Value = item.Weight; _xslSht.Cells[R, 9].Value = item.Height; _xslSht.Cells[R, 10].Value = item.BMI; _xslSht.Cells[R, 11].Value = item.InHospitalTime; _xslSht.Cells[R, 12].Value = item.Diagnose; _xslSht.Cells[R, 13].Value = item.TPNUseTime; _xslSht.Cells[R, 14].Value = item.Drugs; _xslSht.Cells[R, 15].Value = item.IsOK; _xslSht.Cells[R, 16].Value = item.NoOKReason; _xslSht.Cells[R, 14].Style.WrapText = true; _xslSht.Cells[R, 16].Style.WrapText = true; } else { num++; //if (!string.IsNullOrWhiteSpace(item.Drug)) // _xslSht.Cells[R, 14].Value += "\r\n" + item.Drug + " " + item.Dosage; if (!string.IsNullOrWhiteSpace(item.NoOKReason)) { _xslSht.Cells[R, 16].Value += "\r\n" + item.NoOKReason; } } } if (3 <= R) { if (2 <= num) { _xslSht.Row(R).Height = 18 * num; } //边框线 _xslSht.Cells[2, 1, R, 16].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin); _xslSht.Cells[3, 1, R, 16].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Top; _xslSht.Cells[3, 15, R, 15].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center; } return(true); }
private void miDel_Click(object sender, RoutedEventArgs e) { ListView lv = null; if (Visibility.Visible == lvExpIntervene.Visibility) { lv = lvExpIntervene; } else { lv = lvExpTPN; } if (null == lv.SelectedItem) { BLPublic.Dialogs.Alert("请选择要删除的医嘱"); return; } if (lvExpTPN == lv) { ExpTPNRecipe item = (ExpTPNRecipe)lvExpTPN.SelectedItem; lstPntCodes.Remove(item.PatientCode); string rcpID = item.RecipeID; int no = 0; //先删除后面的行 int i = lvExpTPN.SelectedIndex + 1; while (i < lvExpTPN.Items.Count) { if (((ExpTPNRecipe)lvExpTPN.Items[i]).RecipeID.Equals(rcpID)) { lvExpTPN.Items.RemoveAt(i); } else { break; } } //删除空白行 if (i < lvExpTPN.Items.Count && string.IsNullOrWhiteSpace(((ExpTPNRecipe)lvExpTPN.Items[i]).RecipeID)) { lvExpTPN.Items.RemoveAt(i); } //删除前面行 i = lvExpTPN.SelectedIndex; while (i >= 0) { item = (ExpTPNRecipe)lvExpTPN.Items[i]; if (item.RecipeID.Equals(rcpID)) { if (!string.IsNullOrWhiteSpace(item.No)) { no = Convert.ToInt32(item.No); } lvExpTPN.Items.RemoveAt(i); } else { break; } i--; } //重新生成序号 no = 1; for (i = 0; i < lvExpTPN.Items.Count; i++) { item = (ExpTPNRecipe)lvExpTPN.Items[i]; if (!string.IsNullOrWhiteSpace(item.RecipeID) && !string.IsNullOrWhiteSpace(item.BedNo)) { item.No = (no++).ToString(); } } lvExpTPN.Items.Refresh(); } else { lvExpIntervene.Items.RemoveAt(lvExpIntervene.SelectedIndex); } }
private bool addRecipe(PatientModel _pnt) { DataTable tbl = new DataTable(); if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_PNT_TPN, _pnt.PatientCode) + " ORDER BY StartTime", ref tbl)) { BLPublic.Dialogs.Error("加载患者医嘱失败:" + AppConst.db.Error); return(false); } int no = 1; foreach (object obj in lvExpTPN.Items) { if (!string.IsNullOrWhiteSpace(((ExpTPNRecipe)obj).RecipeID) && !string.IsNullOrWhiteSpace(((ExpTPNRecipe)obj).BedNo)) { no++; } } string rcpIDs = ""; int startIndx = lvExpTPN.Items.Count; BLPublic.BLDataReader dr = new BLPublic.BLDataReader(tbl.CreateDataReader()); while (dr.next()) { rcpIDs += ",'" + dr.getString("RecipeID") + "'"; lvExpTPN.Items.Add(new ExpTPNRecipe() { No = (no++).ToString(), RecipeID = dr.getString("RecipeID"), PatientCode = _pnt.PatientCode, WardName = dr.getString("DeptName"), BedNo = dr.getString("BedNo"), PatientName = dr.getString("PatientName"), HospitalNo = dr.getString("HospitalNo"), Age = dr.getString("Age") + getAgeUnit(dr.getString("AgeUnit")), Sex = ComClass.getZhSex(dr.getString("Sex")), InHospitalTime = dr.isNull("InHospitalDT") ? "" : dr.getDateTime("InHospitalDT").ToString("yyyy-M-d"), Weight = "-", Height = "-", Diagnose = _pnt.Diagnose, TPNUseTime = dr.getDateTime("StartTime").ToString("yyyy-MM-dd HH:mm:ss") + " ~ " + (dr.isNull("StopTime") ? "" : dr.getDateTime("StopTime").ToString("yyyy-MM-dd HH:mm:ss")), StartTime = dr.getDateTime("StartTime"), Drugs = "", IsOK = "是" }); } dr.close(); tbl.Clear(); if (string.IsNullOrWhiteSpace(rcpIDs)) { return(true); } //加载医嘱内容 if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_ORDERSPREP_BYRCPs, rcpIDs.Substring(1)), ref tbl)) { BLPublic.Dialogs.Error("加载医嘱内容失败:" + AppConst.db.Error); return(false); } ExpTPNRecipe item = null; DataRow[] rows = null; int i = 0; int orderType = 0; string mntRcpIDs = ""; string tpnChkRcpIDs = ""; for (i = lvExpTPN.Items.Count - 1; i >= startIndx; i--) { item = (ExpTPNRecipe)lvExpTPN.Items[i]; if (string.IsNullOrWhiteSpace(item.RecipeID)) { continue; } rows = tbl.Select("RecipeID='" + item.RecipeID + "'"); foreach (DataRow r in rows) { if ("498".Equals(r["UniPreparationID"].ToString())) //卡文 { orderType = 498; break; } else if (0x07 > orderType) { orderType |= tpnmonitor.TPNMonitor.getPrepSAFType(Convert.ToInt32(r["UniPreparationID"].ToString())); } else { break; } } if (0 < rows.Length) { if (498 == orderType) { item.Drugs = "卡文"; tpnChkRcpIDs += ",'" + item.RecipeID + "'"; } else if (0x07 == orderType) { item.Drugs = "三合一"; mntRcpIDs += ",'" + item.RecipeID + "'"; } else if (0 < orderType) { item.Drugs = "二合一"; tpnChkRcpIDs += ",'" + item.RecipeID + "'"; } } } tbl.Clear(); if (!string.IsNullOrWhiteSpace(mntRcpIDs)) { monitorResult(mntRcpIDs.Substring(1), startIndx); } if (!string.IsNullOrWhiteSpace(tpnChkRcpIDs)) { comCheckResult(tpnChkRcpIDs.Substring(1), startIndx); } return(true); }