Exemple #1
0
        /// <summary>
        /// 获取指定应用环境下的病区文档模板
        /// </summary>
        /// <param name="szApplyEnv">应用环境</param>
        /// <returns>文档模板信息</returns>
        public TempletType GetWardDocType(string szApplyEnv)
        {
            List <TempletType> lstDocTypeInfos = this.GetDocTypeList(szApplyEnv);

            if (lstDocTypeInfos == null || lstDocTypeInfos.Count <= 0)
            {
                return(null);
            }

            //优先选取本病区可用的表单模板
            TempletType hospitalDocTypeInfo = null;

            foreach (TempletType docTypeInfo in lstDocTypeInfos)
            {
                if (docTypeInfo.IsValid && !docTypeInfo.IsFolder)
                {
                    hospitalDocTypeInfo = docTypeInfo;
                    if (this.IsWardDocType(docTypeInfo.DocTypeID))
                    {
                        return(docTypeInfo);
                    }
                }
            }
            return(hospitalDocTypeInfo);
        }
Exemple #2
0
 public ScreenResultModel(int pageIndex, string search, Accessibility accessibility, TempletType templetType)
 {
     PageIndex   = pageIndex;
     Search      = search;
     Accessable  = accessibility;
     TempletType = templetType;
 }
        /// <summary>
        /// 在当前树节点位置处创建模板节点
        /// </summary>
        /// <returns>bool</returns>
        private bool CreateDocType()
        {
            TempletInfoForm templetInfoForm = new TempletInfoForm();

            templetInfoForm.IsNew       = true;
            templetInfoForm.IsFolder    = false;
            templetInfoForm.DocTypeInfo = this.MakeDocTypeInfo(false);
            if (templetInfoForm.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }

            TempletType docTypeInfo = templetInfoForm.DocTypeInfo;

            if (docTypeInfo == null)
            {
                return(false);
            }
            short shRet = TempletTypeAccess.Instance.Insert(docTypeInfo);

            if (shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.ShowError("模板创建失败,无法更新到数据库!");
                return(false);
            }
            this.CreateNewNode(false, docTypeInfo);
            TempletHandler.Instance.OpenTemplet(docTypeInfo);
            return(true);
        }
Exemple #4
0
        /// <summary>
        /// 获取当前TreeView树中已勾选的病历类型信息列表
        /// </summary>
        /// <returns>病历类型信息列表</returns>
        private List <TempletType> GetSelectedDocTypeList()
        {
            List <TempletType> lstDocTypeInfos = new List <TempletType>();

            if (!this.treeView1.CheckBoxes)
            {
                TreeNode selectedNode = this.treeView1.SelectedNode;
                if (selectedNode == null)
                {
                    return(lstDocTypeInfos);
                }
                TempletType docTypeInfo = selectedNode.Tag as TempletType;
                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 TempletType);
                }
                if (parentNode.Nodes.Count > 0)
                {
                    this.GetSelectedDocTypeList(parentNode, ref lstDocTypeInfos);
                }
            }
            return(lstDocTypeInfos);
        }
        /// <summary>
        /// 修改指定的节点显示文本
        /// </summary>
        /// <param name="node">节点对象</param>
        /// <param name="szNewText">修改文本</param>
        /// <returns>bool</returns>
        private bool ModifyNodeText(TreeNode node, string szNewText)
        {
            if (node == null || GlobalMethods.Misc.IsEmptyString(szNewText))
            {
                return(false);
            }
            TempletType docTypeInfo = node.Tag as TempletType;

            if (docTypeInfo == null || docTypeInfo.DocTypeName == szNewText)
            {
                return(false);
            }

            string szDocTypeID      = docTypeInfo.DocTypeID;
            string szOldDocTypeName = docTypeInfo.DocTypeName;

            docTypeInfo.DocTypeName = szNewText;

            short shRet = TempletTypeAccess.Instance.Update(docTypeInfo);

            if (shRet == SystemData.ReturnValue.OK)
            {
                node.Text = szNewText;
                return(true);
            }
            docTypeInfo.DocTypeName = szOldDocTypeName;
            MessageBoxEx.Show(string.Format("“{0}”重命名失败!", docTypeInfo.DocTypeName));
            return(false);
        }
Exemple #6
0
        public override void OnRefreshView()
        {
            base.OnRefreshView();
            //if (SystemParam.Instance.PatVisitInfo == null)
            //    return;

            //this.ShowStatusMessage("正在获取患者信息,请稍候...");
            //this.Update();

            //string szReportName = string.Format("{0}\\Templet\\{1}.hndt", GlobalMethods.Misc.GetWorkingPath(), "患者信息");
            //this.editor.Load(szReportName);

            //this.ShowStatusMessage(null);
            List <TempletType> lstTempletTypes = null;
            short shRet = TempletTypeAccess.Instance.GetTempletTypes(SystemData.TempletTypeApplyEnv.PATIENT_INFO, ref lstTempletTypes);

            if (shRet != SystemData.ReturnValue.OK)
            {
                return;
            }
            this.m_docTypeInfo = lstTempletTypes[0];
            byte[] byteTempletData = null;
            bool   result          = TempletTypeCache.Instance.GetFormTemplet(this.m_docTypeInfo.DocTypeID, ref byteTempletData);

            if (result)
            {
                this.editor.Load(byteTempletData);
            }
        }
