Beispiel #1
0
        private PatientModel getPatientInfo()
        {
            if (string.IsNullOrWhiteSpace(this.patientCode))
            {
                return(null);
            }

            PatientModel pnt = null;
            IDataReader  dr  = null;

            //体格检查
            if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_PNTINFO, this.patientCode), ref dr))
            {
                BLPublic.BLDataReader blDR = new BLPublic.BLDataReader(dr);
                if (blDR.next())
                {
                    string ageStr = "";
                    if (!blDR.isNull("Birthday"))
                    {
                        ageStr = BLPublic.Utils.getAgeStr(blDR.getDateTime("Birthday"));
                    }

                    pnt = new PatientModel()
                    {
                        WardName    = blDR.getString("DeptName"),
                        BedNo       = blDR.getString("BedNo"),
                        HospitalNo  = blDR.getString("HospitalNo"),
                        PatientName = blDR.getString("PatientName"),
                        Age         = ageStr,
                        Sex         = "f".Equals(blDR.getString("Sex")) ? "女" : "男"
                    };
                }

                blDR.close();
            }

            return(pnt);
        }
Beispiel #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            PatientModel pnt = getPatientInfo();

            if (null == pnt)
            {
                return;
            }

            if (0 < this.editID)
            {
                IDataReader           dr   = null;
                BLPublic.BLDataReader blDR = null;
                if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_RCD, this.editID), ref dr))
                {
                    blDR = new BLPublic.BLDataReader(dr);
                    if (blDR.next())
                    {
                        txtRecorder.Text   = blDR.getString("EmployeeCode");
                        txtRecordTime.Text = blDR.getDateTime("RecordTime").ToString("yyyy-M-d H:m");
                    }

                    blDR.close();
                }

                if (AppConst.db.GetRecordSet(string.Format(SQL.SEL_RCDITEMS, this.editID), ref dr))
                {
                    blDR = new BLPublic.BLDataReader(dr);
                    string itemCode = "";
                    while (blDR.next())
                    {
                        itemCode = blDR.getString("DataItemCode").ToLower();

                        if ("patient.age".Equals(itemCode))
                        {
                            pnt.Age = blDR.getString("ItemValue");
                        }
                        else if ("patient.height".Equals(itemCode))
                        {
                            pnt.Height = blDR.getString("ItemValue");
                        }
                        else if ("patient.weight".Equals(itemCode))
                        {
                            pnt.Weight = blDR.getString("ItemValue");
                        }
                        else if ("bmi".Equals(itemCode))
                        {
                            pnt.BMI = blDR.getString("ItemValue");
                        }
                        else if ("albumin".Equals(itemCode))
                        {
                            pnt.Albumin = blDR.getString("ItemValue");
                        }
                        else if ("diagnose".Equals(itemCode))
                        {
                            pnt.Diagnose = blDR.getString("ItemValue");
                        }

                        else if ("remark".Equals(itemCode))
                        {
                            txtRemark.Text = blDR.getString("ItemValue");
                        }
                        else if ("disease.score".Equals(itemCode))
                        {
                            txtDisTotal.Text = blDR.getString("ItemValue");
                        }
                        else if ("nutrition.score".Equals(itemCode))
                        {
                            txtYYTotal.Text = blDR.getString("ItemValue");
                        }
                        else if ("age70".Equals(itemCode))
                        {
                            cbAge.IsChecked = "√".Equals(blDR.getString("ItemValue"));
                        }
                        else if ("gtscore3".Equals(itemCode))
                        {
                            cbGt3.IsChecked = "√".Equals(blDR.getString("ItemValue"));
                        }
                        else if ("ltscore3".Equals(itemCode))
                        {
                            cbLt3.IsChecked = "√".Equals(blDR.getString("ItemValue"));
                        }
                        else if ("total.score".Equals(itemCode))
                        {
                            txtTotal.Text = blDR.getString("ItemValue");
                        }
                        else
                        {
                            checkItem(itemCode);
                        }
                    }

                    blDR.close();
                }
            }

            grdPatient.DataContext = pnt;
        }
Beispiel #3
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(this.patientCode))
            {
                BLPublic.Dialogs.Alert("没有患者信息");
                return;
            }

            PatientModel pnt = (PatientModel)grdPatient.DataContext;
            string       ID  = "@RcdID";

            if (0 < this.editID)
            {
                ID = this.editID.ToString();
            }

            string sql = string.Format(SQL.ADD_RCD_ITEM, ID, "patient.age", pnt.Age);

            sql += string.Format(SQL.ADD_RCD_ITEM, ID, "patient.height", pnt.Height);
            sql += string.Format(SQL.ADD_RCD_ITEM, ID, "patient.weight", pnt.Weight);
            sql += string.Format(SQL.ADD_RCD_ITEM, ID, "BMI", pnt.BMI);
            sql += string.Format(SQL.ADD_RCD_ITEM, ID, "albumin", pnt.Albumin);
            sql += string.Format(SQL.ADD_RCD_ITEM, ID, "diagnose", pnt.Diagnose);
            sql += string.Format(SQL.ADD_RCD_ITEM, ID, "remark", txtRemark.Text);
            sql += string.Format(SQL.ADD_RCD_ITEM, ID, "disease.score", txtDisTotal.Text);
            sql += string.Format(SQL.ADD_RCD_ITEM, ID, "nutrition.score", txtYYTotal.Text);
            sql += string.Format(SQL.ADD_RCD_ITEM, ID, "total.score", txtTotal.Text);
            if (true == cbAge.IsChecked)
            {
                sql += string.Format(SQL.ADD_RCD_ITEM, ID, "age70", check2Label(cbAge));
            }
            if (true == cbGt3.IsChecked)
            {
                sql += string.Format(SQL.ADD_RCD_ITEM, ID, "gtscore3", check2Label(cbGt3));
            }
            if (true == cbLt3.IsChecked)
            {
                sql += string.Format(SQL.ADD_RCD_ITEM, ID, "ltscore3", check2Label(cbLt3));
            }

            foreach (string item in this.lstCheckItem)
            {
                sql += string.Format(SQL.ADD_RCD_ITEM, ID, item, "√");
            }


            if (0 < this.editID)
            {
                sql = string.Format(SQL.DEL_RCD_ITEM_BYRCD, this.editID) + sql;
            }
            else
            {
                sql = string.Format(SQL.ADD_RCD, this.patientCode, AppConst.LoginEmpCode) + sql;
            }

            if (AppConst.db.ExecSQL(sql))
            {
                this.DialogResult = true;
                this.Close();
            }
            else
            {
                BLPublic.Dialogs.Error("保存评价失败:" + AppConst.db.Error);
            }
        }
Beispiel #4
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);
        }