예제 #1
0
        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();
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
        public TPNItemView(BLPublic.DBOperate _db, ItemsControl _viewer)
        {
            this.db       = _db;
            this.icViewer = _viewer;

            loadTPNItems();
            loadComChkTPN();
        }
예제 #5
0
        /// <summary>
        /// 初始化处方模拟
        /// </summary>
        public void initMockRecipe(BLPublic.DBOperate _db, string _recipeID)
        {
            this.db                       = _db;
            this.recipeID                 = _recipeID;
            this.isMockModel              = true;
            lvDrugs.SelectedIndexChanged += new EventHandler(lvDrugs_SelectedIndexChanged);

            init();
        }
예제 #6
0
        public DataSyn(string _appPath)
        {
            this.appPath = _appPath;
            this.logPath = (new DirectoryInfo(this.appPath)).Parent.FullName + @"\InterfaceDataLog\检查\";
            this.logOp   = new BLPublic.LogOperate(this.appPath + @"\log\", "SDFYSyn");

            this.db = new BLPublic.DBOperate(Path.Combine(this.appPath, "bl_server.lcf"));
            if (!this.db.IsConnected)
            {
                this.logOp.log("连接服务器失败:" + this.db.Error);
            }
        }
예제 #7
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.db = new BLPublic.DBOperate(AppDomain.CurrentDomain.BaseDirectory + "bl_server.lcf", "CPMATE");
            if (!this.db.IsConnected)
            {
                BLPublic.Dialogs.Error("连接服务器失败:" + this.db.Error);
                return;
            }

            this.tpnView = new TPNItemView(this.db, lvTPNItems);
            this.loadOrders();
        }
예제 #8
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            this.db = new BLPublic.DBOperate("bl_server.lcf", "CPMATE");
            if (!this.db.IsConnected)
            {
                BLPublic.Dialogs.Error("连接服务器失败:" + this.db.Error);
            }

            else
            {
                loadOrdres();
            }
        }
예제 #9
0
        /// <summary>
        /// 初始化显示项目
        /// </summary>
        /// <param name="_db"></param>
        /// <param name="_recipeID"></param>
        /// <param name="_itemCode"></param>
        public void init(BLPublic.DBOperate _db, string _recipeID, string _itemCode)
        {
            this.db       = _db;
            this.recipeID = _recipeID;
            this.itemCode = _itemCode;

            btnAddDrug.Hide();
            btnDelDrug.Hide();
            sptRight.Hide();
            lvTPN.Hide();
            this.Width -= sptRight.Width + lvTPN.Width;

            init();
        }
예제 #10
0
        private bool connectDB()
        {
            if (null == this.db)
            {
                this.db = new BLPublic.DBOperate(this.appPath + @"\bl_server.lcf", "CPMATE");
            }

            if (!this.db.IsConnected)
            {
                this.Error = "连接服务器失败:" + this.db.Error;
                this.logOp.log(this.Error);
                return(false);
            }

            return(true);
        }
예제 #11
0
        public bool init(BLPublic.DBOperate _db, string _empCode)
        {
            this.db      = _db;
            this.EmpCode = _empCode;

            this.lstError        = new List <string>();
            this.lstMntCondition = new List <MonitorCondition>();
            this.prepClass       = new Dictionary <int, string>();
            this.tpnValue        = new Dictionary <string, double>();
            this.pntValue        = new Dictionary <string, string>();
            this.ordersValue     = new Dictionary <string, double>();
            this.drugValue       = new Dictionary <int, RecipePrep>();
            this.tpnCal          = new TPNCalculator();
            this.tpnCal.init(_db);

            return(loadConfig());
        }
예제 #12
0
        /// <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);
        }
