示例#1
0
        /// <summary>
        /// 获得病人处方
        /// </summary>
        /// <returns></returns>
        public DataTable GetPrescription(long presDocId)
        {
            int presNo = 0;

            InterFace.PrescMoneyCalculateInterFace PrescMoneyCalculateInterFace = new InterFace.PrescMoneyCalculateInterFace();

            //获取处方头列表信息
            List <Prescription> prescriptions = new List <Prescription>();
            string strsql = HIS.BLL.Tables.mz_doc_preshead.PATLISTID + oleDb.EuqalTo() + this.PatList.PatListID
                            + oleDb.And() + HIS.BLL.Tables.mz_doc_preshead.PRES_FLAG + oleDb.LessThan() + 3
                            + oleDb.And() + HIS.BLL.Tables.mz_doc_preshead.PRES_DOC + oleDb.EuqalTo() + presDocId
                            + oleDb.OrderBy(HIS.BLL.Tables.mz_doc_preshead.PRESHEADID);
            List <HIS.Model.Mz_Doc_PresHead> presHead = BindEntity <HIS.Model.Mz_Doc_PresHead> .CreateInstanceDAL(oleDb).GetListArray(strsql);

            for (int index = 0; index < presHead.Count; index++)
            {
                //获取处方明细信息
                List <PresDetail> presLists = new PresDetail(presHead[index].PresHeadId).GetAllPresDetailList();
                if (presLists.Count > 0)
                {
                    presNo++;
                    List <Prescription> presTemp = new List <Prescription>();
                    for (int i = 0; i < presLists.Count; i++)
                    {
                        Prescription prescription = new Prescription();
                        prescription         = (Prescription)HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjectToObj(presLists[i], prescription);
                        prescription.Dept_Id = presHead[index].Pres_ExeDept;
                        prescription.LoadData();
                        prescription.PresNo    = presNo;
                        prescription.Status    = (HIS.MZDoc_BLL.Public.PresStatus)presHead[index].Pres_Flag;
                        prescription.Pres_Date = presHead[index].Pres_Date;
                        prescriptions.Add(prescription);
                        if (prescription.SelfDrug_Flag == 0 || !prescription.IsDrug)
                        {
                            presTemp.Add(prescription);
                        }
                    }
                    //插入小记
                    Prescription prescription0 = new Prescription();
                    prescription0.PresHeadId = presHead[index].PresHeadId;
                    prescription0.Dept_Id    = presHead[index].Pres_ExeDept;
                    prescription0.Item_Name  = "小计:";
                    prescription0.PresNo     = presNo;
                    prescription0.OrderNo    = presLists.Count + 1;
                    //2009-12-22 统一医生站和收费系统的处方费用合计
                    prescription0.Item_Money = (presTemp.Count <= 0) ? "0.0" : (PrescMoneyCalculateInterFace.GetPrescriptionTotalMoney(presTemp).ToString());//itemMoney.ToString();
                    prescription0.Status     = (HIS.MZDoc_BLL.Public.PresStatus)presHead[index].Pres_Flag;
                    prescriptions.Add(prescription0);
                }
            }
            return(HIS.SYSTEM.PubicBaseClasses.ApiFunction.ObjToDataTable(prescriptions));
        }
示例#2
0
        /// <summary>
        /// 按大项目分类汇总处方费用
        /// </summary>
        /// <param name="rows">处方数据行</param>
        /// <returns></returns>
        public static Hashtable GetPresStatItemFeeTable(DataRow[] rows)
        {
            Hashtable feeTable = new Hashtable();

            if (rows != null && rows.Length > 0)
            {
                List <HIS.MZDoc_BLL.Prescription> presList = (List <HIS.MZDoc_BLL.Prescription>)HIS.MZDoc_BLL.Public.Function.DataRowsToList <HIS.MZDoc_BLL.Prescription>(rows);
                decimal totalFee = 0;
                totalFee = new InterFace.PrescMoneyCalculateInterFace().GetPrescriptionTotalMoney(
                    presList.FindAll(delegate(HIS.MZDoc_BLL.Prescription pres) { return(pres.SelfDrug_Flag == 0 || !pres.IsDrug); })
                    , out feeTable, out totalFee);
            }
            return(feeTable);
        }
        /// <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);
        }