private bool initEmpName() { IDataReader idr = null; if (!AppConst.db.GetRecordSet("SELECT e.EmployeeCode, e.EmployeeName FROM hospitaldata.dbo.DEmployee e " + "WHERE EXISTS(SELECT 1 FROM DTCOrganizationMembers om WHERE om.EmployeeCode=e.EmployeeCode)", ref idr)) { BLPublic.Dialogs.Error("加载员工信息失败:" + AppConst.db.Error); return(false); } if (null == this.dicEmp) { this.dicEmp = new Dictionary <string, string>(16); } else { this.dicEmp.Clear(); } BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(idr); while (bldr.next()) { this.dicEmp.Add(bldr.getString("EmployeeCode"), bldr.getString("EmployeeName")); } bldr.close(); return(true); }
/// <summary> /// 设置通用审核项目 /// </summary> private void setComChk(string _recipeID) { if (null == this.tblComChkTPN) { return; } DataTable tbl = new DataTable(); if (!this.db.GetRecordSet(string.Format(SQL.SEL_ORDERSPREP, _recipeID), ref tbl)) { BLPublic.Dialogs.Error("读取医嘱匹配信息失败:" + this.db.Error); return; } List <DataRow> lstRow = new List <DataRow>(); BLPublic.BLDataReader dr = new BLPublic.BLDataReader(tbl.CreateDataReader()); while (dr.next()) { DataRow[] rows = this.tblComChkTPN.Select("UniPreparationID=" + dr.getString("UniPreparationID")); if (null != rows) { foreach (DataRow r in rows) { lstRow.Add(r); } } } dr.close(); if (0 == lstRow.Count) { DataRow[] rows = this.tblComChkTPN.Select("UniPreparationID=0 OR UniPreparationID IS NULL"); if (null != rows) { foreach (DataRow r in rows) { lstRow.Add(r); } } } if (0 == lstRow.Count) { return; } DataRow row = null; foreach (DataRow r in lstRow) { row = this.tblTPNItem.Rows.Find(Convert.ToInt32(r["TPNItemID"].ToString())); if (null != row) { row["NormalValue"] = r["NormalValue"]; row["SeqNo"] = 1000 + Convert.ToInt32(r["SeqNo"].ToString()); } } }
/// <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; } }
/// <summary> /// 初始化TPN检查项目 /// </summary> private void initTPNLIS() { IDataReader dr = null; if (!this.db.GetRecordSet(SQL.SEL_PN_CHKITEM, ref dr)) { BLPublic.Dialogs.Error("获取营养检查项目失败:" + this.db.Error); return; } if (null == this.dicTPNLISChk) { this.dicTPNLISChk = new Dictionary <int, string>(32); } else { this.dicTPNLISChk.Clear(); } BLPublic.BLDataReader dldr = new BLPublic.BLDataReader(dr); while (dldr.next()) { if (!string.IsNullOrWhiteSpace(dldr.getString("HISCheckItemUnit"))) { this.dicTPNLISChk.Add(dldr.getInt("KDCheckItemID"), string.Format("{0} ({1})", dldr.getString("HISCheckItemName"), dldr.getString("HISCheckItemUnit"))); } else { this.dicTPNLISChk.Add(dldr.getInt("KDCheckItemID"), dldr.getString("HISCheckItemName")); } } dldr.close(); }
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> /// <returns></returns> private bool loadMonitorCondition() { this.lstMntCondition.Clear(); IDataReader dr = null; if (this.db.GetRecordSet(SQL.SEL_TPNMNT_CDT, ref dr)) { ConditionPaser paser = new ConditionPaser(); MonitorCondition cdt = null; BLPublic.BLDataReader blDr = new BLPublic.BLDataReader(dr); while (blDr.next()) { cdt = new MonitorCondition(blDr.getInt("TPNMonitorID"), blDr.getString("ItemType"), blDr.getString("Code"), blDr.getString("Condition"), blDr.getBool("IsIn")); if ("tpn".Equals(cdt.ItemType)) { paser.paser(cdt); } this.lstMntCondition.Add(cdt); } blDr.close(); return(true); } else { this.lstError.Add("加载TPN审方条件失败:" + this.db.Error); } return(false); }
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> /// <returns></returns> private bool loadPrepThing(string _prepIDs) { if (string.IsNullOrWhiteSpace(_prepIDs)) { this.Error = "未指定加载内容的制剂"; return(false); } if (',' == _prepIDs[_prepIDs.Length - 1]) { _prepIDs = _prepIDs.Substring(0, _prepIDs.Length - 1); } IDataReader dr = null; if (!this.db.GetRecordSet(string.Format(SEL_PREP_THING, _prepIDs), ref dr)) { this.Error = "加载制剂内容失败:" + this.db.Error; return(false); } if (null == this.tblPrepThing) { this.tblPrepThing = new DataTable(); this.tblPrepThing.Columns.Add("PrepID", typeof(long)); this.tblPrepThing.Columns.Add("Code", typeof(string)); this.tblPrepThing.Columns.Add("Content", typeof(double)); this.tblPrepThing.Columns.Add("UnitID", typeof(int)); } BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr); DataRow rowThing = null; while (bldr.next()) { rowThing = this.tblPrepThing.NewRow(); rowThing["PrepID"] = bldr.getInt("UniPreparationID"); rowThing["Code"] = bldr.getString("Code"); rowThing["Content"] = bldr.getFloat("Content"); rowThing["UnitID"] = bldr.getInt("UnitID"); this.tblPrepThing.Rows.Add(rowThing); if (!this.hadInitPrepIDs.Contains("," + rowThing["PrepID"] + ",")) { this.hadInitPrepIDs += "," + rowThing["PrepID"] + ","; } } bldr.close(); return(true); }
/// <summary> /// 初始化TPN检查项目 /// </summary> private void initTPNLIS() { IDataReader dr = null; if (!AppConst.db.GetRecordSet(recipemonitorlist.SQL.SEL_PN_CHKITEM, ref dr)) { BLPublic.Dialogs.Error("获取营养检查项目失败:" + AppConst.db.Error); return; } if (null == this.tblTPNLISChk) { this.tblTPNLISChk = new DataTable(); this.tblTPNLISChk.Columns.Add("ID", typeof(int)); this.tblTPNLISChk.Columns.Add("ItemName", typeof(string)); this.tblTPNLISChk.Columns.Add("LastTime", typeof(string)); this.tblTPNLISChk.Columns.Add("LastValue", typeof(string)); this.tblTPNLISChk.Columns.Add("ValueDiret", typeof(string)); this.tblTPNLISChk.Columns.Add("NormalValue", typeof(string)); this.tblTPNLISChk.Columns.Add("Diret", typeof(int)); } else { this.tblTPNLISChk.Clear(); } DataRow newRow = null; BLPublic.BLDataReader dldr = new BLPublic.BLDataReader(dr); while (dldr.next()) { newRow = this.tblTPNLISChk.NewRow(); newRow["ID"] = dldr.getInt("KDCheckItemID"); if (!string.IsNullOrWhiteSpace(dldr.getString("HISCheckItemUnit"))) { newRow["ItemName"] = string.Format("{0} ({1})", dldr.getString("HISCheckItemName"), dldr.getString("HISCheckItemUnit")); } else { newRow["ItemName"] = dldr.getString("HISCheckItemName"); } this.tblTPNLISChk.Rows.Add(newRow); } dldr.close(); }
/// <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 loadPNChkItem() { DataTable tbl = new DataTable(); if (!AppConst.db.GetRecordSet(recipemonitorlist.SQL.SEL_PN_CHKITEM, ref tbl)) { BLPublic.Dialogs.Error("加载检查项目失败:" + AppConst.db.Error); return; } BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(tbl.CreateDataReader()); while (bldr.next()) { cbbChkItem.Items.Add(new BLPublic.IDCodeNameItem(bldr.getString("HISCheckItemCode"), bldr.getString("HISCheckItemUnit"), bldr.getString("HISCheckItemName"))); } bldr.close(); tbl.Clear(); }
/// <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 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 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); } }
private void listDrug(string _key = "") { lvDrug.Items.Clear(); ListViewItem item = null; if (!string.IsNullOrEmpty(_key)) { this.tblDrug.DefaultView.RowFilter = string.Format("CustomName LIKE '%{0}%' OR SpellCode LIKE '%{0}%'", _key); } this.tblDrug.DefaultView.Sort = "CustomName"; BLPublic.BLDataReader idr = new BLPublic.BLDataReader(this.tblDrug.DefaultView.ToTable().CreateDataReader()); lvDrug.BeginUpdate(); while (idr.next()) { item = lvDrug.Items.Add(idr.getString("CustomName")); //, item.SubItems.Add(idr.getString("SpecDesc")); item.Tag = idr.getString("CustomCode"); } idr.close(); lvDrug.EndUpdate(); }
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); } }
/// <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 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); } }
/// <summary> /// 加载医嘱药品 /// </summary> private void loadDrug() { lvDrugs.Items.Clear(); if (null == this.tblDrus) { this.tblDrus = new DataTable(); } else { this.tblDrus.Clear(); } if (!this.db.GetRecordSet(string.Format(SQL.SEL_ORDERSPREP_WDRUG, this.recipeID), ref this.tblDrus)) { lvDrugs.Items.Add("加载处方失败:" + this.db.Error); return; } ListViewItem item = null; BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(this.tblDrus.CreateDataReader()); while (bldr.next()) { item = lvDrugs.Items.Add(bldr.getString("DrugName").Trim()); item.Tag = new BLPublic.IDCodeItem(bldr.getInt("UniPreparationID"), bldr.getString("DrugCode")); item.SubItems.Add(bldr.getString("DrugSpec").Trim()); item.SubItems.Add(BLPublic.Utils.trimZero(bldr.getString("Dosage")) + ' ' + fillEnd(bldr.getString("DosageUnit").Trim(), 3)); item.SubItems.Add("-"); item.SubItems.Add("-"); } bldr.close(); this.tblDrus.PrimaryKey = new DataColumn[] { this.tblDrus.Columns["DrugCode"] }; }
private void loadTPNItems() { IDataReader dr = null; if (!AppConst.db.GetRecordSet(SQL.SEL_TPNTEIM2, ref dr)) { BLPublic.Dialogs.Error("加载TPN项目失败:" + AppConst.db.Error); return; } if (null == this.lstTPNItems) { this.lstTPNItems = new List <BLPublic.CodeNameItem>(); } BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr); while (bldr.next()) { this.lstTPNItems.Add(new BLPublic.CodeNameItem(bldr.getString("TPNItemID"), bldr.getString("ItemName") + ftmAddUnit(bldr.getString("Unit")))); } bldr.close(); }
/// <summary> /// 显示评价记录 /// </summary> /// <param name="_rcd"></param> private void showRecord(AnalysisModel _rcd) { IDataReader dr = null; BLPublic.BLDataReader blDR = null; if (null == this.report) { this.report = new Report(); this.report.Load(@"report.frx"); if (AppConst.db.GetRecordSet(SQL.SEL_ANALYSIS_DOCITEM, ref dr)) { blDR = new BLPublic.BLDataReader(dr); while (blDR.next()) { this.report.SetParameterValue(blDR.getString("DataItemCode").ToLower(), blDR.getString("DefaultValue")); } blDR.close(); } else { BLPublic.Dialogs.Error("评价文档默认值失败:" + AppConst.db.Error); return; } this.report.SetParameterValue("isman", boolLabel(false)); this.report.SetParameterValue("iswoman", boolLabel(false)); } setReportValue("recorder", _rcd.Recorder); setReportValue("recordtime", _rcd.RecordTime); if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_PNTINFO, this.patient.PatientCode), ref dr)) { blDR = new BLPublic.BLDataReader(dr); if (blDR.next()) { string sex = blDR.getString("Sex"); this.report.GetParameter("patient.roomname").Value = blDR.getString("DeptName"); this.report.GetParameter("patient.bedno").Value = blDR.getString("BedNo"); this.report.GetParameter("patient.inhospitalno").Value = blDR.getString("HospitalNo"); this.report.GetParameter("patient.patientname").Value = blDR.getString("PatientName"); this.report.GetParameter("isman").Value = boolLabel("男".Equals(sex) || "m".Equals(sex)); this.report.GetParameter("iswoman").Value = boolLabel("女".Equals(sex) || "f".Equals(sex)); } blDR.close(); } if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_RCDITEMS, _rcd.RecordID), ref dr)) { blDR = new BLPublic.BLDataReader(dr); while (blDR.next()) { setReportValue(blDR.getString("DataItemCode").ToLower(), blDR.getString("ItemValue")); } blDR.close(); } this.frmRpt.showReport(this.report); }
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); } } }
/// <summary> /// 加载医嘱TPN项目值,审方通用项目 /// </summary> /// <param name="_recipeID"></param> private void loadTPNValue(string _recipeID) { IDataReader dr = null; if (!this.db.GetRecordSet(string.Format(SQL.SEL_ORDERSTPNVAL, _recipeID), ref dr)) { BLPublic.Dialogs.Error("加载医嘱TPN项目失败:" + this.db.Error); return; } Dictionary <int, double> lstValuet = new Dictionary <int, double>(16); DataRow row = null; while (dr.Read()) { row = this.tblTPNItem.Rows.Find(dr.GetInt32(0).ToString()); if (null != row) { if (dr.IsDBNull(1)) { row["ItemValue"] = ""; } else { row["ItemValue"] = dr.GetString(1); if (BLPublic.Utils.IsNumeric(dr.GetString(1))) { lstValuet.Add(dr.GetInt32(0), Convert.ToDouble(dr.GetString(1))); } } } } dr.Close(); //医嘱药品制剂 if (!this.db.GetRecordSet(string.Format(SQL.SEL_COMCHK_RT, _recipeID), ref dr)) { BLPublic.Dialogs.Error("读取医嘱通用审核失败:" + this.db.Error); return; } bool hadResult = false; string valDire = ""; string valSub = ""; double per = 0; BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr); while (bldr.next()) { valDire = ""; valSub = ""; per = bldr.getFloat("DeviatePer"); if (0 > per) { valDire = "↓"; valSub = "- " + Math.Abs(per).ToString("p2"); } else if (0 < per) { valDire = "↑"; valSub = "+ " + per.ToString("p2"); } row = this.tblTPNItem.Rows.Find(bldr.getInt("TPNItemID")); if (null != row) { row["ValueDiret"] = valDire; row["ValueSubPer"] = valSub; row["ResultOK"] = string.IsNullOrWhiteSpace(valDire) ? "合格" : "不合格"; row["NormalValue"] = bldr.getString("NormalValue"); row["SeqNo"] = 1000 + bldr.getInt("SeqNo"); } hadResult = true; } dr.Close(); if (!hadResult) { setComChk(_recipeID); } }
/// <summary> /// 计算医嘱溶剂 /// </summary> /// <param name="_recipeID"></param> /// <param name="_onDrug">计算药品溶剂事件<制剂ID,溶剂></param> /// <returns></returns> public double ordersCapacity(DataTable _tblDrugs, Action <int, double, double> _onDrug) { this.drugValue.Clear(); double capacity = 0; double totalCapacity = 0; //总容量 double dosage = 0; double quantity = 0; string dosageu = ""; int prepID = 0; BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(_tblDrugs.CreateDataReader()); while (bldr.next()) { prepID = bldr.getInt("UniPreparationID"); dosage = Convert.ToDouble(bldr.getString("Dosage")); dosageu = bldr.getString("DosageUnit").Trim(); capacity = 0; if (dosageu.Equals(bldr.getString("StdDosageUnit").Trim())) { quantity = dosage / bldr.getFloat("StdDosage"); } else if (dosageu.Equals(bldr.getString("CapacityUnit").Trim())) { quantity = dosage / bldr.getFloat("Capacity"); } else { quantity = bldr.getFloat("Quantity"); } if ("ml".Equals(dosageu, StringComparison.CurrentCultureIgnoreCase) || ("毫升".Equals(dosageu))) { capacity = dosage; } else if ("l".Equals(dosageu, StringComparison.CurrentCultureIgnoreCase) || ("升".Equals(dosageu))) { capacity = dosage * 1000; } else if (bldr.getBool("IsMenstruum") || "ml".Equals(bldr.getString("CapacityUnit"))) //溶媒或注射液 { capacity = bldr.getFloat("Capacity") * quantity; } if (this.drugValue.ContainsKey(prepID)) { this.drugValue[prepID].Dosage += dosage; this.drugValue[prepID].Capacity += capacity; this.drugValue[prepID].Quantity += quantity; } else { this.drugValue.Add(prepID, new RecipePrep(prepID, dosage, capacity, quantity)); } //总容积 if (bldr.getBool("IsMenstruum")) { totalCapacity += capacity; } else if (this.config.CalAllCapacity && (capacity >= this.config.CalMinCapacity)) //是否计算非溶媒注射液 & 大于最小计算量 { totalCapacity += capacity; } else { capacity = 0; } if (null != _onDrug) { _onDrug(prepID, quantity, capacity); } } bldr.close(); return(totalCapacity); }
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(); }
/// <summary> /// 显示TPN参数 /// </summary> private void listTPNItem(Dictionary <int, TPNItemMonitor> _dicComChkTPN) { lvTPN.BeginUpdate(); lvTPN.Items.Clear(); ListViewItem item = null; if (null != _dicComChkTPN) { //先显示通用审核TPN参数 DataRow row = null; foreach (KeyValuePair <int, TPNItemMonitor> kv in _dicComChkTPN) { row = tblTPN.Rows.Find(kv.Key); if (null != row) { item = lvTPN.Items.Add(row["ItemName"].ToString()); item.Tag = row["ItemCode"].ToString(); item.SubItems.Add(row["Value"].ToString() + row["Unit"].ToString()); item.SubItems.Add(kv.Value.Domain); item.UseItemStyleForSubItems = false; if (0 > kv.Value.DeviateValue) { item.SubItems.Add("↓"); item.SubItems[3].ForeColor = Color.Coral; } else if (0 < kv.Value.DeviateValue) { item.SubItems.Add("↑"); item.SubItems[3].ForeColor = Color.Coral; } else { item.SubItems.Add("合格"); item.SubItems[3].ForeColor = Color.FromArgb(128, 255, 128); } } } item = lvTPN.Items.Add(""); item.Tag = null; item.SubItems.Add(""); } tblTPN.DefaultView.Sort = "SeqNo DESC"; BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(tblTPN.DefaultView.ToTable().CreateDataReader()); while (bldr.next()) { if (!_dicComChkTPN.ContainsKey(bldr.getInt("TPNItemID"))) { item = lvTPN.Items.Add(bldr.getString("ItemName")); item.Tag = bldr.getString("ItemCode"); item.SubItems.Add(bldr.getString("Value") + bldr.getString("Unit")); item.SubItems.Add(bldr.getString("NormalValue")); item.SubItems.Add(""); } } bldr.close(); lvTPN.EndUpdate(); }
private bool loadMonitorCdt() { if (null == this.lstMntCdt) { this.lstMntCdt = new List <ConditionModel>(); } else { this.lstMntCdt.Clear(); } IDataReader idr = null; if (!AppConst.db.GetRecordSet(SQL.SEL_TPNMNT_DIG, ref idr)) { BLPublic.Dialogs.Error("加载审方条件失败:" + AppConst.db.Error); return(false); } int index = 0; BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(idr); ConditionModel cdt = null; while (bldr.next()) { cdt = new ConditionModel(bldr.getInt("TPNMonitorID"), bldr.getString("ItemType"), bldr.getString("Code"), bldr.getString("Name"), "", bldr.getString("Condition"), bldr.getBool("IsIn")); cdt.Index = index; if ("tpn".Equals(cdt.ItemType) && cdt.ItemName.Contains("()")) { cdt.ItemName = cdt.ItemName.Substring(0, cdt.ItemName.IndexOf("()")); } this.lstMntCdt.Add(cdt); index++; } bldr.close(); idr = null; DataTable tbl = new DataTable(); //药品审方条件 if (AppConst.db.GetRecordSet(SQL.SEL_TPNMNT_DRUG, ref tbl)) { bldr = new BLPublic.BLDataReader(tbl.CreateDataReader()); while (bldr.next()) { this.lstMntCdt.Add(new ConditionModel { Index = index, MonitorID = bldr.getInt("TPNMonitorID"), ItemType = bldr.getString("ItemType"), ItemCode = bldr.getString("Code"), ItemName = bldr.getString("Name"), ConditionType = (bldr.getBool("IsType2") ? "class" : "drug"), ConditionCode = bldr.getString("Code2"), Condition = bldr.getString("Condition"), IsIn = bldr.getBool("IsIn") }); index++; } bldr.close(); tbl.Clear(); } else { BLPublic.Dialogs.Error("加载药品审方失败:" + AppConst.db.Error); } return(true); }
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; }