예제 #13
0
        /// <summary>
        /// 计算初始化。加载TPN项目
        /// </summary>
        /// <param name="_db"></param>
        /// <returns></returns>
        public bool init(BLPublic.DBOperate _db)
        {
            this.db         = _db;
            this.useLISItem = new List <string>();
            this.dicSysUnit = new Dictionary <string, int>();

            dicSysUnit.Add("千克", 1);
            dicSysUnit.Add("kg", 1);
            dicSysUnit.Add("克", 2);
            dicSysUnit.Add("g", 2);
            dicSysUnit.Add("毫克", 25);
            dicSysUnit.Add("mg", 25);
            dicSysUnit.Add("微克", 26);
            dicSysUnit.Add("μg", 26);
            dicSysUnit.Add("ug", 26);

            dicSysUnit.Add("毫升", 17);
            dicSysUnit.Add("ml", 17);
            dicSysUnit.Add("升", 18);
            dicSysUnit.Add("l", 18);

            dicSysUnit.Add("摩尔", 5);
            dicSysUnit.Add("mol", 5);
            dicSysUnit.Add("毫摩尔", 4);
            dicSysUnit.Add("毫摩", 4);
            dicSysUnit.Add("mmol", 4);
            dicSysUnit.Add("微摩尔", 3);
            dicSysUnit.Add("微摩", 3);
            dicSysUnit.Add("μmol", 3);
            dicSysUnit.Add("umol", 3);

            /*dicSysUnit.Add("焦耳", 8);
            *  dicSysUnit.Add("j", 8);
            *  dicSysUnit.Add("千焦", 9);
            *  dicSysUnit.Add("KJ", 9);*/

            return(loadTPNItem());
        }
예제 #14
0
        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);
        }
예제 #15
0
        void IMenuManager.menuBeforeSelect()
        {
            try
            {
                this.db = new BLPublic.DBOperate(AppDomain.CurrentDomain.BaseDirectory + "bl_server.lcf",
                                                 AppConst.SYSTEM_ID);

                if (!this.db.IsConnected)
                {
                    BLPublic.Dialogs.Error("连接服务器失败:" + this.db.Error);
                    return;
                }
                AppConst.db = this.db;
                ComClass.getAcountNameList(AppConst.db, ComClass.Acounts);

                listWard();//初始化患者查询页面中有个病区的下拉列表,耗时80毫秒
                loadPatient(false);
                Page_Click(btnTPNOrders, null);
            }
            catch (Exception ex)
            {
                ShowMsgHelper.ShowError("TPN画面加载时出错:" + ex.Message);
            }
        }
예제 #16
0
 public void init(BLPublic.DBOperate _db, string _patientCode)
 {
     this.db          = _db;
     this.patientCode = _patientCode;
 }
예제 #17
0
        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);
                }
            }
        }
예제 #18
0
        public void monitor()
        {
            this.logOp = new BLPublic.LogOperate(this.appPath + @"\log\", "tpnmonitorlog");
            this.db    = new BLPublic.DBOperate(this.appPath + @"\bl_server.lcf", "CPMATE");
            if (!this.db.IsConnected)
            {
                this.logOp.log("连接服务器失败:" + this.db.Error);
                return;
            }

            DataTable tblPatient = null;

            if (!this.db.GetRecordSet(SEL_ORDERS_NOCHK, ref tblPatient))
            {
                this.logOp.log("加载未审方医嘱失败:" + this.db.Error);
                return;
            }

            if ((null == tblPatient) || (0 == tblPatient.Rows.Count))
            {
                this.logOp.log("审方结束");
            }

            this.tpnMnt = new tpnmonitor.TPNMonitor();
            this.tpnMnt.init(this.db, "9999");

            int      month = 0;
            DateTime birthday;
            bool     rt = false;

            foreach (DataRow row in tblPatient.Rows)
            {
                if (!Convert.IsDBNull(row["Birthday"]))
                {
                    birthday = Convert.ToDateTime(row["Birthday"].ToString());

                    month = DateTime.Now.Month - birthday.Month;
                    month = (DateTime.Now.Year - birthday.Year) * 12 + month;
                    if (DateTime.Now.Day - birthday.Day < -15)
                    {
                        month--;
                    }
                    else if (DateTime.Now.Day - birthday.Day > 14)
                    {
                        month++;
                    }
                }
                else
                {
                    month = 0;
                }

                rt = this.tpnMnt.Monitor(row["PatientCode"].ToString(), month,
                                         "f".Equals(row["Sex"].ToString()) ? "女" : "男",
                                         row["RecipeID"].ToString());
                if (rt)
                {
                    this.tpnMnt.saveTPNValue();
                }
                else
                {
                    this.logOp.log("审核医嘱'" + row["RecipeID"].ToString() + "'失败:" + this.tpnMnt.getError());
                }
            }

            tblPatient.Clear();
            this.logOp.log("审方结束");

            endMonitor();
        }
예제 #19
0
 public void init(BLPublic.DBOperate _db)
 {
     this.db = _db;
 }
예제 #20
0
        /// <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);
        }