Exemple #7
0
        /// <summary>
        /// 获取指定应用环境指定病区下指定名称的表单模板
        /// </summary>
        /// <param name="szApplyEnv">应用环境</param>
        /// <param name="szDocTypeName">表单类型名称</param>
        /// <returns>表单模板信息</returns>
        public TempletType GetWardDocType(string szApplyEnv, string szDocTypeName)
        {
            List <TempletType> lstDocTypeInfos = this.GetDocTypeList(szApplyEnv);

            if (lstDocTypeInfos == null || lstDocTypeInfos.Count <= 0)
            {
                return(null);
            }

            //优先选取本病区指定名称的表单模板
            TempletType docTypeInfo1 = null;
            TempletType docTypeInfo2 = null;

            foreach (TempletType docTypeInfo in lstDocTypeInfos)
            {
                if (docTypeInfo.IsValid && !docTypeInfo.IsFolder)
                {
                    if (docTypeInfo.DocTypeName.StartsWith(szDocTypeName))
                    {
                        docTypeInfo1 = docTypeInfo;
                    }
                    if (this.IsWardDocType(docTypeInfo.DocTypeID))
                    {
                        docTypeInfo2 = docTypeInfo;
                    }
                }
            }
            if (docTypeInfo2 != null && docTypeInfo2.DocTypeName.StartsWith(szDocTypeName))
            {
                return(docTypeInfo2);
            }
            return(docTypeInfo1);
        }
        //保存分类
        public JsonResult SaveTempletType(TempletType entity)
        {
            JsonResult jsonreslut = new JsonResult();

            try
            {
                string id;
                jsonreslut.result = false;
                if (string.IsNullOrEmpty(entity.ID))
                {
                    new Repository <TempletType>().Insert(entity, true, out id);
                }
                else
                {
                    new Repository <TempletType>().Update(entity, true, out id);
                }
                jsonreslut.result = true;
            }
            catch (Exception ex)
            {
                LogHelper.WriteException(ex, LogType.BussinessDLL);
                jsonreslut.result = false;
                jsonreslut.msg    = ex.Message;
            }
            return(jsonreslut);
        }
Exemple #9
0
        private void 新建表单ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TempletType typeInfo = new TempletType();

            typeInfo.DocTypeName = "新建模板";
            TempletHandler.Instance.OpenTemplet(typeInfo);
        }
Exemple #10
0
 internal DesignEditForm GetDesignForm(TempletType docTypeInfo)
 {
     if (docTypeInfo == null)
     {
         return(null);
     }
     return(this.GetDesignForm(docTypeInfo.DocTypeID));
 }
Exemple #11
0
        private void dataTableView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }
            DataGridViewRow row = this.dataTableView1.Rows[e.RowIndex];

            if (row == null || row.Index < 0)
            {
                return;
            }
            FindResult result = row.Tag as FindResult;

            if (result.FileType == SystemData.FileType.TEMPLET)
            {
                TempletType templetType = new TempletType();
                templetType.DocTypeID   = result.TempletID;
                templetType.DocTypeName = result.TempletName;
                Designers.Templet.DesignEditForm designEditForm = Templet.TempletHandler.Instance.GetDesignForm(templetType);
                this.m_ScriptEditForm = Designers.Templet.TempletHandler.Instance.GetScriptForm(designEditForm);
                if (this.m_ScriptEditForm == null)
                {
                    Designers.Templet.TempletHandler.Instance.OpenTemplet(templetType);
                    designEditForm = Designers.Templet.TempletHandler.Instance.GetDesignForm(templetType);
                    Application.DoEvents();
                    Designers.Templet.TempletHandler.Instance.OpenScriptEditForm(designEditForm);
                    this.m_ScriptEditForm = Designers.Templet.TempletHandler.Instance.GetScriptForm(designEditForm);
                    Application.DoEvents();
                }
            }
            else if (result.FileType == SystemData.FileType.REPORT)
            {
                ReportType ReportType = new ReportType();
                ReportType.ReportTypeID   = result.TempletID;
                ReportType.ReportTypeName = result.TempletName;
                Designers.Report.DesignEditForm reportDesignEditForm = ReportHandler.Instance.GetDesignForm(ReportType);
                this.m_ScriptEditForm = ReportHandler.Instance.GetScriptForm(reportDesignEditForm);
                if (this.m_ScriptEditForm == null)
                {
                    ReportHandler.Instance.OpenReport(ReportType);
                    reportDesignEditForm = ReportHandler.Instance.GetDesignForm(ReportType);
                    Application.DoEvents();
                    ReportHandler.Instance.OpenScriptEditForm(reportDesignEditForm);
                    this.m_ScriptEditForm = ReportHandler.Instance.GetScriptForm(reportDesignEditForm);
                    Application.DoEvents();
                }
            }
            if (result == null)
            {
                return;
            }
            if (this.m_ScriptEditForm != null && !this.m_ScriptEditForm.IsDisposed)
            {
                this.m_ScriptEditForm.LocateToText(result.Offset, result.Length);
            }
            this.dataTableView1.SelectRow(e.RowIndex);
        }
Exemple #12
0
        private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            GlobalMethods.UI.SetCursor(this.treeView1, Cursors.WaitCursor);
            TempletType docTypeInfo = e.Node.Tag as TempletType;

            if (docTypeInfo != null && !docTypeInfo.IsFolder)
            {
                TempletHandler.Instance.OpenTemplet(e.Node.Tag as TempletType);
            }
            GlobalMethods.UI.SetCursor(this.treeView1, Cursors.Default);
        }
