Пример #1
0
        /// <summary>
        /// 挂号预算
        /// </summary>
        /// <returns></returns>
        private bool Budget(RegPatient Patient)
        {
            try
            {
                register              = RegisterObject.RegisterFactory.CreateRegisterObject(Patient.PatType.Code);
                register.OperatorId   = this.operatorId;
                register.OperatorName = this.operatorName;

                Patient.RegFeeInfo = register.Budget(Patient);
                return(true);
            }
            catch (OperatorException operr)
            {
                throw operr;
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err);
                throw new Exception("挂号费用计算发生错误!请重试");
            }
            finally
            {
                register = null;
            }
        }
Пример #2
0
        /// <summary>
        /// 删除处方
        /// </summary>
        /// <param name="PrescriptionId">要删除的处方ID</param>
        /// <returns>被删除的处方数</returns>
        public int DeletePrescription(int PrescriptionId)
        {
            Model.MZ_PresMaster mz_presmaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetModel(PrescriptionId);

            if (mz_presmaster.Charge_Flag == 1)
            {
                throw new OperatorException("该处方已经收费,不能删除!");
            }

            oleDb.BeginTransaction();
            try
            {
                int effectRow = 0;
                List <HIS.Model.MZ_PresOrder> detail = BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).GetListArray("PRESMASTERID=" + PrescriptionId);

                for (int i = 0; i < detail.Count; i++)
                {
                    BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).Delete(((HIS.Model.MZ_PresOrder)detail[i]).PresOrderID);

                    effectRow++;
                }
                BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Delete(PrescriptionId);

                effectRow++;
                oleDb.CommitTransaction();
                return(effectRow);
            }
            catch (Exception err)
            {
                oleDb.RollbackTransaction();
                ErrorWriter.WriteLog(err.Message);
                return(0);
            }
        }
Пример #3
0
        /// <summary>
        /// 删除发票卷
        /// </summary>
        /// <param name="VolumnID">发票卷号</param>
        /// <remarks>
        /// 对于在用的,已用的,停用的但之前有使用过的不能删除
        /// 备用的,停用的但还未使用的可以删除
        /// </remarks>
        /// <returns></returns>
        public static bool DeleteInvoiceVolumn(int VolumnID)
        {
            Model.MZ_INVOICE invoice = BindEntity <Model.MZ_INVOICE> .CreateInstanceDAL(oleDb).GetModel(VolumnID);

            if (invoice != null)
            {
                if (invoice.STATUS == 0)
                {
                    throw new OperatorException("该卷发票正在使用中,不能删除");
                }
                if (invoice.STATUS == 1)
                {
                    throw new OperatorException("该卷发票已经有使用记录,不能删除");
                }
                if (invoice.STATUS == 3 && invoice.START_NO != invoice.CURRENT_NO)
                {
                    throw new OperatorException("该卷发票已停用,但有部分票据已经使用过,不能删除!\r\n如果要使用未用的票据号,请将这段票据号重新分配");
                }
            }
            try
            {
                BindEntity <Model.MZ_INVOICE> .CreateInstanceDAL(oleDb).Delete(VolumnID);

                return(true);
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err);
                throw new Exception("删除票卷发生错误!");
            }
        }
Пример #4
0
        /// <summary>
        /// 删除处方明细
        /// </summary>
        /// <param name="PrescriptionDetailId">要删除的明细ID</param>
        /// <returns>被删除的处方明细数</returns>
        public int DeletePrescriptionDetail(int PrescriptionDetailId)
        {
            //HIS.DAL.MZ_PresOrder d_mz_presorder = new HIS.DAL.MZ_PresOrder( );
            //d_mz_presorder._oleDB = this.oleDb;
            HIS.Model.MZ_PresOrder mz_presorder = BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).GetModel(PrescriptionDetailId);

            HIS.Model.MZ_PresMaster mz_presmaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetModel(mz_presorder.PresMasterID);

            if (mz_presmaster.Charge_Flag == 1)
            {
                throw new OperatorException("该处方已经收费,不能删除!");
            }

            oleDb.BeginTransaction();
            try
            {
                int effectRow = 0;
                HIS.Model.MZ_PresOrder detail = BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).GetModel(PrescriptionDetailId);

                BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).Delete(detail.PresOrderID);

                effectRow++;
                oleDb.CommitTransaction();
                return(effectRow);
            }
            catch (Exception err)
            {
                oleDb.RollbackTransaction();
                ErrorWriter.WriteLog(err.Message);
                return(0);
            }
        }
Пример #5
0
        /// <summary>
        ///  登记本次就诊
        /// </summary>
        /// <returns>本次就诊号</returns>
        public int NewRegister()
        {
            oleDb.BeginTransaction();
            try
            {
                HIS.Model.PatientInfo patinfo = new HIS.Model.PatientInfo();
                BindEntity <Model.PatientInfo> .CreateInstanceDAL(oleDb).Add(patinfo);


                HIS.Model.MZ_PatList register = new HIS.Model.MZ_PatList( );
                register.CureDate     = Convert.ToDateTime(HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime.ToString("yyyy-MM-dd")); //就诊日期
                register.CureDeptCode = "";                                                                                           //就诊科室
                register.CureEmpCode  = "";                                                                                           //就诊医生
                register.DiseaseCode  = "";                                                                                           //疾病代码
                register.DiseaseName  = "";                                                                                           //疾病名称
                register.HpCode       = "";                                                                                           //就医机构代码
                register.HpGrade      = "";                                                                                           //就医机构级别
                register.MediCard     = "";                                                                                           //医疗证卡号
                register.MediType     = "";                                                                                           //就诊类型
                register.PatCode      = "";                                                                                           //病人代码
                register.PatID        = patinfo.PatID;
                register.PatListID    = 0;                                                                                            //本次就诊号
                register.PatName      = "";                                                                                           //病人姓名
                register.PatSex       = "";                                                                                           //性别
                register.PYM          = "";                                                                                           //拼音码
                register.WBM          = "";                                                                                           //五笔码
                register.Age          = 0;
                register.VisitNo      = (new RegController( )).CreateVisitNo( );

                int newRegisterno = 0;
                newRegisterno = BindEntity <Model.MZ_PatList> .CreateInstanceDAL(oleDb).Add(register);

                if (newRegisterno > 0)
                {
                    this.PatID     = patinfo.PatID;
                    this.PatListID = newRegisterno;
                    this.VisitNo   = register.VisitNo;
                    oleDb.CommitTransaction( );
                    return(this.PatListID); //返回就诊ID
                }
                else
                {
                    throw new OperatorException("创建病人登记信息失败!");
                }
            }
            catch (OperatorException operr)
            {
                oleDb.RollbackTransaction( );
                throw operr;
            }
            catch (Exception err)
            {
                oleDb.RollbackTransaction( );
                ErrorWriter.WriteLog(err.Message);
                throw new Exception("新登记病人信息发生错误!");
            }
        }
Пример #6
0
        /// <summary>
        /// 交款
        /// </summary>
        /// <param name="userId">操作员ID(EmployeeId)</param>
        public static bool HandInAccount(int userId, PrivyAccountBook accountBook)
        {
            string strblankoutInvoices = "";

            foreach (string invoiceNum in accountBook.ChargeInvoiceInfo.Useless)
            {
                strblankoutInvoices = strblankoutInvoices + invoiceNum + "|";
            }
            if (strblankoutInvoices.Trim( ) != "")
            {
                strblankoutInvoices = strblankoutInvoices.Remove(strblankoutInvoices.Length - 1, 1);
            }

            oleDb.BeginTransaction( );

            try
            {
                HIS.Model.MZ_Account new_mz_account = new HIS.Model.MZ_Account( );
                new_mz_account.AccountCode = userId.ToString( );
                new_mz_account.AccountDate = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                new_mz_account.Total_Fee   = accountBook.InvoiceItemSumTotal;
                new_mz_account.Cash_Fee    = 0;
                new_mz_account.POS_Fee     = 0;
                new_mz_account.BlankOut    = strblankoutInvoices;
                //新增账单
                HIS.SYSTEM.Core.BindEntity <HIS.Model.MZ_Account> .CreateInstanceDAL(oleDb).Add(new_mz_account);

                //当前对象ID赋值
                int accountBookId = new_mz_account.AccountID;
                //更新结算表,置账单号
                List <HIS.Model.MZ_CostMaster> list_costmaster = HIS.SYSTEM.Core.BindEntity <HIS.Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).GetListArray(" RECORD_FLAG<>9 and ACCOUNTID=0 and  CHARGECODE='" + userId + "'");

                if (list_costmaster.Count == 0)
                {
                    throw new OperatorException("没有科目可以交账!");
                }
                for (int i = 0; i < list_costmaster.Count; i++)
                {
                    list_costmaster[i].AccountID = accountBookId;
                    HIS.SYSTEM.Core.BindEntity <HIS.Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Update(list_costmaster[i]);
                }
                oleDb.CommitTransaction( );
                return(true);
            }
            catch (OperatorException operr)
            {
                oleDb.RollbackTransaction( );
                throw operr;
            }
            catch (Exception err)
            {
                oleDb.RollbackTransaction( );
                ErrorWriter.WriteLog(err.Message);
                throw new Exception("交款处理发生错误!");
            }
        }
