Esempio n. 1
0
        /// <summary>
        /// 判断是否有数据更改
        /// </summary>
        /// <returns></returns>
        private bool isChanged()
        {
            //根节点
            TreeNode node = this.cwc.CatalogTree.SelectedNode;

            if (node == null)
            {
                return(false);
            }
            //新增
            if (this.cwc.CatalogTree.SelectedNode != null && this.cwc.CatalogTree.SelectedNode.Tag == null)
            {
                return(true);
            }
            object tag = this.cwc.CatalogTree.SelectedNode.Tag;

            //if (tag == null && this.cwc.CatalogTree.SelectedNode.Name.Substring(0, this.cwc.CatalogTree.SelectedNode.Name.IndexOf("_")) != "0000")
            //{
            //    return true;
            //}
            Neusoft.HISFC.Models.EPR.CaseWriteRule cwr = tag as Neusoft.HISFC.Models.EPR.CaseWriteRule;
            if (this.ntbName.Text != cwr.RuleName ||
                (deptHelper.GetID(this.ncbDept.Text) != cwr.DeptCode && !string.IsNullOrEmpty(cwr.DeptCode)) ||//
                this.ntbSort.Text != cwr.Sort ||
                this.ntbDescript.Text != cwr.Descript ||
                this.ntbLink.Text != cwr.RuleLink ||
                this.ntbData.Text != cwr.RuleData ||
                this.ntbMemo.Text != cwr.Memo)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// 更新拖拽后子节点的rule_code和parent_code
        /// </summary>
        /// <param name="cwr"></param>
        /// <param name="newParentCode"></param>
        /// <returns></returns>
        public int ModifyForDrag(Neusoft.HISFC.Models.EPR.CaseWriteRule cwr, string newParentCode)
        {
            string sqlIndex = "EPR.CaseWriteRule.UpdateForDrag";
            string strSql   = string.Empty;

            try
            {
                if (this.Sql.GetSql(sqlIndex, ref strSql) == -1)
                {
                    return(-1);
                }
                strSql = string.Format(strSql, cwr.RuleCode, newParentCode);
                if (this.ExecNoQuery(strSql) == -1)
                {
                    return(-1);
                }
                if (this.DeleteRule(cwr, false) == -1)
                {
                    return(-1);
                }
            }
            catch (Exception e)
            {
                this.Err = e.Message + "\r\n" + e.StackTrace;
                return(-1);
            }

            return(1);
        }
Esempio n. 3
0
        /// <summary>
        /// 修改书写规范
        /// </summary>
        /// <returns>1 成功,-1 失败</returns>
        private int ModifyRule()
        {
            //是否是浏览
            if (this.isView)
            {
                return(0);
            }
            TreeNode node      = this.cwc.CatalogTree.SelectedNode.Parent;
            object   cwrParent = (node != null ? node.Tag : null);

            Neusoft.HISFC.Models.EPR.CaseWriteRule cwr = new Neusoft.HISFC.Models.EPR.CaseWriteRule();

            cwr.RuleCode = this.cwc.CatalogTree.SelectedNode.Name;//.Substring(0, this.cwc.CatalogTree.SelectedNode.Name.IndexOf("_")); //this.MakeRuleCode();

            cwr.RuleName   = this.ntbName.Text;
            cwr.DeptName   = this.ncbDept.Text;
            cwr.DeptCode   = this.deptHelper.GetID(this.ncbDept.Text);
            cwr.Descript   = this.ntbDescript.Text;
            cwr.Sort       = this.ntbSort.Text;
            cwr.Memo       = this.ntbMemo.Text;
            cwr.RuleLink   = this.ntbLink.Text;
            cwr.ParentCode = (cwrParent == null ? "0" : ((Neusoft.HISFC.Models.EPR.CaseWriteRule)(cwrParent)).RuleCode);
            cwr.RuleData   = this.ntbData.Text;
            int ret = Neusoft.HISFC.BizProcess.Factory.Function.IntegrateEPR.ModifyRule(cwr);

            if (ret == 1)
            {
                this.cwc.CatalogTree.SelectedNode.Tag  = cwr;
                this.cwc.CatalogTree.SelectedNode.Text = cwr.RuleName;
                this.treeNodeList.Clear();
                this.FillNodeList(this.cwc.CatalogTree.Nodes[0]);
            }
            return(ret);
        }
Esempio n. 4
0
        /// <summary>
        /// 删除书写规范
        /// </summary>
        /// <returns>1 成功,-1 失败</returns>
        public int DeleteRule(Neusoft.HISFC.Models.EPR.CaseWriteRule rule, bool deleteChildren)
        {
            string sqlIndex = "EPR.CaseWriteRule.DeleteRule";
            string strSql   = string.Empty;

            try
            {
                if (this.Sql.GetSql(sqlIndex, ref strSql) == -1)
                {
                    return(-1);
                }
                strSql = string.Format(strSql, (rule.RuleCode == "0000" ? "000" : rule.RuleCode) + (deleteChildren ? "%" : ""));

                if (this.ExecNoQuery(strSql) == -1)
                {
                    return(-1);
                }
            }
            catch (Exception e)
            {
                this.Err = e.Message + "\r\n" + e.StackTrace;
                return(-1);
            }

            return(1);
        }
Esempio n. 5
0
        /// <summary>
        /// 通过编码得到某个目录
        /// </summary>
        /// <returns></returns>
        public Neusoft.HISFC.Models.EPR.CaseWriteRule GetCatalogByID(string ruleCode)
        {
            string sqlIndex      = "EPR.CaseWriteRule.QueryCatalog";
            string sqlWhereIndex = "EPR.CaseWriteRule.QueryCatalog.Where";

            Neusoft.HISFC.Models.EPR.CaseWriteRule rule = new Neusoft.HISFC.Models.EPR.CaseWriteRule();
            System.Data.DataSet ds = new System.Data.DataSet();
            string strSql          = string.Empty;

            try
            {
                if (this.Sql.GetSql(sqlIndex, ref strSql) == -1)
                {
                    return(null);
                }
                string strSqlWhere = string.Empty;
                if (this.Sql.GetSql(sqlWhereIndex, ref strSqlWhere) == -1)
                {
                    return(null);
                }
                strSql += string.Format(strSqlWhere, ruleCode);
                if (this.ExecQuery(strSql, ref ds) == -1)
                {
                    return(null);
                }
                strSql   = string.Empty;
                sqlIndex = "EPR.CaseWriteRule.QueryBlob";
                if (this.Sql.GetSql(sqlIndex, ref strSql) == -1)
                {
                    return(null);
                }
                byte[] data;
                string sql = strSql;
                foreach (System.Data.DataRow row in ds.Tables[0].Rows)
                {
                    rule.RuleCode   = row["rule_code"].ToString();
                    rule.RuleName   = row["rule_name"].ToString();
                    rule.DeptName   = row["dept_name"].ToString();
                    rule.DeptCode   = row["his_dept_code"].ToString();
                    rule.Descript   = row["brifsign"].ToString();
                    rule.Sort       = row["sort"].ToString();
                    rule.Memo       = row["memo"].ToString();
                    rule.RuleLink   = row["rule_link"].ToString();
                    rule.ParentCode = row["parent_code"].ToString();

                    strSql        = string.Format(sql, rule.RuleCode);
                    data          = this.OutputBlob(strSql);
                    rule.RuleData = (data == null ? (string.Empty) : System.Text.Encoding.GetEncoding("GB2312").GetString(data));

                    break;
                }
            }
            catch (Exception e)
            {
                this.Err = e.Message + "\r\n" + e.StackTrace;
                return(null);
            }
            return(rule);
        }
Esempio n. 6
0
        /// <summary>
        /// 删除书写规范
        /// </summary>
        /// <returns>1 成功,-1 失败,0 取消操作</returns>
        private int DeleteRule()
        {
            //是否是浏览
            if (this.isView)
            {
                return(0);
            }
            TreeNode node = this.cwc.CatalogTree.SelectedNode;
            //if(node == null || node.Name == "0000"){
            //    return 0;
            //}

            bool hasGrandchildren = false;

            if (node != null && node.Nodes.Count > 0)
            {
                foreach (TreeNode temp in node.Nodes)
                {
                    if (temp.Nodes.Count > 0)
                    {
                        hasGrandchildren = true;
                    }
                }
            }
            if (hasGrandchildren)
            {
                MessageBox.Show("不能删除存在多于2层子节点的节点,请先删除其底层节点!");
                return(-1);
            }
            DialogResult dr = MessageBox.Show("是否要删除该病例书写规范,\r\n该操作将删除其拥有的子节点", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dr == DialogResult.Yes)
            {
                Neusoft.HISFC.Models.EPR.CaseWriteRule cwr = new Neusoft.HISFC.Models.EPR.CaseWriteRule();
                cwr.RuleCode = this.cwc.CatalogTree.SelectedNode.Name;//.Substring(0,this.cwc.CatalogTree.SelectedNode.Name.IndexOf("_")); //((Neusoft.HISFC.Models.EPR.CaseWriteRule)this.cwc.CatalogTree.SelectedNode.Tag).RuleCode;
                cwr.DeptCode = this.deptHelper.GetID(this.ncbDept.Text);
                TreeNode parent = this.cwc.CatalogTree.SelectedNode.Parent;
                this.RemoveChildren(this.cwc.CatalogTree.SelectedNode);
                if (this.cwc.CatalogTree.SelectedNode != null)
                {
                    this.cwc.CatalogTree.SelectedNode.Remove();
                }
                if (parent != null)
                {
                    this.cwc.CatalogTree.SelectedNode = parent;
                }
                if (this.cwc.CatalogTree.Nodes.Count > 0)
                {
                    this.treeNodeList.Clear();
                    this.FillNodeList(this.cwc.CatalogTree.Nodes[0]);
                }
                return(Neusoft.HISFC.BizProcess.Factory.Function.IntegrateEPR.DeleteRule(cwr, true));
            }
            else
            {
                return(0);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 添加书写规范
        /// </summary>
        /// <returns>1 成功,-1 失败</returns>
        public int InsertRule(Neusoft.HISFC.Models.EPR.CaseWriteRule rule)
        {
            string sqlIndex = "EPR.CaseWriteRule.InsertRule";
            string strSql   = string.Empty;

            try
            {
                if (this.Sql.GetSql(sqlIndex, ref strSql) == -1)
                {
                    return(-1);
                }
                strSql = string.Format(strSql,
                                       rule.RuleCode,
                                       rule.RuleName,
                                       rule.DeptName,
                                       rule.DeptCode,
                                       rule.Descript,
                                       rule.Sort,
                                       rule.Memo,
                                       rule.RuleLink,
                                       rule.ParentCode);
                if (this.ExecNoQuery(strSql) == -1)
                {
                    return(-1);
                }

                if (!string.IsNullOrEmpty(rule.RuleData))
                {
                    sqlIndex = "EPR.CaseWriteRule.UpdateBlob";
                    strSql   = string.Empty;
                    if (this.Sql.GetSql(sqlIndex, ref strSql) == -1)
                    {
                        return(-1);
                    }
                    strSql = string.Format(strSql, rule.RuleCode);

                    if (this.InputBlob(strSql, System.Text.Encoding.GetEncoding("GB2312").GetBytes(rule.RuleData)) == -1)
                    {
                        DeleteRule(rule, false);
                        return(-1);
                    }
                }
            }
            catch (Exception e)
            {
                this.Err = e.Message + "\r\n" + e.StackTrace;
                return(-1);
            }
            return(1);
        }
Esempio n. 8
0
 /// <summary>
 /// 对页面赋值
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CatalogTree_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (((TreeView)sender).SelectedNode.Tag != null)
     {
         Neusoft.HISFC.Models.EPR.CaseWriteRule cwr = ((TreeView)sender).SelectedNode.Tag as Neusoft.HISFC.Models.EPR.CaseWriteRule;
         this.ntbName.Text     = cwr.RuleName;
         this.ncbDept.Text     = cwr.DeptName;
         this.ncbDept.Enabled  = false;
         this.ntbSort.Text     = cwr.Sort;
         this.ntbDescript.Text = cwr.Descript;
         this.ntbLink.Text     = cwr.RuleLink;
         this.ntbData.Text     = cwr.RuleData;
         this.ntbMemo.Text     = cwr.Memo;
     }
 }
Esempio n. 9
0
        /// <summary>
        /// 拖拽事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ntvCatalog_DragDrop(object sender, DragEventArgs e)
        {
            TreeNode dragNode;

            if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
            {
                Point    pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
                TreeNode destinationNode = ((TreeView)sender).GetNodeAt(pt);
                dragNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
                if (destinationNode != null && dragNode != destinationNode && destinationNode.TreeView == dragNode.TreeView)
                {
                    if ((destinationNode.Tag as Neusoft.HISFC.Models.EPR.CaseWriteRule).DeptCode != (dragNode.Tag as Neusoft.HISFC.Models.EPR.CaseWriteRule).DeptCode)
                    {
                        MessageBox.Show("不同科室之间不能拖拽!");
                        return;
                    }
                    ((TreeView)sender).SelectedNode = destinationNode;
                    Neusoft.HISFC.Models.EPR.CaseWriteRule cwr = new Neusoft.HISFC.Models.EPR.CaseWriteRule();
                    if (dragNode.Tag != null)
                    {
                        cwr = (Neusoft.HISFC.Models.EPR.CaseWriteRule)dragNode.Tag;

                        Neusoft.HISFC.BizProcess.Factory.Function.BeginTransaction();
                        //Neusoft.HISFC.Management.EPR.CaseWriteRule cwrManager = new Neusoft.HISFC.Management.EPR.CaseWriteRule();

                        if (Neusoft.HISFC.BizProcess.Factory.Function.IntegrateEPR.DeleteRule(cwr, false) == -1)
                        {
                            Neusoft.HISFC.BizProcess.Factory.Function.RollBack();
                            MessageBox.Show("由于数据库操作失败,规范移动失败!");
                            return;
                        }
                        //string newRuleCode = this.MakeRuleCode();

                        if (dragNode.Nodes.Count > 0)
                        {
                            if (Neusoft.HISFC.BizProcess.Factory.Function.IntegrateEPR.ModifyForDrag(cwr, (destinationNode.Tag as Neusoft.HISFC.Models.EPR.CaseWriteRule).RuleCode) == -1)
                            {
                                Neusoft.HISFC.BizProcess.Factory.Function.RollBack();
                                MessageBox.Show("由于数据库操作失败,规范移动失败!");
                                return;
                            }
                        }
                        //cwr.RuleCode = newRuleCode;
                        cwr.ParentCode = ((Neusoft.HISFC.Models.EPR.CaseWriteRule)(destinationNode.Tag)).RuleCode;
                        dragNode.Tag   = cwr;
                        dragNode.Name  = cwr.RuleCode;// +"_" + cwr.DeptCode;
                        if (Neusoft.HISFC.BizProcess.Factory.Function.IntegrateEPR.InsertRule(cwr) == -1)
                        {
                            Neusoft.HISFC.BizProcess.Factory.Function.RollBack();
                            MessageBox.Show("由于数据库操作失败,规范移动失败!");
                            return;
                        }
                        else
                        {
                            Neusoft.HISFC.BizProcess.Factory.Function.Commit();

                            destinationNode.Nodes.Add((TreeNode)dragNode.Clone());
                            destinationNode.ExpandAll();

                            this.RemoveChildren(dragNode);
                            dragNode.Remove();
                        }
                        this.SearchBox.Text = string.Empty;
                    }
                }
            }
        }
Esempio n. 10
0
 public int ModifyRule(Neusoft.HISFC.Models.EPR.CaseWriteRule rule)
 {
     Neusoft.HISFC.BizLogic.EPR.CaseWriteRule cwrManager = new Neusoft.HISFC.BizLogic.EPR.CaseWriteRule();
     this.SetDB(cwrManager);
     return(cwrManager.ModifyRule(rule));
 }
Esempio n. 11
0
 public int ModifyForDrag(Neusoft.HISFC.Models.EPR.CaseWriteRule rule, string newparent)
 {
     Neusoft.HISFC.BizLogic.EPR.CaseWriteRule cwrManager = new Neusoft.HISFC.BizLogic.EPR.CaseWriteRule();
     this.SetDB(cwrManager);
     return(cwrManager.ModifyForDrag(rule, newparent));
 }
Esempio n. 12
0
 public int DeleteRule(Neusoft.HISFC.Models.EPR.CaseWriteRule rule, bool deleteChildren)
 {
     Neusoft.HISFC.BizLogic.EPR.CaseWriteRule cwrManager = new Neusoft.HISFC.BizLogic.EPR.CaseWriteRule();
     this.SetDB(cwrManager);
     return(cwrManager.DeleteRule(rule, deleteChildren));
 }