/// <summary>
        /// 获取药品信息
        /// </summary>
        /// <param name="itemId">药品Id</param>
        /// <returns>药品实体模型</returns>
        public CardDataSourceDrugItem  GetDrugItem(int itemId)
        {
            Action <ClientRequestData> requestAction = ((ClientRequestData request) =>
            {
                request.AddData(itemId);
            });
            ServiceResponseData           retData       = InvokeWcfService("OPProject.Service", "PresManageController", "GetDrugItemTpl", requestAction);
            DataTable                     dt            = retData.GetData <DataTable>(0);
            List <CardDataSourceDrugItem> list_DrugItem = new List <CardDataSourceDrugItem>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                CardDataSourceDrugItem mDrugItem = new CardDataSourceDrugItem();
                mDrugItem.ItemId         = ConvertDataExtend.ToInt32(dt.Rows[i]["ItemID"], 0);
                mDrugItem.ItemName       = dt.Rows[i]["ItemName"].ToString();
                mDrugItem.ItemName_Print = dt.Rows[i]["ItemName"].ToString();
                mDrugItem.Standard       = dt.Rows[i]["Standard"].ToString();

                mDrugItem.Scale        = string.Empty;                                              //补偿比例
                mDrugItem.StoreNum     = ConvertDataExtend.ToDecimal(dt.Rows[i]["StoreAmount"], 0); //库存量
                mDrugItem.UnPickUnit   = dt.Rows[i]["UnPickUnit"].ToString();                       //包装单位(销售单位)
                mDrugItem.SellPrice    = ConvertDataExtend.ToDecimal(dt.Rows[i]["UnitPrice"], 0);   //销售价格?
                mDrugItem.BuyPrice     = ConvertDataExtend.ToDecimal(dt.Rows[i]["InPrice"], 0);     //进价
                mDrugItem.ExecDeptName = dt.Rows[i]["ExecDeptName"].ToString();                     //执行科室?
                mDrugItem.Pym          = dt.Rows[i]["Pym"].ToString();
                mDrugItem.Wbm          = dt.Rows[i]["Wbm"].ToString();
                mDrugItem.Address      = dt.Rows[i]["Address"].ToString();//生产厂家
                //mDrugItem.DoseUnitId = dt.Rows[i][""].ToString();//剂量单位
                mDrugItem.DoseUnitName   = dt.Rows[i]["DoseUnitName"].ToString();
                mDrugItem.DoseConvertNum = ConvertDataExtend.ToDecimal(dt.Rows[i]["DoseConvertNum"], 0);//剂量对应包装单位系数
                int statID      = ConvertDataExtend.ToInt32(dt.Rows[i]["StatID"], 0);
                int itemClass   = ConvertDataExtend.ToInt32(dt.Rows[i]["ItemClass"], 0);
                int itemClassId = GetItemType(itemClass, statID);
                mDrugItem.ItemType     = itemClassId;                                                        //项目类型 0-所有 1-西药 2-中药  3-处方可开的物品 4-收费项目
                mDrugItem.StatItemCode = statID.ToString();                                                  //大项目代码
                //mDrugItem.UnPickUnitId = dt.Rows[i][""].ToString();//包装单位ID
                mDrugItem.ExecDeptId             = ConvertDataExtend.ToInt32(dt.Rows[i]["ExecDeptId"], 0);   //执行科室ID?
                mDrugItem.FloatFlag              = ConvertDataExtend.ToInt32(dt.Rows[i]["FloatFlag"], 0);    // dt.Rows[i][""].ToString();//按含量取整1 按剂量取整0
                mDrugItem.VirulentFlag           = ConvertDataExtend.ToInt32(dt.Rows[i]["VirulentFlag"], 0); //剧毒标识
                mDrugItem.NarcoticFlag           = ConvertDataExtend.ToInt32(dt.Rows[i]["NarcoticFlag"], 0); //麻醉标识
                mDrugItem.SkinTestFlag           = ConvertDataExtend.ToInt32(dt.Rows[i]["SkinTestFlag"], 0); //皮试标识
                mDrugItem.RecipeFlag             = ConvertDataExtend.ToInt32(dt.Rows[i]["RecipeFlag"], 0);   //处方标识
                mDrugItem.LunacyFlag             = ConvertDataExtend.ToInt32(dt.Rows[i]["LunacyFlag"], 0);   //精神药品标识
                mDrugItem.CostlyFlag             = ConvertDataExtend.ToInt32(dt.Rows[i]["CostlyFlag"], 0);   //贵重药品标识
                mDrugItem.default_Usage_Amount   = 0;                                                        //默认用量
                mDrugItem.default_Usage_Id       = 0;                                                        //默认用法
                mDrugItem.default_Usage_Name     = string.Empty;
                mDrugItem.default_Frequency_Id   = 0;                                                        //默认频次
                mDrugItem.default_Frequency_Name = string.Empty;
                list_DrugItem.Add(mDrugItem);
            }

            return(list_DrugItem.Count > 0 ? list_DrugItem[0] : null);
        }
        public CardDataSourceDrugItem GetDrugItem(int ItemId)
        {
            string strsql = @"SELECT TOP 1* FROM ViewBaseData_Med T
                                        WHERE StockID={0}";

            strsql = string.Format(strsql, ItemId);

            DataTable dt = oleDb.GetDataTable(strsql);
            List <CardDataSourceDrugItem> list_DrugItem = new List <CardDataSourceDrugItem>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                CardDataSourceDrugItem mDrugItem = new CardDataSourceDrugItem();
                mDrugItem.ItemId         = ConvertDataExtend.ToInt32(dt.Rows[i]["StockID"], 0);
                mDrugItem.ItemName       = dt.Rows[i]["CName"].ToString();
                mDrugItem.ItemName_Print = dt.Rows[i]["TName"].ToString();
                mDrugItem.Standard       = dt.Rows[i]["Spec"].ToString();

                mDrugItem.Scale      = "";                                                      //补偿比例
                mDrugItem.StoreNum   = ConvertDataExtend.ToDecimal(dt.Rows[i]["ActualQty"], 0); //库存量
                mDrugItem.UnPickUnit = dt.Rows[i]["MiniUnit"].ToString();                       //包装单位(销售单位)
                mDrugItem.SellPrice  = ConvertDataExtend.ToDecimal(dt.Rows[i]["ClinPrice"], 0); //销售价格?
                mDrugItem.BuyPrice   = ConvertDataExtend.ToDecimal(dt.Rows[i]["WardPrice"], 0); //进价
                //mDrugItem.ExecDeptName = dt.Rows[i][""].ToString();//执行科室?
                mDrugItem.Pym     = dt.Rows[i]["PyCode"].ToString();
                mDrugItem.Wbm     = dt.Rows[i]["WbCode"].ToString();
                mDrugItem.Address = dt.Rows[i]["FacName"].ToString();//生产厂家
                //mDrugItem.DoseUnitId = dt.Rows[i][""].ToString();//剂量单位
                mDrugItem.DoseUnitName   = dt.Rows[i]["DosUnit"].ToString();
                mDrugItem.DoseConvertNum = ConvertDataExtend.ToDecimal(dt.Rows[i]["Dosage"], 0); //剂量对应包装单位系数
                mDrugItem.ItemType       = ConvertDataExtend.ToInt32(dt.Rows[i]["MatClass"], 0); //项目类型 0-所有 1-西药 2-中药  3-处方可开的物品 4-收费项目
                //mDrugItem.StatItemCode = dt.Rows[i][""].ToString();//大项目代码
                //mDrugItem.UnPickUnitId = dt.Rows[i][""].ToString();//包装单位ID
                mDrugItem.ExecDeptId = ConvertDataExtend.ToInt32(dt.Rows[i]["DeptID"], 0);       //执行科室ID?
                mDrugItem.FloatFlag  = ConvertDataExtend.ToInt32(dt.Rows[i]["RoundingMode"], 0); // dt.Rows[i][""].ToString();//按含量取整1 按剂量取整0
                //mDrugItem.VirulentFlag = dt.Rows[i][""].ToString();//剧毒标识
                //mDrugItem.NarcoticFlag = dt.Rows[i][""].ToString();//麻醉标识
                mDrugItem.SkinTestFlag = ConvertDataExtend.ToInt32(dt.Rows[i]["SkinMethod"], 0);//皮试标识
                //mDrugItem.RecipeFlag = dt.Rows[i][""].ToString();//处方标识
                //mDrugItem.LunacyFlag = dt.Rows[i][""].ToString();//精神药品标识
                //mDrugItem.CostlyFlag = dt.Rows[i][""].ToString();//贵重药品标识
                mDrugItem.default_Usage_Amount   = 0; //默认用量
                mDrugItem.default_Usage_Id       = 0; //默认用法
                mDrugItem.default_Usage_Name     = "";
                mDrugItem.default_Frequency_Id   = 0; //默认频次
                mDrugItem.default_Frequency_Name = "";

                list_DrugItem.Add(mDrugItem);
            }
            return(list_DrugItem.Count > 0 ? list_DrugItem[0] : null);
        }
        public bool IsDrugStore(List <Prescription.Controls.Entity.Prescription> list, List <Prescription.Controls.Entity.Prescription> errlist)
        {
            list = list.FindAll(x => x.IsDrug == true);
            if (list.Count == 0)
            {
                return(true);
            }
            string strsql = @"SELECT  StockID,ActualQty FROM ViewBaseData_Med WHERE StockID IN ({0}) ";
            string Ids    = null;

            for (int i = 0; i < list.Count; i++)
            {
                if (Ids == null)
                {
                    Ids = list[i].Item_Id.ToString();
                }
                else
                {
                    Ids += "," + list[i].Item_Id.ToString();
                }
            }

            strsql = string.Format(strsql, Ids);
            DataTable dt = oleDb.GetDataTable(strsql);

            //errlist = new List<Entity.Prescription>();
            for (int i = 0; i < list.Count; i++)
            {
                DataRow[] drs = dt.Select("StockID=" + list[i].Item_Id);
                if (drs.Length == 0 || ConvertDataExtend.ToDecimal(drs[0]["ActualQty"], 0) < list[i].Amount)
                {
                    errlist.Add(list[i]);
                }
            }

            if (errlist.Count > 0)
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// 获取药品信息
        /// </summary>
        /// <param name="type">处方类型</param>
        /// <param name="pageNo">页号</param>
        /// <param name="pageSize">页面大小</param>
        /// <param name="filter">过滤条件</param>
        /// <returns>药品列表</returns>
        public List <CardDataSourceDrugItem> GetDrugItem(int type, int pageNo, int pageSize, string filter)
        {
            // 全部 = 0, 西药与中成药 = 1, 中草药 = 2, 收费项目 = 3
            int statId = 100;

            if (type == 1)
            {
                statId = 100;
            }
            else if (type == 2)
            {
                statId = 102;
            }
            else if (type == 3)
            {
                statId = 0;
            }

            List <CardDataSourceDrugItem> list_DrugItem = new List <CardDataSourceDrugItem>();

            if (dtDrugItems == null || dtDrugItems.Rows.Count == 0)
            {
                Action <ClientRequestData> requestAction = ((ClientRequestData request) =>
                {
                    request.AddData(type);
                    request.AddData(statId);
                    request.AddData(SelectedDrugRoomID);
                });
                ServiceResponseData retdata = InvokeWcfService("OPProject.Service", "PresManageController", "GetShowCardData", requestAction);
                dtDrugItems = retdata.GetData <DataTable>(0);
            }

            //过滤处方数据
            DataTable dt = FilterPresData(type, statId);

            DataView dv = dt.DefaultView;

            dv.RowFilter = "Pym like '%" + filter + "%' or Wbm like '%" + filter + "%' or ItemName like '%" + filter + "%'";
            dt           = dv.ToTable();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                CardDataSourceDrugItem mDrugItem = new CardDataSourceDrugItem();
                mDrugItem.ItemId         = ConvertDataExtend.ToInt32(dt.Rows[i]["ItemID"], 0);
                mDrugItem.ItemName       = dt.Rows[i]["ItemName"].ToString();
                mDrugItem.ItemName_Print = dt.Rows[i]["ItemName"].ToString();
                mDrugItem.Standard       = dt.Rows[i]["Standard"].ToString();
                mDrugItem.PresFactor     = ConvertDataExtend.ToInt32(dt.Rows[i]["MiniConvertNum"], 1);
                mDrugItem.Scale          = string.Empty;                                              //补偿比例
                mDrugItem.StoreNum       = ConvertDataExtend.ToDecimal(dt.Rows[i]["StoreAmount"], 0); //库存量
                mDrugItem.UnPickUnit     = dt.Rows[i]["UnPickUnit"].ToString();                       //包装单位(销售单位)
                mDrugItem.PresFactor     = ConvertDataExtend.ToInt32(dt.Rows[i]["MiniConvertNum"], 1);
                mDrugItem.MiniUnit       = dt.Rows[i]["MiniUnitName"].ToString();
                mDrugItem.SellPrice      = ConvertDataExtend.ToDecimal(dt.Rows[i]["UnitPrice"], 0); //基本单位价格?
                mDrugItem.BuyPrice       = ConvertDataExtend.ToDecimal(dt.Rows[i]["InPrice"], 0);   //进价
                mDrugItem.ExecDeptName   = dt.Rows[i]["ExecDeptName"].ToString();                   //执行科室?
                mDrugItem.ExecDeptId     = ConvertDataExtend.ToInt32(dt.Rows[i]["ExecDeptId"], 0);
                mDrugItem.StatItemCode   = dt.Rows[i]["StatID"].ToString();
                mDrugItem.Pym            = dt.Rows[i]["Pym"].ToString();
                mDrugItem.Wbm            = dt.Rows[i]["Wbm"].ToString();
                mDrugItem.Address        = dt.Rows[i]["Address"].ToString();//生产厂家
                //mDrugItem.DoseUnitId = dt.Rows[i][""].ToString();//剂量单位
                mDrugItem.DoseUnitName   = dt.Rows[i]["DoseUnitName"].ToString();
                mDrugItem.DoseConvertNum = ConvertDataExtend.ToDecimal(dt.Rows[i]["DoseConvertNum"], 0);//剂量对应包装单位系数
                int statID      = ConvertDataExtend.ToInt32(dt.Rows[i]["StatID"], 0);
                int itemClass   = ConvertDataExtend.ToInt32(dt.Rows[i]["ItemClass"], 0);
                int itemClassId = GetItemType(itemClass, statID);
                mDrugItem.ItemType     = itemClassId;                                                        //项目类型 0-所有 1-西药 2-中药  3-处方可开的物品 4-收费项目
                mDrugItem.StatItemCode = statID.ToString();                                                  //大项目代码
                //mDrugItem.UnPickUnitId = dt.Rows[i][""].ToString();//包装单位ID
                mDrugItem.ExecDeptId             = ConvertDataExtend.ToInt32(dt.Rows[i]["ExecDeptId"], 0);   //执行科室ID?
                mDrugItem.FloatFlag              = ConvertDataExtend.ToInt32(dt.Rows[i]["FloatFlag"], 0);    // dt.Rows[i][""].ToString();//按含量取整1 按剂量取整0
                mDrugItem.VirulentFlag           = ConvertDataExtend.ToInt32(dt.Rows[i]["VirulentFlag"], 0); //剧毒标识
                mDrugItem.NarcoticFlag           = ConvertDataExtend.ToInt32(dt.Rows[i]["NarcoticFlag"], 0); //麻醉标识
                mDrugItem.SkinTestFlag           = ConvertDataExtend.ToInt32(dt.Rows[i]["SkinTestFlag"], 0); //皮试标识
                mDrugItem.RecipeFlag             = ConvertDataExtend.ToInt32(dt.Rows[i]["RecipeFlag"], 0);   //处方标识
                mDrugItem.LunacyFlag             = ConvertDataExtend.ToInt32(dt.Rows[i]["LunacyFlag"], 0);   //精神药品标识
                mDrugItem.CostlyFlag             = ConvertDataExtend.ToInt32(dt.Rows[i]["CostlyFlag"], 0);   //贵重药品标识
                mDrugItem.default_Usage_Amount   = 0;                                                        //默认用量
                mDrugItem.default_Usage_Id       = 0;                                                        //默认用法
                mDrugItem.default_Usage_Name     = string.Empty;
                mDrugItem.default_Frequency_Id   = 0;                                                        //默认频次
                mDrugItem.default_Frequency_Name = string.Empty;
                mDrugItem.ResolveFlag            = ConvertDataExtend.ToInt32(dt.Rows[i]["ResolveFlag"], 0);
                list_DrugItem.Add(mDrugItem);
            }

            return(list_DrugItem);
        }
