Commit 78ba2d91 by lcx

原始数据修改列、系数、值

parent 1d47df2a
......@@ -4,6 +4,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Performance.DtoModels;
using Performance.Services;
namespace Performance.Api.Controllers
{
......@@ -14,6 +15,29 @@ namespace Performance.Api.Controllers
[ApiController]
public class OriginalController : Controller
{
private readonly ClaimService claim;
private readonly OriginalService originalService;
public OriginalController(ClaimService claim,
OriginalService originalService)
{
this.claim = claim;
this.originalService = originalService;
}
/// <summary>
/// 修改factor数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("factor")]
[HttpPost]
public ApiResponse FactorEdit([FromBody] OriginalRequest request)
{
var result = originalService.EditFactorData(claim.GetUserId(), request);
return result ? new ApiResponse(ResponseType.OK, "修改成功") : new ApiResponse(ResponseType.Fail, "修改失败");
}
/// <summary>
/// 修改header数据
/// </summary>
......@@ -23,7 +47,8 @@ public class OriginalController : Controller
[HttpPost]
public ApiResponse HeaderEdit([FromBody] OriginalRequest request)
{
return new ApiResponse(ResponseType.OK);
var result = originalService.EditHeaderData(claim.GetUserId(), request);
return result ? new ApiResponse(ResponseType.OK, "修改成功") : new ApiResponse(ResponseType.Fail, "修改失败");
}
/// <summary>
......@@ -34,7 +59,8 @@ public ApiResponse HeaderEdit([FromBody] OriginalRequest request)
[HttpPost]
public ApiResponse SheetEdit([FromBody] OriginalRequest request)
{
return new ApiResponse(ResponseType.OK);
var result = originalService.EditSheetData(claim.GetUserId(), request);
return result ? new ApiResponse(ResponseType.OK, "修改成功") : new ApiResponse(ResponseType.Fail, "修改失败");
}
}
}
......@@ -200,6 +200,13 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AllotController.UpdateAllotShowFormula(Performance.DtoModels.AllotRequest)">
<summary>
绩效详情计算公式显示/隐藏
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.BudgetController.Query(Performance.DtoModels.Request.BudgetRequest)">
<summary>
预算管理查询(包含金额、占比)
......@@ -509,6 +516,13 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.Audit(System.Int32)">
<summary>
人事科修改参数后提交
</summary>
<param name="allotid"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.GuaranteeController.Guarantee(Performance.DtoModels.GuaranteeRequest)">
<summary>
保底绩效配置列表
......@@ -694,6 +708,24 @@
</summary>
<returns></returns>
</member>
<member name="T:Performance.Api.Controllers.OriginalController">
<summary>
原始数据修改
</summary>
</member>
<member name="M:Performance.Api.Controllers.OriginalController.HeaderEdit(Performance.DtoModels.OriginalRequest)">
<summary>
修改header数据
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.OriginalController.SheetEdit(Performance.DtoModels.OriginalRequest)">
<summary>
修改sheet数据
</summary>
<returns></returns>
</member>
<member name="T:Performance.Api.Controllers.ReportController">
<summary>
报表
......
......@@ -1715,6 +1715,11 @@
是否开启药占比系数 1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.DtoModels.HospitalRequest.IsShowManage">
<summary>
是否显示绩效合计 1 显示绩效合计 2 显示管理绩效
</summary>
</member>
<member name="P:Performance.DtoModels.IncomeRequest.SheetNameKeyword">
<summary>
关键字匹配
......@@ -2081,6 +2086,16 @@
3 提取数据
</summary>
</member>
<member name="P:Performance.DtoModels.AllotResponse.Generate">
<summary>
1、人事科提交重新生成
</summary>
</member>
<member name="P:Performance.DtoModels.AllotResponse.ShowFormula">
<summary>
0 不显示 1 显示
</summary>
</member>
<member name="P:Performance.DtoModels.AssessDataResponse.AssessID">
<summary>
考核类别ID
......@@ -2307,6 +2322,9 @@
<member name="P:Performance.DtoModels.DeptDataDetails.Detail">
<summary> 收入明细 </summary>
</member>
<member name="P:Performance.DtoModels.DeptDataDetails.ShowFormula">
<summary> 0 不显示 1 显示 </summary>
</member>
<member name="P:Performance.DtoModels.DetailDtos.ItemName">
<summary> 收入项名称 </summary>
</member>
......@@ -2820,6 +2838,11 @@
单元格注释
</summary>
</member>
<member name="P:Performance.DtoModels.Cell.FieldName">
<summary>
数据库字段名称
</summary>
</member>
<member name="P:Performance.DtoModels.SheetResponse.SheetID">
<summary>
SheetID
......
......@@ -2497,7 +2497,12 @@
</member>
<member name="P:Performance.EntityModels.per_allot.Generate">
<summary>
1、人事科提交重新生成 2、生成成功
1、人事科提交重新生成
</summary>
</member>
<member name="P:Performance.EntityModels.per_allot.ShowFormula">
<summary>
0 不显示 1 显示
</summary>
</member>
<member name="T:Performance.EntityModels.per_budget_amount">
......@@ -4015,6 +4020,11 @@
是否开启规模/效率绩效 1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospital.IsShowManage">
<summary>
是否显示绩效合计 1 显示绩效合计 2 显示管理绩效
</summary>
</member>
<member name="T:Performance.EntityModels.sys_hospitalconfig">
<summary>
......
......@@ -8,25 +8,63 @@ namespace Performance.DtoModels
public class PerSheetHeader
{
// Tuple Items: 列明, 字段名, mergeRow, mergeCell, isTotal, isNumValue, 是否含有%
public static List<(string, Func<im_employee, object>, int, int, bool, bool, bool)> employeeHeaders =
new List<(string, Func<im_employee, object>, int, int, bool, bool, bool)>
public static List<(string, Func<im_employee, object>, int, int, bool, bool, bool, string)> employeeHeaders =
new List<(string, Func<im_employee, object>, int, int, bool, bool, bool, string)>
{
("核算单元类型", (t) => t.AccountType, 1, 1, false, false, false),
("核算单元", (t) => t.AccountingUnit, 1, 1, false, false, false),
("人员工号", (t) => t.PersonnelNumber, 1, 1, false, false, false),
("医生姓名", (t) => t.DoctorName, 1, 1, false, false, false),
("职称", (t) => t.JobTitle, 1, 1, false, true, false),
("绩效基数核算参考对象", (t) => t.FitPeople, 1, 1, false, false, false),
("岗位系数", (t) => t.PostCoefficient, 1, 1, false, true, false),
("参加工作时间", (t) => t.WorkTime, 1, 1, false, false, false),
("考核得分率", (t) => Math.Round(t.ScoreAverageRate.Value * 100, 2) , 1, 1, false, true, true),
("出勤率", (t) => Math.Round(t.Attendance.Value * 100, 2), 1, 1, false, true, true),
("核算单元医生数", (t) => t.PeopleNumber, 1, 1, false, true, false),
("工作量绩效", (t) =>t.Workload, 1, 1, false, true, false),
("其他绩效", (t) => t.OtherPerfor, 1, 1, false, true, false),
("医院奖罚", (t) => t.Punishment, 1, 1, false, true, false),
("调节系数", (t) => Math.Round(t.Adjust.Value * 100, 2), 1, 1, false, true, true),
("发放系数", (t) => t.Grant, 1, 1, false, true, false),
("核算单元类型", (t) => t.AccountType, 1, 1, false, false, false,"AccountType"),
("核算单元", (t) => t.AccountingUnit, 1, 1, false, false, false,"AccountingUnit"),
("人员工号", (t) => t.PersonnelNumber, 1, 1, false, false, false,"PersonnelNumber"),
("医生姓名", (t) => t.DoctorName, 1, 1, false, false, false,"DoctorName"),
("职称", (t) => t.JobTitle, 1, 1, false, true, false,"JobTitle"),
("绩效基数核算参考对象", (t) => t.FitPeople, 1, 1, false, false, false, "FitPeople"),
("岗位系数", (t) => t.PostCoefficient, 1, 1, false, true, false, "PostCoefficient"),
("参加工作时间", (t) => t.WorkTime, 1, 1, false, false, false, "WorkTime"),
("考核得分率", (t) => Math.Round(t.ScoreAverageRate.Value * 100, 2) , 1, 1, false, true, true, "ScoreAverageRate"),
("出勤率", (t) => Math.Round(t.Attendance.Value * 100, 2), 1, 1, false, true, true, "Attendance"),
("核算单元医生数", (t) => t.PeopleNumber, 1, 1, false, true, false, "PeopleNumber"),
("工作量绩效", (t) =>t.Workload, 1, 1, false, true, false, "Workload"),
("其他绩效", (t) => t.OtherPerfor, 1, 1, false, true, false, "OtherPerfor"),
("医院奖罚", (t) => t.Punishment, 1, 1, false, true, false, "Punishment"),
("调节系数", (t) => Math.Round(t.Adjust.Value * 100, 2), 1, 1, false, true, true, "Adjust"),
("发放系数", (t) => t.Grant, 1, 1, false, true, false, "Grant"),
};
// Tuple Items: 列明, 字段名, mergeRow, mergeCell, isTotal, isNumValue, 是否含有%
public static List<(string, Func<im_employee_clinic, object>, int, int, bool, bool, bool, string)> employeeClinicHeaders =
new List<(string, Func<im_employee_clinic, object>, int, int, bool, bool, bool, string)>
{
("核算单元分类", (t) => t.UnitType, 1, 1, false, false, false, "UnitType"),
("核算单元", (t) => t.AccountingUnit, 1, 1, false, false, false, "AccountingUnit"),
("人员工号", (t) => t.PersonnelNumber, 1, 1, false, false, false, "PersonnelNumber"),
("医生姓名", (t) => t.DoctorName, 1, 1, false, false, false, "DoctorName"),
("职称", (t) => t.JobTitle, 1, 1, false, true, false, "JobTitle"),
("岗位系数", (t) => t.PostCoefficient, 1, 1, false, true, false, "PostCoefficient"),
("效率绩效系数", (t) => Math.Round(t.Efficiency.Value * 100, 2), 1, 1, false, true, true, "Efficiency"),
("规模绩效系数", (t) => Math.Round(t.Scale.Value * 100, 2), 1, 1, false, true, true, "Scale"),
("管理绩效发放系数", (t) => Math.Round(t.Management.Value * 100, 2), 1, 1, false, true, true, "Management"),
("考核得分率", (t) => Math.Round(t.ScoreAverageRate.Value * 100, 2), 1, 1, false, true, true, "ScoreAverageRate"),
("出勤率", (t) => Math.Round(t.Attendance.Value * 100, 2), 1, 1, false, true, true, "Attendance"),
("其他绩效", (t) => t.OtherPerfor, 1, 1, false, true, false, "OtherPerfor"),
("医院奖罚", (t) => t.Punishment, 1, 1, false, true, false, "Punishment"),
("调节系数", (t) => Math.Round(t.Adjust.Value * 100, 2), 1, 1, false, true, true, "Adjust"),
};
// Tuple Items: 列明, 字段名, mergeRow, mergeCell, isTotal, isNumValue, 是否含有%
public static List<(string, Func<im_specialunit, object>, int, int, bool, bool, bool, string)> specialUnitHeaders =
new List<(string, Func<im_specialunit, object>, int, int, bool, bool, bool, string)>
{
("核算单元", (t) => t.AccountingUnit, 1, 1, false, false, false, "AccountingUnit"),
("科室", (t) => t.Department, 1, 1, false, false, false, "Department"),
("人数", (t) => t.Number, 1, 1, false, true, false, "Number"),
("量化指标", (t) => t.QuantitativeIndicators, 1, 1, false, true, false, "QuantitativeIndicators"),
("数量", (t) => t.Quantity, 1, 1, false, true, false, "Quantity"),
("量化指标绩效分值", (t) => t.QuantitativeIndicatorsValue, 1, 1, false, true, false, "QuantitativeIndicatorsValue"),
("考核得分率", (t) => Math.Round(t.ScoringAverage.Value * 100, 2), 1, 1, false, true, true, "ScoringAverage"),
("其他绩效", (t) => t.OtherPerfor, 1, 1, false, true, false, "OtherPerfor"),
("医院奖罚", (t) => t.Punishment, 1, 1, false, true, false, "Punishment"),
("调节系数", (t) => Math.Round(t.Adjust.Value * 100, 2), 1, 1, false, true, true, "Adjust"),
};
}
}
......@@ -8,6 +8,8 @@ public class OriginalRequest
{
public int SheetId { get; set; }
public int RowNumber { get; set; }
public List<Cell> Cells { get; set; }
}
}
......@@ -94,9 +94,13 @@ public object CellValue
public string Annotation { get; set; }
public int Id { get; set; }
/// <summary>
/// 数据库字段名称
/// </summary>
public string FieldName { get; set; }
public Cell() { }
public Cell(int pointCell, object cellValue, int mergeRow, int mergeCell, bool isTotal, bool isNumValue, string annotation = "", int id = 0)
public Cell(int pointCell, object cellValue, int mergeRow, int mergeCell, bool isTotal, bool isNumValue, string annotation = "", int id = 0, string fieldName = "")
{
PointCell = pointCell;
CellValue = cellValue;
......@@ -106,6 +110,7 @@ public Cell(int pointCell, object cellValue, int mergeRow, int mergeCell, bool i
IsNumValue = isNumValue;
Annotation = annotation;
Id = id;
FieldName = fieldName;
}
}
}
......@@ -95,5 +95,9 @@ public class im_data
///
/// </summary>
public string SignID { get; set; }
public Nullable<DateTime> UpdateDate { get; set; }
public Nullable<int> UpdateUser { get; set; }
}
}
......@@ -125,5 +125,9 @@ public class im_employee
/// 发放系数
/// </summary>
public Nullable<decimal> Grant { get; set; }
public Nullable<DateTime> UpdateDate { get; set; }
public Nullable<int> UpdateUser { get; set; }
}
}
......@@ -130,5 +130,9 @@ public class im_employee_clinic
/// 发放系数
/// </summary>
public Nullable<decimal> Grant { get; set; }
public Nullable<DateTime> UpdateDate { get; set; }
public Nullable<int> UpdateUser { get; set; }
}
}
......@@ -75,5 +75,9 @@ public class im_header
/// 1 汇总 2原始数据
/// </summary>
public Nullable<int> IsTotal { get; set; }
public Nullable<DateTime> UpdateDate { get; set; }
public Nullable<int> UpdateUser { get; set; }
}
}
......@@ -80,5 +80,9 @@ public class im_specialunit
/// 调节系数
/// </summary>
public Nullable<decimal> Adjust { get; set; }
public Nullable<DateTime> UpdateDate { get; set; }
public Nullable<int> UpdateUser { get; set; }
}
}
using NPOI.HSSF.Record.Chart;
using NPOI.SS.Formula.Functions;
using NPOI.SS.UserModel;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Performance.Services
......@@ -33,17 +37,43 @@ public class OriginalService : IAutoInjection
this.imspecialunitRepository = imspecialunitRepository;
}
public bool EditHeaderData(OriginalRequest request)
public bool EditFactorData(int userId, OriginalRequest request)
{
return true;
var allData = imdataRepository.GetEntities(t => t.SheetID == request.SheetId);
var basic = allData.FirstOrDefault(t => t.ID == request.Cells.FirstOrDefault(w => w.Id > 0).Id);
var updateData = allData.Where(t => t.UnitType == basic.UnitType);
foreach (var cell in request.Cells.Where(t => t.Id > 0))
{
var data = updateData.Where(t => t.TypeName == cell.FieldName).ToList();
var factor = ConvertHelper.To<decimal>(cell.CellValue);
if (data != null && data.Any())
{
data.ForEach(t =>
{
t.FactorValue = factor;
t.UpdateDate = DateTime.Now;
t.UpdateUser = userId;
});
}
}
return imdataRepository.UpdateRange(updateData.ToArray());
}
public bool EditSheetData(OriginalRequest request)
public bool EditHeaderData(int userId, OriginalRequest request)
{
var filters = new List<string> { "核算单元(医技组)", "核算单元(医生组)", "核算单元(护理组)", "科室名称", "核算单元", "核算单元类型", "" };
var headers = request.Cells.Where(t => !filters.Contains(t.FieldName));
var allData = imheaderRepository.GetEntities(t => headers.Select(w => w.Id).Contains(t.ID));
foreach (var data in allData)
{
return SheetCommonFactory(request);
data.CellValue = request.Cells.FirstOrDefault(w => w.Id == data.ID).CellValue.ToString();
data.UpdateDate = DateTime.Now;
data.UpdateUser = userId;
}
return imheaderRepository.UpdateRange(allData.ToArray());
}
private bool SheetCommonFactory(OriginalRequest request)
public bool EditSheetData(int userId, OriginalRequest request)
{
var sheet = persheetRepository.GetEntity(t => t.ID == request.SheetId);
if (sheet == null)
......@@ -52,30 +82,186 @@ private bool SheetCommonFactory(OriginalRequest request)
switch (sheet.SheetType)
{
case (int)SheetType.Employee:
return EditEmployee(request);
return EditEmployee(userId, request);
case (int)SheetType.ClinicEmployee:
return true;
case (int)SheetType.Workload:
return true;
case (int)SheetType.AccountBasic:
return true;
return EditEmployeeClinic(userId, request);
case (int)SheetType.SpecialUnit:
return true;
return EditSpecialUnit(userId, request);
case (int)SheetType.OtherIncome:
case (int)SheetType.Income:
case (int)SheetType.Expend:
return true;
case (int)SheetType.Workload:
case (int)SheetType.AccountBasic:
return EditFeeData(userId, request);
}
return false;
}
private bool EditEmployee(OriginalRequest request)
#region employee specialunit
private bool EditEmployee(int userId, OriginalRequest request)
{
var employees = imemployeeRepository.GetEntities(t => request.Cells.Select(c => c.Id).Contains(t.ID));
if (employees == null || !employees.Any(t => t.SheetID == request.SheetId))
var employee = imemployeeRepository.GetEntity(t => request.Cells.FirstOrDefault().Id == t.ID);
if (employee == null)
throw new PerformanceException("提交数据无效");
return false;
SetValue(employee, request.Cells);
employee.UpdateDate = DateTime.Now;
employee.UpdateUser = userId;
return imemployeeRepository.Update(employee);
}
private bool EditEmployeeClinic(int userId, OriginalRequest request)
{
var employeeClinic = imemployeeclinicRepository.GetEntity(t => request.Cells.FirstOrDefault().Id == t.ID);
if (employeeClinic == null)
throw new PerformanceException("提交数据无效");
SetValue(employeeClinic, request.Cells);
employeeClinic.UpdateDate = DateTime.Now;
employeeClinic.UpdateUser = userId;
return imemployeeclinicRepository.Update(employeeClinic);
}
private bool EditSpecialUnit(int userId, OriginalRequest request)
{
var specialUnit = imspecialunitRepository.GetEntity(t => request.Cells.FirstOrDefault().Id == t.ID);
if (specialUnit == null)
throw new PerformanceException("提交数据无效");
SetValue(specialUnit, request.Cells);
specialUnit.UpdateDate = DateTime.Now;
specialUnit.UpdateUser = userId;
return imspecialunitRepository.Update(specialUnit);
}
private void SetValue<TEntity>(TEntity entity, List<Cell> cells)
{
PropertyInfo[] info = (typeof(TEntity)).GetProperties();
foreach (var item in info)
{
//// 修改前的值
//var result = typeof(TEntity).GetProperty(item.Name).GetValue(entity);
var element = PerSheetHeader.employeeHeaders.FirstOrDefault(t => t.Item8 == item.Name);
var index = PerSheetHeader.employeeHeaders.IndexOf(element);
if (index < 0) continue;
var cell = cells.FirstOrDefault(t => t.PointCell == index);
if (cell == null) continue;
typeof(TEntity).GetProperty(item.Name).SetValue(entity, cell.CellValue);
}
}
#endregion
#region imdata
private bool EditFeeData(int userId, OriginalRequest request)
{
var result = false;
var allData = imdataRepository.GetEntities(t => t.SheetID == request.SheetId);
if (allData == null || !allData.Any(t => t.RowNumber == request.RowNumber))
throw new PerformanceException("提交数据无效");
var updateData = request.Cells.Where(t => t.Id > 0);
if (updateData != null && updateData.Any())
{
var data = allData.Where(t => t.RowNumber == request.RowNumber).ToList();
ImDataPublic(request.Cells, data);
var publicTypes = new string[] { "核算单元(医技组)", "核算单元(医生组)", "核算单元(护理组)", "科室名称", "核算单元", "核算单元类型" };
request.Cells.Where(t => publicTypes.Contains(t.FieldName)).ToList().ForEach(t =>
{
var type = t.CellValue.GetType();
if (type.Name != "String")
{
var entity = data.FirstOrDefault(w => w.ID == t.Id);
entity.CellValue = ConvertHelper.To<decimal?>(t.CellValue);
entity.UpdateDate = DateTime.Now;
entity.UpdateUser = userId;
}
});
result = imdataRepository.UpdateRange(data.ToArray());
}
result = ImDataInsert(userId, request, allData);
return result;
}
private void ImDataPublic(IEnumerable<Cell> cells, List<im_data> allData)
{
Dictionary<int, string> publicTypes = new Dictionary<int, string>
{
{ (int)UnitType.医技组, "核算单元(医技组)" },
{ (int)UnitType.医生组, "核算单元(医生组)" },
{ (int)UnitType.护理组, "核算单元(护理组)" },
};
foreach (var item in publicTypes)
{
var cellvalue = cells.FirstOrDefault(t => t.FieldName == item.Value).CellValue.ToString();
var unitType = allData.FirstOrDefault(t => t.UnitType == item.Key).AccountingUnit;
if (cellvalue != unitType)
{
allData.Where(t => t.UnitType == item.Key).ToList().ForEach(t =>
{
t.AccountingUnit = cellvalue;
});
}
}
var celldept = cells.FirstOrDefault(t => t.FieldName == "科室名称").CellValue.ToString();
var department = allData.FirstOrDefault().Department;
if (celldept != department)
{
allData.ForEach(t =>
{
t.Department = celldept;
});
}
}
private bool ImDataInsert(int userId, OriginalRequest request, List<im_data> allData)
{
var addData = request.Cells.Where(t => t.Id == 0).ToList();
if (addData == null || !addData.Any())
return true;
// 列
var headers = imheaderRepository.GetEntities(t => t.SheetID == request.SheetId);
// 核算单元、科室
var publicData = allData.First();
// rownumber含有的核算类型
var unittype = allData.Where(t => t.RowNumber == request.RowNumber).Select(t => t.UnitType).Distinct();
var factor = allData.Where(t => unittype.Contains(t.UnitType)).GroupBy(t => new { t.UnitType, t.TypeName }).Select(t => new
{
UnitType = t.Key.UnitType,
TypeName = t.Key.TypeName,
FactorValue = t.Max(group => group.FactorValue)
});
var newData = addData.Join(factor, inner => inner.FieldName, outer => outer.TypeName, (inner, outer) => new { inner, outer })
.Select(t =>
{
var singId = headers.FirstOrDefault(w => w.CellValue == t.inner.FieldName)?.SignID;
return new im_data
{
RowNumber = request.RowNumber,
AccountingUnit = publicData.AccountingUnit,
Department = publicData.Department,
UnitType = t.outer.UnitType,
TypeName = t.inner.FieldName,
CellValue = ConvertHelper.To<decimal>(t.inner.CellValue),
IsFactor = 1,
FactorValue = t.outer.FactorValue,
SignID = singId,
UpdateDate = DateTime.Now,
UpdateUser = userId,
};
});
return imdataRepository.AddRange(newData.ToArray());
}
#endregion
}
}
......@@ -213,40 +213,40 @@ private void CommonExport(int sheetID, SheetExportResponse response)
var data = dataList.FirstOrDefault(t => t.RowNumber == rowNumber && t.SignID == head.SignID);
var value = data?.CellValue;
if (value.HasValue && value.Value > 0)
rowbody.Data.Add(new Cell(head.PointCell.Value, value, 1, 1, data.IsTotal == 1, true, data.Annotation));
rowbody.Data.Add(new Cell(head.PointCell.Value, value, 1, 1, data.IsTotal == 1, true, data.Annotation, data.ID, head.CellValue));
}
else if (head.CellValue.Contains("核算单元"))
{
if (head.CellValue.Contains("医生组"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber && t.UnitType == 1)?.AccountingUnit;
rowbody.Data.Add(new Cell(head.PointCell.Value, value, 1, 1, false, false));
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber && t.UnitType == 1);
rowbody.Data.Add(new Cell(head.PointCell.Value, value?.AccountingUnit, 1, 1, false, false, "", value?.ID ?? 0, head.CellValue));
}
else if (head.CellValue.Contains("护理组"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber && t.UnitType == 2)?.AccountingUnit;
rowbody.Data.Add(new Cell(head.PointCell.Value, value, 1, 1, false, false));
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber && t.UnitType == 2);
rowbody.Data.Add(new Cell(head.PointCell.Value, value?.AccountingUnit, 1, 1, false, false, "", value?.ID ?? 0, head.CellValue));
}
else if (head.CellValue.Contains("医技组"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber && t.UnitType == 3)?.AccountingUnit;
rowbody.Data.Add(new Cell(head.PointCell.Value, value, 1, 1, false, false));
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber && t.UnitType == 3);
rowbody.Data.Add(new Cell(head.PointCell.Value, value?.AccountingUnit, 1, 1, false, false, "", value?.ID ?? 0, head.CellValue));
}
else
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber)?.AccountingUnit;
rowbody.Data.Add(new Cell(head.PointCell.Value, value, 1, 1, false, false));
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber);
rowbody.Data.Add(new Cell(head.PointCell.Value, value?.AccountingUnit, 1, 1, false, false, "", value?.ID ?? 0, head.CellValue));
}
}
else if (head.CellValue.Contains("科室名称"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber).Department;
rowbody.Data.Add(new Cell(head.PointCell.Value, value, 1, 1, false, false));
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber);
rowbody.Data.Add(new Cell(head.PointCell.Value, value.Department, 1, 1, false, false, "", value.ID, head.CellValue));
}
else if (head.CellValue.Contains("备注"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber).Remark;
rowbody.Data.Add(new Cell(head.PointCell.Value, value, 1, 1, false, false));
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber);
rowbody.Data.Add(new Cell(head.PointCell.Value, value.Remark, 1, 1, false, false, "", value.ID, head.CellValue));
}
else if (!rowbody.Data.Any(t => t.PointCell == head.PointCell))
{
......@@ -255,9 +255,9 @@ private void CommonExport(int sheetID, SheetExportResponse response)
if (value.HasValue)
{
if (!percentparam.Contains(head.CellValue))
rowbody.Data.Add(new Cell(head.PointCell.Value, value, 1, 1, data.IsTotal == 1, true, data.Annotation, data.ID));
rowbody.Data.Add(new Cell(head.PointCell.Value, value, 1, 1, data.IsTotal == 1, true, data.Annotation, data.ID, head.CellValue));
else
rowbody.Data.Add(new Cell(head.PointCell.Value, Math.Round(value.Value * 100, 2) + "%", 1, 1, data.IsTotal == 1, true, data.Annotation, data.ID));
rowbody.Data.Add(new Cell(head.PointCell.Value, Math.Round(value.Value * 100, 2) + "%", 1, 1, data.IsTotal == 1, true, data.Annotation, data.ID, head.CellValue));
}
}
}
......@@ -436,7 +436,7 @@ private void EmployeeExport(int sheetID, SheetExportResponse response)
int index = 1;
foreach (var item in pairs)
{
row.Data.Add(new Cell(index, item.Item1, item.Item3, item.Item4, item.Item5, item.Item6));
row.Data.Add(new Cell(index, item.Item1, item.Item3, item.Item4, item.Item5, item.Item6, fieldName: item.Item8));
index += 1;
}
response.Header.Add(row);
......@@ -449,15 +449,15 @@ private void EmployeeExport(int sheetID, SheetExportResponse response)
foreach (var item in pairs)
{
if (item.Item7)
rowbody.Data.Add(new Cell(index, $"{item.Item2.Invoke(employee)}%", item.Item3, item.Item4, item.Item5, item.Item6, id: employee.ID));
rowbody.Data.Add(new Cell(index, $"{item.Item2.Invoke(employee)}%", item.Item3, item.Item4, item.Item5, item.Item6, id: employee.ID, fieldName: item.Item8));
else
rowbody.Data.Add(new Cell(index, item.Item2.Invoke(employee), item.Item3, item.Item4, item.Item5, item.Item6, id: employee.ID));
rowbody.Data.Add(new Cell(index, item.Item2.Invoke(employee), item.Item3, item.Item4, item.Item5, item.Item6, id: employee.ID, fieldName: item.Item8));
index += 1;
}
response.Row.Add(rowbody);
}
var workDateIndex = pairs.IndexOf(("参加工作时间", (t) => t.WorkTime, 1, 1, false, false, false));
var workDateIndex = pairs.IndexOf(("参加工作时间", (t) => t.WorkTime, 1, 1, false, false, false, "WorkTime"));
response.Row.ForEach(t =>
{
var workDate = t.Data.FirstOrDefault(f => f.PointCell == workDateIndex)?.CellValue;
......@@ -475,30 +475,12 @@ private void ClinicEmployeeExport(int sheetID, SheetExportResponse response)
if (clinicemployeeList != null && clinicemployeeList.Count() > 0)
{
// Tuple Items: 列明, 字段名, mergeRow, mergeCell, isTotal, isNumValue, 是否含有%
List<(string, Func<im_employee_clinic, object>, int, int, bool, bool, bool)> pairs =
new List<(string, Func<im_employee_clinic, object>, int, int, bool, bool, bool)>
{
("核算单元分类", (t) => t.UnitType, 1, 1, false, false, false),
("核算单元", (t) => t.AccountingUnit, 1, 1, false, false, false),
("人员工号", (t) => t.PersonnelNumber, 1, 1, false, false, false),
("医生姓名", (t) => t.DoctorName, 1, 1, false, false, false),
("职称", (t) => t.JobTitle, 1, 1, false, true, false),
("岗位系数", (t) => t.PostCoefficient, 1, 1, false, true, false),
("效率绩效系数", (t) => Math.Round(t.Efficiency.Value * 100, 2), 1, 1, false, true, true),
("规模绩效系数", (t) => Math.Round(t.Scale.Value * 100, 2), 1, 1, false, true, true),
("管理绩效发放系数", (t) => Math.Round(t.Management.Value * 100, 2), 1, 1, false, true, true),
("考核得分率", (t) => Math.Round(t.ScoreAverageRate.Value * 100, 2), 1, 1, false, true, true),
("出勤率", (t) => Math.Round(t.ScoreAverageRate.Value * 100, 2), 1, 1, false, true, true),
("其他绩效", (t) => t.OtherPerfor, 1, 1, false, true, false),
("医院奖罚", (t) => t.Punishment, 1, 1, false, true, false),
("调节系数", (t) => Math.Round(t.Adjust.Value * 100, 2), 1, 1, false, true, true),
};
var pairs = PerSheetHeader.employeeClinicHeaders;
var row = new Row(0);
int index = 1;
foreach (var item in pairs)
{
row.Data.Add(new Cell(index, item.Item1, item.Item3, item.Item4, item.Item5, item.Item6));
row.Data.Add(new Cell(index, item.Item1, item.Item3, item.Item4, item.Item5, item.Item6, fieldName: item.Item8));
index += 1;
}
response.Header.Add(row);
......@@ -527,26 +509,12 @@ private void SpecialUnitExport(int sheetID, SheetExportResponse response)
if (list != null && list.Count() > 0)
{
// Tuple Items: 列明, 字段名, mergeRow, mergeCell, isTotal, isNumValue, 是否含有%
List<(string, Func<im_specialunit, object>, int, int, bool, bool, bool)> pairs =
new List<(string, Func<im_specialunit, object>, int, int, bool, bool, bool)>
{
("核算单元", (t) => t.AccountingUnit, 1, 1, false, false, false),
("科室", (t) => t.Department, 1, 1, false, false, false),
("人数", (t) => t.Number, 1, 1, false, true, false),
("量化指标", (t) => t.QuantitativeIndicators, 1, 1, false, true, false),
("数量", (t) => t.Quantity, 1, 1, false, true, false),
("量化指标绩效分值", (t) => t.QuantitativeIndicatorsValue, 1, 1, false, true, false),
("考核得分率", (t) => Math.Round(t.ScoringAverage.Value * 100, 2), 1, 1, false, true, true),
("其他绩效", (t) => t.OtherPerfor, 1, 1, false, true, false),
("医院奖罚", (t) => t.Punishment, 1, 1, false, true, false),
("调节系数", (t) => Math.Round(t.Adjust.Value * 100, 2), 1, 1, false, true, true),
};
var pairs = PerSheetHeader.specialUnitHeaders;
var row = new Row(0);
int index = 1;
foreach (var item in pairs)
{
row.Data.Add(new Cell(index, item.Item1, item.Item3, item.Item4, item.Item5, item.Item6));
row.Data.Add(new Cell(index, item.Item1, item.Item3, item.Item4, item.Item5, item.Item6, fieldName: item.Item8));
index += 1;
}
response.Header.Add(row);
......@@ -559,9 +527,9 @@ private void SpecialUnitExport(int sheetID, SheetExportResponse response)
foreach (var item in pairs)
{
if (item.Item7)
rowbody.Data.Add(new Cell(index, $"{item.Item2.Invoke(specialunit)}%", item.Item3, item.Item4, item.Item5, item.Item6, id: specialunit.ID));
rowbody.Data.Add(new Cell(index, $"{item.Item2.Invoke(specialunit)}%", item.Item3, item.Item4, item.Item5, item.Item6, id: specialunit.ID, fieldName: item.Item8));
else
rowbody.Data.Add(new Cell(index, item.Item2.Invoke(specialunit), item.Item3, item.Item4, item.Item5, item.Item6, id: specialunit.ID));
rowbody.Data.Add(new Cell(index, item.Item2.Invoke(specialunit), item.Item3, item.Item4, item.Item5, item.Item6, id: specialunit.ID, fieldName: item.Item8));
index += 1;
}
response.Row.Add(rowbody);
......@@ -588,9 +556,9 @@ private SheetExportResponse AddFactor(SheetExportResponse response, Row row, Lis
{
if (!array.Contains(header.CellValue))
{
decimal? value = dataList.FirstOrDefault(t => t.AllotID == header.AllotID && t.SheetID == header.SheetID && t.IsFactor == 1
&& t.TypeName == header.CellValue)?.FactorValue;
row.Data.Add(new Cell(header.PointCell.Value, value, 1, 1, header.IsTotal == 1, false));
var value = dataList.FirstOrDefault(t => t.AllotID == header.AllotID && t.SheetID == header.SheetID && t.IsFactor == 1
&& t.TypeName == header.CellValue);
row.Data.Add(new Cell(header.PointCell.Value, value?.FactorValue, 1, 1, header.IsTotal == 1, false, id: value?.ID ?? 0, fieldName: header.CellValue));
}
}
}
......@@ -601,9 +569,9 @@ private SheetExportResponse AddFactor(SheetExportResponse response, Row row, Lis
{
if (!array.Contains(header.CellValue))
{
decimal? value = dataList.FirstOrDefault(t => t.AllotID == header.AllotID && t.SheetID == header.SheetID && t.IsFactor == 1
&& t.TypeName == header.CellValue && t.UnitType == (int)unitType)?.FactorValue;
row.Data.Add(new Cell(header.PointCell.Value, value, 1, 1, header.IsTotal == 1, false));
var value = dataList.FirstOrDefault(t => t.AllotID == header.AllotID && t.SheetID == header.SheetID && t.IsFactor == 1
&& t.TypeName == header.CellValue && t.UnitType == (int)unitType);
row.Data.Add(new Cell(header.PointCell.Value, value?.FactorValue, 1, 1, header.IsTotal == 1, false, id: value?.ID ?? 0, fieldName: header.CellValue));
}
}
}
......
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