Exemplo n.º 1
0
        /// <summary>
        /// 初始化TPN检查项目
        /// </summary>
        private void initTPNLIS()
        {
            IDataReader dr = null;

            if (!this.db.GetRecordSet(SQL.SEL_PN_CHKITEM, ref dr))
            {
                BLPublic.Dialogs.Error("获取营养检查项目失败:" + this.db.Error);
                return;
            }

            if (null == this.dicTPNLISChk)
            {
                this.dicTPNLISChk = new Dictionary <int, string>(32);
            }

            else
            {
                this.dicTPNLISChk.Clear();
            }

            BLPublic.BLDataReader dldr = new BLPublic.BLDataReader(dr);
            while (dldr.next())
            {
                if (!string.IsNullOrWhiteSpace(dldr.getString("HISCheckItemUnit")))
                {
                    this.dicTPNLISChk.Add(dldr.getInt("KDCheckItemID"), string.Format("{0} ({1})", dldr.getString("HISCheckItemName"), dldr.getString("HISCheckItemUnit")));
                }
                else
                {
                    this.dicTPNLISChk.Add(dldr.getInt("KDCheckItemID"), dldr.getString("HISCheckItemName"));
                }
            }

            dldr.close();
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 加载患者评估记录
        /// </summary>
        /// <param name="_pntCode"></param>
        private void listRecord(string _patientCode)
        {
            lvRecord.Items.Clear();
            IDataReader dr = null;

            if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_ANALYSIS_RCD, _patientCode), ref dr))
            {
                BLPublic.Dialogs.Error("加载评价记录失败:" + AppConst.db.Error);
                return;
            }

            BLPublic.BLDataReader blDR = new BLPublic.BLDataReader(dr);
            while (blDR.next())
            {
                lvRecord.Items.Add(new AnalysisModel()
                {
                    RecordID   = blDR.getInt("RecordID"),
                    TotalScore = blDR.getString("TotalScore"),
                    RecordTime = blDR.getDateTime("RecordTime").ToString("yyyy-MM-dd HH:mm"),
                    Recorder   = blDR.getString("Recorder")
                });
            }

            blDR.close();

            if (0 < lvRecord.Items.Count)
            {
                lvRecord.SelectedIndex = lvRecord.Items.Count - 1;
            }
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 加载监护
        /// </summary>
        private void loadCustody()
        {
            string sql = "";

            if (true == cbAllPatient.IsChecked)
            {
                sql = string.Format(SQL.SEL_CUSTODY_BYDATE, ((DateTime)dpSDate.SelectedDate).ToString("yyyy-MM-dd"),
                                    ((DateTime)dpEDate.SelectedDate).AddDays(1).ToString("yyyy-MM-dd"));
            }
            else if (null == this.patient)
            {
                return;
            }
            else
            {
                sql = string.Format(SQL.SEL_CUSTODY_BYPNT2, this.patient.PatientCode);
            }

            DataTable tbl = null;

            if (AppConst.db.GetRecordSet(sql, ref tbl))
            {
                BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(tbl.CreateDataReader());
                string content             = "";
                while (bldr.next())
                {
                    content = WinCustodyEdit.getObjectStr(bldr.getInt("CustodyID")) + ". " + bldr.getString("CustodyDesc");
                    if (!bldr.isNull("FinishTime"))
                    {
                        content += ". (已结束)";
                    }

                    this.tblOpRecord.Rows.Add(new object[] { "custody", bldr.getInt("CustodyID"),
                                                             bldr.getString("DeptName"), bldr.getString("BedNo"), bldr.getString("PatientName"),
                                                             bldr.getDateTime("CustodyTime"), content, ComClass.getEmpName(bldr.getString("Custodyer")) });
                }

                bldr.close();
                tbl.Clear();
            }
            else
            {
                BLPublic.Dialogs.Error("加载监护失败:" + AppConst.db.Error);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 加载监护记录
        /// </summary>
        private void loadCustody()
        {
            DataTable tbl = null;

            if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_CUSTODY_BYPNT, this.patient.PatientCode), ref tbl))
            {
                BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(tbl.CreateDataReader());
                while (bldr.next())
                {
                    addCustody(bldr.getInt("CustodyID"), WinCustodyEdit.getObjectStr(bldr.getInt("CustodyID"), "\r\n"),
                               bldr.getString("CustodyDesc"), bldr.getDateTime("CustodyTime"), bldr.getString("Custodyer"));
                }

                bldr.close();
                tbl.Clear();
            }
            else
            {
                BLPublic.Dialogs.Error("加载监护记录失败:" + AppConst.db.Error);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 加载干预
        /// </summary>
        private void loadIntervene()
        {
            string sql = "";

            if (true == cbAllPatient.IsChecked)
            {
                sql = string.Format(SQL.SEL_INTERVENE_BYDATE, ((DateTime)dpSDate.SelectedDate).ToString("yyyy-MM-dd"),
                                    ((DateTime)dpEDate.SelectedDate).AddDays(1).ToString("yyyy-MM-dd"));
            }
            else if (null == this.patient)
            {
                return;
            }
            else
            {
                sql = string.Format(SQL.SEL_INTERVENE_BYPNT2, this.patient.PatientCode);
            }

            IDataReader dr = null;

            if (AppConst.db.GetRecordSet(sql, ref dr, true))
            {
                BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr);
                string content             = "";
                while (bldr.next())
                {
                    content = WinInterveneEdit.getObjectStr(bldr.getInt("InterveneID")) + ". " + bldr.getString("IntervenePlan");

                    this.tblOpRecord.Rows.Add(new object[] { "intervene", bldr.getInt("InterveneID"),
                                                             bldr.getString("DeptName"), bldr.getString("BedNo"), bldr.getString("PatientName"),
                                                             bldr.getDateTime("InterveneTime"), content, ComClass.getEmpName(bldr.getString("Intervener")) });
                }
                dr.Close();
            }
            else
            {
                BLPublic.Dialogs.Error("加载干预失败:" + AppConst.db.Error);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 初始化TPN检查项目
        /// </summary>
        private void initTPNLIS()
        {
            IDataReader dr = null;

            if (!AppConst.db.GetRecordSet(recipemonitorlist.SQL.SEL_PN_CHKITEM, ref dr))
            {
                BLPublic.Dialogs.Error("获取营养检查项目失败:" + AppConst.db.Error);
                return;
            }

            if (null == this.tblTPNLISChk)
            {
                this.tblTPNLISChk = new DataTable();
                this.tblTPNLISChk.Columns.Add("ID", typeof(int));
                this.tblTPNLISChk.Columns.Add("ItemName", typeof(string));
                this.tblTPNLISChk.Columns.Add("LastTime", typeof(string));
                this.tblTPNLISChk.Columns.Add("LastValue", typeof(string));
                this.tblTPNLISChk.Columns.Add("ValueDiret", typeof(string));
                this.tblTPNLISChk.Columns.Add("NormalValue", typeof(string));
                this.tblTPNLISChk.Columns.Add("Diret", typeof(int));
            }
            else
            {
                this.tblTPNLISChk.Clear();
            }

            DataRow newRow = null;

            BLPublic.BLDataReader dldr = new BLPublic.BLDataReader(dr);
            while (dldr.next())
            {
                newRow       = this.tblTPNLISChk.NewRow();
                newRow["ID"] = dldr.getInt("KDCheckItemID");

                if (!string.IsNullOrWhiteSpace(dldr.getString("HISCheckItemUnit")))
                {
                    newRow["ItemName"] = string.Format("{0} ({1})", dldr.getString("HISCheckItemName"), dldr.getString("HISCheckItemUnit"));
                }
                else
                {
                    newRow["ItemName"] = dldr.getString("HISCheckItemName");
                }

                this.tblTPNLISChk.Rows.Add(newRow);
            }

            dldr.close();
        }
Exemplo n.º 9
0
        /// <summary>
        /// 加载评估结果
        /// </summary>
        private void loadAnalysis()
        {
            IDataReader dr = null;

            if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_ANALYSIS_RCD, this.patient.PatientCode), ref dr))
            {
                BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr);
                while (bldr.next())
                {
                    this.tblOpRecord.Rows.Add(new object[] { "analysis", bldr.getInt("RecordID"),
                                                             bldr.getDateTime("RecordTime"), "总分: " + bldr.getString("TotalScore"),
                                                             bldr.getString("Recorder") });
                }
                dr.Close();
            }
            else
            {
                BLPublic.Dialogs.Error("加载评估记录失败:" + AppConst.db.Error);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 加载药师日记
        /// </summary>
        private void loadPMNote()
        {
            IDataReader dr = null;

            if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_PM_NOTE, this.patient.PatientCode), ref dr))
            {
                BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr);
                while (bldr.next())
                {
                    this.tblOpRecord.Rows.Add(new object[] { "note", bldr.getInt("NoteID"),
                                                             bldr.getDateTime("NoteTime"), bldr.getString("NoteContent"),
                                                             ComClass.getEmpName(bldr.getString("Noter")) });
                }
                dr.Close();
            }
            else
            {
                BLPublic.Dialogs.Error("加载笔记记录失败:" + AppConst.db.Error);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 加载干预记录
        /// </summary>
        private void loadIntervene()
        {
            DataTable tbl = null;

            if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_INTERVENE_BYPNT, this.patient.PatientCode), ref tbl))
            {
                BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(tbl.CreateDataReader());
                while (bldr.next())
                {
                    addIntervene(bldr.getInt("InterveneID"), WinInterveneEdit.getObjectStr(bldr.getInt("InterveneID")),
                                 bldr.getString("IntervenePlan"), bldr.getDateTime("InterveneTime"), bldr.getString("Intervener"));
                }

                bldr.close();
                tbl.Clear();
            }
            else
            {
                BLPublic.Dialogs.Error("加载干预记录失败:" + AppConst.db.Error);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 加载药师日记
        /// </summary>
        private void loadPMNote()
        {
            string sql = "";

            if (true == cbAllPatient.IsChecked)
            {
                sql = string.Format(SQL.SEL_PM_NOTE_WPNT_BYDATE, ((DateTime)dpSDate.SelectedDate).ToString("yyyy-MM-dd"),
                                    ((DateTime)dpEDate.SelectedDate).AddDays(1).ToString("yyyy-MM-dd"));
            }
            else if (null == this.patient)
            {
                return;
            }
            else
            {
                sql = string.Format(SQL.SEL_PM_NOTE_WPNT_BYPNT, this.patient.PatientCode);
            }

            IDataReader dr = null;

            if (AppConst.db.GetRecordSet(sql, ref dr, true))
            {
                BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(dr);
                while (bldr.next())
                {
                    this.tblOpRecord.Rows.Add(new object[] { "note", bldr.getInt("NoteID"),
                                                             bldr.getString("DeptName"), bldr.getString("BedNo"), bldr.getString("PatientName"),
                                                             bldr.getDateTime("NoteTime"), bldr.getString("NoteContent"),
                                                             ComClass.getEmpName(bldr.getString("Noter")) });
                }
                dr.Close();
            }
            else
            {
                BLPublic.Dialogs.Error("加载药师笔记失败:" + AppConst.db.Error);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 加载医嘱药品
        /// </summary>
        private void loadDrug()
        {
            lvDrugs.Items.Clear();

            if (null == this.tblDrus)
            {
                this.tblDrus = new DataTable();
            }
            else
            {
                this.tblDrus.Clear();
            }

            if (!this.db.GetRecordSet(string.Format(SQL.SEL_ORDERSPREP_WDRUG, this.recipeID), ref this.tblDrus))
            {
                lvDrugs.Items.Add("加载处方失败:" + this.db.Error);
                return;
            }

            ListViewItem item = null;

            BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(this.tblDrus.CreateDataReader());
            while (bldr.next())
            {
                item     = lvDrugs.Items.Add(bldr.getString("DrugName").Trim());
                item.Tag = new BLPublic.IDCodeItem(bldr.getInt("UniPreparationID"), bldr.getString("DrugCode"));
                item.SubItems.Add(bldr.getString("DrugSpec").Trim());
                item.SubItems.Add(BLPublic.Utils.trimZero(bldr.getString("Dosage")) + ' ' +
                                  fillEnd(bldr.getString("DosageUnit").Trim(), 3));
                item.SubItems.Add("-");
                item.SubItems.Add("-");
            }
            bldr.close();

            this.tblDrus.PrimaryKey = new DataColumn[] { this.tblDrus.Columns["DrugCode"] };
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 显示TPN参数
        /// </summary>
        private void listTPNItem(Dictionary <int, TPNItemMonitor> _dicComChkTPN)
        {
            lvTPN.BeginUpdate();
            lvTPN.Items.Clear();

            ListViewItem item = null;

            if (null != _dicComChkTPN)
            {
                //先显示通用审核TPN参数
                DataRow row = null;
                foreach (KeyValuePair <int, TPNItemMonitor> kv in _dicComChkTPN)
                {
                    row = tblTPN.Rows.Find(kv.Key);
                    if (null != row)
                    {
                        item     = lvTPN.Items.Add(row["ItemName"].ToString());
                        item.Tag = row["ItemCode"].ToString();
                        item.SubItems.Add(row["Value"].ToString() + row["Unit"].ToString());
                        item.SubItems.Add(kv.Value.Domain);

                        item.UseItemStyleForSubItems = false;
                        if (0 > kv.Value.DeviateValue)
                        {
                            item.SubItems.Add("↓");
                            item.SubItems[3].ForeColor = Color.Coral;
                        }
                        else if (0 < kv.Value.DeviateValue)
                        {
                            item.SubItems.Add("↑");
                            item.SubItems[3].ForeColor = Color.Coral;
                        }
                        else
                        {
                            item.SubItems.Add("合格");
                            item.SubItems[3].ForeColor = Color.FromArgb(128, 255, 128);
                        }
                    }
                }

                item     = lvTPN.Items.Add("");
                item.Tag = null;
                item.SubItems.Add("");
            }

            tblTPN.DefaultView.Sort = "SeqNo DESC";
            BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(tblTPN.DefaultView.ToTable().CreateDataReader());
            while (bldr.next())
            {
                if (!_dicComChkTPN.ContainsKey(bldr.getInt("TPNItemID")))
                {
                    item     = lvTPN.Items.Add(bldr.getString("ItemName"));
                    item.Tag = bldr.getString("ItemCode");
                    item.SubItems.Add(bldr.getString("Value") + bldr.getString("Unit"));
                    item.SubItems.Add(bldr.getString("NormalValue"));
                    item.SubItems.Add("");
                }
            }
            bldr.close();
            lvTPN.EndUpdate();
        }
Exemplo n.º 17
0
        /// <summary>
        /// 医嘱相关参数
        /// </summary>
        /// <param name="_tblRecipe"></param>
        /// <returns></returns>
        private bool initRecipeInfo(DataTable _tblRecipe)
        {
            double AACapacity    = 0;   //氨基酸容量
            double sugarCapacity = 0;   //葡萄糖容量
            double fatCapacity   = 0;   //脂肪乳容量
            string drugCodes     = "";
            string newPrepIDs    = "";
            int    SAFType       = 0;

            double totalCapacity = ordersCapacity(_tblRecipe, (prepID, quantity, capacity) =>
            {
                if (0 >= prepID)
                {
                    return;
                }

                drugCodes += prepID.ToString() + ",";
                if (!this.prepClass.ContainsKey(prepID))
                {
                    newPrepIDs += prepID.ToString() + ",";
                }

                int t = getPrepSAFType(prepID);
                if (0x01 == t)                  //葡萄糖
                {
                    sugarCapacity += capacity;
                }

                else if (0x02 == t)                  //氨基酸
                {
                    AACapacity += capacity;
                }

                else if (0x04 == t)                 //脂肪乳
                {
                    fatCapacity += capacity;
                }


                SAFType &= t;
            });


            if (string.IsNullOrWhiteSpace(drugCodes))
            {
                this.lstError.Add("医嘱没有药品内容.");
                return(false);
            }

            if (0 >= totalCapacity)
            {
                this.lstError.Add("医嘱没有溶媒.");
                return(false);
            }

            drugCodes = "," + drugCodes;

            this.pntValue["recipe.drugcode"] = drugCodes;

            setOrdersValue("recipe.tpnsaftype", SAFType);
            setOrdersValue("recipe.capacity", totalCapacity);
            setOrdersValue("recipe.capacity.AA", AACapacity);
            setOrdersValue("recipe.capacity.sugar", sugarCapacity);
            setOrdersValue("recipe.capacity.fat", fatCapacity);


            //获取为初始化的制剂分类
            if (!string.IsNullOrWhiteSpace(newPrepIDs))
            {
                newPrepIDs = newPrepIDs.Substring(0, newPrepIDs.Length - 1);
                IDataReader idr = null;
                if (this.db.GetRecordSet(string.Format(SQL.SEL_PREP_CLASS, newPrepIDs), ref idr))
                {
                    BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(idr);
                    int prepID = 0;
                    while (bldr.next())
                    {
                        prepID = bldr.getInt("UniPreparationID");
                        if (this.prepClass.ContainsKey(prepID))
                        {
                            this.prepClass[prepID] += bldr.getString("MedicineClassID") + ",";
                        }
                        else
                        {
                            this.prepClass.Add(prepID, bldr.getString("MedicineClassID") + ",");
                        }
                    }
                    bldr.close();
                }
                else
                {
                    this.lstError.Add("读取药品分类失败:" + this.db.Error);
                }
            }

            //获取药品分类
            string dClass = ",";

            foreach (int pID in this.prepClass.Keys)
            {
                if (drugCodes.Contains("," + pID.ToString() + ","))
                {
                    dClass += this.prepClass[pID] + ",";
                }
            }

            this.pntValue["recipe.drugclass"] = dClass;

            return(true);
        }
Exemplo n.º 18
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);
            }
        }
Exemplo n.º 19
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);
                }
            }
        }