public async Task CopyModel(bool useTokenCredential) { var sourceClient = CreateDocumentModelAdministrationClient(useTokenCredential); var targetClient = CreateDocumentModelAdministrationClient(useTokenCredential); var modelId = Recording.GenerateId(); await using var trainedModel = await CreateDisposableBuildModelAsync(modelId); var targetModelId = Recording.GenerateId(); CopyAuthorization targetAuth = await targetClient.GetCopyAuthorizationAsync(targetModelId); CopyModelOperation operation = await sourceClient.StartCopyModelToAsync(trainedModel.ModelId, targetAuth); await operation.WaitForCompletionAsync(); Assert.IsTrue(operation.HasValue); DocumentModel copiedModel = operation.Value; ValidateDocumentModel(copiedModel); Assert.AreEqual(targetAuth.TargetModelId, copiedModel.ModelId); Assert.AreNotEqual(trainedModel.ModelId, copiedModel.ModelId); Assert.AreEqual(1, copiedModel.DocTypes.Count); Assert.IsTrue(copiedModel.DocTypes.ContainsKey(modelId)); DocTypeInfo docType = copiedModel.DocTypes[modelId]; Assert.AreEqual(DocumentBuildMode.Template, docType.BuildMode); }
/// <summary> /// 装载文档类型列表 /// </summary> private void LoadDocTypeList() { if (this.m_htDocTypeList == null) { this.m_htDocTypeList = new Hashtable(); } this.m_htDocTypeList.Clear(); List <DocTypeInfo> lstDocTypeInfo = null; short shRet = DocTypeAccess.Instance.GetDocTypeInfos(ref lstDocTypeInfo); if (lstDocTypeInfo == null) { return; } //加载文档类型列表 for (int index = 0; index < lstDocTypeInfo.Count; index++) { DocTypeInfo docTypeInfo = lstDocTypeInfo[index]; if (!docTypeInfo.CanCreate) { continue; } if (!this.m_htDocTypeList.Contains(docTypeInfo.DocTypeID)) { this.m_htDocTypeList.Add(docTypeInfo.DocTypeID, docTypeInfo); } } }
public async Task StartBuildModelWithNeuralBuildMode() { // Test takes too long to finish running, and seems to cause multiple failures in our // live test pipeline. Until we find a way to run it without flakiness, this test will // be ignored when running in Live mode. if (Recording.Mode == RecordedTestMode.Live) { Assert.Ignore("https://github.com/Azure/azure-sdk-for-net/issues/27042"); } var client = CreateDocumentModelAdministrationClient(); var trainingFilesUri = new Uri(TestEnvironment.BlobContainerSasUrl); var modelId = Recording.GenerateId(); BuildModelOperation operation = await client.StartBuildModelAsync(trainingFilesUri, DocumentBuildMode.Neural, modelId); await operation.WaitForCompletionAsync(); Assert.IsTrue(operation.HasValue); DocumentModel model = operation.Value; ValidateDocumentModel(model); Assert.AreEqual(1, model.DocTypes.Count); Assert.IsTrue(model.DocTypes.ContainsKey(modelId)); DocTypeInfo docType = model.DocTypes[modelId]; Assert.AreEqual(DocumentBuildMode.Neural, docType.BuildMode); }
/// <summary> /// 显示文档类型设置对话框 /// </summary> /// <param name="row">指定行</param> private void ShowDocTypeSelectForm() { TempletSelectForm templetSelectForm = new TempletSelectForm(); templetSelectForm.DefaultDocTypeID = txtDocType.Tag as string; templetSelectForm.MultiSelect = true; templetSelectForm.Text = "选择病历类型"; templetSelectForm.Description = "请选择应书写的病历类型:"; if (templetSelectForm.ShowDialog() != DialogResult.OK) { return; } List <DocTypeInfo> lstDocTypeInfos = templetSelectForm.SelectedDocTypes; StringBuilder sbDocTypeIDList = new StringBuilder(); StringBuilder sbDocTypeNameList = new StringBuilder(); if (lstDocTypeInfos == null || lstDocTypeInfos.Count <= 0) { txtDocType.Text = sbDocTypeNameList.ToString(); txtDocType.Tag = sbDocTypeIDList.ToString(); return; } for (int index = 0; index < lstDocTypeInfos.Count; index++) { DocTypeInfo docTypeInfo = lstDocTypeInfos[index]; if (docTypeInfo == null) { continue; } sbDocTypeIDList.Append(docTypeInfo.DocTypeID); if (index < lstDocTypeInfos.Count - 1) { sbDocTypeIDList.Append(";"); } sbDocTypeNameList.Append(docTypeInfo.DocTypeName); if (index < lstDocTypeInfos.Count - 1) { sbDocTypeNameList.Append(";"); } } txtDocType.Text = sbDocTypeNameList.ToString(); txtDocType.Tag = sbDocTypeIDList.ToString(); }
/// <summary> /// 根据文档类型ID获取指定的文档类型信息 /// </summary> /// <param name="szDocTypeID">文档类型ID</param> /// <param name="docTypeInfo">文档类型信息</param> /// <returns>MedDocSys.Common.SystemData.ReturnValue</returns> public short GetDocTypeInfo(string szDocTypeID, ref DocTypeInfo docTypeInfo) { if (GlobalMethods.Misc.IsEmptyString(szDocTypeID)) { return(SystemData.ReturnValue.FAILED); } if (this.m_htDocTypeInfos == null) { this.m_htDocTypeInfos = new Hashtable(); } if (this.m_htDocTypeInfos.Count > 0) { docTypeInfo = this.m_htDocTypeInfos[szDocTypeID] as DocTypeInfo; return(SystemData.ReturnValue.OK); } List <DocTypeInfo> lstDocTypeInfos = null; short shRet = EMRDBLib.DbAccess.DocTypeAccess.Instance.GetDocTypeInfos(ref lstDocTypeInfos); if (shRet != SystemData.ReturnValue.OK || lstDocTypeInfos == null) { return(shRet); } for (int index = 0; index < lstDocTypeInfos.Count; index++) { DocTypeInfo docTypeInfoItem = lstDocTypeInfos[index]; if (this.m_htDocTypeInfos.Contains(docTypeInfoItem.DocTypeID)) { continue; } this.m_htDocTypeInfos.Add(docTypeInfoItem.DocTypeID, docTypeInfoItem); } docTypeInfo = this.m_htDocTypeInfos[szDocTypeID] as DocTypeInfo; return(SystemData.ReturnValue.OK); }
public async Task StartBuildModel(bool singlePage) { var client = CreateDocumentModelAdministrationClient(); var trainingFilesUri = new Uri(singlePage ? TestEnvironment.BlobContainerSasUrl : TestEnvironment.MultipageBlobContainerSasUrl); var modelId = Recording.GenerateId(); BuildModelOperation operation = await client.StartBuildModelAsync(trainingFilesUri, DocumentBuildMode.Template, modelId); await operation.WaitForCompletionAsync(); Assert.IsTrue(operation.HasValue); DocumentModel model = operation.Value; ValidateDocumentModel(model); Assert.AreEqual(1, model.DocTypes.Count); Assert.IsTrue(model.DocTypes.ContainsKey(modelId)); DocTypeInfo docType = model.DocTypes[modelId]; Assert.AreEqual(DocumentBuildMode.Template, docType.BuildMode); }
/// <summary> /// 获取当前TreeView树中已勾选的病历类型信息列表 /// </summary> /// <returns>病历类型信息列表</returns> private List <DocTypeInfo> GetSelectedDocTypeList() { List <DocTypeInfo> lstDocTypeInfos = new List <DocTypeInfo>(); if (!this.treeView1.CheckBoxes) { TreeNode selectedNode = this.treeView1.SelectedNode; if (selectedNode == null) { return(lstDocTypeInfos); } DocTypeInfo docTypeInfo = selectedNode.Tag as DocTypeInfo; if (docTypeInfo == null) { return(lstDocTypeInfos); } lstDocTypeInfos.Add(docTypeInfo); return(lstDocTypeInfos); } for (int parentIndex = 0; parentIndex < this.treeView1.Nodes.Count; parentIndex++) { TreeNode parentNode = this.treeView1.Nodes[parentIndex]; if (parentNode.Checked) { lstDocTypeInfos.Add(parentNode.Tag as DocTypeInfo); } for (int childIndex = 0; childIndex < parentNode.Nodes.Count; childIndex++) { TreeNode childNode = parentNode.Nodes[childIndex]; if (childNode.Checked) { lstDocTypeInfos.Add(childNode.Tag as DocTypeInfo); } } } return(lstDocTypeInfos); }
public async Task StartCreateComposedModel(bool useTokenCredential) { var client = CreateDocumentModelAdministrationClient(useTokenCredential); var modelAId = Recording.GenerateId(); var modelBId = Recording.GenerateId(); await using var trainedModelA = await CreateDisposableBuildModelAsync(modelAId); await using var trainedModelB = await CreateDisposableBuildModelAsync(modelBId); var modelIds = new List <string> { trainedModelA.ModelId, trainedModelB.ModelId }; var composedModelId = Recording.GenerateId(); BuildModelOperation operation = await client.StartCreateComposedModelAsync(modelIds, composedModelId); await operation.WaitForCompletionAsync(); Assert.IsTrue(operation.HasValue); DocumentModel composedModel = operation.Value; ValidateDocumentModel(composedModel); Assert.AreEqual(2, composedModel.DocTypes.Count); Assert.IsTrue(composedModel.DocTypes.ContainsKey(modelAId)); Assert.IsTrue(composedModel.DocTypes.ContainsKey(modelBId)); DocTypeInfo docTypeA = composedModel.DocTypes[modelAId]; DocTypeInfo docTypeB = composedModel.DocTypes[modelBId]; Assert.AreEqual(DocumentBuildMode.Template, docTypeA.BuildMode); Assert.AreEqual(DocumentBuildMode.Template, docTypeB.BuildMode); }
/// <summary> /// 显示文档类型设置对话框 /// </summary> /// <param name="row">指定行</param> private void ShowDocTypeSelectForm(DataTableViewRow row) { if (row == null || row.Index < 0 || this.dataGridView1.IsDeletedRow(row)) { return; } TempletSelectForm templetSelectForm = new TempletSelectForm(); DataGridViewCell cell = row.Cells[this.colDocType.Index]; if (cell.Tag != null) { templetSelectForm.DefaultDocTypeID = cell.Tag.ToString(); } templetSelectForm.MultiSelect = true; templetSelectForm.Text = "选择病历类型"; templetSelectForm.Description = "请选择应书写的病历类型:"; if (templetSelectForm.ShowDialog() != DialogResult.OK) { return; } List <DocTypeInfo> lstDocTypeInfos = templetSelectForm.SelectedDocTypes; if (lstDocTypeInfos == null || lstDocTypeInfos.Count <= 0) { row.Cells[this.colDocType.Index].Tag = null; row.Cells[this.colDocType.Index].Value = null; if (this.dataGridView1.IsNormalRowUndeleted(row)) { this.dataGridView1.SetRowState(row, RowState.Update); } return; } StringBuilder sbDocTypeIDList = new StringBuilder(); StringBuilder sbDocTypeNameList = new StringBuilder(); for (int index = 0; index < lstDocTypeInfos.Count; index++) { DocTypeInfo docTypeInfo = lstDocTypeInfos[index]; if (docTypeInfo == null) { continue; } sbDocTypeIDList.Append(docTypeInfo.DocTypeID); if (index < lstDocTypeInfos.Count - 1) { sbDocTypeIDList.Append(";"); } sbDocTypeNameList.Append(docTypeInfo.DocTypeName); if (index < lstDocTypeInfos.Count - 1) { sbDocTypeNameList.Append(";"); } } row.Cells[this.colDocType.Index].Tag = sbDocTypeIDList.ToString(); row.Cells[this.colDocType.Index].Value = sbDocTypeNameList.ToString(); if (this.dataGridView1.IsNormalRowUndeleted(row)) { this.dataGridView1.SetRowState(row, RowState.Update); } }
/// <summary> /// 更新文档类别 /// </summary> /// <param name="docType"></param> /// <returns></returns> public bool UpdateDocType(DocTypeInfo docType) { return(true); }
/// <summary> /// 新增文档类别 /// </summary> /// <param name="docType"></param> /// <param name="TypeID"></param> /// <returns></returns> public bool AddDocType(DocTypeInfo docType, out int TypeID) { TypeID = 0; return(true); }
/// <summary> /// 加载病历类型信息列表树 /// </summary> private void LoadDocTypeList() { this.treeView1.Nodes.Clear(); if (this.m_htDocTypeNodes == null) { this.m_htDocTypeNodes = new Hashtable(); } this.m_htDocTypeNodes.Clear(); this.Update(); List <DocTypeInfo> lstDocTypeInfos = null; short result = EMRDBLib.DbAccess.DocTypeAccess.Instance.GetDocTypeInfos(ref lstDocTypeInfos); if (lstDocTypeInfos == null || lstDocTypeInfos.Count <= 0) { return; } Hashtable htHostDocType = new Hashtable(); //加载主文档类型 int index = 0; while (index < lstDocTypeInfos.Count) { DocTypeInfo docTypeInfo = lstDocTypeInfos[index]; if (docTypeInfo == null || !docTypeInfo.IsHostType) { index++; continue; } if (this.m_szApplyEnv != null && this.m_szDocRight != null) { if (docTypeInfo.ApplyEvn != this.m_szApplyEnv || docTypeInfo.DocRight != this.m_szDocRight) { index++; continue; } } TreeNode docTypeNode = new TreeNode(); docTypeNode.Text = docTypeInfo.DocTypeName; docTypeNode.Tag = docTypeInfo; if (!docTypeInfo.CanCreate) { docTypeNode.ForeColor = Color.Gray; } this.treeView1.Nodes.Add(docTypeNode); if (!htHostDocType.Contains(docTypeInfo.DocTypeID)) { htHostDocType.Add(docTypeInfo.DocTypeID, docTypeNode); } if (!this.m_htDocTypeNodes.Contains(docTypeInfo.DocTypeID)) { this.m_htDocTypeNodes.Add(docTypeInfo.DocTypeID, docTypeNode); } lstDocTypeInfos.RemoveAt(index); } //加载子文档类型 for (index = 0; index < lstDocTypeInfos.Count; index++) { DocTypeInfo docTypeInfo = lstDocTypeInfos[index]; if (docTypeInfo == null) { continue; } if (this.m_szApplyEnv != null && this.m_szDocRight != null) { if (docTypeInfo.ApplyEvn != this.m_szApplyEnv) { continue; } if (docTypeInfo.DocRight != this.m_szDocRight) { continue; } } TreeNode docTypeNode = new TreeNode(); docTypeNode.Tag = docTypeInfo; docTypeNode.Text = docTypeInfo.DocTypeName; if (!docTypeInfo.CanCreate) { docTypeNode.ForeColor = Color.Gray; } TreeNode hostDocTypeNode = htHostDocType[docTypeInfo.HostTypeID] as TreeNode; if (hostDocTypeNode == null) { this.treeView1.Nodes.Add(docTypeNode); } else { hostDocTypeNode.Nodes.Add(docTypeNode); } if (!this.m_htDocTypeNodes.Contains(docTypeInfo.DocTypeID)) { this.m_htDocTypeNodes.Add(docTypeInfo.DocTypeID, docTypeNode); } } this.treeView1.ExpandAll(); if (this.treeView1.Nodes.Count > 0) { this.treeView1.Nodes[0].EnsureVisible(); } }
/// <summary> /// /// </summary> public override void OnRefreshView() { base.OnRefreshView(); this.Update(); if (this.virtualTree1.Nodes.Count > 0) { this.virtualTree1.Nodes.Clear(); } GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor); this.ShowStatusMessage("正在加载文档类型列表,请稍候..."); this.LoadDocTypeList(); this.ShowStatusMessage("正在加载待审核模板列表,请稍候..."); List <TempletInfo> lstTempletInfo = null; short shRet = TempletAccess.Instance.GetUserTempletInfos("0", ref lstTempletInfo); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.Show("获取待审核模板列表失败"); GlobalMethods.UI.SetCursor(this, Cursors.Default); this.ShowStatusMessage(null); return; } if (lstTempletInfo == null) { GlobalMethods.UI.SetCursor(this, Cursors.Default); this.ShowStatusMessage("未找到待审核的模板"); return; } //查询医生已修正确认的模板列表 List <TempletInfo> lstModifyTempletInfos = null; shRet = TempletAccess.Instance.GetUserTempletInfos("2", ref lstModifyTempletInfos); if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND) { MessageBoxEx.Show("获取医生已确认修正待审核模板列表失败"); GlobalMethods.UI.SetCursor(this, Cursors.Default); this.ShowStatusMessage(null); return; } if (lstModifyTempletInfos != null) { lstTempletInfo.AddRange(lstModifyTempletInfos); } lstTempletInfo.Sort(new Comparison <TempletInfo>(this.Compare)); //模板时间显示格式 string szDocTimeFormat = "yyyy-MM-dd HH:mm"; string szDeptCode = string.Empty; VirtualNode deptNode = null; for (int index = 0; index < lstTempletInfo.Count; index++) { TempletInfo templetInfo = lstTempletInfo[index]; if (templetInfo == null) { continue; } if (templetInfo.IsFolder) { continue; } //添加科室名称显示行 if (templetInfo.DeptCode != szDeptCode) { deptNode = new VirtualNode(templetInfo.DeptName); deptNode.ForeColor = Color.Blue; deptNode.Font = new Font("宋体", 10.5f, FontStyle.Regular); this.virtualTree1.Nodes.Add(deptNode); deptNode.Expand(); } szDeptCode = templetInfo.DeptCode; VirtualNode templetNode = new VirtualNode(templetInfo.TempletName); templetNode.Data = templetInfo; templetNode.ForeColor = Color.Black; templetNode.Font = new Font("宋体", 10.5f, FontStyle.Regular); string szDocTypeName = string.Empty; DocTypeInfo docTypeInfo = this.m_htDocTypeList[templetInfo.DocTypeID] as DocTypeInfo; if (docTypeInfo == null) { szDocTypeName = templetInfo.DocTypeID; } else { szDocTypeName = docTypeInfo.DocTypeName; } VirtualSubItem subItem = null; subItem = new VirtualSubItem(szDocTypeName); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; templetNode.SubItems.Add(subItem); subItem = new VirtualSubItem(templetInfo.CreatorName); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; templetNode.SubItems.Add(subItem); subItem = new VirtualSubItem(templetInfo.ModifyTime.ToString(szDocTimeFormat)); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; templetNode.SubItems.Add(subItem); string szShareLevel = string.Empty; if (templetInfo.ShareLevel == SystemData.ShareLevel.HOSPITAL) { szShareLevel = "全院"; } else if (templetInfo.ShareLevel == SystemData.ShareLevel.DEPART) { szShareLevel = "科室"; } else { szShareLevel = "个人"; } subItem = new VirtualSubItem(szShareLevel); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; templetNode.SubItems.Add(subItem); string szCheckStatus = string.Empty; if (templetInfo.CheckStatus == TempletCheckStatus.None) { szCheckStatus = "未审核"; } else if (templetInfo.CheckStatus == TempletCheckStatus.Affirm) { szCheckStatus = "已确认"; } subItem = new VirtualSubItem(szCheckStatus); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; templetNode.SubItems.Add(subItem); deptNode.Nodes.Add(templetNode); } this.ShowStatusMessage(null); GlobalMethods.UI.SetCursor(this, Cursors.Default); }
/// <summary> /// 创建一个新的目录或者类型节点 /// </summary> /// <param name="bIsDir">是否是目录</param> /// <param name="docTypeInfo">病历类型信息</param> /// <returns>节点</returns> private TreeNode CreateNewNode(bool bIsDir, TempletType docTypeInfo) { TreeNode node = new TreeNode(); node.Tag = docTypeInfo; if (docTypeInfo == null) { node.Text = bIsDir ? "新建目录" : "未命名模板"; } else { node.Text = docTypeInfo.DocTypeName; } node.ImageIndex = bIsDir ? 0 : 2; node.SelectedImageIndex = node.ImageIndex; if (!docTypeInfo.IsValid || !docTypeInfo.IsVisible) { node.ForeColor = Color.Silver; } TreeNode selectedNode = this.treeView1.SelectedNode; if (selectedNode == null) { this.treeView1.Nodes.Add(node); return(node); } DocTypeInfo selectedDocType = selectedNode.Tag as DocTypeInfo; if (selectedDocType == null) { this.treeView1.Nodes.Add(node); return(node); } TreeNode parentNode = selectedNode; if (!selectedDocType.IsFolder) { parentNode = selectedNode.Parent; } if (parentNode != null) { parentNode.Nodes.Add(node); parentNode.Expand(); } else { this.treeView1.Nodes.Add(node); } if (node.TreeView != null) { this.treeView1.SelectedNode = node; node.BeginEdit(); return(node); } return(null); }
private void LoadMedDocList(EMRDBLib.PatVisitInfo patVisitLog, VirtualNode patientNode) { if (patVisitLog == null) { return; } string szPatientID = patVisitLog.PATIENT_ID; string szVisitID = patVisitLog.VISIT_ID; if (GlobalMethods.Misc.IsEmptyString(szPatientID) || GlobalMethods.Misc.IsEmptyString(szVisitID)) { return; } string szVisitType = MedDocSys.DataLayer.SystemData.VisitType.IP; MedDocList lstDocInfos = null; short shRet = EmrDocAccess.Instance.GetDocInfos(szPatientID, szVisitID, szVisitType, DateTime.Now, string.Empty, ref lstDocInfos); if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND) { MessageBoxEx.Show("获取新格式病程记录失败!"); return; } if (lstDocInfos == null || lstDocInfos.Count <= 0) { return; } lstDocInfos.Sort(); //文档时间显示格式 string szDocTimeFormat = "yyyy-MM-dd HH:mm"; this.virtualTree1.SuspendLayout(); this.virtualTree1.Tag = lstDocInfos; VirtualNode lastDocRootNode = new VirtualNode(); lastDocRootNode.Text = "医生的病历"; lastDocRootNode.ImageIndex = 0; lastDocRootNode.Font = new Font("宋体", 10.5f, FontStyle.Regular); lastDocRootNode.Data = DOCTOR_NODE_TAG; lastDocRootNode.Expand(); VirtualNode LastNurRootNode = new VirtualNode(); LastNurRootNode.Text = "护士的病历"; LastNurRootNode.ImageIndex = 0; LastNurRootNode.Font = new Font("宋体", 10.5f, FontStyle.Regular); LastNurRootNode.Data = NURSE_NODE_TAG; LastNurRootNode.CollapseAll(); VirtualNode otherDocRootNode = new VirtualNode("未被归类的病历"); otherDocRootNode.ImageIndex = 1; otherDocRootNode.Font = new Font("宋体", 10.5f, FontStyle.Regular); otherDocRootNode.Data = UNKNOWN_NODE_TAG; otherDocRootNode.Expand(); Hashtable htDocType = new Hashtable(); //加载已有文档列表到指定的容器 for (int index = 0; index < lstDocInfos.Count; index++) { MedDocInfo docInfo = lstDocInfos[index]; if (docInfo == null) { continue; } VirtualNode docInfoNode = new VirtualNode(docInfo.DOC_TITLE); docInfoNode.Data = docInfo; docInfoNode.Tag = patVisitLog; docInfoNode.ForeColor = Color.Black; docInfoNode.Font = new Font("宋体", 10.5f, FontStyle.Regular); VirtualSubItem subItem = null; DateTime dtDocTime = docInfo.DOC_TIME; dtDocTime = docInfo.DOC_TIME; subItem = new VirtualSubItem(dtDocTime.ToString(szDocTimeFormat)); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; docInfoNode.SubItems.Add(subItem); subItem = new VirtualSubItem(docInfo.CREATOR_NAME); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; docInfoNode.SubItems.Add(subItem); subItem = new VirtualSubItem(docInfo.MODIFY_TIME.ToString(szDocTimeFormat)); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; docInfoNode.SubItems.Add(subItem); subItem = new VirtualSubItem(docInfo.MODIFIER_NAME); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; docInfoNode.SubItems.Add(subItem); string szReadTime = string.Empty; if (this.m_htQCActionLog.Contains(docInfo.DOC_SETID)) { szReadTime = this.m_htQCActionLog[docInfo.DOC_SETID].ToString(); } subItem = new VirtualSubItem(); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; if (!string.IsNullOrEmpty(szReadTime)) { subItem.Text = "是"; } else { subItem.Text = "否"; } docInfoNode.SubItems.Add(subItem); subItem = new VirtualSubItem(szReadTime); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; docInfoNode.SubItems.Add(subItem); //如果病历被阅读过,则子项的字体颜色分为绿色 if (!string.IsNullOrEmpty(szReadTime)) { docInfoNode.ForeColor = Color.Green; for (int nIndex = 0; nIndex < docInfoNode.SubItems.Count; nIndex++) { docInfoNode.SubItems[nIndex].ForeColor = Color.Green; } } DocTypeInfo currDocType = null; DocTypeAccess.Instance.GetDocTypeInfo(docInfo.DOC_TYPE, ref currDocType); if (currDocType == null) { otherDocRootNode.Nodes.Add(docInfoNode); continue; } DocTypeInfo hostDocType = null; DocTypeAccess.Instance.GetDocTypeInfo(currDocType.HostTypeID, ref hostDocType); if (hostDocType == null) { otherDocRootNode.Nodes.Add(docInfoNode); continue; } VirtualNode hostDocRootNode = null; if (!htDocType.Contains(hostDocType.DocTypeID)) { hostDocRootNode = new VirtualNode(); hostDocRootNode.Text = hostDocType.DocTypeName; hostDocRootNode.Tag = hostDocType.DocTypeName; hostDocRootNode.Data = COMBIN_NODE_TAG; hostDocRootNode.HitExpand = HitExpandMode.Click; hostDocRootNode.Expand(); hostDocRootNode.Font = new Font("宋体", 10.5f, FontStyle.Regular); hostDocRootNode.ImageIndex = 1; if (hostDocType.DocRight != MedDocSys.DataLayer.SystemData.UserType.NURSE) { lastDocRootNode.Nodes.Add(hostDocRootNode); } else if (hostDocType.DocRight == MedDocSys.DataLayer.SystemData.UserType.NURSE) { LastNurRootNode.Nodes.Add(hostDocRootNode); } else { this.virtualTree1.Nodes.Add(hostDocRootNode); } htDocType.Add(hostDocType.DocTypeID, hostDocRootNode); } else { hostDocRootNode = htDocType[hostDocType.DocTypeID] as VirtualNode; } hostDocRootNode.Nodes.Add(docInfoNode); } htDocType.Clear(); this.m_DoctorNode = lastDocRootNode; this.m_NurseNode = LastNurRootNode; if (otherDocRootNode.Nodes.Count > 0) { patientNode.Nodes.Add(otherDocRootNode); } if (lastDocRootNode.Nodes.Count > 0) { patientNode.Nodes.Add(lastDocRootNode); } if (LastNurRootNode.Nodes.Count > 0) { patientNode.Nodes.Add(LastNurRootNode); } }
/// <summary> /// 合并打开指定的一系列文档 /// </summary> /// <param name="documents">文档信息</param> /// <returns>DataLayer.SystemData.ReturnValue</returns> public short OpenDocument(MedDocList documents) { this.m_documents = documents; if (documents == null || documents.Count <= 0) { return(SystemData.ReturnValue.CANCEL); } MedDocInfo firstDocInfo = documents[0]; this.RefreshFormTitle(null); WorkProcess.Instance.Initialize(this, documents.Count , string.Format("正在下载“{0}”,请稍候...", firstDocInfo.DOC_TITLE)); //下载第一份文档 byte[] byteDocData = null; short shRet = EmrDocAccess.Instance.GetDocByID(firstDocInfo.DOC_ID, ref byteDocData); if (shRet != SystemData.ReturnValue.OK) { WorkProcess.Instance.Close(); MessageBoxEx.Show(this, string.Format("文档“{0}”下载失败!", firstDocInfo.DOC_TITLE)); return(SystemData.ReturnValue.FAILED); } if (WorkProcess.Instance.Canceled) { WorkProcess.Instance.Close(); return(SystemData.ReturnValue.CANCEL); } WorkProcess.Instance.Show(string.Format("正在打开“{0}”,请稍候...", firstDocInfo.DOC_TITLE), 1); //打开第一份文档 shRet = this.medEditor1.InitCombinDisplay(byteDocData, firstDocInfo.DOC_ID); if (shRet != SystemData.ReturnValue.OK) { WorkProcess.Instance.Close(); MessageBoxEx.Show(this, string.Format("文档“{0}”加载失败!", firstDocInfo.DOC_TITLE)); return(SystemData.ReturnValue.FAILED); } DocTypeInfo prevDocTypeInfo = null; DataCache.Instance.GetDocTypeInfo(firstDocInfo.DOC_TYPE, ref prevDocTypeInfo); //循环打开其余的文档 for (int index = 1; index < documents.Count; index++) { MedDocInfo docInfo = documents[index]; if (WorkProcess.Instance.Canceled) { break; } WorkProcess.Instance.Show(string.Format("正在下载“{0}”,请稍候...", docInfo.DOC_TITLE), index + 1); //下载文档内容 byteDocData = null; shRet = EmrDocAccess.Instance.GetDocByID(docInfo.DOC_ID, ref byteDocData); if (shRet != SystemData.ReturnValue.OK) { string szTipInfo = string.Format("“{0}”文档数据下载失败!是否继续?", docInfo.DOC_TITLE); if (MessageBoxEx.Show(szTipInfo, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { break; } } if (WorkProcess.Instance.Canceled) { break; } WorkProcess.Instance.Show(string.Format("正在打开“{0}”,请稍候...", docInfo.DOC_TITLE), index + 1); //当前文档或前一文档是需要独立打印的,那么插入一个或两个硬分页符 DocTypeInfo docTypeInfo = null; DataCache.Instance.GetDocTypeInfo(docInfo.DOC_TYPE, ref docTypeInfo); if ((docTypeInfo != null && docTypeInfo.IsTotalPage) || (prevDocTypeInfo != null && prevDocTypeInfo.IsEndEmpty)) { int nTotalPageCount = 0; //获取总页数.注意:单面打印时只需要插入一个空白页 if (this.medEditor1.PageSettings.PageLayout != MedDocSys.DataLayer.PageLayout.Normal) { //格式化一次文档,才能正确获取总页数 this.medEditor1.RefreshCombinDisplay(); this.medEditor1.GetPageCount(ref nTotalPageCount); } int nBlankPageCount = (nTotalPageCount % 2 == 0) ? 1 : 2; this.AppendBlankToCombin(nBlankPageCount, true); } prevDocTypeInfo = docTypeInfo; if (WorkProcess.Instance.Canceled) { break; } //OCX编辑器装载文档 shRet = this.medEditor1.AppendToCombinDisplay(byteDocData, docInfo.DOC_ID); if (shRet != SystemData.ReturnValue.OK) { string szTipInfo = string.Format("“{0}”文档数据加载失败!是否继续?", docInfo.DOC_TITLE); if (MessageBoxEx.Show(szTipInfo, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { break; } } } this.medEditor1.RefreshCombinDisplay(); WorkProcess.Instance.Close(); return(SystemData.ReturnValue.OK); }
/// <summary> /// 根据指定文档类型代码获取文档类型信息 /// </summary> /// <param name="szDocTypeID">文档类型代码</param> /// <param name="docTypeInfo">文档类型信息</param> /// <returns>SystemData.ReturnValue</returns> public short GetDocTypeInfo(string szDocTypeID, ref DocTypeInfo docTypeInfo) { if (GlobalMethods.Misc.IsEmptyString(szDocTypeID)) { return(SystemData.ReturnValue.PARAM_ERROR); } if (base.MeddocAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } szDocTypeID = szDocTypeID.Trim(); string szField = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15}" , SystemData.DocTypeTable.DOCTYPE_ID, SystemData.DocTypeTable.DOCTYPE_NAME, SystemData.DocTypeTable.HOSTTYPE_ID , SystemData.DocTypeTable.IS_REPEATED, SystemData.DocTypeTable.DOC_RIGHT, SystemData.DocTypeTable.APPLY_ENV , SystemData.DocTypeTable.SIGN_FLAG, SystemData.DocTypeTable.MODIFY_TIME, SystemData.DocTypeTable.IS_VALID , SystemData.DocTypeTable.CAN_CREATE, SystemData.DocTypeTable.IS_TOTAL_PAGE, SystemData.DocTypeTable.IS_STRUCT , SystemData.DocTypeTable.IS_END_EMPTY, SystemData.DocTypeTable.NEED_COMBIN, SystemData.DocTypeTable.ORDER_VALUE , SystemData.DocTypeTable.AUTO_MAKE_TITLE); string szCondition = string.Format("{0}='{1}'", SystemData.DocTypeTable.DOCTYPE_ID, szDocTypeID); string szSQL = string.Format(SystemData.SQL.SELECT_WHERE_ORDER_ASC, szField, SystemData.DataTable.DOC_TYPE, szCondition, SystemData.DocTypeTable.ORDER_VALUE); IDataReader dataReader = null; try { dataReader = base.MeddocAccess.ExecuteReader(szSQL, CommandType.Text); if (dataReader == null || dataReader.IsClosed || !dataReader.Read()) { return(SystemData.ReturnValue.RES_NO_FOUND); } if (docTypeInfo == null) { docTypeInfo = new DocTypeInfo(); } docTypeInfo.DocTypeID = dataReader.GetString(0); docTypeInfo.DocTypeName = dataReader.GetString(1); if (!dataReader.IsDBNull(2)) { docTypeInfo.HostTypeID = dataReader.GetString(2); } docTypeInfo.IsRepeated = dataReader.GetValue(3).ToString().Equals("1"); docTypeInfo.DocRight = dataReader.GetString(4); docTypeInfo.ApplyEvn = dataReader.GetString(5); if (!dataReader.IsDBNull(6)) { docTypeInfo.SignFlag = dataReader.GetString(6).Trim(); } docTypeInfo.ModifyTime = dataReader.GetDateTime(7); if (!dataReader.IsDBNull(8)) { docTypeInfo.IsValid = dataReader.GetValue(8).ToString().Equals("1"); } if (!dataReader.IsDBNull(9)) { docTypeInfo.CanCreate = dataReader.GetValue(9).ToString().Equals("1"); } if (!dataReader.IsDBNull(10)) { docTypeInfo.IsTotalPage = dataReader.GetValue(10).ToString().Equals("1"); } if (!dataReader.IsDBNull(11)) { docTypeInfo.IsStruct = dataReader.GetValue(11).ToString().Equals("1"); } if (!dataReader.IsDBNull(12)) { docTypeInfo.IsEndEmpty = dataReader.GetValue(12).ToString().Equals("1"); } if (!dataReader.IsDBNull(13)) { docTypeInfo.NeedCombin = dataReader.GetValue(13).ToString().Equals("1"); } if (!dataReader.IsDBNull(14)) { docTypeInfo.OrderValue = int.Parse(dataReader.GetValue(14).ToString()); } if (!dataReader.IsDBNull(15)) { docTypeInfo.AutoMakeTitle = dataReader.GetValue(15).ToString().Equals("1"); } return(SystemData.ReturnValue.OK); } catch (Exception ex) { LogManager.Instance.WriteLog("DocTypeAccess.GetDocTypeInfo", new string[] { "szSQL" } , new object[] { szSQL }, ex); return(SystemData.ReturnValue.EXCEPTION); } finally { base.MeddocAccess.CloseConnnection(false); } }
private void LoadHerenMedDocList() { if (SystemParam.Instance.PatVisitInfo == null) { return; } string szPatientID = SystemParam.Instance.PatVisitInfo.PATIENT_ID; string szVisitID = SystemParam.Instance.PatVisitInfo.VISIT_ID; if (GlobalMethods.Misc.IsEmptyString(szPatientID) || GlobalMethods.Misc.IsEmptyString(szVisitID)) { return; } this.virtualTree1.SuspendLayout(); this.virtualTree1.Tag = null; this.virtualTree1.Nodes.Clear(); this.virtualTree1.PerformLayout(); string szVisitType = MedDocSys.DataLayer.SystemData.VisitType.IP; MedDocList lstDocInfos = null; short shRet = EmrDocAccess.Instance.GetDocInfos(szPatientID, szVisitID, szVisitType, DateTime.Now, string.Empty, ref lstDocInfos); if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND) { MessageBoxEx.Show("获取新格式病程记录失败!"); return; } if (lstDocInfos == null || lstDocInfos.Count <= 0) { return; } lstDocInfos.Sort(); //文档时间显示格式 string szDocTimeFormat = "yyyy-MM-dd HH:mm"; this.virtualTree1.SuspendLayout(); this.virtualTree1.Tag = lstDocInfos; VirtualNode lastDocRootNode = new VirtualNode(); lastDocRootNode.Text = "医生的病历"; lastDocRootNode.ForeColor = Color.Blue; lastDocRootNode.ImageIndex = 0; lastDocRootNode.Font = new Font("宋体", 10.5f, FontStyle.Regular); lastDocRootNode.Data = DOCTOR_NODE_TAG; lastDocRootNode.Expand(); VirtualNode LastNurRootNode = new VirtualNode(); LastNurRootNode.Text = "护士的病历"; LastNurRootNode.ForeColor = Color.Blue; LastNurRootNode.ImageIndex = 0; LastNurRootNode.Font = new Font("宋体", 10.5f, FontStyle.Regular); LastNurRootNode.Data = NURSE_NODE_TAG; LastNurRootNode.CollapseAll(); VirtualNode otherDocRootNode = new VirtualNode("未被归类的病历"); otherDocRootNode.ForeColor = Color.Blue; otherDocRootNode.ImageIndex = 1; otherDocRootNode.Font = new Font("宋体", 10.5f, FontStyle.Regular); otherDocRootNode.Data = UNKNOWN_NODE_TAG; otherDocRootNode.Expand(); Hashtable htDocType = new Hashtable(); List <VirtualNode> childDocNodes = new List <VirtualNode>(); //加载已有文档列表到指定的容器 for (int index = 0; index < lstDocInfos.Count; index++) { MedDocInfo docInfo = lstDocInfos[index]; if (docInfo == null) { continue; } VirtualNode docInfoNode = new VirtualNode(docInfo.DOC_TITLE); if (!htDocType.ContainsKey(docInfo.DOC_ID)) { htDocType.Add(docInfo.DOC_ID, docInfoNode); } docInfoNode.HitExpand = HitExpandMode.None; docInfoNode.Expand(); docInfoNode.Data = docInfo; docInfoNode.ForeColor = Color.Black; if (m_htQCMsgInfs != null && m_htQCMsgInfs.ContainsKey(docInfo.DOC_SETID)) { docInfoNode.ForeColor = Color.OrangeRed; } docInfoNode.Font = new Font("宋体", 10.5f, FontStyle.Regular); VirtualSubItem subItem = null; DateTime dtDocTime = docInfo.DOC_TIME; { dtDocTime = docInfo.RECORD_TIME; } subItem = new VirtualSubItem(dtDocTime.ToString(szDocTimeFormat)); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; docInfoNode.SubItems.Add(subItem); subItem = new VirtualSubItem(dtDocTime.ToString(szDocTimeFormat)); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; docInfoNode.SubItems.Add(subItem); subItem = new VirtualSubItem(docInfo.CREATOR_NAME); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; docInfoNode.SubItems.Add(subItem); subItem = new VirtualSubItem(docInfo.MODIFY_TIME.ToString(szDocTimeFormat)); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; docInfoNode.SubItems.Add(subItem); subItem = new VirtualSubItem(docInfo.MODIFIER_NAME); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; docInfoNode.SubItems.Add(subItem); string szReadTime = string.Empty; if (this.m_htQCActionLog.Contains(docInfo.DOC_SETID)) { szReadTime = this.m_htQCActionLog[docInfo.DOC_SETID].ToString(); } subItem = new VirtualSubItem(); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; if (!string.IsNullOrEmpty(szReadTime)) { subItem.Text = "是"; } else { subItem.Text = "否"; } docInfoNode.SubItems.Add(subItem); subItem = new VirtualSubItem(szReadTime); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; subItem.ForeColor = Color.Blue; docInfoNode.SubItems.Add(subItem); subItem = new VirtualSubItem(); subItem.Font = new Font("宋体", 10.5f, FontStyle.Regular); subItem.Alignment = Alignment.Middle; GetCnNameSignCode(docInfo, subItem); docInfoNode.SubItems.Add(subItem); DocTypeInfo currDocType = null; DocTypeAccess.Instance.GetDocTypeInfo(docInfo.DOC_TYPE, ref currDocType); if (currDocType == null) { otherDocRootNode.Nodes.Add(docInfoNode); continue; } //病历类型不需要审签 if (string.IsNullOrEmpty(currDocType.SignFlag) || currDocType.SignFlag == SystemData.SignType.NONE) { subItem.Text = string.Empty; } if (currDocType.NeedCombin && !currDocType.IsHostType) { childDocNodes.Add(docInfoNode); continue; } DocTypeInfo hostDocType = null; DocTypeAccess.Instance.GetDocTypeInfo(currDocType.HostTypeID, ref hostDocType); if (hostDocType == null) { hostDocType = currDocType; } VirtualNode hostDocRootNode = null; if (htDocType.ContainsKey(hostDocType.DocTypeID)) { hostDocRootNode = htDocType[hostDocType.DocTypeID] as VirtualNode; } if (hostDocRootNode == null) { hostDocRootNode = new VirtualNode(); hostDocRootNode.Text = hostDocType.DocTypeName; hostDocRootNode.Tag = hostDocType.DocTypeName; hostDocRootNode.Data = COMBIN_NODE_TAG; hostDocRootNode.HitExpand = HitExpandMode.Click; hostDocRootNode.Expand(); hostDocRootNode.Font = new Font("宋体", 10.5f, FontStyle.Regular); hostDocRootNode.ImageIndex = 0; if (hostDocType.DocRight != MedDocSys.DataLayer.SystemData.UserType.NURSE) { lastDocRootNode.Nodes.Add(hostDocRootNode); } else if (hostDocType.DocRight == MedDocSys.DataLayer.SystemData.UserType.NURSE) { LastNurRootNode.Nodes.Add(hostDocRootNode); } else { this.virtualTree1.Nodes.Add(hostDocRootNode); } htDocType.Add(hostDocType.DocTypeID, hostDocRootNode); } hostDocRootNode.Nodes.Add(docInfoNode); } foreach (VirtualNode node in childDocNodes) { if (node.Parent != null) { continue; } MedDocInfo docInfo = node.Data as MedDocInfo; if (docInfo == null) { continue; } if (htDocType.ContainsKey(docInfo.DOC_SETID)) { VirtualNode parent = htDocType[docInfo.DOC_SETID] as VirtualNode; if (parent != null && parent != node) { parent.Nodes.Add(node); } } } htDocType.Clear(); this.m_DoctorNode = lastDocRootNode; this.m_NurseNode = LastNurRootNode; if (otherDocRootNode.Nodes.Count > 0) { this.virtualTree1.Nodes.Add(otherDocRootNode); } if (lastDocRootNode.Nodes.Count > 0) { this.virtualTree1.Nodes.Add(lastDocRootNode); } if (LastNurRootNode.Nodes.Count > 0) { this.virtualTree1.Nodes.Add(LastNurRootNode); } this.virtualTree1.PerformLayout(); }