private void dgvDE_DoubleClick(object sender, EventArgs e) { if (dgvDE.SelectedRows.Count == 0) { return; } int vRow = dgvDE.SelectedRows[0].Index; DeItem vDeItem = new DeItem(dgvDE.Rows[vRow].Cells[1].Value.ToString()); if (FEmrEdit.CurStyleNo > HCStyle.Null) { vDeItem.StyleNo = FEmrEdit.CurStyleNo; } else { vDeItem.StyleNo = 0; } vDeItem.ParaNo = FEmrEdit.CurParaNo; vDeItem[DeProp.Name] = dgvDE.Rows[vRow].Cells[1].Value.ToString(); vDeItem[DeProp.Index] = dgvDE.Rows[vRow].Cells[0].Value.ToString(); FEmrEdit.InsertItem(vDeItem); }
private void DoTraverseItem(HCCustomData aData, int aItemNo, int aTags, ref bool aStop) { if (!(aData.Items[aItemNo] is DeItem)) { return; } DeItem vDeItem = aData.Items[aItemNo] as DeItem; if (TTravTag.Contains(aTags, TTravTag.WriteTraceInfo)) { switch (vDeItem.StyleEx) { case StyleExtra.cseNone: vDeItem[DeProp.Trace] = ""; break; case StyleExtra.cseDel: if (vDeItem[DeProp.Trace] == "") { vDeItem[DeProp.Trace] = UserInfo.Name + "(" + UserInfo.ID + ") 删除 " + string.Format("{0:yyyy-MM-dd}", FServerInfo.DateTime); } break; case StyleExtra.cseAdd: if (vDeItem[DeProp.Trace] == "") { vDeItem[DeProp.Trace] = UserInfo.Name + "(" + UserInfo.ID + ") 添加 " + string.Format("{0:yyyy-MM-dd}", FServerInfo.DateTime); } break; } } }
private void DoDeItemPaintBKG(object sender, HCCanvas aCanvas, RECT aDrawRect, PaintInfo aPaintInfo) { if (!aPaintInfo.Print) { DeItem vDeItem = sender as DeItem; if (vDeItem.IsElement) { if (vDeItem.MouseIn || vDeItem.Active) { if (vDeItem.IsSelectPart || vDeItem.IsSelectComplate) { } else { if (vDeItem[DeProp.Name] != vDeItem.Text) { aCanvas.Brush.Color = FDeDoneColor; } else // 没填写过 { aCanvas.Brush.Color = FDeUnDoneColor; } aCanvas.FillRect(aDrawRect); } } } else // 不是数据元 if (FDesignMode && vDeItem.EditProtect) { aCanvas.Brush.Color = HC.View.HC.clBtnFace; aCanvas.FillRect(aDrawRect); } } }
private void DoSyncDeItem(object sender, HCCustomData aData, DeItem aItem) { if (FOnSyncDeItem != null) { FOnSyncDeItem(sender, aData, aItem); } }
public void InsertDeItem(string aIndex, string aName) { DeItem vDeItem = FEmrView.NewDeItem(aName); vDeItem[DeProp.Index] = aIndex; vDeItem[DeProp.Name] = aName; FEmrView.InsertDeItem(vDeItem); }
private void DoDEInsertAsDeItem(object sender, EventArgs e) { DeItem vDeItem = FEmrEdit.NewDeItem(frmDataElement.GetDeName()); vDeItem[DeProp.Index] = frmDataElement.GetDeIndex(); vDeItem[DeProp.Name] = frmDataElement.GetDeName(); FEmrEdit.InsertDeItem(vDeItem); }
public void SetHCView(HCView aHCView) { DeItem vDeItem = aHCView.ActiveSectionTopLevelData().GetActiveItem() as DeItem; dgvProperty.RowCount = vDeItem.Propertys.Count + 1; int vRow = 0; foreach (KeyValuePair <string, string> keyValuePair in vDeItem.Propertys) { dgvProperty.Rows[vRow].Cells[0].Value = keyValuePair.Key; dgvProperty.Rows[vRow].Cells[1].Value = keyValuePair.Value; vRow++; } cbxCanEdit.Checked = !vDeItem.EditProtect; cbxCanCopy.Checked = !vDeItem.CopyProtect; cbxDeleteAllow.Checked = vDeItem.DeleteAllow; cbxAllocOnly.Checked = vDeItem.AllocOnly; this.ShowDialog(); if (this.DialogResult == System.Windows.Forms.DialogResult.OK) { string vsValue = ""; vDeItem.Propertys.Clear(); for (int i = 0; i < dgvProperty.RowCount; i++) { if (dgvProperty.Rows[i].Cells[0].Value == null) { continue; } if (dgvProperty.Rows[i].Cells[1].Value == null) { vsValue = ""; } else { vsValue = dgvProperty.Rows[i].Cells[1].Value.ToString(); } if (dgvProperty.Rows[i].Cells[0].Value.ToString().Trim() != "") { vDeItem.Propertys.Add(dgvProperty.Rows[i].Cells[0].Value.ToString(), vsValue); } } vDeItem.EditProtect = !cbxCanEdit.Checked; vDeItem.CopyProtect = !cbxCanCopy.Checked; vDeItem.DeleteAllow = cbxDeleteAllow.Checked; vDeItem.AllocOnly = cbxAllocOnly.Checked; } //Close(); }
private void DoSyncDeItem(object sender, HCCustomData aData, HCCustomItem aItem) { if (aItem is DeItem) { DeItem vDeItem = aItem as DeItem; if (vDeItem.IsElement) { string vDeIndex = vDeItem[DeProp.Index]; if (vDeIndex != "") { DataRow[] vDataRows = FDataElementSetMacro.Select("ObjID=" + vDeIndex); if (vDataRows.Length == 1) // 有此数据元的替换信息 { string vsResult = ""; switch (vDataRows[0]["MacroType"].ToString()) { case "1": // 患者信息(客户端处理) vsResult = EMR.GetValueAsString(PatientInfo.FieldByName(vDataRows[0]["Macro"].ToString())); break; case "2": // 用户信息(客户端处理) vsResult = EMR.GetValueAsString(UserInfo.FieldByName(vDataRows[0]["Macro"].ToString())); break; case "3": // 病历信息(服务端处理) vsResult = GetDeValueFromStruct(PatientInfo.PatID, int.Parse(vDataRows[0]["Macro"].ToString()), vDeItem[DeProp.Index]); break; case "4": // 环境信息(服务端,如当前时间等) vsResult = EMR.GetValueAsString(FServerInfo.FieldByName(vDataRows[0]["Macro"].ToString())); break; case "5": // SQL脚本(服务端处理) vsResult = GetMarcoSqlResult(vDeIndex, vDataRows[0]["Macro"].ToString()); break; default: break; } if (vsResult != "") { vDeItem.Text = vsResult; } } } } } }
public bool RunScript(string script, DeItem deItem, PatientInfo patientInfo, RecordInfo recordInfo, ref string text, ref bool cancel) { FErrorMessage = ""; List <string> references = new List <string>(); InitReferences(references); ScriptEngine scriptEngine = new ScriptEngine(false, script, references); ScriptResult scriptResult = (ScriptResult)scriptEngine.Invoke("CheckValue", deItem, patientInfo, recordInfo, text, cancel); text = scriptResult.Text; cancel = scriptResult.Cancel; return(true); }
/// <summary> 遍历处理痕迹隐藏或显示 </summary> private void DoHideTraceTraverse(HCCustomData aData, int aItemNo, int aTags, ref bool aStop) { if (!(aData.Items[aItemNo] is DeItem)) // 只对元素生效 { return; } DeItem vDeItem = aData.Items[aItemNo] as DeItem; if (vDeItem.StyleEx == StyleExtra.cseDel) { vDeItem.Visible = !(aTags == TTravTag.HideTrace); // 隐藏/显示痕迹 } }
public override bool CanConcatItems(HCCustomItem aItem) { bool Result = base.CanConcatItems(aItem); if (Result) { DeItem vDeItem = aItem as DeItem; Result = ((this[DeProp.Index] == vDeItem[DeProp.Index]) && (this.FStyleEx == vDeItem.StyleEx) && (FEditProtect == vDeItem.FEditProtect) && (this[DeProp.Trace] == vDeItem[DeProp.Trace])); } return(Result); }
/// <summary> 插入一个数据元(文本形式) </summary> /// <param name="aIndex">数据元唯一标识</param> /// <param name="aName">数据元名称</param> public DeItem InsertDeItem(string aIndex, string aName) { if ((aIndex == "") || (aName == "")) { MessageBox.Show("要插入的数据元索引和名称不能为空!"); return(null); } DeItem vDeItem = FEmrView.NewDeItem(aName); vDeItem[DeProp.Index] = aIndex; vDeItem[DeProp.Name] = aName; FEmrView.InsertDeItem(vDeItem); return(vDeItem); }
public DeItem NewDeItem(string atext) { DeItem vDeItem = new DeItem(atext); if (this.CurStyleNo > HCStyle.Null) { vDeItem.StyleNo = this.CurStyleNo; } else { vDeItem.StyleNo = 0; } vDeItem.ParaNo = this.CurParaNo; return(vDeItem); }
/// <summary> 设置当前数据元的文本内容 </summary> private void DoSetActiveDeItemText(DeItem aDeItem, string aText, ref bool aCancel) { if (FOnSetDeItemText != null) { string vText = aText; FOnSetDeItemText(this, aDeItem, ref vText, ref aCancel); if (!aCancel) { FEmrEdit.SetActiveItemText(vText); } } else { FEmrEdit.SetActiveItemText(aText); } }
private void InsertEmrTraceItem(string aText) { DeItem vEmrTraceItem = new DeItem(aText); if (this.CurStyleNo < HCStyle.Null) { vEmrTraceItem.StyleNo = 0; } else { vEmrTraceItem.StyleNo = this.CurStyleNo; } vEmrTraceItem.ParaNo = this.CurParaNo; vEmrTraceItem.StyleEx = StyleExtra.cseAdd; this.InsertItem(vEmrTraceItem); }
private void DoTraverseItem(HCCustomData aData, int aItemNo, int aTag, ref bool aStop) { if (!(aData.Items[aItemNo] is DeItem)) { return; } DeItem vDeItem = aData.Items[aItemNo] as DeItem; if (FTraverseTags.Contains(TraverseTag.ttWriteTraceInfo)) { switch (vDeItem.StyleEx) { case StyleExtra.cseNone: vDeItem[DeProp.Trace] = ""; break; case StyleExtra.cseDel: if (vDeItem[DeProp.Trace] == "") { vDeItem[DeProp.Trace] = UserInfo.Name + "(" + UserInfo.ID + ") 删除 " + string.Format("{0:yyyy-MM-dd}", DateTime.Now); } break; case StyleExtra.cseAdd: if (vDeItem[DeProp.Trace] == "") { vDeItem[DeProp.Trace] = UserInfo.Name + "(" + UserInfo.ID + ") 添加 " + string.Format("{0:yyyy-MM-dd}", DateTime.Now); } break; } } if (FTraverseTags.Contains(TraverseTag.ttShowTrace)) { if (vDeItem.StyleEx == StyleExtra.cseDel) { vDeItem.Visible = !vDeItem.Visible; } } }
/// <summary> 新建数据元 </summary> /// <param name="aText">数据元文本</param> /// <returns>新建好的数据元</returns> public DeItem NewDeItem(string aText) { DeItem Result = new DeItem(); Result.Text = aText; if (this.CurStyleNo > HCStyle.Null) { Result.StyleNo = this.CurStyleNo; } else { Result.StyleNo = 0; } Result.ParaNo = this.CurParaNo; return(Result); }
/// <summary> 当节中某Data有Item删除后触发 </summary> /// <param name="sender">在哪个文档节删除</param> /// <param name="aData">在哪个Data删除</param> /// <param name="aItem">已删除的Item</param> protected override void DoSectionRemoveItem(object sender, HCCustomData aData, HCCustomItem aItem) { if (aItem is DeItem) { DeItem vDeItem = aItem as DeItem; vDeItem.OnPaintBKG = DoDeItemPaintBKG; if (vDeItem.StyleEx != StyleExtra.cseNone) { FTraceCount--; if ((FTraceCount == 0) && (this.AnnotatePre.Visible) && (this.AnnotatePre.Count == 0)) { this.AnnotatePre.Visible = false; } } } base.DoSectionRemoveItem(sender, aData, aItem); }
private void mniDeleteProtect_Click(object sender, EventArgs e) { HCCustomData vTopData = FEmrView.ActiveSectionTopLevelData(); if (vTopData.SelectExists()) { string vS = vTopData.GetSelectText(); vS = vS.Replace("\n", "").Replace("\t", "").Replace("\r", ""); DeItem vDeItem = FEmrView.NewDeItem(vS); vDeItem.EditProtect = true; FEmrView.InsertDeItem(vDeItem); } else { DeItem vDeItem = vTopData.GetActiveItem() as DeItem; if (vDeItem.EditProtect) { vDeItem.EditProtect = false; FEmrView.ReAdaptActiveItem(); } } }
/// <summary> 文档某节的Item绘制完成 </summary> /// <param name="AData">当前绘制的Data</param> /// <param name="ADrawItemIndex">Item对应的DrawItem序号</param> /// <param name="ADrawRect">Item对应的绘制区域</param> /// <param name="ADataDrawLeft">Data绘制时的Left</param> /// <param name="ADataDrawBottom">Data绘制时的Bottom</param> /// <param name="ADataScreenTop">绘制时呈现Data的Top位置</param> /// <param name="ADataScreenBottom">绘制时呈现Data的Bottom位置</param> /// <param name="ACanvas">画布</param> /// <param name="APaintInfo">绘制时的其它信息</param> protected override void DoSectionDrawItemPaintAfter(Object sender, HCCustomData aData, int aItemNo, int aDrawItemNo, RECT aDrawRect, int aDataDrawLeft, int aDataDrawRight, int aDataDrawBottom, int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo) { if ((!FHideTrace) && (FTraceCount > 0)) // 显示痕迹且有痕迹 { HCCustomItem vItem = aData.Items[aItemNo]; if (vItem.StyleNo > HCStyle.Null) { DeItem vDeItem = vItem as DeItem; if (vDeItem.StyleEx != StyleExtra.cseNone) // 添加批注 { HCDrawAnnotateDynamic vDrawAnnotate = new HCDrawAnnotateDynamic(); vDrawAnnotate.DrawRect = aDrawRect; vDrawAnnotate.Title = vDeItem.GetHint(); vDrawAnnotate.Text = aData.GetDrawItemText(aDrawItemNo); this.AnnotatePre.AddDrawAnnotate(vDrawAnnotate); } } } if ((FPageBlankTip != "") && (aData is HCPageData)) { if (aDrawItemNo < aData.DrawItems.Count - 1) { if (aData.Items[aData.DrawItems[aDrawItemNo + 1].ItemNo].PageBreak) { DrawBlankTip_(aDataDrawLeft, aDrawRect.Top + aDrawRect.Height + aData.GetLineBlankSpace(aDrawItemNo), aDataDrawRight, aDataDrawBottom, aCanvas); } } else { DrawBlankTip_(aDataDrawLeft, aDrawRect.Top + aDrawRect.Height + aData.GetLineBlankSpace(aDrawItemNo), aDataDrawRight, aDataDrawBottom, aCanvas); } } base.DoSectionDrawItemPaintAfter(sender, aData, aItemNo, aDrawItemNo, aDrawRect, aDataDrawLeft, aDataDrawRight, aDataDrawBottom, aDataScreenTop, aDataScreenBottom, aCanvas, aPaintInfo); }
/// <summary> 当节某Data有Item插入后触发 </summary> /// <param name="sender">在哪个文档节插入</param> /// <param name="aData">在哪个Data插入</param> /// <param name="aItem">已插入的Item</param> protected override void DoSectionInsertItem(object sender, HCCustomData aData, HCCustomItem aItem) { if (aItem is DeItem) { DeItem vDeItem = aItem as DeItem; vDeItem.OnPaintBKG = DoDeItemPaintBKG; if (vDeItem.StyleEx != StyleExtra.cseNone) { FTraceCount++; if (!this.AnnotatePre.Visible) { this.AnnotatePre.Visible = true; } } DoSyncDeItem(sender, aData, vDeItem); } base.DoSectionInsertItem(sender, aData, aItem); }
protected override void DoDrawItemPaintBefor(HCCustomData aData, int aItemNo, int aDrawItemNo, RECT aDrawRect, RECT aClearRect, int aDataDrawLeft, int aDataDrawRight, int aDataDrawBottom, int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo) { if ((!aPaintInfo.Print) && (aData.Items[aItemNo] is DeItem)) { DeItem vDeItem = aData.Items[aItemNo] as DeItem; if (vDeItem.IsElement) // 是数据元 { if ((vDeItem.MouseIn) || (vDeItem.Active)) // 鼠标移入和光标 { if ((vDeItem.IsSelectPart) || (vDeItem.IsSelectComplate)) { } else { if (vDeItem[DeProp.Name] != vDeItem.Text) // 已经填写过了 { aCanvas.Brush.Color = FDeDoneColor; } else // 没填写过 { aCanvas.Brush.Color = FDeUnDoneColor; } aCanvas.FillRect(aDrawRect); } } } else // 不是数据元 { if (FDesignMode && vDeItem.EditProtect) { aCanvas.Brush.Color = HC.View.HC.clBtnFace; aCanvas.FillRect(aDrawRect); } } } }
/// <summary> 文档某节的Item绘制完成 </summary> /// <param name="AData">当前绘制的Data</param> /// <param name="ADrawItemIndex">Item对应的DrawItem序号</param> /// <param name="ADrawRect">Item对应的绘制区域</param> /// <param name="ADataDrawLeft">Data绘制时的Left</param> /// <param name="ADataDrawBottom">Data绘制时的Bottom</param> /// <param name="ADataScreenTop">绘制时呈现Data的Top位置</param> /// <param name="ADataScreenBottom">绘制时呈现Data的Bottom位置</param> /// <param name="ACanvas">画布</param> /// <param name="APaintInfo">绘制时的其它信息</param> protected override void DoSectionDrawItemPaintAfter(Object sender, HCCustomData aData, int aDrawItemNo, RECT aDrawRect, int aDataDrawLeft, int aDataDrawBottom, int aDataScreenTop, int aDataScreenBottom, HCCanvas aCanvas, PaintInfo aPaintInfo) { if (FTraceCount > 0) // 显示批注 { HCCustomItem vItem = aData.Items[aData.DrawItems[aDrawItemNo].ItemNo]; if (vItem.StyleNo > HCStyle.Null) { DeItem vDeItem = vItem as DeItem; if (vDeItem.StyleEx != StyleExtra.cseNone) // 添加批注 { HCDrawAnnotateDynamic vDrawAnnotate = new HCDrawAnnotateDynamic(); vDrawAnnotate.DrawRect = aDrawRect; vDrawAnnotate.Title = vDeItem.GetHint(); vDrawAnnotate.Text = aData.GetDrawItemText(aDrawItemNo); this.AnnotatePre.AddDrawAnnotate(vDrawAnnotate); } } } base.DoSectionDrawItemPaintAfter(sender, aData, aDrawItemNo, aDrawRect, aDataDrawLeft, aDataDrawBottom, aDataScreenTop, aDataScreenBottom, aCanvas, aPaintInfo); }
public bool InsertDeItem(DeItem aDeItem) { return(this.InsertItem(aDeItem)); }
public void TraverseItem(HCCustomData aData, int aItemNo, int aTag, ref bool aStop) { if ((aData is HCHeaderData) || (aData is HCFooterData)) { return; } if (aData.Items[aItemNo] is DeGroup) // 数据组 { DeGroup vDeGroup = aData.Items[aItemNo] as DeGroup; if (vDeGroup.MarkType == MarkType.cmtBeg) { XmlElement vXmlNode = FXmlDoc.CreateElement("DeGroup"); if (FDeGroupNodes.Count > 0) { FDeGroupNodes[FDeGroupNodes.Count - 1].AppendChild(vXmlNode); } else { FXmlDoc.DocumentElement.AppendChild(vXmlNode); } vXmlNode.SetAttribute("Index", vDeGroup[DeProp.Index]); DataRow[] vRows = FDETable.Select("DeID=" + vDeGroup[DeProp.Index]); if (vRows.Length == 1) { vXmlNode.SetAttribute("Code", vRows[0]["decode"].ToString()); vXmlNode.SetAttribute("Name", vRows[0]["dename"].ToString()); } FDeGroupNodes.Add(vXmlNode); } else { if (FDeGroupNodes.Count > 0) { FDeGroupNodes.RemoveAt(FDeGroupNodes.Count - 1); } } } else if (aData.Items[aItemNo].StyleNo > HCStyle.Null) // 文本类 { if ((aData.Items[aItemNo] as DeItem).IsElement) // 是数据元 { DeItem vDeItem = aData.Items[aItemNo] as DeItem; if (vDeItem[DeProp.Index] != "") { XmlElement vXmlNode = FXmlDoc.CreateElement("DeItem"); if (FDeGroupNodes.Count > 0) { FDeGroupNodes[FDeGroupNodes.Count - 1].AppendChild(vXmlNode); } else { FXmlDoc.DocumentElement.AppendChild(vXmlNode); } vXmlNode.InnerText = vDeItem.Text; vXmlNode.SetAttribute("Index", vDeItem[DeProp.Index]); DataRow[] vRows = FDETable.Select("DeID=" + vDeItem[DeProp.Index]); if (vRows.Length == 1) { vXmlNode.SetAttribute("Code", vRows[0]["decode"].ToString()); vXmlNode.SetAttribute("Name", vRows[0]["dename"].ToString()); } } } else if (!FOnlyDeItem) { XmlElement vXmlNode = FXmlDoc.CreateElement("Text"); if (FDeGroupNodes.Count > 0) { FDeGroupNodes[FDeGroupNodes.Count - 1].AppendChild(vXmlNode); } else { FXmlDoc.DocumentElement.AppendChild(vXmlNode); } vXmlNode.InnerText = aData.Items[aItemNo].Text; } } else // 非文本类 { if (aData.Items[aItemNo] is EmrYueJingItem) { XmlElement vXmlNode = FXmlDoc.CreateElement("DeItem"); if (FDeGroupNodes.Count > 0) { FDeGroupNodes[FDeGroupNodes.Count - 1].AppendChild(vXmlNode); } else { FXmlDoc.DocumentElement.AppendChild(vXmlNode); } (aData.Items[aItemNo] as EmrYueJingItem).ToXmlEmr(vXmlNode as XmlElement); } else if (aData.Items[aItemNo] is EmrToothItem) { XmlElement vXmlNode = FXmlDoc.CreateElement("DeItem"); if (FDeGroupNodes.Count > 0) { FDeGroupNodes[FDeGroupNodes.Count - 1].AppendChild(vXmlNode); } else { FXmlDoc.DocumentElement.AppendChild(vXmlNode); } (aData.Items[aItemNo] as EmrToothItem).ToXmlEmr(vXmlNode as XmlElement); } else if (aData.Items[aItemNo] is EmrFangJiaoItem) { XmlElement vXmlNode = FXmlDoc.CreateElement("DeItem"); if (FDeGroupNodes.Count > 0) { FDeGroupNodes[FDeGroupNodes.Count - 1].AppendChild(vXmlNode); } else { FXmlDoc.DocumentElement.AppendChild(vXmlNode); } (aData.Items[aItemNo] as EmrFangJiaoItem).ToXmlEmr(vXmlNode as XmlElement); } } }
public bool PopupDeItem(DeItem aDeItem, POINT aPopupPt) { FFrmtp = ""; FDeItem = aDeItem; string vDeUnit = ""; int vCMV = -1; DataTable dt = emrMSDB.DB.GetData(string.Format("SELECT DeCode, PY, frmtp, deunit, domainid " + "FROM Comm_DataElement WHERE DeID ={0}", FDeItem[DeProp.Index])); if (dt.Rows.Count > 0) { FFrmtp = dt.Rows[0]["frmtp"].ToString(); vDeUnit = dt.Rows[0]["deunit"].ToString(); vCMV = int.Parse(dt.Rows[0]["domainid"].ToString()); } if (FFrmtp == DeFrmtp.Number) // 数值 { FTemplate = false; FTemp = false; FConCalcValue = false; if (aDeItem[DeProp.Unit] != "") { tbxValue.Text = aDeItem.Text.Replace(aDeItem[DeProp.Unit], ""); } else { tbxValue.Text = aDeItem.Text; } if (tbxValue.Text != "") { tbxValue.SelectAll(); } cbbUnit.Items.Clear(); string[] vStrings = vDeUnit.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < vStrings.Length; i++) { cbbUnit.Items.Add(vStrings[i]); } if (cbbUnit.Items.Count > 0) { cbbUnit.SelectedIndex = cbbUnit.Items.IndexOf(aDeItem[DeProp.Unit]); if (cbbUnit.SelectedIndex < 0) { cbbUnit.SelectedIndex = 0; } } else { cbbUnit.Text = aDeItem[DeProp.Unit]; } cbxHideUnit.Checked = aDeItem[DeProp.HideUnit] == "1"; tabPop.SelectedIndex = 1; this.Width = 185; if (aDeItem[DeProp.Index] == "979") // 体温 { tabQk.SelectedIndex = 0; this.Height = 300; } else { tabQk.SelectedIndex = -1; this.Height = 215; } } else if ((FFrmtp == DeFrmtp.Date) || (FFrmtp == DeFrmtp.Time) || (FFrmtp == DeFrmtp.DateTime)) // 日期时间 { tabPop.SelectedIndex = 3; this.Width = 260; this.Height = 170; btnNow_Click(null, null); pnlDate.Visible = FFrmtp != DeFrmtp.Time; pnlTime.Visible = FFrmtp != DeFrmtp.Date; } else if ((FFrmtp == DeFrmtp.Radio) || (FFrmtp == DeFrmtp.Multiselect)) // 单、多选 { MultSelect = FFrmtp == DeFrmtp.Multiselect; tbxSpliter.Clear(); if (FDBDomain.Rows.Count > 0) { FDBDomain.Reset(); } dgvDomain.RowCount = 0; tabPop.SelectedIndex = 0; this.Width = 290; this.Height = 300; if (vCMV > 0) // 有值域 { FDBDomain = emrMSDB.DB.GetData(string.Format("SELECT DE.ID, DE.Code, DE.devalue, DE.PY, DC.Content " + "FROM Comm_DataElementDomain DE LEFT JOIN Comm_DomainContent DC ON DE.ID = DC.DItemID " + "WHERE DE.domainid = {0}", vCMV)); } if (FDBDomain.Rows.Count > 0) // 有选项 { IniDomainUI(); } else // 没选项 { return(false); } } else if (FFrmtp == DeFrmtp.String) { //return false; // 文本的不弹了,使用直接在元素上修改的方式;直接修改怎么解决光标在最后时不是输入纯文本呢 tbxMemo.Clear(); tabPop.SelectedIndex = 2; this.Width = 260; this.Height = 200; } else // 不认识的类型不弹 { return(false); } System.Drawing.Rectangle vRect = Screen.GetWorkingArea(this); if (aPopupPt.X + Width > vRect.Right) { aPopupPt.X = vRect.Right - Width; } if (aPopupPt.Y + Height > vRect.Bottom) { aPopupPt.Y = vRect.Bottom - Height; } if (aPopupPt.X < vRect.Left) { aPopupPt.X = vRect.Left; } if (aPopupPt.Y < vRect.Top) { aPopupPt.Y = vRect.Top; } this.StartPosition = FormStartPosition.Manual; this.Location = new Point(aPopupPt.X, aPopupPt.Y); this.Show(); //User.ShowWindow(this.Handle, User.SW_SHOWNOACTIVATE); if (FFrmtp == DeFrmtp.Number) { tbxValue.Focus(); } return(true); }
private void DoEmrEditMouseUp(object sender, MouseEventArgs e) { string vInfo = ""; HCCustomItem vActiveItem = FEmrEdit.Data.GetTopLevelItem(); if (vActiveItem != null) { if (FEmrEdit.Data.ActiveDomain.BeginNo >= 0) { DeGroup vDeGroup = FEmrEdit.Data.Items[FEmrEdit.Data.ActiveDomain.BeginNo] as DeGroup; vInfo = vDeGroup[DeProp.Name]; } if (vActiveItem is DeItem) { DeItem vDeItem = vActiveItem as DeItem; if (vDeItem.StyleEx != StyleExtra.cseNone) { vInfo += "-" + vDeItem.GetHint(); } else if (vDeItem.Active && (vDeItem[DeProp.Index] != "") && (!vDeItem.IsSelectComplate) && (!vDeItem.IsSelectPart) && (Environment.TickCount - FMouseDownTick < 500) ) { vInfo = vInfo + "元素(" + vDeItem[DeProp.Index] + ")"; if (FEmrEdit.Data.ReadOnly) { //tssDeInfo.Text = ""; return; } POINT vPt = FEmrEdit.Data.GetActiveDrawItemCoord(); // 得到相对EmrEdit的坐标 HCCustomDrawItem vActiveDrawItem = FEmrEdit.Data.GetTopLevelDrawItem(); RECT vDrawItemRect = vActiveDrawItem.Rect; vDrawItemRect = HC.View.HC.Bounds(vPt.X, vPt.Y, vDrawItemRect.Width, vDrawItemRect.Height); if (HC.View.HC.PtInRect(vDrawItemRect, new POINT(e.X, e.Y))) { vPt.Y = vPt.Y + vActiveDrawItem.Height; Point vPoint = new Point(vPt.X, vPt.Y); vPoint = FEmrEdit.PointToScreen(vPoint); //HC.Win32.User.ClientToScreen(FEmrEdit.Handle, ref vPt); vPt.X = vPoint.X; vPt.Y = vPoint.Y; PopupForm().PopupDeItem(vDeItem, vPt); } } } else if (vActiveItem is DeEdit) { } else if (vActiveItem is DeCombobox) { } else if (vActiveItem is DeDateTimePicker) { } } //tssDeInfo.Text = vInfo; }
public void PopupDeItem(DeItem aDeItem, POINT aPopupPt) { FFrmtp = ""; FDeItem = aDeItem; string vDeUnit = ""; int vCMV = -1; DataTable dt = emrMSDB.DB.GetData(string.Format("SELECT DeCode, PY, frmtp, deunit, domainid FROM Comm_DataElement WHERE DeID ={0}", FDeItem[DeProp.Index])); if (dt.Rows.Count > 0) { FFrmtp = dt.Rows[0]["frmtp"].ToString(); vDeUnit = dt.Rows[0]["deunit"].ToString(); vCMV = int.Parse(dt.Rows[0]["domainid"].ToString()); } if (FFrmtp == DeFrmtp.Number) // 数值 { tbxValue.Clear(); tabPop.SelectedIndex = 1; this.Width = 185; if (aDeItem[DeProp.Index] == "979") // 体温 { tabQk.SelectedIndex = 0; this.Height = 285; } else { tabQk.SelectedIndex = -1; this.Height = 215; } } else if ((FFrmtp == DeFrmtp.Date) || (FFrmtp == DeFrmtp.Time) || (FFrmtp == DeFrmtp.DateTime)) // 日期时间 { tabPop.SelectedIndex = 3; this.Width = 260; this.Height = 170; pnlDate.Visible = FFrmtp != DeFrmtp.Time; pnlTime.Visible = FFrmtp != DeFrmtp.Date; } else if ((FFrmtp == DeFrmtp.Radio) || (FFrmtp == DeFrmtp.Multiselect)) // 单、多选 { tbxSpliter.Clear(); if (FDBDomain.Rows.Count > 0) { FDBDomain.Reset(); } dgvDomain.RowCount = 0; tabPop.SelectedIndex = 0; this.Width = 290; this.Height = 300; if (vCMV > 0) // 有值域 { FDBDomain = emrMSDB.DB.GetData(string.Format("SELECT DE.ID, DE.Code, DE.devalue, DE.PY, DC.Content FROM Comm_DataElementDomain DE LEFT JOIN Comm_DomainContent DC ON DE.ID = DC.DItemID WHERE DE.domainid = {0}", vCMV)); } if (FDBDomain.Rows.Count > 0) { IniDomainUI(); } } else if (FFrmtp == DeFrmtp.String) { tbxMemo.Clear(); tabPop.SelectedIndex = 2; this.Width = 260; this.Height = 200; } this.StartPosition = FormStartPosition.Manual; this.Location = new Point(aPopupPt.X, aPopupPt.Y); this.Show(); }
/// <summary> 设置当前数据元的内容为扩展内容 </summary> private void DoSetActiveDeItemExtra(DeItem aDeItem, Stream aStream) { FEmrEdit.SetActiveItemExtra(aStream); }
private void DoDeItemPaintBKG(object sender, HCCanvas aCanvas, RECT aDrawRect, PaintInfo aPaintInfo) { if (aPaintInfo.Print) { return; } DeItem vDeItem = sender as DeItem; if (!vDeItem.Selected()) { if (vDeItem.IsElement) { if (vDeItem.MouseIn || vDeItem.Active) { if (vDeItem.IsSelectPart || vDeItem.IsSelectComplate) { } else { if (vDeItem[DeProp.Name] != vDeItem.Text) { aCanvas.Brush.Color = FDeDoneColor; } else // 没填写过 { aCanvas.Brush.Color = FDeUnDoneColor; } aCanvas.FillRect(aDrawRect); } } else // 不是数据元 if (FDesignMode) { aCanvas.Brush.Color = HC.View.HC.clBtnFace; aCanvas.FillRect(aDrawRect); } } else // 不是数据元 if (FDesignMode && vDeItem.EditProtect) { aCanvas.Brush.Color = HC.View.HC.clBtnFace; aCanvas.FillRect(aDrawRect); } } if (!FHideTrace) // 显示痕迹 { if (vDeItem.StyleEx == StyleExtra.cseDel) // 痕迹 { int vTextHeight = Style.TextStyles[vDeItem.StyleNo].FontHeight; int vAlignVert = User.DT_BOTTOM; switch (Style.ParaStyles[vDeItem.ParaNo].AlignVert) { case ParaAlignVert.pavCenter: vAlignVert = User.DT_CENTER; break; case ParaAlignVert.pavTop: vAlignVert = User.DT_TOP; break; default: vAlignVert = User.DT_BOTTOM; break; } int vTop = aDrawRect.Top; switch (vAlignVert) { case User.DT_TOP: vTop = aDrawRect.Top; break; case User.DT_CENTER: vTop = aDrawRect.Top + (aDrawRect.Bottom - aDrawRect.Top - vTextHeight) / 2; break; default: vTop = aDrawRect.Bottom - vTextHeight; break; } // 绘制删除线 aCanvas.Pen.BeginUpdate(); try { aCanvas.Pen.Style = HCPenStyle.psSolid; aCanvas.Pen.Color = Color.Red; } finally { aCanvas.Pen.EndUpdate(); } vTop = vTop + (aDrawRect.Bottom - vTop) / 2; aCanvas.MoveTo(aDrawRect.Left, vTop - 1); aCanvas.LineTo(aDrawRect.Right, vTop - 1); aCanvas.MoveTo(aDrawRect.Left, vTop + 2); aCanvas.LineTo(aDrawRect.Right, vTop + 2); } else if (vDeItem.StyleEx == StyleExtra.cseAdd) { aCanvas.Pen.BeginUpdate(); try { aCanvas.Pen.Style = HCPenStyle.psSolid; aCanvas.Pen.Color = Color.Blue; } finally { aCanvas.Pen.EndUpdate(); } aCanvas.MoveTo(aDrawRect.Left, aDrawRect.Bottom); aCanvas.LineTo(aDrawRect.Right, aDrawRect.Bottom); } } }