Ejemplo n.º 1
0
        /// <summary>
        /// 增加规则纪录
        /// </summary>
        /// <param name="patid">病人Id</param>
        /// <param name="eprid">病历Id</param>
        /// <param name="opdoctor">操作医生</param>
        /// <param name="conditionType">时限规则条件类别</param>
        /// <param name="conditionObject">条件对象,用来定位具体的条件</param>
        /// <param name="conditionTime">条件发生时间</param>
        public void AddRuleRecord(int patid, int eprid, string opdoctor, QCConditionType conditionType, object conditionObject, DateTime conditionTime)
        {
            DoctorManagerPatient dmp = _patientdal.SelectDoctorManagerPatient(patid);

            if (dmp == null)
            {
                return;
            }

            QCCondition qcc = QCCondition.SelectQCCondition(conditionType, conditionObject);

            if (qcc == null)
            {
                return;
            }

            IList <QCRule> rules = QCRule.GetRulesByCondition(qcc);

            foreach (QCRule rule in rules)
            {
                QCRuleRecord qcrr = new QCRuleRecord(patid, eprid, rule);
                qcrr.ConditionTime  = conditionTime;
                qcrr.ConditionState = CompleteType.Completed;
                qcrr.RuleState      = RuleRecordState.UndoIntime;
                qcrr.CreateDoctor   = opdoctor;
                SetQcRuleRecordState(rule, qcrr);
                _rulerecorddal.InsertPatientRuleRecord(dmp, qcrr);
            }
        }
Ejemplo n.º 2
0
        void textBoxConditionId_EditValueChanged(object sender, EventArgs e)
        {
            if (textBoxConditionId.EditValue == null)
            {
                return;
            }
            QCCondition qcc = QCCondition.SelectQCCondition(textBoxConditionId.EditValue.ToString());

            FillCondition2Editor(qcc);
            if (_currentRule != null)
            {
                _currentRule.Condition = qcc;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 由于条件取消导致规则记录取消
        /// </summary>
        /// <param name="patid"></param>
        /// <param name="eprid"></param>
        /// <param name="opdoctor"></param>
        /// <param name="conditionType"></param>
        /// <param name="conditionObject"></param>
        /// <param name="conditionTime"></param>
        public void CancelRuleRecord(int patid, int eprid, string opdoctor, QCConditionType conditionType, object conditionObject, DateTime conditionTime)
        {
            DoctorManagerPatient dmp = _patientdal.SelectDoctorManagerPatient(patid);

            if (dmp == null)
            {
                return;
            }

            QCCondition qcc = QCCondition.SelectQCCondition(conditionType, conditionObject);

            if (qcc == null)
            {
                return;
            }

            IList <QCRule> rules = QCRule.GetRulesByCondition(qcc);

            if (rules == null || rules.Count == 0)
            {
                return;
            }

            DataTable dtrulerecords = SelectPatientRuleRecords(patid, false);
            Collection <QCRuleRecord> rulerecords = GetRuleRecordsCollection(dtrulerecords);

            for (int i = 0; i < rulerecords.Count; i++)
            {
                QCRuleRecord qcrr = rulerecords[i];
                if (qcrr.ResultState == CompleteType.Completed)
                {
                    continue;
                }
                QCRule existsrule = ((List <QCRule>) rules).Find(delegate(QCRule rule)
                {
                    return(rule.Id == qcrr.Rule.Id);
                });
                qcrr.RecordState = RecordState.Invalid;
                _rulerecorddal.UpdatePatientRuleRecord(dmp, qcrr);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 数据行 -> 时限
        /// </summary>
        /// <param name="row">数据</param>
        /// <param name="allconditions">所有规则条件</param>
        /// <param name="allresults">所有规则结果</param>
        /// <param name="loadRelated">是否加载相关规则</param>
        /// <returns></returns>
        public QCRule DataRow2QCRule(DataRow row, IList <QCCondition> allconditions, IList <QCResult> allresults, bool loadRelated)
        {
            QCRule rule = DataRow2QCRuleBase(row);

            string conditionId = row[col_ConditionCode].ToString();
            string resultId    = row[col_ResultCode].ToString();
            string groupId     = string.Empty;

            if (row[col_fldm] != DBNull.Value)
            {
                groupId = row[col_fldm].ToString();
            }
            QCCondition qcc  = QCCondition.SelectQCCondition(conditionId);
            QCResult    qcr  = QCResult.SelectQCResult(resultId);
            QCRuleGroup qcrg = QCRuleGroup.SelectQCRuleGroup(groupId);

            rule.Condition = qcc;
            rule.Result    = qcr;
            rule.Group     = qcrg;

            string relaterules = row[col_RelatedRule].ToString();

            if (!string.IsNullOrEmpty(relaterules))
            {
                if (loadRelated)
                {
                    GetRelateRules(rule, relaterules, allconditions, allresults);
                }
                else
                {
                    rule.PreRelateRuleIds = relaterules;
                }
            }

            return(rule);
        }