Ejemplo n.º 1
0
        private void loadRecord()
        {
            if (null == tblOpRecord)
            {
                this.tblOpRecord = new DataTable();
                this.tblOpRecord.Columns.Add("TypeCode", typeof(string));
                this.tblOpRecord.Columns.Add("ID", typeof(int));
                this.tblOpRecord.Columns.Add("DeptName", typeof(string));
                this.tblOpRecord.Columns.Add("BedNo", typeof(string));
                this.tblOpRecord.Columns.Add("PatientName", typeof(string));
                this.tblOpRecord.Columns.Add("OpTime", typeof(DateTime));
                this.tblOpRecord.Columns.Add("Content", typeof(string));
                this.tblOpRecord.Columns.Add("Operater", typeof(string));
                this.tblOpRecord.PrimaryKey = new DataColumn[] { this.tblOpRecord.Columns["TypeCode"],
                                                                 this.tblOpRecord.Columns["ID"] };
            }
            else
            {
                this.tblOpRecord.Clear();
                lvRecord.Items.Refresh();
            }

            ComClass.getAcountNameList(AppConst.db, ComClass.Acounts);

            loadCustody();
            loadIntervene();
            loadPMNote();

            this.tblOpRecord.DefaultView.Sort = "OpTime";
            lvRecord.ItemsSource = this.tblOpRecord.DefaultView;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 新增笔记时刷新
        /// </summary>
        /// <param name="_content"></param>
        public void addNote(int _id, string _content)
        {
            this.tblOpRecord.Rows.Add(new object[] { "note", _id, this.patient.WardName,
                                                     this.patient.BedNo, this.patient.PatientName, DateTime.Now,
                                                     _content, ComClass.getEmpName(AppConst.LoginEmpCode) });

            lvRecord.Items.Refresh();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加干预显示
        /// </summary>
        /// <param name="_objName"></param>
        /// <param name="_desc"></param>
        public void addIntervene(int _id, string _objName, string _desc, DateTime _time, string _empCode = null)
        {
            if (null == _empCode)
            {
                _empCode = AppConst.LoginEmpCode;
            }

            this.tblOpRecord.Rows.Add(new object[] { "intervene", _id, _time, _objName + "\r\n" + _desc,
                                                     ComClass.getEmpName(_empCode) });
        }
Ejemplo n.º 4
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     if (0 < this.EditID)
     {
         loadCustody();
     }
     else
     {
         txtIntervener.Text = ComClass.getEmpName(AppConst.db, AppConst.LoginEmpCode);
     }
 }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 6
0
        private void loadCustody()
        {
            DataTable tbl = new DataTable();

            if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_INTERVENE_BYID, this.EditID), ref tbl))
            {
                BLPublic.Dialogs.Error("加载干预失败:" + AppConst.db.Error);
                return;
            }

            txtIntervener.Text = "";
            if (0 < tbl.Rows.Count)
            {
                txtInterveneDesc.Text = tbl.Rows[0]["IntervenePlan"].ToString();
                txtIntervener.Text    = tbl.Rows[0]["Intervener"].ToString();
            }
            tbl.Clear();


            if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_INTERVENE_OBJ, this.EditID), ref tbl))
            {
                BLPublic.Dialogs.Error("加载干预对象失败:" + AppConst.db.Error);
                return;
            }

            BLPublic.BLDataReader bldr = new BLPublic.BLDataReader(tbl.CreateDataReader());
            while (bldr.next())
            {
                setObject(bldr.getString("ObjectType"), bldr.getString("ObjectCode"), bldr.getString("ObjectName"),
                          bldr.getString("ObjectValue"), bldr.getDateTime("ValueTime"));
            }
            bldr.close();
            tbl.Clear();

            if (!string.IsNullOrWhiteSpace(txtIntervener.Text))
            {
                txtIntervener.Text = ComClass.getEmpName(AppConst.db, txtIntervener.Text);
            }
        }
