Beispiel #1
0
        /// <summary>
        /// 显示患者的发票信息
        /// </summary>
        /// <param name="feeItemList"></param>
        /// <returns></returns>
        public int RefreshDisplayInfomation(ArrayList feeItemList)
        {
            for (int i = 0; i < this.fpSpread1_Sheet1.Rows.Count; i++)
            {
                for (int j = 0; j < this.fpSpread1_Sheet1.Columns.Count; j++)
                {
                    this.fpSpread1_Sheet1.Cells[i, j].Text = "";
                }
            }

            decimal totCost     = 0m;
            decimal totPay      = 0m;
            decimal totPub      = 0m;
            decimal totPubPha   = 0m;
            decimal totPubZYPha = 0m;

            if (feeItemList == null)
            {
                MessageBox.Show("没有费用明细!");

                return(-1);
            }
            if (dsInvoice == null || dsInvoice.Tables[0].Rows.Count <= 0)
            {
                MessageBox.Show("没有发票信息!请维护!");

                return(-1);
            }

            foreach (DataRow row in dsInvoice.Tables[0].Rows)
            {
                row["Tot_Cost"] = 0;
                row["Own_Cost"] = 0;
                row["Pay_Cost"] = 0;
                row["Pub_Cost"] = 0;
            }

            foreach (FeeItemList f in feeItemList)
            {
                DataRow rowFind = dsInvoice.Tables[0].Rows.Find(new object[] { f.Item.MinFee.ID });
                if (rowFind == null)
                {
                    MessageBox.Show("最小费用为" + f.Item.MinFee.ID + "的最小费用没有在MZ01的发票大类中维护");
                    return(-1);
                }
                rowFind["Tot_Cost"] = NConvert.ToDecimal(rowFind["Tot_Cost"].ToString()) + f.FT.TotCost;
                rowFind["Own_Cost"] = NConvert.ToDecimal(rowFind["Own_Cost"].ToString()) + f.FT.OwnCost;
                rowFind["Pay_Cost"] = NConvert.ToDecimal(rowFind["Pay_Cost"].ToString()) + f.FT.PayCost;
                rowFind["Pub_Cost"] = NConvert.ToDecimal(rowFind["Pub_Cost"].ToString()) + f.FT.PubCost;

                if (this.regInfo.Pact.PayKind.ID == "03")
                {
                    totPub += f.FT.PubCost;
                    totPay += f.FT.PayCost;
                }
            }
            //by 牛鑫元

            if (feeItemList.Count > 0)
            {
                if (this.isPreFee)
                {
                    if (this.regInfo.Pact.PayKind.ID == "02")
                    {
                        //医保患者处理预结算
                        long returnValue = 0;
                        Neusoft.HISFC.BizProcess.Integrate.FeeInterface.MedcareInterfaceProxy medcareInterfaceProxy = new Neusoft.HISFC.BizProcess.Integrate.FeeInterface.MedcareInterfaceProxy();
                        returnValue = medcareInterfaceProxy.SetPactCode(this.regInfo.Pact.ID);
                        //medcareInterfaceProxy.SetTrans()

                        returnValue = medcareInterfaceProxy.Connect();
                        if (returnValue != 1)
                        {
                            medcareInterfaceProxy.Rollback();
                            MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("待遇接口初始化失败") + medcareInterfaceProxy.ErrMsg);
                            return(-1);
                        }

                        returnValue = medcareInterfaceProxy.UploadFeeDetailsOutpatient(this.regInfo, ref feeItemList);
                        if (returnValue < 0)
                        {
                            MessageBox.Show("待遇接口" + medcareInterfaceProxy.ErrMsg);
                            return(-1);
                        }
                        returnValue = medcareInterfaceProxy.PreBalanceOutpatient(this.regInfo, ref feeItemList);
                        if (returnValue < 0)
                        {
                            MessageBox.Show("待遇接口" + medcareInterfaceProxy.ErrMsg);
                            return(-1);
                        }
                        medcareInterfaceProxy.Rollback();
                        totPay = this.regInfo.SIMainInfo.PayCost;
                        totPub = this.regInfo.SIMainInfo.PubCost;
                    }
                }
            }

            for (int i = 1; i < 50; i++)
            {
                DataRow[] rowFind = dsInvoice.Tables[0].Select("SEQ = " + i.ToString(), "SEQ ASC");
                if (rowFind.Length == 0)
                {
                    //break;
                }
                else
                {
                    Neusoft.HISFC.Models.Fee.Outpatient.BalanceList detail = new Neusoft.HISFC.Models.Fee.Outpatient.BalanceList();

                    detail.InvoiceSquence   = NConvert.ToInt32(rowFind[0]["SEQ"].ToString());
                    detail.FeeCodeStat.ID   = rowFind[0]["FEE_STAT_CATE"].ToString();
                    detail.FeeCodeStat.Name = rowFind[0]["FEE_STAT_NAME"].ToString();

                    foreach (DataRow row in rowFind)
                    {
                        detail.BalanceBase.FT.PubCost += NConvert.ToDecimal(row["Pub_Cost"].ToString());
                        detail.BalanceBase.FT.OwnCost += NConvert.ToDecimal(row["Own_Cost"].ToString());
                        detail.BalanceBase.FT.PayCost += NConvert.ToDecimal(row["Pay_Cost"].ToString());
                        detail.BalanceBase.FT.TotCost += NConvert.ToDecimal(row["Tot_Cost"].ToString());
                    }

                    if (invoicePreviewType == "1" && this.regInfo.Pact.PayKind.ID == "03" && detail.InvoiceSquence != 7 && detail.InvoiceSquence != 8 && detail.InvoiceSquence != 22 && detail.InvoiceSquence != 23)
                    {
                        totCost += detail.BalanceBase.FT.PubCost + detail.BalanceBase.FT.PayCost;
                    }
                    else
                    {
                        totCost += detail.BalanceBase.FT.TotCost;
                    }
                    if (detail.BalanceBase.FT.TotCost > 0)
                    {
                        int y = detail.InvoiceSquence / 8;
                        int x = detail.InvoiceSquence - 8 * y;
                        if (x == 0)
                        {
                            x = 8;
                        }
                        if (y == 3)
                        {
                            y = 2;
                        }
                        if (detail.InvoiceSquence == 16)
                        {
                            y = 1;
                        }
                        #region Changed by zuowy -- 2006/07/28

                        if (detail.InvoiceSquence % 8 == 0)
                        {
                            y = (detail.InvoiceSquence - 8) / 8;
                        }

                        #endregion
                        this.fpSpread1_Sheet1.Cells[x - 1, 2 * y].Text = detail.FeeCodeStat.Name;
                        if (invoicePreviewType == "1" && this.regInfo.Pact.PayKind.ID == "03" && detail.InvoiceSquence != 7 && detail.InvoiceSquence != 8 && detail.InvoiceSquence != 22 && detail.InvoiceSquence != 23)//中山模式公费显示记帐部分
                        {
                            this.fpSpread1_Sheet1.Cells[x - 1, 2 * y + 1].Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString((detail.BalanceBase.FT.PayCost + detail.BalanceBase.FT.PubCost), 2);
                        }
                        else
                        {
                            this.fpSpread1_Sheet1.Cells[x - 1, 2 * y + 1].Text = Neusoft.FrameWork.Public.String.FormatNumberReturnString(detail.BalanceBase.FT.TotCost, 2);
                        }
                    }
                }
            }

            this.lblTotCost.Text = "大写总金额: " + Neusoft.FrameWork.Public.String.LowerMoneyToUpper(totCost);

            return(1);
        }
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        public virtual int Save()
        {
            if (cmbZg.Tag == null || cmbZg.Tag.ToString().Trim() == string.Empty)
            {
                this.Err = "请输入出院情况";
                this.cmbZg.Focus();
                return(-1);
            }
            //如果患者不是当天出院提示
            if (this.dtOutDate.Value.Date != this.inpatient.GetDateTimeFromSysDateTime().Date)
            {
                DialogResult dr = MessageBox.Show("该患者的出院日期是: " +
                                                  this.dtOutDate.Value.ToString("yyyy年MM月dd日") + "  是否继续?", "提示",
                                                  MessageBoxButtons.YesNo, MessageBoxIcon.Information,
                                                  MessageBoxDefaultButton.Button1);
                if (dr == DialogResult.No)
                {
                    this.Err = "";
                    return(-1);
                }
            }

            if (this.PatientInfo == null || string.IsNullOrEmpty(this.PatientInfo.ID))
            {
                this.Err = "请回车确认住院号是否存在!";

                return(-1);
            }

            //取患者最新的住院主表信息
            PatientInfo = this.radt.GetPatientInfomation(this.PatientInfo.ID);
            if (PatientInfo == null)
            {
                this.Err = this.radt.Err;
                return(-1);
            }
            this.Err = "";

            //如果患者在院状态发生变化,则不允许操作

            string in_State = PatientInfo.PVisit.InState.ID.ToString();

            if (PatientInfo.PVisit.InState.ID.ToString() != "I")
            {
                this.Err = "该患者没有接诊";
                return(-1);
            }

            //取出院登记信息
            this.GetOutInfo();
            //{2A467990-BDA3-4cb4-BB89-5801796EBC95}
            Neusoft.HISFC.BizProcess.Interface.IPatientShiftValid obj = Neusoft.FrameWork.WinForms.Classes.UtilInterface.CreateObject(this.GetType(), typeof(Neusoft.HISFC.BizProcess.Interface.IPatientShiftValid)) as Neusoft.HISFC.BizProcess.Interface.IPatientShiftValid;
            if (obj != null)
            {
                string err = string.Empty;
                bool   bl  = obj.IsPatientShiftValid(PatientInfo, Neusoft.HISFC.Models.Base.EnumPatientShiftValid.O, ref err);
                if (!bl)
                {
                    MessageBox.Show(err);
                    return(-1);
                }
            }
            //出院登记
            HISFC.BizProcess.Integrate.FeeInterface.MedcareInterfaceProxy medcareInterfaceProxy = new Neusoft.HISFC.BizProcess.Integrate.FeeInterface.MedcareInterfaceProxy();
            long returnValue = medcareInterfaceProxy.SetPactCode(this.PatientInfo.Pact.ID);

            //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(Neusoft.FrameWork.Management.Connection.Instance);
            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();
            radt.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            medcareInterfaceProxy.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
            medcareInterfaceProxy.BeginTranscation();

            if (returnValue != 1)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                medcareInterfaceProxy.Rollback();
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("待遇接口获得合同单位失败" + medcareInterfaceProxy.ErrMsg));
                return(-1);
            }

            returnValue = medcareInterfaceProxy.Connect();
            {
                if (returnValue != 1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    medcareInterfaceProxy.Rollback();
                    MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("待遇接口获得合同单位失败" + medcareInterfaceProxy.ErrMsg));
                    return(-1);
                }
            }
            medcareInterfaceProxy.BeginTranscation();
            //returnValue = medcareInterfaceProxy.GetRegInfoInpatient(this.PatientInfo);
            //if (returnValue != 1)
            //{
            //    t.RollBack();
            //    medcareInterfaceProxy.Rollback();
            //    MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("待遇接口获得患者信息失败" + medcareInterfaceProxy.ErrMsg));
            //    return -1;
            //}
            //出院登记(带改)
            returnValue = medcareInterfaceProxy.LogoutInpatient(this.PatientInfo);
            if (returnValue != 1)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                medcareInterfaceProxy.Rollback();
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("待遇接口获出院登记失败" + medcareInterfaceProxy.ErrMsg));
                return(-1);
            }


            int i = radt.OutPatient(PatientInfo);

            this.Err = radt.Err;
            if (i == -1)
            {
                         //失败
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    medcareInterfaceProxy.Rollback();
                    return(-1);
                }
            }
            else if (i == 0)//取消
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                medcareInterfaceProxy.Rollback();
                this.Err = "";
                return(0);
            }
            //zhangjunyi 注释掉 改为commit
            //medcareInterfaceProxy.Rollback();
            if (medcareInterfaceProxy.Commit() < 0)
            {
                Neusoft.FrameWork.Management.PublicTrans.RollBack();
                medcareInterfaceProxy.Rollback();
                this.Err = "医保接口提交事务出错!请检查读卡器连接是否正确";
                return(-1);
            }

            #region addby xuewj 2010-3-15

            if (this.adt == null)
            {
                this.adt = Neusoft.FrameWork.WinForms.Classes.UtilInterface.CreateObject(this.GetType(), typeof(Neusoft.HISFC.BizProcess.Interface.IHE.IADT)) as Neusoft.HISFC.BizProcess.Interface.IHE.IADT;
            }
            if (this.adt != null)
            {
                this.adt.DischargeInpatient(this.PatientInfo);
            }

            #endregion

            Neusoft.FrameWork.Management.PublicTrans.Commit();



            return(1);
        }