private void LoadDiagnosisResult() { this.dataGridView1.SuspendLayout(); this.dataGridView1.Rows.Clear(); this.dataGridView1.ResumeLayout(); if (SystemParam.Instance.PatVisitInfo == null) { return; } string szPatientID = SystemParam.Instance.PatVisitInfo.PATIENT_ID; string szVisitID = SystemParam.Instance.PatVisitInfo.VISIT_ID; List <EMRDBLib.Diagnosis> lstDiagnosisInfo = null; short shRet = PatVisitAccess.Instance.GetDiagnosisInfo(szPatientID, szVisitID, ref lstDiagnosisInfo); if (shRet != SystemData.ReturnValue.OK) { return; } if (lstDiagnosisInfo == null || lstDiagnosisInfo.Count <= 0) { return; } int nRowIndex = 0; DataGridViewRow row = null; for (int index = 0; index < lstDiagnosisInfo.Count; index++) { EMRDBLib.Diagnosis diagnosisInfo = lstDiagnosisInfo[index]; nRowIndex = this.dataGridView1.Rows.Add(); row = this.dataGridView1.Rows[nRowIndex]; row.Cells[this.colDiagnosisDate.Index].Value = diagnosisInfo.DIAGNOSIS_DATE.ToString("yyyy-M-d HH:mm"); row.Cells[this.colDiagnosisType.Index].Value = diagnosisInfo.DIAGNOSIS_TYPE_NAME; row.Cells[this.colNum.Index].Value = diagnosisInfo.DIAGNOSIS_NO; row.Cells[this.colDiagnosisDesc.Index].Value = diagnosisInfo.DIAGNOSIS_DESC; row.Tag = diagnosisInfo; } this.dataGridView1.Tag = SystemParam.Instance.PatVisitInfo; }
private void btnQuery_Click(object sender, EventArgs e) { DeptInfo deptInfo = this.cboDeptName.SelectedItem as DeptInfo; string szDeptCode = null; if (deptInfo != null) { szDeptCode = deptInfo.DEPT_CODE; } if (string.IsNullOrEmpty(this.cboDeptName.Text)) { szDeptCode = null; } GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor); this.ShowStatusMessage("正在查询数据,请稍候..."); this.dataGridView1.Rows.Clear(); List <EMRDBLib.PatVisitInfo> lstPatVisitLog = null; short shRet = PatVisitAccess.Instance.GetPatientListByDisChargeTime(null, DateTime.Parse(dtpStatTimeBegin.Value.ToString("yyyy-M-d 00:00:00")), DateTime.Parse(dtpStatTimeEnd.Value.ToString("yyyy-M-d 23:59:59")), szDeptCode, ref lstPatVisitLog); if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND) { GlobalMethods.UI.SetCursor(this, Cursors.Default); MessageBoxEx.Show("查询数据失败!"); return; } if (lstPatVisitLog == null || lstPatVisitLog.Count <= 0) { GlobalMethods.UI.SetCursor(this, Cursors.Default); MessageBoxEx.Show("没有符合条件的数据!", MessageBoxIcon.Information); return; } List <EMRDBLib.PatDoctorInfo> lstPatDoctorInfos = new List <EMRDBLib.PatDoctorInfo>(); Hashtable hashtable = new Hashtable(); for (int index = 0; index < lstPatVisitLog.Count; index++) { EMRDBLib.PatVisitInfo patLog = lstPatVisitLog[index]; if (!hashtable.ContainsKey(patLog.PATIENT_ID + patLog.VISIT_ID)) { EMRDBLib.PatDoctorInfo patDoctorInfo = new EMRDBLib.PatDoctorInfo(); patDoctorInfo.PatientID = patLog.PATIENT_ID; patDoctorInfo.VisitID = patLog.VISIT_ID; hashtable.Add(patLog.PATIENT_ID + patLog.VISIT_ID, patDoctorInfo); lstPatDoctorInfos.Add(patDoctorInfo); } } //获取三级医生信息 shRet = PatVisitAccess.Instance.GetPatSanjiDoctors(ref lstPatDoctorInfos); for (int index = 0; index < lstPatVisitLog.Count; index++) { EMRDBLib.PatVisitInfo patVisitLog = lstPatVisitLog[index]; int nRowIndex = this.dataGridView1.Rows.Add(); DataGridViewRow row = this.dataGridView1.Rows[nRowIndex]; EMRDBLib.PatDoctorInfo patDoctorInfo = lstPatDoctorInfos.Find(delegate(EMRDBLib.PatDoctorInfo p) { if (p.PatientID == lstPatVisitLog[index].PATIENT_ID && p.VisitID == lstPatVisitLog[index].VISIT_ID) { return(true); } else { return(false); } }); this.SetRowData(row, patVisitLog, patDoctorInfo); } #region 重新绑定出院诊断 List <EMRDBLib.Diagnosis> lstDiagnosInfo = new List <EMRDBLib.Diagnosis>(); shRet = PatVisitAccess.Instance.GetOutPatientFirstDiagnosis(lstPatVisitLog, lstDiagnosInfo); if (shRet == SystemData.ReturnValue.OK && lstDiagnosInfo.Count > 0) { for (int index = 0; index < this.dataGridView1.Rows.Count; index++) { DataGridViewRow row = this.dataGridView1.Rows[index]; EMRDBLib.PatVisitInfo patVisitLog = row.Tag as EMRDBLib.PatVisitInfo; if (patVisitLog == null) { continue; } EMRDBLib.Diagnosis diagnosisInfo = lstDiagnosInfo.Find( delegate(EMRDBLib.Diagnosis p) { return(p.PATIENT_ID == patVisitLog.PATIENT_ID && p.VISIT_ID == patVisitLog.VISIT_ID); }); if (diagnosisInfo != null) { row.Cells[this.colDiagnosis.Index].Value = string.Format("{0}({1})", diagnosisInfo.DIAGNOSIS_DESC, string.IsNullOrEmpty(diagnosisInfo.TREAT_RESULT) ? "未知" : diagnosisInfo.TREAT_RESULT); } } } #endregion #region 重新绑定费用 PatVisitAccess.Instance.GetPatConstInfo(ref lstPatVisitLog); if (lstPatVisitLog == null || lstPatVisitLog.Count <= 0) { GlobalMethods.UI.SetCursor(this, Cursors.Default); MessageBoxEx.Show("费用信息查询失败!", MessageBoxIcon.Information); return; } for (int index = 0; index < this.dataGridView1.Rows.Count; index++) { DataGridViewRow row = this.dataGridView1.Rows[index]; EMRDBLib.PatVisitInfo patVisitLog = row.Tag as EMRDBLib.PatVisitInfo; if (patVisitLog == null) { continue; } EMRDBLib.PatVisitInfo findPatVisitLog = lstPatVisitLog.Find( delegate(EMRDBLib.PatVisitInfo p) { return(p.PATIENT_ID == patVisitLog.PATIENT_ID && p.VISIT_ID == patVisitLog.VISIT_ID); }); if (findPatVisitLog != null) { row.Cells[this.colCost.Index].Value = Math.Round(findPatVisitLog.TOTAL_COSTS, 2).ToString(); } } #endregion this.ShowStatusMessage(null); GlobalMethods.UI.SetCursor(this, Cursors.Default); }