コード例 #1
0
ファイル: EmrPainetScoreNew.cs プロジェクト: xuanximoming/key
        /// <summary>
        /// (NEW)将传过来的这个病人的评分信息,填入到评分表的相应位置
        /// add by ywk
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        private DataTable OperatePatPoint(DataTable dt, string mNoofinapt)
        {
            try
            {
                DataTable ResultDt = dt.Copy();//最终要处理此Table
                //DataTable dtpat = m_SqlManager.GetPainetData(mNoofinapt);
                DataTable dtpat   = m_SqlManager.GetEmrPointByNoofinpat(m_NoOfInpat, m_recordid);
                ArrayList notInId = new ArrayList();//记录没有在评分配置表中的配置的项(包括那些根节点)
                //对ResultDt循环,相应的塞值
                for (int i = 0; i < ResultDt.Rows.Count; i++)
                {
                    //for (int j = 0; j < dtpat.Rows.Count; j++)
                    //{
                    //    //if (ResultDt.Rows[i]["ID"].ToString() == dtpat.Rows[j]["ID"].ToString())
                    //    if (ResultDt.Rows[i]["CHILDCODE"].ToString() == dtpat.Rows[j]["CHILDCODE"].ToString())
                    //    {
                    //        double sumpoint = 0;//各项的总扣分
                    //        string koufenly = string.Empty;//扣分理由
                    //        DataRow[] filterow = dtpat.Select("ID='" + ResultDt.Rows[i]["ID"].ToString() + "'");
                    //        for (int k = 0; k < filterow.Length; k++)
                    //        {
                    //            koufenly += filterow[k]["KOUFENLIYOU"].ToString() + "\r\n";
                    //            sumpoint += Double.Parse(filterow[k]["REDPOINT"].ToString());
                    //            ResultDt.Rows[i]["REDPOINT"] = sumpoint.ToString();
                    //            ResultDt.Rows[i]["KOUFENLIYOU"] = koufenly;
                    //        }
                    //    }
                    //}
                    foreach (DataRow dr in dtpat.Rows)
                    {
                        //if (ResultDt.Rows[i]["ID"].ToString() == dtpat.Rows[j]["ID"].ToString())
                        if (ResultDt.Rows[i]["CHILDCODE"].ToString() == dr["CHILDCODE"].ToString())
                        {
                            double    sumpoint = 0;            //各项的总扣分
                            string    koufenly = string.Empty; //扣分理由
                            DataRow[] filterow = dtpat.Select("CHILDCODE='" + ResultDt.Rows[i]["CHILDCODE"].ToString() + "'");
                            //DataTable filterrow = ToDataTable(filterow);
                            for (int k = 0; k < filterow.Length; k++)
                            {
                                koufenly += filterow[k]["PROBLEM_DESC"].ToString() + "\r\n";
                                sumpoint += Double.Parse(filterow[k]["REDUCEPOINT"].ToString());
                                ResultDt.Rows[i]["REDPOINT"]    = sumpoint.ToString();
                                ResultDt.Rows[i]["KOUFENLIYOU"] = koufenly;
                            }
                        }
                    }
                }

                #region old
                //bool isfind = false;//是否找到
                //循环完成后,处理对于在配置中没有配置的选项,比如病案首页,会诊记录等跟节点时,评分表加上它的数据
                //for (int h = 0; h < dtpat.Rows.Count; h++)
                //{
                //    int my = 0;
                //    for (int l = 0; l < ResultDt.Rows.Count; l++)
                //    {
                //        my++;
                //        if (dtpat.Rows[h]["ID"] == ResultDt.Rows[l]["ID"])
                //        {
                //            isfind = false;
                //            break;//找到就break
                //        }
                //        else
                //        {
                //            isfind = true;
                //            if (dtpat.Rows.Count != my)
                //            {
                //                continue;//没找到接着找
                //            }
                //        }
                //    }
                //    if (isfind)
                //    {
                //        notInId.Add(dtpat.Rows[h]["ID"].ToString());
                //    }
                //    break;
                //}
                #endregion
                //ID 小于或者等于0的均是对文件夹评分的(病案首页,会诊记录...)
                DataRow[] findrow = dtpat.Select(" ID<=0");
                for (int s = 0; s < findrow.Length; s++)
                {
                    string id = findrow[s]["ID"].ToString();
                    if (!notInId.Contains(id))
                    {
                        notInId.Add(id);
                    }
                }
                //通过上面存取的ID取得评分内容,加到最终要显示ResultTable中
                for (int n = 0; n < notInId.Count; n++)
                {
                    DataRow[] m_row = dtpat.Select("ID='" + notInId[n].ToString() + "'");
                    for (int m = 0; m < m_row.Length; m++)
                    {
                        ResultDt.ImportRow(m_row[m]);
                    }
                }
                return(ResultDt);//此DataTable可能包含对文件夹评分的情况,(且可能包含重复项数据)
            }
            catch (Exception)
            {
                throw;
            }
        }