/// <summary> /// 确定事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_OK_Click(object sender, EventArgs e) { try { //设置当前病人(修复m_App病人丢失问题) if (null == m_App || null == m_App.CurrentPatientInfo || m_App.CurrentPatientInfo.NoOfFirstPage.ToString() != m_IemInfo.IemBasicInfo.NoOfInpat) { CurrentInpatient = DS_SqlService.GetPatientInfo(m_IemInfo.IemBasicInfo.NoOfInpat); } else { CurrentInpatient = m_App.CurrentPatientInfo; } GetUI(); if (null != CurrentInpatient) { CurrentInpatient.ReInitializeAllProperties(); } IemMainPageManger manger = new IemMainPageManger(m_App, CurrentInpatient); manger.SaveData(m_IemInfo); //add by cyq 2012-12-05 病案室人员编辑后状态改为已归档 if (editFlag) { DS_BaseService.SetRecordsRebacked(int.Parse(CurrentInpatient.NoOfFirstPage.ToString().Trim())); } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 设置编辑器的编辑模式 /// </summary> private void SetEmrDocumentModel() { try { if (CurrentForm != null) { CurrentForm.CurrentEditorControl.EMRDoc.Info.DocumentModel = DrectSoft.Library.EmrEditor.Src.Document.DocumentModel.Clear;//默认不显示修改痕迹 CurrentForm.CurrentEditorControl.EMRDoc.Info.ShowParagraphFlag = false; } //m_PatUtil = new PatRecUtil(); //根据系统参数配置控制,历史病历展示界面的病历是否可以插入和复制 add by ywk 2012年12月7日10:58:56 string IsShowExportHistory = DS_SqlService.GetConfigValueByKey(("IsShowExportHistory")); if (IsShowExportHistory == "0") { barLargeButtonItemInsert.Visibility = BarItemVisibility.Never; barLargeButtonItemCopy.Visibility = BarItemVisibility.Never; } else { barLargeButtonItemInsert.Visibility = BarItemVisibility.Always; barLargeButtonItemCopy.Visibility = BarItemVisibility.Always; } } catch (Exception) { throw; } }
/// <summary> /// 根据传进来的KEY返回是否显示此模块相关按钮 /// add by ywk 2013年6月6日 11:24:45 /// 针对文书录入主体的控制是否显示LIS PACS 医嘱信息 /// </summary> /// 二次更改(新增一个参数,配置名称+键名称)ywk 2013年6月13日 10:04:09 /// <returns></returns> public static bool IsShowThisMD(string configkeyname, string showkey) { bool IsShowthismoudle = true; string configvalue = DS_SqlService.GetConfigValueByKey(configkeyname); Dictionary <string, string> myDic = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(configvalue)) { string[] value = configvalue.Split('-'); if (value.Length > 0) { for (int i = 0; i < value.Length; i++) { myDic.Add(value[i].Substring(0, value[i].ToString().IndexOf(',')), value[i].Substring(value[i].ToString().IndexOf(',') + 1, value[i].ToString().Length - value[i].ToString().IndexOf(',') - 1)); } foreach (string item in myDic.Keys) { if (item == showkey && myDic[showkey].ToString() == "0") { IsShowthismoudle = false; break; } else { IsShowthismoudle = true; } } } } return(IsShowthismoudle); }
private void XtraFormPatientInfo_Load(object sender, EventArgs e) { try { string sqlEmr = " select patnoofhis from inpatient where noofinpat = '{0}' "; string patnoofhis = m_app.SqlHelper.ExecuteScalar(string.Format(sqlEmr, m_NoOfInpat)).ToString(); DataTable dt = new DataTable(); //从his查病人信息功能 if (DS_SqlService.GetConfigValueByKey("GetInpatientForHis") == "1") { IDataAccess sqlHelper = DataAccessFactory.GetSqlDataAccess("HISDB"); if (sqlHelper == null) { m_app.CustomMessageBox.MessageShow("无法连接到HIS", CustomMessageBoxKind.ErrorOk); return; } string sqlHis = " select * from zc_inpatient where zc_inpatient.patnoofhis = '{0}' "; dt = sqlHelper.ExecuteDataTable(string.Format(sqlHis, patnoofhis), CommandType.Text); } else { dt = m_app.SqlHelper.ExecuteDataTable(string.Format(" select * from inpatient where noofinpat = '{0}' ", m_NoOfInpat), CommandType.Text); } InitPatientInfo(dt); } catch (Exception ex) { string ErrorMessage = ex.Message; m_app.CustomMessageBox.MessageShow("调用HIS时出错,请联系管理员!", CustomMessageBoxKind.ErrorOk); } }
/// <summary> /// /根据首页序号和病历分类获取共有多少病历文件信息 /// </summary> /// <param name="m_Noofinpat"></param> /// <param name="sortid"></param> /// <returns></returns> private string GetRecordBySortID(string m_Noofinpat, string sortid) { string tooltipcontent = "条:"; string sqlserach = string.Format(@"select name from recorddetail where noofinpat='{0}' and sortid ='{1}' and valid=1 ", m_Noofinpat, sortid); int recordcount = 0;//此类型病历共几条 switch (sortid) { case "AL": //会诊单独处理 recordcount = DS_SqlService.GetConsultRecrod(Int32.Parse(m_Noofinpat)).Rows.Count; break; default: break; } DataTable dtPatRecordData = m_app.SqlHelper.ExecuteDataTable(sqlserach); if (dtPatRecordData != null && dtPatRecordData.Rows.Count > 0) { recordcount = dtPatRecordData.Rows.Count; tooltipcontent = recordcount.ToString() + tooltipcontent; for (int i = 0; i < dtPatRecordData.Rows.Count; i++) { tooltipcontent += dtPatRecordData.Rows[i]["name"].ToString() + "\r\n"; } } if (dtPatRecordData.Rows.Count == 0) { tooltipcontent = "0条记录"; } return(tooltipcontent); }
/// <summary> /// tabcontrol切换事件 /// Add xlb 2013-03-04 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void xtraTabControl1_SelectedPageChanged(object sender, TabPageChangedEventArgs e) { try { if (xtraTabControl1.SelectedTabPage == xtraEmrInpat) { string config = DS_SqlService.GetConfigValueByKey("IsNewUcInput"); if (null != config && config.Trim() == "1") { AddEmrInputNew(); } else { AddEmrInput(); LoadEmrContent(); } } else if (xtraTabControl1.SelectedTabPage == xtraRecord) { if (consultZDR == ConsultRecordForWrite.MultiEmployee) { InitData(); } } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 初始化数据 --- 病种列表 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2012-12-28</date> private void InitData() { try { //获取所有病种列表 DataTable dt = DS_SqlService.GetDiagnosis(); dt.Columns.Add(new DataColumn("FLAG", typeof(bool))); DataRow[] listArry = dt.Select(" 1=1 "); if (allSource.Rows.Count == 0) { allSource = listArry.Length == 0 ? new DataTable() : listArry.CopyToDataTable(); } string searchStr = this.txt_search.Text.ToUpper(); if (groupID == -1) {//新增 foreach (DataRow dr in listArry) { dr["FLAG"] = false; } notCheckedList = listArry.ToList(); } else {//编辑 DataTable thisGroupDt = DS_SqlService.GetDiseaseGroupByID(groupID); if (null == thisGroupDt || thisGroupDt.Rows.Count == 0) { return; } this.txt_groupName.Text = null == thisGroupDt.Rows[0]["NAME"] ? "" : thisGroupDt.Rows[0]["NAME"].ToString(); this.txt_memo.Text = null == thisGroupDt.Rows[0]["MEMO"] ? "" : thisGroupDt.Rows[0]["MEMO"].ToString(); List <string> idList = thisGroupDt.Rows[0]["diseaseids"].ToString().Split('$').ToList(); checkedList.Clear(); notCheckedList.Clear(); //已勾选项 不过滤 var checkedEnu = listArry.Where(p => null != p["ICD"] && idList.Contains(p["ICD"].ToString())).OrderBy(q => q["NAME"]); foreach (DataRow dr in checkedEnu) { dr["FLAG"] = true; checkedList.Add(dr); } //对未勾选项进行过滤 var notCheckedEnu = listArry.Where(p => null != p["ICD"] && !idList.Contains(p["ICD"].ToString()) && (p["ICD"].ToString().Contains(searchStr) || p["NAME"].ToString().Contains(searchStr) || p["PY"].ToString().Contains(searchStr) || p["WB"].ToString().Contains(searchStr))).OrderBy(q => q["NAME"]); foreach (DataRow dr in notCheckedEnu) { dr["FLAG"] = false; notCheckedList.Add(dr); } RefreshDiseaseTextArea(); } DataTable endDt = checkedList.Union(notCheckedList).CopyToDataTable(); defaultSource = endDt.Copy(); this.gridControl_disease.DataSource = endDt; } catch (Exception ex) { throw new Exception(ex.Message); } }
private void InitCheckEdit() { try { //checkEditIsShowDailyEmrPreView.Visible = false; //labelControlShowDailyEmrPreView.Visible = false; //Add By wwj 2013-04-27 Dictionary <string, UCEmrInputPreView> collection = m_UCEmrInputBody.TempDailyPreViewCollection; //判断该病历对应的病程预览区有没有保存在TempDailyPreViewCollection,如果已经在集合中保存则不显示 if (collection.ContainsKey(m_EmrModel.DeptChangeID)) { checkEditIsShowDailyEmrPreView.Visible = false; labelControlShowDailyEmrPreView.Visible = false; } else { string config = DS_SqlService.GetConfigValueByKey("EmrSetting"); XmlDocument doc = new XmlDocument(); doc.LoadXml(config); XmlNode node = doc.SelectSingleNode("Emr/IsShowDailyPreViewWhenNewDailyEmr"); string isCheck = null != node ? node.InnerText : string.Empty; if (!string.IsNullOrEmpty(isCheck.Trim()) && isCheck == "1") { checkEditIsShowDailyEmrPreView.Checked = true; } } } catch (Exception) { throw; } }
/// <summary> /// 搜索模板树 /// by cyq 2012-09-25 /// </summary> /// <param name="refresh">是否从数据库刷新数据</param> /// <param name="catalog">模板‘病历类别’</param> /// <param name="keyword">搜索关键字</param> private void SearchPersonTree(bool refresh, string catalog, string keyword) { try { if ((null == m_MyTreeFolders) || (refresh)) { m_MyTreeFolders = DS_SqlService.GetPersonTempleteFloder(DS_Common.currentUser.CurrentDeptId, DS_Common.currentUser.Id); m_MyLeafs = DS_SqlService.GetPersonTemplete(DS_Common.currentUser.CurrentDeptId, DS_Common.currentUser.Id); } //所有符合搜索条件的模板集合 var serchedLeafs = m_MyLeafs.AsEnumerable().Where(p => p["Name"].ToString().Contains(keyword)); IEnumerable<DataRow> allFolders = m_MyTreeFolders.AsEnumerable(); //所有符合搜索条件的分类ID集合 List<string> list = new List<string>(); foreach (DataRow leaf in serchedLeafs) { list = GetSearchParentIDs(list, allFolders, leaf, 0); } var allSearchedFolders = m_MyTreeFolders.AsEnumerable().Where(p => list.Contains(p["ID"].ToString())); var allSearchedFirstFolders = allSearchedFolders.Where(p => (null == p["Previd"] || p["Previd"].ToString() == "") && (p["container"].ToString() == "99" || p["container"].ToString() == catalog)); treeListPersonTemplate.BeginUnboundLoad(); treeListPersonTemplate.Nodes.Clear(); foreach (DataRow dr in allSearchedFirstFolders) { SearchLoadTree(dr, null, catalog, allSearchedFolders, serchedLeafs, keyword); } treeListPersonTemplate.CollapseAll(); treeListPersonTemplate.EndUnboundLoad(); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 检查病人当前科室与医生科室(包含权限科室)是否一致 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-03-01</date> /// <param name="noofinpat">首页序号</param> /// <returns></returns> private string CheckIfCurrentDept(int noofinpat) { try { DataTable inpDt = DS_SqlService.GetInpatientByID(noofinpat, 2); if (null == inpDt || inpDt.Rows.Count == 0) { return("该病人不存在,请刷新数据重试。"); } string dept = null == inpDt.Rows[0]["outhosdept"] ? "" : inpDt.Rows[0]["outhosdept"].ToString().Trim(); if (dept != DS_Common.currentUser.CurrentDeptId) {//该病人已转科 if (string.IsNullOrEmpty(dept.Trim())) { return("该病人所属科室异常,请联系管理员。"); } string deptName = DS_BaseService.GetDeptNameByID(dept); List <string[]> list = DS_BaseService.GetDeptAndWardInRight(DS_Common.currentUser.Id); if (null != list && list.Count > 0 && list.Any(p => p[0] == dept)) {//转科后科室在医生权限范围内 return("该病人已转至 " + deptName + "(" + dept + ")" + ",请切换科室。"); } else { return("该病人已转至 " + deptName + "(" + dept + ")" + ",您无权操作。"); } } return(string.Empty); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 设置入院日期为入院时间还是入科日期(依据配置) /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-03-14</date> public void SetInHosOrInWardDate() { try { string config = DS_SqlService.GetConfigValueByKey("EmrInputConfig"); if (!string.IsNullOrEmpty(config)) { XmlDocument doc = new XmlDocument(); doc.LoadXml(config); XmlNodeList nodeList = doc.GetElementsByTagName("InHosTimeType"); if (null != nodeList && nodeList.Count > 0) { string cfgValue = null == nodeList[0].InnerText ? "" : nodeList[0].InnerText.Trim(); if (cfgValue == "1") {//入科 gridViewInpatientFail.Columns[9].FieldName = "INWARDDATE"; } else {//入院 gridViewInpatientFail.Columns[9].FieldName = "ADMITDATE"; } } } } catch (Exception ex) { throw ex; } }
private void QualityMedicalRecord_Load(object sender, EventArgs e) { try { InitUCPoint(); RegisterEvent(); InitDepartment(); InitStatus(); //AddQCForm(); string config = DS_SqlService.GetConfigValueByKey("IsNewUcInput"); if (null != config && config.Trim() == "1") { AddEmrInputNew(); } else { AddEmrInput(); } InitInTime(); SetLookDeptEditor(); Search(); this.InitQCManager(); xtraTabControlEmrInfo.SelectedTabPage = xtraTabPage4; } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
/// <summary> /// 向Datatable中加入出院情况ID、出院情况两列数据 /// 注:Datatable中需包含iem_mainpage_diagnosis_no列 /// </summary> /// <param name="dt"></param> /// <returns></returns> public static DataTable AddColsDataToDataTable(DataTable dt) { try { if (!dt.Columns.Contains("Status_Id_Out")) { dt.Columns.Add("Status_Id_Out"); } if (!dt.Columns.Contains("Status_Name_Out")) { dt.Columns.Add("Status_Name_Out"); } if (null != dt && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { if (null != dr && null != dr["iem_mainpage_diagnosis_no"] && !string.IsNullOrEmpty(dr["iem_mainpage_diagnosis_no"].ToString().Trim()) && Tool.IsInt(dr["iem_mainpage_diagnosis_no"].ToString().Trim())) { DataTable coditionDT = DS_SqlService.GetOutHosConditonByID(int.Parse(dr["iem_mainpage_diagnosis_no"].ToString().Trim())); if (null != coditionDT && coditionDT.Rows.Count > 0) { dr["Status_Id_Out"] = coditionDT.Rows[0]["status_id"]; dr["Status_Name_Out"] = coditionDT.Rows[0]["Status_Name"]; } } } } return(dt); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 将符合条件的未归档病人病历归档 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2012-12-23</date> /// <param name="noofinpat"></param> public static void SetRecordsRebacked(int noofinpat) { try { DataTable dt = DS_SqlService.GetAllRecordsByNoofinpat(noofinpat); if (null == dt || dt.Rows.Count == 0) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("该病人没有病历,无法归档。"); return; } if (DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("您是否要归档该病历?", "归档病历", DrectSoft.Common.Ctrs.DLG.MyMessageBoxButtons.YesNo) == DialogResult.No) { return; } if (CheckRecordRebacked(noofinpat.ToString())) { int num = DS_SqlService.SetRecordsRebacked(noofinpat.ToString()); if (num > 0) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("归档成功"); return; } } DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("该病人已归档。"); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 获取权限内的科室ID和病区ID集合 /// 注:string[0]:科室;string[1]:病区 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-01-18</date> /// <returns></returns> public static List <string[]> GetDeptAndWardInRight(string userID) { try { if (string.IsNullOrEmpty(userID)) { return(new List <string[]>()); } List <string[]> list = new List <string[]>(); DataTable dt = DS_SqlService.GetDeptAndWardInRight(userID); if (null != dt && dt.Rows.Count > 0) { foreach (DataRow drow in dt.Rows) { string[] array = new string[2]; array[0] = null == drow["deptid"] ? "" : drow["deptid"].ToString().Trim(); array[1] = null == drow["wardid"] ? "" : drow["wardid"].ToString().Trim(); list.Add(array); } } return(list); } catch (Exception ex) { throw new Exception(ex.Message); } }
private void InitSize() { try { string config = DS_SqlService.GetConfigValueByKey("EmrSetting"); if (!string.IsNullOrEmpty(config)) { XmlDocument doc = new XmlDocument(); doc.LoadXml(config); XmlNodeList initList = doc.GetElementsByTagName("DailyPreViewInitHeight"); if (null != initList && initList.Count > 0) { string initValue = null == initList[0].InnerText ? "" : initList[0].InnerText.Trim(); if (!string.IsNullOrEmpty(initValue) && Tool.IsNumeric(initValue)) { FirstHeight = int.Parse(initValue); } } XmlNodeList defaultList = doc.GetElementsByTagName("DailyPreViewDefaultHeight"); if (null != defaultList && defaultList.Count > 0) { string defaultValue = null == defaultList[0].InnerText ? "" : defaultList[0].InnerText.Trim(); if (!string.IsNullOrEmpty(defaultValue) && Tool.IsNumeric(defaultValue)) { DefaultHeight = int.Parse(defaultValue); } } } } catch (Exception ex) { throw ex; } }
/// <summary> /// 重置 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-01-06</date> private void Reset() { try { if (groupID == -1) { ClearPage(); } else { this.txt_search.Text = string.Empty; DataTable thisGroupDt = DS_SqlService.GetDiseaseGroupByID(groupID); if (null == thisGroupDt || thisGroupDt.Rows.Count == 0) { return; } this.txt_groupName.Text = null == thisGroupDt.Rows[0]["NAME"] ? "" : thisGroupDt.Rows[0]["NAME"].ToString(); this.txt_memo.Text = null == thisGroupDt.Rows[0]["MEMO"] ? "" : thisGroupDt.Rows[0]["MEMO"].ToString(); this.gridControl_disease.DataSource = defaultSource; checkedList = defaultSource.Select(" FLAG = " + true).ToList(); notCheckedList = defaultSource.Select(" FLAG = " + false).ToList(); RefreshDiseaseTextArea(); } } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 是否开放三级检诊功能 /// </summary> /// 公开,供调用 edit by ywk /// <returns></returns> public bool IsOpenThreeLevelAudit() { try { //edit by cyq 2012-12-03 //string emrConfig = BasicSettings.GetStringConfig("EmrSetting"); string emrConfig = DS_SqlService.GetConfigValueByKey("EmrSetting"); XmlDocument doc = new XmlDocument(); doc.LoadXml(emrConfig); XmlNodeList nodeList = doc.GetElementsByTagName("OpenThreeLevelAudit"); if (nodeList.Count > 0) { XmlElement ele = nodeList[0] as XmlElement; if (ele.InnerText.Trim() == "0") { return(false); } else { return(true); } } return(false); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 查询方法 /// Add by xlb 2013-04-08 /// </summary> private void Search() { try { //存储过程名称 string procedureName = DS_SqlService.GetConfigValueByKey("MadeOrderProcedure"); string IsView = DS_SqlService.GetConfigValueByKey("MadeOrderIsView");; if (string.IsNullOrEmpty(procedureName)) { procedureName = "usp_GetDoctorAdvice"; } DS_SqlHelper.CreateSqlHelperByDBName("HISDB"); CheckConnectHIS(); if (IsView == "1") { GetDateTable(); } else { GetDateTableByPrc(procedureName); } gridView1.Columns.Clear(); gridControlOrder.DataSource = dtOrder; for (int i = 0; i < gridView1.Columns.Count; i++) { //列头居中 gridView1.Columns[i].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; if (gridView1.Columns[i].FieldName.Trim() == "医嘱内容") { gridView1.Columns[i].Width = 200; } else { gridView1.Columns[i].Width = (gridControlOrder.Width - 200) / gridView1.Columns.Count - 1; } //RepositoryItem repository = new RepositoryItemMemoEdit(); //gridView1.Columns[i].ColumnEdit = repository; } gridView1.OptionsCustomization.AllowColumnMoving = false; gridView1.OptionsCustomization.AllowColumnResizing = true; gridView1.OptionsCustomization.AllowRowSizing = false; gridView1.OptionsCustomization.AllowQuickHideColumns = false; gridView1.OptionsCustomization.AllowFilter = false; gridView1.OptionsCustomization.AllowSort = false; //禁掉自带排序 gridView1.OptionsBehavior.Editable = false; //不可编辑 DS_SqlHelper.CreateSqlHelper(); } catch (Exception ex) { DS_SqlHelper.CreateSqlHelper(); throw ex; } }
/// <summary> /// 、二次修改捞取诊断数据源的修改 /// add by ywk 2013年3月19日9:57:05 /// </summary> /// <param name="lueInfo"></param> /// <param name="queryType"></param> private void BindLueData(LookUpEditor lueInfo, Decimal queryType) { try { LookUpWindow lupInfo = new LookUpWindow(); lupInfo.SqlHelper = m_App.SqlHelper; //判断诊断的捞取数据源 add by ywk 2013年3月19日9:48:23 DataTable dataTable = null; string getdiagtype = DS_SqlService.GetConfigValueByKey("GetDiagnosisType") == "" ? "0" : DS_SqlService.GetConfigValueByKey("GetDiagnosisType"); //string getdiagtype = "1"; if (getdiagtype == "0")//EMR { dataTable = GetEditroData(queryType); } if (getdiagtype == "1")//HIS { try { using (OracleConnection conn = new OracleConnection(DataAccessFactory.GetSqlDataAccess("HISDB").GetDbConnection().ConnectionString)) { if (conn.State != ConnectionState.Open) { conn.Open(); } dataTable = new DataTable(); OracleCommand cmd = conn.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = " SELECT NAME, py , WB, memo, icd as ID FROM yd_diagnosis "; OracleDataAdapter myoadapt = new OracleDataAdapter(cmd.CommandText, conn); myoadapt.Fill(dataTable); //MessageBox.Show("诊断取的HIS"); } } catch (Exception ex)//进异常,说明可能HIS那边没有此视图 就取EMR的 { dataTable = GetEditroData(queryType); //MessageBox.Show("出异常,诊断取自EMR"+ex.Message); } } //DataTable dataTable = GetEditroData(queryType); dataTable.Columns["ID"].Caption = "诊断编码"; dataTable.Columns["NAME"].Caption = "诊断名称"; Dictionary <string, int> columnwidth = new Dictionary <String, Int32>(); columnwidth.Add("ID", 90); columnwidth.Add("NAME", 210); SqlWordbook sqlWordBook = new SqlWordbook("ID", dataTable, "ID", "NAME", columnwidth, "ID//NAME//PY//WB"); lueInfo.SqlWordbook = sqlWordBook; lueInfo.ListWindow = lupInfo; } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 二次更改,中心医院手术要取自HIS视图 /// edit by ywk 2013年7月22日 11:42:33 /// </summary> /// <param name="lueInfo"></param> /// <param name="queryType"></param> private void BindLueData(LookUpEditor lueInfo, Decimal queryType) { LookUpWindow lupInfo = new LookUpWindow(); lupInfo.SqlHelper = m_App.SqlHelper; //判断手术信息的捞取数据源 add by ywk 2013年7月22日 11:43:30 DataTable dataTable = null; //DataTable dataTable = GetEditroData(queryType); string getopertype = DS_SqlService.GetConfigValueByKey("GetOperationType") == "" ? "0" : DS_SqlService.GetConfigValueByKey("GetOperationType"); //只有手术从his中取 其他还是从emr中取 if (queryType == 20) { if (getopertype == "0")//EMR { dataTable = GetEditroData(queryType); } if (getopertype == "1")//HIS { try { using (OracleConnection conn = new OracleConnection(DataAccessFactory.GetSqlDataAccess("HISDB").GetDbConnection().ConnectionString)) { if (conn.State != ConnectionState.Open) { conn.Open(); } dataTable = new DataTable(); OracleCommand cmd = conn.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = " SELECT ID, NAME, py , WB, name 名称 FROM yd_operation "; OracleDataAdapter myoadapt = new OracleDataAdapter(cmd.CommandText, conn); myoadapt.Fill(dataTable); //MessageBox.Show("诊断取的HIS"); } } catch (Exception ex)//进异常,说明可能HIS那边没有此视图 就取EMR的 { dataTable = GetEditroData(queryType); //MessageBox.Show("出异常,诊断取自EMR"+ex.Message); } } } else { dataTable = GetEditroData(queryType); } Dictionary <string, int> columnwidth = new Dictionary <String, Int32>(); columnwidth.Add("名称", lueInfo.Width); SqlWordbook sqlWordBook = new SqlWordbook("ID", dataTable, "ID", "Name", columnwidth, true); lueInfo.SqlWordbook = sqlWordBook; lueInfo.ListWindow = lupInfo; }
private void InitlueMorpho() // add by jxh 绑定lueMorpho控件值 { try { LookUpWindow lupInfo1 = new LookUpWindow(); lupInfo1.SqlHelper = m_SqlHelper; string morphosource = DS_SqlService.GetConfigValueByKey("MorphologySource"); DataTable m_DataTableMor = new DataTable(); if (morphosource == "0")//取自EMR { string sql = string.Format(@"select * from diagnosis_xt a where a.valid = 1"); m_DataTableMor = m_SqlHelper.ExecuteDataTable(sql); } else { //形态学编码从HIS捞取 try { using (OracleConnection conn = new OracleConnection(DataAccessFactory.GetSqlDataAccess("HISDB").GetDbConnection().ConnectionString)) { if (conn.State != ConnectionState.Open) { conn.Open(); } OracleCommand cmd = conn.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = " SELECT MarkId as ID, NAME, py , WB, memo, icd FROM yd_morphologh "; OracleDataAdapter myoadapt = new OracleDataAdapter(cmd.CommandText, conn); myoadapt.Fill(m_DataTableMor); } } catch (Exception ex) { m_App.CustomMessageBox.MessageShow("从HIS取诊断学编码有误" + ex.Message); } } m_DataTableMor.Columns["NAME"].Caption = "名称"; Dictionary <string, int> cols = new Dictionary <string, int>(); cols.Add("ICD", 80); cols.Add("NAME", 160); SqlWordbook deptWordBook = new SqlWordbook("querybook", m_DataTableMor, "ICD", "NAME", cols, "ICD//NAME//PY//WB"); lueMorpho.SqlWordbook = deptWordBook; lueMorpho.ListWindow = lupInfo1; } catch (Exception ex) { m_App.CustomMessageBox.MessageShow("绑定诊断学编码有误" + ex.Message); } }
/// <summary> /// 画面检查 /// edit by Yanqiao.Cai 2012-11-23 /// 1、add try ... catch /// 2、优化提示 /// </summary> private void btn_Save_Click(object sender, EventArgs e) { try { if (m_AllDisplayDateTime.Contains(CommitDateTime.ToString("yyyy-MM-dd HH:mm:ss"))) { this.labelControl_Info.Text = "该病程时间已存在,请选择其它时间。"; this.labelControl_Info.ToolTip = "该病程时间已存在,请选择其它时间。"; dateEdit_Date.Focus(); return; } if (m_labelControlInfoText != "" && (CommitDateTime - Convert.ToDateTime(m_labelControlInfoText)).TotalMinutes < 0) { if (!string.IsNullOrEmpty(beginTime) && DateTime.Parse(beginTime) == DateTime.Parse(m_labelControlInfoText)) { this.labelControl_Info.Text = "病程时间应大于 " + m_labelControlInfoText; this.labelControl_Info.ToolTip = "病程时间应大于 " + m_labelControlInfoText; } else { this.labelControl_Info.Text = "病程时间应大于 " + m_labelControlInfoText; this.labelControl_Info.ToolTip = "病程时间应大于 " + m_labelControlInfoText; } dateEdit_Date.Focus(); return; } //注释 by cyq 2013-01-04 修复历史病历导入后无法新增病历的bug //else if (CommitDateTime > DateTime.Now) //{ // this.labelControl_Info.Text = "病程时间不能大于当前时间"; // this.labelControl_Info.ToolTip = "病程时间不能大于当前时间"; // dateEdit_Date.Focus(); // return; //} else { //查看数据库中是否存在该时间的有效病历 ///1、查找所有病人的有效病历 DataTable theRecords = DS_SqlService.GetRecordsByNoofinpat(noofInpat); if (null != theRecords && theRecords.Rows.Count > 0 && theRecords.Select(" 1=1 ").Any(p => DateTime.Parse(p["captiondatetime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss") == CommitDateTime.ToString("yyyy-MM-dd HH:mm:ss"))) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("数据库中已存在时间为 " + CommitDateTime.ToString("yyyy-MM-dd HH:mm:ss") + " 的病历,请选择其它的时间。"); return; } this.DialogResult = System.Windows.Forms.DialogResult.OK; } } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
public FormOrderForInpat() { try { InitializeComponent(); IsSortByDepartment = DS_SqlService.GetConfigValueByKey("IsSortByDepartment"); } catch (Exception ex) { throw ex; } }
//归档 private void btn_reback_Click(object sender, EventArgs e) { try { int fouceRowIndex = dbGridView.FocusedRowHandle; if (fouceRowIndex < 0) { dbGrid.Focus(); SqlUtil.App.CustomMessageBox.MessageShow("请选择一条病人记录"); return; } DataRow foucesRow = dbGridView.GetDataRow(fouceRowIndex); if (null == foucesRow || null == foucesRow["NOOFINPAT"]) { return; } int noofinpat = int.Parse(foucesRow["NOOFINPAT"].ToString().Trim()); string statusname = foucesRow["GDZT"].ToString().Trim(); if (!(statusname == "已提交" || statusname == "补写提交" || statusname == "撤销归档")) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("该状态病历不能直接归档"); return; } #region 注释验证是否有病例 //DataTable dt = DS_SqlService.GetRecordsByNoofinpat(noofinpat); //if (null == dt || dt.Rows.Count == 0) //{ // Common.Ctrs.DLG.MessageBox.Show(foucesRow["NAME"] + " 没有病历,无法归档。"); // return; //} #endregion if (DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("您确定要归档 " + foucesRow["NAME"] + " 的病历吗?", "归档病历", DrectSoft.Common.Ctrs.DLG.MyMessageBoxButtons.YesNo) == DialogResult.No) { return; } // DS_BaseService.CheckRecordRebacked(noofinpat.ToString()) if (foucesRow["islock"].ToString() != "4701") { int num = DS_SqlService.SetRecordsRebacked(noofinpat.ToString()); if (num > 0) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("归档成功"); dbGridView.DeleteRow(dbGridView.FocusedRowHandle); return; } } DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("该病人已归档。"); } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
/// <summary> /// 获取病历开始时间 /// </summary> /// <param name="noofinpat"></param> /// <param name="modelList">编辑器传递节点集合</param> /// <param name="isFirstDailyEmr">是否首程</param> /// <returns></returns> private string GetDailyBeginTime(int noofinpat, List <EmrModel> modelList, bool isFirstDailyEmr) { try { string starttime = string.Empty; //该病人当前所属科室 string currentDeptID = string.Empty; DataTable inpatientDt = DS_SqlService.GetInpatientByID(noofinpat, 2); if (null != inpatientDt && inpatientDt.Rows.Count > 0) { currentDeptID = null == inpatientDt.Rows[0]["outhosdept"] ? "" : inpatientDt.Rows[0]["outhosdept"].ToString(); } if (string.IsNullOrEmpty(currentDeptID)) { currentDeptID = DS_Common.currentUser.CurrentDeptId; } //该病人的所有病历(页面节点) if (null == modelList && modelList.Count() == 0) { return(starttime); } //最后一个病历 EmrModel lastRecord = modelList.OrderByDescending(q => q.DisplayTime).FirstOrDefault(); if (null == lastRecord) {//不存在病历 return(starttime); } //获取该病人所有首次病程 var firstDailyRecords = modelList.Where(p => p.FirstDailyEmrModel); if (null == firstDailyRecords && firstDailyRecords.Count() == 0) {//不存在首次病程 return(starttime); } if (lastRecord.DepartCode != currentDeptID) { return(lastRecord.DisplayTime.ToString("yyyy-MM-dd HH:mm:ss")); } //当前(科室)首次病程(最后一个) EmrModel theFirstDialy = firstDailyRecords.Where(p => p.DepartCode == currentDeptID).OrderByDescending(q => q.DisplayTime).FirstOrDefault(); if (null != theFirstDialy) { return(theFirstDialy.DisplayTime.ToString("yyyy-MM-dd HH:mm:ss")); } return(starttime); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 画面检查 /// <auth>Yanqiao.Cai</auth> /// <date>2011-11-02</date> /// </summary> private string CheckItem() { try { if (string.IsNullOrEmpty(this.dateEdit.Text.Trim())) { this.dateEdit.Focus(); return("请选择日期"); } else if (string.IsNullOrEmpty(this.txtTime.Text.Trim())) { this.txtTime.Focus(); return("请选择时间"); } else if (string.IsNullOrEmpty(this.lookUpState.CodeValue)) { this.lookUpState.Focus(); return("请选择状态"); } else//add by cyq 2013-03-05 增加状态时间限制 { DateTime theTime = DateTime.Parse(this.dateEdit.DateTime.ToString("yyyy-MM-dd") + " " + this.txtTime.Time.ToString("HH:mm:ss")); if (theTime > DateTime.Now) { this.dateEdit.Focus(); return("病人状态时间不能大于当前时间"); } //获取入院记录 //DataTable inpatient = DS_SqlService.GetInpatientByID((int)m_currInpatient.NoOfFirstPage); DataTable inpatient = DS_SqlService.GetInpatientByID(Int32.Parse(NoOfinPat)); if (null != inpatient && inpatient.Rows.Count > 0) {//多次入院 if (theTime < DateTime.Parse(DateTime.Parse(inpatient.Rows[0]["inwarddate"].ToString()).ToString("yyyy-MM-dd 00:00:00"))) { return("病人状态时间不能小于入院时间(" + DateTime.Parse(inpatient.Rows[0]["inwarddate"].ToString()).ToString("yyyy-MM-dd 00:00:00") + ")"); } //if ((inpatient.Rows[0]["status"].ToString() == "1502" || inpatient.Rows[0]["status"].ToString() == "1503") && theTime > DateTime.Parse(inpatient.Rows[0]["outhosdate"].ToString())) //{ // return "病人状态时间不能大于出院时间(" + DateTime.Parse(inpatient.Rows[0]["outhosdate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss") + ")"; //} } } return(string.Empty); } catch (Exception ex) { throw ex; } }
/// <summary> /// 初始化 /// </summary> private void Init(EmrModel model, DateTime?firstDailyTime, List <EmrModel> list) { try { string titleName = model.IsShowFileName == "1" ? (string.IsNullOrEmpty(model.FileName.Trim()) ? model.Description.Trim() : model.FileName.Trim()) : string.Empty; if (null == firstDailyTime) { DataTable dt = DS_SqlService.GetInpatientByID((int)m_app.CurrentPatientInfo.NoOfFirstPage, 2); if (null != dt && dt.Rows.Count > 0) { string config = DS_SqlService.GetConfigValueByKey("EmrInputConfig"); if (!string.IsNullOrEmpty(config)) { XmlDocument doc = new XmlDocument(); doc.LoadXml(config); XmlNodeList nodeList = doc.GetElementsByTagName("InHosTimeType"); if (null != nodeList && nodeList.Count > 0) { string cfgValue = null == nodeList[0].InnerText ? "" : nodeList[0].InnerText.Trim(); if (cfgValue == "0" && !string.IsNullOrEmpty(dt.Rows[0]["admitdate"].ToString().Trim())) {//入院 m_BeginTime = DateTime.Parse(dt.Rows[0]["admitdate"].ToString()); } else if (!string.IsNullOrEmpty(dt.Rows[0]["inwarddate"].ToString().Trim())) {//入科 m_BeginTime = DateTime.Parse(dt.Rows[0]["inwarddate"].ToString()); } } else { m_BeginTime = (null != dt.Rows[0]["inwarddate"] && dt.Rows[0]["inwarddate"].ToString().Trim() != "") ? DateTime.Parse(dt.Rows[0]["inwarddate"].ToString()) : DateTime.Parse(dt.Rows[0]["admitdate"].ToString()); } } this.labelControl_Info.Text = "病程时间应大于入院时间 " + m_BeginTime.ToString("yyyy-MM-dd HH:mm:ss"); } } else { m_BeginTime = (DateTime)firstDailyTime; this.labelControl_Info.Text = "病程时间应大于首次病程时间 " + m_BeginTime.ToString("yyyy-MM-dd HH:mm:ss"); } dateEdit_Date.DateTime = DateTime.Now.Date; timeEdit_Time.Time = DateTime.Now; textEdit_Name.Text = titleName; } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取需要选中的病程数目 /// </summary> private void GetNeedCheckItemCount() { try { string cnt = DS_SqlService.GetConfigValueByKey("PreViewEmrCount"); if (null != cnt && !string.IsNullOrEmpty(cnt.Trim()) && cnt.Split('|').Length == 2) { m_NeedCheckItemCount = Convert.ToInt32(cnt.Split('|')[0]); } } catch (Exception ex) { throw ex; } }