Exemplo n.º 1
0
        /// <summary>
        /// 从数据行对象转换为条件对象,即 DataRow -> QCCondition
        /// </summary>
        /// <param name="dataRowCondition"></param>
        /// <returns></returns>
        static QCCondition ConvertToQCConditionFromDataRow(DataRow dataRowCondition)
        {
            try
            {
                int         result;
                QCCondition condition = new QCCondition();

                #region QCCondition实例赋值
                condition.Code           = dataRowCondition["CODE"].ToString();
                condition.Description    = dataRowCondition["DESCRIPTION"].ToString();
                condition.TableName      = dataRowCondition["TABLENAME"].ToString();
                condition.ColumnName     = dataRowCondition["COLUMNNAME"].ToString();
                condition.ColumnValue    = dataRowCondition["COLUMNVALUE"].ToString();
                condition.TimeColumnName = dataRowCondition["TimeColumnName"].ToString();
                condition.TimeRange      = 0;
                if (int.TryParse(dataRowCondition["TIMERANGE"].ToString(), out result))
                {
                    condition.TimeRange = result;
                }
                condition.PatNoColumnName = dataRowCondition["PATNOCOLUMNNAME"].ToString();
                condition.DBLink          = dataRowCondition["DBLINK"].ToString();
                condition.Memo            = dataRowCondition["MEMO"].ToString();
                condition.Valide          = dataRowCondition["VALID"].ToString();
                #endregion

                return(condition);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 通过条件获取SQL
 /// </summary>
 /// <param name="rule"></param>
 /// <returns></returns>
 static string GetSqlByQCCondition(QCCondition condition)
 {
     try
     {
         string tableName      = condition.TableName.Trim();
         string columnName     = condition.ColumnName.Trim();
         string columnValue    = condition.ColumnValue.Trim();
         string timeColumnName = condition.TimeColumnName.Trim();
         string timeRange      = Convert.ToString(Convert.ToInt32(condition.TimeRange) / 60 / 60 / 24);//秒 -> 天
         string sql            = string.Empty;
         if (timeColumnName != "" && timeRange != "" && timeRange != "0")
         {
             sql = string.Format(" SELECT * FROM {0} WHERE {1} {2} AND {3} >= SYSDATE - {4} ", tableName, columnName, columnValue, timeColumnName, timeRange);
         }
         else
         {
             sql = string.Format(" SELECT * FROM {0} WHERE {1} {2} ", tableName, columnName, columnValue);
         }
         return(sql);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 取得所有有效时限条件
 /// xlb 2013-01-06
 /// </summary>
 /// <returns></returns>
 public static DataTable GetAllQcCondition2(QCCondition _qcCondition)
 {
     try
     {
         if (_qcCondition == null)
         {
             return(null);
         }
         if (_qcCondition.Code == null)
         {
             _qcCondition.Code = "";
         }
         if (_qcCondition.Description == null)
         {
             _qcCondition.Description = "";
         }
         SqlParameter[] sps =
         {
             new SqlParameter("@code",        _qcCondition.Code),
             new SqlParameter("@description", _qcCondition.Description)
         };
         DataTable dtQCCondition = DS_SqlHelper.ExecuteDataTable(c_SqlQcCondition2, sps, CommandType.Text);
         return(dtQCCondition);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 数据行转化为时限规则条件对象  datarow->QCCondition
        /// xlb 2013-01-06
        /// </summary>
        /// <param name="dataRow"></param>
        /// <returns></returns>
        private QCCondition ConvertToQcCondition(DataRow dataRow)
        {
            try
            {
                QCCondition qcConditon = new QCCondition();

                qcConditon.Code            = dataRow["CODE"].ToString();
                qcConditon.Description     = dataRow["DESCRIPTION"].ToString();
                qcConditon.Memo            = dataRow["MEMO"].ToString();
                qcConditon.TableName       = dataRow["TABLENAME"].ToString();
                qcConditon.ColumnName      = dataRow["COLUMNNAME"].ToString();
                qcConditon.ColumnValue     = dataRow["COLUMNVALUE"].ToString();
                qcConditon.TimeColumnName  = dataRow["TIMECOLUMNNAME"].ToString();
                qcConditon.TimeRange       = (int)dataRow["TIMERANGE"];
                qcConditon.PatNoColumnName = dataRow["PATNOCOLUMNNAME"].ToString();
                qcConditon.DBLink          = dataRow["DBLINK"].ToString();
                qcConditon.Valide          = dataRow["VALID"].ToString();

                return(qcConditon);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 修改时限条件具体信息
 /// by xlb 2013-01-07
 /// </summary>
 /// <param name="qcCondition"></param>
 public static void UpdateCondition(QCCondition qcCondition)
 {
     try
     {
         string sqlUpdateCondition = @"update QCCondition set description=@description,"
                                     + "memo=@memo,tablename=@tablename,columnname=@columnname,"
                                     + "columnvalue=@columnvalue,timecolumnname=@timecolumn,timerange=@timerange,"
                                     + "patnocolumnname=@patnocolumnname,dblink=@dblink where code=@code";
         SqlParameter[] sps =
         {
             new SqlParameter("@description",     qcCondition.Description),
             new SqlParameter("@memo",            qcCondition.Memo),
             new SqlParameter("@tablename",       qcCondition.TableName),
             new SqlParameter("@columnname",      qcCondition.ColumnName),
             new SqlParameter("@columnvalue",     qcCondition.ColumnValue),
             new SqlParameter("@timecolumn",      qcCondition.TimeColumnName),
             new SqlParameter("@timerange",       qcCondition.TimeRange),
             new SqlParameter("@patnocolumnname", qcCondition.PatNoColumnName),
             new SqlParameter("@dblink",          qcCondition.DBLink),
             new SqlParameter("@code",            qcCondition.Code)
         };
         DS_SqlHelper.ExecuteNonQuery(sqlUpdateCondition, sps, CommandType.Text);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// 新增时限条件
 /// xlb 2013-01-06
 /// </summary>
 /// <param name="qcCondition"></param>
 public static void InsertCondition(QCCondition qcCondition)
 {
     try
     {
         string sqlCondtiion = "insert into QCCondition(code,description,valid,memo,tablename,"
                               + "columnname,columnvalue,timecolumnname,timerange,patnocolumnname,dblink) values(@code,"
                               + "@description,@valid,@memo,@tablename,@columnname,@columnvalue,@timecolumnname,@timerange,"
                               + "@patnocolumnname,@dblink)";
         SqlParameter[] sps =
         {
             new SqlParameter("@code",            qcCondition.Code),
             new SqlParameter("@description",     qcCondition.Description),
             new SqlParameter("@valid",           "1"),
             new SqlParameter("@memo",            qcCondition.Memo),
             new SqlParameter("@tablename",       qcCondition.TableName),
             new SqlParameter("@columnname",      qcCondition.ColumnName),
             new SqlParameter("@columnvalue",     qcCondition.ColumnValue),
             new SqlParameter("@timecolumnname",  qcCondition.TimeColumnName),
             new SqlParameter("@timerange",       qcCondition.TimeRange),
             new SqlParameter("@patnocolumnname", qcCondition.PatNoColumnName),
             new SqlParameter("@dblink",          qcCondition.DBLink)
         };
         DS_SqlHelper.ExecuteNonQuery(sqlCondtiion, sps, CommandType.Text);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// 新增时限规则
 /// by xlb 2013-01-06
 /// </summary>
 /// <param name="qcRule"></param>
 public static void InsertQcRule(QCRule qcRule, QCCondition qcCondition, RuleCategory ruleCategory)
 {
     try
     {
         string c_SqlInsert = "insert into QCRule(RULECODE,CONDITIONCODE,DESCRIPTION,"
                              + "REMINDER,FOULMESSAGE,DELAYTIME,TIMELIMIT,MARK,CYCLETIMES,CYCLEINTERVAL,"
                              + "DOCOTORLEVEL,SORTCODE,MEMO,SCORE,QCCODE,valid) values(seq_qcrulecode.nextval,@CONDITIONCODE,@DESCRIPTION,"
                              + "@REMINDER,@FOULMESSAGE,@DELAYTIME,@TIMELIMIT,@MARK,@CYCLETIMES,@CYCLEINTERVAL,@DOCOTORLEVEL,"
                              + "@SORTCODE,@MEMO,@SCORE,@QCCODE,@valid)";
         SqlParameter[] sps =
         {
             new SqlParameter("@CONDITIONCODE", qcCondition.Code),
             new SqlParameter("@DESCRIPTION",   qcRule.Description),
             new SqlParameter("@REMINDER",      qcRule.Reminder),
             new SqlParameter("@FOULMESSAGE",   qcRule.FoulMessage),
             new SqlParameter("@TIMELIMIT",     qcRule.TimeLimit),
             new SqlParameter("@MARK",          qcRule.MARK),
             new SqlParameter("@CYCLETIMES",    qcRule.CycleTimes),
             new SqlParameter("@CYCLEINTERVAL", qcRule.CycleInterval),
             new SqlParameter("@DOCOTORLEVEL",  (int)qcRule.DoctorLevel),
             new SqlParameter("@SORTCODE",      ruleCategory.Code),
             new SqlParameter("@valid",         qcRule.Valid),
             new SqlParameter("@MEMO",          qcRule.Valid),
             new SqlParameter("@DELAYTIME",     qcRule.DelayTime),
             new SqlParameter("@SCORE",         qcRule.Sorce),
             new SqlParameter("@QCCODE",        qcRule.QCCode),
         };
         DS_SqlHelper.ExecuteNonQuery(c_SqlInsert, sps, CommandType.Text);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// 获得配置数据的结果集
        /// </summary>
        /// <returns></returns>
        public static DataTable GetConfigDataResult(QCCondition condition)
        {
            try
            {
                DS_SqlHelper.CreateSqlHelperByDBNameFormDA(condition.DBLink);
                DataTable dtConfigResult = DS_SqlHelper.ExecuteDataTable(GetSqlByQCCondition(condition), CommandType.Text);
                DS_SqlHelper.CreateSqlHelperByDBNameFormDA("EMRDB");

                CheckConfigResult(dtConfigResult, condition.PatNoColumnName);

                #region【特殊处理】如果连接的不是电子病历的数据库,需要通过病人流水号得到电子病历中的首页序号inpatient .noofinpat
                if (condition.DBLink != c_EMRDB)
                {
                    //通过病人流水号获得病人首页序号
                    List <string> patNoList = new List <string>();
                    string        patNos    = string.Empty;
                    foreach (DataRow dr in dtConfigResult.Rows)
                    {
                        string patNo = dr[condition.PatNoColumnName].ToString();
                        if (!patNoList.Contains(patNo))
                        {
                            patNoList.Add(patNo);
                            patNos += "'" + patNo + "',";
                        }
                    }
                    patNos = patNos.Trim(',');
                    DataTable dtInpatient = DS_SqlHelper.ExecuteDataTable(string.Format(c_SqlInpatient, patNos), CommandType.Text);

                    //把病人流水号替换为病人首页序号
                    foreach (DataRow dr in dtConfigResult.Rows)
                    {
                        string  patNo = dr[condition.PatNoColumnName].ToString();
                        DataRow drPat = (from DataRow drInpatient in dtInpatient.Rows
                                         where drInpatient["patnoofhis"].ToString() == patNo
                                         select drInpatient).FirstOrDefault();
                        if (drPat != null)
                        {
                            dr[condition.PatNoColumnName] = drPat["noofinpat"].ToString();
                        }
                    }
                }
                #endregion

                return(dtConfigResult);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// 获得病历质量条件库 DataTable -> Dictionary<string, QCCondition>
 /// </summary>
 /// <param name="dataTableCondition"></param>
 /// <returns></returns>
 public static Dictionary <string, QCCondition> GetAllQCCondition(DataTable dataTableCondition)
 {
     try
     {
         Dictionary <string, QCCondition> dictCondition = new Dictionary <string, QCCondition>();
         foreach (DataRow dr in dataTableCondition.Rows)
         {
             QCCondition condition = ConvertToQCConditionFromDataRow(dr);
             dictCondition.Add(condition.Code, condition);
         }
         return(dictCondition);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// 删除时限规则条件方法
 /// xlb 2013-01-06
 /// </summary>
 /// <param name="_qcCondition"></param>
 public static void DeleteCondition(QCCondition _qcCondition)
 {
     try
     {
         if (_qcCondition == null || string.IsNullOrEmpty(_qcCondition.Code))
         {
             throw new Exception("没有删除的数据");
         }
         string         _sqlCondtionDelete = "update QCCondition set valid=0 where code=@cCode ";
         SqlParameter[] sps = { new SqlParameter("@cCode", SqlDbType.NVarChar) };
         sps[0].Value = _qcCondition.Code;
         DS_SqlHelper.ExecuteNonQuery(_sqlCondtionDelete, sps, CommandType.Text);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 11
0
 /// <summary>
 /// 取得有效时限规则条件集合
 /// add by xlb 2013-01-06
 /// </summary>
 /// <returns></returns>
 public static List <QCCondition> getAllConditions(QCCondition _qcCondition)
 {
     try
     {
         List <QCCondition> qcConditionList  = new List <QCCondition>();
         DataTable          dtTableCondition = GetAllQcCondition2(_qcCondition);
         foreach (DataRow dr in dtTableCondition.Rows)
         {
             QCCondition qcConditon = ConvertToQCConditionFromDataRow(dr);
             qcConditionList.Add(qcConditon);
         }
         return(qcConditionList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// 修改时限规则信息
        /// by xlb 2013-01-07
        /// </summary>
        /// <param name="qcRule"></param>
        public static void UpdateQcRule(QCRule qcRule, QCCondition qcCondition, RuleCategory ruleCategory)
        {
            try
            {
                string c_sqlUpdate = @"update QCRule set conditioncode=@conditioncode,description=@description,reminder=@reminder,"
                                     + "foulmessage=@foculmessage,timelimit=@timelimit,mark=@mark,cycletimes=@cycletimes,"
                                     + "cycleinterval=@cycleinterval,"
                                     + "docotorlevel=@docotorlevel,sortcode=@sortcode,valid=@valid,memo=@memo,"
                                     + "delaytime=@delaytime,score=@score,qccode=@qccode where rulecode=@rulecode";

                SqlParameter[] sps =
                {
                    new SqlParameter("@conditioncode", qcCondition.Code),
                    new SqlParameter("@description",   qcRule.Description),
                    new SqlParameter("@reminder",      qcRule.Reminder),
                    new SqlParameter("@foculmessage",  qcRule.FoulMessage),
                    new SqlParameter("@timelimit",     qcRule.TimeLimit),
                    new SqlParameter("@mark",          (int)qcRule.MARK),
                    new SqlParameter("@cycletimes",    qcRule.CycleTimes),
                    new SqlParameter("@cycleinterval", qcRule.CycleInterval),
                    new SqlParameter("@docotorlevel",  (int)qcRule.DoctorLevel),
                    new SqlParameter("@sortcode",      ruleCategory.Code),
                    new SqlParameter("@valid",         qcRule.Valid),
                    new SqlParameter("@memo",          qcRule.Memo),
                    new SqlParameter("@delaytime",     qcRule.DelayTime),
                    new SqlParameter("@score",         qcRule.Sorce),
                    new SqlParameter("@qccode",        qcRule.QCCode),
                    new SqlParameter("@rulecode",      qcRule.RuleCode)
                };
                DS_SqlHelper.ExecuteNonQuery(c_sqlUpdate, sps, CommandType.Text);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }