/// <summary> /// 构造一个结算业务类,每个对象的实例对应一次业务操作 /// 处理过程:保存处方->预算->正式结算->打印发票(可选) /// </summary> /// <param name="Patient">需要结算的病人对象</param> /// <param name="OperatorId">操作员</param> public ChargeControl(OutPatient Patient, int OperatorId) { patient = Patient; userId = OperatorId; ChargeType chargeType = ChargeType.多张处方一次结算;//考虑使用参数 //根据病人类型实例化结算对象 chargeObject = ChargeFactory.CreateChargeObject(Patient, OperatorId, chargeType); }
/// <summary> /// 查找病人信息 /// </summary> /// <param name="strWhere">查询条件</param> /// <returns></returns> public static OutPatient[] GetPatient(string strWhere) { List <HIS.Model.MZ_PatList> patList = MSAccessDb.GetListArray <MZ_PatList>("MZ_PATLIST", strWhere); OutPatient[] patients = new OutPatient[patList.Count]; for (int i = 0; i < patList.Count; i++) { patients[i] = new OutPatient(patList[i].PatListID); } return(patients); }
/// <summary> /// 构造收费对象实例 /// </summary> /// <param name="Patient">病人对象</param> /// <param name="OperatorId">操作员ID,取EmployeeId</param> /// <returns></returns> public static BaseCharge CreateChargeObject(OutPatient Patient, int OperatorId, ChargeType chargeType) { if (chargeType == ChargeType.一张处方一次结算) { return(new GeneralCharge(Patient, OperatorId, chargeType)); } else { return(new GeneralChargeEx(Patient, OperatorId, chargeType)); } //if ( Patient.MediType == "2" ) // return new NccmCharge( Patient , OperatorId , chargeType ); //throw new OperatorException( "未实现的结算对象" ); }
private void txtInvoiceNo_Leave(object sender, EventArgs e) { if (txtInvoiceNo.Text.Trim( ) == "") { return; } try { currentPatient = new OutPatient(txtInvoiceNo.Text, OPDBillKind.门诊收费发票); txtPatientName.Text = currentPatient.PatientName; lblFeeType.Text = DataReader.GetPatientTypeNameByCode(currentPatient.MediType); currentInvoice = new Invoice(txtPerfChar.Text.Trim(), txtInvoiceNo.Text, OPDBillKind.门诊收费发票); if (currentInvoice.RecordFlag != 0) { MessageBox.Show("该发票已经退费,请确认输入的发票号是否正确!"); txtInvoiceNo.Focus( ); return; } lstRetYP = null;//DataReader.GetDrugReturnValueList( currentInvoice.InvoiceNo ); ShowPrescriptions(currentInvoice.Prescription, lstRetYP); lblTotal.Text = currentInvoice.TotalPay.ToString("0.00"); lblCash.Text = currentInvoice.CashPay.ToString("0.00"); lblPOS.Text = currentInvoice.PosPay.ToString("0.00"); lblChargeUp.Text = currentInvoice.VillagePay.ToString("0.00"); lblFover.Text = currentInvoice.FavorPay.ToString("0.00"); lblSelfTally.Text = currentInvoice.SelfTally.ToString("0.00"); } catch (Exception err) { MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); txtInvoiceNo.Focus( ); txtInvoiceNo.Text = ""; txtPatientName.Text = ""; lblFeeType.Text = ""; dgvPresc.Rows.Clear( ); lblCash.Text = "0.00"; lblChargeUp.Text = "0.00"; lblFover.Text = "0.00"; lblPOS.Text = "0.00"; lblTotal.Text = "0.00"; } }
/// <summary> /// 收费基类 /// </summary> /// <param name="Patient"></param> /// <param name="OperatorId"></param> public BaseCharge(OutPatient Patient, int OperatorId, ChargeType _ChargeType) { _patient = Patient; _operatorId = OperatorId; chargeType = _ChargeType; }
/// <summary> /// 门诊结算对象,该对象实现多张处方一次结算的功能 /// </summary> /// <param name="Patient">要结算的病人对象</param> /// <param name="OperatorId">操作员</param> public GeneralChargeEx(OutPatient Patient, int OperatorId, ChargeType _ChargeType) : base(Patient, OperatorId, _ChargeType) { }
/// <summary> /// 退费处理 /// </summary> private void RefundmentProcess() { if (_EmployeeID != Convert.ToInt32(currentInvoice.ChargeUserId)) { throw new Exception("该发票不是您收费,需收费员【" + currentInvoice.ChargeUser + "】才能退费!"); } //得到新的处方 Prescription[] remanentPrescriptions = GetPrescriptionRemanentFromGrid(true); if (remanentPrescriptions == null) { throw new Exception("至少需要指定一条需要退费项目的数量!"); } //整理处方,除去0数量和没有明细的处方 List <Prescription> lstPrescription = new List <Prescription>( ); for (int i = 0; i < remanentPrescriptions.Length; i++) { remanentPrescriptions[i].PrescriptionID = 0; List <PrescriptionDetail> lstDetail = new List <PrescriptionDetail>( ); for (int j = 0; j < remanentPrescriptions[i].PresDetails.Length; j++) { remanentPrescriptions[i].PresDetails[j].DetailId = 0; if (remanentPrescriptions[i].PresDetails[j].Tolal_Fee != 0) { lstDetail.Add(remanentPrescriptions[i].PresDetails[j]); } } remanentPrescriptions[i].Modified = true; if (lstDetail.Count > 0) { remanentPrescriptions[i].PresDetails = lstDetail.ToArray( ); lstPrescription.Add(remanentPrescriptions[i]); } } remanentPrescriptions = lstPrescription.ToArray( ); if (remanentPrescriptions.Length == 0) { remanentPrescriptions = null; } if (remanentPrescriptions != null) { } ChargeControl chargeController = new ChargeControl(currentPatient, _EmployeeID); try { decimal newcost = 0; decimal newmoneypay = 0; decimal newpos = 0; decimal newfoverpay = 0; decimal newtally = 0; decimal invoiceCount = 0; if (chargeController.Refundment(currentInvoice, remanentPrescriptions)) { if (remanentPrescriptions != null) { if (chargeController.SavePrescription(remanentPrescriptions)) { if (MessageBox.Show("还有需要重新收费的处方,是否由系统自动收费?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { MessageBox.Show("用户已取消操作,需要重新收费的处方还未收费,请转到收费窗口继续收费!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); ReturnPatient = currentPatient; HasPresNeedBalance = true; return; } if (MessageBox.Show("需要重新打印发票收据,请确认发票是否已经准备就绪!", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { MessageBox.Show("用户已取消操作,需要重新收费的处方还未收费,请转到收费窗口继续收费!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); ReturnPatient = currentPatient; HasPresNeedBalance = true; return; } ChargeInfo[] chargeInfos = chargeController.Budget(remanentPrescriptions); #region 合计结算信息并显示给用户 //累计结算信息 ChargeInfo totalChargeInfo = new ChargeInfo( ); for (int i = 0; i < chargeInfos.Length; i++) { totalChargeInfo.TotalFee += chargeInfos[i].TotalFee; totalChargeInfo.FavorFee += chargeInfos[i].FavorFee; totalChargeInfo.SelfFee += chargeInfos[i].SelfFee; totalChargeInfo.VillageFee += chargeInfos[i].VillageFee; } //向用户展示结算信息 FrmChargeInfo frmChargeInfo = new FrmChargeInfo(totalChargeInfo, true); frmChargeInfo.ShowDialog( ); chargeController.SetChargeInfoPay(ref chargeInfos, frmChargeInfo.ReturnChargeInfo.VillageFee, frmChargeInfo.ReturnChargeInfo.PosFee, frmChargeInfo.ReturnChargeInfo.CashFee, frmChargeInfo.ReturnChargeInfo.SelfTally); #endregion Invoice[] invoices; chargeController.Charge(chargeInfos, remanentPrescriptions, out invoices); PrintController.PrintChargeInvoice(invoices); invoiceCount = invoices.Length; for (int i = 0; i < invoices.Length; i++) { newcost += invoices[i].TotalPay; newmoneypay += invoices[i].CashPay; newpos += invoices[i].PosPay; newfoverpay += invoices[i].FavorPay; newtally += invoices[i].VillagePay; } } } decimal returncost = currentInvoice.TotalPay - newcost; decimal returnmoneypay = currentInvoice.CashPay - newmoneypay; decimal returnpos = currentInvoice.PosPay - newpos; decimal returnfoverpay = currentInvoice.FavorPay - newfoverpay; decimal returntally = currentInvoice.VillagePay - newtally; MessageBox.Show("本次操作完成!\r\n需要退病人金额:" + returncost + "元,其中:" + "\r\n退 现 金:" + returnmoneypay + "元" + "\r\n退 POS :" + returnpos + "元" + "\r\n退 优 惠:" + returnfoverpay + "元" + "\r\n退 记 账:" + returntally + "元" + "\r\n\r\n新打发票:" + invoiceCount + "张" + "\r\n总 金 额:" + newcost + "元", "退费成功", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception err) { MessageBox.Show("退费失败!\r\n可能的原因;+\r\n" + err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information); } }