Commit 2fae6b6d by ruyun.zhang@suvalue.com

Merge branch 'feature/绩效发放' into develop

parents 107eaf30 c6cde0ed
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
}, },
"AppConnection": { "AppConnection": {
//"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", //"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"PerformanceConnectionString": "server=192.168.18.166;database=db_test_srfy;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", "PerformanceConnectionString": "server=192.168.18.166;database=db_performance_screen;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"HangfireConnectionString": "server=192.168.18.166;database=db_hangfire;uid=root;pwd=1234qwer;port=3306;allow user variables=true;", "HangfireConnectionString": "server=192.168.18.166;database=db_hangfire;uid=root;pwd=1234qwer;port=3306;allow user variables=true;",
"RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2" "RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2"
}, },
......
...@@ -1641,6 +1641,48 @@ ...@@ -1641,6 +1641,48 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ReportController.GetAllComputeView(Performance.DtoModels.BeginEndTime)">
<summary>
全院绩效发放(视图)
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.AllComputeViewDownload(Performance.DtoModels.BeginEndTimeDown)">
<summary>
全院绩效发放(视图)下载
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.GethosdataView(Performance.DtoModels.BeginEndTime)">
<summary>
全院核算绩效发放(视图)
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.GethosdataView(Performance.DtoModels.BeginEndTimeDown)">
<summary>
全院核算绩效发放(视图) 下载
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.AllComputeViewByPM(Performance.DtoModels.BeginEndTime)">
<summary>
获取财务全院绩效列表(视图)
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.AllComputeByPMViewDownLoad(Performance.DtoModels.BeginEndTimeDown)">
<summary>
获取财务全院绩效列表(视图)下载
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportGlobalController.GetAllReportGlobal(System.Int32)"> <member name="M:Performance.Api.Controllers.ReportGlobalController.GetAllReportGlobal(System.Int32)">
<summary> <summary>
获取报表配置信息 获取报表配置信息
......
...@@ -52,4 +52,28 @@ public class ComputerAliasRequest ...@@ -52,4 +52,28 @@ public class ComputerAliasRequest
public string Route { get; set; } public string Route { get; set; }
} }
public class BeginEndTime
{
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 class BeginEndTimeDown
{
public string BeginTime { get; set; } // 2021-01
public string EndTime { get; set; } // 2021-08
public int HospitalId { get; set; }
}
public class QueryComputeByDateGetPage
{
public List<dynamic> Data { get; set; }
public Dictionary<string, decimal> TotalData { get; set; }
public int CurrentPage { get; set; }
public int TotalPages { get; set; }
public int PageSize { get; set; }
public int TotalCount { get; set; }
}
} }
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels; using Performance.EntityModels;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -396,6 +397,14 @@ public List<dynamic> QueryCompute(int allotId, string viewName) ...@@ -396,6 +397,14 @@ public List<dynamic> QueryCompute(int allotId, string viewName)
return DapperQuery<dynamic>(sql, new { allotId })?.ToList(); return DapperQuery<dynamic>(sql, new { allotId })?.ToList();
} }
public List<dynamic> QueryComputeByDate(string viewName, DateTime beginTime, DateTime endTime)
{
var sql = $@"SELECT * FROM {viewName}
where STR_TO_DATE(concat(Year,'-',Month,'-01'),'%Y-%m-%d') >= @beginTime
and STR_TO_DATE(concat(Year,'-',Month,'-01'),'%Y-%m-%d') < @endTime";
return DapperQuery<dynamic>(sql, new { beginTime = beginTime.ToString("yyyy-MM-dd"), endTime = endTime.ToString("yyyy-MM-dd") }).ToList();
}
public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead) public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead)
{ {
...@@ -426,7 +435,7 @@ public bool QueryIsAllotId(string tableName) ...@@ -426,7 +435,7 @@ public bool QueryIsAllotId(string tableName)
var sql = $@"SELECT column_name FROM information_schema.COLUMNS s var sql = $@"SELECT column_name FROM information_schema.COLUMNS s
WHERE table_name = @table_name AND TABLE_SCHEMA = @database AND (column_name='allotId' or column_name='AccountingUnit' or column_name='UnitType');"; WHERE table_name = @table_name AND TABLE_SCHEMA = @database AND (column_name='allotId' or column_name='AccountingUnit' or column_name='UnitType');";
var result = DapperQuery<string>(sql, new { database = database, table_name = tableName }); var result = DapperQuery<string>(sql, new { database = database, table_name = tableName });
var isExist=result ?.Count() == 3; var isExist = result?.Count() == 3;
return isExist; return isExist;
......
...@@ -2012,6 +2012,10 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route) ...@@ -2012,6 +2012,10 @@ public List<cof_alias> CustomColumnHeaders(int hospitalId, string route)
{ "/result/compute" , ComputeConfig.AllComputeView }, { "/result/compute" , ComputeConfig.AllComputeView },
{ "/result/wholehospital" , ComputeConfig.AllComputePersonView }, { "/result/wholehospital" , ComputeConfig.AllComputePersonView },
{ "/result/print/compute" , ComputeConfig.AllComputeDepartmentView }, { "/result/print/compute" , ComputeConfig.AllComputeDepartmentView },
{ "/report/wholehospital_grant" , ComputeConfig.AllComputeViewByDate },
{ "/report/wholehospital_accounting_grant" , ComputeConfig.AllComputeDepartmentViewByDate },
{ "/report/wholehospital_finance_grant" , ComputeConfig.AllComputePersonViewByDate },
}; };
init = pairs.ContainsKey(route.ToLower()) ? pairs[route.ToLower()] : new List<cof_alias>(); init = pairs.ContainsKey(route.ToLower()) ? pairs[route.ToLower()] : new List<cof_alias>();
} }
...@@ -2065,6 +2069,48 @@ public List<dynamic> GetAllComputeView(int hospitalId, int AllotId, string viewN ...@@ -2065,6 +2069,48 @@ public List<dynamic> GetAllComputeView(int hospitalId, int AllotId, string viewN
{ {
return reportRepository.QueryCompute(AllotId, viewName); return reportRepository.QueryCompute(AllotId, viewName);
} }
public List<dynamic> GetAllComputeViewByDate(string viewName, DateTime beginTime, DateTime endTime)
{
return reportRepository.QueryComputeByDate(viewName, beginTime, endTime);
}
/// <summary>
///
/// </summary>
/// <param name="datas"></param>
/// <returns></returns>
public Dictionary<string, decimal> SumDatas(List<dynamic> datas)
{
string[] notSum = new string[] { "hospitalid", "allotid", "year", "month", "jobnumber", "bankcard", "jobtitle", "secondid", "states", "isshowmanage", "batch" };
Dictionary<string, decimal> pairs = new Dictionary<string, decimal>();
foreach (var dt in datas)
{
var row = (IDictionary<string, object>)dt;
foreach (var item in row)
{
if (notSum.Contains(item.Key.ToLower())) continue;
if (decimal.TryParse(item.Value?.ToString(), out decimal v))
{
if (pairs.TryGetValue(item.Key, out decimal sum))
{
sum += v;
pairs[item.Key] = sum;
}
else
{
pairs[item.Key] = v;
}
}
}
}
foreach (var item in pairs)
{
pairs[item.Key] = Math.Round(item.Value, 2, MidpointRounding.AwayFromZero);
}
return pairs;
}
} }
public class ComputeConfig public class ComputeConfig
...@@ -2081,7 +2127,7 @@ public class ComputeConfig ...@@ -2081,7 +2127,7 @@ public class ComputeConfig
new cof_alias{ Alias = "批次", Name = nameof(view_allot_sign_emp.Batch), States = 1}, new cof_alias{ Alias = "批次", Name = nameof(view_allot_sign_emp.Batch), States = 1},
new cof_alias{ Alias = "银行卡号", Name = nameof(view_allot_sign_emp.BankCard), States = 1}, new cof_alias{ Alias = "银行卡号", Name = nameof(view_allot_sign_emp.BankCard), States = 1},
new cof_alias{ Alias = "正式/临聘", Name = nameof(view_allot_sign_emp.JobCategory), States = 1}, new cof_alias{ Alias = "正式/临聘", Name = nameof(view_allot_sign_emp.JobCategory), States = 1},
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},
new cof_alias{ Alias = "职称", Name = nameof(view_allot_sign_emp.TitlePosition), States = 1}, new cof_alias{ Alias = "职称", Name = nameof(view_allot_sign_emp.TitlePosition), States = 1},
new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1}, new cof_alias{ Alias = "调节后业绩绩效", Name = nameof(view_allot_sign_emp.PerforSumFee), States = 1},
...@@ -2095,6 +2141,22 @@ public class ComputeConfig ...@@ -2095,6 +2141,22 @@ public class ComputeConfig
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1}, new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1},
}; };
private static List<cof_alias> _allComputeViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputeViewByDate
{
get
{
if (_allComputeViewByDate == null || _allComputeViewByDate.Count == 0)
{
_allComputeViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1 });
_allComputeViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1 });
_allComputeViewByDate.AddRange(AllComputeView);
}
return _allComputeViewByDate;
}
}
public static List<cof_alias> AllComputePersonView { get; } = new List<cof_alias> public static List<cof_alias> AllComputePersonView { get; } = new List<cof_alias>
{ {
new cof_alias{ Alias = "科室类别", Name = nameof(view_allot_sign_emp.UnitType), States = 1}, new cof_alias{ Alias = "科室类别", Name = nameof(view_allot_sign_emp.UnitType), States = 1},
...@@ -2111,6 +2173,21 @@ public class ComputeConfig ...@@ -2111,6 +2173,21 @@ public class ComputeConfig
new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1}, new cof_alias{ Alias = "预留绩效", Name = nameof(view_allot_sign_emp.ReservedRatioFee), States = 1},
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1}, new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_emp.RealGiveFee), States = 1},
}; };
private static List<cof_alias> _allComputePersonViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputePersonViewByDate
{
get
{
if (_allComputePersonViewByDate == null || _allComputePersonViewByDate.Count == 0)
{
_allComputePersonViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1 });
_allComputePersonViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1 });
_allComputePersonViewByDate.AddRange(AllComputePersonView);
}
return _allComputePersonViewByDate;
}
}
public static List<cof_alias> AllComputeDepartmentView { get; } = new List<cof_alias> public static List<cof_alias> AllComputeDepartmentView { get; } = new List<cof_alias>
{ {
new cof_alias{ Alias = "核算群体", Name = nameof(view_allot_sign_dept.UnitName), States = 1}, new cof_alias{ Alias = "核算群体", Name = nameof(view_allot_sign_dept.UnitName), States = 1},
...@@ -2132,5 +2209,19 @@ public class ComputeConfig ...@@ -2132,5 +2209,19 @@ public class ComputeConfig
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_dept.HideAprOtherPerforAmount), States = 1}, new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_dept.HideAprOtherPerforAmount), States = 1},
new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_dept.RealGiveFee), States = 1}, new cof_alias{ Alias = "实发绩效", Name = nameof(view_allot_sign_dept.RealGiveFee), States = 1},
}; };
private static List<cof_alias> _allComputeDepartmentViewByDate = new List<cof_alias>();
public static List<cof_alias> AllComputeDepartmentViewByDate
{
get
{
if (_allComputeDepartmentViewByDate == null || _allComputeDepartmentViewByDate.Count == 0)
{
_allComputeDepartmentViewByDate.Add(new cof_alias { Alias = "年份", Name = nameof(view_allot_sign_emp.Year), States = 1 });
_allComputeDepartmentViewByDate.Add(new cof_alias { Alias = "月份", Name = nameof(view_allot_sign_emp.Month), States = 1 });
_allComputeDepartmentViewByDate.AddRange(AllComputeDepartmentView);
}
return _allComputeDepartmentViewByDate;
}
}
} }
} }
...@@ -181,11 +181,29 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string ...@@ -181,11 +181,29 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
{ {
var allot = perallotRepository.GetEntity(t => t.ID == allotId); var allot = perallotRepository.GetEntity(t => t.ID == allotId);
var hospital = perforHospital.GetEntity(t => t.ID == allot.HospitalId); var hospital = perforHospital.GetEntity(t => t.ID == allot.HospitalId);
var alias = perforCofalias.GetEntities(t => t.HospitalId == hospital.ID); var title = $"{allot.Year}{allot.Month}{hospital.HosName}医院 --- {name}";
return AllComputerDown(hospital, dynamics, route, title, name);
}
/// <summary>
/// 财务、全院绩效发放下载(时间段)
/// </summary>
/// <param name="allotId"></param>
/// <param name="allData"></param>
/// <param name="isAll"></param>
/// <returns></returns>
public string AllComputerViewReportByDate(int hospitalId, List<dynamic> dynamics, string route, string name, DateTime beginTime, DateTime endTime)
{
var hospital = perforHospital.GetEntity(t => t.ID == hospitalId);
var title = (beginTime.AddMonths(1).Date == endTime.Date)
? $"{beginTime.ToString("yyyy年MM月")}{hospital.HosName}医院 --- {name}"
: $"{beginTime.ToString("yyyy年MM月")}{endTime.ToString("yyyy年MM月")}{hospital.HosName}医院 --- {name}";
return AllComputerDown(hospital, dynamics, route, title, name);
}
public string AllComputerDown(sys_hospital hospital, List<dynamic> dynamics, string route, string title, string name)
{
var headList = _computeService.CustomColumnHeaders(hospital.ID, route).Where(w => w.States == 1).ToList(); var headList = _computeService.CustomColumnHeaders(hospital.ID, route).Where(w => w.States == 1).ToList();
var dpath = Path.Combine(evn.ContentRootPath, "Files", "PerformanceRelease", $"{hospital.ID}");
var dpath = Path.Combine(evn.ContentRootPath, "Files", "PerformanceRelease", $"{allot.HospitalId}");
FileHelper.CreateDirectory(dpath); FileHelper.CreateDirectory(dpath);
string filepath = Path.Combine(dpath, $"{hospital.HosName}-{name}-{DateTime.Now:yyyyMMdd}"); string filepath = Path.Combine(dpath, $"{hospital.HosName}-{name}-{DateTime.Now:yyyyMMdd}");
FileHelper.DeleteFile(filepath); FileHelper.DeleteFile(filepath);
...@@ -198,7 +216,7 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string ...@@ -198,7 +216,7 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
if (dynamics != null && dynamics.Count() > 0) if (dynamics != null && dynamics.Count() > 0)
{ {
worksheet.SetValue(1, 1, $"{allot.Year}{allot.Month}{hospital.HosName}医院 --- {name}"); worksheet.SetValue(1, 1, title);
var headers = ((IDictionary<string, object>)dynamics.ElementAt(0)).Keys; var headers = ((IDictionary<string, object>)dynamics.ElementAt(0)).Keys;
for (int col = 0; col < headList.Count; col++) for (int col = 0; col < headList.Count; col++)
...@@ -216,9 +234,9 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string ...@@ -216,9 +234,9 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
worksheet.Cells[row + 3, col + 1].Value = value; worksheet.Cells[row + 3, col + 1].Value = value;
} }
if (col == 0) if (col == 0)
worksheet.SetValue(dynamics.Count() + 2, col + 1, "合计"); worksheet.SetValue(dynamics.Count() + 3, col + 1, "合计");
else if (!notSum.Contains(headList[col].Name.ToLower())) else if (!notSum.Contains(headList[col].Name.ToLower()))
worksheet.Cells[dynamics.Count() + 2, col + 1].Formula = string.Format("SUM({0})", new ExcelAddress(2, col + 1, dynamics.Count() + 1, col + 1).Address); worksheet.Cells[dynamics.Count() + 3, col + 1].Formula = string.Format("SUM({0})", new ExcelAddress(3, col + 1, dynamics.Count() + 2, col + 1).Address);
} }
#region 样式设置 #region 样式设置
...@@ -227,7 +245,9 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string ...@@ -227,7 +245,9 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
worksheet.Row(row).Height = 20; worksheet.Row(row).Height = 20;
for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++) for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++)
{ {
if (headList.Count < col && !notSum.Contains(headList[col - 1].Name.ToLower()))
worksheet.Cells[row, col].Style.Numberformat.Format = "#,##0.00"; worksheet.Cells[row, col].Style.Numberformat.Format = "#,##0.00";
worksheet.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin); worksheet.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin);
worksheet.Cells[row, col].Style.VerticalAlignment = ExcelVerticalAlignment.Center; worksheet.Cells[row, col].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
} }
...@@ -241,6 +261,10 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string ...@@ -241,6 +261,10 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
worksheet.Cells[2, 1, 2, headList.Count].Style.Font.Bold = true; worksheet.Cells[2, 1, 2, headList.Count].Style.Font.Bold = true;
worksheet.View.FreezePanes(3, 1); worksheet.View.FreezePanes(3, 1);
worksheet.Cells.AutoFitColumns(); worksheet.Cells.AutoFitColumns();
for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++)
{
worksheet.Column(col).Width = worksheet.Column(col).Width > 20 ? 20 : worksheet.Column(col).Width;
}
#endregion #endregion
} }
package.Save(); package.Save();
......
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