/// <summary> /// 克隆 /// </summary> /// <returns></returns> public QCScore Clone() { QCScore score = base.Clone() as QCScore; score.PatientInfo = this.PatientInfo.Clone(); return(score); }
/// <summary> /// 病历质控系统,修改一条病案质控问题类别 /// </summary> /// <param name="qcScore">病案质控问题类别</param> /// <param name="szOldEventType">旧的病案质控问题类别名称</param> /// <returns>SystemData.ReturnValue</returns> public short Update(QCScore qcScore) { if (qcScore == null) { LogManager.Instance.WriteLog("", new string[] { "qcScore" } , new object[] { qcScore }, "参数不能为空"); return(SystemData.ReturnValue.PARAM_ERROR); } if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } StringBuilder sbField = new StringBuilder(); sbField.AppendFormat("{0}='{1}'," , SystemData.QCScoreTable.DEPT_NAME, qcScore.DEPT_NAME); sbField.AppendFormat("{0}='{1}'," , SystemData.QCScoreTable.DOC_LEVEL, qcScore.DOC_LEVEL); sbField.AppendFormat("{0}={1}," , SystemData.QCScoreTable.HOS_ASSESS, qcScore.HOS_ASSESS); sbField.AppendFormat("{0}={1}," , SystemData.QCScoreTable.HOS_DATE, base.MedQCAccess.GetSqlTimeFormat(qcScore.HOS_DATE)); sbField.AppendFormat("{0}='{1}'," , SystemData.QCScoreTable.HOS_QCMAN, qcScore.HOS_QCMAN); sbField.AppendFormat("{0}='{1}'," , SystemData.QCScoreTable.HOS_QCMAN_ID, qcScore.HOS_QCMAN_ID); sbField.AppendFormat("{0}='{1}'," , SystemData.QCScoreTable.PATIENT_NAME, qcScore.PATIENT_NAME); sbField.AppendFormat("{0}='{1}'," , SystemData.QCScoreTable.SUBMIT_DOCTOR, qcScore.SUBMIT_DOCTOR); sbField.AppendFormat("{0}='{1}'" , SystemData.QCScoreTable.SUBMIT_DOCTOR_ID, qcScore.SUBMIT_DOCTOR_ID); string szCondition = string.Format("{0}='{1}' AND {2}='{3}'" , SystemData.QCScoreTable.PATIENT_ID, qcScore.PATIENT_ID , SystemData.QCScoreTable.VISIT_ID, qcScore.VISIT_ID); string szSQL = string.Format(SystemData.SQL.UPDATE, SystemData.DataTable.QC_SCORE, sbField.ToString(), szCondition); int nCount = 0; try { nCount = base.MedQCAccess.ExecuteNonQuery(szSQL, CommandType.Text); } catch (Exception ex) { LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, ex); return(SystemData.ReturnValue.EXCEPTION); } if (nCount <= 0) { LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, "SQL语句执行后返回0!"); return(SystemData.ReturnValue.EXCEPTION); } return(SystemData.ReturnValue.OK); }
private void CalHummanScore() { float totalScore = 100; foreach (DataGridViewRow row in this.dgvHummanScore.Rows) { if (row is CollapseDataGridViewRow) { //第一级分类行 CollapseDataGridViewRow FirstRow = (row as CollapseDataGridViewRow); foreach (var item in FirstRow.Rows) { var qcMsgDict = item.Tag as QcMsgDict; if (qcMsgDict == null || string.IsNullOrEmpty(qcMsgDict.MESSAGE)) { continue; } if (item.Cells[this.colCheckBox.Index].Value != null && item.Cells[this.colCheckBox.Index].Value.ToString() == "True") { float point = float.Parse(item.Cells[this.colPoint.Index].Value.ToString()); int errorCount = int.Parse(item.Cells[this.colErrorCount.Index].Value.ToString()); totalScore -= point * errorCount; } } } } this.tpHummanScore.Text = string.Format("人工检测({0})", totalScore); this.txtLevel.Text = DocLevel.GetDocLevel(totalScore); QCScore qcScore = this.tpHummanScore.Tag as QCScore; if (qcScore == null) { qcScore = new QCScore(); } if (SystemParam.Instance.PatVisitInfo == null) { return; } qcScore.DeptCode = SystemParam.Instance.PatVisitInfo.DEPT_CODE; qcScore.DEPT_NAME = SystemParam.Instance.PatVisitInfo.DEPT_NAME; qcScore.PATIENT_NAME = SystemParam.Instance.PatVisitInfo.PATIENT_NAME; qcScore.DOC_LEVEL = DocLevel.GetDocLevel(totalScore); qcScore.HOS_ASSESS = totalScore; qcScore.HOS_DATE = SysTimeHelper.Instance.Now; qcScore.HOS_QCMAN = SystemParam.Instance.UserInfo.USER_NAME; qcScore.HOS_QCMAN_ID = SystemParam.Instance.UserInfo.USER_ID; qcScore.PATIENT_ID = SystemParam.Instance.PatVisitInfo.PATIENT_ID; qcScore.VISIT_ID = SystemParam.Instance.PatVisitInfo.VISIT_ID; qcScore.VISIT_NO = SystemParam.Instance.PatVisitInfo.VISIT_NO; }
private void dataTableView2_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0) { return; } QCScore qcScore = this.dataTableView2.Rows[e.RowIndex].Tag as QCScore; if (qcScore == null) { return; } this.MainForm.SwitchPatient(qcScore.PATIENT_ID, qcScore.VISIT_ID); }
/// <summary> /// 加载系统检查扣分信息 /// </summary> private void LoadSystemScoreInfos() { string szPatientID = SystemParam.Instance.PatVisitInfo.PATIENT_ID; string szVisitID = SystemParam.Instance.PatVisitInfo.VISIT_ID; List <QcCheckResult> lstQcCheckResult = null; short shRet = QcCheckResultAccess.Instance.GetQcCheckResults(SystemParam.Instance.DefaultTime, SystemParam.Instance.DefaultTime, szPatientID, szVisitID, null, null, null, SystemData.StatType.System, ref lstQcCheckResult); if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND) { MessageBoxEx.Show("质控质检问题下载失败!"); return; } foreach (DataGridViewRow item in this.dgvSystemScore.Rows) { QcMsgDict qcMsgDict = item.Tag as QcMsgDict; if (qcMsgDict == null) { continue; } if (lstQcCheckResult == null) { item.Cells[this.col_2_QC_EXPLAIN.Index].Tag = null; item.Visible = false; continue; } QcCheckResult qcCheckResult = lstQcCheckResult.Where(m => m.MSG_DICT_CODE == qcMsgDict.QC_MSG_CODE && m.QC_RESULT == SystemData.QcResult.UnPass).FirstOrDefault(); if (qcCheckResult != null) { item.Cells[this.col_2_ErrorCount.Index].Value = qcCheckResult.ERROR_COUNT; item.Cells[this.col_2_QC_EXPLAIN.Index].Value = qcCheckResult.QC_EXPLAIN; item.Cells[this.col_2_Score.Index].Value = qcCheckResult.SCORE; item.Cells[this.col_2_QC_EXPLAIN.Index].Tag = qcCheckResult; item.DefaultCellStyle.ForeColor = Color.Red; item.Visible = true; } else { item.Cells[this.col_2_QC_EXPLAIN.Index].Tag = null; item.Visible = false; } } //加载评分结果 this.CalSystemScore(); QCScore qcScore = new QCScore(); shRet = QcScoreAccess.Instance.GetQCScore(szPatientID, szVisitID, ref qcScore); this.tpHummanScore.Tag = qcScore; }
public short Save(QCScore qcScore) { short shRet = SystemData.ReturnValue.OK; QCScore oldQcScore = null; shRet = this.GetQCScore(qcScore.PATIENT_ID, qcScore.VISIT_ID, ref oldQcScore); if (oldQcScore != null) { shRet = this.Update(qcScore); } else { shRet = this.Insert(qcScore); } return(shRet); }
/// <summary> /// 保存病历内容扣分 /// </summary> private void SaveHummanScore() { if (this.dgvHummanScore.Rows.Count <= 0) { return; } if (SystemParam.Instance.PatVisitInfo == null) { return; } short shRet = SystemData.ReturnValue.OK; if (this.m_lstQcCheckResult == null) { this.m_lstQcCheckResult = new List <QcCheckResult>(); } this.m_lstQcCheckResult.Clear(); shRet = QcCheckResultAccess.Instance.GetQcCheckResults(SystemParam.Instance.PatVisitInfo.PATIENT_ID, SystemParam.Instance.PatVisitInfo.VISIT_ID, SystemData.StatType.Artificial, ref this.m_lstQcCheckResult); for (int index = 0; index < this.dgvHummanScore.Rows.Count; index++) { DataGridViewRow row = this.dgvHummanScore.Rows[index]; if (row is CollapseDataGridViewRow) { foreach (var item in (row as CollapseDataGridViewRow).Rows) { if (!SaveQcCheckResult(item)) { continue; } } } } //评分明细项保存完毕,保存评分结果到QC_SCORE表 this.CalHummanScore(); QCScore qcScore = this.tpHummanScore.Tag as QCScore; shRet = QcScoreAccess.Instance.Save(qcScore); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.Show("评分结果保存失败"); return; } this.OnHummanScoreSaved(System.EventArgs.Empty); if (qcScore.HOS_ASSESS == 100) { MessageBoxEx.ShowMessage("评分保存成功"); return; } else if (MessageBoxEx.ShowConfirm("评分保存成功,是否通知相关医生整改") == DialogResult.OK) { try { Dialogs.ModifyNoticeForm frm = new Dialogs.ModifyNoticeForm(); frm.ShowDialog(); } catch (Exception ex) { MessageBoxEx.ShowMessage("操作失败,系统发生异常,请联系管理员", ex.ToString()); } } }
/// <summary> /// 获取缺陷率统计所需的基础数据 /// </summary> /// <param name="lstQcCheckResults"></param> /// <returns>SystemData.ReturnValue</returns> public short GetQcScores(DateTime dtDischargeTimeBegin, DateTime dtDischargeTimeEnd, ref List <QCScore> lstQCScores) { if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } StringBuilder sbSql = new StringBuilder(); sbSql.Append("select distinct t1.PATIENT_ID,t1.DEPT_NAME,t1.VISIT_NO,t1.VISIT_ID,t1.PATIENT_NAME,t1.DEPT_CODE,t1.DISCHARGE_TIME,t2.hos_assess "); sbSql.Append(" from pat_visit_v t1,qc_score t2 "); sbSql.Append(" where t1.PATIENT_ID=t2.patient_id(+) and t1.VISIT_ID = t2.visit_id(+)"); sbSql.AppendFormat("and t1.DISCHARGE_TIME > {0} and t1.DISCHARGE_TIME < {1}" , base.MedQCAccess.GetSqlTimeFormat(dtDischargeTimeBegin) , base.MedQCAccess.GetSqlTimeFormat(dtDischargeTimeEnd) ); IDataReader dataReader = null; try { dataReader = base.MedQCAccess.ExecuteReader(sbSql.ToString(), CommandType.Text); if (dataReader == null || dataReader.IsClosed || !dataReader.Read()) { return(SystemData.ReturnValue.RES_NO_FOUND); } if (lstQCScores == null) { lstQCScores = new List <QCScore>(); } lstQCScores.Clear(); do { QCScore qcScore = new QCScore(); for (int i = 0; i < dataReader.FieldCount; i++) { if (dataReader.IsDBNull(i)) { continue; } switch (dataReader.GetName(i)) { case SystemData.PatVisitView.DEPT_NAME: qcScore.DEPT_NAME = dataReader.GetString(i); break; case SystemData.PatVisitView.PATIENT_ID: qcScore.PATIENT_ID = dataReader.GetString(i); break; case SystemData.PatVisitView.VISIT_ID: qcScore.VISIT_ID = dataReader.GetString(i); break; case SystemData.PatVisitView.VISIT_NO: qcScore.VISIT_NO = dataReader.GetString(i); break; case SystemData.QCScoreTable.HOS_ASSESS: qcScore.HOS_ASSESS = float.Parse(dataReader.GetValue(i).ToString()); break; case SystemData.PatVisitView.PATIENT_NAME: qcScore.PATIENT_NAME = dataReader.GetString(i); break; case SystemData.PatVisitView.DEPT_CODE: qcScore.DeptCode = dataReader.GetString(i); break; case SystemData.PatVisitView.DISCHARGE_TIME: qcScore.DischargeTime = dataReader.GetDateTime(i); break; default: break; } } lstQCScores.Add(qcScore); } while (dataReader.Read()); return(SystemData.ReturnValue.OK); } catch (Exception ex) { LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { sbSql.ToString() }, ex); return(SystemData.ReturnValue.EXCEPTION); } finally { base.MedQCAccess.CloseConnnection(false); } }
public short GetQcScores(DateTime dtHosDateTimeBegin, DateTime dtHosDateTimeEnd, string szHosQCManID, ref List <QCScore> lstQCScores) { if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } StringBuilder sbField = new StringBuilder(); sbField.AppendFormat("{0},", SystemData.QCScoreTable.DEPT_NAME); sbField.AppendFormat("{0},", SystemData.QCScoreTable.DOC_LEVEL); sbField.AppendFormat("{0},", SystemData.QCScoreTable.HOS_ASSESS); sbField.AppendFormat("{0},", SystemData.QCScoreTable.HOS_DATE); sbField.AppendFormat("{0},", SystemData.QCScoreTable.HOS_QCMAN); sbField.AppendFormat("{0},", SystemData.QCScoreTable.HOS_QCMAN_ID); sbField.AppendFormat("{0},", SystemData.QCScoreTable.PATIENT_ID); sbField.AppendFormat("{0},", SystemData.QCScoreTable.PATIENT_NAME); sbField.AppendFormat("{0},", SystemData.QCScoreTable.SUBMIT_DOCTOR); sbField.AppendFormat("{0},", SystemData.QCScoreTable.SUBMIT_DOCTOR_ID); sbField.AppendFormat("{0},", SystemData.QCScoreTable.VISIT_ID); sbField.AppendFormat("{0}", SystemData.QCScoreTable.VISIT_NO); string szCondition = string.Format("1=1"); szCondition = string.Format("{0} AND {1} >= {2} AND {1} <= {3}" , szCondition , SystemData.QCScoreTable.HOS_DATE , base.MedQCAccess.GetSqlTimeFormat(dtHosDateTimeBegin) , base.MedQCAccess.GetSqlTimeFormat(dtHosDateTimeEnd)); if (!string.IsNullOrEmpty(szHosQCManID)) { szCondition = string.Format("{0} AND {1}='{2}'" , szCondition , SystemData.QCScoreTable.HOS_QCMAN_ID , szHosQCManID); } string szOrderBy = string.Format("{0},{1},{2}" , SystemData.QCScoreTable.HOS_QCMAN , SystemData.QCScoreTable.DEPT_NAME , SystemData.QCScoreTable.PATIENT_NAME); string szSQL = string.Format(SystemData.SQL.SELECT_WHERE_ORDER_ASC , sbField.ToString(), SystemData.DataTable.QC_SCORE, szCondition, szOrderBy); IDataReader dataReader = null; try { dataReader = base.MedQCAccess.ExecuteReader(szSQL, CommandType.Text); if (dataReader == null || dataReader.IsClosed || !dataReader.Read()) { return(SystemData.ReturnValue.RES_NO_FOUND); } if (lstQCScores == null) { lstQCScores = new List <QCScore>(); } do { QCScore qcScore = new QCScore(); for (int i = 0; i < dataReader.FieldCount; i++) { if (dataReader.IsDBNull(i)) { continue; } switch (dataReader.GetName(i)) { case SystemData.QCScoreTable.DEPT_NAME: qcScore.DEPT_NAME = dataReader.GetValue(i).ToString(); break; case SystemData.QCScoreTable.DOC_LEVEL: qcScore.DOC_LEVEL = dataReader.GetString(i); break; case SystemData.QCScoreTable.HOS_DATE: qcScore.HOS_DATE = DateTime.Parse(dataReader.GetValue(i).ToString()); break; case SystemData.QCScoreTable.HOS_ASSESS: qcScore.HOS_ASSESS = float.Parse(dataReader.GetValue(i).ToString()); break; case SystemData.QCScoreTable.PATIENT_ID: qcScore.PATIENT_ID = dataReader.GetString(i); break; case SystemData.QCScoreTable.PATIENT_NAME: qcScore.PATIENT_NAME = dataReader.GetString(i); break; case SystemData.QCScoreTable.VISIT_ID: qcScore.VISIT_ID = dataReader.GetString(i); break; case SystemData.QCScoreTable.VISIT_NO: qcScore.VISIT_NO = dataReader.GetString(i); break; case SystemData.QCScoreTable.SUBMIT_DOCTOR: qcScore.SUBMIT_DOCTOR = dataReader.GetString(i); break; case SystemData.QCScoreTable.SUBMIT_DOCTOR_ID: qcScore.SUBMIT_DOCTOR_ID = dataReader.GetString(i); break; case SystemData.QCScoreTable.HOS_QCMAN: qcScore.HOS_QCMAN = dataReader.GetString(i); break; case SystemData.QCScoreTable.HOS_QCMAN_ID: qcScore.HOS_QCMAN_ID = dataReader.GetString(i); break; default: break; } } lstQCScores.Add(qcScore); } while (dataReader.Read()); return(SystemData.ReturnValue.OK); } catch (Exception ex) { LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, ex); return(SystemData.ReturnValue.EXCEPTION); } finally { base.MedQCAccess.CloseConnnection(false); } }
/// <summary> /// 病历质控系统,获取病案质量问题分类信息字典列表 /// </summary> /// <param name="lstQCEventTypes">病案质量问题分类信息字典列表</param> /// <returns>SystemData.ReturnValue</returns> public short GetQCScore(string szPatientID, string szVisitID, ref QCScore qcScore) { if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } string szField = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}" , SystemData.QCScoreTable.DOC_LEVEL , SystemData.QCScoreTable.HOS_ASSESS , SystemData.QCScoreTable.HOS_DATE , SystemData.QCScoreTable.HOS_QCMAN , SystemData.QCScoreTable.PATIENT_ID , SystemData.QCScoreTable.SUBMIT_DOCTOR , SystemData.QCScoreTable.SUBMIT_DOCTOR_ID , SystemData.QCScoreTable.VISIT_ID , SystemData.QCScoreTable.VISIT_NO); string szCondtion = string.Format("{0} = '{1}' AND {2}='{3}' " , SystemData.QCScoreTable.PATIENT_ID, szPatientID , SystemData.QCScoreTable.VISIT_ID, szVisitID); string szSQL = string.Format(SystemData.SQL.SELECT_WHERE, szField , SystemData.DataTable.QC_SCORE, szCondtion); IDataReader dataReader = null; try { dataReader = base.MedQCAccess.ExecuteReader(szSQL, CommandType.Text); if (dataReader == null || dataReader.IsClosed || !dataReader.Read()) { return(SystemData.ReturnValue.RES_NO_FOUND); } if (qcScore == null) { qcScore = new QCScore(); } if (!dataReader.IsDBNull(0)) { qcScore.DOC_LEVEL = dataReader.GetValue(0).ToString(); } if (!dataReader.IsDBNull(1)) { qcScore.HOS_ASSESS = float.Parse(dataReader.GetValue(1).ToString()); } if (!dataReader.IsDBNull(2)) { qcScore.HOS_DATE = dataReader.GetDateTime(2); } if (!dataReader.IsDBNull(3)) { qcScore.HOS_QCMAN = dataReader.GetString(3); } if (!dataReader.IsDBNull(4)) { qcScore.PATIENT_ID = dataReader.GetString(4); } if (!dataReader.IsDBNull(5)) { qcScore.SUBMIT_DOCTOR = dataReader.GetString(5); } if (!dataReader.IsDBNull(6)) { qcScore.SUBMIT_DOCTOR_ID = dataReader.GetString(6); } if (!dataReader.IsDBNull(7)) { qcScore.VISIT_ID = dataReader.GetString(7); } if (!dataReader.IsDBNull(8)) { qcScore.VISIT_NO = dataReader.GetString(8); } return(SystemData.ReturnValue.OK); } catch (Exception ex) { LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, ex); return(SystemData.ReturnValue.EXCEPTION); } finally { if (dataReader != null) { dataReader.Close(); dataReader.Dispose(); dataReader = null; } base.MedQCAccess.CloseConnnection(false); } }