Ejemplo n.º 7
0
        private void loadPatient(DataSet dsPatient)
        {
            lvPatient.Items.Clear();
            string ageStr    = "";
            int    ageMonths = 0;

            if (dsPatient != null && dsPatient.Tables.Count > 0 && dsPatient.Tables[0].Rows.Count > 0)
            {
                DateTime birthday = DateTime.Now;
                foreach (DataRow item in dsPatient.Tables[0].Rows)
                {
                    if (item["Birthday"] != DBNull.Value)//生日为空
                    {
                        birthday = DateTime.Parse(item["Birthday"].ToString());
                    }
                    ageStr = BLPublic.Utils.getAge(birthday, out ageMonths);

                    lvPatient.Items.Add(new PatientModel
                    {
                        PatientCode       = item["PatientCode"].ToString().Trim(),
                        WardCode          = item["DeptCode"].ToString().Trim(),
                        WardName          = item["DeptName"].ToString().Trim(),
                        BedNo             = item["BedNo"].ToString().Trim(),
                        HospitalNo        = item["HospitalNo"].ToString().Trim(),
                        PatientName       = item["PatientName"].ToString().Trim(),
                        Age               = ageStr,
                        AgeMonth          = ageMonths,
                        Sex               = ComClass.getZhSex(item["Sex"].ToString().Trim()),
                        IsHospital        = true,//csw修改,赋值为常量true,原是从数据集中获取,修改sql后不再获取
                        HadNotCheckOrders = dsNoReviewTpnOfPatient.Tables[0].Select("PatientCode = "
                                                                                    + item["PatientCode"].ToString().Trim()).Length == 1,
                        HadTodayOrders = dsTodayTpnOfPatient.Tables[0].Select("PatientCode = "
                                                                              + item["PatientCode"].ToString().Trim()).Length == 1,
                    });
                }
            }
            txtPatientNum.Text = "患者数:" + lvPatient.Items.Count.ToString();
        }
Ejemplo n.º 8
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);
            }
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 显示医嘱
        /// </summary>
        private void listOrders()
        {
            lbOrders.Items.Clear();
            lvTPNItems.Items.Clear();

            if (null == this.tblOrders)
            {
                return;
            }

            this.tpnMnt.loadConfig();

            string rowFilter = "";

            if (true == cbOnlyTPN.IsChecked)
            {
                rowFilter = "OrdersLabel=4";
            }

            this.tblOrders.DefaultView.RowFilter = rowFilter;

            int         tpnLvl       = -1;
            bool        isTPN        = false;
            bool        hadNotChk    = false;
            string      prveRecipeID = "";
            OrdersModel odrModel     = null;

            foreach (DataRow row in this.tblOrders.DefaultView.ToTable().Rows)
            {
                if (!prveRecipeID.Equals(row["RecipeID"].ToString()))
                {
                    prveRecipeID = row["RecipeID"].ToString();
                    isTPN        = "4".Equals(row["OrdersLabel"].ToString());
                    if (row.IsNull("TPNLevel"))
                    {
                        tpnLvl    = -1;
                        hadNotChk = true;
                    }
                    else
                    {
                        tpnLvl = Convert.ToInt32(row["TPNLevel"].ToString());
                    }

                    if (0 > (double)row["Capacity"])
                    {
                        row["Capacity"] = this.tpnMnt.ordersCapacity(row["RecipeID"].ToString());
                    }

                    odrModel = new OrdersModel
                    {
                        RecipeID = prveRecipeID,

                        OrderTime  = ComClass.getDateTimeFmt(Convert.ToDateTime(row["StartTime"].ToString())),
                        StopTime   = row.IsNull("StopTime") ? "--" : ComClass.getDateTimeFmt(Convert.ToDateTime(row["StopTime"].ToString())),
                        UseRoute   = row["UsageCode"].ToString(),
                        FreqCode   = row["FreqCode"].ToString(),
                        Remark     = row["Remark"].ToString(),
                        Capacity   = row["Capacity"].ToString(),
                        GroupNo    = row["GroupNo"].ToString(),
                        CheckLevel = tpnLvl,
                        IsTPN      = isTPN,
                        IsStop     = false,
                        CanMod     = this.canModType
                    };

                    if (isTPN)
                    {
                        if (-1 == tpnLvl)
                        {
                            odrModel.State = "未审方";
                        }
                        else if (0 == tpnLvl)
                        {
                            odrModel.State = "通过";
                        }
                        else
                        {
                            odrModel.State = "未通过";
                        }
                    }
                    else
                    {
                        odrModel.State = "--";
                    }

                    if (!row.IsNull("StopTime"))
                    {
                        odrModel.IsStop = true;
                    }
                    else if ("-1" == row["NowStatus"].ToString())
                    {
                        odrModel.StopTime = "已退方";
                        odrModel.IsStop   = true;
                    }

                    lbOrders.Items.Add(odrModel);
                }

                odrModel.Drugs.Add(new OrdersDrugModel(row["DrugCode"].ToString(), row["DrugName"].ToString(),
                                                       row["DrugSpec"].ToString(),
                                                       BLPublic.Utils.trimZero(row["Dosage"].ToString()),
                                                       row["DosageUnit"].ToString(),
                                                       row["Quantity"].ToString()));
            }

            if (hadNotChk && (null != this.patient))
            {
                this.patient.HadNotCheckOrders = true;
                if (null != this.onRefParent)
                {
                    this.onRefParent();
                }
            }
        }
Ejemplo n.º 11
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);
            }
        }
Ejemplo n.º 12
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);
            }
        }