Exemple #13
0
        /// <summary>
        /// 获取指定表单类型对应的表单模板数据
        /// </summary>
        /// <param name="szDocTypeID">文档类型ID</param>
        /// <param name="byteTempletData">返回的模板数据</param>
        /// <returns>DataLayer.SystemData.ReturnValue</returns>
        public bool GetFormTemplet(string szDocTypeID, ref byte[] byteTempletData)
        {
            TempletType docTypeInfo = this.GetDocTypeInfo(szDocTypeID);

            if (docTypeInfo == null)
            {
                LogManager.Instance.WriteLog("FormCache.GetFormTemplet"
                                             , new string[] { "szDocTypeID" }, new object[] { szDocTypeID }, "表单不存在!");
                return(false);
            }
            return(this.GetFormTemplet(docTypeInfo, ref byteTempletData));
        }
Exemple #14
0
        /// <summary>
        /// 显示选中的模板的信息,并接受修改
        /// </summary>
        private void ShowTempletInfoEditForm()
        {
            TreeNode selectedNode = this.treeView1.SelectedNode;

            if (selectedNode == null)
            {
                return;
            }
            TempletType docTypeInfo = selectedNode.Tag as TempletType;

            if (docTypeInfo == null)
            {
                return;
            }
            string szDocTypeID = docTypeInfo.DocTypeID;

            TempletInfoForm templetInfoForm = new TempletInfoForm();

            templetInfoForm.IsNew       = false;
            templetInfoForm.IsFolder    = docTypeInfo.IsFolder;
            templetInfoForm.DocTypeInfo = docTypeInfo.Clone() as TempletType;
            DialogResult result = templetInfoForm.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            docTypeInfo = templetInfoForm.DocTypeInfo;
            if (docTypeInfo == null)
            {
                return;
            }
            short shRet = TempletTypeAccess.Instance.Update(docTypeInfo);

            if (shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.ShowError("模板创建失败,无法更新到数据库!");
                return;
            }
            selectedNode.Tag  = docTypeInfo;
            selectedNode.Text = docTypeInfo.DocTypeName;
            if (!docTypeInfo.IsValid || !docTypeInfo.IsVisible)
            {
                selectedNode.ForeColor = Color.Silver;
            }
            else
            {
                selectedNode.ForeColor = Color.Black;
            }
        }
Exemple #15
0
        /// <summary>
        /// 获取指定的文档类型对应的已写表单列表是否已设置为允许打印
        /// </summary>
        /// <param name="szDocTypeID">文档类型ID</param>
        /// <returns>是否允许打印</returns>
        public bool IsFormListPrintable(string szDocTypeID)
        {
            TempletType docTypeInfo = TempletTypeCache.Instance.GetDocTypeInfo(szDocTypeID);

            if (docTypeInfo == null)
            {
                return(false);
            }
            if (docTypeInfo.PrintMode == FormPrintMode.List || docTypeInfo.PrintMode == FormPrintMode.FormAndList)
            {
                return(true);
            }
            return(false);
        }
Exemple #16
0
        public short Insert(TempletType TempletType)
        {
            if (TempletType == null)
            {
                LogManager.Instance.WriteLog("", new string[] { "" }
                                             , new object[] { TempletType }, "参数不能为空");
                return(SystemData.ReturnValue.PARAM_ERROR);
            }
            if (TempletType.DocTypeID == string.Empty)
            {
                return(SystemData.ReturnValue.EXCEPTION);
            }
            StringBuilder sbField = new StringBuilder();
            StringBuilder sbValue = new StringBuilder();

            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.APPLY_ENV);
            sbValue.AppendFormat("'{0}',", TempletType.ApplyEnv);
            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.IS_FOLDER);
            sbValue.AppendFormat("{0},", TempletType.IsFolder ? 1 : 0);
            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.IS_VALID);
            sbValue.AppendFormat("{0},", TempletType.IsValid ? 1 : 0);
            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.MODIFY_TIME);
            sbValue.AppendFormat("{0},", base.MedQCAccess.GetSqlTimeFormat(TempletType.ModifyTime));
            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.PARENT_ID);
            sbValue.AppendFormat("'{0}',", TempletType.ParentID);
            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.TEMPLET_TYPE_ID);
            sbValue.AppendFormat("'{0}',", TempletType.DocTypeID);
            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.TEMPLET_TYPE_NAME);
            sbValue.AppendFormat("'{0}',", TempletType.DocTypeName);
            sbField.AppendFormat("{0}", SystemData.TempletTypeTable.TEMPLET_TYPE_NO);
            sbValue.AppendFormat("{0}", TempletType.DocTypeNo);
            string szSQL  = string.Format(SystemData.SQL.INSERT, SystemData.DataTable.TEMPLET_TYPE, sbField.ToString(), sbValue.ToString());
            int    nCount = 0;

            try
            {
                nCount = base.MedQCAccess.ExecuteNonQuery(szSQL, CommandType.Text);
            }
            catch (Exception ex)
            {
                LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, ex);
                return(SystemData.ReturnValue.EXCEPTION);
            }
            if (nCount <= 0)
            {
                LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, "SQL语句执行后返回0!");
                return(SystemData.ReturnValue.EXCEPTION);
            }
            return(SystemData.ReturnValue.OK);
        }
