private void AddPadForm() { PadForm pad = new PadForm(m_PatUtil, null); pad.Dock = DockStyle.Fill; pad.LoadDocment(m_Model); this.Text = "病历内容--" + m_Model.ModelName; panelEmrContent.Controls.Add(pad); }
private void AddPadForm() { PadForm pad = new PadForm(m_PatUtil, null); pad.Dock = DockStyle.Fill; //pad.BackColor = Color.White;//打印还是白色 pad.SetBackColor(); InitEmrDoc(); pad.LoadDocment(m_Model); this.Text = "打印预览--" + m_Model.ModelName; panelControlPrintReview.Controls.Add(pad); SetEmrDocumentModel(); }
/// <summary> /// 设置病程的所有时间 /// </summary> /// <param name="node"></param> public void SetAllDisplayDateTime(PadForm padForm) { try { if (padForm != null) { ArrayList al = new ArrayList(); padForm.zyEditorControl1.EMRDoc.GetAllSpecElement(al, padForm.zyEditorControl1.EMRDoc.RootDocumentElement, ElementType.Text, "记录日期"); if (al.Count > 0) { foreach (ZYText ele in al) { m_AllDisplayDateTime.Add(DateTime.Parse(ele.Text).ToString("yyyy-MM-dd HH:mm:ss")); } } } } catch (Exception) { } }
private PadForm GetSourcePadFormForReplaceItem(string sourceEMR) { try { m_EmrSourceModel = null; GetEmrDestModel(treeList1.Nodes, sourceEMR); if (m_EmrSourceModel != null) { PadForm pad = new PadForm(m_patUtil, m_RecordDal); InsertEmrModelContent(pad, m_EmrSourceModel); return(pad); } else { return(null); } } catch (Exception ex) { throw ex; } }
private void FillModelMacro(PadForm padForm) { try { if (padForm != null) { bool isModified = padForm.zyEditorControl1.EMRDoc.Modified; //根据病历的不同状态,调用程序在此处初始化宏的值。 //替换标题中的宏 XmlDocument headerdoc = new XmlDocument(); headerdoc.LoadXml(padForm.zyEditorControl1.EMRDoc.HeadString); XmlNodeList nodes = headerdoc.SelectNodes("header/p/macro"); foreach (XmlNode node in nodes) //为默认值的时候进行替换 { if (node.Attributes["name"].Value.Trim() == "科室" && node.InnerText.Trim() != "科室") { continue; } if (node.Attributes["name"].Value.Trim() == "病区" && node.InnerText.Trim() != "病区") { continue; } //Add by wwj 2012-07-17 if (node.Attributes["name"].Value.Trim() == "医师签名" && node.InnerText.Trim() != "医师签名") { continue; } if (node.Attributes["name"].Value.Trim() == "当前日期" && node.InnerText.Trim() != "当前日期") { continue; } if (node.Attributes["name"].Value.Trim() == "当前时间" && node.InnerText.Trim() != "当前时间") { continue; } node.InnerText = GetDataByNameForMacro(node.Attributes["name"].Value); } padForm.zyEditorControl1.EMRDoc.HeadString = headerdoc.OuterXml; //替换文档中的宏 //获得所有宏元素列表 ArrayList al = new ArrayList(); ZYTextDocument doc = padForm.zyEditorControl1.EMRDoc; doc.GetAllSpecElement(al, doc.RootDocumentElement, ElementType.Macro, null); //循环每个宏元素,根据宏元素的Name属性,查询并赋值线Text属性 foreach (ZYMacro m in al) { if (m.Name == "科室" && m.Text.Trim() != "科室") { continue; } if (m.Name == "病区" && m.Text.Trim() != "病区") { continue; } //Add by wwj 2012-07-17 if (m.Name == "医师签名" && m.text.Trim() != "医师签名") { continue; } if (m.Name == "当前日期" && m.text.Trim() != "当前日期") { continue; } if (m.Name == "当前时间" && m.text.Trim() != "当前时间") { continue; } m.Text = GetDataByNameForMacro(m.Name); } doc.RefreshSize(); doc.ContentChanged(); doc.OwnerControl.Refresh(); doc.UpdateCaret(); padForm.zyEditorControl1.EMRDoc.Modified = isModified; } } catch (Exception ex) { throw ex; } }
private void ReplaceModelMacro(EmrModel model) { try { //循环每个可替换元素,根据可替换元素的Name属性,查询并赋值Text属性 //获得病历中所有可替换元素列表 ArrayList al = new ArrayList(); ZYTextDocument doc = CurrentForm.zyEditorControl1.EMRDoc; doc.GetAllSpecElement(al, doc.RootDocumentElement, ElementType.Replace, null); //无可替换元素则退出 if (al.Count < 0) { return; } Dictionary <string, PadForm> padFormDictionary = new Dictionary <string, PadForm>(); //获得当前病历需要替换的项目需要从哪些病历中提取 DataTable dtReplaceItem = m_RecordDal.GetReplaceItem(model.ModelName); //源病历的列表 List <string> sourceEmrList = m_RecordDal.GetSourceEMRByDestEmrName(model.ModelName, dtReplaceItem); foreach (string sourceEmr in sourceEmrList) { PadForm padForm = GetSourcePadFormForReplaceItem(sourceEmr); padFormDictionary.Add(sourceEmr, padForm); } if (padFormDictionary.Count == 0) { return; } int startIndex; int endIndex; GetEditAreaIndex(doc, out startIndex, out endIndex); DocumentModel docModel = CurrentForm.zyEditorControl1.EMRDoc.Info.DocumentModel; //替换当前病历中的项目 foreach (ZYReplace m in al) { //排除编辑范围之外的可替换元素 if (c_IsOpenEditAreaCanReplaceFlag && docModel == DocumentModel.Read && startIndex != -1 && endIndex != -1) { int zyReplaceIndex = CurrentForm.zyEditorControl1.EMRDoc.Content.IndexOf(m.FirstElement); if (zyReplaceIndex < startIndex || zyReplaceIndex > endIndex) { continue; } } List <string> destList = m_RecordDal.GetSourceEMRByDestItemAndDestEmrName(model.ModelName, m.Name, dtReplaceItem); if (destList.Count == 0) { continue; } if (destList.Count == 2) { string source_emrname = destList[0]; string source_itemname = destList[1]; PadForm padForm = padFormDictionary[source_emrname]; if (padForm != null) { m.Text = padForm.zyEditorControl1.EMRDoc.GetReplaceText(source_itemname); } } } doc.RefreshSize(); doc.ContentChanged(); doc.OwnerControl.Refresh(); doc.UpdateCaret(); } catch (Exception ex) { throw ex; } }