Пример #7
0
        /// <summary>
        /// 预算
        /// </summary>
        /// <param name="prescriptions">处方对象</param>
        /// <returns>预结算信息</returns>
        public override ChargeInfo[] Budget(Prescription[] prescriptions)
        {
            ////////////////////////////////////////////////////////////////////////////////
            //处理过程
            //先由医院做预算,完成后用 病人就诊序号+处方头ID+结算头ID组合作为农合的mzId,
            //因为农合要求mzId不能重复,所以医院结算必须放在前以此产生结算头ID
            /////////////////////////////////////////////////////////////////////////////////

            //提交医院结算
            ChargeInfo[] hisChargeInfos = base.Budget(prescriptions);

            InsurChargeInfo insurChargeInfo = new InsurChargeInfo();

            //构造农合接口对象
            HIS.MZ_BLL.InsurInterface.IInsureCharge insureCharge = HIS.MZ_BLL.InsurInterface.InsurInterfaceFactory.CreateInsurInstance(InsurType.新农合);
            //将包含农合信息的病人对象传给接口
            insureCharge.HisPatientInfo = Patient;
            //预算。
            insurChargeInfo = insureCharge.PreviewCharge(prescriptions);
            //合计补偿金额
            for (int i = 0; i < hisChargeInfos.Length; i++)
            {
                if (hisChargeInfos[i].ChargeID == prescriptions[i].ChargeID)
                {
                    hisChargeInfos[i].VillageFee += prescriptions[i].RedeemCost;
                }
            }
            oleDb.BeginTransaction();
            try
            {
                //回写数据库字段
                for (int i = 0; i < prescriptions.Length; i++)
                {
                    Model.MZ_PresMaster presMaster = HIS.SYSTEM.Core.BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetModel(prescriptions[i].PrescriptionID);

                    presMaster.RedeemCost = prescriptions[i].RedeemCost;
                    HIS.SYSTEM.Core.BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(presMaster);   //更新处方头的补偿金额
                }
                oleDb.CommitTransaction( );
            }
            catch (OperatorException operr)
            {
                oleDb.RollbackTransaction( );
                throw operr;
            }
            catch (Exception err)
            {
                oleDb.RollbackTransaction( );
                ErrorWriter.WriteLog(err.Message);
                throw new Exception("农合收费预算发生错误!");
            }
            return(hisChargeInfos);
        }
Пример #8
0
        /// <summary>
        /// 复制处方到指定的病人
        /// </summary>
        /// <param name="PrescriptionId">目标处方ID</param>
        /// <param name="patient">目标病人</param>
        /// <returns></returns>
        public bool CopyPrescription(int PrescriptionId, BasePatient patient)
        {
            MZ_PresMaster mz_presmaster = BindEntity <MZ_PresMaster> .CreateInstanceDAL(oleDb).GetModel(PrescriptionId);

            if (mz_presmaster == null)
            {
                throw new Exception("没有找到处方,请确认处方是否存在!");
            }
            List <MZ_PresOrder> lstPresOrder = BindEntity <MZ_PresOrder> .CreateInstanceDAL(oleDb).GetListArray(Tables.mz_presorder.PRESMASTERID + oleDb.EuqalTo( ) + PrescriptionId);

            if (lstPresOrder.Count == 0)
            {
                throw new Exception("该处方没有明细,不能复制!");
            }

            try
            {
                mz_presmaster.Charge_Flag  = 0;
                mz_presmaster.ChargeCode   = "";
                mz_presmaster.CostMasterID = 0;
                mz_presmaster.Drug_Flag    = 0;
                mz_presmaster.OldID        = 0;
                mz_presmaster.PresDate     = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                mz_presmaster.Record_Flag  = 0;
                mz_presmaster.TicketCode   = "";
                mz_presmaster.TicketNum    = "";
                if (patient != null)
                {
                    mz_presmaster.PatID     = patient.PatID;
                    mz_presmaster.PatListID = patient.PatListID;
                }

                oleDb.BeginTransaction( );
                BindEntity <MZ_PresMaster> .CreateInstanceDAL(oleDb).Add(mz_presmaster);

                foreach (MZ_PresOrder order in lstPresOrder)
                {
                    order.PresMasterID = mz_presmaster.PresMasterID;
                    BindEntity <MZ_PresOrder> .CreateInstanceDAL(oleDb).Add(order);
                }
                oleDb.CommitTransaction( );
                return(true);
            }
            catch (Exception err)
            {
                oleDb.RollbackTransaction( );
                ErrorWriter.WriteLog(err.Message + "\r\n" + err.StackTrace);
                throw new Exception("复制处方发生错误!详情请参考log日志!");
            }
        }
Пример #9
0
        /// <summary>
        /// 保存挂号病人基本信息
        /// </summary>
        /// <param name="Patient"></param>
        /// <returns></returns>
        public bool SaveRegPatient(RegPatient Patient)
        {
            HIS.Model.PatientInfo mz_patient = null;
            try
            {
                mz_patient = BindEntity <Model.PatientInfo> .CreateInstanceDAL(oleDb).GetModel("PatID=" + Patient.PatID.ToString( ));

                if (mz_patient == null)
                {
                    (new CardController( )).AddNewPatient(Patient);
                }
                else
                {
                    (new CardController( )).UpdatePatient(Patient);
                }
                //mz_patient.ADDRESS = Patient.Address;
                //mz_patient.BORNDAY = Patient.BornDate;
                //mz_patient.CARDNO = Patient.HisCardNo;
                //mz_patient.FOLK = Patient.Folk;
                //mz_patient.IDCARD = Patient.IDCard;
                //mz_patient.OCCUPATION = Patient.Occupation;
                //mz_patient.PATNAME = Patient.PatientName;
                //mz_patient.SEX = Patient.Sex;
                //mz_patient.TEL = Patient.Tel;
                //mz_patient.TYPE = Convert.ToInt32( Patient.PatType.Code );
                //mz_patient.TYPE_NAME = Patient.PatType.Name;
                //if ( !Patient.ValidCardNo )
                //{
                //    BindEntity<Model.MZ_PATIENT>.CreateInstanceDAL( oleDb ).Add( mz_patient );
                //    Patient.PatID = mz_patient.PATID;
                //}
                //else
                //{
                //    BindEntity<Model.MZ_PATIENT>.CreateInstanceDAL( oleDb ).Update( mz_patient );
                //}
                return(true);
            }
            catch (OperatorException operr)
            {
                throw operr;
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                throw new Exception("保存病人基本信息失败!");
            }
        }
Пример #10
0
        /// <summary>
        /// 更新退药标识
        /// </summary>
        /// <param name="presMasterID">处方头ID</param>
        /// <returns></returns>
        public static bool UpdateBackDrugFlag(int presMasterID)
        {
            try
            {
                Model.MZ_PresMaster presMaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetModel(presMasterID);

                presMaster.Drug_Flag = 0;
                BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(presMaster);

                return(true);
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                return(false);
            }
        }
Пример #11
0
 /// <summary>
 /// 预算
 /// </summary>
 /// <param name="prescriptions">要预算的处方</param>
 /// <returns>预算信息,供正式结算用</returns>
 public override ChargeInfo[] Budget(Prescription[] prescriptions)
 {
     ChargeInfo[] chargeInfos = new ChargeInfo[prescriptions.Length];
     try
     {
         oleDb.BeginTransaction( );
         chargeInfos = _budget(prescriptions);
         oleDb.CommitTransaction( );
     }
     catch (Exception err)
     {
         oleDb.RollbackTransaction( );
         ErrorWriter.WriteLog(err);
         throw new Exception("预结算发生错误!");
     }
     return(chargeInfos);
 }
Пример #12
0
        /// <summary>
        /// 得到发票信息
        /// </summary>
        /// <param name="PerfChar"></param>
        /// <param name="StartNo"></param>
        /// <param name="EndNo"></param>
        /// <param name="TotalMoney"></param>
        /// <param name="Count"></param>
        /// <param name="RefundMoney"></param>
        /// <param name="RefundCount"></param>
        public static void GetInvoiceListInfo(string PerfChar, string StartNo, string EndNo,
                                              out decimal TotalMoney, out int Count,
                                              out decimal RefundMoney, out int RefundCount)
        {
            TotalMoney  = 0;
            Count       = 0;
            RefundMoney = 0;
            RefundCount = 0;
            try
            {
                string    sql     = @"select ticketnum,record_flag,total_fee ,ticketcode
                            from
                            (
                                select ticketnum,ticketcode,record_flag,total_fee from mz_costmaster where record_flag in (0,1,2) and workid=" + HIS.SYSTEM.Core.EntityConfig.WorkID + @"
                            ) a
                            where cast(ticketnum as bigint) between " + StartNo + " and " + EndNo + " and ticketcode='" + PerfChar + "'";
                DataTable tb      = oleDb.GetDataTable(sql);
                string    fileter = "record_flag in (0,1)";
                object    objSum  = tb.Compute("Sum(Total_fee)", fileter);
                TotalMoney = 0;
                if (!Convert.IsDBNull(objSum))
                {
                    TotalMoney = Convert.ToDecimal(objSum);
                }
                Count = tb.Select(fileter).Length;

                fileter     = "record_flag in (1)";
                objSum      = tb.Compute("Sum(Total_fee)", fileter);
                RefundMoney = 0;
                if (!Convert.IsDBNull(objSum))
                {
                    RefundMoney = Convert.ToDecimal(objSum);
                }
                RefundCount = tb.Select(fileter).Length;
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                throw new Exception("发生未知错误");
            }
        }
