Esempio n. 1
0
        private void InitSqlWorkBook()
        {
            try
            {
                lookUpWindowDepartment.SqlHelper = sql_Helper;
                //科室
                DataTable Dept = sql_Helper.ExecuteDataTable("usp_GetMedicalRrecordViewFrm",
                                                             new SqlParameter[] { new SqlParameter("@GetType", "1") }, CommandType.StoredProcedure);
                Dept.Columns["ID"].Caption   = "科室编码";
                Dept.Columns["NAME"].Caption = "科室名称";
                Dictionary <string, int> cols = new Dictionary <string, int>();
                cols.Add("ID", 60);
                cols.Add("NAME", 120);
                SqlWordbook deptWordBook = new SqlWordbook("querybook", Dept, "ID", "NAME", cols, "ID//NAME//PY//WB");
                lookUpEditorDepartment.SqlWordbook = deptWordBook;
                lookUpEditorDepartment.CodeValue   = DS_Common.currentUser.CurrentDeptId;

                //诊断
                this.lookUpWindowInDiag.SqlHelper      = sql_Helper;
                this.lookUpWindowOutDiag.SqlHelper     = sql_Helper;
                this.lookUpWindowCurrentDiag.SqlHelper = sql_Helper;
                Dictionary <string, int> col = new Dictionary <string, int>();
                //edit by cyq 2013-01-07 新版&老板主诊医师(配置)
                DataTable   diagDt = new DataTable();
                string      config = DS_SqlService.GetConfigValueByKey("ImportDiseasesGroupHistoryData");
                XmlDocument doc    = new XmlDocument();
                if (!string.IsNullOrEmpty(config))
                {
                    doc.LoadXml(config);
                }
                XmlNodeList nodeList = doc.GetElementsByTagName("isnew");
                string      isnew    = string.Empty;
                if (null != nodeList && nodeList.Count > 0)
                {
                    isnew = nodeList[0].InnerText;
                }
                if (!string.IsNullOrEmpty(isnew) && isnew.Trim() == "1")
                {//新版主诊医师
                    diagDt = DS_BaseService.GetDiagResourceByUserID(DS_Common.currentUser.Id);
                    if (null == diagDt || diagDt.Rows.Count == 0)
                    {
                        if (!diagDt.Columns.Contains("ICD"))
                        {
                            diagDt.Columns.Add("ICD");
                        }
                        if (!diagDt.Columns.Contains("NAME"))
                        {
                            diagDt.Columns.Add("NAME");
                        }
                        if (!diagDt.Columns.Contains("PY"))
                        {
                            diagDt.Columns.Add("PY");
                        }
                        if (!diagDt.Columns.Contains("WB"))
                        {
                            diagDt.Columns.Add("WB");
                        }
                    }
                    diagDt.Columns["ICD"].Caption  = "诊断编码";
                    diagDt.Columns["NAME"].Caption = "诊断名称";
                    col.Add("ICD", 60);
                    col.Add("NAME", 120);
                    SqlWordbook inWordBook = new SqlWordbook("inDiag", diagDt, "ICD", "NAME", col, "ICD//NAME//PY//WB");
                    this.lookUpEditorInDiag.SqlWordbook = inWordBook;
                    SqlWordbook outWordBook = new SqlWordbook("outDiag", diagDt, "ICD", "NAME", col, "ICD//NAME//PY//WB");
                    this.lookUpEditorOutDiag.SqlWordbook = outWordBook;
                    SqlWordbook currentWordBook = new SqlWordbook("curDiag", diagDt, "ICD", "NAME", col, "ICD//NAME//PY//WB");
                    this.lookUpEditorCurrentDiag.SqlWordbook = currentWordBook;
                }
                else
                {//原版主诊医师
                    #region 原诊断数据集
                    DataTable diagofuser = new DataTable();
                    diagofuser.Columns.Add("ICD");
                    diagofuser.Columns.Add("DIAGNOSIS");
                    diagofuser.Columns.Add("PY");
                    diagofuser.Columns.Add("WB");
                    diagofuser.Columns["ICD"].Caption       = "诊断编码";
                    diagofuser.Columns["DIAGNOSIS"].Caption = "诊断名称";
                    DataTable diag = sql_Helper.ExecuteDataTable("usp_getdiagbyattendphysician",
                                                                 new SqlParameter[] { new SqlParameter("@USERID", m_app.User.Id) }, CommandType.StoredProcedure);
                    if (diag.Rows.Count != 0)
                    {
                        string   diagnames = diag.Rows[0][0].ToString();
                        string[] name      = diagnames.Split(',');
                        for (int i = 0; i < name.Length; i++)
                        {
                            if (name[i].Trim() != "")
                            {
                                if (name[i].Trim().Contains("$"))
                                {
                                    string[] str = name[i].Split('$');
                                    DataRow  dr  = diagofuser.NewRow();
                                    dr[0] = str[0];
                                    dr[1] = str[1];
                                    diagofuser.Rows.Add(dr);
                                }
                                else if (name[i].Trim().Contains("-"))
                                {
                                    string[] str = name[i].Split('-');
                                    DataRow  dr  = diagofuser.NewRow();
                                    dr[0] = str[0];
                                    dr[1] = str[1];
                                    diagofuser.Rows.Add(dr);
                                }
                            }
                        }
                    }
                    #endregion

                    diagDt = diagofuser;
                    new GenerateShortCode(sql_Helper).AutoAddShortCode(diagDt, "DIAGNOSIS");
                    col.Add("ICD", 60);
                    col.Add("DIAGNOSIS", 120);
                    SqlWordbook inWordBook = new SqlWordbook("inDiag", diagDt, "ICD", "DIAGNOSIS", col, "ICD//DIAGNOSIS//PY//WB");
                    this.lookUpEditorInDiag.SqlWordbook = inWordBook;
                    SqlWordbook outWordBook = new SqlWordbook("outDiag", diagDt, "ICD", "DIAGNOSIS", col, "ICD//DIAGNOSIS//PY//WB");
                    this.lookUpEditorOutDiag.SqlWordbook = outWordBook;
                    SqlWordbook currentWordBook = new SqlWordbook("curDiag", diagDt, "ICD", "DIAGNOSIS", col, "ICD//DIAGNOSIS//PY//WB");
                    this.lookUpEditorCurrentDiag.SqlWordbook = currentWordBook;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }