handsontable

parent 16e726ae
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Performance.DtoModels;
using Performance.DtoModels.Response;
using Performance.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Performance.Api.Controllers
{
[Route("api/collect")]
[ApiController]
public class CollectController : ControllerBase
{
private readonly ILogger<CollectController> logger;
private readonly ClaimService claim;
private readonly CollectService collectService;
public CollectController(
ILogger<CollectController> logger,
ClaimService claim,
CollectService collectService)
{
this.logger = logger;
this.claim = claim;
this.collectService = collectService;
}
/// <summary>
/// 查询采集内容
/// </summary>
[HttpPost]
[Route("getcollectcontent")]
public ApiResponse GetCollectContent([FromQuery]int hospitalId, [FromQuery]int userId)
{
if (hospitalId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
var result = collectService.GetCollectContent(hospitalId, userId);
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
/// 设置采集录入权限
/// </summary>
[HttpPost]
[Route("setpermission/{userid}")]
public ApiResponse SetPermission(int userid, [FromBody] IEnumerable<CollectPermission> collects)
{
if (collects == null || !collects.Any())
return new ApiResponse(ResponseType.ParameterError, "参数无效");
collectService.SetPermission(userid, collects);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 获取采集SHEET名称
/// </summary>
[HttpPost]
[Route("getcollectsheet/{hospitalId}")]
public ApiResponse GetCollectSheet(int hospitalId)
{
if (hospitalId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
var userId = claim.GetUserId();
var result = collectService.GetCollectSheet(hospitalId, userId)
?.Select(w => new { w.SheetType, w.SheetName })
.Distinct()
.ToList();
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
/// 加载采集内容
/// </summary>
[HttpPost]
[Route("getcollectdata/{allotId}")]
public ApiResponse GetCollectData(int allotId, [FromQuery] string sheetName)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
var userId = claim.GetUserId();
var result = collectService.GetCollectData(userId, allotId, sheetName);
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
/// 保存采集内容
/// </summary>
[HttpPost]
[Route("savecollectdata/{allotId}")]
public ApiResponse SaveCollectData(int allotId, [FromBody] SaveCollectData request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
collectService.SaveCollectData(allotId, request);
return new ApiResponse(ResponseType.OK);
}
}
}
\ No newline at end of file
......@@ -284,6 +284,31 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.CollectController.GetCollectContent(System.Int32,System.Int32)">
<summary>
查询采集内容
</summary>
</member>
<member name="M:Performance.Api.Controllers.CollectController.SetPermission(System.Int32,System.Collections.Generic.IEnumerable{Performance.DtoModels.Response.CollectPermission})">
<summary>
设置采集录入权限
</summary>
</member>
<member name="M:Performance.Api.Controllers.CollectController.GetCollectSheet(System.Int32)">
<summary>
获取采集SHEET名称
</summary>
</member>
<member name="M:Performance.Api.Controllers.CollectController.GetCollectData(System.Int32,System.String)">
<summary>
加载采集内容
</summary>
</member>
<member name="M:Performance.Api.Controllers.CollectController.SaveCollectData(System.Int32,Performance.DtoModels.SaveCollectData)">
<summary>
保存采集内容
</summary>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.GetCompute(Performance.DtoModels.ComputerRequest)">
<summary>
获取绩效发放列表
......
......@@ -2311,6 +2311,31 @@
医院总收支结余
</summary>
</member>
<member name="P:Performance.DtoModels.Response.CollectPermission.HeadName">
<summary>
列头名称
</summary>
</member>
<member name="P:Performance.DtoModels.Response.CollectPermission.BanChange">
<summary>
禁止修改
</summary>
</member>
<member name="P:Performance.DtoModels.Response.CollectPermission.Readnoly">
<summary>
0 可读可写 1 只读
</summary>
</member>
<member name="P:Performance.DtoModels.Response.CollectPermission.Visible">
<summary>
是否可见 0 不可见 1 可见
</summary>
</member>
<member name="P:Performance.DtoModels.Response.CollectPermission.AttachLast">
<summary>
是否附带上次绩效 0 不附带 1 附带
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeResponse.Source">
<summary>
来源
......
......@@ -97,6 +97,12 @@
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_workyear">
<summary> 工龄对应绩效系数配置 </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.collect_data">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.collect_permission">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.ex_item">
<summary> </summary>
</member>
......@@ -1499,6 +1505,121 @@
绩效系数
</summary>
</member>
<member name="T:Performance.EntityModels.collect_data">
<summary>
采集数据
</summary>
</member>
<member name="P:Performance.EntityModels.collect_data.ID">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.collect_data.AllotID">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.collect_data.SheetName">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.collect_data.UnitType">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.collect_data.RowNumber">
<summary>
行号
</summary>
</member>
<member name="P:Performance.EntityModels.collect_data.EmployeeName">
<summary>
人员姓名
</summary>
</member>
<member name="P:Performance.EntityModels.collect_data.JobNumber">
<summary>
人员工号
</summary>
</member>
<member name="P:Performance.EntityModels.collect_data.AccountingUnitTechnician">
<summary>
核算单元名称 医技
</summary>
</member>
<member name="P:Performance.EntityModels.collect_data.AccountingUnitNurse">
<summary>
核算单元名称 护士
</summary>
</member>
<member name="P:Performance.EntityModels.collect_data.AccountingUnitDoctor">
<summary>
核算单元名称 医生
</summary>
</member>
<member name="P:Performance.EntityModels.collect_data.Department">
<summary>
科室名称
</summary>
</member>
<member name="P:Performance.EntityModels.collect_data.TypeName">
<summary>
列头类型名称
</summary>
</member>
<member name="P:Performance.EntityModels.collect_data.CellValue">
<summary>
单元格value
</summary>
</member>
<member name="T:Performance.EntityModels.collect_permission">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.collect_permission.ID">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.collect_permission.HospitalId">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.collect_permission.UserId">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.collect_permission.SheetName">
<summary>
列头类型名称
</summary>
</member>
<member name="P:Performance.EntityModels.collect_permission.HeadName">
<summary>
列头名称
</summary>
</member>
<member name="P:Performance.EntityModels.collect_permission.Readnoly">
<summary>
0 可读可写 1 只读
</summary>
</member>
<member name="P:Performance.EntityModels.collect_permission.AttachLast">
<summary>
是否附带上次绩效 0 不附带 1 附带
</summary>
</member>
<member name="P:Performance.EntityModels.collect_permission.Visible">
<summary>
0 可见 1 不可见
</summary>
</member>
<member name="T:Performance.EntityModels.ex_item">
<summary>
......
using Performance.EntityModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Performance.DtoModels
{
public class HandsonTable
{
private IEnumerable<collect_permission> _permissions;
private List<Dictionary<string, string>> _data;
public HandsonTable(int sheetType, string[] cols, List<collect_permission> permissions)
{
_permissions = permissions;
_data = new List<Dictionary<string, string>>();
InitColHeaders(sheetType, cols);
InitColumns(permissions);
}
public string[] ColHeaders { get; private set; }
public List<Dictionary<string, string>> Data => _data;
public HandsonColumn[] Columns { get; private set; }
public void SetRowData(IEnumerable<HandsonRowData> datas)
{
foreach (var dt in datas)
{
var dic = CreateDataRow("编号", dt.Row.ToString());
foreach (var item in dt.CellData)
{
if (dic.ContainsKey(item.Name) && _permissions.Any(w => w.HeadName == item.Name && w.AttachLast > 0))
dic[item.Name] = item.Value?.ToString();
}
_data.Add(dic);
}
}
private void InitColHeaders(int sheetType, string[] cols)
{
var defaluts = new DefalutHandsonHeader[]
{
new DefalutHandsonHeader{ SheetType = SheetType.OtherIncome, Necessity = new[] { "核算单元(医技组)","核算单元(医生组)","核算单元(护理组)","科室名称" } },
new DefalutHandsonHeader{ SheetType = SheetType.Expend, Necessity = new[] { "核算单元(医技组)","核算单元(医生组)","核算单元(护理组)","科室名称" } },
new DefalutHandsonHeader{ SheetType = SheetType.Workload, Necessity = new[] { "核算单元","科室名称" } },
//new DefalutHandsonHeader{ SheetType = SheetType.AccountExtra, Necessity = new[] { "核算单元","科室名称" } },
//new DefalutHandsonHeader{ SheetType = SheetType.PersonExtra, Necessity = new[] { "核算单元","科室名称" } },
};
var necessitys = defaluts.FirstOrDefault(w => sheetType == (int)w.SheetType)?.Necessity.ToList();
necessitys = necessitys ?? new List<string>();
foreach (var item in cols)
{
if (!necessitys.Contains(item))
necessitys.Add(item);
if (!_permissions.Any(w => w.HeadName == item && w.Visible == 0))
necessitys.Remove(item);
}
ColHeaders = necessitys.ToArray();
}
private void InitColumns(List<collect_permission> permissions)
{
List<HandsonColumn> columns = new List<HandsonColumn>();
foreach (var item in ColHeaders)
{
var readnoly = _permissions.FirstOrDefault(f => f.HeadName == item)?.Readnoly == 1;
columns.Add(new HandsonColumn(item, readnoly));
}
Columns = columns.ToArray();
}
private Dictionary<string, string> CreateDataRow(string key, string value)
{
var temp = new Dictionary<string, string>() { { key, value } };
foreach (var item in ColHeaders)
{
if (!temp.ContainsKey(item))
temp.Add(item, "");
}
return temp;
}
}
public class HandsonColumn
{
public HandsonColumn(string data, bool readOnly = false)
{
Data = data;
ReadOnly = readOnly;
}
public string Data { get; set; }
public bool ReadOnly { get; set; }
}
public class DefalutHandsonHeader
{
public SheetType SheetType { get; set; }
public string[] Necessity { get; set; }
}
public class HandsonRowData
{
public HandsonRowData(int row, IEnumerable<HandsonCellData> cellData)
{
Row = row;
CellData = cellData;
}
public int Row { get; set; }
public IEnumerable<HandsonCellData> CellData { get; set; }
}
public class HandsonCellData
{
public HandsonCellData(string name, object value)
{
Name = name;
Value = value;
}
public string Name { get; set; }
public object Value { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels.Response
{
public class CollectPermission
{
public int HospitalId { get; set; }
public string SheetName { get; set; }
public int? PermissionId { get; set; }
/// <summary>
/// 列头名称
/// </summary>
public string HeadName { get; set; }
/// <summary>
/// 禁止修改
/// </summary>
public bool BanChange { get; set; }
/// <summary>
/// 0 可读可写 1 只读
/// </summary>
public int Readnoly { get; set; }
/// <summary>
/// 是否可见 0 不可见 1 可见
/// </summary>
public int Visible { get; set; }
/// <summary>
/// 是否附带上次绩效 0 不附带 1 附带
/// </summary>
public int AttachLast { get; set; }
public int SheetType { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class SaveCollectData
{
public int SheetType { get; set; }
public string SheetName { get; set; }
public string[] ColHeaders { get; set; }
public string[][] Data { get; set; }
}
}
......@@ -75,6 +75,10 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
/// <summary> 工龄对应绩效系数配置 </summary>
public virtual DbSet<cof_workyear> cof_workyear { get; set; }
/// <summary> </summary>
public virtual DbSet<collect_data> collect_data { get; set; }
/// <summary> </summary>
public virtual DbSet<collect_permission> collect_permission { get; set; }
/// <summary> </summary>
public virtual DbSet<ex_item> ex_item { get; set; }
/// <summary> </summary>
public virtual DbSet<ex_module> ex_module { get; set; }
......
//-----------------------------------------------------------------------
// <copyright file=" ag_data.cs">
// * FileName: 二次分配不固定数据.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
/// 采集数据
/// </summary>
[Table("collect_data")]
public class collect_data
{
/// <summary>
///
/// </summary>
[Key]
public int ID { get; set; }
/// <summary>
///
/// </summary>
public int AllotID { get; set; }
/// <summary>
///
/// </summary>
public string SheetName { get; set; }
/// <summary>
///
/// </summary>
public string UnitType { get; set; }
/// <summary>
/// 行号
/// </summary>
public int RowNumber { get; set; }
/// <summary>
/// 人员姓名
/// </summary>
public string EmployeeName { get; set; }
/// <summary>
/// 人员工号
/// </summary>
public string JobNumber { get; set; }
/// <summary>
/// 核算单元名称 医技
/// </summary>
public string AccountingUnitTechnician { get; set; }
/// <summary>
/// 核算单元名称 护士
/// </summary>
public string AccountingUnitNurse { get; set; }
/// <summary>
/// 核算单元名称 医生
/// </summary>
public string AccountingUnitDoctor { get; set; }
/// <summary>
/// 科室名称
/// </summary>
public string Department { get; set; }
/// <summary>
/// 列头类型名称
/// </summary>
public string TypeName { get; set; }
/// <summary>
/// 单元格value
/// </summary>
public string CellValue { get; set; }
}
}
//-----------------------------------------------------------------------
// <copyright file=" ag_data.cs">
// * FileName: 二次分配不固定数据.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("collect_permission")]
public class collect_permission
{
/// <summary>
///
/// </summary>
[Key]
public int ID { get; set; }
/// <summary>
///
/// </summary>
public int HospitalId { get; set; }
/// <summary>
///
/// </summary>
public int UserId { get; set; }
/// <summary>
/// 列头类型名称
/// </summary>
public string SheetName { get; set; }
/// <summary>
/// 列头名称
/// </summary>
public string HeadName { get; set; }
/// <summary>
/// 0 可读可写 1 只读
/// </summary>
public int? Readnoly { get; set; }
/// <summary>
/// 是否附带上次绩效 0 不附带 1 附带
/// </summary>
public int AttachLast { get; set; }
public int SheetType { get; set; }
/// <summary>
/// 0 可见 1 不可见
/// </summary>
public int Visible { get; set; }
}
}
......@@ -54,6 +54,29 @@ public static T Deserialize<T>(string json)
}
/// <summary>
/// 将指定的 JSON 数据反序列化成指定对象。
/// </summary>
/// <typeparam name="T">对象类型。</typeparam>
/// <param name="json">JSON 数据。</param>
/// <returns></returns>
public static T Deserialize<T>(Dictionary<string, object> @object)
{
var json = JsonConvert.SerializeObject(@object, Formatting.None, _jsonSettings);
return JsonConvert.DeserializeObject<T>(json, _jsonSettings);
}
/// <summary>
/// 将转换后的Key全部设置为小写
/// </summary>
/// <param name="json"></param>
/// <returns></returns>
public static SortedDictionary<string, object> Deserialize(object @object)
{
var json = JsonConvert.SerializeObject(@object, Formatting.None, _jsonSettings);
return Deserialize<SortedDictionary<string, object>>(json);
}
/// <summary>
/// 将转换后的Key全部设置为小写
/// </summary>
/// <param name="json"></param>
......
//-----------------------------------------------------------------------
// <copyright file=" ag_againsituation.cs">
// * FileName: ag_againsituation.cs
// </copyright>
//-----------------------------------------------------------------------
using Performance.EntityModels;
using System;
namespace Performance.Repository
{
/// <summary>
/// collect_data Repository
/// </summary>
public partial class PerforcollectdataRepository : PerforRepository<collect_data>
{
public PerforcollectdataRepository(PerformanceDbContext context) : base(context)
{
}
}
}
//-----------------------------------------------------------------------
// <copyright file=" ag_againsituation.cs">
// * FileName: ag_againsituation.cs
// </copyright>
//-----------------------------------------------------------------------
using Performance.EntityModels;
using System;
namespace Performance.Repository
{
/// <summary>
/// collect_permission Repository
/// </summary>
public partial class PerforcollectpermissionRepository : PerforRepository<collect_permission>
{
public PerforcollectpermissionRepository(PerformanceDbContext context) : base(context)
{
}
}
}
......@@ -140,7 +140,7 @@ private PerExcel Import(per_allot allot)
/// <param name="sheet"></param>
/// <param name="allotId"></param>
/// <returns></returns>
private void SaveEmployee(PerSheet sheet, int allotId)
private int SaveEmployee(PerSheet sheet, int allotId)
{
var imsheet = new per_sheet { AllotID = allotId, SheetName = sheet.SheetName, Source = 1, SheetType = (int)sheet.SheetType };
perforPerSheetRepository.Add(imsheet);
......@@ -171,6 +171,7 @@ private void SaveEmployee(PerSheet sheet, int allotId)
addList.Add(imdata);
}
perforImEmployeeRepository.AddRange(addList.ToArray());
return imsheet.ID;
}
/// <summary>
......@@ -179,7 +180,7 @@ private void SaveEmployee(PerSheet sheet, int allotId)
/// <param name="sheet"></param>
/// <param name="allotId"></param>
/// <returns></returns>
private void SaveClinicEmployee(PerSheet sheet, int allotId)
private int SaveClinicEmployee(PerSheet sheet, int allotId)
{
var imsheet = new per_sheet { AllotID = allotId, SheetName = sheet.SheetName, Source = 1, SheetType = (int)sheet.SheetType };
perforPerSheetRepository.Add(imsheet);
......@@ -210,6 +211,7 @@ private void SaveClinicEmployee(PerSheet sheet, int allotId)
addList.Add(imdata);
}
perforImemployeeclinicRepository.AddRange(addList.ToArray());
return imsheet.ID;
}
/// <summary>
......@@ -218,7 +220,7 @@ private void SaveClinicEmployee(PerSheet sheet, int allotId)
/// <param name="sheet"></param>
/// <param name="allotId"></param>
/// <returns></returns>
private void SaveLogisticsEmployee(PerSheet sheet, int allotId)
private int SaveLogisticsEmployee(PerSheet sheet, int allotId)
{
var imsheet = new per_sheet { AllotID = allotId, SheetName = sheet.SheetName, Source = 1, SheetType = (int)sheet.SheetType };
perforPerSheetRepository.Add(imsheet);
......@@ -249,6 +251,7 @@ private void SaveLogisticsEmployee(PerSheet sheet, int allotId)
addList.Add(imdata);
}
perforImemployeelogisticsRepository.AddRange(addList.ToArray());
return imsheet.ID;
}
/// <summary>
......@@ -257,7 +260,7 @@ private void SaveLogisticsEmployee(PerSheet sheet, int allotId)
/// <param name="sheet"></param>
/// <param name="allotId"></param>
/// <returns></returns>
private void SaveAccountBasic(PerSheet sheet, int allotId)
private int SaveAccountBasic(PerSheet sheet, int allotId)
{
//var imsheet = new per_sheet { AllotID = allotId, SheetName = sheet.SheetName, Source = 1, SheetType = (int)sheet.SheetType };
//perforPerSheetRepository.Add(imsheet);
......@@ -285,6 +288,7 @@ private void SaveAccountBasic(PerSheet sheet, int allotId)
addList.Add(imdata);
}
perforImaccountbasicRepository.AddRange(addList.ToArray());
return imsheet.ID;
}
/// <summary>
......@@ -293,7 +297,7 @@ private void SaveAccountBasic(PerSheet sheet, int allotId)
/// <param name="sheet"></param>
/// <param name="allotId"></param>
/// <returns></returns>
private void SaveSpecialUnit(PerSheet sheet, int allotId)
private int SaveSpecialUnit(PerSheet sheet, int allotId)
{
var imsheet = new per_sheet { AllotID = allotId, SheetName = sheet.SheetName, Source = 1, SheetType = (int)sheet.SheetType };
perforPerSheetRepository.Add(imsheet);
......@@ -308,6 +312,7 @@ private void SaveSpecialUnit(PerSheet sheet, int allotId)
addList.Add(imdata);
}
perforImspecialunitRepository.AddRange(addList.ToArray());
return imsheet.ID;
}
/// <summary>
......@@ -316,7 +321,7 @@ private void SaveSpecialUnit(PerSheet sheet, int allotId)
/// <param name="sheet"></param>
/// <param name="allotId"></param>
/// <returns></returns>
private void SaveCommon(PerSheet sheet, int allotId)
private int SaveCommon(PerSheet sheet, int allotId)
{
per_sheet imsheet = null;
List<int> types = new List<int> { (int)SheetType.AccountBasicSpecial, (int)SheetType.AccountBasic };
......@@ -336,27 +341,6 @@ private void SaveCommon(PerSheet sheet, int allotId)
perforPerSheetRepository.Add(imsheet);
}
List<im_header> addHeadList = new List<im_header>();
foreach (var header in sheet.PerHeader)
{
var imheader = Mapper.Map<im_header>(header);
imheader.SheetID = imsheet.ID;
imheader.AllotID = allotId;
perforImHeaderRepository.Add(imheader);
if (header.IsHasChildren)
{
foreach (var child in header.Children)
{
var imheaderChild = Mapper.Map<im_header>(child);
imheaderChild.SheetID = imsheet.ID;
imheaderChild.ParentID = imheader.ID;
imheaderChild.AllotID = allotId;
addHeadList.Add(imheaderChild);
}
}
}
if (addHeadList != null && addHeadList.Any())
perforImHeaderRepository.AddRange(addHeadList.ToArray());
List<im_data> addDataList = new List<im_data>();
var dataList = sheet.PerData.Select(t => (PerData)t);
......@@ -375,7 +359,32 @@ private void SaveCommon(PerSheet sheet, int allotId)
perforImDataRepository.AddRange(addDataList.Skip(rows * i).Take(rows).ToArray());
}
}
return imsheet.ID;
}
private void SaveHeader(PerSheet sheet, int allotId, int imsheetid)
{
List<im_header> addHeadList = new List<im_header>();
foreach (var header in sheet.PerHeader)
{
var imheader = Mapper.Map<im_header>(header);
imheader.SheetID = imsheetid;
imheader.AllotID = allotId;
perforImHeaderRepository.Add(imheader);
if (header.IsHasChildren)
{
foreach (var child in header.Children)
{
var imheaderChild = Mapper.Map<im_header>(child);
imheaderChild.SheetID = imsheetid;
imheaderChild.ParentID = imheader.ID;
imheaderChild.AllotID = allotId;
addHeadList.Add(imheaderChild);
}
}
}
if (addHeadList != null && addHeadList.Any())
perforImHeaderRepository.AddRange(addHeadList.ToArray());
}
private bool Save(PerExcel excel, int allotId)
......@@ -385,27 +394,33 @@ private bool Save(PerExcel excel, int allotId)
logManageService.WriteMsg("保存基础数据", $"开始保存数据 -- {sheet.SheetName}", 1, allotId, "ReceiveMessage", true);
if (sheet.SheetType == SheetType.Employee)
{
SaveEmployee(sheet, allotId);
var imsheetid = SaveEmployee(sheet, allotId);
SaveHeader(sheet, allotId, imsheetid);
}
else if (sheet.SheetType == SheetType.LogisticsEmployee)
{
SaveLogisticsEmployee(sheet, allotId);
var imsheetid = SaveLogisticsEmployee(sheet, allotId);
SaveHeader(sheet, allotId, imsheetid);
}
else if (sheet.SheetType == SheetType.ClinicEmployee)
{
SaveClinicEmployee(sheet, allotId);
var imsheetid = SaveClinicEmployee(sheet, allotId);
SaveHeader(sheet, allotId, imsheetid);
}
else if (sheet.SheetType == SheetType.AccountBasic)
{
SaveAccountBasic(sheet, allotId);
var imsheetid = SaveAccountBasic(sheet, allotId);
SaveHeader(sheet, allotId, imsheetid);
}
else if (sheet.SheetType == SheetType.SpecialUnit)
{
SaveSpecialUnit(sheet, allotId);
var imsheetid = SaveSpecialUnit(sheet, allotId);
SaveHeader(sheet, allotId, imsheetid);
}
else
{
SaveCommon(sheet, allotId);
var imsheetid = SaveCommon(sheet, allotId);
SaveHeader(sheet, allotId, imsheetid);
}
}
logManageService.WriteMsg("保存基础数据", $"基础数据保存完成!", 1, allotId, "ReceiveMessage", true);
......
using Performance.DtoModels;
using Performance.DtoModels.Response;
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Performance.Services
{
public class CollectService : IAutoInjection
{
private readonly PerforUserRepository userRepository;
private readonly PerforPerallotRepository perforPerallotRepository;
private readonly PerforPersheetRepository perforPersheetRepository;
private readonly PerforImheaderRepository perforImheaderRepository;
private readonly PerforImdataRepository perforImdataRepository;
private readonly PerforImemployeeRepository perforImEmployeeRepository;
private readonly PerforImemployeeclinicRepository perforImemployeeclinicRepository;
private readonly PerforImemployeelogisticsRepository perforImemployeelogisticsRepository;
private readonly PerforcollectdataRepository perforcollectdataRepository;
private readonly PerforcollectpermissionRepository perforcollectpermissionRepository;
public CollectService(
PerforUserRepository userRepository,
PerforPerallotRepository perforPerallotRepository,
PerforPersheetRepository perforPersheetRepository,
PerforImheaderRepository perforImheaderRepository,
PerforImdataRepository perforImdataRepository,
PerforImemployeeRepository perforImEmployeeRepository,
PerforImemployeeclinicRepository perforImemployeeclinicRepository,
PerforImemployeelogisticsRepository perforImemployeelogisticsRepository,
PerforcollectdataRepository perforcollectdataRepository,
PerforcollectpermissionRepository perforcollectpermissionRepository)
{
this.userRepository = userRepository;
this.perforPerallotRepository = perforPerallotRepository;
this.perforPersheetRepository = perforPersheetRepository;
this.perforImheaderRepository = perforImheaderRepository;
this.perforImdataRepository = perforImdataRepository;
this.perforImEmployeeRepository = perforImEmployeeRepository;
this.perforImemployeeclinicRepository = perforImemployeeclinicRepository;
this.perforImemployeelogisticsRepository = perforImemployeelogisticsRepository;
this.perforcollectdataRepository = perforcollectdataRepository;
this.perforcollectpermissionRepository = perforcollectpermissionRepository;
}
/// <summary>
/// 查询采集内容
/// </summary>
/// <param name="hospitalId"></param>
/// <param name="userId"></param>
/// <returns></returns>
public IEnumerable<CollectPermission> GetCollectContent(int hospitalId, int userId)
{
var states = new[] { (int)AllotStates.Archive, (int)AllotStates.GenerateSucceed, (int)AllotStates.GenerateAccomplish };
var allotList = perforPerallotRepository.GetEntities(w => w.HospitalId == hospitalId && states.Contains(w.States))
?.OrderByDescending(w => w.Year).ThenByDescending(w => w.Month).ToList();
if (allotList == null || !allotList.Any())
return null;
var allot = allotList.First();
var types = new[] { (int)SheetType.Employee, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload,
(int)SheetType.ClinicEmployee, (int)SheetType.AccountExtra, (int)SheetType.PersonExtra, (int)SheetType.LogisticsEmployee};
var sheets = perforPersheetRepository.GetEntities(w => w.AllotID == allot.ID && types.Contains((w.SheetType ?? 0)));
var headers = perforImheaderRepository.GetEntities(w => w.AllotID == allot.ID);
var permissions = perforcollectpermissionRepository.GetEntities(w => w.HospitalId == hospitalId && w.UserId == userId);
if (sheets == null || !sheets.Any())
return null;
// 查询sheet和列头对应
var sheetHeads = from sheet in sheets
join head in headers on sheet.ID equals head.SheetID
select new { sheet.SheetName, sheet.SheetType, HeadName = head.CellValue };
List<CollectPermission> result;
// 查询列头和权限对应
if (permissions == null)
{
result = sheetHeads.Select(sh => new CollectPermission { HospitalId = hospitalId, SheetName = sh.SheetName, SheetType = sh.SheetType.Value, HeadName = sh.HeadName })?.ToList();
}
else
{
result = (from sh in sheetHeads
join pmss in permissions on new { sh.SheetName, sh.HeadName } equals new { pmss.SheetName, pmss.HeadName }
into emppmss
from item in emppmss.DefaultIfEmpty()
select new CollectPermission
{
HospitalId = hospitalId,
SheetName = sh.SheetName,
SheetType = sh.SheetType.Value,
HeadName = sh.HeadName,
PermissionId = item?.ID,
Readnoly = item?.Readnoly ?? 0,
AttachLast = item?.AttachLast ?? 0,
Visible = item?.Visible ?? 0
}).ToList();
}
if (result != null && result.Any())
{
var retain = new[] { "核算单元(医技组)", "核算单元(医生组)", "核算单元(护理组)", "科室名称", "核算单元",
"核算单元类型", "人员工号", "医生姓名", "姓名", "核算单元分类", "人员分类" };
result.ForEach(w =>
{
w.BanChange = retain.Any(r => r == w.HeadName);
w.Readnoly = w.BanChange ? 1 : w.Readnoly;
w.AttachLast = w.BanChange ? 1 : w.AttachLast;
w.Visible = w.BanChange ? 1 : w.Visible;
});
return result;
}
return result;
}
/// <summary>
/// 设置采集录入权限
/// </summary>
/// <param name="userid"></param>
/// <param name="collects"></param>
public void SetPermission(int userid, IEnumerable<CollectPermission> collects)
{
var user = userRepository.GetEntity(w => w.ID == userid);
if (user == null)
throw new PerformanceException("参数无效");
// 删除
var data3 = collects.Where(w => w.PermissionId.HasValue && 0 == w.AttachLast && 0 == w.Readnoly);
if (data3 != null)
{
var ids = data3.Select(t => t.PermissionId).ToList();
var deletes = perforcollectpermissionRepository.GetEntities(w => ids.Contains(w.ID));
if (deletes != null)
perforcollectpermissionRepository.RemoveRange(deletes.ToArray());
}
// 修改
var data1 = collects.Where(w => w.PermissionId.HasValue && (w.AttachLast > 0 || w.Readnoly > 0));
if (data1 != null)
{
var ids = data1.Select(t => t.PermissionId).ToList();
var updates = perforcollectpermissionRepository.GetEntities(w => ids.Contains(w.ID));
if (updates != null)
{
foreach (var item in updates)
{
item.AttachLast = data1.FirstOrDefault(w => w.PermissionId == item.ID).AttachLast;
item.Readnoly = data1.FirstOrDefault(w => w.PermissionId == item.ID).Readnoly;
item.Visible = data1.FirstOrDefault(w => w.PermissionId == item.ID).Visible;
}
perforcollectpermissionRepository.UpdateRange(updates.ToArray());
}
}
// 新增
var data2 = collects.Where(w => !w.PermissionId.HasValue && (w.AttachLast > 0 || w.Readnoly > 0));
var inserts = data2?.Select(w => new collect_permission
{
UserId = userid,
SheetName = w.SheetName,
SheetType = w.SheetType,
HospitalId = w.HospitalId,
HeadName = w.HeadName,
AttachLast = w.AttachLast,
Readnoly = w.Readnoly,
Visible = w.Visible,
});
if (data2 != null)
perforcollectpermissionRepository.AddRange(inserts.ToArray());
}
public IEnumerable<collect_permission> GetCollectSheet(int hospitalId, int userId)
{
return perforcollectpermissionRepository.GetEntities(w => w.HospitalId == hospitalId && w.UserId == userId);
}
#region 加载采集内容
/// <summary>
/// 加载采集内容
/// </summary>
/// <param name="allotId"></param>
/// <param name="sheetName"></param>
/// <returns></returns>
public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
{
var user = userRepository.GetEntity(w => w.ID == userId);
if (user == null)
throw new PerformanceException("参数无效");
var allot = perforPerallotRepository.GetEntity(w => w.ID == allotId);
if (allot == null)
throw new PerformanceException("参数无效");
var states = new[] { (int)AllotStates.Archive, (int)AllotStates.GenerateSucceed, (int)AllotStates.GenerateAccomplish };
// 如果录入绩效未生成 则获取最近新可用绩效记录
if (!states.Contains(allot.States))
{
var allotList = perforPerallotRepository
.GetEntities(w => w.HospitalId == allot.HospitalId && states.Contains(w.States))
?.OrderBy(w => w.Year).ThenBy(w => w.Month).ToList();
allot = allotList?.First();
}
if (allot == null)
throw new PerformanceException("当前医院没有录入项");
var types = new[] { (int)SheetType.Employee, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload,
(int)SheetType.ClinicEmployee, (int)SheetType.AccountExtra, (int)SheetType.PersonExtra, (int)SheetType.LogisticsEmployee};
var sheet = perforPersheetRepository
.GetEntity(w => w.AllotID == allot.ID && w.SheetName == sheetName && types.Contains((w.SheetType ?? 0)));
if (sheet == null)
throw new PerformanceException("找不到当前SHEET页信息");
var headers = perforImheaderRepository.GetEntities(w => w.SheetID == sheet.ID).OrderBy(w => w.PointCell);
if (headers == null || !headers.Any())
throw new PerformanceException("SHEET页没有有效列头");
var cols = headers.Select(w => w.CellValue).ToArray();
var permissions = perforcollectpermissionRepository
.GetEntities(w => w.HospitalId == allot.HospitalId && w.UserId == userId && w.SheetName == sheetName)?.ToList();
if (permissions == null || !permissions.Any())
throw new PerformanceException("用户没有权限编辑当前SHEET页");
List<HandsonRowData> rowDatas = null;
var collectdata = perforcollectdataRepository.GetEntities(w => w.SheetName == sheet.SheetName);
if (collectdata != null)
{
Dictionary<string, string> config = null;
if (sheet.SheetType == (int)SheetType.Employee)
config = CollectDataConfig.Employee;
else if (sheet.SheetType == (int)SheetType.ClinicEmployee)
config = CollectDataConfig.ClinicEmployee;
else if (sheet.SheetType == (int)SheetType.LogisticsEmployee)
config = CollectDataConfig.LogisticsEmployee;
else if (sheet.SheetType == (int)SheetType.PersonExtra)
config = CollectDataConfig.PersonExtra;
else
config = CollectDataConfig.Default;
rowDatas = new List<HandsonRowData>();
foreach (var rownumber in collectdata.Select(w => w.RowNumber).Distinct())
{
var first = collectdata.FirstOrDefault(w => w.RowNumber == rownumber);
var json = JsonHelper.Serialize(first);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
var cells = (from conf in config
join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
foreach (var item in collectdata.Where(w => w.RowNumber == rownumber))
{
cells.Add(new HandsonCellData(item.TypeName, item.CellValue));
}
rowDatas.Add(new HandsonRowData(rownumber, cells));
}
}
else
{
if (sheet.SheetType == (int)SheetType.Employee)
rowDatas = GerEmployee(sheet);
else if (sheet.SheetType == (int)SheetType.ClinicEmployee)
rowDatas = GetClinicEmployee(sheet);
else if (sheet.SheetType == (int)SheetType.LogisticsEmployee)
rowDatas = GetLogisticsEmployee(sheet);
else
rowDatas = GetCommonData(sheet);
}
HandsonTable handson = new HandsonTable(sheet.SheetType.Value, cols, permissions);
handson.SetRowData(rowDatas);
return handson;
}
private List<HandsonRowData> GetCommonData(per_sheet sheet)
{
var rowdatas = new List<HandsonRowData>();
var imdatas = perforImdataRepository.GetEntities(w => w.SheetID == sheet.ID);
if (imdatas != null && imdatas.Any())
{
var rownums = imdatas.Select(w => new { w.RowNumber, w.Department }).Distinct()?.OrderBy(w => w.RowNumber);
foreach (var rownum in rownums)
{
var rowdata = imdatas.Where(w => w.RowNumber == rownum.RowNumber && w.Department == rownum.Department);
var setdata = rowdata.Select(w => new HandsonCellData(w.TypeName, w.CellValue))?.ToList();
if (setdata == null) continue;
setdata.Add(new HandsonCellData("科室名称", rownum.Department));
var units = rowdata.Where(w => w.UnitType.HasValue).Select(w => new { w.UnitType, w.AccountingUnit }).Distinct();
foreach (var item in units)
{
if ((new[] { (int)UnitType.医生组, (int)UnitType.其他医生组 }).Contains(item.UnitType.Value))
setdata.Add(new HandsonCellData("核算单元(医生组)", item.AccountingUnit));
else if ((new[] { (int)UnitType.医技组, (int)UnitType.其他医技组 }).Contains(item.UnitType.Value))
setdata.Add(new HandsonCellData("核算单元(医技组)", item.AccountingUnit));
else if ((new[] { (int)UnitType.护理组, (int)UnitType.其他护理组 }).Contains(item.UnitType.Value))
setdata.Add(new HandsonCellData("核算单元(护理组)", item.AccountingUnit));
setdata.Add(new HandsonCellData("核算单元", item.AccountingUnit));
}
if (sheet.SheetType == (int)SheetType.PersonExtra)
{
var employee = rowdata.Select(w => new { w.EmployeeName, w.JobNumber }).Distinct().FirstOrDefault();
setdata.Add(new HandsonCellData("医生姓名", employee.EmployeeName));
setdata.Add(new HandsonCellData("人员工号", employee.JobNumber));
}
rowdatas.Add(new HandsonRowData(rownum.RowNumber.Value, setdata));
}
}
return rowdatas;
}
private List<HandsonRowData> GetLogisticsEmployee(per_sheet sheet)
{
var employeeList = perforImemployeelogisticsRepository.GetEntities(t => t.SheetID == sheet.ID)?.OrderBy(w => w.RowNumber);
if (employeeList != null && employeeList.Any())
{
var temps = employeeList.Select(item => new { row = item.RowNumber.Value, dic = JsonHelper.Deserialize(item) });
return temps.Select(temp => CreateRowData(temp.row, ExcelReadConfig.LogisticsEmployee, temp.dic)).ToList();
}
return new List<HandsonRowData>();
}
private List<HandsonRowData> GetClinicEmployee(per_sheet sheet)
{
var employeeList = perforImemployeeclinicRepository.GetEntities(t => t.SheetID == sheet.ID)?.OrderBy(w => w.RowNumber);
if (employeeList != null && employeeList.Any())
{
var temps = employeeList.Select(item => new { row = item.RowNumber.Value, dic = JsonHelper.Deserialize(item) });
return temps.Select(temp => CreateRowData(temp.row, ExcelReadConfig.ClinicEmployee, temp.dic)).ToList();
}
return new List<HandsonRowData>();
}
private List<HandsonRowData> GerEmployee(per_sheet sheet)
{
var employeeList = perforImEmployeeRepository.GetEntities(t => t.SheetID == sheet.ID)?.OrderBy(w => w.RowNumber);
if (employeeList != null && employeeList.Any())
{
var temps = employeeList.Select(item => new { row = item.RowNumber.Value, dic = JsonHelper.Deserialize(item) });
return temps.Select(temp => CreateRowData(temp.row, ExcelReadConfig.Employee, temp.dic)).ToList();
}
return new List<HandsonRowData>();
}
private HandsonRowData CreateRowData(int row, ColumnInfo[] columns, SortedDictionary<string, object> dic)
{
var setdata = from cfg in columns
join d in dic.Keys on cfg.Field.ToUpper() equals d.ToUpper()
select new HandsonCellData(cfg.Description, dic[d]);
return new HandsonRowData(row, setdata);
}
#endregion
public void SaveCollectData(int allotId, SaveCollectData request)
{
var types = new[] { (int)SheetType.Employee, (int)SheetType.OtherIncome, (int)SheetType.Expend, (int)SheetType.Workload,
(int)SheetType.ClinicEmployee, (int)SheetType.AccountExtra, (int)SheetType.PersonExtra, (int)SheetType.LogisticsEmployee};
if (!types.Contains(request.SheetType))
throw new PerformanceException("当前SHEET页信息错误");
if (request.ColHeaders == null || request.ColHeaders.Length == 0)
throw new PerformanceException("当前SHEET页列头信息错误");
if (request.Data == null || request.Data.Length == 0)
throw new PerformanceException("当前SHEET页列头信息错误");
Dictionary<string, string> config = null;
if (request.SheetType == (int)SheetType.Employee)
config = CollectDataConfig.Employee;
else if (request.SheetType == (int)SheetType.ClinicEmployee)
config = CollectDataConfig.ClinicEmployee;
else if (request.SheetType == (int)SheetType.LogisticsEmployee)
config = CollectDataConfig.LogisticsEmployee;
else if (request.SheetType == (int)SheetType.PersonExtra)
config = CollectDataConfig.PersonExtra;
else
config = CollectDataConfig.Default;
var dicData = CreateDataRow(allotId, request, config);
List<collect_data> datas = new List<collect_data>();
foreach (var item in dicData)
{
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<collect_data>(json);
datas.Add(data);
}
perforcollectdataRepository.Execute("delete from collect_data where allotid = @allotid and sheetname=@sheetname", new { allotId, request.SheetName });
perforcollectdataRepository.AddRange(datas.ToArray());
}
private List<Dictionary<string, string>> CreateDataRow(int allotId, SaveCollectData request, Dictionary<string, string> config)
{
List<Dictionary<string, string>> allData = new List<Dictionary<string, string>>();
for (int r = 0; r < request.Data.Length; r++)
{
// 创建固定数据列
Dictionary<string, string> baseData = CreateBaseData(request, config, r);
baseData.Add(nameof(collect_data.RowNumber), r.ToString());
baseData.Add(nameof(collect_data.AllotID), allotId.ToString());
baseData.Add(nameof(collect_data.SheetName), request.SheetName);
// 创建动态列数据
for (int c = 0; c < request.ColHeaders.Length; c++)
{
var header = request.ColHeaders[c];
var first = config.FirstOrDefault(w => w.Value == header);
Dictionary<string, string> compData = new Dictionary<string, string>(baseData);
if (default(KeyValuePair<string, string>).Equals(first)
&& !compData.ContainsKey(header)
&& request.Data[r].Length > c)
{
compData.Add(nameof(collect_data.TypeName), header);
compData.Add(nameof(collect_data.CellValue), request.Data[r][c]);
allData.Add(compData);
}
}
}
return allData;
}
private Dictionary<string, string> CreateBaseData(SaveCollectData request, Dictionary<string, string> config, int rownumber)
{
Dictionary<string, string> result = new Dictionary<string, string>();
for (int c = 0; c < request.ColHeaders.Length; c++)
{
var header = request.ColHeaders[c];
var first = config.FirstOrDefault(w => w.Value == header);
if (!default(KeyValuePair<string, string>).Equals(first)
&& !result.ContainsKey(header)
&& request.Data[rownumber].Length > c)
{
result.Add(first.Key, request.Data[rownumber][c]);
}
}
return result;
}
}
public class CollectDataConfig
{
public static Dictionary<string, string> Employee { get; } = new Dictionary<string, string>
{
{ nameof(collect_data.UnitType), "人员分类" },
{ nameof(collect_data.AccountingUnitDoctor), "核算单元" },
{ nameof(collect_data.Department), "核算单元" },
{ nameof(collect_data.JobNumber), "人员工号" },
{ nameof(collect_data.EmployeeName), "医生姓名" },
};
public static Dictionary<string, string> ClinicEmployee { get; } = new Dictionary<string, string>
{
{ nameof(collect_data.UnitType), "核算单元分类" },
{ nameof(collect_data.AccountingUnitDoctor), "核算单元" },
{ nameof(collect_data.Department), "核算单元" },
{ nameof(collect_data.JobNumber), "人员工号" },
{ nameof(collect_data.EmployeeName), "医生姓名" },
};
public static Dictionary<string, string> LogisticsEmployee { get; } = new Dictionary<string, string>
{
{ nameof(collect_data.UnitType), "人员分类" },
{ nameof(collect_data.AccountingUnitDoctor), "核算单元" },
{ nameof(collect_data.Department), "核算单元" },
{ nameof(collect_data.JobNumber), "人员工号" },
{ nameof(collect_data.EmployeeName), "人员姓名" },
};
public static Dictionary<string, string> PersonExtra { get; } = new Dictionary<string, string>
{
{ nameof(collect_data.UnitType), "核算单元分类" },
{ nameof(collect_data.AccountingUnitDoctor), "核算单元" },
{ nameof(collect_data.Department), "核算单元" },
{ nameof(collect_data.JobNumber), "人员工号" },
{ nameof(collect_data.EmployeeName), "医生姓名" },
};
public static Dictionary<string, string> Default { get; } = new Dictionary<string, string>
{
{ nameof(collect_data.UnitType), "核算单元分类" },
{ nameof(collect_data.AccountingUnitTechnician), "核算单元(医技组)" },
{ nameof(collect_data.AccountingUnitDoctor), "核算单元(医生组)" },
{ nameof(collect_data.AccountingUnitNurse), "核算单元(护理组)" },
{ nameof(collect_data.Department), "科室名称" },
{ nameof(collect_data.JobNumber), "人员工号" },
{ nameof(collect_data.EmployeeName), "医生姓名" },
};
}
}
using Performance.DtoModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.Services
{
public class ExcelReadConfig
{
public static ColumnInfo[] Employee { get; set; } = new ColumnInfo[]
{
new ColumnInfo(nameof(PerDataEmployee.AccountingUnit), "核算单元" ),
new ColumnInfo(nameof(PerDataEmployee.Department), "核算单元"),
new ColumnInfo(nameof(PerDataEmployee.PersonnelNumber), "人员工号"),
new ColumnInfo(nameof(PerDataEmployee.DoctorName), "医生姓名"),
new ColumnInfo(nameof(PerDataEmployee.JobTitle), "职务分类"),
new ColumnInfo(nameof(PerDataEmployee.FitPeople), "绩效基数核算参考对象"),
new ColumnInfo(nameof(PerDataEmployee.FitPeopleValue), "绩效基础核算参考值", true),
new ColumnInfo(nameof(PerDataEmployee.FitPeopleRatio), "绩效基数核算系数", true),
new ColumnInfo(nameof(PerDataEmployee.AccountType), "人员分类"),
new ColumnInfo(nameof(PerDataEmployee.PostCoefficient), "岗位系数", true),
new ColumnInfo(nameof(PerDataEmployee.ScoreAverageRate), "考核得分率", true),
new ColumnInfo(nameof(PerDataEmployee.Attendance), "出勤率", true),
new ColumnInfo(nameof(PerDataEmployee.Adjust), "调节系数", true),
};
public static ColumnInfo[] ClinicEmployee { get; set; } = new ColumnInfo[]
{
new ColumnInfo(nameof(PerDataClinicEmployee.UnitType), "核算单元分类"),
new ColumnInfo(nameof(PerDataClinicEmployee.AccountingUnit), "核算单元"),
new ColumnInfo(nameof(PerDataClinicEmployee.Department), "核算单元"),
new ColumnInfo(nameof(PerDataClinicEmployee.PersonnelNumber), "人员工号"),
new ColumnInfo(nameof(PerDataClinicEmployee.DoctorName), "医生姓名"),
new ColumnInfo(nameof(PerDataClinicEmployee.JobTitle), "职务分类"),
new ColumnInfo(nameof(PerDataClinicEmployee.Basics), "基础绩效系数", true),
new ColumnInfo(nameof(PerDataClinicEmployee.PermanentStaff), "效率绩效人数", true),
new ColumnInfo(nameof(PerDataClinicEmployee.Efficiency), "效率绩效系数", true),
new ColumnInfo(nameof(PerDataClinicEmployee.Scale), "规模绩效系数", true),
new ColumnInfo(nameof(PerDataClinicEmployee.Management), "管理绩效发放系数", true),
new ColumnInfo(nameof(PerDataClinicEmployee.ScoreAverageRate), "考核得分率", true),
new ColumnInfo(nameof(PerDataClinicEmployee.Attendance), "出勤率", true),
new ColumnInfo(nameof(PerDataClinicEmployee.OtheManagementPerfor), "其他管理绩效"),
new ColumnInfo(nameof(PerDataClinicEmployee.Adjust), "调节系数", true),
};
public static ColumnInfo[] LogisticsEmployee { get; set; } = new ColumnInfo[]
{
new ColumnInfo(nameof(PerDataLogisticsEmployee.AccountType), "人员分类"),
new ColumnInfo(nameof(PerDataLogisticsEmployee.AccountingUnit), "核算单元"),
new ColumnInfo(nameof(PerDataLogisticsEmployee.FitPeople), "绩效基数核算参考对象"),
new ColumnInfo(nameof(PerDataLogisticsEmployee.FitPeopleValue), "绩效基础核算参考值", true),
new ColumnInfo(nameof(PerDataLogisticsEmployee.FitPeopleRatio), "绩效基数核算系数", true),
new ColumnInfo(nameof(PerDataLogisticsEmployee.JobNumber), "人员工号"),
new ColumnInfo(nameof(PerDataLogisticsEmployee.DoctorName), "人员姓名"),
new ColumnInfo(nameof(PerDataLogisticsEmployee.JobTitle), "职务分类"),
new ColumnInfo(nameof(PerDataLogisticsEmployee.PostCoefficient), "岗位系数", true),
new ColumnInfo(nameof(PerDataLogisticsEmployee.Attendance), "出勤率", true),
new ColumnInfo(nameof(PerDataLogisticsEmployee.OthePerfor), "其他绩效", true),
};
public static ColumnInfo[] AccountBaisc { get; set; } = new ColumnInfo[]
{
new ColumnInfo(nameof(PerDataAccountBaisc.UnitType), "核算单元类型"),
new ColumnInfo(nameof(PerDataAccountBaisc.AccountingUnit), "核算单元"),
new ColumnInfo(nameof(PerDataAccountBaisc.ManagerNumber), "科主任/护士长人数", true),
new ColumnInfo(nameof(PerDataAccountBaisc.Number), "核算单元人员数量", true),
new ColumnInfo(nameof(PerDataAccountBaisc.BasicFactor), "预算比例", true),
new ColumnInfo(nameof(PerDataAccountBaisc.OtherPerfor1), "其他绩效1", true),
new ColumnInfo(nameof(PerDataAccountBaisc.ScoringAverage), "考核得分率", true),
new ColumnInfo(nameof(PerDataAccountBaisc.AdjustFactor), "调节系数", true),
};
}
public class ColumnInfo
{
public ColumnInfo(string field, string description, bool isNumber = false)
{
Field = field;
Description = description;
IsNumber = isNumber;
}
public string Field { get; set; }
public string Description { get; set; }
public bool IsNumber { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Performance.Services
{
public enum DataFormat
{
/// <summary> 普通格式 </summary>
普通格式,
/// <summary> 小数 </summary>
小数,
/// <summary> 货币 </summary>
货币,
/// <summary> 百分比 </summary>
百分比,
/// <summary> 科学计数 </summary>
科学计数,
/// <summary> 分数 </summary>
分数,
/// <summary> 日期 </summary>
日期
}
public class RecognitionDataFormat
{
/*
0 General General 18 Time h:mm AM/PM
1 Decimal 0 19 Time h:mm:ss AM/PM
2 Decimal 0.00 20 Time h:mm
3 Decimal #,##0 21 Time h:mm:ss
4 Decimal #,##0.00 2232 Date/Time M/D/YY h:mm
5 Currency "$"#,##0_);("$"#,##0) 37 Account. _(#,##0_);(#,##0)
6 Currency "$"#,##0_);[Red]("$"#,##0) 38 Account. _(#,##0_);[Red](#,##0)
7 Currency "$"#,##0.00_);("$"#,##0.00) 39 Account. _(#,##0.00_);(#,##0.00)
8 Currency "$"#,##0.00_);[Red]("$"#,##0.00) 40 Account. _(#,##0.00_);[Red](#,##0.00)
9 Percent 0% 4131 Currency _("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)
10 Percent 0.00% 4231 33 Currency _(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)
11 Scientific 0.00E+00 4331 Currency _("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)
12 Fraction # ?/? 4431 33 Currency _(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)
13 Fraction # ??/?? 45 Time mm:ss
14 Date M/D/YY 46 Time [h]:mm:ss
15 Date D-MMM-YY 47 Time mm:ss.0
16 Date D-MMM 48 Scientific ##0.0E+0
17 Date MMM-YY 49 Text @
*/
private static Dictionary<DataFormat, int[]> dic = new Dictionary<DataFormat, int[]>
{
{ DataFormat.普通格式, new[] { 0 } },
{ DataFormat.小数, new[] { 1,2,3,4 } },
{ DataFormat.货币, new[] { 5,6,7,8 } },
{ DataFormat.百分比, new[] { 9,10 } },
{ DataFormat.科学计数, new[] { 11 } },
{ DataFormat.分数, new[] { 12,13 } },
{ DataFormat.日期, new[] { 14,15,16,17 } },
};
public static DataFormat GetDataFormat(short type)
{
foreach (var item in dic.Keys)
{
if (dic[item].Contains(type))
return item;
}
return DataFormat.普通格式;
}
}
}
......@@ -21,61 +21,42 @@ public class PerSheetDataReadClinicEmployee : IPerSheetDataRead
public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
List<IPerData> dataList = new List<IPerData>();
string[] headers = new string[]
{
"核算单元分类",
"核算单元",
"核算单元",
"人员工号",
"医生姓名",
"职务分类",
"基础绩效系数",
//"岗位系数",
"效率绩效人数",
"效率绩效系数",
"规模绩效系数",
"管理绩效发放系数",
"考核得分率",
"出勤率",
"其他管理绩效",
//"其他绩效",
//"医院奖罚",
"调节系数",
};
foreach (var item in headers)
{
if (!perHeader.Any(p => p.CellValue == item))
throw new NullReferenceException($"sheet '{sheet.SheetName}'中列'{item}'为空");
}
for (int r = Point.DataFirstRowNum.Value; r < sheet.LastRowNum + 1; r++)
{
var row = sheet.GetRow(r);
if (row == null) continue;
PerDataClinicEmployee clinicEmployee = new PerDataClinicEmployee();
Dictionary<string, object> dic = new Dictionary<string, object>
{
{ nameof(PerDataClinicEmployee.RowNumber), r}
};
foreach (var item in ExcelReadConfig.ClinicEmployee)
{
if (NopiSevice.TryGetPoint(perHeader, item.Description, out int point))
{
//var cell = row.GetCell(point);
//if (cell == null) continue;
//// 获取单元格格式
//var xxs = cell.CellStyle.DataFormat;
//var dataFormat = RecognitionDataFormat.GetDataFormat(xxs);
object @object = row.GetCell(point).GetValue();
if (item.IsNumber)
@object = ConvertHelper.To<decimal?>(@object);
if (dic.Keys.Contains(item.Field))
dic[item.Field] = @object;
else
dic.Add(item.Field, @object);
}
}
clinicEmployee.RowNumber = r;
clinicEmployee.UnitType = NopiSevice.GetCellStringValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元分类").PointCell));
clinicEmployee.AccountingUnit = NopiSevice.GetCellStringValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元").PointCell));
clinicEmployee.Department = NopiSevice.GetCellStringValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元").PointCell));
clinicEmployee.PersonnelNumber = NopiSevice.GetCellStringValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "人员工号").PointCell));
clinicEmployee.DoctorName = NopiSevice.GetCellStringValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医生姓名").PointCell));
clinicEmployee.JobTitle = NopiSevice.GetCellStringValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "职务分类").PointCell));
clinicEmployee.Basics = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "基础绩效系数").PointCell)?.NumericCellValue);
//clinicEmployee.PostCoefficient = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "岗位系数").PointCell)?.NumericCellValue);
clinicEmployee.PermanentStaff = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "效率绩效人数").PointCell)?.NumericCellValue);
clinicEmployee.Efficiency = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "效率绩效系数").PointCell)?.NumericCellValue);
clinicEmployee.Scale = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "规模绩效系数").PointCell)?.NumericCellValue);
clinicEmployee.Management = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "管理绩效发放系数").PointCell)?.NumericCellValue);
clinicEmployee.ScoreAverageRate = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率").PointCell)?.NumericCellValue);
clinicEmployee.Attendance = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "出勤率").PointCell)?.NumericCellValue);
//clinicEmployee.OthePerfor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效").PointCell)?.NumericCellValue);
//clinicEmployee.Punishment = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医院奖罚").PointCell)?.NumericCellValue);
clinicEmployee.OtheManagementPerfor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他管理绩效").PointCell)?.NumericCellValue);
clinicEmployee.Adjust = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "调节系数").PointCell)?.NumericCellValue);
var employee = JsonHelper.Deserialize<PerDataClinicEmployee>(dic);
if (!string.IsNullOrEmpty(clinicEmployee.UnitType) && !string.IsNullOrEmpty(clinicEmployee.DoctorName))
dataList.Add(clinicEmployee);
if (!string.IsNullOrEmpty(employee.UnitType) && !string.IsNullOrEmpty(employee.DoctorName))
dataList.Add(employee);
}
return dataList;
......
......@@ -24,99 +24,39 @@ public class PerSheetDataReadDeptAccounting : IPerSheetDataRead
public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
List<IPerData> dataList = new List<IPerData>();
string[] headers = new string[]
{
"核算单元类型",
"核算单元",
//"科室名称",
//"效率绩效人数",
"科主任/护士长人数",
"核算单元人员数量",
"预算比例",
//"倾斜系数",
//"工作量倾斜系数",
//"保底绩效参考标准",
//"保底绩效系数",
//"其他绩效1",
//"其他绩效2",
//"药占比奖罚",
//"材料占比奖罚",
//"医院奖罚",
"考核得分率",
"调节系数",
};
foreach (var item in headers)
{
if (!perHeader.Any(p => p.CellValue == item))
throw new NullReferenceException($"sheet '{sheet.SheetName}'中列'{item}'为空");
}
for (int r = Point.DataFirstRowNum.Value; r < sheet.LastRowNum + 1; r++)
{
var row = sheet.GetRow(r);
if (row == null) continue;
PerDataAccountBaisc unifyUnit = new PerDataAccountBaisc();
unifyUnit.RowNumber = r;
unifyUnit.UnitType = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元类型").PointCell)?.StringCellValue;
unifyUnit.AccountingUnit = NopiSevice.GetCellStringValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元").PointCell));
//unifyUnit.Department = NopiSevice.GetCellStringValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "科室名称").PointCell));
//unifyUnit.PermanentStaff = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "效率绩效人数").PointCell)?.NumericCellValue);
unifyUnit.ManagerNumber = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "科主任/护士长人数").PointCell)?.NumericCellValue);
unifyUnit.Number = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元人员数量").PointCell)?.NumericCellValue);
unifyUnit.BasicFactor = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "预算比例").PointCell)?.NumericCellValue);
//unifyUnit.SlopeFactor = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "倾斜系数").PointCell)?.NumericCellValue);
//unifyUnit.Scale = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "规模绩效系数").PointCell)?.NumericCellValue);
//unifyUnit.Effic = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "效率绩效系数").PointCell)?.NumericCellValue);
//unifyUnit.Grant = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "管理绩效发放系数").PointCell)?.NumericCellValue);工作量倾斜系数
//unifyUnit.WorkSlopeFactor = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "工作量倾斜系数").PointCell)?.NumericCellValue);
//unifyUnit.MinimumReference = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "保底绩效参考标准").PointCell)?.StringCellValue;
//unifyUnit.MinimumFactor = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "保底绩效系数").PointCell)?.NumericCellValue);
unifyUnit.OtherPerfor1 = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效1").PointCell)?.NumericCellValue);
//unifyUnit.OtherPerfor2 = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效2").PointCell)?.NumericCellValue);
//unifyUnit.MedicineExtra = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "药占比奖罚").PointCell)?.NumericCellValue);
//unifyUnit.MaterialsExtra = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "材料占比奖罚").PointCell)?.NumericCellValue);
//unifyUnit.Extra = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医院奖罚").PointCell)?.NumericCellValue);
unifyUnit.ScoringAverage = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率").PointCell)?.NumericCellValue);
unifyUnit.AdjustFactor = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "调节系数").PointCell)?.NumericCellValue);
Dictionary<string, object> dic = new Dictionary<string, object>
{
{ nameof(PerDataAccountBaisc.RowNumber), r}
};
//unifyUnit.NurseHeadNumber = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元护士长数量" && p.Parent.CellValue == "护理组").PointCell)?.ToString());
//unifyUnit.NurseNumber = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元护士数量" && p.Parent.CellValue == "护理组").PointCell)?.ToString());
//unifyUnit.NurseBasicFactor = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "预算比例" && p.Parent.CellValue == "护理组").PointCell)?.ToString());
//unifyUnit.NurseSlopeFactor = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "倾斜系数" && p.Parent.CellValue == "护理组").PointCell)?.ToString());
//unifyUnit.NurseScale = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "规模绩效系数" && p.Parent.CellValue == "护理组").PointCell)?.ToString());
//unifyUnit.NurseEffic = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "效率绩效系数" && p.Parent.CellValue == "护理组").PointCell)?.ToString());
//unifyUnit.NurseGrant = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "管理绩效发放系数" && p.Parent.CellValue == "护理组").PointCell)?.ToString());
//unifyUnit.NurseOtherPerfor1 = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效1" && p.Parent.CellValue == "护理组").PointCell)?.ToString());
//unifyUnit.NurseOtherPerfor2 = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效2" && p.Parent.CellValue == "护理组").PointCell)?.ToString());
//unifyUnit.NurseExtra = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医院奖罚" && p.Parent.CellValue == "护理组").PointCell)?.ToString());
//unifyUnit.NurseScoringAverage = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率" && p.Parent.CellValue == "护理组").PointCell)?.ToString());
//unifyUnit.NurseAdjustFactor = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "调节系数" && p.Parent.CellValue == "护理组").PointCell)?.ToString());
foreach (var item in ExcelReadConfig.AccountBaisc)
{
if (NopiSevice.TryGetPoint(perHeader, item.Description, out int point))
{
object @object = row.GetCell(point).GetValue();
if (item.IsNumber)
@object = ConvertHelper.To<decimal?>(@object);
if (!string.IsNullOrEmpty(unifyUnit.UnitType))
dataList.Add(unifyUnit);
}
if (dic.Keys.Contains(item.Field))
dic[item.Field] = @object;
else
dic.Add(item.Field, @object);
}
}
return dataList;
}
var baisc = JsonHelper.Deserialize<PerDataAccountBaisc>(dic);
/// <summary>
/// 转换核算单元类型
/// </summary>
/// <param name="unitType"></param>
/// <returns></returns>
public int UnitType(string unitType)
{
switch (unitType)
{
case "医生组":
return 1;
case "护理组":
return 2;
case "医技组":
return 3;
default:
return 0;
if (!string.IsNullOrEmpty(baisc.UnitType))
dataList.Add(baisc);
}
return dataList;
}
}
}
......@@ -24,57 +24,34 @@ public class PerSheetDataReadEmployee : IPerSheetDataRead
public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
List<IPerData> dataList = new List<IPerData>();
string[] headers = new string[]
{
"核算单元",
"人员工号",
"医生姓名",
"职务分类",
"绩效基数核算参考对象",
"绩效基础核算参考值",
"绩效基数核算系数",
"人员分类",
"岗位系数",
//"参加工作时间",
"考核得分率",
"出勤率",
//"其他绩效",
//"医院奖罚",
"调节系数",
};
foreach (var item in headers)
{
if (!perHeader.Any(p => p.CellValue == item))
throw new NullReferenceException($"sheet '{sheet.SheetName}'中列'{item}'为空");
}
for (int r = Point.DataFirstRowNum.Value; r < sheet.LastRowNum + 1; r++)
{
var row = sheet.GetRow(r);
if (row == null) continue;
PerDataEmployee employee = new PerDataEmployee
Dictionary<string, object> dic = new Dictionary<string, object>
{
RowNumber = r,
AccountingUnit = NopiSevice.GetCellStringValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元").PointCell)),
Department = NopiSevice.GetCellStringValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元").PointCell)),
PersonnelNumber = NopiSevice.GetCellStringValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "人员工号").PointCell)),
DoctorName = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医生姓名").PointCell)?.StringCellValue,
JobTitle = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "职务分类").PointCell)?.StringCellValue,
FitPeople = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "绩效基数核算参考对象").PointCell)?.StringCellValue,
FitPeopleValue = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "绩效基础核算参考值").PointCell)?.ToString()),
FitPeopleRatio = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "绩效基数核算系数").PointCell)?.NumericCellValue),
AccountType = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "人员分类").PointCell)?.StringCellValue,
PostCoefficient = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "岗位系数").PointCell)?.NumericCellValue),
//WorkTime = NopiSevice.GetCellDatetimeValue(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "参加工作时间").PointCell)),
ScoreAverageRate = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率").PointCell)?.NumericCellValue),
Attendance = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "出勤率").PointCell)?.NumericCellValue),
//PeopleNumber = ConvertHelper.To<int?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元医生数").PointCell)?.ToString()),
//Workload = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "工作量绩效").PointCell)?.ToString()),
//OthePerfor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效").PointCell)?.NumericCellValue),
//Punishment = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医院奖罚").PointCell)?.NumericCellValue),
Adjust = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "调节系数").PointCell)?.NumericCellValue),
//Grant = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "发放系数").PointCell)?.ToString()),
{ nameof(PerDataEmployee.RowNumber), r}
};
foreach (var item in ExcelReadConfig.Employee)
{
if (NopiSevice.TryGetPoint(perHeader, item.Description, out int point))
{
object @object = row.GetCell(point).GetValue();
if (item.IsNumber)
@object = ConvertHelper.To<decimal?>(@object);
if (dic.Keys.Contains(item.Field))
dic[item.Field] = @object;
else
dic.Add(item.Field, @object);
}
}
var employee = JsonHelper.Deserialize<PerDataEmployee>(dic);
if (!string.IsNullOrEmpty(employee.AccountingUnit) && !string.IsNullOrEmpty(employee.FitPeople))
dataList.Add(employee);
}
......
......@@ -30,44 +30,27 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var row = sheet.GetRow(r);
if (row == null) continue;
PerDataLogisticsEmployee employee = new PerDataLogisticsEmployee()
Dictionary<string, object> dic = new Dictionary<string, object>
{
RowNumber = r,
{ nameof(PerDataLogisticsEmployee.RowNumber), r}
};
int point = 0;
if (NopiSevice.TryGetPoint(perHeader, "人员分类", out point))
employee.AccountType = row.GetCell(point).GetValue();
if (NopiSevice.TryGetPoint(perHeader, "核算单元", out point))
employee.AccountingUnit = row.GetCell(point).GetValue();
if (NopiSevice.TryGetPoint(perHeader, "绩效基数核算参考对象", out point))
employee.FitPeople = row.GetCell(point).GetValue();
if (NopiSevice.TryGetPoint(perHeader, "绩效基础核算参考值", out point))
employee.FitPeopleValue = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue());
if (NopiSevice.TryGetPoint(perHeader, "绩效基数核算系数", out point))
employee.FitPeopleRatio = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue());
if (NopiSevice.TryGetPoint(perHeader, "人员工号", out point))
employee.JobNumber = row.GetCell(point).GetValue();
if (NopiSevice.TryGetPoint(perHeader, "人员姓名", out point))
employee.DoctorName = row.GetCell(point).GetValue();
if (NopiSevice.TryGetPoint(perHeader, "职务分类", out point))
employee.JobTitle = row.GetCell(point).GetValue();
if (NopiSevice.TryGetPoint(perHeader, "岗位系数", out point))
employee.PostCoefficient = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue());
if (NopiSevice.TryGetPoint(perHeader, "出勤率", out point))
employee.Attendance = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue());
if (NopiSevice.TryGetPoint(perHeader, "其他绩效", out point))
employee.OthePerfor = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue());
foreach (var item in ExcelReadConfig.LogisticsEmployee)
{
if (NopiSevice.TryGetPoint(perHeader, item.Description, out int point))
{
object @object = row.GetCell(point).GetValue();
if (item.IsNumber)
@object = ConvertHelper.To<decimal?>(@object);
if (dic.Keys.Contains(item.Field))
dic[item.Field] = @object;
else
dic.Add(item.Field, @object);
}
}
var employee = JsonHelper.Deserialize<PerDataLogisticsEmployee>(dic);
if (!string.IsNullOrEmpty(employee.AccountingUnit) && !string.IsNullOrEmpty(employee.FitPeople))
dataList.Add(employee);
......
......@@ -50,19 +50,29 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
PerDataSpecialUnit specialUnit = new PerDataSpecialUnit
{
RowNumber = r,
//AccountingUnit = accountingUnit,
//Department = accountingUnit,
QuantitativeIndicators = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "量化指标").PointCell)?.StringCellValue,
Quantity = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "数量").PointCell)?.ToString()),
QuantitativeIndicatorsValue = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "量化指标绩效分值").PointCell)?.NumericCellValue),
};
var cell = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "科室").PointCell);//?.ToString();
var accountingUnit = NopiSevice.GetCellStringValue(cell);
int point;
if (NopiSevice.TryGetPoint(perHeader, "量化指标", out point))
specialUnit.QuantitativeIndicators = row.GetCell(point).GetValue();
if (NopiSevice.TryGetPoint(perHeader, "数量", out point))
specialUnit.Quantity = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue());
if (NopiSevice.TryGetPoint(perHeader, "量化指标绩效分值", out point))
specialUnit.QuantitativeIndicatorsValue = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue());
if (NopiSevice.TryGetPoint(perHeader, "人数", out point))
specialUnit.Number = ConvertHelper.To<decimal?>(row.GetCell(point).GetValue());
ICell cell = null;
if (NopiSevice.TryGetPoint(perHeader, "科室", out int kspoint))
cell = row.GetCell(kspoint);
if (cell == null) continue;
var accountingUnit = cell.GetValue();
if (cell != null && IsMergeCell(cell, out Point start, out Point end) && r != start.X)
{
row = sheet.GetRow(start.X);
cell = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "科室").PointCell);
accountingUnit = cell?.StringCellValue;
cell = row.GetCell(kspoint);
accountingUnit = cell.GetValue();
}
if (string.IsNullOrEmpty(accountingUnit))
accountingUnit = lastAccount;
......@@ -72,7 +82,6 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
specialUnit.AccountingUnit = accountingUnit;
specialUnit.Department = accountingUnit;
specialUnit.Number = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "人数").PointCell)?.NumericCellValue);
//specialUnit.ScoringAverage = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "考核得分率").PointCell)?.NumericCellValue);
//specialUnit.OtherPerfor = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "其他绩效").PointCell)?.NumericCellValue);
//specialUnit.Punishment = ConvertHelper.To<decimal?>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "医院奖罚").PointCell)?.NumericCellValue);
......
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