Пример #13
0
        /// <summary>
        /// 退费
        /// </summary>
        /// <param name="invoice">要退费的发票对象</param>
        /// <returns></returns>
        public override bool Refundment(Invoice invoice, Prescription[] ReblancePrescriptions, List <int> ReturnedDocPresIdList)
        {
            //根据发票获得原始收费处方
            Prescription[] prescription = Patient.GetPrescriptionByInvoiceSerialNo(invoice.InvoiceNo);

            MZ_BLL.InsurInterface.IInsureCharge insurCharge = InsurInterface.InsurInterfaceFactory.CreateInsurInstance(InsurType.新农合);
            //设置农合结算对象的病人信息
            insurCharge.HisPatientInfo = Patient;
            //原始处方
            Prescription orgPrescription = invoice.Prescription[0];
            //先处理医院退费操作,因为农合需要医院端的退费冲正信息
            bool bOk = false;

            try
            {
                bOk = base.Refundment(invoice, null, null);
            }
            catch (OperatorException operr)
            {
                throw operr;
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                throw new Exception("医院退费发生错误!");
            }

            if (!bOk)
            {
                return(false);
            }



            //冲正处方
            Prescription disChargePrescription = GetDisChargePrescription(invoice.Prescription[0].PrescriptionID);

            insurCharge.CancelCharge(orgPrescription, disChargePrescription);

            return(false);
        }
Пример #14
0
 /// <summary>
 /// 正式结算
 /// </summary>
 /// <param name="BudgetaryChargeInfos">预算信息</param>
 /// <param name="prescriptions">要结算的处方,该处方对象经过预算方法处理</param>
 /// <returns>true:结算成功,false:结算失败</returns>
 public override bool Charge(ChargeInfo[] BudgetaryChargeInfos, Prescription[] prescriptions, out BaseInvoice[] ChargeInvoicies)
 {
     oleDb.BeginTransaction();
     try
     {
         _charge(BudgetaryChargeInfos, prescriptions, out ChargeInvoicies);
         oleDb.CommitTransaction( );
         return(true);
     }
     catch (OperatorException operr)
     {
         oleDb.RollbackTransaction( );
         throw operr;
     }
     catch (Exception err)
     {
         oleDb.RollbackTransaction( );
         ErrorWriter.WriteLog(err);
         throw new Exception("正式结算发生错误,请重新点收银按钮!");
     }
 }
Пример #15
0
        /// <summary>
        /// 退号
        /// </summary>
        /// <param name="RegInvoiceNo"></param>
        /// <returns></returns>
        public bool CancelRegister(string RegInvoiceNo, string PerfChar)
        {
            try
            {
                RegPatient Patient = GetPatientInfoByInvoiceNo(PerfChar, RegInvoiceNo);
                if (Patient == null)
                {
                    throw new OperatorException("没有找到挂号病人信息!\r\n1、请确认挂号收据号是否正确。\r\n2、如果发票有前缀字符,请确认是否输入前缀字符。\r\n3、确认该号是否已经退号");
                }
                OutPatient     patient = new OutPatient(Patient.PatListID);
                Prescription[] pres    = patient.GetPrescriptions(PresStatus.全部, true);
                if (pres.Length > 0)
                {
                    throw new OperatorException("该病人已经有就诊记录,不能退号");
                }


                register              = RegisterObject.RegisterFactory.CreateRegisterObject(Patient.PatType.Code);
                register.OperatorId   = this.operatorId;
                register.OperatorName = this.operatorName;
                try
                {
                    return(register.CancelRegister(RegInvoiceNo, PerfChar));
                }
                catch (OperatorException operr)
                {
                    throw operr;
                }
                catch (Exception e1)
                {
                    ErrorWriter.WriteLog(e1.Message);
                    throw new Exception("退号操作不成功!请重试");
                }
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Пример #16
0
 /// <summary>
 /// 预算处理过程
 /// </summary>
 /// <param name="Patient"></param>
 /// <returns></returns>
 public bool BudgetProcess(RegPatient Patient)
 {
     oleDb.BeginTransaction();
     try
     {
         //费用预算
         bool ret = Budget(Patient);
         oleDb.CommitTransaction( );
         return(true);
     }
     catch (OperatorException operr)
     {
         oleDb.RollbackTransaction( );
         throw operr;
     }
     catch (Exception err)
     {
         oleDb.RollbackTransaction( );
         ErrorWriter.WriteLog(err.Message);
         throw new Exception("挂号费用计算发生错误!请重试");
     }
 }
Пример #17
0
 /// <summary>
 /// 正式挂号过程
 /// </summary>
 /// <param name="Patient"></param>
 /// <returns></returns>
 public bool RegisterPrecess(RegPatient Patient)
 {
     oleDb.BeginTransaction();
     try
     {
         Patient.VisitNo = CreateVisitNo( );   //正式挂号前创建一个门诊号
         bool ret = Register(Patient);
         oleDb.CommitTransaction( );
         return(ret);
     }
     catch (OperatorException operr)
     {
         oleDb.RollbackTransaction( );
         throw operr;
     }
     catch (Exception err)
     {
         oleDb.RollbackTransaction( );
         ErrorWriter.WriteLog(err.Message);
         throw new Exception("挂号登记发生错误!");
     }
 }
Пример #18
0
        /// <summary>
        /// 退费
        /// </summary>
        /// <param name="invoice">要退费的发票对象</param>
        /// <returns></returns>
        public override bool Refundment(Invoice invoice, Prescription[] ReblancePrescriptions, List <int> ReturnedDocPresIdList)
        {
            try
            {
                oleDb.BeginTransaction( );

                _refundment(invoice, ReblancePrescriptions);
                MZClinicInterface clinicInterface = new MZClinicInterface();
                for (int i = 0; i < ReturnedDocPresIdList.Count; i++)
                {
                    clinicInterface.ChangePresStatus(ReturnedDocPresIdList[i], 2);
                    //HIS.MZDoc_BLL.OP_Prescription.ChangePresStatus( ReturnedDocPresIdList[i], 2 );
                }

                oleDb.CommitTransaction( );
                return(true);
            }
            catch (Exception err)
            {
                oleDb.RollbackTransaction( );
                ErrorWriter.WriteLog(err.Message);
                throw err;
            }
        }
Пример #19
0
        /// <summary>
        /// 正式结算
        /// </summary>
        /// <param name="BudgetaryChargeInfos">预算信息</param>
        /// <param name="prescriptions">要结算的处方,该处方对象经过预算方法处理</param>
        /// <returns>true:结算成功,false:结算失败</returns>
        public override bool Charge(ChargeInfo[] BudgetaryChargeInfos, Prescription[] prescriptions, out BaseInvoice[] ChargeInvoicies)
        {
            MZClinicInterface clinicInterface = new MZClinicInterface();

            oleDb.BeginTransaction();

            try
            {
                for (int presindex = 0; presindex < prescriptions.Length; presindex++)
                {
                    if (prescriptions[presindex].DocPresId > 0)
                    {
                        decimal mzdocfee = clinicInterface.GetDocPresMoney(prescriptions[presindex].DocPresId);
                        if (mzdocfee != prescriptions[presindex].Total_Fee)
                        {
                            throw new Exception("门诊医生站已对该收费处方进行修改,请重新刷新处方再点收银!");
                        }
                    }
                }
                for (int chargeCount = 0; chargeCount < BudgetaryChargeInfos.Length; chargeCount++)
                {
                    if (BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Exists(BudgetaryChargeInfos[chargeCount].ChargeID))
                    {
                        HIS.Model.MZ_CostMaster chargeBill = new HIS.Model.MZ_CostMaster();
                        chargeBill = BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).GetModel(BudgetaryChargeInfos[chargeCount].ChargeID);

                        chargeBill.Self_Fee    = BudgetaryChargeInfos[chargeCount].SelfFee;
                        chargeBill.Village_Fee = BudgetaryChargeInfos[chargeCount].VillageFee;
                        chargeBill.Favor_Fee   = BudgetaryChargeInfos[chargeCount].FavorFee;
                        chargeBill.Pos_Fee     = BudgetaryChargeInfos[chargeCount].PosFee;
                        chargeBill.Money_Fee   = BudgetaryChargeInfos[chargeCount].CashFee;
                        chargeBill.Self_Tally  = BudgetaryChargeInfos[chargeCount].SelfTally;
                        chargeBill.Ticket_Flag = 0;
                        chargeBill.CostDate    = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                        chargeBill.Record_Flag = 0;
                        string perfCode = "";
                        chargeBill.TicketNum  = InvoiceManager.GetBillNumber(OPDBillKind.门诊收费发票, OperatorId, false, out perfCode);
                        chargeBill.TicketCode = perfCode;    //前缀 BudgetaryChargeInfos[chargeCount].InvoiceNO;

                        BudgetaryChargeInfos[chargeCount].InvoiceSerialNO = Convert.ToInt32(chargeBill.TicketNum);
                        BudgetaryChargeInfos[chargeCount].InvoiceNO       = chargeBill.TicketNum;
                        BudgetaryChargeInfos[chargeCount].PerfChar        = perfCode;
                        BudgetaryChargeInfos[chargeCount].ChargeDate      = chargeBill.CostDate;

                        BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Update(chargeBill);  //更新结算表


                        //更新处方表收费标识
                        List <Model.MZ_PresMaster> lstPresMaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetListArray(HIS.BLL.Tables.mz_presmaster.COSTMASTERID + oleDb.EuqalTo() + BudgetaryChargeInfos[chargeCount].ChargeID);

                        if (lstPresMaster.Count == 0)
                        {
                            throw new OperatorException("没有找到要结算的处方,请确认是否已被人收费");
                        }
                        foreach (Model.MZ_PresMaster mz_presmaster in lstPresMaster)
                        {
                            if (mz_presmaster.Charge_Flag == 0)
                            {
                                mz_presmaster.Charge_Flag = 1;
                                mz_presmaster.TicketCode  = perfCode;   //前缀     BudgetaryChargeInfos[chargeCount].InvoiceNO;
                                mz_presmaster.TicketNum   = chargeBill.TicketNum;
                                mz_presmaster.ChargeCode  = OperatorId.ToString();
                                BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(mz_presmaster);
                            }
                            else
                            {
                                throw new OperatorException("该处方已被其他收费员收费!");
                            }
                        }
                    }
                    else
                    {
                        throw new OperatorException("没有找到结算号的记录!");
                    }
                }

                for (int i = 0; i < prescriptions.Length; i++)
                {
                    clinicInterface.ChangePresStatus(prescriptions[i].DocPresId, 1);
                }

                oleDb.CommitTransaction( );
            }
            catch (OperatorException operr)
            {
                oleDb.RollbackTransaction( );
                throw operr;
            }
            catch (Exception err)
            {
                oleDb.RollbackTransaction( );
                ErrorWriter.WriteLog(err.Message);
                throw new Exception("正式结算发生错误!");
            }
            //发票对象
            try
            {
                ChargeInvoicies = new Invoice[BudgetaryChargeInfos.Length];
                for (int i = 0; i < BudgetaryChargeInfos.Length; i++)
                {
                    ChargeInvoicies[i] = new Invoice(BudgetaryChargeInfos[i].PerfChar, BudgetaryChargeInfos[i].InvoiceNO, OPDBillKind.门诊收费发票);
                }
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                throw new OperatorException("收费成功,但生成发票对象失败!");
            }
            return(true);
        }
Пример #20
0
        /// <summary>
        /// 预算
        /// </summary>
        /// <param name="prescriptions">要预算的处方</param>
        /// <returns>预算信息,供正式结算用</returns>
        public override ChargeInfo[] Budget(Prescription[] prescriptions)
        {
            //单张处方明细转化为大项目明细合并后累加在取舍。
            //保存每张处方的大项目明细
            List <List <Item> > lstStatItems = new List <List <Item> >( );
            //本次结算总金额(等于每张处方舍入后的金额的合计)
            decimal chargeTotalCost = 0;

            #region 合并大类并计算舍入金额
            try
            {
                for (int i = 0; i < prescriptions.Length; i++)
                {
                    List <Item> lstTemp = new List <Item>( );
                    lstTemp         = MergePrescriptionByStatItemCode(ref prescriptions[i]);
                    chargeTotalCost = chargeTotalCost + prescriptions[i].Total_Fee;
                    lstStatItems.Add(lstTemp);
                }
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message + "\r\n" + err.StackTrace);
                throw new OperatorException("合并项目发生错误!");
            }
            #endregion
            //保存合并后的所有大项目明细,类型MZ_CostOrder
            Hashtable htCostOrder = new Hashtable();
            #region 合并所有结算明细(不需要再舍入)
            try
            {
                foreach (List <Item> lstTemp in lstStatItems)
                {
                    foreach (object obj in lstTemp)
                    {
                        if (htCostOrder.ContainsKey(((Item)obj).Text.Trim( )))
                        {
                            Item item = (Item)obj;
                            Model.MZ_CostOrder mz_costorder = (Model.MZ_CostOrder)htCostOrder[item.Text.Trim( )];
                            mz_costorder.Total_Fee = mz_costorder.Total_Fee + Convert.ToDecimal(item.Value);
                        }
                        else
                        {
                            Model.MZ_CostOrder mz_costorder = new HIS.Model.MZ_CostOrder( );
                            mz_costorder.ItemType  = ((Item)obj).Text.Trim( );
                            mz_costorder.Total_Fee = Convert.ToDecimal(((Item)obj).Value);
                            htCostOrder.Add(mz_costorder.ItemType, mz_costorder);
                        }
                    }
                }
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                throw new OperatorException("合并明细大类发生错误!");
            }
            #endregion
            int costmasterid = 0; //本次结算ID
            #region 数据库操作,得到结算号
            try
            {
                oleDb.BeginTransaction( );

                #region 赋值结算头表并保存
                HIS.Model.MZ_CostMaster mz_costmaster = new HIS.Model.MZ_CostMaster( );
                mz_costmaster.PatID        = Patient.PatID;
                mz_costmaster.PatListID    = Patient.PatListID;
                mz_costmaster.PresMasterID = 0;
                mz_costmaster.TicketNum    = "";
                mz_costmaster.TicketCode   = "";
                mz_costmaster.ChargeCode   = OperatorId.ToString( );
                //mz_costmaster.ChargeName = PublicDataReader.GetEmployeeNameById( OperatorId );
                mz_costmaster.ChargeName   = BaseDataController.GetName(BaseDataCatalog.人员列表, OperatorId);
                mz_costmaster.Total_Fee    = chargeTotalCost;//结算表的总金额
                mz_costmaster.Self_Fee     = 0;
                mz_costmaster.Village_Fee  = 0;
                mz_costmaster.Favor_Fee    = 0;
                mz_costmaster.Pos_Fee      = 0;
                mz_costmaster.Money_Fee    = 0;
                mz_costmaster.Ticket_Flag  = 0;
                mz_costmaster.Record_Flag  = 9;//预结算记录状态置为9
                mz_costmaster.OldID        = 0;
                mz_costmaster.AccountID    = 0;
                mz_costmaster.Hang_Flag    = (int)OPDOperationType.门诊收费;
                mz_costmaster.Hurried_Flag = Patient.IsEmergency ? 1 : 0;
                mz_costmaster.CostMasterID = BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Add(mz_costmaster);

                #endregion
                costmasterid = mz_costmaster.CostMasterID;
                #region 更新处方表的结算号和总金额,舍入金额
                for (int prescCount = 0; prescCount < prescriptions.Length; prescCount++)
                {
                    string strWhere = Tables.mz_presmaster.PRESMASTERID + oleDb.EuqalTo( ) + prescriptions[prescCount].PrescriptionID;
                    Model.MZ_PresMaster mz_presmaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetModel(strWhere);

                    if (mz_presmaster.Charge_Flag == 1)
                    {
                        throw new OperatorException("处方已被别的收费员收费,请确认!");
                    }
                    if (prescriptions[prescCount].DocPresId != 0)
                    {
                        if (HIS.Interface.InstanceFactory.CreatMZ_ClinicDataInstance().CheckPresStatus(prescriptions[prescCount].DocPresId) == false)
                        {
                            throw new OperatorException("处方已经收费,请重新刷新病人信息以获取最新未收费处方!\r\n(建议不要同时打开多个收费界面)");
                        }
                    }
                    //更新处方表的结算号和总金额,舍入金额
                    BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(strWhere,
                                                                                      Tables.mz_presmaster.COSTMASTERID + oleDb.EuqalTo( ) + mz_costmaster.CostMasterID,
                                                                                      Tables.mz_presmaster.TOTAL_FEE + oleDb.EuqalTo( ) + prescriptions[prescCount].Total_Fee,
                                                                                      Tables.mz_presmaster.ROUNGINGMONEY + oleDb.EuqalTo( ) + prescriptions[prescCount].RoundingMoney);
                }
                #endregion

                #region 保存结算明细到数据库(按大项目保存)
                foreach (object obj in htCostOrder)
                {
                    HIS.Model.MZ_CostOrder mz_costorder = (HIS.Model.MZ_CostOrder)((System.Collections.DictionaryEntry)obj).Value;
                    mz_costorder.CostID = mz_costmaster.CostMasterID;
                    //保存到数据库
                    mz_costorder.CostOrderID = BindEntity <Model.MZ_CostOrder> .CreateInstanceDAL(oleDb).Add(mz_costorder);
                }
                #endregion

                oleDb.CommitTransaction( );
            }
            catch (OperatorException oe)
            {
                oleDb.RollbackTransaction( );
                throw oe;
            }
            catch (Exception err)
            {
                oleDb.RollbackTransaction( );
                ErrorWriter.WriteLog(err.Message + "\r\n" + err.StackTrace);
                throw new OperatorException("保存预算结果到数据库发生错误!");
            }
            #endregion
            //回填处方的结算号
            for (int prescCount = 0; prescCount < prescriptions.Length; prescCount++)
            {
                prescriptions[prescCount].ChargeID = costmasterid;
            }

            #region 返回预算结果
            try
            {
                Hashtable htInvoiceItem = new Hashtable( );
                foreach (object obj in htCostOrder)
                {
                    HIS.Model.MZ_CostOrder mz_costorder = (HIS.Model.MZ_CostOrder)((System.Collections.DictionaryEntry)obj).Value;
                    InvoiceItem            invoice      = GetInvoiceByStatCode(mz_costorder.ItemType.Trim( ));
                    invoice.Cost = mz_costorder.Total_Fee;
                    if (htInvoiceItem.ContainsKey(invoice.ItemCode.Trim( )))
                    {
                        InvoiceItem _invoice = (InvoiceItem)htInvoiceItem[invoice.ItemCode];
                        _invoice.Cost = _invoice.Cost + invoice.Cost;
                        htInvoiceItem.Remove(invoice.ItemCode);
                        htInvoiceItem.Add(_invoice.ItemCode, _invoice);
                    }
                    else
                    {
                        htInvoiceItem.Add(invoice.ItemCode, invoice);
                    }
                }
                List <InvoiceItem> chargeItems = new List <InvoiceItem>( );
                foreach (object item in htInvoiceItem)
                {
                    chargeItems.Add((InvoiceItem)((DictionaryEntry)item).Value);
                }

                ChargeInfo chargeInfos = new ChargeInfo( );
                chargeInfos.Items    = chargeItems.ToArray( );
                chargeInfos.ChargeID = costmasterid;
                chargeInfos.TotalFee = chargeTotalCost;

                ChargeInfo[] chargeInfo = new ChargeInfo[1];
                chargeInfo[0].TotalFee = chargeTotalCost;
                chargeInfo[0]          = chargeInfos;
                //计算本次的优惠金额
                chargeInfo[0].FavorFee = GetFavorCost(Patient.MediType, chargeInfo[0], prescriptions);
                return(chargeInfo);
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err);
                throw new OperatorException("返回预算结果发生错误!");
            }
            #endregion
        }
Пример #21
0
        /// <summary>
        /// 更新本次就诊登记信息
        /// </summary>
        /// <returns>成功标识;true</returns>
        public bool UpdateRegister()
        {
            try
            {
                HIS.Model.MZ_PatList register = BindEntity <Model.MZ_PatList> .CreateInstanceDAL(oleDb).GetModel(this.PatListID);

                register.CureDeptCode = _cureDeptCode; //就诊科室
                register.CureEmpCode  = _cureEmpCode;  //就诊医生
                register.DiseaseCode  = _diseaseCode;  //疾病代码
                if (register.REG_DOC_CODE.Trim( ) == "")
                {
                    //如果挂号医生为空,则将挂号医生更改为当前就诊医生
                    register.REG_DOC_CODE  = _cureEmpCode;
                    register.REG_DOC_NAME  = BaseDataController.GetName(BaseDataCatalog.人员列表, Convert.ToInt32(_cureEmpCode));    //PublicDataReader.GetEmployeeNameById( Convert.ToInt32(_cureEmpCode) );
                    register.REG_DEPT_CODE = _cureDeptCode;
                    register.REG_DEPT_NAME = BaseDataController.GetName(BaseDataCatalog.科室列表, Convert.ToInt32(_cureDeptCode));   // PublicDataReader.GetDeptNameById( Convert.ToInt32( _cureDeptCode ) );
                }

                register.DiseaseName = _diseaseName.Replace("|", "") + "|" + _diseaseMemo.Replace("|", ""); //疾病名称
                register.HpCode      = _hpCode;                                                             //就医机构代码(病人单位代码)
                register.HpGrade     = _hpGrade;                                                            //就医机构级别
                register.MediCard    = _mediCard;                                                           //医疗证卡号
                register.MediType    = _mediType;                                                           //就诊类型
                register.PatCode     = "";                                                                  //病人代码????
                register.PatID       = this.PatID;                                                          //病人ID,如果是普通病人,则为0;否则参见PatientInfo.PatID;
                register.PatListID   = this.PatListID;                                                      //本次就诊号
                register.PatName     = this.PatientName;                                                    //病人姓名
                register.PatSex      = this.Sex;                                                            //性别
                register.PYM         = this.PYM;                                                            //拼音码
                register.WBM         = this.WBM;                                                            //五笔码
                register.Age         = this.Age;                                                            //年龄
                register.VisitNo     = this.VisitNo;                                                        //就诊号(门诊号)
                BindEntity <Model.MZ_PatList> .CreateInstanceDAL(oleDb).Update(register);

                Model.PatientInfo patientinfo = BindEntity <Model.PatientInfo> .CreateInstanceDAL(oleDb).GetModel(Convert.ToInt32(this.PatID));

                if (patientinfo != null)
                {
                    patientinfo.PatName  = register.PatName;
                    patientinfo.PatSex   = register.PatSex;
                    patientinfo.ALLERGIC = this.Allergic;
                    BindEntity <Model.PatientInfo> .CreateInstanceDAL(oleDb).Update(patientinfo);
                }

                //将处方表中挂号的记录改为处方医生
                string strWhere = Tables.mz_presmaster.PATLISTID + oleDb.EuqalTo() + this.PatListID + oleDb.And( ) +
                                  Tables.mz_presmaster.HAND_FLAG + oleDb.EuqalTo() + "0";
                Model.MZ_PresMaster mz_presmaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetModel(strWhere);

                if (mz_presmaster != null)
                {
                    if (mz_presmaster.PresDocCode == null || mz_presmaster.PresDocCode.Trim( ) == "")
                    {
                        strWhere += oleDb.And( ) + Tables.mz_presmaster.PRESMASTERID + oleDb.EuqalTo( ) + mz_presmaster.PresMasterID;
                        BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(strWhere,
                                                                                          Tables.mz_presmaster.PRESDOCCODE + oleDb.EuqalTo( ) + "'" + _cureEmpCode + "'",
                                                                                          Tables.mz_presmaster.PRESDEPTCODE + oleDb.EuqalTo( ) + "'" + _cureDeptCode + "'");
                    }
                }
                return(true);
            }
            catch (OperatorException operr)
            {
                throw operr;
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                throw new Exception("更新病人等级信息发生错误!");
            }
        }
Пример #22
0
        /// <summary>
        /// 正式结算
        /// </summary>
        /// <param name="BudgetaryChargeInfos">预结算信息,一般调用预算方法后返回该信息</param>
        /// <param name="prescriptions">处方信息</param>
        /// <returns></returns>
        public override bool Charge(ChargeInfo[] BudgetaryChargeInfos, Prescription[] prescriptions, out BaseInvoice[] ChargeInvoicies)
        {
            string errMsg = "新农合接口发生错误!";

            //构造农合接口对象
            HIS.MZ_BLL.InsurInterface.IInsureCharge insureCharge = HIS.MZ_BLL.InsurInterface.InsurInterfaceFactory.CreateInsurInstance(InsurType.新农合);
            //将包含农合信息的病人对象传给接口
            insureCharge.HisPatientInfo = Patient;

            try
            {
                object     result;
                bool       success  = insureCharge.Charge(prescriptions, out result);
                CompData[] compData = (CompData[])result;//获得补偿结果
                errMsg = "";
                //调用接口正式结算新农合
                if (success)
                {
                    try
                    {
                        success = base.Charge(BudgetaryChargeInfos, prescriptions, out ChargeInvoicies);
                        //在结算信息中加入补偿结果以返回
                        for (int i = 0; i < compData.Length; i++)
                        {
                            if (compData[i].bill_no == BudgetaryChargeInfos[i].ChargeID.ToString( ))
                            {
                                BudgetaryChargeInfos[i].compData = new System.Data.DataTable( );
                                #region ...
                                BudgetaryChargeInfos[i].compData.Columns.Add("医疗证号");
                                BudgetaryChargeInfos[i].compData.Columns.Add("户主姓名");
                                BudgetaryChargeInfos[i].compData.Columns.Add("就医机构名称");
                                BudgetaryChargeInfos[i].compData.Columns.Add("就医机构级别");
                                BudgetaryChargeInfos[i].compData.Columns.Add("就诊日期");
                                BudgetaryChargeInfos[i].compData.Columns.Add("补偿类别");
                                BudgetaryChargeInfos[i].compData.Columns.Add("补偿方案");
                                BudgetaryChargeInfos[i].compData.Columns.Add("门诊费用小计", Type.GetType("System.Decimal"));
                                BudgetaryChargeInfos[i].compData.Columns.Add("药费", Type.GetType("System.Decimal"));
                                BudgetaryChargeInfos[i].compData.Columns.Add("核算补偿额", Type.GetType("System.Decimal"));
                                BudgetaryChargeInfos[i].compData.Columns.Add("实际补偿", Type.GetType("System.Decimal"));
                                BudgetaryChargeInfos[i].compData.Columns.Add("领款人签名");
                                #endregion
                                System.Data.DataRow dr = BudgetaryChargeInfos[i].compData.NewRow( );
                                dr["医疗证号"]   = insureCharge.HisPatientInfo.InsurInfo.Medcard_Id;
                                dr["户主姓名"]   = insureCharge.HisPatientInfo.InsurInfo.Name;
                                dr["就医机构名称"] = HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.WorkName;
                                dr["就医机构级别"] = insureCharge.HisPatientInfo.InsurInfo.Medorg_Level;
                                dr["就诊日期"]   = insureCharge.HisPatientInfo.CureDate;
                                dr["补偿类别"]   = "门诊";
                                dr["补偿方案"]   = "";
                                dr["门诊费用小计"] = BudgetaryChargeInfos[i].TotalFee;
                                dr["药费"]     = Convert.ToDecimal(compData[i].comp_drugfee);
                                dr["核算补偿额"]  = Convert.ToDecimal(compData[i].comp_treatfee);
                                dr["实际补偿"]   = Convert.ToDecimal(compData[i].comp_money);
                                dr["领款人签名"]  = "";
                                BudgetaryChargeInfos[i].compData.Rows.Add(dr);
                            }
                        }
                    }
                    catch (OperatorException operr)
                    {
                        throw new OperatorException("新农合正式补偿成功,医院结算失败!\r\n原因" + operr.Message);
                    }
                    catch (Exception interfaceErr)
                    {
                        throw interfaceErr;
                    }
                }
                else
                {
                    throw new OperatorException("新农合补偿不成功!");
                }
                return(false);
            }
            catch (OperatorException Operr)
            {
                throw Operr;
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                throw new Exception("新农合结算发生错误!");
            }
        }
Пример #23
0
        /// <summary>
        /// 获取病人处方
        /// </summary>
        /// <param name="status"></param>
        /// <param name="IsCharge">是否收费处检索</param>
        /// <param name="beginDate">开始时间</param>
        /// <param name="endDate">结束时间</param>
        /// <param name="InvoiceNo">发票号</param>
        /// <param name="ExecDeptCode">执行科室ID</param>
        /// <returns>处方信息</returns>
        public Prescription[] GetPrescriptions(PresStatus status, bool IsCharge, string beginDate, string endDate, string InvoiceNo, int ExecDeptCode)
        {
            string condiction = "";

            switch (status)
            {
            case PresStatus.全部:
                condiction = " PatListID = " + this.PatListID + " AND Record_Flag in (0,1)";
                break;

            case PresStatus.未收费:
                condiction = " PatListID = " + this.PatListID + " AND Charge_Flag = 0 AND Record_Flag = 0 AND Drug_Flag = 0";
                break;

            case PresStatus.已收费未发药:
            case PresStatus.已收费已退药:
                condiction = " PatListID = " + this.PatListID + " AND Charge_Flag = 1 AND Record_Flag = 0 And Drug_Flag = 0";
                break;

            case PresStatus.已收费已发药:
                condiction = " PatListID = " + this.PatListID + " AND Charge_Flag = 1 AND Record_Flag = 0 And Drug_Flag = 1";
                break;
            }
            condiction += " and docpresid=0 ";
            if (!IsCharge)
            {
                condiction = condiction + " and PRESTYPE in ('0','1','2','3') ";
            }

            if (ExecDeptCode != 0)
            {
                condiction = condiction + " and ExecDeptCode = '" + ExecDeptCode.ToString() + "'";
            }

            if (InvoiceNo.Trim( ) == "")
            {
                if (beginDate.Trim( ) != "")
                {
                    condiction = condiction + " and PresDate>='" + beginDate + "'";
                }
                if (endDate.Trim( ) != "")
                {
                    condiction = condiction + " and PresDate<='" + endDate + "'";
                }
            }

            if (InvoiceNo.Trim( ) != "")
            {
                condiction = condiction + " and COSTMASTERID in (select COSTMASTERID from MZ_COSTMASTER where TICKETNUM='" + InvoiceNo + "' and RECORD_FLAG IN (0,1))";
            }

            condiction = condiction + " and hand_flag = " + (int)OPDOperationType.门诊收费 + " order by presmasterid";

            //得到实体列表
            List <HIS.Model.MZ_PresMaster> presMastList = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetListArray(condiction);

            //定义返回的处方
            Prescription[] prescriptions = new Prescription[presMastList.Count];
            for (int i = 0; i < presMastList.Count; i++)
            {
                #region 读取处方头
                prescriptions[i]                = new Prescription();
                prescriptions[i].Charge_Flag    = presMastList[i].Charge_Flag;
                prescriptions[i].ChargeCode     = presMastList[i].ChargeCode;
                prescriptions[i].ChargeID       = presMastList[i].CostMasterID;
                prescriptions[i].Drug_Flag      = presMastList[i].Drug_Flag;
                prescriptions[i].ExecDeptCode   = presMastList[i].ExecDeptCode;
                prescriptions[i].ExecDocCode    = presMastList[i].ExecDocCode;
                prescriptions[i].OldPresID      = presMastList[i].OldID;
                prescriptions[i].PresCostCode   = presMastList[i].PresCostCode;
                prescriptions[i].PrescriptionID = presMastList[i].PresMasterID;
                prescriptions[i].PrescType      = presMastList[i].PresType;
                prescriptions[i].PresDeptCode   = presMastList[i].PresDeptCode;
                prescriptions[i].PresDocCode    = presMastList[i].PresDocCode;
                prescriptions[i].Record_Flag    = presMastList[i].Record_Flag;
                prescriptions[i].TicketCode     = presMastList[i].TicketCode;
                prescriptions[i].TicketNum      = presMastList[i].TicketNum;
                prescriptions[i].Total_Fee      = presMastList[i].Total_Fee;
                prescriptions[i].VisitNo        = this.VisitNo;
                #endregion

                List <HIS.Model.MZ_PresOrder> presDetailList = BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).GetListArray(" PresMasterID = " + presMastList[i].PresMasterID + " order by order_flag");

                //写明细
                PrescriptionDetail[] details = new PrescriptionDetail[presDetailList.Count];
                for (int j = 0; j < presDetailList.Count; j++)
                {
                    #region 明细
                    details[j]             = new PrescriptionDetail();
                    details[j].Amount      = presDetailList[j].Amount;
                    details[j].BigitemCode = presDetailList[j].BigItemCode;
                    details[j].Buy_price   = presDetailList[j].Buy_Price;
                    details[j].ComplexId   = presDetailList[j].CaseID;
                    details[j].DetailId    = presDetailList[j].PresOrderID;
                    details[j].ItemId      = presDetailList[j].ItemID;
                    details[j].Itemname    = presDetailList[j].ItemName;
                    details[j].ItemType    = presDetailList[j].ItemType;
                    details[j].Order_Flag  = presDetailList[j].Order_Flag;
                    details[j].PassId      = presDetailList[j].PassID;
                    details[j].PresAmount  = presDetailList[j].PresAmount;
                    details[j].PresctionId = presDetailList[j].PresMasterID;
                    details[j].RelationNum = presDetailList[j].RelationNum;
                    details[j].Sell_price  = presDetailList[j].Sell_Price;
                    details[j].Standard    = presDetailList[j].Standard;
                    details[j].Tolal_Fee   = presDetailList[j].Tolal_Fee;
                    details[j].Unit        = presDetailList[j].Unit;
                    details[j].Drug_Flag   = prescriptions[i].Drug_Flag;
                    #endregion
                }
                prescriptions[i].PresDetails = details;
            }

            bool readDocPres = false;
            if (Convert.ToInt32(HIS.MZ_BLL.OPDParamter.Parameters["017"]) == 1)
            {
                readDocPres = true;
            }

            if (readDocPres)
            {
                MZClinicInterface clinicInterface = new MZClinicInterface();
                if (status == PresStatus.未收费)
                {
                    List <Prescription> lstPrescription = new List <Prescription>();
                    for (int i = 0; i < prescriptions.Length; i++)
                    {
                        lstPrescription.Add(prescriptions[i]);
                    }
                    try
                    {
                        //Prescription[] docPrescs = HIS.MZDoc_BLL.OP_Prescription.GetPrescriptions(base.PatListID);
                        HIS.Interface.Structs.Prescription[] docPrescs = clinicInterface.GetPrescriptions(base.PatListID);
                        for (int i = 0; i < docPrescs.Length; i++)
                        {
                            docPrescs[i].Modified       = true;
                            docPrescs[i].DocPresId      = docPrescs[i].PrescriptionID;
                            docPrescs[i].PrescriptionID = 0;
                            for (int j = 0; j < docPrescs[i].PresDetails.Length; j++)
                            {
                                docPrescs[i].PresDetails[j].DocPrescDetailId = docPrescs[i].PresDetails[j].DetailId;
                                docPrescs[i].PresDetails[j].DetailId         = 0;
                            }
                            lstPrescription.Add(docPrescs[i]);
                        }
                    }
                    catch (Exception err)
                    {
                        ErrorWriter.WriteLog(err.Message);
                        throw new Exception("读取医生未收费处方发生错误!");
                    }

                    prescriptions = lstPrescription.ToArray();
                }
            }
            return(prescriptions);
        }
