/// <summary> /// 确切的计算最小项目的减免金额 /// </summary> /// <param name="DerateCost"></param> /// <param name="List"></param> /// <param name="DerateTotal"></param> /// <returns></returns> private ArrayList CalculateDerateCost(decimal DerateCost, ArrayList List, decimal DerateTotal) { ArrayList costList = null; try { decimal costSum = 0; if (List != null && DerateCost >= 0) { costList = new ArrayList(); if (List.Count == 0) { return(List); } Neusoft.HISFC.Models.Fee.Inpatient.FeeInfo FeeRate = null; if (List.Count > 1) { for (int i = 0; i < List.Count - 1; i++) { FeeRate = new Neusoft.HISFC.Models.Fee.Inpatient.FeeInfo(); FeeRate.Item.MinFee.ID = ((Neusoft.HISFC.Models.Fee.Inpatient.FeeInfo)List[i]).Item.MinFee.ID; decimal temp = ((Neusoft.HISFC.Models.Fee.Inpatient.FeeInfo)List[i]).FT.OwnCost; FeeRate.FT.TotCost = Neusoft.FrameWork.Public.String.FormatNumber((temp / DerateTotal) * DerateCost, 2); FeeRate.FT.OwnCost = FeeRate.FT.TotCost; costSum = costSum + FeeRate.FT.TotCost; costList.Add(FeeRate); FeeRate = null; } FeeRate = new Neusoft.HISFC.Models.Fee.Inpatient.FeeInfo(); FeeRate.Item.MinFee.ID = ((Neusoft.HISFC.Models.Fee.Inpatient.FeeInfo)List[List.Count - 1]).Item.MinFee.ID; FeeRate.FT.TotCost = DerateCost - costSum; FeeRate.FT.OwnCost = FeeRate.FT.TotCost; costList.Add(FeeRate); FeeRate = null; } else { FeeRate = new Neusoft.HISFC.Models.Fee.Inpatient.FeeInfo(); //FeeRate.Item.ID = ((Neusoft.HISFC.Models.Fee.Inpatient.FeeInfo)List[List.Count - 1]).Item.MinFee.ID; //luzhp 2008-3-31减免金额 //{372537A2-51BD-4113-A1CE-991C98391ECD} FeeRate.Item.MinFee.ID = ((Neusoft.HISFC.Models.Fee.Inpatient.FeeInfo)List[0]).Item.MinFee.ID; FeeRate.FT.TotCost = DerateCost; FeeRate.FT.OwnCost = FeeRate.FT.TotCost; costList.Add(FeeRate); } } } catch (Exception ee) { this.Err = ee.Message; costList = null; } return(costList); }
/// <summary> /// 得到减免的费用及金额 按最小费用分类{BD300517-D927-43c0-A1D3-8FB99BD10298} /// </summary> /// <param name="clinicNo"></param> /// <returns></returns> //public ArrayList GetFeeCodeAndDerateCost(string clinicNo) //{ // //SELECT FEE_CODE ,SUM(DERATE_COST) FROM FIN_COM_DERATE WHERE CLINIC_NO ='{0}' AND PARENT_CODE = '[父级编码]' AND CURRENT_CODE ='[本级编码]' GROUP BY FEE_CODE // ArrayList List = null; // string strSql=""; // if (this.Sql.GetSql("Management.Fee.GetFeeCodeAndDerateCost1",ref strSql)==-1) return null; // try // { // strSql = string.Format(strSql,clinicNo); // this.ExecQuery(strSql); // Neusoft.HISFC.Models.Fee.Rate info = null; // List = new ArrayList(); // while(this.Reader.Read()) // { // info = new Neusoft.HISFC.Models.Fee.Rate(); // if(Reader[0]!=null) // { // info.FeeCode =Reader[0].ToString(); //住院流水号 // } // try // { // info.derate_Cost = Convert.ToDecimal(Reader[1]); // } // catch(Exception ee) // { // string Error = ee.Message; // info.derate_Cost = Convert.ToDecimal(0); // } // List.Add(info); // info = null; // } // this.Reader.Close(); // } // catch(Exception ee) // { // string Error = ee.Message; // } // return List; //} /// <summary> /// 得到减免的费用及金额 按最小费用分类{BD300517-D927-43c0-A1D3-8FB99BD10298} /// </summary> /// <param name="clinicNo"></param> /// <returns></returns> public ArrayList GetFeeCodeAndDerateCost(string clinicNo, string balanceNO) { //SELECT FEE_CODE ,SUM(DERATE_COST) FROM FIN_COM_DERATE WHERE CLINIC_NO ='{0}' AND PARENT_CODE = '[父级编码]' AND CURRENT_CODE ='[本级编码]' GROUP BY FEE_CODE ArrayList List = null; string strSql = ""; if (this.Sql.GetSql("Management.Fee.GetFeeCodeAndDerateCost1", ref strSql) == -1) { return(null); } try { strSql = string.Format(strSql, clinicNo, balanceNO); this.ExecQuery(strSql); //{8D6068F9-058A-4a25-976A-FB4C68834FA9} //Neusoft.HISFC.Models.Fee.Rate info = null; Neusoft.HISFC.Models.Fee.Inpatient.FeeInfo info; List = new ArrayList(); while (this.Reader.Read()) { //{8D6068F9-058A-4a25-976A-FB4C68834FA9} //info = new Neusoft.HISFC.Models.Fee.Rate(); info = new Neusoft.HISFC.Models.Fee.Inpatient.FeeInfo(); if (Reader[0] != null) { //{8D6068F9-058A-4a25-976A-FB4C68834FA9} //info.FeeCode =Reader[0].ToString(); //住院流水号 info.Item.MinFee.ID = Reader[0].ToString(); // } try { //{8D6068F9-058A-4a25-976A-FB4C68834FA9} //info.derate_Cost = Convert.ToDecimal(Reader[1]); info.FT.OwnCost = Convert.ToDecimal(Reader[1]); info.FT.TotCost = Convert.ToDecimal(Reader[1]); } catch (Exception ee) { string Error = ee.Message; //{8D6068F9-058A-4a25-976A-FB4C68834FA9} //info.derate_Cost = Convert.ToDecimal(0); info.FT.TotCost = Convert.ToDecimal(0); info.FT.OwnCost = Convert.ToDecimal(0); } List.Add(info); info = null; } this.Reader.Close(); } catch (Exception ee) { string Error = ee.Message; } return(List); }
/// <summary> /// 根据减免总额 分派最小项目的减免金额 /// </summary> /// <param name="clinicNo"></param> /// <param name="DerateCost">减免总额</param> /// <param name="DerateTotal">分摊的总费用</param> /// <returns></returns> public ArrayList GetFeeCodeAndDerateCost(string clinicNo, decimal DerateCost, decimal DerateTotal) { //select fee_code,sum(own_cost) from fin_ipb_feeinfo where parent_code ='[父级编码]' and current_code ='[本级编码]' and inpatient_no ='{0}' and balance_state ='0' group by fee_code ArrayList costList = null; string strSql = ""; if (this.Sql.GetSql("Management.Fee.GetFeeCodeAndDerateCost2", ref strSql) == -1) { return(null); } try { ArrayList List = null; strSql = string.Format(strSql, clinicNo); this.ExecQuery(strSql); Neusoft.HISFC.Models.Fee.Inpatient.FeeInfo info = null; List = new ArrayList(); while (this.Reader.Read()) { info = new Neusoft.HISFC.Models.Fee.Inpatient.FeeInfo(); info.Item.MinFee.ID = Reader[0].ToString(); info.FT.OwnCost = Convert.ToDecimal(Reader[1]); List.Add(info); info = null; } this.Reader.Close(); costList = CalculateDerateCost(DerateCost, List, DerateTotal); } catch (Exception ee) { //出错,返回null this.Err = ee.Message; costList = null; } return(costList); }