/// <summary> /// 新增一条专家质控病案分配详情记录 /// </summary> /// <param name="qcSpecialCheck"></param> /// <returns></returns> public short SaveQCSpecialDetail(QcSpecialDetail qcSpecialDetail) { if (qcSpecialDetail == null) { LogManager.Instance.WriteLog("DbAccess.SaveQCSpecialDetail", new string[] { "qcSpecialDetail" } , new object[] { qcSpecialDetail }, "参数不能为空"); return(SystemData.ReturnValue.PARAM_ERROR); } string szField = string.Format("{0},{1},{2},{3},{4}" , SystemData.QcSpecialDetailTable.CONFIG_ID , SystemData.QcSpecialDetailTable.PATIENT_ID , SystemData.QcSpecialDetailTable.SPECIAL_ID , SystemData.QcSpecialDetailTable.SPECIAL_NAME , SystemData.QcSpecialDetailTable.VISIT_ID); string szValue = string.Format("'{0}','{1}','{2}','{3}','{4}'" , qcSpecialDetail.ConfigID , qcSpecialDetail.PatientID , qcSpecialDetail.SpecialID , qcSpecialDetail.SpecialName , qcSpecialDetail.VisitID); string szSQL = string.Format(SystemData.SQL.INSERT, SystemData.DataTable.QC_SPECIAL_DETAIL, szField, szValue); int nCount = 0; try { nCount = base.MedQCAccess.ExecuteNonQuery(szSQL, CommandType.Text); } catch (Exception ex) { LogManager.Instance.WriteLog("DbAccess.SaveQCSpecialDetail", new string[] { "szSQL" }, new object[] { szSQL }, ex); return(SystemData.ReturnValue.EXCEPTION); } if (nCount <= 0) { LogManager.Instance.WriteLog("DbAccess.SaveQCSpecialDetail", new string[] { "szSQL" }, new object[] { szSQL }, "SQL语句执行后返回0!"); return(SystemData.ReturnValue.ACCESS_ERROR); } return(SystemData.ReturnValue.OK); }
private void btnSaveResult_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtName.Text.Trim())) { MessageBoxEx.ShowWarning("请设置本次抽检名称"); this.txtName.Focus(); return; } if (this.numCount.Value == 0) { MessageBoxEx.ShowWarning("请输入每科室抽检的病案数"); this.numCount.Focus(); return; } if (this.dataGridView1.Rows.Count <= 0) { MessageBoxEx.ShowWarning("未抽检出病案信息"); return; } if (this.dgvDetailList.Rows.Count <= 0) { MessageBoxEx.ShowWarning("请选择专家!"); return; } if (this.m_QcSpecialCheck == null || this.m_QcSpecialCheck.ConfigID == string.Empty) { this.m_QcSpecialCheck = new QcSpecialCheck(); this.m_QcSpecialCheck.ConfigID = this.m_QcSpecialCheck.MakeConfigID(); this.m_QcSpecialCheck.Creater = SystemParam.Instance.UserInfo.USER_NAME; this.m_QcSpecialCheck.CreateTime = DateTime.Now; } this.m_QcSpecialCheck.Name = this.txtName.Text.Trim(); this.m_QcSpecialCheck.DischargeMode = this.cboDischargeMode.Text.Trim(); this.m_QcSpecialCheck.PatientCondition = this.cboPatientCondition.Text.Trim(); this.m_QcSpecialCheck.PatientCount = this.dataGridView1.Rows.Count; this.m_QcSpecialCheck.PerCount = int.Parse(this.numCount.Text); this.CheckdgvDetailInfos();//移除分配为0份病案的专家 this.m_QcSpecialCheck.SpecialCount = this.dgvDetailList.Rows.Count; this.m_QcSpecialCheck.StartTime = this.dtpBeginTime.Value; this.m_QcSpecialCheck.EndTime = this.dtpEndTime.Value; short shRet = SystemData.ReturnValue.OK; if (this.IsNew) { shRet = SpecialAccess.Instance.SaveQCSpecialCheck(this.m_QcSpecialCheck); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.ShowError("保存失败"); this.m_QcSpecialCheck = null; return; } } else { shRet = SpecialAccess.Instance.UpdateQCSpecialCheck(this.m_QcSpecialCheck); if (shRet != EMRDBLib.SystemData.ReturnValue.OK) { MessageBoxEx.ShowError("保存失败"); return; } } //保存专家质控病案分配详情信息 //先删除之前的配置信息 if (!this.IsNew) { shRet = SpecialAccess.Instance.DeleteQCSpecialDetail(this.m_QcSpecialCheck.ConfigID); } //再保存分配信息 for (int detailIndex = 0; detailIndex < this.dgvDetailList.Rows.Count; detailIndex++) { DataGridViewRow detailRow = this.dgvDetailList.Rows[detailIndex]; List <PatVisitInfo> lstPatVisitLog = detailRow.Cells[this.colPatientCount.Index].Tag as List <PatVisitInfo>; Specialist specialist = detailRow.Tag as Specialist; if (specialist == null) { continue; } if (lstPatVisitLog == null || lstPatVisitLog.Count <= 0) { continue; } foreach (PatVisitInfo item in lstPatVisitLog) { QcSpecialDetail qcSpecialDetail = new QcSpecialDetail(); qcSpecialDetail.ConfigID = this.m_QcSpecialCheck.ConfigID; qcSpecialDetail.PatientID = item.PATIENT_ID; qcSpecialDetail.VisitID = item.VISIT_ID; qcSpecialDetail.SpecialID = specialist.UserID; qcSpecialDetail.SpecialName = specialist.UserName; shRet = SpecialAccess.Instance.SaveQCSpecialDetail(qcSpecialDetail); if (shRet != EMRDBLib.SystemData.ReturnValue.OK) { MessageBoxEx.ShowError("病案分配详情保存失败!"); return; } } } MessageBoxEx.ShowMessage("保存成功"); this.IsNew = false; }
/// <summary> /// 获取专家质控病案分配详情表信息列表 /// </summary> /// <param name="lstQcSpecialCheck"></param> /// <returns></returns> public short GetQCSpecialDetailList(string szConfigID, ref List <QcSpecialDetail> lstQcSpecialDetail) { if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } if (string.IsNullOrEmpty(szConfigID)) { LogManager.Instance.WriteLog("DbAccess.GetQCSpecialDetailList", new string[] { "szConfigID" } , new object[] { szConfigID }, "参数不能为空"); return(SystemData.ReturnValue.PARAM_ERROR); } string szField = string.Format("{0},{1},{2},{3},{4}" , SystemData.QcSpecialDetailTable.CONFIG_ID , SystemData.QcSpecialDetailTable.PATIENT_ID , SystemData.QcSpecialDetailTable.SPECIAL_ID , SystemData.QcSpecialDetailTable.SPECIAL_NAME , SystemData.QcSpecialDetailTable.VISIT_ID ); string szCondition = string.Format("1=1 And {0}='{1}'" , SystemData.QcSpecialDetailTable.CONFIG_ID, szConfigID); string szSQL = string.Format(SystemData.SQL.SELECT_WHERE_ORDER_ASC , szField, SystemData.DataTable.QC_SPECIAL_DETAIL, szCondition , SystemData.QcSpecialDetailTable.SPECIAL_ID); 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 (lstQcSpecialDetail == null) { lstQcSpecialDetail = new List <QcSpecialDetail>(); } do { QcSpecialDetail qcSpecialDetail = new QcSpecialDetail(); if (!dataReader.IsDBNull(0)) { qcSpecialDetail.ConfigID = dataReader.GetString(0); } if (!dataReader.IsDBNull(1)) { qcSpecialDetail.PatientID = dataReader.GetString(1); } if (!dataReader.IsDBNull(2)) { qcSpecialDetail.SpecialID = dataReader.GetString(2); } if (!dataReader.IsDBNull(3)) { qcSpecialDetail.SpecialName = dataReader.GetString(3); } if (!dataReader.IsDBNull(4)) { qcSpecialDetail.VisitID = dataReader.GetString(4); } lstQcSpecialDetail.Add(qcSpecialDetail); } while (dataReader.Read()); return(SystemData.ReturnValue.OK); } catch (Exception ex) { LogManager.Instance.WriteLog("DbAccess.GetQCSpecialDetailList", new string[] { "szSQL" }, new object[] { szSQL }, ex); return(SystemData.ReturnValue.EXCEPTION); } finally { base.MedQCAccess.CloseConnnection(false); } }