コード例 #1
0
ファイル: DiagForm.cs プロジェクト: xuanximoming/key
        /// <summary>
        /// 根据配置控制哪些诊断按钮要同步诊断信息
        /// add by ywk
        /// </summary>
        /// <param name="emrSetting">配置中的诊断按钮</param>
        /// <param name="mainpagetip">用于区分是哪个版本的首页</param>
        private void SetOutDiagBtnEvent(string emrSetting, string mainpagetip, DiagEntity m_DiagEntity)
        {
            string      type     = string.Empty;
            string      typename = string.Empty;
            string      sql      = string.Empty;
            XmlDocument doc      = new XmlDocument();

            doc.LoadXml(emrSetting);
            XmlNodeList nodeList = doc.GetElementsByTagName("OutDiag");

            if (mainpagetip == "2012")//2012版本的
            {
                if (nodeList.Count > 0)
                {
                    XmlElement ele = nodeList[0] as XmlElement;
                    nodeList = ele.GetElementsByTagName("EmrPad2012");
                    if (nodeList.Count > 0)
                    {
                        ele = nodeList[0] as XmlElement;
                        if (ele.InnerText.Contains(","))
                        {
                            string[] BtnArray = ele.InnerText.ToString().Split(',');
                            if (BtnArray.Length > 0)
                            {
                                for (int k = 0; k < BtnArray.Length; k++)
                                {
                                    if (BtnArray[k].ToString() == lookUpEditDiagType.Text)//判断当前节点的值是不是等于弹出的诊断按钮的名称
                                    {
                                        sql = string.Format(@"INSERT INTO iem_mainpage_diagnosis_2012
                                      (iem_mainpage_diagnosis_no,
                                       iem_mainpage_no,
                                       diagnosis_type_id,
                                       diagnosis_code,
                                       diagnosis_name,
                                       status_id,
                                       order_value,
                                       valide,
                                       create_user,
                                       create_time
                                     )
                                       VALUES
                                      (seq_iem_mainpage_diagnosis_id.NEXTVAL,
                                       '{0}', 
                                       '{1}',
                                       '{2}',
                                       '{3}',
                                       '{4}', 
                                       '{5}',
                                         1,
                                       '{6}', 
                                       TO_CHAR(SYSDATE, 'yyyy-mm-dd HH24:mi:ss')
                                      ) ", m_DiagEntity.IEMMainPageNO, m_DiagEntity.DiagTypeID, m_DiagEntity.DiagCode,
                                                            m_DiagEntity.DiagName, m_DiagEntity.StatusID, m_DiagEntity.Order_Value, m_App.User.Id);
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (ele.InnerText.Trim() == lookUpEditDiagType.Text)//判断当前节点的值是不是等于弹出的诊断按钮的名称
                            {
                                sql = string.Format(@"INSERT INTO iem_mainpage_diagnosis_2012
                          (iem_mainpage_diagnosis_no,
                           iem_mainpage_no,
                           diagnosis_type_id,
                           diagnosis_code,
                           diagnosis_name,
                           status_id,
                           order_value,
                           valide,
                           create_user,
                           create_time
                         )
                           VALUES
                          (seq_iem_mainpage_diagnosis_id.NEXTVAL,
                           '{0}', 
                           '{1}',
                           '{2}',
                           '{3}',
                           '{4}', 
                           '{5}',
                             1,
                           '{6}', 
                           TO_CHAR(SYSDATE, 'yyyy-mm-dd HH24:mi:ss')
                          ) ", m_DiagEntity.IEMMainPageNO, m_DiagEntity.DiagTypeID, m_DiagEntity.DiagCode,
                                                    m_DiagEntity.DiagName, m_DiagEntity.StatusID, m_DiagEntity.Order_Value, m_App.User.Id);
                            }
                        }
                    }
                }
            }
            if (mainpagetip == "sx")//泗县版本的
            {
                if (nodeList.Count > 0)
                {
                    XmlElement ele = nodeList[0] as XmlElement;
                    nodeList = ele.GetElementsByTagName("EmrPadSX");
                    if (nodeList.Count > 0)
                    {
                        //*******************中西医的分开处理************
                        for (int j = 0; j < nodeList.Count; j++)
                        {
                            ele      = nodeList[j] as XmlElement;//第一个节点是代表SXChinese中医(第二个是西医节点)
                            nodeList = ele.GetElementsByTagName("SXChinese");
                        }
                        if (nodeList.Count > 0)
                        {
                            type     = "2";
                            typename = "中医诊断";
                        }
                        //处理中医
                        for (int i = 0; i < nodeList.Count; i++)
                        {
                            ele = nodeList[i] as XmlElement;
                            //每个节点可以包含各个要起作用的按钮名称,并且用,分隔开
                            if (ele.InnerText.Contains(","))
                            {
                                string[] BtnArray = ele.InnerText.ToString().Split(',');
                                if (BtnArray.Length > 0)
                                {
                                    for (int k = 0; k < BtnArray.Length; k++)
                                    {
                                        if (BtnArray[k].ToString() == lookUpEditDiagType.Text)//判断当前节点的值是不是等于弹出的诊断按钮的名称
                                        {
                                            sql = string.Format(@"INSERT INTO iem_mainpage_diagnosis_sx
                                            (iem_mainpage_diagnosis_no,
                                           iem_mainpage_no,
                                           diagnosis_type_id,
                                           diagnosis_code,
                                           diagnosis_name,
                                           status_id,
                                           order_value,
                                           valide,
                                           create_user,
                                           create_time,
                                           type,
                                          typeName)
                                           VALUES
                                          (seq_iem_mainpage_diagnosis_id.NEXTVAL,
                                           '{0}', 
                                           '{1}',
                                           '{2}',
                                           '{3}',
                                           '{4}', 
                                           '{5}',
                                             1,
                                           '{6}', 
                                           TO_CHAR(SYSDATE, 'yyyy-mm-dd HH24:mi:ss'),
                                           '{7}',
                                           '{8}') ", m_DiagEntity.IEMMainPageNO, m_DiagEntity.DiagTypeID, m_DiagEntity.DiagCode,
                                                                m_DiagEntity.DiagName, m_DiagEntity.StatusID, m_DiagEntity.Order_Value, m_App.User.Id, type, typename);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                if (ele.InnerText.Trim() == lookUpEditDiagType.Text)//判断当前节点的值是不是等于弹出的诊断按钮的名称
                                {
                                    sql = string.Format(@"INSERT INTO iem_mainpage_diagnosis_sx
                                    (iem_mainpage_diagnosis_no,
                                   iem_mainpage_no,
                                   diagnosis_type_id,
                                   diagnosis_code,
                                   diagnosis_name,
                                   status_id,
                                   order_value,
                                   valide,
                                   create_user,
                                   create_time,
                                   type,
                                  typeName)
                                   VALUES
                                  (seq_iem_mainpage_diagnosis_id.NEXTVAL,
                                   '{0}', 
                                   '{1}',
                                   '{2}',
                                   '{3}',
                                   '{4}', 
                                   '{5}',
                                     1,
                                   '{6}', 
                                   TO_CHAR(SYSDATE, 'yyyy-mm-dd HH24:mi:ss'),
                                   '{7}',
                                   '{8}') ", m_DiagEntity.IEMMainPageNO, m_DiagEntity.DiagTypeID, m_DiagEntity.DiagCode,
                                                        m_DiagEntity.DiagName, m_DiagEntity.StatusID, m_DiagEntity.Order_Value, m_App.User.Id, type, typename);
                                }
                            }
                        }

                        //处理西医
                        XmlNodeList nodeList1 = doc.GetElementsByTagName("OutDiag");
                        if (nodeList1.Count > 0)
                        {
                            XmlElement ele1 = nodeList1[0] as XmlElement;
                            nodeList1 = ele1.GetElementsByTagName("EmrPadSX");
                            nodeList1 = ele1.GetElementsByTagName("SXEn");
                            if (nodeList1.Count > 0)
                            {
                                type     = "1";
                                typename = "西医诊断";
                            }
                            for (int i = 0; i < nodeList1.Count; i++)
                            {
                                ele = nodeList1[i] as XmlElement;

                                if (ele.InnerText.Contains(","))
                                {
                                    string[] BtnArray = ele.InnerText.ToString().Split(',');
                                    if (BtnArray.Length > 0)
                                    {
                                        for (int k = 0; k < BtnArray.Length; k++)
                                        {
                                            if (BtnArray[k].ToString() == lookUpEditDiagType.Text)//判断当前节点的值是不是等于弹出的诊断按钮的名称
                                            {
                                                sql = string.Format(@"INSERT INTO iem_mainpage_diagnosis_sx
                                                  (iem_mainpage_diagnosis_no,
                                                   iem_mainpage_no,
                                                   diagnosis_type_id,
                                                   diagnosis_code,
                                                   diagnosis_name,
                                                   status_id,
                                                   order_value,
                                                   valide,
                                                   create_user,
                                                   create_time,
                                                   type,
                                                  typeName)
                                                   VALUES
                                                  (seq_iem_mainpage_diagnosis_id.NEXTVAL,
                                                   '{0}', 
                                                   '{1}',
                                                   '{2}',
                                                   '{3}',
                                                   '{4}', 
                                                   '{5}',
                                                     1,
                                                   '{6}', 
                                                   TO_CHAR(SYSDATE, 'yyyy-mm-dd HH24:mi:ss'),
                                                   '{7}',
                                                   '{8}') ", m_DiagEntity.IEMMainPageNO, m_DiagEntity.DiagTypeID, m_DiagEntity.DiagCode,
                                                                    m_DiagEntity.DiagName, m_DiagEntity.StatusID, m_DiagEntity.Order_Value, m_App.User.Id, type, typename);
                                            }
                                        }
                                    }
                                }

                                else
                                {
                                    if (ele.InnerText.Trim() == lookUpEditDiagType.Text)//判断当前节点的值是不是等于弹出的诊断按钮的名称
                                    {
                                        sql = string.Format(@"INSERT INTO iem_mainpage_diagnosis_sx
                                  (iem_mainpage_diagnosis_no,
                                   iem_mainpage_no,
                                   diagnosis_type_id,
                                   diagnosis_code,
                                   diagnosis_name,
                                   status_id,
                                   order_value,
                                   valide,
                                   create_user,
                                   create_time,
                                   type,
                                  typeName)
                                   VALUES
                                  (seq_iem_mainpage_diagnosis_id.NEXTVAL,
                                   '{0}', 
                                   '{1}',
                                   '{2}',
                                   '{3}',
                                   '{4}', 
                                   '{5}',
                                     1,
                                   '{6}', 
                                   TO_CHAR(SYSDATE, 'yyyy-mm-dd HH24:mi:ss'),
                                   '{7}',
                                   '{8}') ", m_DiagEntity.IEMMainPageNO, m_DiagEntity.DiagTypeID, m_DiagEntity.DiagCode,
                                                            m_DiagEntity.DiagName, m_DiagEntity.StatusID, m_DiagEntity.Order_Value, m_App.User.Id, type, typename);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            try
            {
                if (!string.IsNullOrEmpty(sql))
                {
                    m_App.SqlHelper.ExecuteNoneQuery(sql, CommandType.Text);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("出现错误 :" + ex.Message);
            }
        }
コード例 #2
0
ファイル: DiagForm.cs プロジェクト: xuanximoming/key
        private void SaveData(TreeListNode subNode)
        {
            //将界面中的诊断保存到【表:PATDIAG】
            string diagType      = m_DiagTypeID;
            string diagTypeName  = m_DiagName;
            string diagCode      = string.Empty; //诊断ICD编码
            string diagName      = string.Empty; //诊断名称
            string diagDate      = string.Empty; //诊断日期
            string digDoctorID   = string.Empty; //经治医师
            string hoseman       = string.Empty; //实习医师
            string super         = string.Empty; //主治医师
            string superSignDate = string.Empty; //主治日期审核日期
            string remark        = string.Empty; //备注
            string backDiag      = string.Empty; //置后否
            string confirmedFlag = string.Empty; //确诊否
            //int diagNO = 0;//诊断编号
            //int diagSubNO = 0;//子诊断编号
            string id        = string.Empty; //节点ID
            string parentID  = string.Empty; //父节点ID
            string patientID = m_App.CurrentPatientInfo.NoOfFirstPage.ToString();
            string nad       = m_App.CurrentPatientInfo.TimesOfAdmission.ToString();

            diagCode      = subNode.GetValue("DIAG_CODE").ToString();
            diagName      = subNode.GetValue("DIAG_CONTENT").ToString();
            diagDate      = subNode.GetValue("DIAG_DATE").ToString();
            diagDate      = diagDate == "" ? "null" : "to_date('" + diagDate.Split(' ')[0] + "', 'yyyy-mm-dd')";
            digDoctorID   = subNode.GetValue("DIAG_DOCTOR_ID").ToString();
            hoseman       = subNode.GetValue("HOUSEMAN_ID").ToString();
            super         = subNode.GetValue("SUPER_ID").ToString();
            superSignDate = subNode.GetValue("SUPER_SIGN_DATE").ToString();
            superSignDate = superSignDate == "" ? "null" : "to_date('" + superSignDate.Split(' ')[0] + "', 'yyyy-mm-dd')";
            confirmedFlag = subNode.GetValue("CONFIRMED_FLAG").ToString();
            backDiag      = subNode.GetValue("BACK_DIAG").ToString();
            remark        = subNode.GetValue("REMARK").ToString();
            id            = subNode.GetValue("ID").ToString();
            parentID      = subNode.GetValue("PARENT_ID").ToString();

            if (parentID != "0")//有父节点
            {
                diagSubNO++;
            }
            else//没有父节点
            {
                diagNO++;
                diagSubNO = 0;
            }

            string sqlInsert = string.Format(SqlInsertDiag,
                                             m_App.CurrentPatientInfo.NoOfFirstPage, nad, diagType, diagTypeName, diagNO,
                                             diagSubNO, "", diagCode, diagName, diagDate,
                                             digDoctorID, "", "NULL", parentID,
                                             super, superSignDate, "0", hoseman, confirmedFlag, id,
                                             "0", backDiag, remark);

            m_App.SqlHelper.ExecuteNoneQuery(sqlInsert, CommandType.Text);


            #region 在此处理,加入到PATDIAG表后,要相应的加到病案首页中去(iem_mainpage_diagnosis_sx)--ywk
            string    tablename   = string.Empty;                                                  //用于处理两个病案首页诊断信息的处理,区分表名 首页的表
            string    containbase = string.Empty;
            string    diagtable   = string.Empty;                                                  //诊断的表
            string    searchdic   = string.Format(@"select mname from dict_catalog where ccode='AA'");
            DataTable dtse        = m_App.SqlHelper.ExecuteDataTable(searchdic, CommandType.Text); //查询病案首页的值
            if (dtse.Rows.Count > 0)
            {
                containbase = dtse.Rows[0]["mname"].ToString();
            }
            if (containbase.Contains("SX"))//是泗县的
            {
                tablename = "IEM_MAINPAGE_BASICINFO_SX";
                ////diagtable = "iem_mainpage_diagnosis_sx";
            }
            if (containbase.Contains("2012"))
            {
                tablename = "IEM_MAINPAGE_BASICINFO_2012";
                //diagtable = "iem_mainpage_diagnosis_2012";
            }

            //病人的首页序号
            string iem_mainpage_no = string.Empty;
            string type            = string.Empty; //代表是中医诊断还是西医诊断
            string typename        = string.Empty; //类型名称
            string order_value     = string.Empty;

            string    mainpagetip = string.Empty; //用于区分是泗县首页还是2012版本的
            DataTable dt          = new DataTable();
            if (containbase.Contains("SX"))       //是泗县的
            {
                mainpagetip = "sx";
                dt          = m_App.SqlHelper.ExecuteDataTable(string.Format(@"select  iem_mainpage_no from  IEM_MAINPAGE_BASICINFO_SX 
                    where noofinpat='{0}'", m_App.CurrentPatientInfo.NoOfFirstPage), CommandType.Text);
            }
            if (containbase.Contains("2012"))//仁和
            {
                mainpagetip = "2012";
                dt          = m_App.SqlHelper.ExecuteDataTable(string.Format(@"select  iem_mainpage_no from  IEM_MAINPAGE_BASICINFO_2012 
                    where noofinpat='{0}'", m_App.CurrentPatientInfo.NoOfFirstPage), CommandType.Text);
            }
            if (dt.Rows.Count == 0)
            {
                //MessageBox.Show("请先填写此病人病案首页信息!");
                return;
            }
            if (dt.Rows.Count > 0)
            {
                iem_mainpage_no = dt.Rows[0]["iem_mainpage_no"].ToString();
            }

            if (lookUpEditDiagType.Text.Contains("西医"))//这里没取到值
            {
                type     = "1";
                typename = "西医诊断";
            }
            if (lookUpEditDiagType.Text.Contains("中医"))
            {
                type     = "2";
                typename = "中医诊断";
            }

            string searchdiag = string.Empty; //查找诊断SQL语句
            if (containbase.Contains("SX"))   //是泗县的
            {
                searchdiag = string.Format(@"select * from iem_mainpage_diagnosis_sx  where 
               iem_mainpage_no='{0}' and valide='1' ", iem_mainpage_no);
            }
            if (containbase.Contains("2012"))//仁和
            {
                searchdiag = string.Format(@"select * from iem_mainpage_diagnosis_2012 where 
               iem_mainpage_no='{0}' and valide='1' ", iem_mainpage_no);
            }
            DataTable dtdiag = m_App.SqlHelper.ExecuteDataTable(searchdiag, CommandType.Text);
            if (dtdiag.Rows.Count > 0)
            {
                order_value = (dtdiag.Rows.Count + 1).ToString();
            }
            else
            {
                order_value = "0";
            }

            //不允许重复插入处理
            string sql1 = string.Empty;
            if (containbase.Contains("SX"))//是泗县的
            {
                sql1 = string.Format(@"select * from iem_mainpage_diagnosis_sx  where 
               iem_mainpage_no='{0}' and valide='1' and diagnosis_code='{1}'", iem_mainpage_no, diagCode);
            }
            if (containbase.Contains("2012"))//仁和
            {
                sql1 = string.Format(@"select * from iem_mainpage_diagnosis_2012 where 
               iem_mainpage_no='{0}' and valide='1' and diagnosis_code='{1}'", iem_mainpage_no, diagCode);
            }
            DataTable m_dt       = m_App.SqlHelper.ExecuteDataTable(sql1, CommandType.Text);
            string    diagtypeid = string.Empty; //标识是否是主诊断
            if (parentID == "0")                 //是父节点表示主诊断
            {
                diagtypeid = "7";
            }
            else
            {
                diagtypeid = "8";
            }
            if (m_dt.Rows.Count > 0)//病案首页的诊断有数据,进行判断是否已经插入当前诊断
            {
                foreach (DataRow dr in dtdiag.Rows)
                {
                    if (dr["iem_mainpage_no"].ToString() == iem_mainpage_no && dr["diagnosis_code"].ToString() == diagCode)
                    {
                        return;
                    }
                }
            }
            else
            {
                //diagnosis_type_id=7是表示主诊断,8是标识其他诊断
                string sql = string.Empty;//要执行的插入SQL语句
                //两个病案首页的诊断表不一样
                //此处为真正将诊断信息同步插入到首页的操作,在此处读取配置表中的配置信息
                //判断点击的按钮是不是配置中的按钮名称
                string emrSetting = BasicSettings.GetStringConfig("BtnOutDiagEvent");//取得配置表中的配置信息
                //由于处理插入数据的方法都放在了下面,传的参数用实体封装起来
                DiagEntity diagEnt = new DiagEntity();
                //iem_mainpage_no, diagtypeid, diagCode, diagName, "0", order_value, m_App.User.Id, type, typename);
                diagEnt.IEMMainPageNO = iem_mainpage_no;
                diagEnt.DiagTypeID    = diagtypeid;
                diagEnt.DiagCode      = diagCode;
                diagEnt.DiagName      = diagName;
                diagEnt.StatusID      = "0";
                diagEnt.Order_Value   = order_value;
                diagEnt.Type          = type;
                diagEnt.TypeName      = typename;

                SetOutDiagBtnEvent(emrSetting, mainpagetip, diagEnt);
                #region 注释掉的

                //                if (tablename == "IEM_MAINPAGE_BASICINFO_SX")
                //                {
                //                    //其中status_id字段为病案首页插入诊断信息有无选择入院病请(此处为0,为没选择 )
                //                    sql = string.Format(@"INSERT INTO iem_mainpage_diagnosis_sx
                //                          (iem_mainpage_diagnosis_no,
                //                           iem_mainpage_no,
                //                           diagnosis_type_id,
                //                           diagnosis_code,
                //                           diagnosis_name,
                //                           status_id,
                //                           order_value,
                //                           valide,
                //                           create_user,
                //                           create_time,
                //                           type,
                //                          typeName)
                //                           VALUES
                //                          (seq_iem_mainpage_diagnosis_id.NEXTVAL,
                //                           '{0}',
                //                           '{1}',
                //                           '{2}',
                //                           '{3}',
                //                           '{4}',
                //                           '{5}',
                //                             1,
                //                           '{6}',
                //                           TO_CHAR(SYSDATE, 'yyyy-mm-dd HH24:mi:ss'),
                //                           '{7}',
                //                           '{8}') ", iem_mainpage_no, diagtypeid, diagCode, diagName, "0", order_value, m_App.User.Id, type, typename);
                //                }
                //                if (tablename == "IEM_MAINPAGE_BASICINFO_2012")
                //                {
                //                    sql = string.Format(@"INSERT INTO iem_mainpage_diagnosis_2012
                //                          (iem_mainpage_diagnosis_no,
                //                           iem_mainpage_no,
                //                           diagnosis_type_id,
                //                           diagnosis_code,
                //                           diagnosis_name,
                //                           status_id,
                //                           order_value,
                //                           valide,
                //                           create_user,
                //                           create_time
                //                         )
                //                           VALUES
                //                          (seq_iem_mainpage_diagnosis_id.NEXTVAL,
                //                           '{0}',
                //                           '{1}',
                //                           '{2}',
                //                           '{3}',
                //                           '{4}',
                //                           '{5}',
                //                             1,
                //                           '{6}',
                //                           TO_CHAR(SYSDATE, 'yyyy-mm-dd HH24:mi:ss')
                //                          ) ", iem_mainpage_no, diagtypeid, diagCode, diagName, "0", order_value, m_App.User.Id);
                //                }

                //                try
                //                {
                //                    m_App.SqlHelper.ExecuteNoneQuery(sql, CommandType.Text);
                //                }
                //                catch (Exception ex)
                //                {
                //                    MessageBox.Show("出现错误 :" + ex.Message);
                //                }
                #endregion
            }

            #endregion
        }