/// <summary> /// 获取<员工账户,姓名>字典集合 /// </summary> public static bool getAcountNameList(BLPublic.DBOperate _db, Dictionary <string, string> lstAcount) { if ((null == _db) || (null == lstAcount)) { return(false); } lstAcount.Clear(); bool rt = false; IDataReader dr = null; if (_db.GetRecordSet(SQL.SEL_ACOUNTNAME, ref dr)) { while (dr.Read()) { if (!lstAcount.ContainsKey(dr.GetString(0))) { lstAcount.Add(dr.GetString(0), dr.GetString(1)); } } dr.Close(); rt = true; } return(rt); }
private void loadPatient() { showProcess("正在加载病人信息..."); BLPublic.DBOperate db = new BLPublic.DBOperate(Application.StartupPath + @"\bl_server.lcf"); if (!db.IsConnected) { showProcess("连接服务器失败:" + db.Error); return; } DataTable tblPatient = null; if (!db.GetRecordSet(DataSyn.SEL_ACTTPN_PATIENT, ref tblPatient)) { showProcess("加载TPN患者失败:" + db.Error); return; } ListViewItem item = null; foreach (DataRow row in tblPatient.Rows) { item = lvPatient.Items.Add(row["DeptName"].ToString()); item.SubItems.Add(row["BedNo"].ToString()); item.SubItems.Add(row["PatientName"].ToString()); item.SubItems.Add(row["HospitalNo"].ToString()); } tblPatient.Clear(); }
/// <summary> /// 获取病人诊断 /// </summary> /// <param name="_db"></param> /// <param name="_pcode"></param> /// <param name="diagnose">诊断内容</param> /// <returns>获取是否成功</returns> public static bool getDiagnose(BLPublic.DBOperate _db, string _pcode, ref string diagnose) { IDataReader dr = null; if (_db.GetRecordSet(string.Format(SQL.SEL_PNTDIG, _pcode), ref dr, true)) { diagnose = ""; while (dr.Read()) { if (!string.IsNullOrWhiteSpace(diagnose)) { diagnose += ","; } diagnose += dr["ICD10Name"].ToString(); if (!dr.IsDBNull(dr.GetOrdinal("SubName2")) && !string.IsNullOrWhiteSpace(dr["SubName2"].ToString())) { diagnose += "((" + dr["SubName1"].ToString() + "(" + dr["SubName2"].ToString() + "))"; //有SubName2必有SubName1 } else if (!dr.IsDBNull(dr.GetOrdinal("SubName1")) && !string.IsNullOrWhiteSpace(dr["SubName1"].ToString())) { diagnose += "(" + dr["SubName1"].ToString() + ")"; } } dr.Close(); return(true); } else { diagnose = "加载患者诊断失败:" + _db.Error; } return(false); }
/// <summary> /// 获取员工姓名 /// </summary> /// <param name="_db"></param> /// <param name="_empCode"></param> /// <returns></returns> public static string getEmpName(BLPublic.DBOperate _db, string _empCode) { if ((null == _db) || string.IsNullOrWhiteSpace(_empCode)) { return(""); } string rt = ""; IDataReader dr = null; if (_db.GetRecordSet(string.Format(SQL.SEL_EMPNAME, _empCode), ref dr)) { if (dr.Read()) { rt = dr.GetString(0); } dr.Close(); } return(rt); }
public static bool loadConfig(BLPublic.DBOperate _db, ref Config config) { IDataReader dr = null; if (!_db.GetRecordSet(SQL.SEL_CONFIG, ref dr)) { return(false); } while (dr.Read()) { if ("cal_all_capacity".Equals(dr["SettingItemCode"].ToString())) { config.CalAllCapacity = !"0".Equals(dr["SettingValue"].ToString()); } else if ("cal_min_capacity".Equals(dr["SettingItemCode"].ToString())) { config.CalMinCapacity = Convert.ToSingle(dr["SettingValue"].ToString()); } } dr.Close(); return(true); }
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="lstResult">错误项目列表<项目ID, 错误偏差值(小于审核值时为负数)></param> /// <returns></returns> public bool checkComTPN(BLPublic.DBOperate _db, List <int> _lstPrep, Dictionary <int, double> _tpnValue, Dictionary <int, TPNItemMonitor> lstResult) { DataTable tblChk = new DataTable(); //TPN通用审方项目 if (!_db.GetRecordSet(SQL.SEL_COMTPN_CHK, ref tblChk)) { //this.lstError.Add("加载PIVAS审核项目失败:" + _db.Error); return(false); } List <DataRow> lstChk = new List <DataRow>(16); DataRow[] rows = null; int orderType = 0; foreach (int prepID in _lstPrep) { if (0 >= prepID) { continue; } if (0x07 > orderType) { orderType |= getPrepSAFType(prepID); } rows = tblChk.Select("UniPreparationID=" + prepID.ToString()); if ((null != rows) && (0 < rows.Length)) { foreach (DataRow r in rows) { lstChk.Add(r); } } } if (0 == lstChk.Count) { rows = tblChk.Select("(UniPreparationID IS NULL) OR (UniPreparationID=0)"); foreach (DataRow r in rows) { if (!r.IsNull("RequireSugar") && (bool)r["RequireSugar"] && (0x01 != (orderType & 0x01))) { continue; } else if (!r.IsNull("RequireAA") && (bool)r["RequireAA"] && (0x02 != (orderType & 0x02))) { continue; } else if (!r.IsNull("RequireFat") && (bool)r["RequireFat"] && (0x04 != (orderType & 0x04))) { continue; } lstChk.Add(r); } } int itemID = 0; int rt = 0; double val = 0.0f; ConditionPaser paser = new ConditionPaser(); DataDomain domain = null; TPNItemMonitor mntRT = null; foreach (DataRow row in lstChk) { itemID = Convert.ToInt32(row["TPNItemID"].ToString()); //SeqNo if (lstResult.ContainsKey(itemID)) //防止重复评价 { continue; } mntRT = new TPNItemMonitor((int)row["AlwayCheckID"], Convert.ToInt32(row["SeqNo"].ToString()), row["NormalValue"].ToString()); lstResult.Add(itemID, mntRT); //只要有审核的都有记录 if (string.IsNullOrWhiteSpace(row["NormalValue"].ToString())) { continue; } if (_tpnValue.ContainsKey(itemID)) { val = _tpnValue[itemID]; } else { val = 0; } //if (0 >= _tpnValue[itemID]) // continue; domain = new tpnmonitor.DataDomain(row["NormalValue"].ToString()); paser.paser(domain); rt = paser.compareDomain(domain, val); if (-1 == rt) { mntRT.DeviateValue = val - domain.Values[0]; if (0 != domain.Values[0]) { if (0.0 == mntRT.DeviateValue) //没有等号的判断,如val=1, NormalValue为>1 { mntRT.DeviateValue = -0.0001; mntRT.DeviatePer = -0.0001; //保留四位小数 } else { mntRT.DeviatePer = mntRT.DeviateValue / domain.Values[0]; } } else { mntRT.DeviatePer = 9.9999; } } else if (1 == rt) { if (domain.HadMinValue) { mntRT.DeviateValue = val - domain.Values[1]; } else { mntRT.DeviateValue = val - domain.Values[0]; } if (0 != domain.Values[0]) { if (0.0 == mntRT.DeviateValue) { mntRT.DeviateValue = 0.0001; mntRT.DeviatePer = 0.0001; } else { mntRT.DeviatePer = mntRT.DeviateValue / domain.Values[0]; } } else { mntRT.DeviatePer = 9.9999; } } } return(true); }