Ejemplo n.º 13
0
        private bool addRecipe(PatientModel _pnt)
        {
            DataTable tbl = new DataTable();

            if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_PNT_TPN, _pnt.PatientCode) + " ORDER BY StartTime", ref tbl))
            {
                BLPublic.Dialogs.Error("加载患者医嘱失败:" + AppConst.db.Error);
                return(false);
            }

            int no = 1;

            foreach (object obj in lvExpTPN.Items)
            {
                if (!string.IsNullOrWhiteSpace(((ExpTPNRecipe)obj).RecipeID) && !string.IsNullOrWhiteSpace(((ExpTPNRecipe)obj).BedNo))
                {
                    no++;
                }
            }

            string rcpIDs    = "";
            int    startIndx = lvExpTPN.Items.Count;

            BLPublic.BLDataReader dr = new BLPublic.BLDataReader(tbl.CreateDataReader());
            while (dr.next())
            {
                rcpIDs += ",'" + dr.getString("RecipeID") + "'";
                lvExpTPN.Items.Add(new ExpTPNRecipe()
                {
                    No             = (no++).ToString(),
                    RecipeID       = dr.getString("RecipeID"),
                    PatientCode    = _pnt.PatientCode,
                    WardName       = dr.getString("DeptName"),
                    BedNo          = dr.getString("BedNo"),
                    PatientName    = dr.getString("PatientName"),
                    HospitalNo     = dr.getString("HospitalNo"),
                    Age            = dr.getString("Age") + getAgeUnit(dr.getString("AgeUnit")),
                    Sex            = ComClass.getZhSex(dr.getString("Sex")),
                    InHospitalTime = dr.isNull("InHospitalDT") ? "" : dr.getDateTime("InHospitalDT").ToString("yyyy-M-d"),
                    Weight         = "-",
                    Height         = "-",
                    Diagnose       = _pnt.Diagnose,
                    TPNUseTime     = dr.getDateTime("StartTime").ToString("yyyy-MM-dd HH:mm:ss") + " ~ " +
                                     (dr.isNull("StopTime") ? "" : dr.getDateTime("StopTime").ToString("yyyy-MM-dd HH:mm:ss")),
                    StartTime = dr.getDateTime("StartTime"),
                    Drugs     = "",
                    IsOK      = "是"
                });
            }
            dr.close();
            tbl.Clear();

            if (string.IsNullOrWhiteSpace(rcpIDs))
            {
                return(true);
            }

            //加载医嘱内容
            if (!AppConst.db.GetRecordSet(string.Format(SQL.SEL_ORDERSPREP_BYRCPs, rcpIDs.Substring(1)), ref tbl))
            {
                BLPublic.Dialogs.Error("加载医嘱内容失败:" + AppConst.db.Error);
                return(false);
            }

            ExpTPNRecipe item = null;

            DataRow[] rows         = null;
            int       i            = 0;
            int       orderType    = 0;
            string    mntRcpIDs    = "";
            string    tpnChkRcpIDs = "";

            for (i = lvExpTPN.Items.Count - 1; i >= startIndx; i--)
            {
                item = (ExpTPNRecipe)lvExpTPN.Items[i];
                if (string.IsNullOrWhiteSpace(item.RecipeID))
                {
                    continue;
                }


                rows = tbl.Select("RecipeID='" + item.RecipeID + "'");
                foreach (DataRow r in rows)
                {
                    if ("498".Equals(r["UniPreparationID"].ToString())) //卡文
                    {
                        orderType = 498;
                        break;
                    }
                    else if (0x07 > orderType)
                    {
                        orderType |= tpnmonitor.TPNMonitor.getPrepSAFType(Convert.ToInt32(r["UniPreparationID"].ToString()));
                    }
                    else
                    {
                        break;
                    }
                }

                if (0 < rows.Length)
                {
                    if (498 == orderType)
                    {
                        item.Drugs    = "卡文";
                        tpnChkRcpIDs += ",'" + item.RecipeID + "'";
                    }
                    else if (0x07 == orderType)
                    {
                        item.Drugs = "三合一";
                        mntRcpIDs += ",'" + item.RecipeID + "'";
                    }
                    else if (0 < orderType)
                    {
                        item.Drugs    = "二合一";
                        tpnChkRcpIDs += ",'" + item.RecipeID + "'";
                    }
                }
            }
            tbl.Clear();

            if (!string.IsNullOrWhiteSpace(mntRcpIDs))
            {
                monitorResult(mntRcpIDs.Substring(1), startIndx);
            }

            if (!string.IsNullOrWhiteSpace(tpnChkRcpIDs))
            {
                comCheckResult(tpnChkRcpIDs.Substring(1), startIndx);
            }

            return(true);
        }