Commit 6c42064d by 李承祥

报表调整

parent 56f8f98f
...@@ -89,6 +89,18 @@ public List<PerReport> Income(int hospitalId, List<string> date) ...@@ -89,6 +89,18 @@ public List<PerReport> Income(int hospitalId, List<string> date)
#region 首页报表 #region 首页报表
/// <summary> /// <summary>
/// 医院收入结构占比
/// </summary>
/// <returns></returns>
public List<PerReport> InHosIncome(int hospitalId, string currentDate)
{
string sql = $"select '{currentDate}' x,'住院收入占比' y,round(t.InHos/(t.InHos+t.Outpatient) * 100, 2) value from (select year,month,sum(case SourceType when '住院' then CellValue else 0 end) InHos,sum(case SourceType when '门诊' then CellValue else 0 end) Outpatient from report_original_income where hospitalid = @hospitalId and concat(year,'-',lpad(month,2,'0')) = '{currentDate}' group by year,month)t" +
$" union " +
$"select '{currentDate}' x,'门诊收入占比' y,round(t.Outpatient/(t.InHos+t.Outpatient) * 100, 2) value from (select year,month,sum(case SourceType when '住院' then CellValue else 0 end) InHos,sum(case SourceType when '门诊' then CellValue else 0 end) Outpatient from report_original_income where hospitalid = @hospitalId and concat(year,'-',lpad(month,2,'0')) = '{currentDate}' group by year,month)t;";
return DapperQuery(sql, new { hospitalId }).ToList();
}
/// <summary>
/// 绩效发放金额 /// 绩效发放金额
/// </summary> /// </summary>
/// <param name="currentDate"></param> /// <param name="currentDate"></param>
...@@ -97,7 +109,7 @@ public List<PerReport> Income(int hospitalId, List<string> date) ...@@ -97,7 +109,7 @@ public List<PerReport> Income(int hospitalId, List<string> date)
/// <returns></returns> /// <returns></returns>
public List<PerReport> PerforPayment(int hospitalId, string currentDate, string yoyDate, string chainDate) public List<PerReport> PerforPayment(int hospitalId, string currentDate, string yoyDate, string chainDate)
{ {
string sql = $"select t1.*,ifnull(t2.RealGiveFee, 0.0000) value from (select '{currentDate}' x,'当月发放金额' y union select '{yoyDate}' x,'同期发放金额' y union select '{chainDate}' x,'环比发放金额' y)t1 left join report_allot_summary t2 on t1.x = concat(t2.year,'-',lpad(t2.month,2,'0')) and t2.HospitalId = @hospitalId;"; string sql = $"select '{currentDate}' x,t1.y,ifnull(t2.RealGiveFee, 0.0000) value from (select '{currentDate}' x,'当月发放金额' y union select '{yoyDate}' x,'同期发放金额' y union select '{chainDate}' x,'环比发放金额' y)t1 left join report_allot_summary t2 on t1.x = concat(t2.year,'-',lpad(t2.month,2,'0')) and t2.HospitalId = @hospitalId;";
return DapperQuery(sql, new { hospitalId }).ToList(); return DapperQuery(sql, new { hospitalId }).ToList();
} }
...@@ -110,7 +122,7 @@ public List<PerReport> PerforPayment(int hospitalId, string currentDate, string ...@@ -110,7 +122,7 @@ public List<PerReport> PerforPayment(int hospitalId, string currentDate, string
/// <returns></returns> /// <returns></returns>
public List<PerReport> IndexPerforRatio(int hospitalId, string currentDate, string yoyDate, string chainDate) public List<PerReport> IndexPerforRatio(int hospitalId, string currentDate, string yoyDate, string chainDate)
{ {
string sql = $"select t1.*, round(ifnull(t2.RealGiveFee, 0.0000)/t3.income*100, 2)value from(select '{currentDate}' x,'当月发放占比' y union select '{yoyDate}' x,'同期发放占比' y union select '{chainDate}' x,'环比发放占比' y)t1 left join report_allot_summary t2 on t1.x = concat(t2.year,'-', lpad(t2.month,2,'0')) and t2.HospitalId = @hospitalId left join (select year, month, sum(CellValue) income from report_original_income where HospitalId = @hospitalId group by year, month)t3 on t1.x = concat(t3.year,'-', lpad(t3.month,2,'0'));"; string sql = $"select '{currentDate}' x,t1.y, round(ifnull(t2.RealGiveFee, 0.0000)/t3.income*100, 2)value from(select '{currentDate}' x,'当月发放占比' y union select '{yoyDate}' x,'同期发放占比' y union select '{chainDate}' x,'环比发放占比' y)t1 left join report_allot_summary t2 on t1.x = concat(t2.year,'-', lpad(t2.month,2,'0')) and t2.HospitalId = @hospitalId left join (select year, month, sum(CellValue) income from report_original_income where HospitalId = @hospitalId group by year, month)t3 on t1.x = concat(t3.year,'-', lpad(t3.month,2,'0'));";
return DapperQuery(sql, new { hospitalId }).ToList(); return DapperQuery(sql, new { hospitalId }).ToList();
} }
...@@ -124,7 +136,7 @@ public List<PerReport> IndexPerforRatio(int hospitalId, string currentDate, stri ...@@ -124,7 +136,7 @@ public List<PerReport> IndexPerforRatio(int hospitalId, string currentDate, stri
/// <returns></returns> /// <returns></returns>
public List<PerReport> IndexDrugRatio(int hospitalId, string currentDate, string yoyDate, string chainDate) public List<PerReport> IndexDrugRatio(int hospitalId, string currentDate, string yoyDate, string chainDate)
{ {
string sql = $"select t1.*,round(t2.CellValue/t3.`value`*100, 2) value from (select '{currentDate}' x,'当月药占比' y union select '{yoyDate}' x,'同期药占比' y union select '{chainDate}' x,'环比药占比' y)t1 left join (select concat(year,'-',lpad(month,2,'0')) date,sum(CellValue) CellValue from report_original_income t1 inner join cof_drugtype t2 on t1.TypeName = t2.Charge and t1.AllotID = t2.AllotId and t2.ChargeType = '药品' where HospitalID = @hospitalId group by year,month) t2 on t1.x = t2.date left join (select concat(year,'-',lpad(month,2,'0')) date,sum(CellValue) value from report_original_income where hospitalid = @hospitalId group by year,month)t3 on t1.x = t3.date;"; string sql = $"select '{currentDate}' x,t1.y,round(t2.CellValue/t3.`value`*100, 2) value from (select '{currentDate}' x,'当月药占比' y union select '{yoyDate}' x,'同期药占比' y union select '{chainDate}' x,'环比药占比' y)t1 left join (select concat(year,'-',lpad(month,2,'0')) date,sum(CellValue) CellValue from report_original_income t1 inner join cof_drugtype t2 on t1.TypeName = t2.Charge and t1.AllotID = t2.AllotId and t2.ChargeType = '药品' where HospitalID = @hospitalId group by year,month) t2 on t1.x = t2.date left join (select concat(year,'-',lpad(month,2,'0')) date,sum(CellValue) value from report_original_income where hospitalid = @hospitalId group by year,month)t3 on t1.x = t3.date;";
return DapperQuery(sql, new { hospitalId }).ToList(); return DapperQuery(sql, new { hospitalId }).ToList();
} }
...@@ -138,7 +150,7 @@ public List<PerReport> IndexDrugRatio(int hospitalId, string currentDate, string ...@@ -138,7 +150,7 @@ public List<PerReport> IndexDrugRatio(int hospitalId, string currentDate, string
/// <returns></returns> /// <returns></returns>
public List<PerReport> IndexMaterialRatio(int hospitalId, string currentDate, string yoyDate, string chainDate) public List<PerReport> IndexMaterialRatio(int hospitalId, string currentDate, string yoyDate, string chainDate)
{ {
string sql = $"select t1.*,round(t2.CellValue/t3.`value`*100, 2) value from (select '{currentDate}' x,'当月材料占比' y union select '{yoyDate}' x,'同期材料占比' y union select '{chainDate}' x,'环比材料占比' y)t1 left join (select concat(year,'-',lpad(month,2,'0')) date,sum(CellValue) CellValue from report_original_income t1 inner join cof_drugtype t2 on t1.TypeName = t2.Charge and t1.AllotID = t2.AllotId and t2.ChargeType = '耗材' where HospitalID = @hospitalId group by year,month) t2 on t1.x = t2.date left join (select concat(year,'-',lpad(month,2,'0')) date,sum(CellValue) value from report_original_income where hospitalid = @hospitalId group by year,month)t3 on t1.x = t3.date;"; string sql = $"select '{currentDate}' x,t1.y,round(t2.CellValue/t3.`value`*100, 2) value from (select '{currentDate}' x,'当月材料占比' y union select '{yoyDate}' x,'同期材料占比' y union select '{chainDate}' x,'环比材料占比' y)t1 left join (select concat(year,'-',lpad(month,2,'0')) date,sum(CellValue) CellValue from report_original_income t1 inner join cof_drugtype t2 on t1.TypeName = t2.Charge and t1.AllotID = t2.AllotId and t2.ChargeType = '耗材' where HospitalID = @hospitalId group by year,month) t2 on t1.x = t2.date left join (select concat(year,'-',lpad(month,2,'0')) date,sum(CellValue) value from report_original_income where hospitalid = @hospitalId group by year,month)t3 on t1.x = t3.date;";
return DapperQuery(sql, new { hospitalId }).ToList(); return DapperQuery(sql, new { hospitalId }).ToList();
} }
...@@ -171,7 +183,7 @@ public List<PerReport> GeneralIncome(ReportRequest request) ...@@ -171,7 +183,7 @@ public List<PerReport> GeneralIncome(ReportRequest request)
} }
string sql = $"select year x,'业务总收入(年)' y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by year;"; string sql = $"select year x,'业务总收入(年)' y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by year;";
if (request.OnlyYear != 1) if (request.OnlyYear != 1)
sql = $"select concat(year,'-',lpad(month,2,'0')) x,'业务总收入(月)' y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by year,month;"; sql = $"select month x,year y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by year,month;";
return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList(); return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList();
} }
...@@ -190,13 +202,13 @@ public List<PerReport> InHosIncome(ReportRequest request) ...@@ -190,13 +202,13 @@ public List<PerReport> InHosIncome(ReportRequest request)
{ {
where += $" and month in ({request.Month}) "; where += $" and month in ({request.Month}) ";
} }
string sql = $"select '住院' x,year y,round(t.InHos/(t.InHos + t.Outpatient) * 100, 2) value from (select year,sum(case SourceType when '住院' then CellValue else 0 end) InHos,sum(case SourceType when '门诊' then CellValue else 0 end) Outpatient from report_original_income where hospitalid = @hospitalId {where} group by year)t" + string sql = $"select '住院' y,year x,round(t.InHos/(t.InHos + t.Outpatient) * 100, 2) value from (select year,sum(case SourceType when '住院' then CellValue else 0 end) InHos,sum(case SourceType when '门诊' then CellValue else 0 end) Outpatient from report_original_income where hospitalid = @hospitalId {where} group by year)t" +
$" union " + $" union " +
$"select '门诊' x,year y,round(t.Outpatient/(t.InHos + t.Outpatient) * 100, 2) value from (select year,sum(case SourceType when '住院' then CellValue else 0 end) InHos,sum(case SourceType when '门诊' then CellValue else 0 end) Outpatient from report_original_income where hospitalid = @hospitalId {where} group by year)t;"; $"select '门诊' y,year x,round(t.Outpatient/(t.InHos + t.Outpatient) * 100, 2) value from (select year,sum(case SourceType when '住院' then CellValue else 0 end) InHos,sum(case SourceType when '门诊' then CellValue else 0 end) Outpatient from report_original_income where hospitalid = @hospitalId {where} group by year)t;";
if (request.OnlyYear != 1) if (request.OnlyYear != 1)
sql = $"select '住院' x,concat(year,'-',lpad(month,2,'0')) y,round(t.InHos/(t.InHos+t.Outpatient) * 100, 2) value from (select year,month,sum(case SourceType when '住院' then CellValue else 0 end) InHos,sum(case SourceType when '门诊' then CellValue else 0 end) Outpatient from report_original_income where hospitalid = @hospitalId {where} group by year,month)t" + sql = $"select '住院' y,month x,round(t.InHos/(t.InHos+t.Outpatient) * 100, 2) value from (select year,month,sum(case SourceType when '住院' then CellValue else 0 end) InHos,sum(case SourceType when '门诊' then CellValue else 0 end) Outpatient from report_original_income where hospitalid = @hospitalId {where} group by month)t" +
$" union " + $" union " +
$"select '门诊' x,concat(year,'-',lpad(month,2,'0')) y,round(t.Outpatient/(t.InHos+t.Outpatient) * 100, 2) value from (select year,month,sum(case SourceType when '住院' then CellValue else 0 end) InHos,sum(case SourceType when '门诊' then CellValue else 0 end) Outpatient from report_original_income where hospitalid = @hospitalId {where} group by year,month)t;"; $"select '门诊' y,month x,round(t.Outpatient/(t.InHos+t.Outpatient) * 100, 2) value from (select year,month,sum(case SourceType when '住院' then CellValue else 0 end) InHos,sum(case SourceType when '门诊' then CellValue else 0 end) Outpatient from report_original_income where hospitalid = @hospitalId {where} group by month)t;";
return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList(); return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList();
} }
...@@ -215,9 +227,9 @@ public List<PerReport> StructRatio(ReportRequest request) ...@@ -215,9 +227,9 @@ public List<PerReport> StructRatio(ReportRequest request)
{ {
where += $" and month in ({request.Month}) "; where += $" and month in ({request.Month}) ";
} }
string sql = $"select TypeName x,t1.y,round(CellValue/t2.`value`*100,2) value from (select year y,TypeName,sum(CellValue) CellValue from report_original_income where HospitalID = @hospitalId {where} group by year,TypeName) t1 inner join (select year y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by year)t2 on t1.y = t2.y order by y asc,value desc;"; string sql = $"select TypeName y,t1.y x,round(CellValue/t2.`value`*100,2) value from (select year y,TypeName,sum(CellValue) CellValue from report_original_income where HospitalID = @hospitalId {where} group by year,TypeName) t1 inner join (select year y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by year)t2 on t1.y = t2.y order by x asc,value desc;";
if (request.OnlyYear != 1) if (request.OnlyYear != 1)
sql = $"select TypeName x,t1.y,round(CellValue/t2.`value`*100,2) value from (select concat(year,'-',lpad(month,2,'0')) y,TypeName,sum(CellValue) CellValue from report_original_income where HospitalID = @hospitalId {where} group by year,month,TypeName) t1 inner join (select concat(year,'-',lpad(month,2,'0')) y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by year,month)t2 on t1.y = t2.y order by y asc,value desc;"; sql = $"select TypeName y,t1.y x,round(CellValue/t2.`value`*100,2) value from (select month y,TypeName,sum(CellValue) CellValue from report_original_income where HospitalID = @hospitalId {where} group by month,TypeName) t1 inner join (select month y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by month)t2 on t1.y = t2.y order by x asc,value desc;";
return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList(); return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList();
} }
...@@ -238,9 +250,9 @@ public List<PerReport> DrugRatio(ReportRequest request) ...@@ -238,9 +250,9 @@ public List<PerReport> DrugRatio(ReportRequest request)
{ {
where += $" and month in ({request.Month}) "; where += $" and month in ({request.Month}) ";
} }
string sql = $"select TypeName x,t1.y,round(CellValue/t2.`value`*100,2) value from (select year y,TypeName,sum(CellValue) CellValue from report_original_income t1 inner join cof_drugtype t2 on t1.TypeName = t2.Charge and t1.AllotID = t2.AllotId and t2.ChargeType = '药品' where HospitalID = @hospitalId {where} group by year,TypeName) t1 inner join (select year y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by year)t2 on t1.y = t2.y;"; string sql = $"select TypeName y,t1.y x,round(CellValue/t2.`value`*100,2) value from (select year y,TypeName,sum(CellValue) CellValue from report_original_income t1 inner join cof_drugtype t2 on t1.TypeName = t2.Charge and t1.AllotID = t2.AllotId and t2.ChargeType = '药品' where HospitalID = @hospitalId {where} group by year,TypeName) t1 inner join (select year y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by year)t2 on t1.y = t2.y;";
if (request.OnlyYear != 1) if (request.OnlyYear != 1)
sql = $"select TypeName x,t1.y,round(CellValue/t2.`value`*100,2) value from (select concat(year,'-',lpad(month,2,'0')) y,TypeName,sum(CellValue) CellValue from report_original_income t1 inner join cof_drugtype t2 on t1.TypeName = t2.Charge and t1.AllotID = t2.AllotId and t2.ChargeType = '药品' where HospitalID = @hospitalId {where} group by year,month,TypeName) t1 inner join (select concat(year,'-',lpad(month,2,'0')) y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by year,month)t2 on t1.y = t2.y;"; sql = $"select TypeName y,t1.y x,round(CellValue/t2.`value`*100,2) value from (select month y,TypeName,sum(CellValue) CellValue from report_original_income t1 inner join cof_drugtype t2 on t1.TypeName = t2.Charge and t1.AllotID = t2.AllotId and t2.ChargeType = '药品' where HospitalID = @hospitalId {where} group by month,TypeName) t1 inner join (select month y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by month)t2 on t1.y = t2.y;";
return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList(); return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList();
} }
...@@ -261,9 +273,9 @@ public List<PerReport> MaterialRatio(ReportRequest request) ...@@ -261,9 +273,9 @@ public List<PerReport> MaterialRatio(ReportRequest request)
{ {
where += $" and month in ({request.Month}) "; where += $" and month in ({request.Month}) ";
} }
string sql = $"select TypeName x,t1.y,round(CellValue/t2.`value`*100,2) value from (select year y,TypeName,sum(CellValue) CellValue from report_original_income t1 inner join cof_drugtype t2 on t1.TypeName = t2.Charge and t1.AllotID = t2.AllotId and t2.ChargeType = '耗材' where HospitalID = @hospitalId {where} group by year,TypeName) t1 inner join (select year y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by year)t2 on t1.y = t2.y;"; string sql = $"select TypeName y,t1.y x,round(CellValue/t2.`value`*100,2) value from (select year y,TypeName,sum(CellValue) CellValue from report_original_income t1 inner join cof_drugtype t2 on t1.TypeName = t2.Charge and t1.AllotID = t2.AllotId and t2.ChargeType = '耗材' where HospitalID = @hospitalId {where} group by year,TypeName) t1 inner join (select year y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by year)t2 on t1.y = t2.y;";
if (request.OnlyYear != 1) if (request.OnlyYear != 1)
sql = $"select TypeName x,t1.y,round(CellValue/t2.`value`*100,2) value from (select concat(year,'-',lpad(month,2,'0')) y,TypeName,sum(CellValue) CellValue from report_original_income t1 inner join cof_drugtype t2 on t1.TypeName = t2.Charge and t1.AllotID = t2.AllotId and t2.ChargeType = '耗材' where HospitalID = @hospitalId {where} group by year,month,TypeName) t1 inner join (select concat(year,'-',lpad(month,2,'0')) y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by year,month)t2 on t1.y = t2.y;"; sql = $"select TypeName y,t1.y x,round(CellValue/t2.`value`*100,2) value from (select month y,TypeName,sum(CellValue) CellValue from report_original_income t1 inner join cof_drugtype t2 on t1.TypeName = t2.Charge and t1.AllotID = t2.AllotId and t2.ChargeType = '耗材' where HospitalID = @hospitalId {where} group by month,TypeName) t1 inner join (select month y,sum(CellValue) value from report_original_income where hospitalid = @hospitalId {where} group by month)t2 on t1.y = t2.y;";
return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList(); return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList();
} }
...@@ -286,7 +298,7 @@ public List<PerReport> PerforRatio(ReportRequest request) ...@@ -286,7 +298,7 @@ public List<PerReport> PerforRatio(ReportRequest request)
} }
string sql = $"select t2.x,'绩效发放金额占全院收入占比(年)' y,round(t1.RealGiveFee/t2.income * 100, 2) value from (select `year`,sum(realgivefee) realgivefee from report_allot_summary where HospitalID = @hospitalId {where} group by year) t1 inner join (select year x,sum(CellValue) income from report_original_income where HospitalId = @hospitalId {where} group by year)t2 on t1.`Year` = t2.x;"; string sql = $"select t2.x,'绩效发放金额占全院收入占比(年)' y,round(t1.RealGiveFee/t2.income * 100, 2) value from (select `year`,sum(realgivefee) realgivefee from report_allot_summary where HospitalID = @hospitalId {where} group by year) t1 inner join (select year x,sum(CellValue) income from report_original_income where HospitalId = @hospitalId {where} group by year)t2 on t1.`Year` = t2.x;";
if (request.OnlyYear != 1) if (request.OnlyYear != 1)
sql = $"select t2.x,'绩效发放金额占全院收入占比(月)' y,round(t1.RealGiveFee/t2.income * 100, 2) value from report_allot_summary t1 inner join (select concat(year,'-',lpad(month,2,'0')) x,sum(CellValue) income from report_original_income where HospitalId = @hospitalId {where} group by year,month)t2 on concat(t1.year,'-',lpad(t1.month,2,'0')) = t2.x where t1.HospitalID = @hospitalId {where};"; sql = $"select t2.x,t2.y,round(t1.RealGiveFee/t2.income * 100, 2) value from (select `month`,sum(realgivefee) realgivefee from report_allot_summary where HospitalID = @hospitalId {where} group by month) t1 inner join (select month x,year y,sum(CellValue) income from report_original_income where HospitalId = @hospitalId {where} group by month)t2 on t1.month = t2.x ;";
return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList(); return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList();
} }
...@@ -307,9 +319,9 @@ public List<PerReport> PerforGroup(ReportRequest request) ...@@ -307,9 +319,9 @@ public List<PerReport> PerforGroup(ReportRequest request)
{ {
where += $" and month in ({request.Month}) "; where += $" and month in ({request.Month}) ";
} }
string sql = $"select PositionName x,year y,round(sum(avgvalue), 2) value from (select t1.PositionName,year,AvgValue from res_baiscnorm t1 inner join per_allot t2 on t1.AllotID = t2.Id and t2.HospitalId = @hospitalId {where} and locate('保底', t1.PositionName) = 0)t group by PositionName,year;"; string sql = $"select PositionName y,year x,round(sum(avgvalue), 2) value from (select t1.PositionName,year,AvgValue from res_baiscnorm t1 inner join per_allot t2 on t1.AllotID = t2.Id and t2.HospitalId = @hospitalId {where} and locate('保底', t1.PositionName) = 0)t group by PositionName,year order by value desc;";
if (request.OnlyYear != 1) if (request.OnlyYear != 1)
sql = $"select t1.PositionName x, concat(t2.year, '-', lpad(t2.month, 2, '0')) y,round(AvgValue, 2) value from res_baiscnorm t1 inner join per_allot t2 on t1.AllotID = t2.Id and t2.HospitalId = @hospitalId {where} and locate('保底', t1.PositionName) = 0;"; sql = $"select PositionName y,month x,round(sum(avgvalue), 2) value from (select t1.PositionName,month,AvgValue from res_baiscnorm t1 inner join per_allot t2 on t1.AllotID = t2.Id and t2.HospitalId = @hospitalId {where} and locate('保底', t1.PositionName) = 0)t group by PositionName,month order by value desc;";
return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList(); return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList();
} }
...@@ -330,9 +342,9 @@ public List<PerReport> DoctorAvg(ReportRequest request) ...@@ -330,9 +342,9 @@ public List<PerReport> DoctorAvg(ReportRequest request)
{ {
where += $" and t2.month in ({request.Month}) "; where += $" and t2.month in ({request.Month}) ";
} }
string sql = $"select `Year` y,AccountingUnit x,round(sum(avg),2) value from (select t1.AccountingUnit,t1.Avg,t2.`Year`,t2.`Month`,t2.ID from res_account t1 inner join per_allot t2 on t1.AllotID = t2.ID and t2.HospitalId = @hospitalId and t1.UnitType != 2 where 1=1 {where})t group by year,AccountingUnit;"; string sql = $"select `Year` x,AccountingUnit y,round(sum(avg),2) value from (select t1.AccountingUnit,t1.Avg,t2.`Year`,t2.`Month`,t2.ID from res_account t1 inner join per_allot t2 on t1.AllotID = t2.ID and t2.HospitalId = @hospitalId and t1.UnitType != 2 where 1=1 {where})t group by year,AccountingUnit order by value desc;";
if (request.OnlyYear != 1) if (request.OnlyYear != 1)
sql = $"select concat(year,'-',lpad(month,2,'0')) y,AccountingUnit x,round(sum(avg),2) value from (select t1.AccountingUnit,t1.Avg,t2.`Year`,t2.`Month`,t2.ID from res_account t1 inner join per_allot t2 on t1.AllotID = t2.ID and t2.HospitalId = @hospitalId and t1.UnitType != 2 where 1=1 {where})t group by year,month,AccountingUnit;"; sql = $"select month x,AccountingUnit y,round(sum(avg),2) value from (select t1.AccountingUnit,t1.Avg,t2.`Year`,t2.`Month`,t2.ID from res_account t1 inner join per_allot t2 on t1.AllotID = t2.ID and t2.HospitalId = @hospitalId and t1.UnitType != 2 where 1=1 {where})t group by month,AccountingUnit order by value desc;";
return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList(); return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList();
} }
...@@ -353,9 +365,9 @@ public List<PerReport> NurseAvg(ReportRequest request) ...@@ -353,9 +365,9 @@ public List<PerReport> NurseAvg(ReportRequest request)
{ {
where += $" and t2.month in ({request.Month}) "; where += $" and t2.month in ({request.Month}) ";
} }
string sql = $"select `Year` y,AccountingUnit x,round(sum(avg),2) value from (select t1.AccountingUnit,t1.Avg,t2.`Year`,t2.`Month`,t2.ID from res_account t1 inner join per_allot t2 on t1.AllotID = t2.ID and t2.HospitalId = @hospitalId and t1.UnitType = 2 where 1=1 {where})t group by year,AccountingUnit;"; string sql = $"select `Year` x,AccountingUnit y,round(sum(avg),2) value from (select t1.AccountingUnit,t1.Avg,t2.`Year`,t2.`Month`,t2.ID from res_account t1 inner join per_allot t2 on t1.AllotID = t2.ID and t2.HospitalId = @hospitalId and t1.UnitType = 2 where 1=1 {where})t group by year,AccountingUnit order by value desc;";
if (request.OnlyYear != 1) if (request.OnlyYear != 1)
sql = $"select concat(year,'-',lpad(month,2,'0')) y,AccountingUnit x,round(sum(avg),2) value from (select t1.AccountingUnit,t1.Avg,t2.`Year`,t2.`Month`,t2.ID from res_account t1 inner join per_allot t2 on t1.AllotID = t2.ID and t2.HospitalId = @hospitalId and t1.UnitType = 2 where 1=1 {where})t group by year,month,AccountingUnit;"; sql = $"select month x,AccountingUnit y,round(sum(avg),2) value from (select t1.AccountingUnit,t1.Avg,t2.`Year`,t2.`Month`,t2.ID from res_account t1 inner join per_allot t2 on t1.AllotID = t2.ID and t2.HospitalId = @hospitalId and t1.UnitType = 2 where 1=1 {where})t group by month,AccountingUnit order by value desc;";
return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList(); return DapperQuery(sql, new { hospitalId = request.HospitalId }).ToList();
} }
#endregion #endregion
......
...@@ -254,6 +254,9 @@ public List<PerReport> IndexReport(int hospitalId, string source) ...@@ -254,6 +254,9 @@ public List<PerReport> IndexReport(int hospitalId, string source)
var report = new List<PerReport>(); var report = new List<PerReport>();
switch (source) switch (source)
{ {
case "医院收入结构占比":
report = perforReportRepository.InHosIncome(hospitalId, currentDate);
break;
case "绩效发放金额": case "绩效发放金额":
report = perforReportRepository.PerforPayment(hospitalId, currentDate, yoyDate, chainDate); report = perforReportRepository.PerforPayment(hospitalId, currentDate, yoyDate, chainDate);
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment