stringsql=$"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 group by year)t"+
$"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 group by year)t;";
stringsql=$"select '{xAxis}' x,year y,round({formula} * 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 group by year)t;";
if(isOnlyYear!=1)
if(isOnlyYear!=1)
sql=$"select '{xAxis}' x,concat(year,'-',lpad(month,2,'0')) y,round({formula} * 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 group by year,month)t;";
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 group by year,month)t"+
$" 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 group by year,month)t;";