Commit dac88b32 by 李承祥

报表 门诊住院业务收入占比 修改

parent 4a447221
......@@ -9,6 +9,9 @@
namespace Performance.Api.Controllers
{
/// <summary>
/// 报表
/// </summary>
[Route("api/[controller]")]
public class ReportController : Controller
{
......@@ -153,7 +156,7 @@ public ApiResponse IndexReport([CustomizeValidator(RuleSet = "Index"), FromBody]
[HttpPost]
public ApiResponse MenuReport([CustomizeValidator(RuleSet = "Menu"), FromBody]ReportRequest request)
{
var list = reportService.MenuReport(request.HospitalId, request.OnlyYear, request.Source, request.IsInHos);
var list = reportService.MenuReport(request.HospitalId, request.OnlyYear, request.Source);
return new ApiResponse(ResponseType.OK, "", list);
}
}
......
......@@ -659,6 +659,11 @@
</summary>
<returns></returns>
</member>
<member name="T:Performance.Api.Controllers.ReportController">
<summary>
报表
</summary>
</member>
<member name="M:Performance.Api.Controllers.ReportController.Survey(Performance.DtoModels.ReportRequest)">
<summary>
首页数据概况
......@@ -715,6 +720,20 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.IndexReport(Performance.DtoModels.ReportRequest)">
<summary>
首页报表
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.MenuReport(Performance.DtoModels.ReportRequest)">
<summary>
菜单报表
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="T:Performance.Api.Controllers.SecondAllotController">
<summary>
二次绩效
......
......@@ -1449,6 +1449,15 @@
职位类别 1 普通类别 2 基础绩效来源
</summary>
</member>
<member name="P:Performance.DtoModels.ReportRequest.IsIndex">
<summary> 是否为首页 </summary>
</member>
<member name="P:Performance.DtoModels.ReportRequest.OnlyYear">
<summary> 是否以年为单位 </summary>
</member>
<member name="P:Performance.DtoModels.ReportRequest.Source">
<summary> 报表名称 </summary>
</member>
<member name="T:Performance.DtoModels.SetDepartmentRequest">
<summary>
登录请求
......
......@@ -15,9 +15,6 @@ public class ReportRequest
/// <summary> 是否以年为单位 </summary>
public int OnlyYear { get; set; }
/// <summary> 是否住院 </summary>
public int IsInHos { get; set; }
/// <summary> 报表名称 </summary>
public string Source { get; set; }
}
......
......@@ -169,14 +169,15 @@ public List<PerReport> GeneralIncome(int hospitalId, int isOnlyYear)
/// 门诊、住院业务收入占比
/// </summary>
/// <returns></returns>
public List<PerReport> InHosIncome(int hospitalId, int isOnlyYear, int isInHos)
public List<PerReport> InHosIncome(int hospitalId, int isOnlyYear)
{
string xAxis = isInHos == 1 ? "住院" : "门诊";
string formula = isInHos == 1 ? "t.InHos/(t.InHos+t.Outpatient)" : "t.Outpatient/(t.InHos+t.Outpatient)";
string sql = $"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;";
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 group by year)t" +
$" 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 group by year)t;";
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;";
return DapperQuery(sql, new { hospitalId }).ToList();
}
......
......@@ -280,7 +280,7 @@ public List<PerReport> IndexReport(int hospitalId, string source)
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
public List<PerReport> MenuReport(int hospitalId, int isOnlyYear, string source, int? isInHos = null)
public List<PerReport> MenuReport(int hospitalId, int isOnlyYear, string source)
{
var report = new List<PerReport>();
switch (source)
......@@ -288,8 +288,8 @@ public List<PerReport> MenuReport(int hospitalId, int isOnlyYear, string source,
case "业务总收入":
report = perforReportRepository.GeneralIncome(hospitalId, isOnlyYear);
break;
case "门诊住院业务收入占比":
report = perforReportRepository.InHosIncome(hospitalId, isOnlyYear, isInHos.Value);
case "门诊住院业务收入占比":
report = perforReportRepository.InHosIncome(hospitalId, isOnlyYear);
break;
case "业务收入结构占比":
report = perforReportRepository.StructRatio(hospitalId, isOnlyYear);
......
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