/// <summary> /// 初始化等待框 /// 王冀 2012-10-30 /// </summary> /// <param name="caption"></param> //private void SetWaitDialogCaption(string caption) //{ // try // { // if (m_WaitDialog != null) // { // if (!m_WaitDialog.Visible) // m_WaitDialog.Visible = true; // m_WaitDialog.Caption = caption; // } // } // catch (Exception ex) // { // Common.Ctrs.DLG.MyMessageBox.Show(1, ex); // } //} /// <summary> /// 等待框收起 /// 王冀 2012-10-30 /// </summary> //private void HideWaitDialog() //{ // try // { // if (m_WaitDialog != null) // m_WaitDialog.Hide(); // } // catch (Exception ex) // { // Common.Ctrs.DLG.MyMessageBox.Show(1, ex); // } //} #endregion /// <summary> /// 构建树控件 /// 王冀 2012-10-30 /// </summary> private void MakeTree() { try { DS_Common.SetWaitDialogCaption(m_WaitDialog, "正在构建树控件!"); DataTable Class; DataTable Treatment; m_HaveBindNode.Clear(); treeList_Medicine.ClearNodes(); Class = m_SqlManger.GetTreatmentTreeOne(this.cbClass.SelectedIndex.ToString()); //第一级 foreach (DataRow dr in Class.Rows) { TreeListNode parentNode = null;// parentNode = treeList_Medicine.AppendNode(new object[] { dr["unitmname"].ToString(), "Folder", dr["unitmid"].ToString() }, null); m_HaveBindNode.Add(dr["unitmname"].ToString()); Treatment = m_SqlManger.GetTreatmentTreeTwo(dr["unitmid"].ToString()); //第二级 foreach (DataRow secdr in Treatment.Rows) { TreeListNode node = null; node = treeList_Medicine.AppendNode(new object[] { secdr["jibingmingcheng"].ToString(), "Leaf", secdr["ID"].ToString() }, parentNode); //m_LeafNode.Add(secdr["id"].ToString()); node.Tag = secdr["id"].ToString(); } } DS_Common.HideWaitDialog(m_WaitDialog); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 窗体加载事件 /// by xlb 2012-12-19 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CommonNote_ModelWeiHu_Load(object sender, EventArgs e) { try { DS_Common.SetWaitDialogCaption(m_WaitForm, "正在加载数据"); txtFileName.Focus(); DS_Common.HideWaitDialog(m_WaitForm); } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
/// <summary> /// 导入前的处理 /// </summary> private void BeforeProcEMR() { try { if (m_IsClearAllDailyEmr) { DS_Common.SetWaitDialogCaption(m_WaitDialog, "正在删除现有病程..."); string sqlClearDailyEMR = "update recorddetail set valid = '0' where noofinpat = '{0}' and sortid = 'AC' and valid = '1' "; m_App.SqlHelper.ExecuteNoneQuery(string.Format(sqlClearDailyEMR, m_CurrentInpatient.NoOfFirstPage.ToString()), CommandType.Text); } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void AddEmrInputNew() { try { DS_Common.SetWaitDialogCaption(m_WaitDialog, "正在加载病人信息..."); m_App.ChoosePatient(Convert.ToDecimal(m_noofinpat));//切换病人 DS_Common.HideWaitDialog(m_WaitDialog); m_UCEmrInputNew = new DrectSoft.Core.MainEmrPad.New.UCEmrInput(m_App.CurrentPatientInfo, m_App, FloderState.None); m_UCEmrInputNew.SetVarData(m_App); this.panelControl1.Controls.Add(m_UCEmrInputNew); m_UCEmrInputNew.OnLoad(); m_UCEmrInputNew.HideBar(); m_UCEmrInputNew.Dock = DockStyle.Fill; } catch (Exception) { throw; } }
/// <summary> /// 搜索功能 /// 王冀2012-10-29 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnFind_Click(object sender, EventArgs e) { try { DS_Common.SetWaitDialogCaption(m_WaitDialog, "正在构建树控件!"); m_HaveBindNode.Clear(); treeListFind.ClearNodes(); string key = this.txtFind.Text.Trim().Replace("'", "''").Replace("*", "[*]").Replace("%", "[%]"); if (CheckKey(key)) { this.txtFind.Focus(); return; } if (key == null || key.Trim() == string.Empty) { this.treeListFind.Visible = false; this.treeList_Medicine.Visible = true; } else { this.treeList_Medicine.Visible = false; this.treeListFind.Visible = true; dtMyLeafNode = m_SqlManger.GetMedicaineByKey(sqlGetDrug, key); if (dtMyLeafNode.Rows.Count == 0) { MessageBox.Show("没有查询到结果,请重新输入!"); return; } else { LoadTreeList(dtMyLeafNode); } } DS_Common.HideWaitDialog(m_WaitDialog); txtFind.Focus(); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 从数据库获取数据 并展现数据。 /// </summary> private void GetData() { try { //m_WaitDialog = new WaitDialogForm("正在加载数据", "请稍后..."); DS_Common.SetWaitDialogCaption(m_WaitDialog, "正在加载数据"); DateTime date = dateEdit1.DateTime; if (date == null) { return; } string dateStr = date.ToString("yyyy-MM-dd"); InCommonNoteItemEntityListAll = m_InCommonNoteBiz.GetIncommNoteItemByDay(m_CommonNoteEntity.CommonNoteFlow, dateStr); BindDate(); //m_WaitDialog.Hide(); DS_Common.HideWaitDialog(m_WaitDialog); } catch (Exception ex) { throw ex; } }
///// <summary> ///// 初始化等待框 ///// edit by 王冀 2012-10-30 ///// </summary> ///// <param name="caption"></param> //private void SetWaitDialogCaption(string caption) //{ // try // { // if (m_WaitDialog != null) // { // if (!m_WaitDialog.Visible) // m_WaitDialog.Visible = true; // m_WaitDialog.Caption = caption; // } // } // catch (Exception ex) // { // Common.Ctrs.DLG.MyMessageBox.Show(1, ex); // } //} //private void HideWaitDialog() //{ // if (m_WaitDialog != null) // m_WaitDialog.Hide(); //} #endregion /// <summary> /// 构建树控件 /// 王冀 2012-10-29 修改 加图标 /// </summary> private void MakeTree() { try { DS_Common.SetWaitDialogCaption(m_WaitDialog, "正在构建树控件!"); //DataTable Doseform; //DataTable DirectTitle2; //已绑定节点 清空 王冀 2012-10-30 //DataTable drug; m_HaveBindNode.Clear(); treeList_Medicine.ClearNodes(); Doseform = m_SqlManger.GetMedicaineDirectTreeOne(); //第一级 foreach (DataRow dr in Doseform.Rows) { TreeListNode parentNode = null;// parentNode = treeList_Medicine.AppendNode(new object[] { dr["Doseform"].ToString(), "Folder", dr["Doseform"].ToString() }, null); m_HaveBindNode.Add(dr["Doseform"].ToString()); DataTable DirectTitle2 = m_SqlManger.GetMedicaineDirectTreeTwo(dr["Doseform"].ToString()); //第二级 foreach (DataRow secdr in DirectTitle2.Rows) { TreeListNode node = null; node = treeList_Medicine.AppendNode(new object[] { secdr["DirectTitle"].ToString(), "Leaf", secdr["ID"].ToString() }, parentNode); //m_LeafNode.Add(secdr["id"].ToString()); node.Tag = secdr["id"].ToString(); } } ntree = treeList_Medicine; DS_Common.HideWaitDialog(m_WaitDialog); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 导入前的检查操作 /// </summary> /// 是否可导入历史病历 private bool BeforeBatchInCheck() { try { bool boo = false; DS_Common.SetWaitDialogCaption(m_WaitDialog, "正在检查病历..."); string sqlGetDailyEmrCount = "SELECT COUNT (1) FROM recorddetail WHERE noofinpat = '{0}' AND sortid = 'AC' AND valid = '1'"; DataTable dt = m_App.SqlHelper.ExecuteDataTable(string.Format(sqlGetDailyEmrCount, m_CurrentInpatient.NoOfFirstPage.ToString()), CommandType.Text); string cnt = dt.Rows[0][0].ToString(); if (cnt.Equals("0")) {//无病历 return(true); } string question = "此病人已存在病程 \n\r 选择【是】则删除现有病程,并导入历史病程记录; \n\r 选择【否】则保留现有病程,不导入历史病程记录。"; if (m_App.CustomMessageBox.MessageShow(question, DrectSoft.Core.CustomMessageBoxKind.QuestionYesNo) == System.Windows.Forms.DialogResult.Yes) { m_IsClearAllDailyEmr = true; m_IsNeedBatchInDailyEmr = true; boo = true; } else { m_IsClearAllDailyEmr = false; m_IsNeedBatchInDailyEmr = false; boo = false; } DS_Common.HideWaitDialog(m_WaitDialog); return(boo); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 得到病人某一次就诊的所有病例 /// </summary> /// <returns></returns> private DataTable GetPatAllEmr() { try { DS_Common.SetWaitDialogCaption(m_WaitDialog, "正在捞取历史病历..."); //排除护理病历 string sqlAllPatEMR = " select * from recorddetail where noofinpat = '{0}' and valid = '1' and sortid not in('AI','AJ','AK') order by sortid, captiondatetime "; DataTable dt = m_App.SqlHelper.ExecuteDataTable(string.Format(sqlAllPatEMR, m_NoOfInpat), CommandType.Text); //Add by wwj 2012-08-10 对病历内容中的宏元素重新赋值 foreach (DataRow dr in dt.Rows) { string content = dr["content"].ToString(); if (content.Trim() != "") { XmlDocument doc = new XmlDocument(); doc.PreserveWhitespace = true; doc.LoadXml(content); XmlNodeList nodeList = doc.GetElementsByTagName("macro"); foreach (XmlNode node in nodeList) { string macroName = node.Attributes["name"].Value; string macroValue = GetDataByNameForMacro(macroName); node.InnerText = macroValue; } dr["content"] = doc.InnerXml; } } return(dt); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 导入处理过的病历---优化(转科) /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-02-20</date> /// <param name="dt"></param> private void ProcEMRNew(DataTable dt) { try { DS_Common.SetWaitDialogCaption(m_WaitDialog, "正在处理历史病历..."); string userID = m_App.User.Id; string userName = m_App.User.Name; int day = 0; List <DataRow> allRecords = new List <DataRow>(); //【1】初始化病例信息 dt.Columns.Add("captiondatetimeTemp"); foreach (DataRow dr in dt.Rows) { dr["noofinpat"] = m_CurrentInpatient.NoOfFirstPage.ToString(); dr["owner"] = userID; dr["createtime"] = CurrentDateTime; dr["auditor"] = ""; dr["audittime"] = null; dr["hassubmit"] = "4600"; dr["hasprint"] = "3600"; dr["hassign"] = "0"; dr["islock"] = "4700"; dr["ip"] = DS_Common.GetIPHost(); dr["departcode"] = DS_Common.currentUser.CurrentDeptId; dr["wardcode"] = DS_Common.currentUser.CurrentWardId; if (dr["sortid"].ToString() == ContainerCatalog.BingChengJiLu)//针对病程需要特殊处理,每份病例的时间间距是1天 { string bingChenDateTime = Convert.ToDateTime(CurrentDateTime).AddDays(day).ToString("yyyy-MM-dd HH:mm:ss"); day++; dr["name"] = dr["name"].ToString().Split(' ')[0] + ' ' + bingChenDateTime + ' ' + userName; dr["captiondatetimeTemp"] = bingChenDateTime; } else { dr["name"] = dr["name"].ToString().Split(' ')[0] + ' ' + CurrentDateTime + ' ' + userName; dr["captiondatetime"] = CurrentDateTime; } allRecords.Add(dr); } //【2】处理病历记录和首程内容 ///获取病例中所有首次病程 var firstRecords = allRecords.Where(p => p["sortid"].ToString() == ContainerCatalog.BingChengJiLu && p["FIRSTDAILYFLAG"].ToString() == "1"); ///获取所有病历内容集合(包含header和footer,包含所有首次病程中的病历) List <string[]> allRecordContents = new List <string[]>(); if (null != firstRecords && firstRecords.Count() > 0) { for (int i = 0; i < firstRecords.Count(); i++) { DataRow firstRecord = firstRecords.ElementAt(i); XmlDocument xmlRecord = NewXmlDocument(firstRecord["content"].ToString()); if (null != allRecordContents && allRecordContents.Count() > 0) { List <string[]> thisRecordContents = DS_BaseService.GetRecoedsByXML(xmlRecord); if (null != thisRecordContents && thisRecordContents.Count() > 0) { var onlyRecordContents = thisRecordContents.Where(p => p[0] != "header" && p[0] != "footer"); allRecordContents = allRecordContents.AsEnumerable().Union(onlyRecordContents).ToList(); } } else { allRecordContents = DS_BaseService.GetRecoedsByXML(xmlRecord); } } ///将首次病程设为普通病历(非首次病程) firstRecords = SetFirstDailyToDaily(firstRecords); } ///获取所有病历内容对应的时间集合 List <string> xmlRecordTimes = allRecordContents.Select(p => p[0]).ToList(); ///去除病例中无内容的节点 allRecords = allRecords.Where(p => (p["sortid"].ToString() != ContainerCatalog.BingChengJiLu && !string.IsNullOrEmpty(p["content"].ToString())) || (p["sortid"].ToString() == ContainerCatalog.BingChengJiLu && xmlRecordTimes.Contains(p["captiondatetime"].ToString()))).OrderBy(q => DateTime.Parse(q["captiondatetime"].ToString())).ToList(); ///首次病程内容 string newEMRContent = string.Empty; ///获取过滤后的病程记录 var emrRecords = allRecords.Where(p => p["sortid"].ToString() == ContainerCatalog.BingChengJiLu).OrderBy(q => DateTime.Parse(q["captiondatetime"].ToString())); ///需要过滤(去除)的病历时间 List <string> toDeleteTime = new List <string>(); foreach (DataRow emr in emrRecords) { string[] contentArray = allRecordContents.FirstOrDefault(p => p[0] == emr["captiondatetime"].ToString()); if (null == contentArray || string.IsNullOrEmpty(contentArray[1].Trim())) { toDeleteTime.Add(emr["captiondatetime"].ToString()); continue; } string newContent = SetCaptionTime(emr["captiondatetime"].ToString(), emr["captiondatetimeTemp"].ToString(), contentArray[1]); if (!string.IsNullOrEmpty(newContent.Trim())) { newEMRContent += newContent; emr["captiondatetime"] = emr["captiondatetimeTemp"]; } else { toDeleteTime.Add(emr["captiondatetime"].ToString()); } } if (null != toDeleteTime && toDeleteTime.Count > 0) { allRecords = allRecords.Where(p => !toDeleteTime.Contains(p["captiondatetime"].ToString())).OrderBy(q => DateTime.Parse(q["captiondatetime"].ToString())).ToList(); } if (null != allRecordContents && allRecordContents.Count() > 0) { string[] header = allRecordContents.FirstOrDefault(p => p[0] == "header"); if (null != header && !string.IsNullOrEmpty(header[1])) { newEMRContent = header[1] + newEMRContent; } string[] footer = allRecordContents.FirstOrDefault(p => p[0] == "footer"); if (null != footer && !string.IsNullOrEmpty(footer[1])) { newEMRContent += footer[1]; } } if (null != emrRecords && emrRecords.Count() > 0) { DataRow firstEmr = emrRecords.FirstOrDefault(); if (null != firstEmr) { firstEmr["FIRSTDAILYFLAG"] = "1"; firstEmr["content"] = newEMRContent; } } //【3】保存到数据库 DS_Common.SetWaitDialogCaption(m_WaitDialog, "正在保存病历..."); SaveRecordsInTran(allRecords); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 导入处理过的病历 /// </summary> private void ProcEMR(DataTable dt) { //增加捕获异常验证 add by ywk 2012年12月10日16:22:49 try { DS_Common.SetWaitDialogCaption(m_WaitDialog, "正在处理历史病历..."); string userID = m_App.User.Id; string userName = m_App.User.Name; int day = 0; //【1】初始化病例信息 dt.Columns.Add("captiondatetimeTemp"); foreach (DataRow dr in dt.Rows) { dr["noofinpat"] = m_CurrentInpatient.NoOfFirstPage.ToString(); dr["owner"] = userID; dr["createtime"] = CurrentDateTime; dr["auditor"] = ""; dr["audittime"] = null; dr["hassubmit"] = "4600"; dr["hasprint"] = "3600"; dr["hassign"] = "0"; dr["islock"] = "4700"; if (dr["sortid"].ToString() == ContainerCatalog.BingChengJiLu)//针对病程需要特殊处理,每份病例的时间间距是1天 { string bingChenDateTime = Convert.ToDateTime(CurrentDateTime).AddDays(day).ToString("yyyy-MM-dd HH:mm:ss"); day++; dr["name"] = dr["name"].ToString().Split(' ')[0] + ' ' + bingChenDateTime + ' ' + userName; dr["captiondatetimeTemp"] = bingChenDateTime; } else { dr["name"] = dr["name"].ToString().Split(' ')[0] + ' ' + CurrentDateTime + ' ' + userName; dr["captiondatetime"] = System.DateTime.MinValue; } } //【2】修改病程病例中节点的时间 XmlDocument xmlDoc = new XmlDocument(); xmlDoc.PreserveWhitespace = true; foreach (DataRow dr in dt.Rows) { if (dr["sortid"].ToString() == ContainerCatalog.BingChengJiLu) //针对病程需要特殊处理,每份病例的时间间距是1天 { if (dr["FIRSTDAILYFLAG"].ToString() == "1") //首次病程中保存了病程的内容 { xmlDoc.LoadXml(dr["content"].ToString()); } XmlNodeList nodeList = xmlDoc.GetElementsByTagName("text"); foreach (XmlElement ele in nodeList) { if (ele.HasAttribute("type") && ele.HasAttribute("name")) { if (ele.Attributes["type"].Value == "text" && ele.Attributes["name"].Value == "记录日期") { if (ele.InnerText.Trim() == dr["captiondatetime"].ToString()) { ele.InnerXml = dr["captiondatetimeTemp"].ToString(); dr["captiondatetime"] = dr["captiondatetimeTemp"].ToString(); break; } } } } } } //【3】修改病程保存到首程中 foreach (DataRow dr in dt.Rows) { if (dr["sortid"].ToString() == ContainerCatalog.BingChengJiLu) //针对病程需要特殊处理,每份病例的时间间距是1天 { if (dr["FIRSTDAILYFLAG"].ToString() == "1") //首次病程中保存了病程的内容 { dr["content"] = xmlDoc.InnerXml; break; } } } //【4】保存到数据库 DS_Common.SetWaitDialogCaption(m_WaitDialog, "正在保存病历..."); XmlDocument doc = new XmlDocument(); doc.PreserveWhitespace = true; UCEmrInput UcEmr = new UCEmrInput(); List <EmrModel> listmodel = new List <EmrModel>(); foreach (DataRow dr in dt.Rows) { if (dr["sortid"].ToString() == ContainerCatalog.BingChengJiLu && !m_IsNeedBatchInDailyEmr)//如果是病程记录,并且不需要导入病程,则暂时不做任何动作 { //TODO } else { EmrModel model = new EmrModel(dr); //如果不为空,则遍历到病程记录时,就代表对首程进行操作时 ,遍历其他病程记录时不会进这个方法 //edit by ywk 2012年12月10日15:33:59 listmodel.Add(model); if (dr["content"].ToString().Trim() != "") { //XmlDocument doc = new XmlDocument(); //doc.PreserveWhitespace = true; doc.LoadXml(dr["content"].ToString()); model.ModelContent = doc; } #region 注释掉的 //XmlDocument doc = new XmlDocument(); //doc.PreserveWhitespace = true; ////改为病程特殊处理 //if (dr["content"].ToString().Trim() != "" && dr["sortid"].ToString() != "AC") //{ // doc.LoadXml(dr["content"].ToString()); // model.ModelContent = doc; //} //if (dr["sortid"].ToString() == "AC") //{ // if (dr["FIRSTDAILYFLAG"].ToString() == "1")//是首程 // { // doc.LoadXml(dr["content"].ToString()); // model.ModelContent = doc; // } // else // { // } //} #endregion m_RecordDal.InsertModelInstance(model, Convert.ToInt32(m_CurrentInpatient.NoOfFirstPage)); } } UcEmr.SaveDocumentByModelList(listmodel, m_RecordDal, m_CurrentInpatient); #region 注释掉的 //HistoryEMRBLL bll = new HistoryEMRBLL(m_App, m_CurrentInpatient, m_RecordDal, "AC"); ////处理有的病程记录有节点,右侧没内容的情况 add by ywk 2012年12月10日16:45:07 //foreach (DataRow dr in dt.Rows) //{ // if (dr["sortid"].ToString() == "AC") // { // if (!bll.CheckExistRecordDetail(Int32.Parse(dr["ID"].ToString()), dr["captiondatetime"].ToString())) // { // //DS_SqlService.UpdateRecordValid(Int32.Parse(dr["ID"].ToString()), false); // bll.UpdateRecordValid(Int32.Parse(dr["ID"].ToString()), false); // } // } //} #endregion } catch (Exception ex) { throw new Exception(ex.Message); } }