/// <summary>
        /// Open form to View selected Fee
        /// </summary>
        private void ViewSelectedFee()
        {
            FeeDetail            selectedFee             = (FeeDetail)this.lstFees.SelectedItem;
            DocumentInfoFeesForm newDocumentInfoFeesForm = new DocumentInfoFeesForm(selectedFee, DocumentInfoFeesForm.FormState.ViewFee);

            newDocumentInfoFeesForm.ShowDialog();
        }
        private void grid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
        {
            if (!isManualEditCommit)
            {
                isManualEditCommit = true;
                DataGrid grid = (DataGrid)sender;
                grid.CommitEdit(DataGridEditingUnit.Row, true);
                isManualEditCommit = false;
            }

            if (e.EditAction == DataGridEditAction.Commit)
            {
                FeeDetail feeDetail = e.Row.DataContext as FeeDetail;

                var remaingFee = feeDetail.DecidedFee - (feeDetail.PaidFee + feeDetail.RemainingFee);
                if (remaingFee < 0)
                {
                    Message(MessageTypes.Error, "Please Enter Correct Paid");
                    return;
                }

                foreach (var item in ChildrenFeeDetailList)
                {
                    if (item.StudentID == feeDetail.StudentID)
                    {
                        item.RemainingFee = remaingFee;
                        item.isUpdated    = true;
                    }
                }
            }
        }
예제 #3
0
        public void Ent_CreateFee_CreateFee_FeeId()
        {
            //arrange
            String claimId = "200002020654";
            String feeId   = "20002052146";

            feeDetail = new FeeDetail();
            feeDetail.cardAcceptorIdCode = "123456789012345";
            feeDetail.cardNumber         = "500000000001234";
            feeDetail.countryCode        = "USA";
            feeDetail.currency           = "USD";
            feeDetail.feeDate            = "2017-02-11";
            feeDetail.destinationMember  = "002083";
            feeDetail.feeAmount          = "100.00";
            feeDetail.creditSender       = "true";
            feeDetail.creditReceiver     = "false";
            feeDetail.message            = "This is a test message";
            feeDetail.reason             = "7604";
            apiController.Setup(f => f.Create <FeeDetail>(It.IsAny <long>(), It.IsAny <String>(), feeDetail))
            .Returns(new FeeDetail()
            {
                feeId = feeId
            });
            //act
            Fees fee    = new Fees(apiController.Object);
            var  result = fee.CreateFee(0, claimId, feeDetail);

            //assert
            Assert.That(result, Is.EqualTo(feeId));
        }
예제 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            FeeDetail feeDetail = db.FeeDetails.Find(id);

            db.FeeDetails.Remove(feeDetail);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #5
0
 public ActionResult Edit([Bind(Include = "FeeDetailId,Date,Particular,Amount,MemberId")] FeeDetail feeDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(feeDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MemberId = new SelectList(db.members, "MemberId", "MemberNo", feeDetail.MemberId);
     return(View(feeDetail));
 }
예제 #6
0
        public ActionResult Create([Bind(Include = "FeeDetailId,Date,Particular,Amount,MemberId")] FeeDetail feeDetail)
        {
            if (ModelState.IsValid)
            {
                db.FeeDetails.Add(feeDetail);
                db.SaveChanges();
                return(RedirectToAction("Create", "members"));
            }

            ViewBag.MemberId = new SelectList(db.members, "MemberId", "MemberNo", feeDetail.MemberId);

            return(View(feeDetail));
        }
예제 #7
0
        // GET: FeeDetails/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FeeDetail feeDetail = db.FeeDetails.Find(id);

            if (feeDetail == null)
            {
                return(HttpNotFound());
            }
            return(View(feeDetail));
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="feeDetail"></param>
 /// <param name="formState"></param>
 public DocumentInfoFeesForm(FeeDetail feeDetail, FormState formState)
     : this()
 {
     this.FeeDetail = feeDetail;
     this.SetFormState(formState);
     switch (formState)
     {
         case FormState.NewFee:
             this.ctrlFeeDetail.SetControlState(FeeDetailControl.ControlState.NewFee);
             break;
         case FormState.ViewFee:
             this.ctrlFeeDetail.SetControlState(FeeDetailControl.ControlState.ViewFee);
             break;
     }
 }
예제 #9
0
        // GET: FeeDetails/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FeeDetail feeDetail = db.FeeDetails.Find(id);

            if (feeDetail == null)
            {
                return(HttpNotFound());
            }
            ViewBag.MemberId = new SelectList(db.members, "MemberId", "MemberNo", feeDetail.MemberId);
            return(View(feeDetail));
        }
        /// <summary>
        /// Delete selected Fee
        /// </summary>
        private void DeleteSelectedFee()
        {
            FeeDetail selectedFee = (FeeDetail)this.lstFees.SelectedItem;

            if (selectedFee.ActionCode == ActionCode.New)
            {
                this.CurrentFees.Remove(selectedFee);
                this._DocumentInfo.Fees = this.CurrentFees.ToArray();
            }
            else
            {
                selectedFee.ActionCode = ActionCode.Delete;
            }
            this.UpdateFeesList();
        }
예제 #11
0
        /// <summary>
        /// 临时用。。
        /// </summary>
        private static void temp_trans_fee()
        {
            BudgetFee hisData  = new BudgetFee();
            JoinArea  joinArea = new JoinArea();

            joinArea.code = "430121";
            joinArea.name = "长沙县";

            DataType dataType = new DataType();

            dataType.dataTypeName  = "门诊数据";
            dataType.dataTypeValue = "2";

            ZyPatBaseData zyPat = new ZyPatBaseData();

            zyPat.idCard      = "440100199707010033";
            zyPat.person_code = "430121112001001000101";
            zyPat.hisID       = "200904080001";
            zyPat.area_id     = "430121";
            zyPat.medorg_code = "400866951";

            FeeDetail feeDetail = new FeeDetail();

            feeDetail.his_billno       = "";
            feeDetail.item_sn          = "123523";
            feeDetail.item_code        = "112010702110105";
            feeDetail.item_class       = "1";
            feeDetail.item_equal       = "0";
            feeDetail.item_name        = "青霉素";
            feeDetail.item_use_time    = "2009-4-1";
            feeDetail.amount           = 12.00;
            feeDetail.drugform         = "针剂";
            feeDetail.doctorTitle      = "232";
            feeDetail.doctor           = "刘医生";
            feeDetail.money            = 24.00;
            feeDetail.price            = 2.00;
            feeDetail.center_item_code = "0101010605110201";
            feeDetail.specs            = "1.0g*24支";
            feeDetail.unit             = "支";

            FeeDetail[] detailList = new FeeDetail[1];
            detailList[0]     = feeDetail;
            hisData.zyPat     = zyPat;
            hisData.feeDetail = detailList;
            hisData.uploadorg = "400866951";
            hisData.dataType  = dataType;
            hisData.joinArea  = joinArea;
        }
예제 #12
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="feeDetail"></param>
        /// <param name="formState"></param>
        public DocumentInfoFeesForm(FeeDetail feeDetail, FormState formState)
            : this()
        {
            this.FeeDetail = feeDetail;
            this.SetFormState(formState);
            switch (formState)
            {
            case FormState.NewFee:
                this.ctrlFeeDetail.SetControlState(FeeDetailControl.ControlState.NewFee);
                break;

            case FormState.ViewFee:
                this.ctrlFeeDetail.SetControlState(FeeDetailControl.ControlState.ViewFee);
                break;
            }
        }
        /// <summary>
        /// Add Fee
        /// </summary>
        private void AddFee()
        {
            FeeDetail newFee = new FeeDetail();

            newFee._ID             = "-" + (new Random(DateTime.Now.Millisecond)).Next(0, 999).ToString();
            newFee.CreateTimeStamp = System.DateTime.Now;
            newFee.EditTimeStamp   = System.DateTime.Now;
            newFee.ActionCode      = ActionCode.New;

            DocumentInfoFeesForm newDocumentInfoFeesForm = new DocumentInfoFeesForm(newFee, DocumentInfoFeesForm.FormState.NewFee);

            if (newDocumentInfoFeesForm.ShowDialog(this) == DialogResult.OK)
            {
                this.CurrentFees.Add(newFee);
                this._DocumentInfo.Fees = this.CurrentFees.ToArray();
                this.UpdateFeesList();
            }
        }
