/// <summary> /// 病人结算 /// </summary> /// <param name="_costType">结算类型</param> public void CostPat(CostType _costType, FrmCostController controller) { if (zyPatlist == null || zyPatlist.PatListID <= 0) { throw new Exception("请指定一个病人!"); } if (zyPatlist.CureDate.Date > XcDate.ServerDateTime.Date) { throw new Exception("入院日期大于结算日期,不能结算!"); } if (CheckFee() == false) { throw new Exception("该病人的费用发生变化,请重新核对后再结算!"); } switch (_costType) { case CostType.中途结算: #region 中途结算 if (zyPatlist.PatType != "1" && zyPatlist.PatType != "2" && zyPatlist.PatType != "7") { throw new Exception("该病人无法办理[中途]结算!"); } if (patFee.receiveFee > 0) { throw new Exception("该病人已经欠费,请先补交费用再结算!"); } #endregion break; case CostType.出院结算: #region 出院结算 if (zyConfig008 == 0) { if (zyPatlist.PatType != "3") { throw new Exception("该病人没有定义出院,无法办理[出院]结算!"); } } else { if (zyPatlist.PatType == "4" || zyPatlist.PatType == "5") { throw new Exception("该病人已经办理了出院结算!"); } } #endregion break; case CostType.费结算: #region 费结算 if (zyConfig008 == 0) { if (zyPatlist.PatType != "3") { throw new Exception("该病人没有定义出院,无法办理[欠费]结算!"); } } else { if (zyPatlist.PatType == "4" || zyPatlist.PatType == "5") { throw new Exception("该病人已经办理了出院结算!"); } } if (patFee.retreatFee > 0 || patFee.receiveFee == 0) { throw new Exception("该病人没有欠费,不能办理欠费结算!"); } #endregion break; } FrmCostDiag fcd = new FrmCostDiag(_costType, this); fcd.ShowDialog(); if (CheckFee() == false) { throw new Exception("该病人的费用发生变化,请重新核对后再结算!"); } if (fcd.isDiag) { zyPatlist = IfrmCostDiagView.zyPatList; _patType = zyPatlist.PatientCode; int CostmasterID = CostPat((int)_costType, fcd); if (CostmasterID > 0)//住院中途结算 { if (IfrmCostDiagView.Ptt != PrintTicketType.打发票) { IfrmCostView.CostPrint(CostmasterID);//打印发票 } IfrmCostView.BrushPatList(); } else { throw new Exception("结算失败!"); } } }
private int CostPat(int costType, FrmCostDiag fcd) { try { ZY_PresOrder zypo = new ZY_PresOrder(); zypo.PatListID = zyPatlist.PatListID; if (zyConfig008 != 0) { DataTable dt1 = zypo.GetNotSendDurgPresDataTable(); if (dt1.Rows.Count > 0) { throw new Exception("该病人还有未发药的费用!"); } } if (costType != 1) { if (costType == 2) { zyPatlist.PatType = "4"; } else if (costType == 3) { zyPatlist.PatType = "5"; } } ZY_CostMaster zy_CostM = new ZY_CostMaster(); zy_CostM.PatID = zyPatlist.PatID; zy_CostM.PatListID = zyPatlist.PatListID; zy_CostM.Ntype = costType; zy_CostM.Discharge_date = XcDate.ServerDateTime.Date; zy_CostM.Discharge_bdate = zyPatlist.CureDate.Date; //入院日期 zy_CostM.Discharge_edate = zyPatlist.OutDate; //出院日期 zy_CostM.TicketNum = zyCostMaster.GetNewTicketNO(XcDate.ServerDateTime); //? zy_CostM.TicketCode = IfrmCostDiagView.tbTicketNO; //fcd.TicketNo.Trim(); zy_CostM.ChargeCode = user.EmployeeID.ToString(); zy_CostM.Ticket_Flag = (int)IfrmCostDiagView.Ptt; zy_CostM.CostDate = XcDate.ServerDateTime; zy_CostM.Record_Flag = 0; //农合结算 //decimal villageFee = HIS.ZY_BLL.OP_CostManage.NccmCheck_CostPat(zy_CostM, base.zy_PatList); //if (villageFee != 0) // Op_PatFee.SetvillageFee(ref patFee, villageFee); zy_CostM.Total_Fee = Convert.ToDecimal(patFee.costFee.ToString("0.00")); zy_CostM.Deptosit_Fee = Convert.ToDecimal(patFee.chargeFee.ToString("0.00")); zy_CostM.Self_Fee = Convert.ToDecimal(patFee.selfFee.ToString("0.00")); zy_CostM.Village_Fee = Convert.ToDecimal(patFee.villageFee.ToString("0.00")); zy_CostM.Favor_Fee = Convert.ToDecimal(patFee.faoverFee.ToString("0.00")); zy_CostM.Pos_Fee = IfrmCostDiagView.tbPos; zy_CostM.Money_Fee = IfrmCostDiagView.tbFee; zy_CostM.Reality_Fee = zy_CostM.Pos_Fee + zy_CostM.Money_Fee;//实收金额=pos金额+现金金额 zy_CostM.Village_Type = 3; if (_patType.Trim() == "01") { zy_CostM.Village_Type = 3; } else if (_patType.Trim() == "02") { zy_CostM.Village_Type = 2; } else if (_patType.Trim() == "03") { zy_CostM.Village_Type = 0; } else if (_patType.Trim() == "04") { zy_CostM.Village_Type = 1; } else if (_patType.Trim() == "05") { zy_CostM.Village_Type = 3; } else if (_patType.Trim() == "06") { zy_CostM.Village_Type = 3; } zy_CostM.PatType = _patType; zy_CostM.WorkUnit = WorkUnit; zy_CostM.WorkUnit_Fee = workUnit_Fee; zy_CostM.NotWorkUnit_Fee = zy_CostM.Village_Fee - workUnit_Fee; zy_CostM.Ration_Fee = Ration_Fee; zy_CostM.MoreRation_Fee = Ration_Fee != 0 ? (Ration_Fee - zy_CostM.Village_Fee) : 0; zy_CostM.SelfDrug_Fee = Convert.ToDecimal(IfrmCostView.selfDrugFee); //TicketNum = zy_CostM.TicketNum;//add zenghao 090209 DataTable dt = zyCostMaster.GetPatBigItemOrderFee(); List <ZY_CostOrder> zy_CostOL = new List <ZY_CostOrder>(); for (int i = 0; i < dt.Rows.Count; i++) { ZY_CostOrder zy_CostO = new ZY_CostOrder(); zy_CostO.PatID = zyPatlist.PatID; zy_CostO.PatListID = zyPatlist.PatListID; zy_CostO.TicketNum = zy_CostM.TicketNum; zy_CostO.TicketCode = zy_CostM.TicketCode; zy_CostO.BigItemCode = dt.Rows[i]["itemtype"].ToString(); zy_CostO.Total_Fee = Convert.ToDecimal(Convert.ToDecimal(dt.Rows[i]["tolal_fee"]).ToString("0.00")); zy_CostOL.Add(zy_CostO); } zyCostMaster.CostPat(zy_CostM, zy_CostOL, zyPatlist); return(zy_CostM.CostMasterID); } catch (Exception err) { throw new Exception(err.Message); } }