/// <summary>
        /// 获取摆药单列表显示时患者节点
        /// </summary>
        /// <param name="nodeBill">父级节点</param>
        /// <param name="obj">患者信息</param>
        /// <returns>成功返回摆药单显示时的患者节点</returns>
        private DrugMessageTreeNode GetNodePatient(Neusoft.FrameWork.Models.NeuObject obj, DrugMessageTreeNode parentNode)
        {
            foreach (DrugMessageTreeNode childNode in parentNode.Nodes)
            {
                if (childNode.Text == "【" + obj.Memo + "】" + obj.Name)
                {
                    return(childNode);
                }
            }

            DrugMessageTreeNode nodePatient;

            nodePatient                    = new DrugMessageTreeNode();
            nodePatient.Text               = "【" + obj.Memo + "】" + obj.Name; //【床号】姓名
            nodePatient.ImageIndex         = 6;
            nodePatient.SelectedImageIndex = 6;
            nodePatient.Tag                = obj;
            nodePatient.NodeType           = DrugMessageNodeType.Patient;
            if (parentNode == null)
            {
                this.Nodes.Add(nodePatient);
            }
            else
            {
                parentNode.Nodes.Add(nodePatient);
            }
            return(nodePatient);
        }
        /// <summary>
        /// 获取摆药单列表显示时的摆药单节点
        /// </summary>
        /// <param name="info">摆药通知信息</param>
        /// <param name="nodeDept">父级节点</param>
        /// <returns>成功返回摆药单列表显示时的摆药单节点</returns>
        private DrugMessageTreeNode GetNodeBill(Neusoft.HISFC.Models.Pharmacy.DrugMessage info, DrugMessageTreeNode parentNode)
        {
            //{22E638FE-2821-4bdf-A8A9-5BD25D51742E}  数据校验 避免parentNode为null
            if (parentNode != null)
            {
                foreach (DrugMessageTreeNode childNode in parentNode.Nodes)
                {
                    if (childNode.Text == info.DrugBillClass.Name)
                    {
                        return(childNode);
                    }
                }
            }

            DrugMessageTreeNode nodeBill = new DrugMessageTreeNode();

            nodeBill.Text               = info.DrugBillClass.Name;
            nodeBill.ImageIndex         = 4;
            nodeBill.SelectedImageIndex = 5;
            nodeBill.Tag      = info;
            nodeBill.NodeType = DrugMessageNodeType.DrugBill;
            if (parentNode == null)
            {
                this.Nodes.Add(nodeBill);
            }
            else
            {
                parentNode.Nodes.Add(nodeBill);         //添加到科室节点
            }
            return(nodeBill);
        }
        /// <summary>
        /// 根据传入的摆药通知数组,显示在tvDrugMessage中
        /// 传入参数数组是按照科室、摆药单类型、发送时间(倒序)排序的
        ///
        /// 显示层次为 科室/患者/单据
        /// </summary>
        /// <param name="alDrugMessage">摆药通知数组</param>
        public virtual void ShowListForInpatientFirst(ArrayList alDrugMessage)
        {
            this.Nodes.Clear();

            string privPatientNO = "";
            string privDeptCode  = "";                          //上一个科室

            Neusoft.HISFC.Models.Pharmacy.DrugMessage privInfo = new Neusoft.HISFC.Models.Pharmacy.DrugMessage();
            DrugMessageTreeNode nodePatient;
            DrugMessageTreeNode nodeDept = new DrugMessageTreeNode();
            DrugMessageTreeNode nodeBill = new DrugMessageTreeNode();

            this.SuspendLayout();

            foreach (DrugMessage info in alDrugMessage)
            {
                if (info.ApplyDept.ID != privDeptCode)          //添加新的科室节点 一个科室节点仅需添加处理一次
                {
                    nodeDept = this.GetNodeDept(info, null);

                    privDeptCode = info.ApplyDept.ID;
                    privInfo     = new Neusoft.HISFC.Models.Pharmacy.DrugMessage();
                }

                //避免重复添加
                if (info.ApplyDept.ID == privInfo.ApplyDept.ID && info.StockDept.ID == privInfo.StockDept.ID &&
                    info.DrugBillClass.ID == privInfo.DrugBillClass.ID && info.SendType == privInfo.SendType)
                {
                    continue;
                }

                //获取患者信息
                List <Neusoft.FrameWork.Models.NeuObject> neuObjectList = this.itemManager.QueryApplyOutPatientList(info);
                if (neuObjectList == null)
                {
                    MessageBox.Show("添加患者节点:" + this.itemManager.Err);
                    return;
                }
                foreach (Neusoft.FrameWork.Models.NeuObject obj in neuObjectList)
                {
                    nodePatient = this.GetNodePatient(obj, nodeDept);

                    nodeBill = this.GetNodeBill(info, nodePatient);

                    this.JudgePrint(info.ApplyDept.ID + info.DrugBillClass.ID + obj.ID, info, obj.ID);
                }
            }

            this.ResumeLayout();
        }
        /// <summary>
        /// 获取摆药单列表显示时科室节点
        /// </summary>
        /// <param name="info">摆药通知信息</param>
        /// <returns>成功返回摆药单列表显示时的科室节点</returns>
        private DrugMessageTreeNode GetNodeDept(Neusoft.HISFC.Models.Pharmacy.DrugMessage info, DrugMessageTreeNode parentNode)
        {
            DrugMessageTreeNode nodeDept = new DrugMessageTreeNode();

            if (info.ApplyDept.Name == "")
            {
                info.ApplyDept.Name = objHelper.GetName(info.ApplyDept.ID);
            }
            nodeDept.Text       = info.ApplyDept.Name;
            nodeDept.ImageIndex = 0;
            nodeDept.Tag        = info;
            nodeDept.NodeType   = DrugMessageNodeType.ApplyDept;
            if (parentNode == null)
            {
                this.Nodes.Add(nodeDept);
            }
            else
            {
                parentNode.Nodes.Add(nodeDept);
            }
            return(nodeDept);
        }
        /// <summary>
        /// 根据传入的摆药通知数组,显示在tvDrugMessage中
        /// 传入参数数组是按照科室、摆药单类型、发送时间(倒序)排序的
        /// </summary>
        /// <param name="alDrugMessage">摆药通知数组</param>
        /// <param name="showLevel">显示等级</param>
        protected virtual void ShowList(ArrayList alDrugMessage, int showLevel)
        {
            //if (!this.isListAddType)
            this.Nodes.Clear();

            string privBillCode = "";
            string privDeptCode = "";                           //上一个科室

            Neusoft.HISFC.Models.Pharmacy.DrugMessage privInfo = new Neusoft.HISFC.Models.Pharmacy.DrugMessage();
            DrugMessageTreeNode nodePatient;
            DrugMessageTreeNode nodeDept = new DrugMessageTreeNode();
            DrugMessageTreeNode nodeBill = new DrugMessageTreeNode();

            foreach (DrugMessage info in alDrugMessage)
            {
                #region 每次将节点清空重新添加

                this.SuspendLayout();

                if (this.isDeptFirst)
                {
                    #region 只显示至科室节点
                    if (info.ApplyDept.ID != privDeptCode)              //添加新的科室节点
                    {
                        nodeDept = GetNodeDept(info, null);

                        privDeptCode = info.ApplyDept.ID;
                        privInfo     = new Neusoft.HISFC.Models.Pharmacy.DrugMessage();
                        privBillCode = "";
                    }
                    if (showLevel == 0)
                    {
                        continue;                                       //如果只显示一级 则继续
                    }
                    #endregion

                    #region 只显示至摆药单节点
                    if (info.DrugBillClass.ID != privBillCode)  //添加新的摆药单节点
                    {
                        nodeBill = this.GetNodeBill(info, nodeDept);

                        privBillCode = info.DrugBillClass.ID;   //保存上一次的摆药单号
                    }
                    if (showLevel == 1)
                    {
                        continue;                                       //如果不显示患者信息 则继续
                    }
                    #endregion

                    #region 显示患者信息 如果信息相同则继续
                    if (info.ApplyDept.ID == privInfo.ApplyDept.ID && info.StockDept.ID == privInfo.StockDept.ID &&
                        info.DrugBillClass.ID == privInfo.DrugBillClass.ID && info.SendType == privInfo.SendType)
                    {
                        continue;
                    }
                    privInfo = info;

                    //住院领药单 by Sunjh 2010-11-17 {F667C43C-FA2B-4c94-843D-5C540B6F06F7}
                    bool isNursePrint = this.ctrlIntegrate.GetControlParam <bool>("P01016", true, false);
                    if (isNursePrint)
                    {
                        ArrayList alTemp = this.itemManager.QueryNursePrintBill(info.DrugBillClass.ID, privInfo.ApplyDept.ID, privInfo.StockDept.ID);
                        if (alTemp == null)
                        {
                            MessageBox.Show("添加摆药单号节点:" + this.itemManager.Err);
                            return;
                        }
                        foreach (Neusoft.FrameWork.Models.NeuObject obj in alTemp)
                        {
                            nodePatient = this.GetNodePatient(obj, nodeBill);

                            this.JudgePrint(info.ApplyDept.ID + info.DrugBillClass.ID + obj.ID, info, obj.ID);
                        }
                    }
                    else
                    {
                        List <Neusoft.FrameWork.Models.NeuObject> neuObjectList = this.itemManager.QueryApplyOutPatientList(info);
                        if (neuObjectList == null)
                        {
                            MessageBox.Show("添加患者节点:" + this.itemManager.Err);
                            return;
                        }
                        foreach (Neusoft.FrameWork.Models.NeuObject obj in neuObjectList)
                        {
                            nodePatient = this.GetNodePatient(obj, nodeBill);

                            this.JudgePrint(info.ApplyDept.ID + info.DrugBillClass.ID + obj.ID, info, obj.ID);
                        }
                    }

                    //List<Neusoft.FrameWork.Models.NeuObject> neuObjectList = this.itemManager.QueryApplyOutPatientList(info);
                    //if (neuObjectList == null)
                    //{
                    //    MessageBox.Show("添加患者节点:" + this.itemManager.Err);
                    //    return;
                    //}
                    //foreach (Neusoft.FrameWork.Models.NeuObject obj in neuObjectList)
                    //{
                    //    nodePatient = this.GetNodePatient(obj, nodeBill);

                    //    this.JudgePrint(info.ApplyDept.ID + info.DrugBillClass.ID + obj.ID, info, obj.ID);
                    //}
                    #endregion
                }
                else
                {
                    #region  照摆药单优先显示

                    //添加摆药单分类列表,如果本节点已经添加则不重复添加
                    if (info.DrugBillClass.ID != privBillCode)
                    {
                        nodeBill = this.GetNodeBill(info, null);

                        privDeptCode = "";  //清空科室编码变量,避免跟上一张摆药单中的科室重复

                        //{22E638FE-2821-4bdf-A8A9-5BD25D51742E} 摆药单优先时发生错误
                        privBillCode = info.DrugBillClass.ID;
                    }

                    //如果显示等级为0(显示科室汇总),则不进行下面的代码
                    if (showLevel == 0)
                    {
                        continue;
                    }

                    //添加科室列表,如果本节点已经添加则不重复添加
                    if (info.ApplyDept.ID != privDeptCode)
                    {
                        nodeDept     = this.GetNodeDept(info, nodeBill);
                        privDeptCode = info.ApplyDept.ID;   //保存最新一次添加的科室节点

                        //如果显示等级为1(显示科室明细),则不进行下面的代码
                        if (showLevel == 1)
                        {
                            continue;
                        }

                        //添加患者列表(患者信息:住院流水号ID,姓名Name,床号Memo)
                        List <Neusoft.FrameWork.Models.NeuObject> neuObjectList = this.itemManager.QueryApplyOutPatientList(info);
                        if (neuObjectList == null)
                        {
                            MessageBox.Show("添加患者节点:" + this.itemManager.Err);
                            return;
                        }
                        foreach (Neusoft.FrameWork.Models.NeuObject obj in neuObjectList)
                        {
                            nodePatient = this.GetNodePatient(obj, nodeDept);

                            this.JudgePrint(info.ApplyDept.ID + info.DrugBillClass.ID + obj.ID, info, obj.ID);
                        }
                    }

                    #endregion
                }

                this.ResumeLayout();

                #endregion

                #region 屏蔽原来累加方式代码 保留备份

                //if (this.isListAddType)
                //{
                //    #region 每次累加方式

                //    if (this.isDeptFirst)
                //    {
                //        #region 每次累计方式 按科室优先添加

                //        nodeDept = this.FindNode(info, this.Nodes, "0");
                //        if (nodeDept == null)
                //            nodeDept = GetNodeDept(info, null);

                //        if (showLevel == 0) continue;			//如果只显示一级 则继续

                //        nodeBill = this.FindNode(info, nodeDept.Nodes, "1");
                //        if (nodeBill == null)
                //            nodeBill = this.GetNodeBill(info, nodeDept);

                //        if (showLevel == 1) continue;			//如果不显示患者信息 则继续

                //        List<Neusoft.FrameWork.Models.NeuObject> neuObjectList = this.itemManager.QueryApplyOutPatientList(info);
                //        if (neuObjectList == null)
                //        {
                //            MessageBox.Show("添加患者节点:" + this.itemManager.Err);
                //            return;
                //        }
                //        foreach (Neusoft.FrameWork.Models.NeuObject obj in neuObjectList)
                //        {
                //            nodePatient = this.FindNode(obj, nodeBill.Nodes);
                //            if (nodePatient == null)
                //            {
                //                nodePatient = this.GetNodePatient(obj, nodeBill);
                //                this.JudgePrint(info.ApplyDept.ID + info.DrugBillClass.ID + obj.ID, info, obj.ID);
                //            }
                //        }

                //        #endregion
                //    }
                //    else
                //    {
                //        #region 每次累计方式 按单据优先添加

                //        nodeBill = this.FindNode(info, this.Nodes, "1");
                //        if (nodeBill == null)
                //            nodeBill = this.GetNodeBill(info, null);

                //        if (showLevel == 0) continue;

                //        nodeDept = this.FindNode(info, nodeBill.Nodes, "1");
                //        if (nodeDept == null)
                //            nodeDept = this.GetNodeDept(info, null);

                //        if (showLevel == 1) continue;

                //        List<Neusoft.FrameWork.Models.NeuObject> neuObjectList = this.itemManager.QueryApplyOutPatientList(info);
                //        if (neuObjectList == null)
                //        {
                //            MessageBox.Show("添加患者节点:" + this.itemManager.Err);
                //            return;
                //        }
                //        foreach (Neusoft.FrameWork.Models.NeuObject obj in neuObjectList)
                //        {
                //            nodePatient = this.FindNode(obj, nodeDept.Nodes);
                //            if (nodePatient == null)
                //            {
                //                nodePatient = this.GetNodePatient(obj, nodeDept);
                //                this.JudgePrint(info.ApplyDept.ID + info.DrugBillClass.ID + obj.ID, info, obj.ID);
                //            }
                //        }

                //        #endregion
                //    }

                //    #endregion
                //}
                //else
                //{
                //    #region 每次将节点清空重新添加

                //    this.SuspendLayout();

                //    if (this.isDeptFirst)
                //    {
                //        #region 只显示至科室节点
                //        if (info.ApplyDept.ID != privDeptCode)		//添加新的科室节点
                //        {
                //            nodeDept = GetNodeDept(info, null);

                //            privDeptCode = info.ApplyDept.ID;
                //            privInfo = new Neusoft.HISFC.Models.Pharmacy.DrugMessage();
                //            privBillCode = "";
                //        }
                //        if (showLevel == 0) continue;			//如果只显示一级 则继续
                //        #endregion

                //        #region 只显示至摆药单节点
                //        if (info.DrugBillClass.ID != privBillCode)	//添加新的摆药单节点
                //        {
                //            nodeBill = this.GetNodeBill(info, nodeDept);

                //            privBillCode = info.DrugBillClass.ID;	//保存上一次的摆药单号
                //        }
                //        if (showLevel == 1) continue;			//如果不显示患者信息 则继续
                //        #endregion

                //        #region 显示患者信息 如果信息相同则继续
                //        if (info.ApplyDept.ID == privInfo.ApplyDept.ID && info.StockDept.ID == privInfo.StockDept.ID
                //            && info.DrugBillClass.ID == privInfo.DrugBillClass.ID && info.SendType == privInfo.SendType)
                //            continue;
                //        privInfo = info;
                //        List<Neusoft.FrameWork.Models.NeuObject> neuObjectList = this.itemManager.QueryApplyOutPatientList(info);
                //        if (neuObjectList == null)
                //        {
                //            MessageBox.Show("添加患者节点:" + this.itemManager.Err);
                //            return;
                //        }
                //        foreach (Neusoft.FrameWork.Models.NeuObject obj in neuObjectList)
                //        {
                //            nodePatient = this.GetNodePatient(obj, nodeBill);

                //            this.JudgePrint(info.ApplyDept.ID + info.DrugBillClass.ID + obj.ID, info, obj.ID);
                //        }
                //        #endregion
                //    }
                //    else
                //    {
                //        #region 按照摆药单优先显示

                //        //添加摆药单分类列表,如果本节点已经添加则不重复添加
                //        if (info.DrugBillClass.ID != privBillCode)
                //        {
                //            nodeBill = this.GetNodeBill(info, null);

                //            privDeptCode = "";  //清空科室编码变量,避免跟上一张摆药单中的科室重复
                //        }

                //        //如果显示等级为0(显示科室汇总),则不进行下面的代码
                //        if (showLevel == 0) continue;

                //        //添加科室列表,如果本节点已经添加则不重复添加
                //        if (info.ApplyDept.ID != privDeptCode)
                //        {
                //            nodeDept = this.GetNodeDept(info, nodeBill);
                //            privDeptCode = info.ApplyDept.ID;   //保存最新一次添加的科室节点

                //            //如果显示等级为1(显示科室明细),则不进行下面的代码
                //            if (showLevel == 1) continue;

                //            //添加患者列表(患者信息:住院流水号ID,姓名Name,床号Memo)
                //            List<Neusoft.FrameWork.Models.NeuObject> neuObjectList = this.itemManager.QueryApplyOutPatientList(info);
                //            if (neuObjectList == null)
                //            {
                //                MessageBox.Show("添加患者节点:" + this.itemManager.Err);
                //                return;
                //            }
                //            foreach (Neusoft.FrameWork.Models.NeuObject obj in neuObjectList)
                //            {
                //                nodePatient = this.GetNodePatient(obj, nodeDept);

                //                this.JudgePrint(info.ApplyDept.ID + info.DrugBillClass.ID + obj.ID, info, obj.ID);
                //            }
                //        }

                //        #endregion
                //    }

                //    this.ResumeLayout();

                //    #endregion
                //}

                #endregion
            }
        }
        /// <summary>
        /// 根据传入的摆药通知数组,显示在tvDrugMessage中
        /// 传入参数数组是按照科室、摆药单类型、发送时间(倒序)排序的
        /// </summary>
        /// <param name="alDrugMessage">摆药通知数组</param>
        /// <param name="showLevel">显示等级</param>
        public virtual void ShowListForDeptFirst(ArrayList alDrugMessage, int showLevel)
        {
            this.Nodes.Clear();

            string privBillCode = "";
            string privDeptCode = "";                           //上一个科室

            Neusoft.HISFC.Models.Pharmacy.DrugMessage privInfo = new Neusoft.HISFC.Models.Pharmacy.DrugMessage();
            DrugMessageTreeNode nodePatient;
            DrugMessageTreeNode nodeDept = new DrugMessageTreeNode();
            DrugMessageTreeNode nodeBill = new DrugMessageTreeNode();

            foreach (DrugMessage info in alDrugMessage)
            {
                #region 每次将节点清空重新添加

                this.SuspendLayout();

                #region 只显示至科室节点

                if (info.ApplyDept.ID != privDeptCode)          //添加新的科室节点
                {
                    nodeDept = GetNodeDept(info, null);

                    privDeptCode = info.ApplyDept.ID;
                    privInfo     = new Neusoft.HISFC.Models.Pharmacy.DrugMessage();
                    privBillCode = "";
                }
                if (showLevel == 0)
                {
                    continue;                   //如果只显示一级 则继续
                }

                #endregion

                if (showLevel != 3)         //按原显示方式正常处理
                {
                    #region 只显示至摆药单节点 此处不显示患者

                    if (info.DrugBillClass.ID != privBillCode)  //添加新的摆药单节点
                    {
                        nodeBill = this.GetNodeBill(info, nodeDept);

                        privBillCode = info.DrugBillClass.ID;   //保存上一次的摆药单号
                    }
                    if (showLevel == 1)
                    {
                        continue;                       //如果不显示患者信息 则继续
                    }

                    #endregion

                    #region 显示患者信息 如果信息相同则继续

                    //避免重复添加
                    if (info.ApplyDept.ID == privInfo.ApplyDept.ID && info.StockDept.ID == privInfo.StockDept.ID &&
                        info.DrugBillClass.ID == privInfo.DrugBillClass.ID && info.SendType == privInfo.SendType)
                    {
                        continue;
                    }
                    privInfo = info;
                    List <Neusoft.FrameWork.Models.NeuObject> neuObjectList = this.itemManager.QueryApplyOutPatientList(info);
                    if (neuObjectList == null)
                    {
                        MessageBox.Show("添加患者节点:" + this.itemManager.Err);
                        return;
                    }
                    foreach (Neusoft.FrameWork.Models.NeuObject obj in neuObjectList)
                    {
                        nodePatient = this.GetNodePatient(obj, nodeBill);

                        this.JudgePrint(info.ApplyDept.ID + info.DrugBillClass.ID + obj.ID, info, obj.ID);
                    }

                    #endregion
                }
                else
                {
                    //显示患者明细 并按患者优先显示 即患者下面显示单据明细
                    DrugMessage tempMessage = info.Clone();
                    tempMessage.DrugBillClass.ID = "A";
                    List <Neusoft.FrameWork.Models.NeuObject> neuObjectList = this.itemManager.QueryApplyOutPatientList(tempMessage);
                    if (neuObjectList == null)
                    {
                        MessageBox.Show("添加患者节点:" + this.itemManager.Err);
                        return;
                    }

                    foreach (Neusoft.FrameWork.Models.NeuObject obj in neuObjectList)
                    {
                        nodePatient = this.GetNodePatient(obj, nodeDept);

                        this.JudgePrint(info.ApplyDept.ID + info.DrugBillClass.ID + obj.ID, info, obj.ID);
                    }
                }

                this.ResumeLayout();

                #endregion
            }
        }
        /// <summary>
        /// 获取选中的节点的摆药申请信息
        /// </summary>
        /// <param name="selectNode">当前选中节点</param>
        /// <param name="drugMessage">摆药通知信息</param>
        /// <param name="al">摆药明细信息</param>
        /// <param name="treeLevel">树节点层次</param>
        protected virtual void GetSelectData(DrugMessageTreeNode selectNode, ref Neusoft.HISFC.Models.Pharmacy.DrugMessage drugMessage, ref ArrayList al, ref bool isDetail)
        {
            if (selectNode == null)
            {
                return;
            }

            #region 库存药品列表获取 用于药柜管理的判断 仅取一次

            if (stockMark != null && stockMark.ID != "")
            {
                //获取科室库存药品信息
                if (this.hsStockData == null)
                {
                    this.hsStockData = new Hashtable();

                    Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm(Language.Msg("正在加载科室库存信息 请稍候..."));
                    Application.DoEvents();

                    ArrayList alStorage = this.itemManager.QueryStockinfoList(stockMark.ID);

                    foreach (Neusoft.HISFC.Models.Pharmacy.Storage storage in alStorage)
                    {
                        if (storage.IsArkManager)
                        {
                            continue;
                        }
                        this.hsStockData.Add(storage.Item.ID, null);
                    }

                    Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                }
            }

            #endregion

            int treeLevel = selectNode.Level;
            drugMessage = selectNode.Tag as Neusoft.HISFC.Models.Pharmacy.DrugMessage;

            ArrayList alTotal = new ArrayList();

            //住院领药单 by Sunjh 2010-11-17 {F667C43C-FA2B-4c94-843D-5C540B6F06F7}
            bool isNursePrint = this.ctrlIntegrate.GetControlParam <bool>("P01016", true, false);

            switch (treeLevel)
            {
            case 0:                 //第一级  NodeType 可能为 科室、单据
                //住院领药单 by Sunjh 2010-11-17 {F667C43C-FA2B-4c94-843D-5C540B6F06F7}
                //bool isNursePrint = this.ctrlIntegrate.GetControlParam<bool>("P01016", true, false);
                if (isNursePrint)
                {
                    break;
                }

                if (this.isDeptFirst)
                {
                    alTotal  = this.drugStoreManager.QueryDrugBillList(this.drugControl.ID, drugMessage);
                    isDetail = false;
                }
                else
                {
                    alTotal  = this.drugStoreManager.QueryDrugMessageList(drugMessage);
                    isDetail = false;
                }
                break;

            case 1:                //第二级 NodeType 可能为 科室、单据、患者
                //住院领药单 by Sunjh 2010-11-17 {F667C43C-FA2B-4c94-843D-5C540B6F06F7}
                //bool isNursePrint = this.ctrlIntegrate.GetControlParam<bool>("P01016", true, false);
                if (isNursePrint)
                {
                    break;
                }

                if (selectNode.NodeType == DrugMessageNodeType.Patient)         //节点为患者 特殊处理 取所有子节点摆药单进行处理
                {
                    Neusoft.FrameWork.Models.NeuObject patientTag = selectNode.Tag as Neusoft.FrameWork.Models.NeuObject;
                    ArrayList alTempTotal = new ArrayList();
                    foreach (DrugMessageTreeNode childNode in selectNode.Nodes)
                    {
                        drugMessage = childNode.Tag as Neusoft.HISFC.Models.Pharmacy.DrugMessage;
                        if (drugMessage != null)
                        {
                            drugMessage.User01 = patientTag.ID;
                            alTempTotal        = this.itemManager.QueryApplyOutListByPatient(drugMessage);
                        }

                        alTotal.AddRange(alTempTotal);
                    }
                }
                else
                {
                    alTotal = this.itemManager.QueryApplyOutList(drugMessage);
                }

                isDetail = true;

                break;

            case 2:             //第三级 NodeType 可能为 单据、患者
                if (selectNode.NodeType == DrugMessageNodeType.Patient)
                {
                    drugMessage = selectNode.Parent.Tag as Neusoft.HISFC.Models.Pharmacy.DrugMessage;
                    Neusoft.FrameWork.Models.NeuObject patientObj = selectNode.Tag as Neusoft.FrameWork.Models.NeuObject;
                    drugMessage.User01 = patientObj.ID;

                    //住院领药单 by Sunjh 2010-11-17 {F667C43C-FA2B-4c94-843D-5C540B6F06F7}
                    //bool isNursePrint = this.ctrlIntegrate.GetControlParam<bool>("P01016", true, false);
                    if (isNursePrint)
                    {
                        alTotal = this.itemManager.QueryApplyOutListByNurseBill(patientObj.ID);
                        drugMessage.DrugBillClass.Memo = patientObj.ID;    //事先保存摆药单号,用于后面的日志信息保存 by Sunjh 2010-8-5
                    }
                    else
                    {
                        alTotal = this.itemManager.QueryApplyOutListByPatient(drugMessage);
                    }

                    //alTotal = this.itemManager.QueryApplyOutListByPatient(drugMessage);
                    isDetail = true;
                }
                else           //节点为单据时
                {
                    drugMessage = selectNode.Tag as Neusoft.HISFC.Models.Pharmacy.DrugMessage;
                    Neusoft.FrameWork.Models.NeuObject patientObj = selectNode.Parent.Tag as Neusoft.FrameWork.Models.NeuObject;
                    drugMessage.User01 = patientObj.ID;
                    alTotal            = this.itemManager.QueryApplyOutListByPatient(drugMessage);
                    isDetail           = true;
                }
                break;
            }

            #region 药柜管理药品的处理

            if (this.hsStockData == null)
            {
                al = alTotal;
            }
            else
            {
                //屏蔽药柜管理的药品
                if (alTotal.Count > 0)
                {
                    if (alTotal[0] is Neusoft.HISFC.Models.Pharmacy.ApplyOut)
                    {
                        foreach (Neusoft.HISFC.Models.Pharmacy.ApplyOut info in alTotal)
                        {
                            if (this.hsStockData.ContainsKey(info.Item.ID))
                            {
                                al.Add(info);
                            }
                        }
                    }
                    else
                    {
                        al = alTotal;
                    }
                }
            }

            #endregion
        }