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