Пример #24
0
        /// <summary>
        /// 发票号
        /// </summary>
        /// <param name="InvoiceNo">发票号</param>
        public Invoice(string PerfChar, string InvoiceNo, OPDBillKind kind)
        {
            HIS.Model.MZ_CostMaster m_mz_costmaster = new HIS.Model.MZ_CostMaster( );
            HIS.DAL.MZ_DAL          mz_dal          = new HIS.DAL.MZ_DAL( );
            mz_dal._OleDB = oleDb;
            try
            {
                string condiction = "TicketNum='" + InvoiceNo + "' and record_flag in (0,1)";
                //if ( PerfChar.Trim( ) != "" )
                condiction += " and TicketCode ='" + PerfChar + "'";

                if (kind == OPDBillKind.门诊挂号发票)
                {
                    condiction += " and hang_flag=" + (int)OPDOperationType.门诊挂号;
                }
                if (kind == OPDBillKind.门诊收费发票)
                {
                    condiction += " and hang_flag=" + (int)OPDOperationType.门诊收费;
                }

                m_mz_costmaster = BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).GetModel(condiction);

                _perfchar  = PerfChar;
                _billKind  = kind;
                _chargeId  = m_mz_costmaster.CostMasterID;
                _invoiceNo = InvoiceNo;
                _perfChar  = m_mz_costmaster.TicketCode;
                Model.MZ_CostMaster mz_costmaster = BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).GetModel(m_mz_costmaster.CostMasterID);

                Model.MZ_PatList mz_patlist = BindEntity <Model.MZ_PatList> .CreateInstanceDAL(oleDb).GetModel(mz_costmaster.PatListID);

                _patientName  = mz_patlist == null ? "" : mz_patlist.PatName;
                _totalPay     = m_mz_costmaster.Total_Fee;
                _posPay       = m_mz_costmaster.Pos_Fee;
                _favorPay     = m_mz_costmaster.Favor_Fee;
                _villagePay   = m_mz_costmaster.Village_Fee;
                _selfTally    = m_mz_costmaster.Self_Tally;
                _chargeUser   = m_mz_costmaster.ChargeName;
                _chargeUserId = m_mz_costmaster.ChargeCode;
                _chargeDate   = m_mz_costmaster.CostDate;
                _record_flag  = m_mz_costmaster.Record_Flag;
                _cashPay      = _totalPay - _posPay - _villagePay - _favorPay - _selfTally;//m_mz_costmaster.Money_Fee;
                //发票内容
                System.Data.DataTable tb = mz_dal.GetInvoiceDetail(mz_costmaster.CostMasterID);
                //Hashtable htInvoiceItems = new Hashtable();
                //for (int i = 0; i < tb.Rows.Count; i++)
                //{
                //    InvoiceItem item = new InvoiceItem();
                //    item.ItemName = tb.Rows[i]["Item_Name"].ToString().Trim();
                //    item.Cost = Convert.ToDecimal(tb.Rows[i]["Total_fee"]);
                //    item.Item_Name = tb.Rows[i]["ItemName"].ToString().Trim();
                //    item.Tolal_Fee = Convert.ToDecimal(tb.Rows[i]["Fee"]);

                //    if (htInvoiceItems.ContainsKey(item.ItemName))
                //    {
                //        InvoiceItem item1 = (InvoiceItem)htInvoiceItems[item.ItemName];
                //        if (tb.Rows[i]["itemtype"].ToString() == "01" || tb.Rows[i]["itemtype"].ToString() == "02" || tb.Rows[i]["itemtype"].ToString() == "03")
                //        {
                //            item1.Cost = item1.Cost + item.Cost;
                //            htInvoiceItems.Remove(item.ItemName);
                //        }
                //        htInvoiceItems.Add(item1.ItemName, item1);
                //    }
                //    else
                //    {
                //        htInvoiceItems.Add(item.ItemName, item);
                //    }
                //}

                _items = new InvoiceItem[tb.Rows.Count];
                // int invoiceCount = 0;
                for (int i = 0; i < tb.Rows.Count; i++)
                {
                    _items[i].ItemName = tb.Rows[i]["Item_Name"].ToString().Trim();
                    _items[i].Cost     = Convert.ToDecimal(tb.Rows[i]["Total_fee"]);

                    _items[i].Item_Name = tb.Rows[i]["ItemName"].ToString().Trim();
                    if (_items[i].Item_Name.Trim() == "")
                    {
                        _items[i].Tolal_Fee = "";
                    }
                    else
                    {
                        _items[i].Tolal_Fee = tb.Rows[i]["Fee"].ToString();
                    }
                }
                //foreach (object obj in htInvoiceItems)
                //{
                //    _items[invoiceCount].ItemName = ((InvoiceItem)((DictionaryEntry)obj).Value).ItemName;
                //    _items[invoiceCount].Cost = ((InvoiceItem)((DictionaryEntry)obj).Value).Cost;
                //    _items[invoiceCount].ItemName = ((InvoiceItem)((DictionaryEntry)obj).Value).Item_Name;
                //    _items[invoiceCount].Tolal_Fee = ((InvoiceItem)((DictionaryEntry)obj).Value).Tolal_Fee;

                //    invoiceCount++;
                //}
                //处方信息
                #region ...
                //定义统计大类容器
                Hashtable htStatItems = new Hashtable( );
                List <HIS.Model.MZ_PresMaster> lst_mz_presmaster = new List <HIS.Model.MZ_PresMaster>( );
                lst_mz_presmaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetListArray(Tables.mz_presmaster.COSTMASTERID + oleDb.EuqalTo() + _chargeId);

                _prescription = new Prescription[lst_mz_presmaster.Count];
                int index = 0;
                foreach (Model.MZ_PresMaster model_mz_presmaster in lst_mz_presmaster)
                {
                    _prescription[index]                = new Prescription( );
                    _prescription[index].Charge_Flag    = model_mz_presmaster.Charge_Flag;
                    _prescription[index].ChargeCode     = model_mz_presmaster.ChargeCode;
                    _prescription[index].ChargeID       = model_mz_presmaster.CostMasterID;
                    _prescription[index].Drug_Flag      = model_mz_presmaster.Drug_Flag;
                    _prescription[index].ExecDeptCode   = model_mz_presmaster.ExecDeptCode;
                    _prescription[index].ExecDocCode    = model_mz_presmaster.ExecDocCode;
                    _prescription[index].OldPresID      = model_mz_presmaster.OldID;
                    _prescription[index].PresCostCode   = model_mz_presmaster.PresCostCode;
                    _prescription[index].PrescriptionID = model_mz_presmaster.PresMasterID;
                    _prescription[index].PrescType      = model_mz_presmaster.PresType;
                    _prescription[index].PresDeptCode   = model_mz_presmaster.PresDocCode;
                    _prescription[index].PresDocCode    = model_mz_presmaster.PresDocCode;
                    _prescription[index].Record_Flag    = model_mz_presmaster.Record_Flag;
                    _prescription[index].TicketCode     = model_mz_presmaster.TicketCode;
                    _prescription[index].TicketNum      = model_mz_presmaster.TicketNum;
                    _prescription[index].Total_Fee      = model_mz_presmaster.Total_Fee;
                    _prescription[index].Drug_Flag      = model_mz_presmaster.Drug_Flag;
                    _prescription[index].DocPresId      = model_mz_presmaster.DocPresId;
                    List <HIS.Model.MZ_PresOrder> orders = BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).GetListArray("PresmasterID=" + _prescription[index].PrescriptionID);

                    PrescriptionDetail[] details = new PrescriptionDetail[orders.Count];
                    for (int j = 0; j < orders.Count; j++)
                    {
                        #region 明细
                        details[j]             = new PrescriptionDetail();
                        details[j].Amount      = orders[j].Amount;
                        details[j].BigitemCode = orders[j].BigItemCode;
                        details[j].Buy_price   = orders[j].Buy_Price;
                        details[j].ComplexId   = orders[j].CaseID;
                        details[j].DetailId    = orders[j].PresOrderID;
                        details[j].ItemId      = orders[j].ItemID;
                        details[j].Itemname    = orders[j].ItemName;
                        details[j].ItemType    = orders[j].ItemType;
                        details[j].Order_Flag  = orders[j].Order_Flag;
                        details[j].PassId      = orders[j].PassID;
                        details[j].PresAmount  = orders[j].PresAmount;
                        details[j].PresctionId = orders[j].PresMasterID;
                        details[j].RelationNum = orders[j].RelationNum;
                        details[j].Sell_price  = orders[j].Sell_Price;
                        details[j].Standard    = orders[j].Standard;
                        details[j].Tolal_Fee   = orders[j].Tolal_Fee;
                        details[j].Unit        = orders[j].Unit;
                        details[j].Comp_Money  = orders[j].Comp_Money;
                        #endregion

                        #region 生成大项目列表
                        if (htStatItems.ContainsKey(orders[j].BigItemCode.Trim()))
                        {
                            InvoiceItem item = (InvoiceItem)htStatItems[orders[j].BigItemCode.Trim( )];
                            item.Cost += orders[j].Tolal_Fee;
                            htStatItems.Remove(orders[j].BigItemCode.Trim( ));
                            htStatItems.Add(item.ItemCode, item);
                        }
                        else
                        {
                            InvoiceItem item = new InvoiceItem( );
                            item.ItemCode = orders[j].BigItemCode.Trim();
                            //item.ItemName = GetStatItemNameByStatCode( item.ItemCode );
                            item.ItemName = BaseDataController.GetName(BaseDataCatalog.基本分类科目, item.ItemCode);
                            item.Cost     = orders[j].Tolal_Fee;
                            htStatItems.Add(item.ItemCode, item);
                        }
                        #endregion
                    }
                    _prescription[index].PresDetails = details;
                    index++;
                }
                #endregion
                _statitems = new InvoiceItem[htStatItems.Count];
                index      = 0;
                foreach (object obj in htStatItems.Values)
                {
                    _statitems[index] = (InvoiceItem)obj;
                    index++;
                }
                paytype = "";
                if (_cashPay > 0)
                {
                    paytype += " 现金 ";
                }
                if (_posPay > 0)
                {
                    paytype += " POS ";
                }
                if (_villagePay > 0)
                {
                    paytype += " 农合医保记账 ";
                }
                if (_selfTally > 0)
                {
                    paytype += " 单位记账 ";
                }
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                throw new Exception("读取发票信息错误!");
            }
        }
