public static string getObjectStr(int _interveneID, string _sptChr = ",") { string rt = ""; DataTable tbl = new DataTable(); if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_INTERVENE_OBJ, _interveneID), ref tbl)) { return(""); } BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(tbl.CreateDataReader()); while (bldr.next()) { if (!string.IsNullOrWhiteSpace(rt)) { rt += _sptChr; } rt += bldr.getDateTime("ValueTime").ToString("[yy.MM.dd] ") + bldr.getString("ObjectName"); if (!string.IsNullOrWhiteSpace(bldr.getString("ObjectValue"))) { rt += " " + bldr.getString("ObjectValue"); } } bldr.close(); tbl.Clear(); return(rt); }
/// <summary> /// 加载患者评估记录 /// </summary> /// <param name="_pntCode"></param> private void listRecord(string _patientCode) { lvRecord.Items.Clear(); IDataReader dr = null; if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_ANALYSIS_RCD, _patientCode), ref dr)) { BLPublic.Dialogs.Error("加载评价记录失败:" + AppConst.db.Error); return; } BLPublic.BLDataReader blDR = new BLPublic.BLDataReader(dr); while (blDR.next()) { lvRecord.Items.Add(new AnalysisModel() { RecordID = blDR.getInt("RecordID"), TotalScore = blDR.getString("TotalScore"), RecordTime = blDR.getDateTime("RecordTime").ToString("yyyy-MM-dd HH:mm"), Recorder = blDR.getString("Recorder") }); } blDR.close(); if (0 < lvRecord.Items.Count) { lvRecord.SelectedIndex = lvRecord.Items.Count - 1; } }
private void grdOrders_SelectionChanged(object sender, SelectionChangedEventArgs e) { this.clear(); if (null == grdOrders.SelectedItem) { return; } DataRowView drv = (DataRowView)grdOrders.SelectedItem; string rcpID = drv.Row["RecipeID"].ToString(); string pCode = drv.Row["PatientCode"].ToString(); IDataReader dr = null; if (!this.db.GetRecordSet(string.Format(SQL.SEL_PNTINFO, pCode), ref dr)) { BLPublic.Dialogs.Error("加载患者信息失败:" + this.db.Error); return; } PatientInfo patient = null; BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr); if (bldr.next()) { patient = new PatientInfo { PatientCode = pCode, WardName = bldr.getString("DeptName"), BedNo = bldr.getString("BedNo"), HospitalNo = bldr.getString("HospitalNo"), PatientName = bldr.getString("PatientName"), Age = BLPublic.Utils.getAge(bldr.getDateTime("Birthday")), Sex = "f".Equals(bldr.getString("Sex")) ? "女" : "男" }; } bldr.close(); pnlPatient.DataContext = patient; pnlOrders.DataContext = drv; DataTable tblDrugs = new DataTable(); if (!this.db.GetRecordSet(string.Format(SQL.SEL_ORDERSDETAIL, rcpID), ref tblDrugs)) { BLPublic.Dialogs.Error("加载医嘱内容信息失败:" + this.db.Error); return; } lvOrdersDrug.ItemsSource = tblDrugs.DefaultView; //RecipeTPNCheck.loadTPNCheck(lbChkResult, this.db, rcpID, txtChkResult); this.tpnView.showRecipeTPN(rcpID); }
/// <summary> /// 加载监护 /// </summary> private void loadCustody() { string sql = ""; if (true == cbAllPatient.IsChecked) { sql = string.Format(SQL.SEL_CUSTODY_BYDATE, ((DateTime)dpSDate.SelectedDate).ToString("yyyy-MM-dd"), ((DateTime)dpEDate.SelectedDate).AddDays(1).ToString("yyyy-MM-dd")); } else if (null == this.patient) { return; } else { sql = string.Format(SQL.SEL_CUSTODY_BYPNT2, this.patient.PatientCode); } DataTable tbl = null; if (AppConst.db.GetRecordSet(sql, ref tbl)) { BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(tbl.CreateDataReader()); string content = ""; while (bldr.next()) { content = WinCustodyEdit.getObjectStr(bldr.getInt("CustodyID")) + ". " + bldr.getString("CustodyDesc"); if (!bldr.isNull("FinishTime")) { content += ". (已结束)"; } this.tblOpRecord.Rows.Add(new object[] { "custody", bldr.getInt("CustodyID"), bldr.getString("DeptName"), bldr.getString("BedNo"), bldr.getString("PatientName"), bldr.getDateTime("CustodyTime"), content, ComClass.getEmpName(bldr.getString("Custodyer")) }); } bldr.close(); tbl.Clear(); } else { BLPublic.Dialogs.Error("加载监护失败:" + AppConst.db.Error); } }
/// <summary> /// 加载药师日记 /// </summary> private void loadPMNote() { IDataReader dr = null; if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_PM_NOTE, this.patient.PatientCode), ref dr)) { BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr); while (bldr.next()) { this.tblOpRecord.Rows.Add(new object[] { "note", bldr.getInt("NoteID"), bldr.getDateTime("NoteTime"), bldr.getString("NoteContent"), ComClass.getEmpName(bldr.getString("Noter")) }); } dr.Close(); } else { BLPublic.Dialogs.Error("加载笔记记录失败:" + AppConst.db.Error); } }
/// <summary> /// 加载评估结果 /// </summary> private void loadAnalysis() { IDataReader dr = null; if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_ANALYSIS_RCD, this.patient.PatientCode), ref dr)) { BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr); while (bldr.next()) { this.tblOpRecord.Rows.Add(new object[] { "analysis", bldr.getInt("RecordID"), bldr.getDateTime("RecordTime"), "总分: " + bldr.getString("TotalScore"), bldr.getString("Recorder") }); } dr.Close(); } else { BLPublic.Dialogs.Error("加载评估记录失败:" + AppConst.db.Error); } }
/// <summary> /// 加载干预记录 /// </summary> private void loadIntervene() { DataTable tbl = null; if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_INTERVENE_BYPNT, this.patient.PatientCode), ref tbl)) { BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(tbl.CreateDataReader()); while (bldr.next()) { addIntervene(bldr.getInt("InterveneID"), WinInterveneEdit.getObjectStr(bldr.getInt("InterveneID")), bldr.getString("IntervenePlan"), bldr.getDateTime("InterveneTime"), bldr.getString("Intervener")); } bldr.close(); tbl.Clear(); } else { BLPublic.Dialogs.Error("加载干预记录失败:" + AppConst.db.Error); } }
/// <summary> /// 加载监护记录 /// </summary> private void loadCustody() { DataTable tbl = null; if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_CUSTODY_BYPNT, this.patient.PatientCode), ref tbl)) { BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(tbl.CreateDataReader()); while (bldr.next()) { addCustody(bldr.getInt("CustodyID"), WinCustodyEdit.getObjectStr(bldr.getInt("CustodyID"), "\r\n"), bldr.getString("CustodyDesc"), bldr.getDateTime("CustodyTime"), bldr.getString("Custodyer")); } bldr.close(); tbl.Clear(); } else { BLPublic.Dialogs.Error("加载监护记录失败:" + AppConst.db.Error); } }
/// <summary> /// 加载干预 /// </summary> private void loadIntervene() { string sql = ""; if (true == cbAllPatient.IsChecked) { sql = string.Format(SQL.SEL_INTERVENE_BYDATE, ((DateTime)dpSDate.SelectedDate).ToString("yyyy-MM-dd"), ((DateTime)dpEDate.SelectedDate).AddDays(1).ToString("yyyy-MM-dd")); } else if (null == this.patient) { return; } else { sql = string.Format(SQL.SEL_INTERVENE_BYPNT2, this.patient.PatientCode); } IDataReader dr = null; if (AppConst.db.GetRecordSet(sql, ref dr, true)) { BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr); string content = ""; while (bldr.next()) { content = WinInterveneEdit.getObjectStr(bldr.getInt("InterveneID")) + ". " + bldr.getString("IntervenePlan"); this.tblOpRecord.Rows.Add(new object[] { "intervene", bldr.getInt("InterveneID"), bldr.getString("DeptName"), bldr.getString("BedNo"), bldr.getString("PatientName"), bldr.getDateTime("InterveneTime"), content, ComClass.getEmpName(bldr.getString("Intervener")) }); } dr.Close(); } else { BLPublic.Dialogs.Error("加载干预失败:" + AppConst.db.Error); } }
private void loadCustody() { DataTable tbl = new DataTable(); if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_INTERVENE_BYID, this.EditID), ref tbl)) { BLPublic.Dialogs.Error("加载干预失败:" + AppConst.db.Error); return; } txtIntervener.Text = ""; if (0 < tbl.Rows.Count) { txtInterveneDesc.Text = tbl.Rows[0]["IntervenePlan"].ToString(); txtIntervener.Text = tbl.Rows[0]["Intervener"].ToString(); } tbl.Clear(); if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_INTERVENE_OBJ, this.EditID), ref tbl)) { BLPublic.Dialogs.Error("加载干预对象失败:" + AppConst.db.Error); return; } BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(tbl.CreateDataReader()); while (bldr.next()) { setObject(bldr.getString("ObjectType"), bldr.getString("ObjectCode"), bldr.getString("ObjectName"), bldr.getString("ObjectValue"), bldr.getDateTime("ValueTime")); } bldr.close(); tbl.Clear(); if (!string.IsNullOrWhiteSpace(txtIntervener.Text)) { txtIntervener.Text = ComClass.getEmpName(AppConst.db, txtIntervener.Text); } }
private PatientModel getPatientInfo() { if (string.IsNullOrWhiteSpace(this.patientCode)) { return(null); } PatientModel pnt = null; IDataReader dr = null; //体格检查 if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_PNTINFO, this.patientCode), ref dr)) { BLPublic.BLDataReader blDR = new BLPublic.BLDataReader(dr); if (blDR.next()) { string ageStr = ""; if (!blDR.isNull("Birthday")) { ageStr = BLPublic.Utils.getAgeStr(blDR.getDateTime("Birthday")); } pnt = new PatientModel() { WardName = blDR.getString("DeptName"), BedNo = blDR.getString("BedNo"), HospitalNo = blDR.getString("HospitalNo"), PatientName = blDR.getString("PatientName"), Age = ageStr, Sex = "f".Equals(blDR.getString("Sex")) ? "女" : "男" }; } blDR.close(); } return(pnt); }
/// <summary> /// 加载药师日记 /// </summary> private void loadPMNote() { string sql = ""; if (true == cbAllPatient.IsChecked) { sql = string.Format(SQL.SEL_PM_NOTE_WPNT_BYDATE, ((DateTime)dpSDate.SelectedDate).ToString("yyyy-MM-dd"), ((DateTime)dpEDate.SelectedDate).AddDays(1).ToString("yyyy-MM-dd")); } else if (null == this.patient) { return; } else { sql = string.Format(SQL.SEL_PM_NOTE_WPNT_BYPNT, this.patient.PatientCode); } IDataReader dr = null; if (AppConst.db.GetRecordSet(sql, ref dr, true)) { BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr); while (bldr.next()) { this.tblOpRecord.Rows.Add(new object[] { "note", bldr.getInt("NoteID"), bldr.getString("DeptName"), bldr.getString("BedNo"), bldr.getString("PatientName"), bldr.getDateTime("NoteTime"), bldr.getString("NoteContent"), ComClass.getEmpName(bldr.getString("Noter")) }); } dr.Close(); } else { BLPublic.Dialogs.Error("加载药师笔记失败:" + AppConst.db.Error); } }
public static void loadTPNCheck(ListBox _lbChkResult, BLPublic.DBOperate _db, string _recipeID, TextBlock _txtResult = null) { if ((null == _lbChkResult) || string.IsNullOrWhiteSpace(_recipeID)) { return; } _lbChkResult.Items.Clear(); if (null != _txtResult) { _txtResult.Text = ""; } if (null == tblMntSrc) { tblMntSrc = new DataTable(); } else { tblMntSrc.Clear(); } if (!_db.GetRecordSet(string.Format(SQL.SEL_ORD_TPNMNT, _recipeID), ref tblMntSrc)) { if (null != _txtResult) { _txtResult.Text = "加载错误," + _db.Error; } } IDataReader dr = null; //显示TPN审方结果 if (_db.GetRecordSet(string.Format(SQL.SEL_TPNMNT, _recipeID), ref dr)) { BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr); while (bldr.next()) { _lbChkResult.Items.Add(new MonitorResult { ResultID = bldr.getInt("TPNCheckResultID"), Title = bldr.getString("ResultType"), DrugName = getMonitorItems(bldr.getInt("SourceID")), ResultDesc = bldr.getString("ResultDesc"), CheckLevel = bldr.getInt("ResultLevel"), ReferenName = bldr.getString("ReferenceName"), CheckTime = bldr.getDateTime("CheckDT").ToString("yyyy-M-d h:mm:ss") }); } bldr.close(); } else { if (null != _txtResult) { _txtResult.Text += "加载TPN审方失败:" + _db.Error; } else { BLPublic.Dialogs.Error("加载TPN审方失败:" + _db.Error); } } if (_db.GetRecordSet(string.Format(SQL.SEL_CUSTOM_CHK_BYRCP, _recipeID), ref dr)) { BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr); while (bldr.next()) { _lbChkResult.Items.Add(new MonitorResult { ResultID = bldr.getInt("CustomCheckResultID"), IsCustom = true, Title = "自定义", DrugName = "", ResultDesc = bldr.getString("ResultDesc"), CheckLevel = bldr.getInt("ResultLevel"), ReferenName = "", CheckTime = bldr.getDateTime("CheckDT").ToString("yyyy-M-d h:mm:ss") }); } dr.Close(); } else { if (null != _txtResult) { _txtResult.Text += "加载自定义审方失败:" + _db.Error; } else { BLPublic.Dialogs.Error("加载自定义审方失败:" + _db.Error); } } if (null != _txtResult) { if (string.IsNullOrWhiteSpace(_txtResult.Text)) { if (0 == _lbChkResult.Items.Count) { _txtResult.Text = "通过"; _txtResult.Foreground = new SolidColorBrush(Colors.Green); } } else { _txtResult.Foreground = new SolidColorBrush(Colors.Red); } } }
private void btnStat_Click(object sender, RoutedEventArgs e) { this.tblST.Clear(); lvStat.Items.Refresh(); string d1 = dpStart.SelectedDate.Value.ToString("yyyy-MM-dd"); string d2 = dpEnd.SelectedDate.Value.ToString("yyyy-MM-dd"); string sql = string.Format(SQL.SEL_CUSTODY_ST, d1, d2); sql += " UNION ALL "; sql += string.Format(SQL.SEL_INTERVENE_ST, d1, d2); sql += " UNION ALL "; sql += string.Format(SQL.SEL_PM_NOTE_ST, d1, d2); IDataReader idr = null; if (!AppConst.db.GetRecordSet(sql, ref idr)) { BLPublic.Dialogs.Error("加载监护失败:" + AppConst.db.Error); return; } BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(idr); string date = ""; DataRow nrow = null; while (bldr.next()) { date = getSTDDate(bldr.getDateTime("Time")); nrow = this.tblST.Rows.Find(new object[] { date, bldr.getString("EmpCode") }); if (null == nrow) { nrow = this.tblST.NewRow(); nrow["STDate"] = date; nrow["EmpCode"] = bldr.getString("EmpCode"); if (this.dicEmp.ContainsKey(bldr.getString("EmpCode"))) { nrow["EmpName"] = this.dicEmp[bldr.getString("EmpCode")]; } else { nrow["EmpName"] = bldr.getString("EmpCode"); } nrow["InterveneNum"] = 0; nrow["CustodyNum"] = 0; nrow["NoteNum"] = 0; this.tblST.Rows.Add(nrow); } if ("intervene".Equals(bldr.getString("Type"))) { nrow["InterveneNum"] = Convert.ToInt32(nrow["InterveneNum"].ToString()) + 1; } else if ("custody".Equals(bldr.getString("Type"))) { nrow["CustodyNum"] = Convert.ToInt32(nrow["CustodyNum"].ToString()) + 1; } else if ("note".Equals(bldr.getString("Type"))) { nrow["NoteNum"] = Convert.ToInt32(nrow["NoteNum"].ToString()) + 1; } } bldr.close(); this.tblST.DefaultView.Sort = "STDate"; lvStat.Items.Refresh(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { PatientModel pnt = getPatientInfo(); if (null == pnt) { return; } if (0 < this.editID) { IDataReader dr = null; BLPublic.BLDataReader blDR = null; if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_RCD, this.editID), ref dr)) { blDR = new BLPublic.BLDataReader(dr); if (blDR.next()) { txtRecorder.Text = blDR.getString("EmployeeCode"); txtRecordTime.Text = blDR.getDateTime("RecordTime").ToString("yyyy-M-d H:m"); } blDR.close(); } if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_RCDITEMS, this.editID), ref dr)) { blDR = new BLPublic.BLDataReader(dr); string itemCode = ""; while (blDR.next()) { itemCode = blDR.getString("DataItemCode").ToLower(); if ("patient.age".Equals(itemCode)) { pnt.Age = blDR.getString("ItemValue"); } else if ("patient.height".Equals(itemCode)) { pnt.Height = blDR.getString("ItemValue"); } else if ("patient.weight".Equals(itemCode)) { pnt.Weight = blDR.getString("ItemValue"); } else if ("bmi".Equals(itemCode)) { pnt.BMI = blDR.getString("ItemValue"); } else if ("albumin".Equals(itemCode)) { pnt.Albumin = blDR.getString("ItemValue"); } else if ("diagnose".Equals(itemCode)) { pnt.Diagnose = blDR.getString("ItemValue"); } else if ("remark".Equals(itemCode)) { txtRemark.Text = blDR.getString("ItemValue"); } else if ("disease.score".Equals(itemCode)) { txtDisTotal.Text = blDR.getString("ItemValue"); } else if ("nutrition.score".Equals(itemCode)) { txtYYTotal.Text = blDR.getString("ItemValue"); } else if ("age70".Equals(itemCode)) { cbAge.IsChecked = "√".Equals(blDR.getString("ItemValue")); } else if ("gtscore3".Equals(itemCode)) { cbGt3.IsChecked = "√".Equals(blDR.getString("ItemValue")); } else if ("ltscore3".Equals(itemCode)) { cbLt3.IsChecked = "√".Equals(blDR.getString("ItemValue")); } else if ("total.score".Equals(itemCode)) { txtTotal.Text = blDR.getString("ItemValue"); } else { checkItem(itemCode); } } blDR.close(); } } grdPatient.DataContext = pnt; }
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); }