Example #1
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;
     }
 }
Example #2
0
 /// <summary>
 /// 删除时限规则
 /// xlb 2013-01-06
 /// </summary>
 /// <param name="rule"></param>
 public static void DeleteQcRule(QCRule rule)
 {
     try
     {
         if (rule == null)
         {
             return;
         }
         SqlParameter[] sps = { new SqlParameter("@rulecode", rule.RuleCode == null ? "" : rule.RuleCode) };
         DS_SqlHelper.ExecuteNonQuery(c_sqlDelete, sps, CommandType.Text);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #3
0
        /// <summary>
        /// 插入初始化数据,即外部触发时应该往QCRecord表中插入的一条时限记录信息
        /// </summary>
        /// <param name="noofinpat"></param>
        /// <param name="rule"></param>
        /// <param name="ConfigDataResult"></param>
        public static void InsertInitData(string noofinpat, QCRule rule, DataRow drConfigDataResult)
        {
            try
            {
                SqlParameter[] parms = new SqlParameter[] {
                    new SqlParameter("@noofinpat", SqlDbType.NVarChar),
                    new SqlParameter("@rulecode", SqlDbType.NVarChar),
                    new SqlParameter("@conditioncode", SqlDbType.NVarChar),
                    new SqlParameter("@conditiontime", SqlDbType.NVarChar),
                    new SqlParameter("@realconditiontime", SqlDbType.NVarChar),
                    new SqlParameter("@condition", SqlDbType.Int),
                    new SqlParameter("@reminder", SqlDbType.NVarChar),
                    new SqlParameter("@foulmessage", SqlDbType.NVarChar),
                    new SqlParameter("@docotorlevel", SqlDbType.Int),
                    new SqlParameter("@cycletimes", SqlDbType.Int),
                    new SqlParameter("@memo", SqlDbType.NVarChar),
                    new SqlParameter("@iscycle", SqlDbType.Int),
                    new SqlParameter("@firstcyclerecordid", SqlDbType.NVarChar),
                    new SqlParameter("@timelimit", SqlDbType.Int),
                    new SqlParameter("@qccode", SqlDbType.NVarChar),
                    new SqlParameter("@score", SqlDbType.Decimal)
                };
                parms[0].Value = noofinpat;
                parms[1].Value = rule.RuleCode;
                parms[2].Value = rule.Condition.Code;
                parms[3].Value = (Convert.ToDateTime(drConfigDataResult[rule.Condition.TimeColumnName].ToString())).ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.CurrentCulture);
                DateTime RealConditionTime = Convert.ToDateTime(parms[3].Value).AddSeconds((int)rule.DelayTime);
                parms[4].Value  = RealConditionTime.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.CurrentCulture);
                parms[5].Value  = (int)rule.DelayTime == 0 ? 1 : 0;
                parms[6].Value  = rule.Reminder;
                parms[7].Value  = rule.FoulMessage;
                parms[8].Value  = (int)rule.DoctorLevel;
                parms[9].Value  = rule.MARK == OperationType.Circle ? "1" : "0";
                parms[10].Value = rule.Memo;
                parms[11].Value = rule.MARK == OperationType.Circle ? "1" : "0";
                parms[12].Value = "";
                parms[13].Value = rule.TimeLimit.ToString();
                parms[14].Value = rule.QCCode;
                parms[15].Value = rule.Sorce.ToString();

                DS_SqlHelper.ExecuteNonQuery(c_SqlInsertInitData, parms, CommandType.Text);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #4
0
 /// <summary>
 /// 获得病历质量控制规则库 DataTable -> Dictionary<string, QCRule>
 /// </summary>
 /// <param name="dataTableRules"></param>
 /// <param name="dictCondition"></param>
 /// <param name="dictCategory"></param>
 /// <returns></returns>
 public static Dictionary <string, QCRule> GetAllQCRule(DataTable dataTableRules, Dictionary <string, QCCondition> dictCondition, Dictionary <string, RuleCategory> dictCategory)
 {
     try
     {
         Dictionary <string, QCRule> ruleDictionary = new Dictionary <string, QCRule>();
         foreach (DataRow dr in dataTableRules.Rows)
         {
             QCRule rule = ConvertToQCRuleFromDataRow(dr, dictCondition, dictCategory);
             ruleDictionary.Add(rule.RuleCode, rule);
         }
         return(ruleDictionary);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #5
0
 /// <summary>
 /// 取得时限规则集合
 /// by xlb 2013-01-05
 /// </summary>
 /// <param name="dictCondition"></param>
 /// <param name="dictCategory"></param>
 /// <returns></returns>
 public static IList <QCRule> GetRuleList(Dictionary <string, QCCondition> dictCondition, Dictionary <string, RuleCategory> dictCategory)
 {
     try
     {
         IList <QCRule> ruleList   = new List <QCRule>();
         DataTable      dtRuleList = GetAllQCRules();
         foreach (DataRow dr in dtRuleList.Rows)
         {
             QCRule rule = ConvertToQCRuleFromDataRow(dr, dictCondition, dictCategory);
             ruleList.Add(rule);
         }
         return(ruleList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #6
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;
            }
        }
Example #7
0
        /// <summary>
        /// 从数据行对象转换为质量规则对象,即 DataRow -> QCRule
        /// Modify by xlb 2013-03-25 扣分项可带小数 转换为整型引起错误
        /// </summary>
        /// <param name="dataRowRule"></param>
        /// <param name="dictCondition"></param>
        /// <param name="dictCategory"></param>
        /// <returns></returns>
        static QCRule ConvertToQCRuleFromDataRow(DataRow dataRowRule, Dictionary <string, QCCondition> dictCondition, Dictionary <string, RuleCategory> dictCategory)
        {
            try
            {
                int    result;
                QCRule rule = new QCRule();

                #region QCRule实例赋值
                rule.RuleCode  = dataRowRule["RULECODE"].ToString();
                rule.Condition = dictCondition[dataRowRule["CONDITIONCODE"].ToString()];

                rule.Description = dataRowRule["DESCRIPTION"].ToString();
                rule.Reminder    = dataRowRule["REMINDER"].ToString();
                rule.FoulMessage = dataRowRule["FOULMESSAGE"].ToString();
                rule.DelayTime   = 0;
                if (int.TryParse(dataRowRule["DELAYTIME"].ToString(), out result))
                {
                    rule.DelayTime = result;
                }
                rule.TimeLimit = 0;
                if (int.TryParse(dataRowRule["TIMELIMIT"].ToString(), out result))
                {
                    rule.TimeLimit = result;
                }
                rule.MARK       = (OperationType)Enum.Parse(typeof(OperationType), dataRowRule["MARK"].ToString());
                rule.CycleTimes = 0;
                if (int.TryParse(dataRowRule["CYCLETIMES"].ToString(), out result))
                {
                    rule.CycleTimes = result;
                }
                rule.CycleInterval = 0;
                if (int.TryParse(dataRowRule["CYCLEINTERVAL"].ToString(), out result))
                {
                    rule.CycleInterval = result;
                }
                rule.DoctorLevel = (DoctorGrade)Enum.Parse(typeof(DoctorGrade), dataRowRule["DOCOTORLEVEL"].ToString());

                string sortCode = dataRowRule["SORTCODE"].ToString().Trim();
                if (sortCode != "" && dictCategory.ContainsKey(sortCode))
                {
                    rule.RuleCategory     = dictCategory[sortCode];
                    rule.RuleCategoryName = sortCode + " " + rule.RuleCategory.Description;
                }

                rule.Memo  = dataRowRule["MEMO"].ToString();
                rule.Sorce = 0;
                double Qcscore = 0;
                if (Double.TryParse(dataRowRule["SCORE"].ToString(), out Qcscore))
                {
                    rule.Sorce = Qcscore;
                }
                rule.QCCode = dataRowRule["QCCODE"].ToString();
                rule.Valid  = dataRowRule["VALID"].ToString();
                #endregion

                return(rule);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }