Beispiel #1
0
        /// <summary>
        /// 插入初始化数据,只针对循环时限规则
        /// </summary>
        /// <param name="record"></param>
        public static void InsertInitDataForCircle(QCRecord recordLast, QCRecord recordFirst)
        {
            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  = recordLast.NoOfInpat;
                parms[1].Value  = recordLast.Rule.RuleCode;
                parms[2].Value  = recordLast.Condition.Code;
                parms[3].Value  = recordLast.RealConditionTime.AddSeconds(recordLast.TimeLimit).ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.CurrentCulture);
                parms[4].Value  = recordLast.RealConditionTime.AddSeconds(recordLast.TimeLimit).ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.CurrentCulture);
                parms[5].Value  = 1;//由于循环中的规则没有延迟时间,所以插入即生效
                parms[6].Value  = recordLast.Reminder;
                parms[7].Value  = recordLast.FoulMessage;
                parms[8].Value  = (int)recordLast.DoctorLevel;
                parms[9].Value  = ++recordLast.CycleTimes;//当前是循环的次数
                parms[10].Value = recordLast.Memo;
                parms[11].Value = recordLast.Rule.MARK == OperationType.Circle ? "1" : "0";
                parms[12].Value = recordFirst.ID;
                parms[13].Value = recordLast.TimeLimit;
                parms[14].Value = recordLast.QCCode;
                parms[15].Value = recordLast.Score;

                DS_SqlHelper.ExecuteNonQuery(c_SqlInsertInitData, parms, CommandType.Text);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 从数据行对象转换为质量规则对象,即 DataRow -> QCRule
        /// </summary>
        /// <param name="dataRowRule"></param>
        /// <param name="dictCondition"></param>
        /// <param name="dictCategory"></param>
        /// <returns></returns>
        static QCRecord ConvertToQCRecordFromDataRow(DataRow dataRowRecord,
                                                     Dictionary <string, QCRule> dictRule,
                                                     Dictionary <string, QCCondition> dictCondition,
                                                     Dictionary <string, RuleCategory> dictCategory)
        {
            try
            {
                int      result;
                QCRecord record = new QCRecord();

                #region QCRecord实例赋值
                record.ID                = dataRowRecord["ID"].ToString();
                record.NoOfInpat         = dataRowRecord["NOOFINPAT"].ToString();
                record.NoOfRecord        = dataRowRecord["NOOFRECORD"].ToString();
                record.Rule              = dictRule[dataRowRecord["RULECODE"].ToString()];
                record.Condition         = dictCondition[dataRowRecord["CONDITIONCODE"].ToString()];
                record.ConditionTime     = Convert.ToDateTime(dataRowRecord["CONDITIONTIME"].ToString());
                record.RealConditionTime = Convert.ToDateTime(dataRowRecord["REALCONDITIONTIME"].ToString());
                record.IsConditionFinish = dataRowRecord["CONDITION"].ToString() == "0" ? false : true;
                if (dataRowRecord["RESULTTIME"].ToString() != "")
                {
                    record.ResultTime = Convert.ToDateTime(dataRowRecord["RESULTTIME"].ToString());
                }
                record.IsResultFinish     = dataRowRecord["RESULT"].ToString() == "0" ? false : true;
                record.IsFoul             = dataRowRecord["FOULSTATE"].ToString() == "0" ? false : true;
                record.Reminder           = dataRowRecord["REMINDER"].ToString();
                record.FoulMessage        = dataRowRecord["FOULMESSAGE"].ToString();
                record.OperateTime        = Convert.ToDateTime(dataRowRecord["OPERATETIME"].ToString());
                record.DoctorLevel        = (DoctorGrade)Enum.Parse(typeof(DoctorGrade), dataRowRecord["DOCOTORLEVEL"].ToString());
                record.IsCycle            = dataRowRecord["ISCYCLE"].ToString() == "0" ? false : true;
                record.FirstCycleRecordID = dataRowRecord["FIRSTCYCLERECORDID"].ToString();
                record.CycleTimes         = 0;
                if (int.TryParse(dataRowRecord["CYCLETIMES"].ToString(), out result))
                {
                    record.CycleTimes = result;
                }
                record.Memo      = dataRowRecord["MEMO"].ToString();
                record.TimeLimit = 0;
                if (int.TryParse(dataRowRecord["TIMELIMIT"].ToString(), out result))
                {
                    record.TimeLimit = result;
                }
                record.QCCode         = dataRowRecord["QCCODE"].ToString();
                record.RecordDetailID = dataRowRecord["RECORDDETAILID"].ToString();
                record.Score          = 0;
                if (int.TryParse(dataRowRecord["SCORE"].ToString(), out result))
                {
                    record.Score = result;
                }
                record.IsStopCycle = false;
                if (dataRowRecord["ISSTOPCYCLE"].ToString() == "1")
                {
                    record.IsStopCycle = true;
                }
                #endregion

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