/// <summary>
        /// 获取门诊处方打印数据
        /// </summary>
        /// <param name="presHeadId">门诊收费处方头ID</param>
        public HIS.Interface.Structs.PrintInfo GetDocPresPrintInfo(long presHeadId)
        {
            #region 查询sql
            string sql = @"select distinct 
                           e.visitno,
                           e.patname, 
                           e.patsex, 
                           e.DiseaseName,
                           e.CureDate,
                           rtrim(char(e.age))||e.hpgrade as patage, 
                           f.name as dept_name, 
                           g.name as doc_name, 
                           c.*,
                           h.ExecNum as Frequency_ExecNum,
                           h.CycleDay as Frequency_CycleDay,
                           h.Caption as Frequency_Caption,
                           i.NAME as Usage_Name,
                           j.printname,
                           j.lunacy_flag,
                           b.pres_date,
                           b.prestype,
                           k.NAME as FeeTypeName,
                           l.PatTEL,
                           l.PatAddress
                           from mz_presmaster a
                           left join mz_doc_preshead b on a.docpresid=b.presheadid
                           left join mz_doc_preslist c on b.presheadid=c.presheadid
                           left join mz_patlist e on b.patlistid=e.patlistid
                           left join base_dept_property f on b.pres_dept=f.dept_id
                           left join base_employee_property g on b.pres_doc=g.employee_id
                           left join BASE_FREQUENCY h on c.FREQUENCY_ID=h.ID
                           left join BASE_USAGEDICTION i on c.USAGE_ID=i.ID
                           left join VI_CLINICAL_ALL_ITEMS j on c.ITEM_ID=j.ITEMID
                           left join BASE_PATIENTTYPE k on e.MEDITYPE=k.code
                           left join PatientInfo l on e.patid=l.patid
                           where a.PRESMASTERID=" + presHeadId + " and c.delete_bit=0 order by presheadid,orderno";

            DataTable presTable = oleDb.GetDataTable(sql);
            if (presTable == null || presTable.Rows.Count <= 0)
            {
                throw new Exception("处方无法打印,请确认:1.该张处方是由医生站开出的处方。2.该张处方已收费");
            }
            #endregion

            HIS.Interface.Structs.PrintInfo printInfo = new HIS.Interface.Structs.PrintInfo();
            Hashtable parameters = new Hashtable();

            List <Prescription> presDetails = new List <Prescription>();
            foreach (DataRow row in presTable.Rows)
            {
                if (row["SelfDrug_Flag"].ToString().Trim() == "0" || row["prestype"].ToString().Trim() == "00")
                {
                    Prescription presDetail = new Prescription();
                    presDetail.BigItemCode = row["StatItem_Code"].ToString();
                    presDetail.Money       = Convert.ToDecimal(row["Item_Price"]) * Convert.ToDecimal(row["Dosage"]) * Convert.ToDecimal(row["Item_Amount"]);
                    presDetails.Add(presDetail);
                }
            }
            decimal drugFee = new PrescMoneyCalculateInterFace().GetPrescriptionTotalMoney(presDetails);

            #region 划分处方类型
            string presType = "普通";
            //按病人就诊时间划分处方类型
            string[]  timestr     = { "" };
            DataTable configTable = oleDb.GetDataTable("select value from mz_doc_config where code='004'");
            if (configTable != null && configTable.Rows.Count > 0)
            {
                timestr = configTable.Rows[0]["value"].ToString().Trim().Split(',');
            }
            DateTime cureDate = Convert.ToDateTime(presTable.Rows[0]["CureDate"]);
            for (int index = 0; index < timestr.Length; index++)
            {
                if (cureDate > DateTime.Parse(cureDate.ToShortDateString() + ' ' + timestr[index].Substring(0, timestr[index].IndexOf('-'))) &&
                    cureDate <= DateTime.Parse(cureDate.ToShortDateString() + ' ' + timestr[index].Substring(timestr[index].IndexOf('-') + 1)))
                {
                    presType = "急诊";
                }
            }

            for (int index = 0; index < presTable.Rows.Count; index++)
            {
                //判断精二类处方
                if (Convert.ToInt32(presTable.Rows[index]["lunacy_flag"]) == 1)
                {
                    presType = "精二";
                }
            }
            #endregion

            if (presTable.Rows[0]["StatItem_Code"].ToString().Trim() == "03")
            {
                #region 处理中药处方
                printInfo.PrintFileName = HIS.SYSTEM.PubicBaseClasses.Constant.ApplicationDirectory + "\\report\\门诊医生中药处方.grf";

                //中药处方需要显示用法和剂数
                parameters.Add("用法", Convert.ToString(presTable.Rows[0]["Usage_Name"]));
                parameters.Add("剂数", Convert.ToString(presTable.Rows[0]["Dosage"]) + "剂");

                printInfo.PrintData = CreateDocHerbPresData(presTable);
                #endregion
            }
            else if (presTable.Rows[0]["StatItem_Code"].ToString().Trim() == "01" || presTable.Rows[0]["StatItem_Code"].ToString().Trim() == "02")
            {
                #region 处理西成药处方
                printInfo.PrintFileName = HIS.SYSTEM.PubicBaseClasses.Constant.ApplicationDirectory + "\\report\\门诊医生西成药处方.grf";

                printInfo.PrintData = CreateDocNoHerbPresData(presTable);
                #endregion
            }
            else
            {
                return(printInfo);
            }

            #region 添加参数
            parameters.Add("医院名称", HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.WorkName);
            parameters.Add("处方类型", presType);
            parameters.Add("开方科室", presTable.Rows[0]["dept_name"].ToString());
            parameters.Add("开方医生", presTable.Rows[0]["doc_name"].ToString());
            parameters.Add("门诊号", presTable.Rows[0]["visitno"].ToString());
            parameters.Add("开方时间", Convert.ToDateTime(presTable.Rows[0]["pres_date"]).ToString("yyyy年MM月dd日") + " " +
                           Convert.ToDateTime(presTable.Rows[0]["pres_date"]).ToString("HH:mm:ss"));
            parameters.Add("病人姓名", presTable.Rows[0]["patname"].ToString());
            parameters.Add("病人年龄", presTable.Rows[0]["patage"].ToString());
            parameters.Add("病人性别", presTable.Rows[0]["patsex"].ToString());
            parameters.Add("病人费别", presTable.Rows[0]["FeeTypeName"].ToString());
            parameters.Add("诊断", presTable.Rows[0]["DiseaseName"].ToString());
            parameters.Add("电话", presTable.Rows[0]["PatTEL"].ToString());
            parameters.Add("联系地址", presTable.Rows[0]["PatAddress"].ToString());
            parameters.Add("处方号", Convert.ToString(presTable.Rows[0]["PresHeadId"]).PadLeft(7, '0'));

            //设置处方金额金额
            parameters.Add("处方金额", drugFee.ToString("0.00") + "元");
            printInfo.PrintParameters = parameters;
            #endregion

            return(printInfo);
        }