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
......@@ -275,11 +275,8 @@ public ApiResponse TableSpecial([FromBody] ConditionRequest request)
return new ApiResponse(ResponseType.OK, "", list);
}
#region 发放表视图、下载
#region 发放表视图、下载 全院发放
#region 全院发放
/// <summary>
/// 全院绩效发放(视图)
/// </summary>
......@@ -289,25 +286,11 @@ public ApiResponse TableSpecial([FromBody] ConditionRequest request)
[HttpPost]
public ApiResponse GetAllComputeView([FromBody] BeginEndTime request)
{
DateTime bdate = DateTime.Now;
DateTime edate = DateTime.Now;
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate))
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out _) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out _))
throw new PerformanceException("请输入正确的时间");
var datas = _computeService.GetAllComputeViewByDate("view_allot_sign_emp", bdate, edate.AddMonths(1));
if (null == datas)
throw new PerformanceException("当前绩效记录不存在");
var list = new QueryComputeByDateGetPage
{
Data = datas.Skip((request.CurrentPage - 1) * request.PageSize).Take(request.PageSize).ToList(),
TotalData = _computeService.SumDatas(datas),
TotalCount = datas.Count(),
TotalPages = (int)Math.Ceiling((double)datas.Count() / request.PageSize),
CurrentPage = request.CurrentPage,
PageSize = request.PageSize
};
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_emp", request);
return new ApiResponse(ResponseType.OK, "ok", list);
}
......@@ -318,23 +301,21 @@ public ApiResponse GetAllComputeView([FromBody] BeginEndTime request)
/// <returns></returns>
[Route("getAllComputeViewDown/download")]
[HttpPost]
public IActionResult AllComputeViewDownload([FromBody] BeginEndTimeDown request)
public IActionResult AllComputeViewDownload([FromBody] BeginEndTime request)
{
if (request.HospitalId == 0)
throw new PerformanceException("医院ID不能为空");
DateTime bdate = DateTime.Now;
DateTime edate = DateTime.Now;
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate))
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out DateTime bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out DateTime edate))
throw new PerformanceException("请输入正确的时间");
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_emp", bdate, edate.AddMonths(1));
if (null == list)
request.PageSize = 0;
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_emp", request);
if (null == list || null == list.Data)
throw new PerformanceException("当前绩效记录不存在");
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_grant", "全院绩效发放", bdate, edate.AddMonths(1));
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list.Data, "/report/wholehospital_grant", "全院绩效发放", bdate, edate.AddMonths(1));
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
......@@ -417,25 +398,11 @@ public IActionResult WholeHospitalGrantSummaryDownload([FromBody] HospitalGrantS
[HttpPost]
public ApiResponse GethosdataView([FromBody] BeginEndTime request)
{
DateTime bdate = DateTime.Now;
DateTime edate = DateTime.Now;
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate))
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out _) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out _))
throw new PerformanceException("请输入正确的时间");
var datas = _computeService.GetAllComputeViewByDate("view_allot_sign_dept", bdate, edate.AddMonths(1));
if (null == datas)
throw new PerformanceException("当前绩效记录不存在");
var list = new QueryComputeByDateGetPage
{
Data = datas.Skip((request.CurrentPage - 1) * request.PageSize).Take(request.PageSize).ToList(),
TotalData = _computeService.SumDatas(datas),
TotalCount = datas.Count(),
TotalPages = (int)Math.Ceiling((double)datas.Count() / request.PageSize),
CurrentPage = request.CurrentPage,
PageSize = request.PageSize
};
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_dept", request);
return new ApiResponse(ResponseType.OK, "ok", list);
}
......@@ -449,22 +416,21 @@ public ApiResponse GethosdataView([FromBody] BeginEndTime request)
/// <returns></returns>
[Route("gethosdataView/download")]
[HttpPost]
public IActionResult GethosdataView([FromBody] BeginEndTimeDown request)
public IActionResult GethosdataViewDown([FromBody] BeginEndTime request)
{
if (request.HospitalId == 0)
throw new PerformanceException("医院ID不能为空");
DateTime bdate = DateTime.Now;
DateTime edate = DateTime.Now;
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate))
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out DateTime bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out DateTime edate))
throw new PerformanceException("请输入正确的时间");
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_dept", bdate, edate.AddMonths(1));
if (null == list)
request.PageSize = 0;
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_dept", request);
if (null == list || null == list.Data)
throw new PerformanceException("当前绩效记录不存在");
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_accounting_grant", "全院核算绩效发放", bdate, edate.AddMonths(1));
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list.Data, "/report/wholehospital_accounting_grant", "全院核算绩效发放", bdate, edate.AddMonths(1));
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
......@@ -549,26 +515,12 @@ public IActionResult WholeHospitalAccountingGrantSummaryDownload([FromBody] Hosp
[HttpPost]
public ApiResponse AllComputeViewByPM([FromBody] BeginEndTime request)
{
DateTime bdate = DateTime.Now;
DateTime edate = DateTime.Now;
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate))
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out _) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out _))
throw new PerformanceException("请输入正确的时间");
var datas = _computeService.GetAllComputeViewByDate("view_allot_sign_emp_finance", bdate, edate.AddMonths(1));
if (null == datas)
throw new PerformanceException("当前绩效记录不存在");
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_emp_finance", request);
var list = new QueryComputeByDateGetPage
{
Data = datas.Skip((request.CurrentPage - 1) * request.PageSize).Take(request.PageSize).ToList(),
TotalData = _computeService.SumDatas(datas),
TotalCount = datas.Count(),
TotalPages = (int)Math.Ceiling((double)datas.Count() / request.PageSize),
CurrentPage = request.CurrentPage,
PageSize = request.PageSize
};
return new ApiResponse(ResponseType.OK, "ok", list);
}
......@@ -579,22 +531,21 @@ public ApiResponse AllComputeViewByPM([FromBody] BeginEndTime request)
/// <returns></returns>
[Route("allcomputeView/personnel/download")]
[HttpPost]
public IActionResult AllComputeByPMViewDownLoad([FromBody] BeginEndTimeDown request)
public IActionResult AllComputeByPMViewDownLoad([FromBody] BeginEndTime request)
{
if (request.HospitalId == 0)
throw new PerformanceException("医院ID不能为空");
DateTime bdate = DateTime.Now;
DateTime edate = DateTime.Now;
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out edate))
if (string.IsNullOrEmpty(request.BeginTime) || !DateTime.TryParse(request.BeginTime, out DateTime bdate) ||
string.IsNullOrEmpty(request.EndTime) || !DateTime.TryParse(request.EndTime, out DateTime edate))
throw new PerformanceException("请输入正确的时间");
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_emp_finance", bdate, edate.AddMonths(1));
if (null == list)
request.PageSize = 0;
var list = _computeService.GetAllComputeViewByDate("view_allot_sign_emp_finance", request);
if (null == list || null == list.Data)
throw new PerformanceException("当前绩效记录不存在");
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list, "/report/wholehospital_finance_grant", "财务全院绩效发放", bdate, edate.AddMonths(1));
var filepath = downloadService.AllComputerViewReportByDate(request.HospitalId, list.Data, "/report/wholehospital_finance_grant", "财务全院绩效发放", bdate, edate.AddMonths(1));
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
......@@ -667,6 +618,5 @@ public IActionResult WholeHospitalFinanceGrantSummaryDownload([FromBody] Hospita
}
#endregion
#endregion
}
}
\ No newline at end of file
......@@ -1672,7 +1672,7 @@
<param name="request"></param>
<returns></returns>
</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>
......@@ -1700,7 +1700,7 @@
<param name="request"></param>
<returns></returns>
</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>
......@@ -1728,7 +1728,7 @@
<param name="request"></param>
<returns></returns>
</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>
......
......@@ -69,8 +69,8 @@ static void Main(string[] args)
var task = emailService.SendAsync(message);
task.Wait();
Mapper.Initialize(cfg => cfg.AddProfile<AutoMapperConfigs>());
services.AddAutoMapper();
//Mapper.Initialize(cfg => cfg.AddProfile<AutoMapperConfigs>());
//services.AddAutoMapper();
//service注入 repoitory注入
services
......@@ -79,10 +79,10 @@ static void Main(string[] args)
var connection = configuration.GetSection("AppConnection:PerformanceConnectionString").Value;
services.AddDbContext<PerformanceDbContext>(options =>
{
options.UseMySQL(connection);
});
//services.AddDbContext<PerformanceDbContext>(options =>
//{
// options.UseMySQL(connection);
//});
Console.ReadKey();
}
......
......@@ -53,19 +53,20 @@ public class ComputerAliasRequest
public string Route { get; set; }
public string[] Heads { get; set; }
}
public class BeginEndTime
public abstract class BeginEndTimeDown
{
public string BeginTime { get; set; } // 2021-01
public string EndTime { get; set; } // 2021-08
public int CurrentPage { get; set; }
public int PageSize { get; set; }
public int HospitalId { 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 string EndTime { get; set; } // 2021-08
public int HospitalId { get; set; }
public int CurrentPage { get; set; }
public int PageSize { get; set; }
}
public class HospitalGrantSummary : BeginEndTime
......@@ -73,10 +74,9 @@ public class HospitalGrantSummary : BeginEndTime
public List<string> GroupBy { get; set; }
public List<string> SumBy { get; set; }
}
public class HospitalGrantSummaryDown : HospitalGrantSummary
{
public int HospitalId { get; set; }
public string[] heads { get; set; }
}
......@@ -86,6 +86,7 @@ public class QueryComputeByDateGetPage : GetPage
public Dictionary<string, decimal> TotalData { get; set; }
}
public class GetPage
{
public int CurrentPage { get; set; }
......@@ -93,6 +94,7 @@ public class GetPage
public int PageSize { get; set; }
public int TotalCount { get; set; }
}
public class QueryComputeByDateGetTotal: GetPage
{
public List<dynamic> Data { get; set; }
......
......@@ -4,14 +4,18 @@
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace Performance.Repository
{
public partial class PerforReportRepository : PerforRepository<PerReport>
{
private readonly IDbConnection connection;
public PerforReportRepository(PerformanceDbContext context) : base(context)
{
connection = context?.Database.GetDbConnection() ?? throw new ArgumentNullException(nameof(context));
}
/// <summary>
......@@ -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();
}
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>());
......@@ -446,6 +449,23 @@ public List<dynamic> QueryComputeByDate(string viewName, DateTime beginTime, Dat
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)
{
var result = new CustonPagingData();
......
......@@ -2086,6 +2086,7 @@ public List<dynamic> GetAllComputeViewByDate(string viewName, DateTime beginTime
{
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)
{
return reportRepository.QueryComputeByDateAndTotal(viewName, beginTime, endTime, groupBy, sumBy, pageNumber, pageSize);
......@@ -2120,7 +2121,45 @@ public QueryComputeByDateGetTotal GetPerformanceSummary(HospitalGrantSummary req
CurrentPage = request.CurrentPage,
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>
......@@ -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.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.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.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