Commit dac88b32 by 李承祥

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

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