예제 #14
0
        /// <summary>
        /// 处方明细信息转化为接口明细
        /// </summary>
        /// <param name="dt">处方信息</param>
        /// <returns></returns>
        public static FeeDetail[] ConvertFeeDetail(DataTable dt)
        {
            try
            {
                ZY_PresOrder zypo = new ZY_PresOrder();

                List <FeeDetail> fees = new List <FeeDetail>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    FeeDetail feeDetail = new FeeDetail();
                    feeDetail.his_billno = dt.Rows[i]["CostMasterID"].ToString();//结算ID
                    feeDetail.item_sn    = dt.Rows[i]["PRESORDERID"].ToString();
                    feeDetail.item_code  = dt.Rows[i]["ITEMID"].ToString();

                    feeDetail.item_class       = Convert.ToInt32(dt.Rows[i]["PRESTYPE"].ToString().Trim()) >= 4 ? "2" : "1";
                    feeDetail.item_equal       = "0";
                    feeDetail.item_name        = dt.Rows[i]["ITEMNAME"].ToString();
                    feeDetail.item_use_time    = DateTime.Now.ToString("yyyy-MM-dd");
                    feeDetail.amount           = Convert.ToDouble(dt.Rows[i]["TOLAL_FEE"]) / Convert.ToDouble(dt.Rows[i]["SELL_PRICE"]);//Convert.ToDouble(dt.Rows[i]["AMOUNT"]);
                    feeDetail.drugform         = "";
                    feeDetail.doctorTitle      = dt.Rows[i]["PresDocCode"].ToString();
                    feeDetail.doctor           = dt.Rows[i]["DocName"].ToString();
                    feeDetail.money            = Convert.ToDouble(dt.Rows[i]["TOLAL_FEE"]);
                    feeDetail.price            = Convert.ToDouble(dt.Rows[i]["SELL_PRICE"]);
                    feeDetail.center_item_code = dt.Rows[i]["NCMS_CODE"].ToString();
                    feeDetail.comp_ratio       = Convert.ToDouble(dt.Rows[i]["Comp_Money"]) / 100;
                    feeDetail.specs            = dt.Rows[i]["STANDARD"].ToString();
                    feeDetail.unit             = dt.Rows[i]["PACKUNIT"].ToString();
                    feeDetail.nccm_comp_status = "0";
                    feeDetail.feeType          = zypo.GetFPXM_Code(dt.Rows[i]["ITEMTYPE"].ToString());//费用类型
                    feeDetail.reverse_sn       = dt.Rows[i]["OLDID"].ToString() == "0" ? "" : dt.Rows[i]["OLDID"].ToString();
                    feeDetail.reverse_status   = feeDetail.reverse_sn == "" ? "0" : "2";
                    feeDetail.reverse_date     = DateTime.Now.ToString("yyyy-MM-dd");

                    fees.Add(feeDetail);
                }
                return(fees.ToArray());
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
예제 #15
0
 public static FeeDetailModel ToModel(this FeeDetail entity)
 {
     return(entity.MapTo <FeeDetail, FeeDetailModel>());
 }
        /// <summary>
        /// Add Fee
        /// </summary>
        private void AddFee()
        {
            FeeDetail newFee = new FeeDetail();
            newFee._ID = "-" + (new Random(DateTime.Now.Millisecond)).Next(0, 999).ToString();
            newFee.CreateTimeStamp = System.DateTime.Now;
            newFee.EditTimeStamp = System.DateTime.Now;
            newFee.ActionCode = ActionCode.New;

            DocumentInfoFeesForm newDocumentInfoFeesForm = new DocumentInfoFeesForm(newFee, DocumentInfoFeesForm.FormState.NewFee);
            if (newDocumentInfoFeesForm.ShowDialog(this) == DialogResult.OK)
            {
                this.CurrentFees.Add(newFee);
                this._DocumentInfo.Fees = this.CurrentFees.ToArray();
                this.UpdateFeesList();
            }
        }
예제 #17
0
파일: Fees.cs 프로젝트: emrahm/MasterCom
 public String CreateFee(long refKey, String claimId, FeeDetail feeDetail)
 {
     return(_apiController.Create <FeeDetail>(refKey, String.Format("claims/{0}/fee", claimId), feeDetail).feeId);
 }
예제 #18
0
 public static FeeDetail ToEntity(this FeeDetailModel model, FeeDetail destination)
 {
     return(model.MapTo(destination));
 }
예제 #19
0
        /// <summary>
        /// 退费
        /// </summary>
        /// <param name="OrgPrescription">原始处方</param>
        /// <param name="DisChargePrescription">冲正的处方</param>
        /// <returns></returns>
        public bool CancelCharge(Prescription OrgPrescription, Prescription DisChargePrescription)
        {
            CanceDetail hisData = new CanceDetail();

            hisData.hos_class    = hospitalInfo.hos_class;
            hisData.hos_level    = hospitalInfo.hos_level;
            hisData.medorg_level = hospitalInfo.org_id;
            hisData.uploadorg    = MED_ORG_CODE;
            hisData.uploadPerson = hospitalInfo.userCode;
            hisData.uploadTime   = DateTime.Now.ToString("yyyy-MM-dd");

            hisData.joinArea      = new JoinArea();
            hisData.joinArea.code = JOIN_AREA_CODE;
            hisData.joinArea.name = JOIN_AREA_NAME;

            hisData.dataClass = new DataClass();
            hisData.dataClass.dataClassName  = "新农合数据";
            hisData.dataClass.dataClassValue = "1";

            hisData.dataType = new DataType();
            hisData.dataType.dataTypeName  = "门诊数据";
            hisData.dataType.dataTypeValue = "1";

            hisData.operType = new OperType();
            hisData.operType.operTypeName  = "冲正";
            hisData.operType.operTypeValue = "2";
            //病人基本信息
            hisData.baseData             = new PatBaseData();
            hisData.baseData.age         = hisOutPatient.InsurInfo.Age.ToString();
            hisData.baseData.area_id     = JOIN_AREA_CODE;
            hisData.baseData.birthdate   = hisOutPatient.InsurInfo.BirthDate.ToString("yyyy-MM-dd");
            hisData.baseData.family_code = hisOutPatient.InsurInfo.Family_Code;
            hisData.baseData.hisID       = hisOutPatient.PatListID.ToString();
            hisData.baseData.idCard      = hisOutPatient.InsurInfo.IdCard;
            hisData.baseData.medcard_id  = hisOutPatient.InsurInfo.Medcard_Id;
            hisData.baseData.name        = hisOutPatient.InsurInfo.Name;
            hisData.baseData.person_code = hisOutPatient.InsurInfo.Person_Code;
            hisData.baseData.sex         = hisOutPatient.InsurInfo.Sex;

            hisData.baseData.visit_type = "1";
            //指定需要退费的明细(负记录)数量和金额是负数
            List <FeeDetail> feeList = new List <FeeDetail>();

            for (int i = 0; i < DisChargePrescription.PresDetails.Length; i++)
            {
                try
                {
                    FeeDetail detail = new FeeDetail( );
                    detail.his_billno = DisChargePrescription.ChargeID.ToString( );                                                                                                                //*
                    detail.item_sn    = DisChargePrescription.PrescriptionID.ToString( ) + DisChargePrescription.PresDetails[i].DetailId.ToString( ) + DisChargePrescription.ChargeID.ToString( ); //*
                    detail.item_code  = DisChargePrescription.PresDetails[i].ItemId.ToString( );                                                                                                   //*
                    if (DisChargePrescription.PresDetails[i].ItemType == "01" || DisChargePrescription.PresDetails[i].ItemType == "02" || DisChargePrescription.PresDetails[i].ItemType == "03")
                    {
                        detail.item_class = "1";
                    }
                    else
                    {
                        detail.item_class = "2";
                    }

                    detail.item_equal       = "0";                                                                                                                                     //
                    detail.item_name        = DisChargePrescription.PresDetails[i].Itemname;                                                                                           //*
                    detail.item_use_time    = DisChargePrescription.PresDate.ToString("yyyy-MM-dd");                                                                                   //*
                    detail.amount           = Convert.ToDouble(DisChargePrescription.PresDetails[i].Amount);                                                                           //*
                    detail.drugform         = "";                                                                                                                                      //
                    detail.doctorTitle      = "";                                                                                                                                      //
                    detail.doctor           = DisChargePrescription.PresDocCode;                                                                                                       //
                    detail.money            = Convert.ToDouble(DisChargePrescription.PresDetails[i].Tolal_Fee);                                                                        //*
                    detail.price            = Convert.ToDouble(DisChargePrescription.PresDetails[i].Sell_price);                                                                       //*
                    detail.center_item_code = GetNcmsCenterCode(detail.item_code, detail.item_class);                                                                                  //
                    detail.specs            = "";                                                                                                                                      //
                    detail.unit             = DisChargePrescription.PresDetails[i].Unit;                                                                                               //
                    detail.reverse_date     = DateTime.Now.ToString("yyyy-MM-dd");                                                                                                     //* 冲正日期
                    detail.reverse_person   = hisData.uploadPerson;                                                                                                                    //* 冲正人
                    detail.reverse_sn       = OrgPrescription.PrescriptionID.ToString( ) + OrgPrescription.PresDetails[i].DetailId.ToString( ) + OrgPrescription.ChargeID.ToString( ); //* 冲正对应的正记录的ID

                    feeList.Add(detail);
                }
                catch (OperatorException operr)
                {
                    throw operr;
                }
                catch (Exception err)
                {
                    ErrorWriter.WriteLog(err.Message);
                    throw new Exception("数据上传期间发生错误!");
                }
            }
            hisData.cancelData = feeList.ToArray();
            try
            {
                object obj = NccmInterfaces.OutPatientCancelCharge(hisData);
                return(true);
            }
            catch (OperatorException operr)
            {
                throw operr;
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Source + "\r\n" + err.Message);
                throw new Exception("农合接口退费发生错误!");
            }
        }
예제 #20
0
        /// <summary>
        /// 正式结算
        /// </summary>
        /// <param name="prescriptions">需要结算的处方</param>
        /// <returns>true:结算成功,false:结算失败</returns>
        /// <param name="Result">返回的相关信息</param>
        public bool Charge(Prescription[] prescriptions, out object Result)
        {
            Result = null;
            PatientComp patComp = new PatientComp();

            patComp.uploadorg = MED_ORG_CODE;

            DataClass dataClass = new DataClass();

            dataClass.dataClassValue = "1";
            patComp.dataClass        = dataClass;

            JoinArea joinArea = new JoinArea();

            joinArea.code    = JOIN_AREA_CODE;
            joinArea.name    = JOIN_AREA_NAME;
            patComp.joinArea = joinArea;

            DataType dataType = new DataType();

            dataType.dataTypeName  = "门诊数据";
            dataType.dataTypeValue = "2";
            patComp.dataType       = dataType;


            MzPatBaseData mzPat = new MzPatBaseData();

            mzPat.idCard       = hisOutPatient.InsurInfo.IdCard;
            mzPat.person_code  = hisOutPatient.InsurInfo.Person_Code;
            mzPat.hisID        = hisOutPatient.PatListID.ToString();//本次门诊的唯一号
            mzPat.area_id      = JOIN_AREA_CODE;
            mzPat.family_code  = hisOutPatient.InsurInfo.Family_Code;
            mzPat.medorg_code  = MED_ORG_CODE;
            mzPat.medorg_level = hisOutPatient.InsurInfo.Medorg_Level;
            mzPat.visit_type   = "1"; //1,门诊,2-住院
            mzPat.age          = hisOutPatient.Age.ToString();
            mzPat.name         = hisOutPatient.PatientName;
            mzPat.medcard_id   = hisOutPatient.InsurInfo.Medcard_Id;

            patComp.mzPat = mzPat;

            List <FeeDetail> fees = new List <FeeDetail>();

            for (int i = 0; i < prescriptions.Length; i++)
            {
                for (int j = 0; j < prescriptions[i].PresDetails.Length; j++)
                {
                    FeeDetail feeDetail = new FeeDetail();
                    feeDetail.his_billno = prescriptions[i].ChargeID.ToString();
                    feeDetail.item_sn    = prescriptions[i].PrescriptionID.ToString() + prescriptions[i].PresDetails[j].DetailId.ToString() + prescriptions[i].ChargeID.ToString();
                    feeDetail.item_code  = prescriptions[i].PresDetails[j].ItemId.ToString();
                    if (prescriptions[i].PresDetails[j].ItemType == "01" || prescriptions[i].PresDetails[j].ItemType == "02" || prescriptions[i].PresDetails[j].ItemType == "03")
                    {
                        feeDetail.item_class = "1";
                    }
                    else
                    {
                        feeDetail.item_class = "2";
                    }
                    feeDetail.item_equal       = "0";
                    feeDetail.item_name        = prescriptions[i].PresDetails[j].Itemname.Trim();
                    feeDetail.item_use_time    = DateTime.Now.ToString("yyyy-MM-dd");
                    feeDetail.amount           = Convert.ToDouble(prescriptions[i].PresDetails[j].Amount);
                    feeDetail.drugform         = "";
                    feeDetail.doctorTitle      = GetDoctorTitle(prescriptions[i].PresDocCode);
                    feeDetail.doctor           = prescriptions[i].PresDocCode;
                    feeDetail.money            = Convert.ToDouble(prescriptions[i].PresDetails[j].Tolal_Fee);
                    feeDetail.price            = Convert.ToDouble(prescriptions[i].PresDetails[j].Sell_price);
                    feeDetail.center_item_code = GetNcmsCenterCode(feeDetail.item_code, feeDetail.item_class);
                    feeDetail.specs            = prescriptions[i].PresDetails[j].Standard;
                    feeDetail.unit             = prescriptions[i].PresDetails[j].Unit;
                    feeDetail.nccm_comp_status = "0";
                    feeDetail.feeType          = GetClassCode(prescriptions[i].PresDetails[j].BigitemCode);
                    feeDetail.comp_ratio       = Convert.ToDouble(GetNcmsCompRate(feeDetail.item_code, feeDetail.item_class));
                    fees.Add(feeDetail);
                }
            }
            FeeDetail[] detailList = fees.ToArray();
            patComp.mzDetail = detailList;

            //调用接口预算功能
            try
            {
                CompData[] cpData = NccmInterfaces.OutPatientCharge(patComp);
                Result = cpData;
                return(true);
            }
            catch (OperatorException operr)
            {
                throw operr;
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Source + "\r\n" + err.Message);
                throw new Exception("新农合接口调用期间发生错误!");
            }
        }
