示例#1
0
        /// <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);
        }
示例#2
0
        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);
        }
示例#3
0
        /// <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);
        }