Exemple #17
0
        /// <summary>
        /// 获取指定表单类型对应的表单模板数据
        /// </summary>
        /// <param name="docTypeInfo">文档类型信息</param>
        /// <param name="byteTempletData">返回的模板数据</param>
        /// <returns>DataLayer.SystemData.ReturnValue</returns>
        public bool GetFormTemplet(TempletType docTypeInfo, ref byte[] byteTempletData)
        {
            if (docTypeInfo == null || GlobalMethods.Misc.IsEmptyString(docTypeInfo.DocTypeID))
            {
                return(false);
            }

            string szTempletPath = this.GetFormCachePath(docTypeInfo.DocTypeID);

            // 如果本地已经有模板缓存,那么返回本地的
            DateTime dtModifyTime = this.GetFormModifyTime(docTypeInfo.DocTypeID);

            if (dtModifyTime.CompareTo(docTypeInfo.ModifyTime) == 0)
            {
                if (GlobalMethods.IO.GetFileBytes(szTempletPath, ref byteTempletData))
                {
                    return(true);
                }
            }

            // 创建本地目录
            string szParentDir = GlobalMethods.IO.GetFilePath(szTempletPath);

            if (!GlobalMethods.IO.CreateDirectory(szParentDir))
            {
                LogManager.Instance.WriteLog("FormCache.GetFormTemplet"
                                             , new string[] { "docTypeInfo" }, new object[] { docTypeInfo }, "表单模板缓存目录创建失败!", null);
                return(false);
            }

            // 下载文档模板内容
            short shRet = TempletTypeAccess.Instance.GetTempletData(docTypeInfo.DocTypeID, ref byteTempletData);

            if (shRet != SystemData.ReturnValue.OK)
            {
                LogManager.Instance.WriteLog("FormCache.GetFormTemplet"
                                             , new string[] { "docTypeInfo" }, new object[] { docTypeInfo }, "表单模板下载失败!", null);
                return(false);
            }

            // 写用户模板本地索引信息
            if (!this.CacheFormTemplet(docTypeInfo, byteTempletData))
            {
                LogManager.Instance.WriteLog("FormCache.GetFormTemplet"
                                             , new string[] { "docTypeInfo" }, new object[] { docTypeInfo }, "表单模板缓存到本地失败!", null);
            }
            return(true);
        }
Exemple #18
0
        private bool SaveTempletToServer(byte[] byteTempletData)
        {
            //获取当前模板类型信息
            TempletType docTypeInfo = null;

            if (this.ActiveTemplet != null)
            {
                docTypeInfo = this.ActiveTemplet.DocTypeInfo;
            }
            else if (this.ActiveScript != null)
            {
                docTypeInfo = this.ActiveScript.DocTypeInfo;
            }

            TempletSelectForm frmTempletSelect = new TempletSelectForm();

            frmTempletSelect.Description = "请选择需要更新的目标病历模板:";
            frmTempletSelect.MultiSelect = false;
            if (docTypeInfo != null)
            {
                frmTempletSelect.ApplyEnv         = docTypeInfo.ApplyEnv;
                frmTempletSelect.DefaultDocTypeID = docTypeInfo.DocTypeID;
            }
            if (frmTempletSelect.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }
            if (frmTempletSelect.SelectedDocTypes == null)
            {
                return(false);
            }
            if (frmTempletSelect.SelectedDocTypes.Count <= 0)
            {
                return(false);
            }

            docTypeInfo = frmTempletSelect.SelectedDocTypes[0];
            short shRet = TempletTypeAccess.Instance.SaveTempletDataToDB(docTypeInfo.DocTypeID, byteTempletData);

            if (shRet != SystemData.ReturnValue.OK)
            {
                string szDocTypeName = docTypeInfo.DocTypeName;
                MessageBoxEx.Show(string.Format("模板“{0}”保存失败!", szDocTypeName));
                return(false);
            }
            return(true);
        }
Exemple #19
0
        /// <summary>
        /// 返回当前选中的模板节点对应的文档类型信息
        /// </summary>
        /// <param name="bIsDir">是否是目录</param>
        /// <returns>DocTypeInfo</returns>
        private TempletType MakeDocTypeInfo(bool bIsDir)
        {
            TempletType docTypeInfo = new TempletType();

            docTypeInfo.DocTypeID   = docTypeInfo.MakeDocTypeID();
            docTypeInfo.IsValid     = true;
            docTypeInfo.IsFolder    = bIsDir;
            docTypeInfo.ParentID    = string.Empty;
            docTypeInfo.DocTypeName = bIsDir ? "新建目录" : "未命名模板";
            docTypeInfo.ModifyTime  = SysTimeHelper.Instance.Now;
            docTypeInfo.DocTypeNo   = this.treeView1.Nodes.Count;

            string szApplyEnv = this.toolcboApplyEnv.Text;

            szApplyEnv           = SystemData.TempletTypeApplyEnv.GetApplyEnvCode(szApplyEnv);
            docTypeInfo.ApplyEnv = szApplyEnv;

            TreeNode selectedNode = this.treeView1.SelectedNode;

            if (selectedNode == null)
            {
                return(docTypeInfo);
            }

            TempletType selectedDocType = selectedNode.Tag as TempletType;

            if (selectedDocType == null)
            {
                return(docTypeInfo);
            }

            if (selectedDocType.IsFolder)
            {
                docTypeInfo.ParentID  = selectedDocType.DocTypeID;
                docTypeInfo.DocTypeNo = selectedNode.Nodes.Count;
            }
            else
            {
                docTypeInfo.ParentID = selectedDocType.ParentID;
                if (selectedNode.Parent != null)
                {
                    docTypeInfo.DocTypeNo = selectedNode.Parent.Nodes.Count;
                }
            }
            return(docTypeInfo);
        }
