Commit 15e8630f by lcx

Merge branch 'feature/绩效发放' into feature/实发绩效检验,医技组绩效,绩效汇总表合并

# Conflicts:
#	performance/Performance.Api/Controllers/ReportController.cs
#	performance/Performance.Api/wwwroot/Performance.Api.xml
#	performance/Performance.Api/wwwroot/Performance.EntityModels.xml
#	performance/Performance.DtoModels/Request/ComputerRequest.cs
#	performance/Performance.Repository/PerforReportRepository .cs
#	performance/Performance.Services/ComputeService.cs
parents 4619a6bc a67f3c5d
...@@ -1672,7 +1672,7 @@ ...@@ -1672,7 +1672,7 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ReportController.AllComputeViewDownload(Performance.DtoModels.BeginEndTimeDown)"> <member name="M:Performance.Api.Controllers.ReportController.AllComputeViewDownload(Performance.DtoModels.BeginEndTime)">
<summary> <summary>
全院绩效发放(视图)下载 全院绩效发放(视图)下载
</summary> </summary>
...@@ -1700,7 +1700,7 @@ ...@@ -1700,7 +1700,7 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ReportController.GethosdataView(Performance.DtoModels.BeginEndTimeDown)"> <member name="M:Performance.Api.Controllers.ReportController.GethosdataViewDown(Performance.DtoModels.BeginEndTime)">
<summary> <summary>
全院核算绩效发放(视图) 下载 全院核算绩效发放(视图) 下载
</summary> </summary>
...@@ -1728,7 +1728,7 @@ ...@@ -1728,7 +1728,7 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ReportController.AllComputeByPMViewDownLoad(Performance.DtoModels.BeginEndTimeDown)"> <member name="M:Performance.Api.Controllers.ReportController.AllComputeByPMViewDownLoad(Performance.DtoModels.BeginEndTime)">
<summary> <summary>
获取财务全院绩效列表(视图)下载 获取财务全院绩效列表(视图)下载
</summary> </summary>
......
...@@ -69,8 +69,8 @@ static void Main(string[] args) ...@@ -69,8 +69,8 @@ static void Main(string[] args)
var task = emailService.SendAsync(message); var task = emailService.SendAsync(message);
task.Wait(); task.Wait();
Mapper.Initialize(cfg => cfg.AddProfile<AutoMapperConfigs>()); //Mapper.Initialize(cfg => cfg.AddProfile<AutoMapperConfigs>());
services.AddAutoMapper(); //services.AddAutoMapper();
//service注入 repoitory注入 //service注入 repoitory注入
services services
...@@ -79,10 +79,10 @@ static void Main(string[] args) ...@@ -79,10 +79,10 @@ static void Main(string[] args)
var connection = configuration.GetSection("AppConnection:PerformanceConnectionString").Value; var connection = configuration.GetSection("AppConnection:PerformanceConnectionString").Value;
services.AddDbContext<PerformanceDbContext>(options => //services.AddDbContext<PerformanceDbContext>(options =>
{ //{
options.UseMySQL(connection); // options.UseMySQL(connection);
}); //});
Console.ReadKey(); Console.ReadKey();
} }
......
...@@ -53,19 +53,20 @@ public class ComputerAliasRequest ...@@ -53,19 +53,20 @@ public class ComputerAliasRequest
public string Route { get; set; } public string Route { get; set; }
public string[] Heads { get; set; } public string[] Heads { get; set; }
} }
public class BeginEndTime
public abstract class BeginEndTimeDown
{ {
public string BeginTime { get; set; } // 2021-01 public string BeginTime { get; set; } // 2021-01
public string EndTime { get; set; } // 2021-08 public string EndTime { get; set; } // 2021-08
public int CurrentPage { get; set; } public int HospitalId { get; set; }
public int PageSize { get; set; } public List<TitleValue> Search { get; set; }
public string SortBy { get; set; }
} }
public class BeginEndTimeDown public class BeginEndTime : BeginEndTimeDown
{ {
public string BeginTime { get; set; } // 2021-01 public int CurrentPage { get; set; }
public string EndTime { get; set; } // 2021-08 public int PageSize { get; set; }
public int HospitalId { get; set; }
} }
public class HospitalGrantSummary : BeginEndTime public class HospitalGrantSummary : BeginEndTime
...@@ -73,10 +74,9 @@ public class HospitalGrantSummary : BeginEndTime ...@@ -73,10 +74,9 @@ public class HospitalGrantSummary : BeginEndTime
public List<string> GroupBy { get; set; } public List<string> GroupBy { get; set; }
public List<string> SumBy { get; set; } public List<string> SumBy { get; set; }
} }
public class HospitalGrantSummaryDown : HospitalGrantSummary public class HospitalGrantSummaryDown : HospitalGrantSummary
{ {
public int HospitalId { get; set; }
public string[] heads { get; set; } public string[] heads { get; set; }
} }
...@@ -86,6 +86,7 @@ public class QueryComputeByDateGetPage : GetPage ...@@ -86,6 +86,7 @@ public class QueryComputeByDateGetPage : GetPage
public Dictionary<string, decimal> TotalData { get; set; } public Dictionary<string, decimal> TotalData { get; set; }
} }
public class GetPage public class GetPage
{ {
public int CurrentPage { get; set; } public int CurrentPage { get; set; }
...@@ -93,6 +94,7 @@ public class GetPage ...@@ -93,6 +94,7 @@ public class GetPage
public int PageSize { get; set; } public int PageSize { get; set; }
public int TotalCount { get; set; } public int TotalCount { get; set; }
} }
public class QueryComputeByDateGetTotal: GetPage public class QueryComputeByDateGetTotal: GetPage
{ {
public List<dynamic> Data { get; set; } public List<dynamic> Data { get; set; }
......
...@@ -4,14 +4,18 @@ ...@@ -4,14 +4,18 @@
using Performance.EntityModels; using Performance.EntityModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Linq; using System.Linq;
namespace Performance.Repository namespace Performance.Repository
{ {
public partial class PerforReportRepository : PerforRepository<PerReport> public partial class PerforReportRepository : PerforRepository<PerReport>
{ {
private readonly IDbConnection connection;
public PerforReportRepository(PerformanceDbContext context) : base(context) public PerforReportRepository(PerformanceDbContext context) : base(context)
{ {
connection = context?.Database.GetDbConnection() ?? throw new ArgumentNullException(nameof(context));
} }
/// <summary> /// <summary>
...@@ -408,7 +412,6 @@ public List<dynamic> QueryComputeByDate(string viewName, DateTime beginTime, Dat ...@@ -408,7 +412,6 @@ public List<dynamic> QueryComputeByDate(string viewName, DateTime beginTime, Dat
return DapperQuery<dynamic>(sql, new { beginTime = beginTime.ToString("yyyy-MM-dd"), endTime = endTime.ToString("yyyy-MM-dd") }).ToList(); return DapperQuery<dynamic>(sql, new { beginTime = beginTime.ToString("yyyy-MM-dd"), endTime = endTime.ToString("yyyy-MM-dd") }).ToList();
} }
public (int count, List<dynamic> data) QueryComputeByDateAndTotal(string viewName, DateTime beginTime, DateTime endTime, List<string> groupBy, List<string> sumBy, int pageNumber, int pageSize) public (int count, List<dynamic> data) QueryComputeByDateAndTotal(string viewName, DateTime beginTime, DateTime endTime, List<string> groupBy, List<string> sumBy, int pageNumber, int pageSize)
{ {
if (!new string[] { "view_allot_sign_dept", "view_allot_sign_emp", "view_allot_sign_emp_finance" }.Contains(viewName)) return (0, new List<dynamic>()); if (!new string[] { "view_allot_sign_dept", "view_allot_sign_emp", "view_allot_sign_emp_finance" }.Contains(viewName)) return (0, new List<dynamic>());
...@@ -446,6 +449,23 @@ public List<dynamic> QueryComputeByDate(string viewName, DateTime beginTime, Dat ...@@ -446,6 +449,23 @@ public List<dynamic> QueryComputeByDate(string viewName, DateTime beginTime, Dat
return (count, data); return (count, data);
} }
public (List<dynamic> list, int count) QueryComputePageData(string query, object param = null)
{
try
{
using (var multi = connection.QueryMultiple(query, param, commandTimeout: 1000))
{
var list = multi.Read<dynamic>().ToList();
var count = multi.Read<int>().FirstOrDefault();
return (list, count);
}
}
catch
{
return (new List<dynamic>(), 0);
}
}
public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead) public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead)
{ {
var result = new CustonPagingData(); var result = new CustonPagingData();
......
...@@ -2086,6 +2086,7 @@ public List<dynamic> GetAllComputeViewByDate(string viewName, DateTime beginTime ...@@ -2086,6 +2086,7 @@ public List<dynamic> GetAllComputeViewByDate(string viewName, DateTime beginTime
{ {
return reportRepository.QueryComputeByDate(viewName, beginTime, endTime); return reportRepository.QueryComputeByDate(viewName, beginTime, endTime);
} }
public (int count, List<dynamic> data) GetAllComputeViewByDateAndTotal(string viewName, DateTime beginTime, DateTime endTime, List<string> groupBy, List<string> sumBy, int pageNumber = 0, int pageSize = 0) public (int count, List<dynamic> data) GetAllComputeViewByDateAndTotal(string viewName, DateTime beginTime, DateTime endTime, List<string> groupBy, List<string> sumBy, int pageNumber = 0, int pageSize = 0)
{ {
return reportRepository.QueryComputeByDateAndTotal(viewName, beginTime, endTime, groupBy, sumBy, pageNumber, pageSize); return reportRepository.QueryComputeByDateAndTotal(viewName, beginTime, endTime, groupBy, sumBy, pageNumber, pageSize);
...@@ -2120,7 +2121,45 @@ public QueryComputeByDateGetTotal GetPerformanceSummary(HospitalGrantSummary req ...@@ -2120,7 +2121,45 @@ public QueryComputeByDateGetTotal GetPerformanceSummary(HospitalGrantSummary req
CurrentPage = request.CurrentPage, CurrentPage = request.CurrentPage,
PageSize = request.PageSize PageSize = request.PageSize
}; };
return list; return list;
}
public QueryComputeByDateGetPage GetAllComputeViewByDate(string viewName, BeginEndTime request)
{
var sql = $@"select * from {viewName}
where str_to_date(concat(year, '-', month, '-01'), '%Y-%m-%d') >= '{request.BeginTime}-01'
and str_to_date(concat(year, '-', month, '-01'), '%Y-%m-%d') < '{request.EndTime}-01'
and hospitalid = {request.HospitalId}";
if (request.Search != null && request.Search.Any(w => !string.IsNullOrEmpty(w.Title) && !string.IsNullOrEmpty(w.Value)))
{
var where = request.Search.Where(w => !string.IsNullOrEmpty(w.Title) && !string.IsNullOrEmpty(w.Value)).Select(t => $"{t.Title} like '%{t.Value}%'");
sql += " and " + string.Join(" and ", where);
}
if (!string.IsNullOrEmpty(request.SortBy))
sql += $" order by {request.SortBy} ";
string query = sql + @"; select 0 as total;";
if (request.PageSize > 0 && request.CurrentPage > 0)
{
query = $@"
select * from ({sql}) tab limit {request.PageSize} offset {(request.CurrentPage - 1) * request.PageSize};
select count(1) total from ({sql}) tab;";
}
var (list, count) = reportRepository.QueryComputePageData(query);
return new QueryComputeByDateGetPage
{
Data = list,
TotalData = SumDatas(list),
TotalCount = count,
TotalPages = (int)Math.Ceiling((double)list.Count() / request.PageSize),
CurrentPage = request.CurrentPage,
PageSize = request.PageSize
};
} }
/// <summary> /// <summary>
...@@ -2195,7 +2234,7 @@ public static List<cof_alias> PerformanceTotal(string route, string[] heads) ...@@ -2195,7 +2234,7 @@ public static List<cof_alias> PerformanceTotal(string route, string[] heads)
new cof_alias{ Alias = "批次", Name = nameof(view_allot_sign_emp.Batch), States = 1, SumStatus = 0}, new cof_alias{ Alias = "批次", Name = nameof(view_allot_sign_emp.Batch), States = 1, SumStatus = 0},
new cof_alias{ Alias = "银行卡号", Name = nameof(view_allot_sign_emp.BankCard), States = 1, SumStatus = 0}, new cof_alias{ Alias = "银行卡号", Name = nameof(view_allot_sign_emp.BankCard), States = 1, SumStatus = 0},
new cof_alias{ Alias = "正式/临聘", Name = nameof(view_allot_sign_emp.JobCategory), States = 1, SumStatus = 0}, new cof_alias{ Alias = "正式/临聘", Name = nameof(view_allot_sign_emp.JobCategory), States = 1, SumStatus = 0},
//new cof_alias{ Alias = "职务", Name = nameof(view_allot_sign_emp.Duty), States = 1},
new cof_alias{ Alias = "职务", Name = nameof(view_allot_sign_emp.Duty), States = 1, SumStatus = 0}, new cof_alias{ Alias = "职务", Name = nameof(view_allot_sign_emp.Duty), States = 1, SumStatus = 0},
new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1, SumStatus = 1}, new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1, SumStatus = 1},
......
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