@@ -18,7 +18,7 @@ public PerforReportRepository(PerformanceDbContext context) : base(context)
publicList<PerReport>GetAvgPerfor(inthospitalid)
{
stringsql=@"select concat(allot.year,'-',lpad(allot.month,2,'0')) x, positionname y,avgvalue value
stringsql=@"select concat(allot.year,'-',lpad(allot.month,2,'0')) x, positionname y,round(avgvalue,2) value
from res_baiscnorm bc left join per_allot allot on bc.allotid = allot.id where allot.hospitalid = @hospitalid
order by str_to_date(concat(allot.month, '/', allot.year),'%m/%Y')";
returnDapperQuery(sql,new{hospitalid}).ToList();
...
...
@@ -42,40 +42,48 @@ public List<PerReport> AvgRatio(int hospitalid)
/// 门诊患者均次费用
/// </summary>
/// <returns></returns>
publicList<PerReport>OutFeeAvg()
publicList<PerReport>OutFeeAvg(List<string>date)
{
stringsql=@"select concat(year,'-',lpad(month,2,'0')) x,deptname y,sum(fee) / sum(persontime) value from hos_personfee where source = '门诊' group by year,month,deptname;";
returnDapperQuery(sql,null).ToList();
stringsql=@"select concat(year,'-',lpad(month,2,'0')) y,deptname x,round(sum(fee) / sum(persontime),2) value from hos_personfee where source = '门诊' and concat(year,'-',lpad(month,2,'0')) in @date group by year,month,deptname order by y;";
stringsql=@"select concat(year,'-',lpad(month,2,'0')) x,deptname y,sum(fee) / sum(persontime) value from hos_personfee where source = '住院' group by year,month,deptname;";
returnDapperQuery(sql,null).ToList();
stringsql=@"select concat(year,'-',lpad(month,2,'0')) y,deptname x,round(sum(fee) / sum(persontime),2) value from hos_personfee where source = '住院' and concat(year,'-',lpad(month,2,'0')) in @date group by year,month,deptname order by y;";
returnDapperQuery(sql,new{date}).ToList();
}
/// <summary>
/// 科室药占比
/// </summary>
/// <returns></returns>
publicList<PerReport>Medicine()
publicList<PerReport>Medicine(List<string>date)
{
stringsql=@"select concat(year,'-',lpad(month,2,'0')) x,deptname y,sum(if(category in ('中成药','西药','中草药'),fee,0)) / sum(fee) value from hos_personfee group by year,month,deptname;";
returnDapperQuery(sql,null).ToList();
stringsql=@"select accountingunit x,concat(year,'-',lpad(month,2,'0')) y,round((sum(if(dt.TypeName in
('中成药费','西药费','中草药费'),cellvalue,0)) / sum(cellvalue))*100,2) value from per_allot aot
join per_sheet sht on aot.id=sht.allotid join im_data dt on dt.sheetid=sht.id where unittype=1 and sheettype=3
and sheetname like '%就诊收入' and ifnull(accountingunit,'') not in ('') and concat(year,'-',lpad(month,2,'0'))
in @date group by year,month,accountingunit order by y;";
returnDapperQuery(sql,new{date}).ToList();
}
/// <summary>
/// 科室有效收入占比
/// </summary>
/// <returns></returns>
publicList<PerReport>Income()
publicList<PerReport>Income(List<string>date)
{
stringsql=@"select concat(year,'-',lpad(month,2,'0')) x,deptname y,sum(if(category not in ('中成药','西药','中草药','医材费'),fee,0)) / sum(fee) value from hos_personfee group by year,month,deptname;";
returnDapperQuery(sql,null).ToList();
stringsql=@"select accountingunit x,concat(year,'-',lpad(month,2,'0')) y,round((sum(if(dt.TypeName not in
('中成药费','西药费','中草药费','医材费'),cellvalue,0)) / sum(cellvalue))*100,2) value from per_allot aot
join per_sheet sht on aot.id=sht.allotid join im_data dt on dt.sheetid=sht.id where unittype=1 and sheettype=3
and sheetname like '%就诊收入' and ifnull(accountingunit,'') not in ('') and concat(year,'-',lpad(month,2,'0'))
in @date group by year,month,accountingunit order by y;";