Exemple #20
0
 protected override bool ProcessDialogKey(Keys keyData)
 {
     if (keyData == Keys.F5)
     {
         GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);
         if (this.m_docTypeInfo == null)
         {
             return(false);
         }
         string szDocTypeID = this.m_docTypeInfo.DocTypeID;
         if (string.IsNullOrEmpty(szDocTypeID))
         {
             return(true);
         }
         //重新查询获取文档类型信息
         TempletType docTypeInfo = null;
         short       shRet       = TempletTypeAccess.Instance.GetTempletType(szDocTypeID, ref docTypeInfo);
         // 如果本地与服务器的版本相同,则无需重新加载
         DateTime dtModifyTime = TempletTypeCache.Instance.GetFormModifyTime(docTypeInfo.DocTypeID);
         if (dtModifyTime.CompareTo(docTypeInfo.ModifyTime) == 0)
         {
             GlobalMethods.UI.SetCursor(this, Cursors.Default);
             return(true);
         }
         byte[] byteTempletData = null;
         bool   result          = TempletTypeCache.Instance.GetFormTemplet(docTypeInfo, ref byteTempletData);
         if (!result)
         {
             MessageBoxEx.Show("刷新失败");
             GlobalMethods.UI.SetCursor(this, Cursors.Default);
             return(true);
         }
         byte[] byteDocData = null;
         this.editor.Save(ref byteDocData);
         result = this.editor.Load(byteDocData, byteTempletData);
         if (!result)
         {
             MessageBoxEx.Show("刷新失败");
             GlobalMethods.UI.SetCursor(this, Cursors.Default);
             return(true);
         }
         GlobalMethods.UI.SetCursor(this, Cursors.Default);
         return(true);
     }
     return(base.ProcessDialogKey(keyData));
 }
Exemple #21
0
        /// <summary>
        /// 生成待保存的文档类型信息
        /// </summary>
        /// <returns>bool</returns>
        private bool MakeDocTypeInfo()
        {
            if (this.m_docTypeInfo == null)
            {
                this.m_docTypeInfo = new TempletType();
            }

            if (this.txtTempletID.Text.Trim() == string.Empty)
            {
                MessageBoxEx.ShowError("请输入病历类型ID号");
                return(false);
            }

            if (this.txtTempletName.Text.Trim() == string.Empty)
            {
                MessageBoxEx.ShowError("请输入病历类型名称");
                return(false);
            }

            this.m_docTypeInfo.DocTypeID   = this.txtTempletID.Text.Trim();
            this.m_docTypeInfo.DocTypeName = this.txtTempletName.Text.Trim();
            this.m_docTypeInfo.IsRepeated  = this.chkIsRepeat.Checked;
            this.m_docTypeInfo.IsVisible   = this.chkIsVisible.Checked;
            this.m_docTypeInfo.IsValid     = this.chkIsValid.Checked;

            this.m_docTypeInfo.PrintMode = FormPrintMode.None;
            if (this.chkFormPrintable.Checked)
            {
                this.m_docTypeInfo.PrintMode = FormPrintMode.Form;
            }
            if (this.chkListPrintable.Checked)
            {
                this.m_docTypeInfo.PrintMode = FormPrintMode.List;
            }
            if (this.chkFormPrintable.Checked && this.chkListPrintable.Checked)
            {
                this.m_docTypeInfo.PrintMode = FormPrintMode.FormAndList;
            }
            this.m_docTypeInfo.DocTypeNo =
                GlobalMethods.Convert.StringToValue(this.txtDocTypeNo.Text.Trim(), 0);
            return(true);
        }
Exemple #22
0
        /// <summary>
        /// 打开指定的表单模板或者表单模板文件对应的脚本
        /// </summary>
        /// <param name="docTypeInfo">表单模板信息</param>
        /// <param name="szHndfFile">表单模板文件</param>
        /// <returns>是否成功</returns>
        public bool Open(TempletType docTypeInfo, string szHndfFile)
        {
            this.IsModified    = false;
            this.m_hndfFile    = szHndfFile;
            this.m_docTypeInfo = docTypeInfo;
            this.RefreshFormText();

            FormFileParser parser = new FormFileParser();

            this.textEditor1.Text = parser.GetScriptData(szHndfFile);

            if (GlobalMethods.Misc.IsEmptyString(this.textEditor1.Text))
            {
                string szDefaultHndfFile = string.Format("{0}\\Templet\\Default.hndt"
                                                         , GlobalMethods.Misc.GetWorkingPath());
                this.textEditor1.Text = parser.GetScriptData(szDefaultHndfFile);
            }
            this.IsModified = false;
            return(true);
        }
Exemple #23
0
        public bool Open(TempletType docTypeInfo, string szHndfFile)
        {
            this.m_hndfFile    = szHndfFile;
            this.m_docTypeInfo = docTypeInfo;
            this.RefreshFormText();
            if (this.MainForm == null)
            {
                return(false);
            }

            FormFileParser parser       = new FormFileParser();
            string         szDesignData = null;

            if (System.IO.File.Exists(szHndfFile))
            {
                szDesignData = parser.GetDesignData(szHndfFile);
            }
            this.formDesigner1.OpenDesignData(szDesignData);
            return(true);
        }
Exemple #24
0
        /// <summary>
        /// 获取指定ID的文档类型信息
        /// </summary>
        /// <param name="szDocTypeID">文档类型代码</param>
        /// <returns>文档类型信息</returns>
        public TempletType GetDocTypeInfo(string szDocTypeID)
        {
            if (GlobalMethods.Misc.IsEmptyString(szDocTypeID))
            {
                return(null);
            }

            //如果是子病历类型
            if (this.m_htDocTypeTable == null)
            {
                this.m_htDocTypeTable = new Dictionary <string, TempletType>();
            }

            //重新查询获取文档类型信息
            TempletType docTypeInfo = null;
            short       shRet       = TempletTypeAccess.Instance.GetTempletType(szDocTypeID, ref docTypeInfo);

            if (shRet != SystemData.ReturnValue.OK || docTypeInfo == null)
            {
                return(null);
            }
            return(docTypeInfo);
        }
Exemple #25
0
        /// <summary>
        /// 获取指定节点下所有子节点的文档类型ID列表
        /// </summary>
        /// <param name="parentNode">模板父节点</param>
        /// <param name="lstDocTypeID">文档类型ID列表</param>
        private void GetDocTypeList(TreeNode parentNode, ref List <string> lstDocTypeID)
        {
            if (lstDocTypeID == null)
            {
                lstDocTypeID = new List <string>();
            }
            if (parentNode == null)
            {
                return;
            }

            TempletType docTypeInfo = parentNode.Tag as TempletType;

            if (docTypeInfo == null)
            {
                return;
            }
            lstDocTypeID.Add(docTypeInfo.DocTypeID);
            for (int index = 0; index < parentNode.Nodes.Count; index++)
            {
                this.GetDocTypeList(parentNode.Nodes[index], ref lstDocTypeID);
            }
        }
Exemple #26
0
        internal short OpenTemplet(TempletType docTypeInfo)
        {
            if (docTypeInfo == null)
            {
                return(SystemData.ReturnValue.FAILED);
            }

            DesignEditForm designEditForm = this.GetDesignForm(docTypeInfo);

            if (designEditForm != null)
            {
                designEditForm.Activate();
                return(SystemData.ReturnValue.OK);
            }
            designEditForm          = new DesignEditForm(this.MainForm);
            designEditForm.FlagCode = Guid.NewGuid().ToString();
            this.MainForm.OpenDesignEditForm(designEditForm);

            string szDocTypeID = docTypeInfo.DocTypeID;
            string szHndfFile  = string.Format("{0}\\Cache\\{1}.hndt"
                                               , GlobalMethods.Misc.GetWorkingPath(), szDocTypeID);

            byte[] byteTempletData = null;
            if (szDocTypeID != string.Empty)
            {
                short shRet = TempletTypeAccess.Instance.GetTempletData(szDocTypeID, ref byteTempletData);
                if (shRet != SystemData.ReturnValue.OK)
                {
                    return(shRet);
                }
            }

            GlobalMethods.IO.WriteFileBytes(szHndfFile, byteTempletData);
            return(designEditForm.Open(docTypeInfo, szHndfFile) ?
                   SystemData.ReturnValue.OK : SystemData.ReturnValue.FAILED);
        }
Exemple #27
0
        /// <summary>
        /// 将本地目录下的模板提交到服务器
        /// </summary>
        public void ImportTemplet()
        {
            TempletSelectForm frmTempletSelect = new TempletSelectForm();

            frmTempletSelect.MultiSelect = true;
            frmTempletSelect.Description = "请选择需要导入的病历类型模板:";

            string szApplyEnv = this.toolcboApplyEnv.Text;

            szApplyEnv = SystemData.TempletTypeApplyEnv.GetApplyEnvCode(szApplyEnv);
            frmTempletSelect.ApplyEnv = szApplyEnv;

            if (frmTempletSelect.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            List <TempletType> lstDocTypeInfos = frmTempletSelect.SelectedDocTypes;

            if (lstDocTypeInfos == null || lstDocTypeInfos.Count <= 0)
            {
                return;
            }

            FolderBrowserDialog folderDialog = new FolderBrowserDialog();

            folderDialog.Description         = "请选择模板在本地的存放目录:";
            folderDialog.ShowNewFolderButton = false;
            if (folderDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string szDirPath = folderDialog.SelectedPath;

            WorkProcess.Instance.Initialize(this.MainForm, lstDocTypeInfos.Count, "正在导入系统模板...");

            StringBuilder sbExecuteResult = new StringBuilder();
            short         shRet           = SystemData.ReturnValue.OK;

            for (int index = 0; index <= lstDocTypeInfos.Count - 1; index++)
            {
                WorkProcess.Instance.Show(null, index + 1);
                if (WorkProcess.Instance.Canceled)
                {
                    break;
                }

                TempletType docTypeInfo = lstDocTypeInfos[index];
                if (docTypeInfo == null || docTypeInfo.IsFolder)
                {
                    continue;
                }

                //读取本地模板文件
                byte[] byteTempletData = null;
                string szTempletFile   = string.Format("{0}\\{1}.hndt", szDirPath, docTypeInfo.DocTypeName);
                if (!GlobalMethods.IO.GetFileBytes(szTempletFile, ref byteTempletData))
                {
                    sbExecuteResult.AppendLine("----导入失败! DocTypeName=" + docTypeInfo.DocTypeName);
                    continue;
                }

                //保存模板到服务器
                shRet = TempletTypeAccess.Instance.SaveTempletDataToDB(docTypeInfo.DocTypeID, byteTempletData);
                if (shRet != SystemData.ReturnValue.OK)
                {
                    sbExecuteResult.AppendLine("----导入失败! DocTypeName=" + docTypeInfo.DocTypeName);
                    continue;
                }
                sbExecuteResult.AppendLine("导入成功! DocTypeName=" + docTypeInfo.DocTypeName);
            }
            WorkProcess.Instance.Close();
            this.ShowTextData(sbExecuteResult.ToString());
        }
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (this.m_lstTestInfo == null)
            {
                this.m_lstTestInfo = new List <DataTable>();
            }
            else
            {
                this.m_lstTestInfo.Clear();
            }

            if (this.dgvLabMaster.Rows.Count <= 0)
            {
                return;
            }

            for (int index = 0; index < this.dgvLabMaster.Rows.Count; index++)
            {
                DataGridViewRow row         = this.dgvLabMaster.Rows[index];
                LabMaster       labTestInfo = row.Tag as LabMaster;

                if (labTestInfo == null)
                {
                    continue;
                }
                DataGridViewCell cell = row.Cells[this.colNeedPrint.Index];
                if (cell == null)
                {
                    continue;
                }
                object objValue = cell.Value;
                if (objValue == null || !bool.Parse(objValue.ToString()))
                {
                    continue;
                }

                List <LabResult> lstResultInfo = row.Cells[this.colYiChang.Index].Tag as List <LabResult>;
                //short shRet = LabResultAccess.Instance.GetList(labTestInfo.TEST_ID, ref lstResultInfo);
                //if (shRet != SystemData.ReturnValue.OK)
                //    continue;
                if (lstResultInfo == null || lstResultInfo.Count <= 0)
                {
                    continue;
                }

                DataTable dtResult = this.CreateResultData(lstResultInfo);
                dtResult = this.CreateTestData(labTestInfo, dtResult);
                this.m_lstTestInfo.Add(dtResult);
            }
            if (this.m_lstTestInfo.Count <= 0)
            {
                MessageBoxEx.Show("请勾选需要打印记录左边的复选框!");
                return;
            }
            if (SystemParam.Instance.LocalConfigOption.IsLabPrintNewMethod)
            {
                DocumentPrintStyleForm frm         = new DocumentPrintStyleForm();
                TempletType            templetType = TempletTypeCache.Instance.GetWardDocType(SystemData.TempletTypeApplyEnv.LAB_REPROT);
                if (templetType == null)
                {
                    MessageBoxEx.ShowMessage("打印表单未制作");
                    return;
                }
                frm.TempletType = templetType;
                frm.Data        = m_lstTestInfo;
                frm.Text        = templetType.DocTypeName;
                frm.ShowDialog();
                return;
            }

            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);
            ReportType reportType = ReportCache.Instance.GetWardReportType(SystemData.ReportTypeApplyEnv.LAB_RESULT, this.Text);

            if (reportType == null)
            {
                MessageBoxEx.ShowMessage("打印报表还没有制作");
                return;
            }
            byte[] byteReportData = null;
            ReportCache.Instance.GetReportTemplet(reportType, ref byteReportData);
            if (byteReportData != null)
            {
                ReportExplorerForm explorerForm = this.GetReportExplorerForm();
                explorerForm.ReportFileData = byteReportData;
                explorerForm.ReportParamData.Add("是否续打", false);
                explorerForm.ReportParamData.Add("打印数据", this.m_lstTestInfo);
                explorerForm.ShowDialog();
            }
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }
Exemple #29
0
        /// <summary>
        /// 加载病历类型信息列表树
        /// </summary>
        private void LoadDocTypeList(string szApplyEnv)
        {
            this.treeView1.Nodes.Clear();
            if (this.m_htDocTypeNodes == null)
            {
                this.m_htDocTypeNodes = new Hashtable();
            }
            this.m_htDocTypeNodes.Clear();
            this.Update();

            List <TempletType> lstDocTypeInfos = null;
            short shRet = TempletTypeAccess.Instance.GetTempletTypes(szApplyEnv, ref lstDocTypeInfos);

            if (shRet != SystemData.ReturnValue.OK &&
                shRet != SystemData.ReturnValue.RES_NO_FOUND)
            {
                MessageBoxEx.ShowError("护理病历模板列表下载失败!");
                return;
            }
            if (lstDocTypeInfos == null)
            {
                return;
            }

            //先创建节点哈希列表
            Dictionary <string, TreeNode> nodeTable = new Dictionary <string, TreeNode>();

            foreach (TempletType docTypeInfo in lstDocTypeInfos)
            {
                TreeNode docTypeNode = new TreeNode();
                docTypeNode.Tag  = docTypeInfo;
                docTypeNode.Text = docTypeInfo.DocTypeName;

                if (!docTypeInfo.IsValid || !docTypeInfo.IsVisible)
                {
                    docTypeNode.ForeColor = Color.Silver;
                }

                if (!docTypeInfo.IsFolder)
                {
                    docTypeNode.ImageIndex = 2;
                }
                else
                {
                    docTypeNode.ImageIndex = 0;
                }
                docTypeNode.SelectedImageIndex = docTypeNode.ImageIndex;

                if (!nodeTable.ContainsKey(docTypeInfo.DocTypeID))
                {
                    nodeTable.Add(docTypeInfo.DocTypeID, docTypeNode);
                }
                if (!this.m_htDocTypeNodes.Contains(docTypeInfo.DocTypeID))
                {
                    this.m_htDocTypeNodes.Add(docTypeInfo.DocTypeID, docTypeNode);
                }
            }

            //将节点连接起来,添加到树中
            foreach (KeyValuePair <string, TreeNode> pair in nodeTable)
            {
                if (string.IsNullOrEmpty(pair.Key) || pair.Value == null)
                {
                    continue;
                }

                TempletType docTypeInfo = pair.Value.Tag as TempletType;
                if (docTypeInfo == null)
                {
                    continue;
                }

                if (string.IsNullOrEmpty(docTypeInfo.ParentID))
                {
                    this.treeView1.Nodes.Add(pair.Value);
                }
                else
                {
                    TreeNodeCollection nodes = null;
                    if (!nodeTable.ContainsKey(docTypeInfo.ParentID))
                    {
                        nodes = this.treeView1.Nodes;
                    }

                    TreeNode parentNode = nodeTable[docTypeInfo.ParentID];
                    if (parentNode != null)
                    {
                        parentNode.Nodes.Add(pair.Value);
                    }
                    else
                    {
                        this.treeView1.Nodes.Add(pair.Value);
                    }
                }
            }
            this.treeView1.ExpandAll();
            if (this.treeView1.Nodes.Count > 0)
            {
                this.treeView1.Nodes[0].EnsureVisible();
            }
        }
