Commit f16410ad by 李承祥

月群体人均绩效

parent 69cd2acf
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using Performance.DtoModels;
using Performance.Services;
namespace Performance.Api.Controllers
{
[Route("api/[controller]")]
public class ReportController : Controller
{
private ReportService reportService;
public ReportController(ReportService reportService)
{
this.reportService = reportService;
}
/// <summary>
/// 月群体人均绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("getperforavg")]
[HttpPost]
public ApiResponse AvgPerfor([CustomizeValidator(RuleSet = "Query"), FromBody]ReportRequest request)
{
var list = reportService.GetAvgPerfor(request.HospitalId);
return new ApiResponse(ResponseType.OK, "", list);
}
}
}
\ No newline at end of file
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class ReportRequest : ApiRequest
{
public int HospitalId { get; set; }
}
public class ReportRequestValidator : AbstractValidator<ReportRequest>
{
public ReportRequestValidator()
{
RuleSet("Query", () =>
{
RuleFor(x => x.HospitalId).NotNull().GreaterThan(0);
});
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.EntityModels
{
public class PerReport
{
public string X { get; set; }
public string Y { get; set; }
public string Value { get; set; }
public string Type { get; set; }
public string Name { get; set; }
}
}
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Performance.Repository
{
public partial class PerforReportRepository : PerforRepository<PerReport>
{
public PerforReportRepository(PerformanceDbContext context) : base(context)
{
}
/// <summary>
/// 月群体人均绩效
/// </summary>
/// <returns></returns>
public List<PerReport> GetAvgPerfor(int hospitalid)
{
string sql = @"SELECT
t.date x,t.FitPeople y,ROUND(IFNULL(SUM(t.RealGiveFee),0)/count(1) ,2) value
FROM
(
SELECT rc.ID,rc.AllotID,rc.AccountingUnit,
CASE
WHEN rc.FitPeople = '临床科室主任人均绩效' THEN
'院领导绩效'
WHEN rc.FitPeople = '临床科室中层人均绩效' THEN
'行政职能中层绩效'
WHEN rc.FitPeople IN ( '临床科室护士人均绩效的95%', '临床科室护士长人均绩效', '' ) THEN
'行政工勤绩效'
WHEN rc.FitPeople IN ( '科室主任人均绩效', '科室副主任人均绩效' ) THEN
'临床主任绩效'
WHEN rc.FitPeople = '科室护士长人均绩效' THEN
'临床护理绩效'
END FitPeople,
rc.RealGiveFee,date_format( str_to_date( CONCAT( allot.`Month`, '/', allot.`Year` ), '%m/%Y' ), '%Y-%m' ) date
FROM res_compute rc LEFT JOIN per_allot allot ON rc.AllotID = allot.ID
WHERE allot.HospitalId=@hospitalid ) t
GROUP BY t.date,t.FitPeople";
return DapperQuery(sql, new { hospitalid }).ToList();
}
}
}
using Performance.EntityModels;
using Performance.Repository;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.Services
{
public class ReportService : IAutoInjection
{
private PerforReportRepository perforReportRepository;
public ReportService(PerforReportRepository perforReportRepository)
{
this.perforReportRepository = perforReportRepository;
}
/// <summary>
/// 月群体人均绩效
/// </summary>
/// <returns></returns>
public List<PerReport> GetAvgPerfor(int hospitalid)
{
return perforReportRepository.GetAvgPerfor(hospitalid);
}
}
}
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