/// <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); } }
void FillCondition2Editor(QCCondition condition) { if (condition == null) { return; } textBoxConditionName.Text = condition.Name; comboBoxConditionType.SelectedItem = e2cConditionType.FindChineseEnum(condition.ConditionType as Enum); textBoxConditionParams.Text = condition.JudgeSetting; }
/// <summary> /// 取得指定条件的时限规则 /// </summary> /// <param name="condition"></param> /// <returns></returns> public static IList <QCRule> GetRulesByCondition(QCCondition condition) { IList <QCRule> ret = new List <QCRule>(); foreach (QCRule qcr in _allRules) { if (qcr._condition.Id == condition.Id) { ret.Add(qcr.Clone()); } } return(ret); }
bool SetQcObjectFromEditor() { if (_qcObj == null) { return(false); } string newId = textEditIdEdit.Text; if (_qcObj.IsNew) { if (string.IsNullOrEmpty(newId) || QCCondition.IdIsExisted(newId)) { string msg = ConstRes.cstSaveCheckExistSameId; switch (_editState) { case EditState.Condition: msg = ConstRes.cstSaveCheckExistSameCondId; break; case EditState.Result: msg = ConstRes.cstSaveCheckExistSameResultId; break; default: break; } app.CustomMessageBox.MessageShow(msg); textBoxConditionId.Focus(); return(false); } else { _qcObj.Id = newId; _qcObj.Name = textEditDescriptEdit.Text; } } if (comboBoxTypeEdit.SelectedItem == null) { comboBoxTypeEdit.Focus(); return(false); } if (propertyInfoTree1.QcParams.Settings == null || propertyInfoTree1.QcParams.Settings.Count == 0) { propertyInfoTree1.Focus(); return(false); } _qcObj.SetQcObjInnerKind((QCConditionType)((Enum2Chinese.ChineseEnum)comboBoxTypeEdit.SelectedItem).Value); _qcObj.JudgeSetting = propertyInfoTree1.QcParams.ToString(); return(true); }
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; } }
/// <summary> /// 保存时限规则条件到数据库 /// </summary> /// <param name="condition"></param> public void SaveCondition(QCCondition condition) { if (condition == null) { throw new ArgumentNullException("condition"); } SqlParameter[] sqlparams = InitQCConditionParams(condition); if (condition.IsNew) { _sqlHelper.ExecuteNoneQuery(SQL_InsertCondition, sqlparams); } else { _sqlHelper.ExecuteNoneQuery(SQL_UpdateCondition, sqlparams); } }
/// <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); } }
SqlParameter[] InitQCConditionParams(QCCondition condition) { SqlParameter paramTjdm = new SqlParameter(param_tjdm, SqlDbType.VarChar, 64); SqlParameter paramTjfl = new SqlParameter(param_tjfl, SqlDbType.Int); SqlParameter paramTjms = new SqlParameter(param_tjms, SqlDbType.VarChar, 64); SqlParameter paramTjsz = new SqlParameter(param_tjsz, SqlDbType.VarChar, 1024); SqlParameter paramSjsz = new SqlParameter(param_sjsz, SqlDbType.VarChar, 1024); SqlParameter paramYxjl = new SqlParameter(param_yxjl, SqlDbType.Int); SqlParameter paramMemo = new SqlParameter(param_memo, SqlDbType.VarChar, 64); paramTjdm.Value = condition.Id; paramTjfl.Value = (int)condition.ConditionType + ConstRes.cstCondTypeNo; paramTjms.Value = condition.Name; paramTjsz.Value = condition.JudgeSetting; paramSjsz.Value = condition.TimeSetting; paramYxjl.Value = 1; paramMemo.Value = string.Empty; return(new SqlParameter[] { paramTjdm, paramTjfl, paramTjms, paramTjsz, paramSjsz, paramYxjl, paramMemo }); }
/// <summary> /// 数据行 -> 时限条件 /// </summary> /// <param name="row"></param> /// <returns></returns> public QCCondition DataRow2QCCondition(DataRow row) { if (row == null) { throw new ArgumentNullException("row"); } string condId = row[col_tjdm].ToString(); string condDescription = row[col_tjms].ToString(); QCCondition qcc = new QCCondition(condId, condDescription); qcc.JudgeSetting = row[col_tjsz].ToString(); qcc.TimeSetting = row[col_sjsz].ToString(); if (row[col_tjfl] == DBNull.Value) { qcc.ConditionType = QCConditionType.None; } else { qcc.ConditionType = (QCConditionType)(int.Parse(row[col_tjfl].ToString()) - ConstRes.cstCondTypeNo); } return(qcc); }
/// <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); }
/// <summary> /// 保存时限规则条件 /// </summary> /// <param name="condition"></param> public static void SaveQCCondition(QCCondition condition) { Dal.SaveCondition(condition); }