Exemple #30
0
        public short GetTempletTypes(string szApplyEnv, ref List <TempletType> lstTempletTypes)
        {
            if (base.MedQCAccess == null)
            {
                return(SystemData.ReturnValue.PARAM_ERROR);
            }

            StringBuilder sbField = new StringBuilder();

            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.APPLY_ENV);
            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.IS_FOLDER);
            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.IS_VALID);
            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.MODIFY_TIME);
            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.PARENT_ID);
            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.TEMPLET_TYPE_ID);
            sbField.AppendFormat("{0},", SystemData.TempletTypeTable.TEMPLET_TYPE_NAME);

            sbField.AppendFormat("{0}", SystemData.TempletTypeTable.TEMPLET_TYPE_NO);
            string szCondition = string.Format("1=1");

            if (!string.IsNullOrEmpty(szApplyEnv))
            {
                szCondition = string.Format("{0} AND {1} = '{2}'"
                                            , szCondition
                                            , SystemData.TempletTypeTable.APPLY_ENV
                                            , szApplyEnv);
            }
            string szSQL = string.Format(SystemData.SQL.SELECT_WHERE
                                         , sbField.ToString(), SystemData.DataTable.TEMPLET_TYPE, szCondition);

            IDataReader dataReader = null;

            try
            {
                dataReader = base.MedQCAccess.ExecuteReader(szSQL, CommandType.Text);
                if (dataReader == null || dataReader.IsClosed || !dataReader.Read())
                {
                    return(SystemData.ReturnValue.RES_NO_FOUND);
                }
                if (lstTempletTypes == null)
                {
                    lstTempletTypes = new List <TempletType>();
                }
                do
                {
                    TempletType TempletType = new TempletType();
                    for (int i = 0; i < dataReader.FieldCount; i++)
                    {
                        if (dataReader.IsDBNull(i))
                        {
                            continue;
                        }
                        switch (dataReader.GetName(i))
                        {
                        case SystemData.TempletTypeTable.APPLY_ENV:
                            TempletType.ApplyEnv = dataReader.GetString(i).ToString();
                            break;

                        case SystemData.TempletTypeTable.IS_FOLDER:
                            TempletType.IsFolder = dataReader.GetValue(i).ToString() == "1";
                            break;

                        case SystemData.TempletTypeTable.IS_VALID:
                            TempletType.IsValid = dataReader.GetValue(i).ToString() == "1";
                            break;

                        case SystemData.TempletTypeTable.MODIFY_TIME:
                            TempletType.ModifyTime = dataReader.GetDateTime(i);
                            break;

                        case SystemData.TempletTypeTable.PARENT_ID:
                            TempletType.ParentID = dataReader.GetValue(i).ToString();
                            break;

                        case SystemData.TempletTypeTable.TEMPLET_TYPE_ID:
                            TempletType.DocTypeID = dataReader.GetString(i);
                            break;

                        case SystemData.TempletTypeTable.TEMPLET_TYPE_NAME:
                            TempletType.DocTypeName = dataReader.GetString(i);
                            break;

                        case SystemData.TempletTypeTable.TEMPLET_TYPE_NO:
                            TempletType.DocTypeNo = int.Parse(dataReader.GetValue(i).ToString());
                            break;

                        default: break;
                        }
                    }
                    lstTempletTypes.Add(TempletType);
                } while (dataReader.Read());
                return(SystemData.ReturnValue.OK);
            }
            catch (Exception ex)
            {
                LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, ex);
                return(SystemData.ReturnValue.EXCEPTION);
            }
            finally { base.MedQCAccess.CloseConnnection(false); }
        }