예제 #21
0
        /// <summary>
        /// 预算(接口预算完成后,回写入参的补偿金额字段以便后续使用)
        /// </summary>
        /// <returns>返回医保预算信息</returns>
        public InsurChargeInfo PreviewCharge(Prescription[] prescriptions)
        {
            PatientComp patComp = new PatientComp();

            patComp.uploadorg = MED_ORG_CODE;

            DataClass dataClass = new DataClass();

            dataClass.dataClassValue = "1";
            patComp.dataClass        = dataClass;

            JoinArea joinArea = new JoinArea();

            joinArea.code    = JOIN_AREA_CODE;
            joinArea.name    = JOIN_AREA_NAME;
            patComp.joinArea = joinArea;

            DataType dataType = new DataType();

            dataType.dataTypeName  = "门诊数据";
            dataType.dataTypeValue = "2";
            patComp.dataType       = dataType;



            MzPatBaseData mzPat = new MzPatBaseData();

            mzPat.idCard       = hisOutPatient.InsurInfo.IdCard;
            mzPat.person_code  = hisOutPatient.InsurInfo.Person_Code;
            mzPat.hisID        = hisOutPatient.PatListID.ToString();//本次门诊的唯一号
            mzPat.area_id      = JOIN_AREA_CODE;
            mzPat.family_code  = hisOutPatient.InsurInfo.Family_Code;
            mzPat.medorg_code  = MED_ORG_CODE;
            mzPat.medorg_level = hisOutPatient.InsurInfo.Medorg_Level;
            mzPat.visit_type   = "1"; //1,门诊,2-住院
            mzPat.age          = hisOutPatient.Age.ToString();
            mzPat.name         = hisOutPatient.PatientName;
            mzPat.medcard_id   = hisOutPatient.InsurInfo.Medcard_Id;
            mzPat.birthdate    = hisOutPatient.InsurInfo.BirthDate.ToString("yyyy-MM-dd");
            mzPat.age          = hisOutPatient.InsurInfo.Age.ToString();
            patComp.mzPat      = mzPat;

            List <FeeDetail> fees = new List <FeeDetail>();

            for (int i = 0; i < prescriptions.Length; i++)
            {
                for (int j = 0; j < prescriptions[i].PresDetails.Length; j++)
                {
                    try
                    {
                        FeeDetail feeDetail = new FeeDetail();
                        feeDetail.his_billno = prescriptions[i].ChargeID.ToString();
                        feeDetail.item_sn    = prescriptions[i].PrescriptionID.ToString() + prescriptions[i].PresDetails[j].DetailId.ToString() + prescriptions[i].ChargeID.ToString();
                        feeDetail.item_code  = prescriptions[i].PresDetails[j].ItemId.ToString();
                        if (prescriptions[i].PresDetails[j].ItemType == "01" || prescriptions[i].PresDetails[j].ItemType == "02" || prescriptions[i].PresDetails[j].ItemType == "03")
                        {
                            feeDetail.item_class = "1";
                        }
                        else
                        {
                            feeDetail.item_class = "2";
                        }
                        feeDetail.item_equal       = "0";
                        feeDetail.item_name        = prescriptions[i].PresDetails[j].Itemname.Trim();
                        feeDetail.item_use_time    = DateTime.Now.ToString("yyyy-MM-dd");
                        feeDetail.amount           = Convert.ToDouble(prescriptions[i].PresDetails[j].Amount);
                        feeDetail.drugform         = "";
                        feeDetail.doctorTitle      = GetDoctorTitle(prescriptions[i].PresDocCode);
                        feeDetail.doctor           = prescriptions[i].PresDocCode;
                        feeDetail.money            = Convert.ToDouble(prescriptions[i].PresDetails[j].Tolal_Fee);
                        feeDetail.price            = Convert.ToDouble(prescriptions[i].PresDetails[j].Sell_price);
                        feeDetail.center_item_code = GetNcmsCenterCode(feeDetail.item_code, feeDetail.item_class);
                        feeDetail.specs            = prescriptions[i].PresDetails[j].Standard;
                        feeDetail.unit             = prescriptions[i].PresDetails[j].Unit;
                        feeDetail.nccm_comp_status = "0";
                        feeDetail.feeType          = GetClassCode(prescriptions[i].PresDetails[j].BigitemCode);
                        feeDetail.comp_ratio       = Convert.ToDouble(GetNcmsCompRate(feeDetail.item_code, feeDetail.item_class));

                        fees.Add(feeDetail);
                    }
                    catch (Exception err)
                    {
                        ErrorWriter.WriteLog(err.Message);
                        throw new OperatorException("准备上传数据期间发生错误!");
                    }
                }
            }
            FeeDetail[] detailList = fees.ToArray();
            patComp.mzDetail = detailList;

            InsurChargeInfo insurChargeInfo = new InsurChargeInfo();//定义的农合结算信息

            //调用接口预算功能
            try
            {
                CompData[] compDatas = NccmInterfaces.OutPatientBudegt(patComp);
                //判断返回的农合结算结果记录是是否和医院处方数对应
                if (compDatas.Length != prescriptions.Length)
                {
                    throw new NcmsInterfaceException("新农合预算结果的记录数(" + compDatas.Length.ToString() + ")不等于医院上传的处方数(" + prescriptions.Length.ToString() + ")");
                }
                //回写每条明细的补偿金额
                for (int i = 0; i < prescriptions.Length; i++)
                {
                    for (int j = 0; j < compDatas.Length; j++)
                    {
                        if (prescriptions[i].ChargeID.ToString() == compDatas[j].bill_no)
                        {
                            prescriptions[i].RedeemCost = Convert.ToDecimal(compDatas[j].comp_money);
                            break;
                        }
                    }
                }
            }
            catch (NcmsInterfaceException ncmsErr)
            {
                throw new OperatorException(ncmsErr.Message);
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                ErrorWriter.WriteLog(err.InnerException.Message);
                throw new Exception("农合预算发生错误!");
            }


            return(insurChargeInfo);
        }