绩效发放表 改为视图

parent 5143bb0a
......@@ -386,7 +386,7 @@ public ApiResponse<res_baiscnorm> EditHospitalAvg([FromBody] ComputerAvgRequest
[HttpPost]
public ApiResponse CustomColumnHeaders([FromBody] ComputerAliasRequest request)
{
var result = _computeService.CustomColumnHeaders(request);
var result = _computeService.CustomColumnHeaders(request.HospitalId, request.Route);
return new ApiResponse(ResponseType.OK, result);
}
......@@ -498,43 +498,68 @@ public IActionResult AllComputeByPMDownLoad(int allotId)
#region 发放表视图、下载
/// <summary>
/// 获取全院绩效列表(视图)
/// 全院核算绩效发放(视图)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("allcomputeView")]
[Route("gethosdataView")]
[HttpPost]
public ApiResponse AllComputeView([FromBody] ComputerRequest request)
public ApiResponse GethosdataView([FromBody] ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _computeService.GetAllComputeView(allot.HospitalId, request.AllotId, true);
var list = _computeService.GetAllComputeView(allot.HospitalId, request.AllotId, "view_allot_sign_dept");
return new ApiResponse(ResponseType.OK, "ok", list);
}
/// <summary>
/// 获取全院绩效列表(人事科)
/// 全院核算绩效发放(视图) 下载
/// </summary>
/// <param name="request"></param>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("allcomputeView/personnel")]
[Route("gethosdataView/download/{allotId}")]
[HttpPost]
public ApiResponse AllComputeViewByPM([FromBody] ComputerRequest request)
public IActionResult GethosdataView(int allotId)
{
var allot = _allotService.GetAllot(request.AllotId);
var allot = _allotService.GetAllot(allotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var result = _computeService.GetAllComputeView(allot.HospitalId, request.AllotId, false);
var list = _computeService.GetAllComputeView(allot.HospitalId, allotId, "view_allot_sign_dept");
var filepath = downloadService.AllComputerViewReport(allotId, list, "/result/print/compute", "全院核算绩效发放");
//var result = _computeService.ComputerGroupBy(list);
return new ApiResponse(ResponseType.OK, "ok", result);
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
{
stream.CopyToAsync(memoryStream).Wait();
}
memoryStream.Seek(0, SeekOrigin.Begin);
var provider = new FileExtensionContentTypeProvider();
FileInfo fileInfo = new FileInfo(filepath);
var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
}
/// <summary>
/// 获取全院绩效列表(视图)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("allcomputeView")]
[HttpPost]
public ApiResponse AllComputeView([FromBody] ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _computeService.GetAllComputeView(allot.HospitalId, request.AllotId, "view_allot_sign_emp");
return new ApiResponse(ResponseType.OK, "ok", list);
}
/// <summary>
/// 下载全院绩效列表
......@@ -549,8 +574,8 @@ public IActionResult AllComputeViewDownload(int allotId)
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _computeService.GetAllComputeView(allot.HospitalId, allotId, true);
var filepath = downloadService.AllComputerViewReport(allotId, list, true, "全院绩效发放");
var list = _computeService.GetAllComputeView(allot.HospitalId, allotId, "view_allot_sign_emp");
var filepath = downloadService.AllComputerViewReport(allotId, list, "/result/compute", "全院绩效发放");
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
......@@ -564,8 +589,28 @@ public IActionResult AllComputeViewDownload(int allotId)
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
}
/// <summary>
/// 获取全院绩效列表(人事科)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("allcomputeView/personnel")]
[HttpPost]
public ApiResponse AllComputeViewByPM([FromBody] ComputerRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var result = _computeService.GetAllComputeView(allot.HospitalId, request.AllotId, "view_allot_sign_emp_finance");
//var result = _computeService.ComputerGroupBy(list);
return new ApiResponse(ResponseType.OK, "ok", result);
}
/// <summary>
/// 下载全院绩效列表(人事科/视图
/// 下载全院绩效列表(人事科)
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
......@@ -577,8 +622,8 @@ public IActionResult AllComputeByPMViewDownLoad(int allotId)
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var result =_computeService.GetAllComputeView(allot.HospitalId, allotId, false);
var filepath = downloadService.AllComputerViewReport(allotId, result, false, "财务全院绩效");
var result = _computeService.GetAllComputeView(allot.HospitalId, allotId, "view_allot_sign_emp_finance");
var filepath = downloadService.AllComputerViewReport(allotId, result, "/result/wholehospital", "财务全院绩效发放");
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
......
......@@ -575,16 +575,23 @@
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.AllComputeView(Performance.DtoModels.ComputerRequest)">
<member name="M:Performance.Api.Controllers.ComputeController.GethosdataView(Performance.DtoModels.ComputerRequest)">
<summary>
获取全院绩效列表(视图)
全院核算绩效发放(视图)
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.AllManageComputeView(Performance.DtoModels.ComputerRequest)">
<member name="M:Performance.Api.Controllers.ComputeController.GethosdataView(System.Int32)">
<summary>
全院核算绩效发放(视图) 下载
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.AllComputeView(Performance.DtoModels.ComputerRequest)">
<summary>
获取全院管理绩效列表(视图)
获取全院绩效列表(视图)
</summary>
<param name="request"></param>
<returns></returns>
......@@ -596,9 +603,16 @@
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.AllComputeViewByPM(Performance.DtoModels.ComputerRequest)">
<summary>
获取全院绩效列表(人事科)
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.AllComputeByPMViewDownLoad(System.Int32)">
<summary>
下载全院绩效列表(人事科/视图
下载全院绩效列表(人事科)
</summary>
<param name="allotId"></param>
<returns></returns>
......
namespace Performance.DtoModels
{
public class view_allot_sign_dept
{
public int HospitalId { get; set; }
public int AllotID { get; set; }
public int Year { get; set; }
public int Month { get; set; }
public int UnitName { get; set; }
public int AccountingUnit { get; set; }
public int PerforFee { get; set; }
public int WorkloadFee { get; set; }
public int AssessBeforeOtherFee { get; set; }
public int PerforTotal { get; set; }
public int ScoringAverage { get; set; }
public int Extra { get; set; }
public int MedicineExtra { get; set; }
public int MaterialsExtra { get; set; }
public int AssessLaterOtherFee { get; set; }
public int AssessLaterPerforTotal { get; set; }
public int AdjustFactor { get; set; }
public int AdjustLaterOtherFee { get; set; }
public int AprPerforAmount { get; set; }
public int HideAprOtherPerforAmount { get; set; }
public int AssessLaterManagementFee { get; set; }
public int RealGiveFee { get; set; }
}
}
namespace Performance.DtoModels
{
public class view_allot_sign_emp
{
public int HospitalID { get; set; }
public int Year { get; set; }
public int Month { get; set; }
public int Source { get; set; }
public int AllotId { get; set; }
public int SecondId { get; set; }
public int States { get; set; }
public string UnitType { get; set; }
public string AccountingUnit { get; set; }
public string IsShowManage { get; set; }
public string EmployeeName { get; set; }
public string JobNumber { get; set; }
public string JobTitle { get; set; }
public string Emp_UnitType { get; set; }
public string Emp_AccountingUnit { get; set; }
public string BankCard { get; set; }
public string Batch { get; set; }
public string JobCategory { get; set; }
public string Duty { get; set; }
public string TitlePosition { get; set; }
public string PerforSumFee { get; set; }
public decimal PerforManagementFee { get; set; }
public decimal NightWorkPerfor { get; set; }
public decimal AdjustLaterOtherFee { get; set; }
public decimal OtherPerfor { get; set; }
public decimal HideOtherPerfor { get; set; }
public decimal ShouldGiveFee { get; set; }
public decimal ReservedRatioFee { get; set; }
public decimal RealGiveFee { get; set; }
}
}
......@@ -389,18 +389,11 @@ public List<view_allot_result> GetOwnerPerformance(List<int> hospitalId, string
return DapperQuery<view_allot_result>(sql, new { HospitalID = hospitalId, JobNumber = jobNumber })?.ToList();
}
public List<dynamic> QueryAllCompute(int hospitalId,int allotId)
public List<dynamic> QueryCompute(int allotId, string viewName)
{
var sql = $@"SELECT * FROM view_allot_result WHERE hospitalId = @hospitalId AND AllotId = @AllotId ORDER BY UnitType,AccountingUnit; ";
var sql = $@"SELECT * FROM {viewName} WHERE AllotId = @AllotId; ";
return DapperQuery<dynamic>(sql, new { hospitalId, allotId })?.ToList();
}
public List<dynamic> QueryAdminCompute(int hospitalId, int allotId)
{
var sql = $@"SELECT * FROM view_allot_result_finance WHERE hospitalId=@hospitalId AND allotId=@allotId ORDER BY UnitType,AccountingUnit;";
return DapperQuery<dynamic>(sql, new { hospitalId, allotId })?.ToList();
return DapperQuery<dynamic>(sql, new { allotId })?.ToList();
}
}
}
......@@ -1998,11 +1998,43 @@ private decimal GetDecimal(decimal? value, decimal _ = 0)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public List<cof_alias> CustomColumnHeaders(ComputerAliasRequest request)
public List<cof_alias> CustomColumnHeaders(int hospitalId, string route)
{
var result = cofaliasRepository.GetEntities(t => t.HospitalId == request.HospitalId && t.Route == request.Route && t.States == 1);
if (result == null || !result.Any()) return new List<cof_alias>();
return result;
var alias = cofaliasRepository.GetEntities(t => t.HospitalId == hospitalId && t.Route.Equals(route, StringComparison.OrdinalIgnoreCase));
var pairs = new Dictionary<string, List<cof_alias>>
{
{ "/result/compute" , ComputeConfig.AllComputeView },
{ "/result/wholehospital" , ComputeConfig.AllComputePersonView },
{ "/result/print/compute" , ComputeConfig.AllComputeDepartmentView },
};
var init = pairs.ContainsKey(route.ToLower()) ? pairs[route.ToLower()] : new List<cof_alias>();
foreach (var item in init)
{
item.HospitalId = hospitalId;
item.Route = route;
item.OriginalName = item.Alias;
}
if (alias != null && alias.Count > 0)
{
foreach (var item in alias)
{
var x = init.FirstOrDefault(w => w.Name == item.Name);
if (x == null)
{
init.Add(item);
}
else
{
x.HospitalId = hospitalId;
x.Route = route;
x.Alias = item.Alias;
x.States = item.States;
}
}
}
return init;
}
public bool Batch(BatchRequest request)
......@@ -2029,26 +2061,76 @@ public bool Batch(BatchRequest request)
return perforPerbatchRepository.AddRange(data.ToArray());
}
public List<dynamic> GetAllComputeView(int hospitalId,int AllotId,bool isAllCompte)
public List<dynamic> GetAllComputeView(int hospitalId, int AllotId, string viewName)
{
var viewResult = new List<dynamic>();
if (isAllCompte)
viewResult = reportRepository.QueryAllCompute(hospitalId, AllotId);
else
viewResult = reportRepository.QueryAdminCompute(hospitalId, AllotId);
// 人员字典
var employees = perforPeremployeeRepository.GetEntities(w => w.AllotId == AllotId);
return reportRepository.QueryCompute(AllotId, viewName);
}
}
viewResult.ForEach(t =>
public class ComputeConfig
{
var employee=employees?.FirstOrDefault(w => w.PersonnelNumber == t.JobNumber);
var real = Math.Round((t.PerforSumFee ?? 0) + (t.PerforManagementFee ?? 0) + (t.AdjustLaterOtherFee ?? 0), 2, MidpointRounding.AwayFromZero);
t.ReservedRatioFee = Math.Round(real * (employee?.ReservedRatio ?? 0), 2, MidpointRounding.AwayFromZero);
t.RealPerformance = Math.Round(t.ShouldGiveFee - (t.ReservedRatioFee ?? 0) ?? 0, 2, MidpointRounding.AwayFromZero);
});
public static List<cof_alias> AllComputeView { get; } = new List<cof_alias>
{
new cof_alias{ Alias = "来源", Name = nameof(view_allot_sign_emp.Source), States = 1},
new cof_alias{ Alias = "科室类别", Name = nameof(view_allot_sign_emp.UnitType), States = 1},
new cof_alias{ Alias = "核算单元", Name = nameof(view_allot_sign_emp.AccountingUnit), States = 1},
return viewResult;
}
new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1},
new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), States = 1},
new cof_alias{ Alias = "职务", Name = nameof(view_allot_sign_emp.JobTitle), 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.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.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.PerforManagementFee), States = 1},
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1},
new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1},
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1},
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1},
new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), 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},
};
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.AccountingUnit), States = 1},
new cof_alias{ Alias = "员工号", Name = nameof(view_allot_sign_emp.JobNumber), States = 1},
new cof_alias{ Alias = "人员姓名", Name = nameof(view_allot_sign_emp.EmployeeName), 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.PerforManagementFee), States = 1},
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_emp.AdjustLaterOtherFee), States = 1},
new cof_alias{ Alias = "夜班费", Name = nameof(view_allot_sign_emp.NightWorkPerfor), States = 1},
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_emp.OtherPerfor), States = 1},
new cof_alias{ Alias = "不公示其他绩效", Name = nameof(view_allot_sign_emp.HideOtherPerfor), States = 1},
new cof_alias{ Alias = "应发小计", Name = nameof(view_allot_sign_emp.ShouldGiveFee), 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},
};
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.AccountingUnit), States = 1},
new cof_alias{ Alias = "业绩绩效", Name = nameof(view_allot_sign_dept.PerforFee), States = 1},
new cof_alias{ Alias = "工作量绩效", Name = nameof(view_allot_sign_dept.WorkloadFee), States = 1},
new cof_alias{ Alias = "考核前其他绩效", Name = nameof(view_allot_sign_dept.AssessBeforeOtherFee), States = 1},
new cof_alias{ Alias = "考核前绩效合计", Name = nameof(view_allot_sign_dept.PerforTotal), States = 1},
new cof_alias{ Alias = "科室考核得分", Name = nameof(view_allot_sign_dept.ScoringAverage), States = 1},
new cof_alias{ Alias = "药占比奖罚", Name = nameof(view_allot_sign_dept.MedicineExtra), States = 1},
new cof_alias{ Alias = "材料占比奖罚", Name = nameof(view_allot_sign_dept.MaterialsExtra), States = 1},
new cof_alias{ Alias = "医院奖罚", Name = nameof(view_allot_sign_dept.Extra), States = 1},
new cof_alias{ Alias = "考核后其他绩效", Name = nameof(view_allot_sign_dept.AssessLaterOtherFee), States = 1},
new cof_alias{ Alias = "考核后绩效", Name = nameof(view_allot_sign_dept.AssessLaterPerforTotal), States = 1},
new cof_alias{ Alias = "调节系数", Name = nameof(view_allot_sign_dept.AdjustFactor), States = 1},
new cof_alias{ Alias = "调节后其他绩效", Name = nameof(view_allot_sign_dept.AdjustLaterOtherFee), States = 1},
new cof_alias{ Alias = "科主任实发管理绩效", Name = nameof(view_allot_sign_dept.AssessLaterManagementFee), States = 1},
new cof_alias{ Alias = "医院其他绩效", Name = nameof(view_allot_sign_dept.AprPerforAmount), 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},
};
}
}
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