/// <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); }
/// <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); }