Esempio n. 5
0
        //0-所有 1-西药 2-中药  3-处方可开的物品 4-收费项目
        public static List <CardDataSourceDrugItem> GetDrugItem(int type, int pageNo, int pageSize, string filter)
        {
            if (PrescripttionDbHelper != null)
            {
                return(PrescripttionDbHelper.GetDrugItem(type, pageNo, pageSize, filter));
            }
            else
            {
                PageInfo page = new PageInfo(pageSize, pageNo);
                page.KeyName = "StockID";


                string strsql = @"SELECT * FROM hisdb..View_DrugAndFeeList WHERE MatClass={1} and (PyCode LIKE '%{0}%' OR PyCodeT LIKE '%{0}%' OR WbCode LIKE '%{0}%' OR WbCodeT LIKE '%{0}%' OR CName LIKE '%{0}%')";
                strsql = string.Format(strsql, filter, type);
                DataTable dt = MidDbHelper.ExecuteDataTable(MidDbHelper.HisHandle, strsql, page);

                //DataTable dt = HIS_FeeList.GetDrugAndFeeListFromMid(0, filter);

                List <CardDataSourceDrugItem> list_DrugItem = new List <CardDataSourceDrugItem>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    CardDataSourceDrugItem mDrugItem = new CardDataSourceDrugItem();
                    mDrugItem.ItemId         = ConvertDataExtend.ToInt32(dt.Rows[i]["StockID"], 0);
                    mDrugItem.ItemName       = dt.Rows[i]["CName"].ToString();
                    mDrugItem.ItemName_Print = dt.Rows[i]["TName"].ToString();
                    mDrugItem.Standard       = dt.Rows[i]["Spec"].ToString();

                    mDrugItem.Scale      = dt.Rows[i]["Competence"].ToString();                     //补偿比例
                    mDrugItem.StoreNum   = ConvertDataExtend.ToDecimal(dt.Rows[i]["ActualQty"], 0); //库存量
                    mDrugItem.UnPickUnit = dt.Rows[i]["MiniUnit"].ToString();                       //包装单位(销售单位)
                    mDrugItem.SellPrice  = ConvertDataExtend.ToDecimal(dt.Rows[i]["ClinPrice"], 0); //销售价格?
                    mDrugItem.BuyPrice   = ConvertDataExtend.ToDecimal(dt.Rows[i]["WardPrice"], 0); //进价
                    //mDrugItem.ExecDeptName = dt.Rows[i][""].ToString();//执行科室?
                    mDrugItem.Pym     = dt.Rows[i]["PyCode"].ToString();
                    mDrugItem.Wbm     = dt.Rows[i]["WbCode"].ToString();
                    mDrugItem.Address = dt.Rows[i]["FacName"].ToString();//生产厂家
                    //mDrugItem.DoseUnitId = dt.Rows[i][""].ToString();//剂量单位
                    mDrugItem.DoseUnitName   = dt.Rows[i]["DosUnit"].ToString();
                    mDrugItem.DoseConvertNum = ConvertDataExtend.ToDecimal(dt.Rows[i]["Dosage"], 0); //剂量对应包装单位系数
                    mDrugItem.ItemType       = ConvertDataExtend.ToInt32(dt.Rows[i]["MatClass"], 0); //项目类型 0-所有 1-西药 2-中药  3-处方可开的物品 4-收费项目
                    //mDrugItem.StatItemCode = dt.Rows[i][""].ToString();//大项目代码
                    //mDrugItem.UnPickUnitId = dt.Rows[i][""].ToString();//包装单位ID
                    mDrugItem.ExecDeptId = ConvertDataExtend.ToInt32(dt.Rows[i]["DeptID"], 0); //执行科室ID?
                    mDrugItem.FloatFlag  = 1;                                                  // dt.Rows[i][""].ToString();//按含量取整1 按剂量取整0
                    //mDrugItem.VirulentFlag = dt.Rows[i][""].ToString();//剧毒标识
                    //mDrugItem.NarcoticFlag = dt.Rows[i][""].ToString();//麻醉标识
                    mDrugItem.SkinTestFlag = ConvertDataExtend.ToInt32(dt.Rows[i]["SkinMethod"], 0);//皮试标识
                    //mDrugItem.RecipeFlag = dt.Rows[i][""].ToString();//处方标识
                    //mDrugItem.LunacyFlag = dt.Rows[i][""].ToString();//精神药品标识
                    //mDrugItem.CostlyFlag = dt.Rows[i][""].ToString();//贵重药品标识
                    mDrugItem.default_Usage_Amount   = ConvertDataExtend.ToDecimal(dt.Rows[i]["BASEDos"], 0); //默认用量
                    mDrugItem.default_Usage_Id       = ConvertDataExtend.ToInt32(dt.Rows[i]["UsgID"], 0);     //默认用法
                    mDrugItem.default_Usage_Name     = dt.Rows[i]["ChannelName"].ToString();
                    mDrugItem.default_Frequency_Id   = ConvertDataExtend.ToInt32(dt.Rows[i]["FcyID"], 0);     //默认频次
                    mDrugItem.default_Frequency_Name = dt.Rows[i]["FrequencyName"].ToString();

                    list_DrugItem.Add(mDrugItem);
                }
                return(list_DrugItem);
            }
        }
        public List <Prescription.Controls.Entity.Prescription> GetPresTemplateRow(int type, int[] tpldetailIds)
        {
            if (tpldetailIds.Length == 0)
            {
                return(new List <Prescription.Controls.Entity.Prescription>());
            }

            string strsql = "";

            strsql = @"SELECT TOP 100 A.GroupID,
	                                A.FeeID,A.FeeName,A.FeeClass, 
	                                A.Dosage,A.DosageUnit,
	                                A.Amount,A.Unit,
	                                A.FrequencyID,C.FrequencyName AS FrequencyName,C.ExecuteCode,
	                                A.ChannelID,B.CName AS ChannelName,
	                                A.Days Num, A.Days,A.Memo
	                                ,D.ClinPrice,D.Spec,D.Dosage DoseConvertNum,D.MatClass,D.SkinMethod IsAst
	                                FROM Clinic_SetMealDetail A
		                                LEFT JOIN Clinic_Channel B ON A.ChannelID = B.ID
		                                LEFT JOIN Clinic_Frequency C ON A.FrequencyID = C.ID 
		                                LEFT JOIN ViewBaseData_Med D ON A.FeeID=D.StockID 
	                                 WHERE A.ID in ({0})
	                                 ORDER BY A.GroupID,A.OrderNum"    ;
            strsql = string.Format(strsql,
                                   string.Join(",", Array.ConvertAll <int, string>(tpldetailIds, delegate(int v)
            {
                return(v.ToString());
            })));


            DataTable dt = oleDb.GetDataTable(strsql);
            List <Prescription.Controls.Entity.Prescription> list_Prescription = new List <Prescription.Controls.Entity.Prescription>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Prescription.Controls.Entity.Prescription mPres = new Prescription.Controls.Entity.Prescription();

                mPres.PresListId = 0;
                mPres.PresHeadId = 0;
                //mPres.OrderNo = i + 1;//行号
                mPres.Item_Id       = Convert.ToInt32(dt.Rows[i]["FeeID"]);
                mPres.Item_Name     = dt.Rows[i]["FeeName"].ToString();
                mPres.Item_Type     = type;//1西药 2中药 3项目材料
                mPres.StatItem_Code = "";
                mPres.Sell_Price    = ConvertDataExtend.ToDecimal(dt.Rows[i]["ClinPrice"], 0);
                mPres.Buy_Price     = ConvertDataExtend.ToDecimal(dt.Rows[i]["ClinPrice"], 0);
                mPres.Item_Price    = ConvertDataExtend.ToDecimal(dt.Rows[i]["ClinPrice"], 0);
                mPres.Standard      = dt.Rows[i]["Spec"].ToString();
                mPres.Usage_Amount  = Convert.ToDecimal(dt.Rows[i]["Dosage"]);                      //剂量
                mPres.Usage_Unit    = dt.Rows[i]["DosageUnit"].ToString();                          //剂量单位
                mPres.Usage_Rate    = ConvertDataExtend.ToDecimal(dt.Rows[i]["DoseConvertNum"], 1); //剂量系数
                mPres.Dosage        = Convert.ToInt32(dt.Rows[i]["Num"]);                           //付数
                mPres.Usage_Id      = Convert.ToInt32(dt.Rows[i]["ChannelID"]);
                mPres.Frequency_Id  = Convert.ToInt32(dt.Rows[i]["FrequencyID"]);
                mPres.Days          = Convert.ToInt32(dt.Rows[i]["Days"]);

                mPres.Amount = Convert.ToDecimal(dt.Rows[i]["Amount"].ToString());            //发药数量
                mPres.Unit   = dt.Rows[i]["Unit"].ToString();                                 //发药单位

                mPres.Item_Amount = Convert.ToInt32(Convert.ToDecimal(dt.Rows[i]["Amount"])); //开药数量
                mPres.Item_Unit   = dt.Rows[i]["Unit"].ToString();                            //开药单位
                mPres.Item_Rate   = 1;                                                        //系数

                mPres.Group_Id      = Convert.ToInt32(dt.Rows[i]["GroupID"]);                 //分组组号
                mPres.SkinTest_Flag = ConvertDataExtend.ToInt32(dt.Rows[i]["IsAst"], 0);      //皮试
                mPres.SelfDrug_Flag = 0;                                                      //自备
                mPres.Entrust       = dt.Rows[i]["Memo"].ToString();                          //嘱托

                mPres.FootNote = "";
                mPres.Tc_Flag  = 0;                                               //套餐

                mPres.Usage_Name        = dt.Rows[i]["ChannelName"].ToString();   //用法名称
                mPres.Frequency_Name    = dt.Rows[i]["FrequencyName"].ToString(); //频次名称
                mPres.Frequency_Caption = dt.Rows[i]["ExecuteCode"].ToString();   //频次名称

                int _execNum, _cycleDay;
                CardDataSourceFrequency.Calculate(dt.Rows[i]["ExecuteCode"].ToString(), out _execNum, out _cycleDay);
                mPres.Frequency_ExecNum  = _execNum;  //执行次数
                mPres.Frequency_CycleDay = _cycleDay; //执行周期


                mPres.CalculateAmount(null);

                list_Prescription.Add(mPres);
            }

            return(list_Prescription);
            //throw new NotImplementedException();
        }
        private List <CardDataSourceDrugItem> GetDrugItemToDatabase(int type, int pageNo, int pageSize, string filter)
        {
            PageInfo page = new PageInfo(pageSize, pageNo);

            page.KeyName = "StockID";

            string strsql = "";

            strsql = @"SELECT * FROM ViewBaseData_Med T WHERE  (PyCode LIKE '%{0}%' OR PyCodeT LIKE '%{0}%' OR WbCode LIKE '%{0}%' OR WbCodeT LIKE '%{0}%' OR CName LIKE '%{0}%' OR TName LIKE '%{0}%')";
            strsql = string.Format(strsql, filter);
            strsql = SqlPage.FormatSql(strsql, page, delegate(string sql)
            {
                int toltal        = 0;
                SqlDataReader sdr = oleDb.GetSqlDataReader(sql);
                if (sdr.Read())
                {
                    toltal = (int)sdr.GetValue(0);
                }
                sdr.Close();
                return(toltal);
            });
            DataTable dt = oleDb.GetDataTable(strsql);

            List <CardDataSourceDrugItem> list_DrugItem = new List <CardDataSourceDrugItem>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                CardDataSourceDrugItem mDrugItem = new CardDataSourceDrugItem();
                mDrugItem.ItemId         = ConvertDataExtend.ToInt32(dt.Rows[i]["StockID"], 0);
                mDrugItem.ItemName       = dt.Rows[i]["CName"].ToString();
                mDrugItem.ItemName_Print = dt.Rows[i]["TName"].ToString();
                mDrugItem.Standard       = dt.Rows[i]["Spec"].ToString();

                mDrugItem.Scale      = "";                                                      //补偿比例
                mDrugItem.StoreNum   = ConvertDataExtend.ToDecimal(dt.Rows[i]["ActualQty"], 0); //库存量
                mDrugItem.UnPickUnit = dt.Rows[i]["MiniUnit"].ToString();                       //包装单位(销售单位)
                mDrugItem.SellPrice  = ConvertDataExtend.ToDecimal(dt.Rows[i]["ClinPrice"], 0); //销售价格?
                mDrugItem.BuyPrice   = ConvertDataExtend.ToDecimal(dt.Rows[i]["WardPrice"], 0); //进价
                //mDrugItem.ExecDeptName = dt.Rows[i][""].ToString();//执行科室?
                mDrugItem.Pym     = dt.Rows[i]["PyCode"].ToString();
                mDrugItem.Wbm     = dt.Rows[i]["WbCode"].ToString();
                mDrugItem.Address = dt.Rows[i]["FacName"].ToString();//生产厂家
                //mDrugItem.DoseUnitId = dt.Rows[i][""].ToString();//剂量单位
                mDrugItem.DoseUnitName   = dt.Rows[i]["DosUnit"].ToString();
                mDrugItem.DoseConvertNum = ConvertDataExtend.ToDecimal(dt.Rows[i]["Dosage"], 0); //剂量对应包装单位系数
                mDrugItem.ItemType       = ConvertDataExtend.ToInt32(dt.Rows[i]["MatClass"], 0); //项目类型 0-所有 1-西药 2-中药  3-处方可开的物品 4-收费项目
                //mDrugItem.StatItemCode = dt.Rows[i][""].ToString();//大项目代码
                //mDrugItem.UnPickUnitId = dt.Rows[i][""].ToString();//包装单位ID
                mDrugItem.ExecDeptId = ConvertDataExtend.ToInt32(dt.Rows[i]["DeptID"], 0);       //执行科室ID?
                mDrugItem.FloatFlag  = ConvertDataExtend.ToInt32(dt.Rows[i]["RoundingMode"], 0); // dt.Rows[i][""].ToString();//按含量取整1 按剂量取整0
                //mDrugItem.VirulentFlag = dt.Rows[i][""].ToString();//剧毒标识
                //mDrugItem.NarcoticFlag = dt.Rows[i][""].ToString();//麻醉标识
                mDrugItem.SkinTestFlag = ConvertDataExtend.ToInt32(dt.Rows[i]["SkinMethod"], 0);//皮试标识
                //mDrugItem.RecipeFlag = dt.Rows[i][""].ToString();//处方标识
                //mDrugItem.LunacyFlag = dt.Rows[i][""].ToString();//精神药品标识
                //mDrugItem.CostlyFlag = dt.Rows[i][""].ToString();//贵重药品标识
                mDrugItem.default_Usage_Amount   = 0; //默认用量
                mDrugItem.default_Usage_Id       = 0; //默认用法
                mDrugItem.default_Usage_Name     = "";
                mDrugItem.default_Frequency_Id   = 0; //默认频次
                mDrugItem.default_Frequency_Name = "";

                list_DrugItem.Add(mDrugItem);
            }
            return(list_DrugItem);
        }