Пример #25
0
        /// <summary>
        /// 保存处方
        /// </summary>
        /// <param name="Prescriptions">要保存的处方</param>
        /// <returns>成功标志</returns>
        /// <remarks></remarks>
        public bool SavePrescription(Prescription[] Prescriptions)
        {
            oleDb.BeginTransaction();
            try
            {
                for (int i = 0; i < Prescriptions.Length; i++)
                {
                    if (!Prescriptions[i].Modified)
                    {
                        continue;
                    }

                    if (Prescriptions[i].PresDetails == null)
                    {
                        continue;
                    }

                    if (Prescriptions[i].PresDetails.Length == 0)
                    {
                        continue;
                    }

                    HIS.Model.MZ_PresMaster t_mz_prescMaster = new HIS.Model.MZ_PresMaster( );
                    #region 赋值
                    t_mz_prescMaster.PatID        = Prescriptions[i].PatientID;
                    t_mz_prescMaster.PatListID    = Prescriptions[i].RegisterID;
                    t_mz_prescMaster.Charge_Flag  = Prescriptions[i].Charge_Flag;
                    t_mz_prescMaster.ChargeCode   = Prescriptions[i].ChargeCode;
                    t_mz_prescMaster.CostMasterID = Prescriptions[i].ChargeID;
                    t_mz_prescMaster.Drug_Flag    = Prescriptions[i].Drug_Flag;
                    t_mz_prescMaster.ExecDeptCode = Prescriptions[i].ExecDeptCode;
                    t_mz_prescMaster.ExecDocCode  = Prescriptions[i].ExecDocCode;
                    t_mz_prescMaster.OldID        = Prescriptions[i].OldPresID;
                    t_mz_prescMaster.PresCostCode = Prescriptions[i].PresCostCode;
                    t_mz_prescMaster.PresMasterID = Prescriptions[i].PrescriptionID;
                    t_mz_prescMaster.PresType     = Prescriptions[i].PrescType;
                    t_mz_prescMaster.PresDeptCode = Prescriptions[i].PresDeptCode;
                    t_mz_prescMaster.PresDocCode  = Prescriptions[i].PresDocCode;
                    t_mz_prescMaster.Record_Flag  = Prescriptions[i].Record_Flag;
                    t_mz_prescMaster.TicketCode   = Prescriptions[i].TicketCode;
                    t_mz_prescMaster.TicketNum    = Prescriptions[i].TicketNum;
                    t_mz_prescMaster.Total_Fee    = Prescriptions[i].Total_Fee;
                    t_mz_prescMaster.PresDate     = Prescriptions[i].PresDate;
                    t_mz_prescMaster.PresAmount   = Prescriptions[i].PresDetails[0].PresAmount;
                    t_mz_prescMaster.Hand_Flag    = (int)OPDOperationType.门诊收费;
                    t_mz_prescMaster.DocPresId    = Prescriptions[i].DocPresId;
                    #endregion
                    if (BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Exists(Prescriptions[i].PrescriptionID))
                    {
                        Model.MZ_PresMaster mz_presmaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetModel(Prescriptions[i].PrescriptionID);

                        if (mz_presmaster.Charge_Flag == 1)
                        {
                            throw new OperatorException("处方已收费,不能修改!");
                        }
                        //更新处方头
                        BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(t_mz_prescMaster);
                    }
                    else
                    {
                        //插入新处方
                        int ret1 = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Add(t_mz_prescMaster);

                        Prescriptions[i].PrescriptionID = ret1;
                    }
                    //更新或增加明细
                    PrescriptionDetail[] details = Prescriptions[i].PresDetails;
                    for (int j = 0; j < details.Length; j++)
                    {
                        if (details[j].Amount == 0)
                        {
                            throw new OperatorException("【" + details[j].Itemname + "】数量为零,请输入一个大于零的数");
                        }
                        if (details[j].BigitemCode == "01" || details[j].BigitemCode == "02" || details[j].BigitemCode == "03")
                        {
                            decimal sellprice, buyprice, storevalue;
                            decimal inputValue = details[j].Amount * details[j].PresAmount;
                            PublicDataReader.StoreExists(details[j].ItemId, Prescriptions[i].ExecDeptCode, inputValue,
                                                         out sellprice, out buyprice, out storevalue);
                        }

                        HIS.Model.MZ_PresOrder t_mz_presOrder = new HIS.Model.MZ_PresOrder( );
                        #region 赋值
                        t_mz_presOrder.Amount       = details[j].Amount;
                        t_mz_presOrder.BigItemCode  = details[j].BigitemCode;
                        t_mz_presOrder.Buy_Price    = details[j].Buy_price;
                        t_mz_presOrder.CaseID       = details[j].ComplexId; //预留的CASEID用来保存组合项目的ID
                        t_mz_presOrder.ItemID       = details[j].ItemId;
                        t_mz_presOrder.ItemName     = details[j].Itemname;
                        t_mz_presOrder.ItemType     = details[j].ItemType;
                        t_mz_presOrder.Order_Flag   = details[j].Order_Flag;
                        t_mz_presOrder.PassID       = details[j].DocPrescDetailId; //预留的PassID用来保存门诊医生处方明细ID
                        t_mz_presOrder.PatID        = this.patient.PatID;
                        t_mz_presOrder.PatListID    = this.patient.PatListID;
                        t_mz_presOrder.PresAmount   = details[j].PresAmount;
                        t_mz_presOrder.PresMasterID = Prescriptions[i].PrescriptionID;
                        t_mz_presOrder.PresOrderID  = details[j].DetailId;
                        t_mz_presOrder.RelationNum  = details[j].RelationNum;
                        t_mz_presOrder.Sell_Price   = details[j].Sell_price;
                        t_mz_presOrder.Standard     = details[j].Standard;
                        t_mz_presOrder.Tolal_Fee    = details[j].Tolal_Fee;
                        t_mz_presOrder.Unit         = details[j].Unit;
                        #endregion

                        if (BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).Exists(details[j].DetailId))
                        {
                            //更新处方明细
                            BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).Update(t_mz_presOrder);
                        }
                        else
                        {
                            //插入新处方明细
                            int ret2 = BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).Add(t_mz_presOrder);

                            details[j].DetailId = ret2;
                        }
                    }
                }

                oleDb.CommitTransaction( );
                return(true);
            }
            catch (OperatorException operr)
            {
                oleDb.RollbackTransaction( );
                throw operr;
            }
            catch (Exception err)
            {
                oleDb.RollbackTransaction( );
                ErrorWriter.WriteLog(err.Message);
                throw new Exception("保存处方发生错误!");
            }
        }