public int Update(ExamModel model) { Mapper.CreateMap <ExamModel, ExamMaster>(); ExamMaster objUser = Dbcontext.ExamMasters.SingleOrDefault(m => m.EID == model.EID); objUser = Mapper.Map(model, objUser); return(Dbcontext.SaveChanges()); }
public ExamModel getByID(int id) { try { Mapper.CreateMap <ExamMaster, ExamModel>(); ExamMaster objCityMaster = Dbcontext.ExamMasters.Where(m => m.EID == id).SingleOrDefault(); ExamModel objCityItem = Mapper.Map <ExamModel>(objCityMaster); return(objCityItem); } catch (Exception ex) { throw ex; } }
public int Insert(ExamModel model) { try { Mapper.CreateMap <ExamModel, ExamMaster>(); ExamMaster objUser = Mapper.Map <ExamMaster>(model); Dbcontext.ExamMasters.Add(objUser); return(Dbcontext.SaveChanges()); } catch (Exception ex) { throw ex; } }
private void ExamList_SelectionChanged(object sender, EventArgs e) { if (this.ExamList.SelectedRows.Count <= 0) { this.txtReportDetial.Clear(); return; } this.ShowStatusMessage("正在下载检查报告,请稍候..."); GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor); ExamMaster examInfo = (ExamMaster)this.ExamList.SelectedRows[0].Tag; if (examInfo != null) { this.LoadExamReportDetial(examInfo.EXAM_ID); } this.ShowStatusMessage(null); GlobalMethods.UI.SetCursor(this, Cursors.Default); }
/// <summary> /// 根据病人ID和就诊号,获取该次住院的检查信息列表 /// </summary> /// <param name="szPatientID">病人编号</param> /// <param name="nVisitID">就诊号</param> /// <param name="lstExamInfo">检查信息列表</param> /// <returns>SystemData.ReturnValue</returns> public short GetInpExamList(string szPatientID, string szVisitID, ref List <ExamMaster> lstExamInfo) { if (GlobalMethods.Misc.IsEmptyString(szPatientID) || GlobalMethods.Misc.IsEmptyString(szVisitID)) { LogManager.Instance.WriteLog("EMRDBAccess.GetInpExamList", "查询参数为空!"); return(SystemData.ReturnValue.PARAM_ERROR); } if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } if (lstExamInfo == null) { lstExamInfo = new List <ExamMaster>(); } else { lstExamInfo.Clear(); } string szField = string.Format("{0},{1},{2},{3},{4},{5},{6}" , SystemData.ExamMasterView.EXAM_ID, SystemData.ExamMasterView.SUBJECT , SystemData.ExamMasterView.REQUEST_TIME, SystemData.ExamMasterView.REQUEST_DOCTOR , SystemData.ExamMasterView.RESULT_STATUS, SystemData.ExamMasterView.REPORT_TIME , SystemData.ExamMasterView.REPORT_DOCTOR); string szTable = SystemData.DataView.EXAM_MASTER; string szCondition = string.Format("{0}='{1}' AND {2}='{3}'" , SystemData.ExamMasterView.PATIENT_ID, szPatientID, SystemData.ExamMasterView.VISIT_ID, szVisitID); string szExamField = SystemData.ExamMasterView.REQUEST_TIME; string szSQL = string.Format(SystemData.SQL.SELECT_WHERE_ORDER_ASC, szField, szTable, szCondition, szExamField); IDataReader dataReader = null; try { dataReader = base.MedQCAccess.ExecuteReader(szSQL, CommandType.Text); if (dataReader == null || dataReader.IsClosed || !dataReader.Read()) { return(SystemData.ReturnValue.RES_NO_FOUND); } do { ExamMaster examInfo = new ExamMaster(); for (int i = 0; i < dataReader.FieldCount; i++) { if (dataReader.IsDBNull(i)) { continue; } switch (dataReader.GetName(i)) { case SystemData.ExamMasterView.EXAM_ID: examInfo.EXAM_ID = dataReader.GetString(i); break; case SystemData.ExamMasterView.PATIENT_ID: examInfo.PATIENT_ID = dataReader.GetString(i); break; case SystemData.ExamMasterView.REPORT_DOCTOR: examInfo.REPORT_DOCTOR = dataReader.GetString(i); break; case SystemData.ExamMasterView.REPORT_TIME: examInfo.REPORT_TIME = dataReader.GetDateTime(i); break; case SystemData.ExamMasterView.REQUEST_DOCTOR: examInfo.REQUEST_DOCTOR = dataReader.GetString(i); break; case SystemData.ExamMasterView.REQUEST_TIME: examInfo.REQUEST_TIME = dataReader.GetDateTime(i); break; case SystemData.ExamMasterView.RESULT_STATUS: examInfo.RESULT_STATUS = dataReader.GetString(i); break; case SystemData.ExamMasterView.SUBJECT: examInfo.SUBJECT = dataReader.GetString(i); break; case SystemData.ExamMasterView.VISIT_ID: examInfo.VISIT_ID = dataReader.GetString(i); break; default: break; } } lstExamInfo.Add(examInfo); } while (dataReader.Read()); return(SystemData.ReturnValue.OK); } catch (Exception ex) { LogManager.Instance.WriteLog("EMRDBAccess.GetInpExamList", new string[] { "szSQL" }, new object[] { szSQL }, "查询检查列表时出现异常!", ex); return(SystemData.ReturnValue.EXCEPTION); } finally { base.MedQCAccess.CloseConnnection(false); } }
/// <summary> /// 加载检查列表 /// </summary> private void LoadExamList() { this.ExamList.SuspendLayout(); this.ExamList.Rows.Clear(); this.ExamList.ResumeLayout(); if (SystemParam.Instance.PatVisitInfo == null) { return; } string szPatientID = SystemParam.Instance.PatVisitInfo.PATIENT_ID; string szVisitID = SystemParam.Instance.PatVisitInfo.VISIT_ID; List <ExamMaster> lstExamInfo = null; if (GlobalMethods.Misc.IsEmptyString(szPatientID) || GlobalMethods.Misc.IsEmptyString(szVisitID)) { return; } short shRet = ExamMasterAccess.Instance.GetInpExamList(szPatientID, szVisitID, ref lstExamInfo); if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND && shRet != SystemData.ReturnValue.CANCEL) { MessageBoxEx.Show("检查记录下载失败!"); return; } if (lstExamInfo == null || lstExamInfo.Count <= 0) { return; } this.ExamList.SuspendLayout(); for (int index = lstExamInfo.Count - 1; index >= 0; index--) { ExamMaster examInfo = lstExamInfo[index]; if (examInfo == null) { continue; } int nRowIndex = this.ExamList.Rows.Add(); DataGridViewRow row = this.ExamList.Rows[nRowIndex]; row.Tag = examInfo; if (examInfo.RESULT_STATUS == "确认报告" && SystemParam.Instance.LocalConfigOption.IsOpenPrintPacs) { ExamResult examResultInfo = null; shRet = ExamResultAccess.Instance.GetExamResultInfo(examInfo.EXAM_ID, ref examResultInfo); if (!string.IsNullOrEmpty(examResultInfo.FILE_PATH)) { row.Cells[this.colFilePath.Index].Value = Properties.Resources.pdf; row.Cells[this.colFilePath.Index].Tag = examResultInfo; } } row.Cells[this.colExamClass.Index].Value = examInfo.SUBJECT; if (examInfo.REQUEST_TIME != examInfo.DefaultTime) { row.Cells[this.colRequestTime.Index].Value = examInfo.REQUEST_TIME.ToString("yyyy-MM-dd"); } row.Cells[this.colRequestDoctor.Index].Value = examInfo.REQUEST_DOCTOR; if (examInfo.REPORT_TIME != examInfo.DefaultTime) { row.Cells[this.colReportTime.Index].Value = examInfo.REPORT_TIME.ToString("yyyy-MM-dd"); } row.Cells[this.colReportDoctor.Index].Value = examInfo.REPORT_DOCTOR; row.Cells[this.colResultStatus.Index].Value = examInfo.RESULT_STATUS; } this.ExamList.ResumeLayout(); }