Commit c9ea0b6b by ruyun.zhang@suvalue.com

Merge branch 'release/大量更新'

parents db1680c9 f441fd10
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Performance.DtoModels.AppSettings;
using Performance.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Performance.Api.Configurations
{
public static class AppSettingConfig
{
public static void AddAppSettingConfiguration(this IServiceCollection services, IConfiguration configuration)
{
if (services == null) throw new ArgumentNullException(nameof(services));
services
.Configure<AppConnection>(configuration.GetSection("AppConnection"))
.Configure<Application>(configuration.GetSection("Application"))
.Configure<HuyiSmsConfig>(configuration.GetSection("HuyiSmsConfig"))
.Configure<EmailOptions>(configuration.GetSection("EmailOptions"))
.Configure<RateLimitingConfig>(configuration.GetSection("RateLimitingConfig"))
.Configure<WebapiUrl>(configuration.GetSection("WebapiUrl"));
}
}
}
using AutoMapper;
using Microsoft.Extensions.DependencyInjection;
using Performance.DtoModels.AutoMapper;
using System;
namespace Performance.Api.Configurations
{
public static class AutoMapperConfig
{
public static void AddAutoMapperConfiguration(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
Mapper.Initialize(cfg => cfg.AddProfile<AutoMapperConfigs>());
services.AddAutoMapper();
}
}
}
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Performance.DtoModels.AppSettings;
using Performance.EntityModels;
using System;
namespace Performance.Api.Configurations
{
public static class DatabaseConfig
{
public static void AddDatabaseConfiguration(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
var connection = services.BuildServiceProvider().GetService<IOptions<AppConnection>>();
services.AddDbContext<PerformanceDbContext>(options =>
{
options.UseMySQL(connection.Value.PerformanceConnectionString);
});
}
}
}
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Performance.Infrastructure;
using Performance.Services;
using Performance.Services.Queues;
using System;
namespace Performance.Api.Configurations
{
public static class DependencyInjectionConfig
{
public static void AddDependencyInjectionConfiguration(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
#region custom util
//huyi短信发送注入
services.AddScoped<HuyiSmsNotify>();
//用户身份信息服务
services.AddScoped<ClaimService>();
#endregion custom util
#region email
//阿里邮箱配置
var emailOption = services.BuildServiceProvider().GetService<IOptions<EmailOptions>>();
//邮件发送
services.AddEmailUtil(options =>
{
options.Account = emailOption.Value.Account;
options.Password = emailOption.Value.Password;
options.SmtpServer = emailOption.Value.SmtpServer;
});
#endregion email
#region redis
//var csredis = new CSRedis.CSRedisClient(connection.Value.RedisConnectionString);
//RedisHelper.Initialization(csredis);
#endregion redis
services.AddHostedService<QueuedHostedService>();
services.AddSingleton<IBackgroundTaskQueue, BackgroundTaskQueue>();
services.AddSingleton<IHubNotificationQueue, HubNotificationQueue>();
services
.AddPerformanceService()
.AddPerformanceRepoitory();
}
}
#region hangfire 权限
public class HangfireAuthorizationFilter : Hangfire.Dashboard.IDashboardAuthorizationFilter
{
//这里需要配置权限规则
public bool Authorize(Hangfire.Dashboard.DashboardContext context)
{
return true;
}
}
#endregion hangfire 权限
}
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Swagger;
using System;
using System.Collections.Generic;
using System.IO;
namespace Performance.Api.Configurations
{
public static class SwaggerConfig
{
public static void AddSwaggerConfiguration(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1.0", Title = "绩效API接口" });
//var xmlPath = new string[]
//{
// Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.Api.xml"),
// Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.DtoModels.xml"),
// Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.EntityModels.xml"),
//};
//foreach (var item in xmlPath)
//{
// c.IncludeXmlComments(item, true);
//}
var xmlPathsss = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.Api.xml");
c.IncludeXmlComments(xmlPathsss, true);
// Token绑定到ConfigureServices
var security = new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference{ Type = ReferenceType.SecurityScheme, Id = "Bearer" }
},
new List<string>()
}
};
c.AddSecurityRequirement(security);
c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Description = "JWT授权(数据将在请求头中进行传输) 直接在下框中输入Bearer {token}(注意两者之间是一个空格)",
Name = "Authorization",
In = ParameterLocation.Header
});
});
}
public static void UseSwaggerSetup(this IApplicationBuilder app, IConfiguration configuration)
{
if (app == null) throw new ArgumentNullException(nameof(app));
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint(configuration["Application:SwaggerEndpoint"], "v1.0");
c.RoutePrefix = string.Empty;
});
}
}
}
......@@ -315,7 +315,7 @@ public ApiResponse SelfInfos([FromBody] UserRequest request)
if (request.Role <= 0)
user.IsAgainAdmin = user.Role != null ? roleArray.Contains(user.Role.First().Type ?? 0) : false;
else
user.IsAgainAdmin = user.Role != null ? roleArray.Contains(user.Role.First(t=>t.RoleID==request.Role).Type ?? 0) : false;
user.IsAgainAdmin = user.Role != null ? roleArray.Contains(user.Role.First(t => t.RoleID == request.Role).Type ?? 0) : false;
return new ApiResponse(ResponseType.OK, user);
}
......@@ -371,16 +371,34 @@ public ApiResponse DeleteUser([CustomizeValidator(RuleSet = "Delete"), FromBody]
#endregion
/// <summary>
/// 批量新增用户表头
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("GetBatchUserStructrue")]
[HttpPost]
public ApiResponse GetBatchUserStructrue()
{
var result = _userService.GetUserHandsFlat();
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
/// 批量新增用户
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("BatchSaveUser")]
[HttpPost]
public ApiResponse BatchSaveUser()
public ApiResponse BatchSaveUser([CustomizeValidator(RuleSet = "Insert"), FromBody] UserCollectData data)
{
var result = _userService.SaveUserHandsFlat(data);
if (result == "")
return new ApiResponse(ResponseType.OK);
else
return new ApiResponse(ResponseType.Error, result);
return new ApiResponse(ResponseType.OK);
}
}
}
\ No newline at end of file
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Internal;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Performance.DtoModels;
......@@ -16,6 +18,7 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
......@@ -88,7 +91,7 @@ public ApiResponse Success([FromBody] AllotRequest request)
/// <returns></returns>
[Route("insert")]
[HttpPost]
public ApiResponse Insert([CustomizeValidator(RuleSet = "Insert"), FromBody] AllotRequest request)
public ApiResponse Insert([FromBody] AllotRequest request)
{
var userId = _claim.GetUserId();
var result = _allotService.InsertAllot(request, userId);
......@@ -298,7 +301,20 @@ public ApiResponse GenerateReport([CustomizeValidator(RuleSet = "Delete"), FromB
await Task.Delay(TimeSpan.FromSeconds(5), token);
}
});
return new ApiResponse(ResponseType.OK);
return new ApiResponse(ResponseType.OK, "统计报表数据任务开始");
}
/// <summary>
/// 验证科室核算单元、工号
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("accounting/verify/{allotId}")]
[HttpPost]
public ApiResponse AccountingVerify([FromRoute] int allotId)
{
_allotService.AccoungtingVerify(allotId);
return new ApiResponse(ResponseType.OK, "核算单元及组别数据验证结束,请刷新页面。");
}
/*
......@@ -500,5 +516,37 @@ public ApiResponse Reserved([FromBody] ReservedRequest request)
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
/// 下载当前测算表
/// </summary>
/// <param name="allotid"></param>
/// <returns></returns>
[Route("current/download/{allotid}")]
[HttpGet]
[AllowAnonymous]
public IActionResult DownloadCurrentCalculationTable(int allotid)
{
var allot = _allotService.GetAllot(allotid);
if (null == allot)
throw new PerformanceException("当前测算表不存在");
if (string.IsNullOrEmpty(allot.Path))
throw new PerformanceException("尚未提交测算表");
if (!FileHelper.IsExistFile(allot.Path))
throw new PerformanceException("测算表文件路径无效");
var memoryStream = new MemoryStream();
using (var stream = new FileStream(allot.Path, FileMode.Open))
{
stream.CopyToAsync(memoryStream).Wait();
}
memoryStream.Seek(0, SeekOrigin.Begin);
var provider = new FileExtensionContentTypeProvider();
FileInfo fileInfo = new FileInfo(allot.Path);
var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
}
}
}
......@@ -305,6 +305,7 @@ public ApiResponse AllComputeByPM([FromBody] ComputerRequest request)
AdjustLaterOtherFee = t.Sum(s => s.AdjustLaterOtherFee),
ShouldGiveFee = t.Sum(s => s.ShouldGiveFee),
OthePerfor = t.Sum(s => s.OthePerfor),
HideOtherPerfor = t.Sum(s => s.HideOtherPerfor),
NightWorkPerfor = t.Sum(s => s.NightWorkPerfor),
RealGiveFee = t.Sum(s => s.RealGiveFee),
ReservedRatio = t.Sum(s => s.ReservedRatio),
......@@ -395,23 +396,5 @@ public ApiResponse<res_baiscnorm> EditHospitalAvg([FromBody] ComputerAvgRequest
}
#endregion
#region 其他绩效统计
/// <summary>
/// 其他医院绩效统计
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("OtherPerStats/{allotId}")]
[HttpPost]
public ApiResponse OtherPerStats(int allotId)
{
var employee = _employeeService.GetAprList(allotId, _claim.GetUserId());
var relust = _computeService.GetOtherPerStats(employee);
return new ApiResponse(ResponseType.OK, relust);
}
#endregion
}
}
\ No newline at end of file
......@@ -533,19 +533,24 @@ public ApiResponse DepttypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB
[HttpPost]
public ApiResponse GetAccountingList([FromBody] AccoungingRequest request)
{
if (request.AllotId == 0 || !new int[] { 1, 2, 3 }.Contains(request.Type))
var enumItems = EnumHelper.GetItems<AccountTypeEnum>();
if ((request.AllotId == 0 && request.HospitalId == 0) || !enumItems.Select(t => t.Value).Contains(request.Type))
return new ApiResponse(ResponseType.ParameterError);
var list = _configService.GetAccountingList(request) ?? new List<cof_accounting>();
var result = _configService.GetAccountingList(request);
switch (request.Type)
{
case 1:
default: //返回accounting列表
return new ApiResponse(ResponseType.OK, "ok", list);
case 3: //返回核算单元类型
return new ApiResponse(ResponseType.OK, "ok", list.Select(t => new TitleValue { Title = t.UnitType, Value = t.UnitType }).ToDistinct());
case 2: //返回核算单元
return new ApiResponse(ResponseType.OK, "ok", list.Select(t => new TitleValue { Title = t.AccountingUnit, Value = t.AccountingUnit }).ToDistinct());
case (int)AccountTypeEnum.List: //返回accounting列表
default:
return new ApiResponse(ResponseType.OK, AccountTypeEnum.List.ToString(), result);
case (int)AccountTypeEnum.UnitType: //返回核算单元类型
var unittypes = result.Select(t => new TitleValue { Title = t.UnitType, Value = t.UnitType }).ToDistinct();
return new ApiResponse(ResponseType.OK, AccountTypeEnum.UnitType.ToString(), unittypes);
case (int)AccountTypeEnum.AccountingUnit: //返回核算单元
var accountingunits = result.Select(t => new TitleValue { Title = t.AccountingUnit, Value = t.AccountingUnit }).ToDistinct();
return new ApiResponse(ResponseType.OK, AccountTypeEnum.AccountingUnit.ToString(), accountingunits);
}
}
......@@ -595,18 +600,37 @@ public ApiResponse AccountingDelete([FromRoute] int accountingId)
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 核算单元及组别数据验证
/// 核算单元及组别批量表头
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("accountingverify/{allotId}")]
[Route("BatchAccountingStructrue/{allotId}")]
[HttpPost]
public ApiResponse AccountingVerify([FromRoute] int allotId)
public ApiResponse BatchAccountingStructrue([FromRoute] int allotId)
{
_configService.AccoungtingVerify(allotId);
return new ApiResponse(ResponseType.OK);
var request = _configService.GetBatchAccountingStructrue(allotId);
return new ApiResponse(ResponseType.OK, request);
}
/// <summary>
/// 核算单元及组别批量添加
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("BatchSaveAccounting/{allotId}")]
[HttpPost]
public ApiResponse BatchSaveAccounting(int allotId, [FromBody] SaveCollectData request)
{
var result = _configService.BatchSaveAccounting(allotId, request);
if (result)
return new ApiResponse(ResponseType.OK);
else
return new ApiResponse(ResponseType.Error, "请选择正确的核算组别");
}
#endregion
/// <summary>
......
......@@ -254,14 +254,16 @@ public ApiResponse Audit(int allotid)
return result ? new ApiResponse(ResponseType.OK, "提交成功") : new ApiResponse(ResponseType.Fail, "提交失败");
}
#region 医院其他绩效
/// <summary>
/// 获取人员补充绩效列表
/// 获取医院其他绩效列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("apr/getlist")]
[HttpPost]
public ApiResponse GetAprList([FromBody] per_apr_amount request)
public ApiResponse GetAprList([FromBody] AllotIdRequest request)
{
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
......@@ -277,7 +279,7 @@ public ApiResponse GetAprList([FromBody] per_apr_amount request)
/// <returns></returns>
[Route("apr/getdeptlist")]
[HttpPost]
public ApiResponse GetAprGroupList([FromBody] per_apr_amount request)
public ApiResponse GetAprGroupList([FromBody] AllotIdRequest request)
{
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
......@@ -328,7 +330,7 @@ public ApiResponse GetAprDetail([FromBody] per_apr_amount request)
}
/// <summary>
/// 新增人员补充绩效
/// 新增医院其他绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
......@@ -345,7 +347,7 @@ public ApiResponse InsertApr([FromBody] per_apr_amount request)
}
/// <summary>
/// 修改人员补充绩效
/// 修改医院其他绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
......@@ -362,13 +364,13 @@ public ApiResponse UpdateApr([FromBody] per_apr_amount request)
}
/// <summary>
/// 删除人员补充绩效
/// 删除医院其他绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("apr/delete")]
[HttpPost]
public ApiResponse DeleteApr([FromBody] per_apr_amount request)
public ApiResponse DeleteApr([FromBody] IdRequest request)
{
if (request.Id == 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效!");
......@@ -392,7 +394,7 @@ public ApiResponse AuditResult([FromBody] AprAmountAuditRequest request)
}
/// <summary>
/// 上传人员绩效文件
/// 上传医院其他绩效文件
/// </summary>
/// <param name="form"></param>
/// <returns></returns>
......@@ -434,6 +436,32 @@ public ApiResponse Import([FromForm] IFormCollection form)
}
/// <summary>
/// 绩效类型字典
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpPost("apr/perfortype/{allotId}")]
public ApiResponse<List<TitleValue>> GetPerforTypeDict([FromRoute] int allotId)
{
var result = employeeService.GetPerforTypeDict(allotId);
return new ApiResponse<List<TitleValue>>(ResponseType.OK, "绩效类型字典", result);
}
/// <summary>
/// 医院其他绩效统计
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("apr/overview/{allotId}")]
[HttpPost]
public ApiResponse AprOverview(int allotId)
{
var relust = employeeService.GetOtherPerStats(allotId);
return new ApiResponse(ResponseType.OK, relust);
}
#endregion
/// <summary>
/// 自动获取人员信息
/// </summary>
/// <remarks>
......@@ -456,30 +484,223 @@ public ApiResponse<per_apr_amount> GetEmployeeMessage([FromBody] per_apr_amount
}
/// <summary>
/// 绩效类型字典
/// 材料科室考核
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpPost("apr/perfortype/{allotId}")]
public ApiResponse<List<TitleValue>> GetPerforTypeDict([FromRoute] int allotId)
[Route("deptAssessment/{allotId}")]
[HttpPost]
public ApiResponse GetDeptAssessment(int allotId)
{
var result = employeeService.GetPerforTypeDict(allotId);
return new ApiResponse<List<TitleValue>>(ResponseType.OK, "绩效类型字典", result);
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var result = employeeService.GetDeptAssessment(allotId);
return new ApiResponse(ResponseType.OK, result);
}
#region 不公示其他绩效
/// <summary>
/// 材料科室考核
/// 获取不公示其他绩效列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("deptAssessment/{allotId}")]
[Route("apr/hide/getlist")]
[HttpPost]
public ApiResponse GetDeptAssessment(int allotId)
public ApiResponse GetAprHideList([FromBody] AllotIdRequest request)
{
if (allotId<=0)
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var result=employeeService.GetDeptAssessment(allotId);
return new ApiResponse(ResponseType.OK,result);
var employee = employeeService.GetAprHideList(request.AllotId, claim.GetUserId());
return new ApiResponse(ResponseType.OK, "ok", employee);
}
/// <summary>
/// 不公示其他绩效审核
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("apr/hide/getdeptlist")]
[HttpPost]
public ApiResponse GetAprHideGroupList([FromBody] AllotIdRequest request)
{
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.GetAprHideList(request.AllotId, claim.GetUserId());
if (employee == null || !employee.Any())
return new ApiResponse(ResponseType.OK, "ok", employee);
var result = employee.GroupBy(t => new { TypeInDepartment = t.TypeInDepartment ?? "" })
.Select(t => new per_apr_amount
{
TypeInDepartment = t.Key.TypeInDepartment,
Amount = t.Sum(s => s.Amount ?? 0),
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
});
return new ApiResponse(ResponseType.OK, "ok", result);
}
/// <summary>
///不公示其他绩效审核详情
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("apr/hide/getdeptdetail")]
[HttpPost]
public ApiResponse GetAprHideDetail([FromBody] per_apr_amount request)
{
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.GetAprHideList(request.AllotId, request.TypeInDepartment);
if (employee == null || !employee.Any())
return new ApiResponse(ResponseType.OK, "ok", employee);
var result = employee.GroupBy(t => new { t.AccountingUnit, t.PersonnelNumber, t.DoctorName }).Select(t => new
{
PersonnelNumber = t.Key.PersonnelNumber,
DoctorName = t.Key.DoctorName,
AccountingUnit = t.Key.AccountingUnit,
Status = t.Any(s => s.Status == 2) ? 2 : t.Any(s => s.Status == 4) ? 4 : t.FirstOrDefault().Status,
Detail = t.GroupBy(group => group.PerforType).Select(s => new TitleValue<decimal>
{
Title = string.IsNullOrEmpty(s.Key) ? "未知" : s.Key,
Value = s.Sum(sum => sum.Amount ?? 0)
})
});
return new ApiResponse(ResponseType.OK, "ok", result);
}
/// <summary>
/// 新增不公示其他绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("apr/hide/insert")]
[HttpPost]
public ApiResponse InsertAprHide([FromBody] per_apr_amount_hide request)
{
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var result = employeeService.InsertAprHide(request, claim.GetUserId());
return result ? new ApiResponse(ResponseType.OK, "添加成功", request) :
new ApiResponse(ResponseType.Fail, "添加失败");
}
/// <summary>
/// 修改不公示其他绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("apr/hide/update")]
[HttpPost]
public ApiResponse UpdateAprHide([FromBody] per_apr_amount_hide request)
{
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var result = employeeService.UpdateAprHide(request);
return result ? new ApiResponse(ResponseType.OK, "修改成功", request) :
new ApiResponse(ResponseType.Fail, "修改失败");
}
/// <summary>
/// 删除不公示其他绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("apr/hide/delete")]
[HttpPost]
public ApiResponse DeleteAprHide([FromBody] IdRequest request)
{
if (request.Id == 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效!");
if (!employeeService.DeleteAprHide(request.Id))
return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 不公示其他绩效审核;驳回、成功
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("apr/hide/audit")]
public ApiResponse AuditResultHide([FromBody] AprAmountAuditRequest request)
{
var userid = claim.GetUserId();
var result = employeeService.ConfirmAuditHide(userid, request);
return result ? new ApiResponse(ResponseType.OK, "操作成功") : new ApiResponse(ResponseType.Fail, "操作失败");
}
/// <summary>
/// 上传不公示其他绩效
/// </summary>
/// <param name="form"></param>
/// <returns></returns>
[Route("apr/hide/import")]
[HttpPost]
public ApiResponse ImportAprHide([FromForm] IFormCollection form)
{
var allotid = form.ToDictionary().GetValue("allotid", 0);
if (allotid <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
var file = ((FormFileCollection)form.Files).FirstOrDefault();
if (file == null)
return new ApiResponse(ResponseType.Fail, "参数错误", "文件无效");
if (!ExtractHelper.IsXlsxFile(file.FileName))
return new ApiResponse(ResponseType.Fail, "文件格式错误", "文件暂只支持xlsx文件");
var allot = allotService.GetAllot(allotid);
if (allot == null)
return new ApiResponse(ResponseType.Fail, "allotid不存在");
var name = FileHelper.GetFileNameNoExtension(file.FileName) + DateTime.Now.ToString("yyyyMMddHHmmssfff");
var ext = FileHelper.GetExtension(file.FileName);
var dpath = Path.Combine(evn.ContentRootPath, "Files", $"{allot.HospitalId}", $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}");
FileHelper.CreateDirectory(dpath);
var path = Path.Combine(dpath, $"{name}{ext}");
using (var stream = file.OpenReadStream())
{
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
if (!FileHelper.CreateFile(path, bytes))
return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传失败");
}
employeeService.ImpoerAprHideEmployees(allotid, path, claim.GetUserId());
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 不公示其他绩效类型字典
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpPost("apr/hide/perfortype/{allotId}")]
public ApiResponse<List<TitleValue>> GetPerforTypeDictHide([FromRoute] int allotId)
{
var result = employeeService.GetPerforTypeDictHide(allotId);
return new ApiResponse<List<TitleValue>>(ResponseType.OK, "绩效类型字典", result);
}
/// <summary>
/// 不公示其他绩效统计
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[Route("apr/hide/overview/{allotId}")]
[HttpPost]
public ApiResponse AprHideOverview(int allotId)
{
var relust = employeeService.GetOtherPerStatsHide(allotId);
return new ApiResponse(ResponseType.OK, relust);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Infrastructure.Models;
using Performance.Services;
namespace Performance.Api.Controllers
......@@ -27,13 +31,22 @@ public PersonController(PersonService personService, ClaimService claimService)
/// 获取所有员工记录
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("person/list/{allotId}")]
[HttpPost]
public ApiResponse GetPersons(int allotId)
public ApiResponse GetPersons([FromRoute] int allotId, [FromBody] PersonParamsRequest request)
{
var list = personService.GetPersons(allotId, claimService.GetUserId());
return new ApiResponse(ResponseType.OK, list);
var list = personService.GetPersons(allotId, claimService.GetUserId(), request)
?? new PageList<per_employee>(new List<per_employee>(), 0, request.PageNumber, request.PageSize);
return new ApiResponse(ResponseType.OK, new
{
list.CurrentPage,
list.TotalPages,
list.PageSize,
list.TotalCount,
list
});
}
/// <summary>
......@@ -80,6 +93,30 @@ public ApiResponse DeletePerson(int employeeId)
}
/// <summary>
/// 下载当前测算表
/// </summary>
/// <returns></returns>
[Route("person/list/download/{allotId}")]
[HttpPost]
public IActionResult DownloadCurrentCalculationTable([FromRoute] int allotId)
{
var filepath = personService.GetPersonDictFile(allotId, claimService.GetUserId());
if (!FileHelper.IsExistFile(filepath))
throw new PerformanceException("获取人员字典失败");
var memoryStream = new MemoryStream();
using (var stream = new FileStream(filepath, FileMode.Open))
{
stream.CopyToAsync(memoryStream).Wait();
}
memoryStream.Seek(0, SeekOrigin.Begin);
var provider = new FileExtensionContentTypeProvider();
FileInfo fileInfo = new FileInfo(filepath);
var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
}
/// <summary>
/// 获取所有科室记录
/// </summary>
/// <param name="hospitalId"></param>
......@@ -181,5 +218,56 @@ public ApiResponse DeptIncomeDetail([CustomizeValidator(RuleSet = "Select"), Fro
var data = personService.DeptIncomeDetail(request, claimService.GetUserId());
return new ApiResponse(ResponseType.OK, data);
}
/// <summary>
/// 批量人员字典表头
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("person/GetBatchPersonStructrue/{hospitalId}")]
public ApiResponse GetBatchPersonStructrue(int hospitalId)
{
var result = personService.GetBatchPersonStructrue(hospitalId);
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
/// 批量添加人员信息
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("person/{allotId}/BathSavePerson/{hospitalId}")]
public ApiResponse BathSavePerson(int allotId, int hospitalId, SaveCollectData request)
{
var result = personService.BathSavePerson(allotId, hospitalId, request);
if (result)
return new ApiResponse(ResponseType.OK);
else
return new ApiResponse(ResponseType.Error, "出勤天数或预留比例格式错误");
}
/// <summary>
/// 批量科室字典表头
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("dept/GetDeptStructrue/{hospitalId}")]
public ApiResponse GetDeptStructrue(int hospitalId)
{
var result = personService.GetDepartmentHands(hospitalId);
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
/// 批量添加科室信息
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("dept/SaveDeptHands/{hospitalId}")]
public ApiResponse SaveDeptHands(int hospitalId, SaveCollectData request)
{
personService.SaveDeptDicHands(hospitalId, request);
return new ApiResponse(ResponseType.OK);
}
}
}
......@@ -81,7 +81,8 @@ public ApiResponse SaveValue(int secondid, [FromBody] List<ag_fixatitem> request
if (unitTypeCount != 1 || request.Any(t => string.IsNullOrEmpty(t.UnitType)))
throw new PerformanceException("科室类型错误");
var repetition = request.GroupBy(t => new { t.RowNumber, t.ItemName /*, WorkType = t.WorkType ?? 0*/ }).Where(t => t.Count() > 1);
var repetition = request.Where(t => !string.IsNullOrWhiteSpace(t.ItemName))
.GroupBy(t => new { t.RowNumber, t.ItemName /*, WorkType = t.WorkType ?? 0*/ }).Where(t => t.Count() > 1);
if (repetition.Any())
throw new PerformanceException(string.Join(";", repetition.Select(t => $"行{t.Key.RowNumber}项‘{t.Key.ItemName}’重复录入")));
......
......@@ -221,9 +221,10 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
//检验科室、费用类型是否需要补充
allot.IsExtracting = allot.IsExtracting ?? 0;
if (allot.IsExtracting == 1)
if (allot.IsExtracting == 1 && allot.ExtractTime.HasValue && DateTime.Now.AddHours(-3) < allot.ExtractTime)
return new ApiResponse(ResponseType.OK, "正在提取数据,请稍等!", new { IsExtracting = true });
allot.IsExtracting = 1;
allot.ExtractTime = DateTime.Now;
allotService.Update(allot);
string email = claim.GetUserClaim(JwtClaimTypes.Mail);
......
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Performance.DtoModels;
using Performance.DtoModels.AppSettings;
using Performance.Infrastructure;
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
namespace Performance.Api
{
public class RequestRateLimitingMiddleware
{
private readonly int Limit = 1;
private readonly ILogger logger;
private readonly RequestDelegate next;
private readonly IMemoryCache requestStore;
private readonly IHttpContextAccessor httpContextAccessor;
private readonly RateLimitingConfig options;
public RequestRateLimitingMiddleware(
ILogger<RequestRateLimitingMiddleware> logger,
RequestDelegate next,
IMemoryCache requestStore,
IHttpContextAccessor httpContextAccessor,
IOptions<RateLimitingConfig> options)
{
this.logger = logger;
this.next = next;
this.requestStore = requestStore;
this.httpContextAccessor = httpContextAccessor;
this.options = options.Value;
if (options != null)
Limit = options.Value.Limit;
}
public async Task Invoke(HttpContext context)
{
if (!context.Response.HasStarted && options != null && options.Endpoints != null && options.Endpoints.Any(t => context.Request.Path.ToString().StartsWith(t)))
{
var ip = httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
var headers = context.Request.Headers;
if (headers.ContainsKey("X-Forwarded-For"))
{
ip = IPAddress.Parse(headers["X-Forwarded-For"].ToString().Split(',', StringSplitOptions.RemoveEmptyEntries)[0]).ToString();
}
var requestKey = $"{ip}-{context.Request.Method}-{context.Request.Path}";
// logger.LogInformation($"请求地址:{requestKey}");
var cacheOptions = new MemoryCacheEntryOptions()
{
AbsoluteExpiration = DateTime.Now.AddSeconds(options.Period)
};
if (requestStore.TryGetValue(requestKey, out int hitCount))
{
if (hitCount < Limit)
{
await ProcessRequest(context, requestKey, hitCount, cacheOptions);
}
else
{
// X-RateLimit-RetryAfter:超出限制后能够再次正常访问的时间。
context.Response.Headers["X-RateLimit-RetryAfter"] = cacheOptions.AbsoluteExpiration?.ToString();
context.Response.StatusCode = StatusCodes.Status200OK;
context.Response.ContentType = "application/json; charset=utf-8";
var response = new ApiResponse
{
State = ResponseType.TooManyRequests,
Message = "访问过于频繁,请稍后重试"
};
await context.Response.WriteAsync(JsonHelper.Serialize(response));
}
}
else
{
await ProcessRequest(context, requestKey, hitCount, cacheOptions);
}
}
else
{
await next(context);
}
}
private async Task ProcessRequest(HttpContext context, string requestKey, int hitCount, MemoryCacheEntryOptions cacheOptions)
{
hitCount++;
requestStore.Set(requestKey, hitCount, cacheOptions);
// X-RateLimit-Limit:同一个时间段所允许的请求的最大数目
context.Response.Headers["X-RateLimit-Limit"] = Limit.ToString();
// X-RateLimit-Remaining:在当前时间段内剩余的请求的数量。
context.Response.Headers["X-RateLimit-Remaining"] = (Limit - hitCount).ToString();
await next(context);
}
}
}
using GraphQL;
using GraphQL.Types;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Performance.Api
{
......
......@@ -55,7 +55,7 @@
<PackageReference Include="NLog" Version="4.5.11" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.4.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.8.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
<PackageReference Include="Microsoft.AspNet.SignalR" Version="2.4.1" />
</ItemGroup>
......
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using NLog.Web;
using System;
namespace Performance.Api
{
......@@ -23,6 +19,7 @@ public static void Main(string[] args)
catch (Exception ex)
{
logger.Error(ex, "Stopped program because of exception");
throw;
}
finally
{
......@@ -37,14 +34,16 @@ public static void Main(string[] args)
var env = context.HostingEnvironment;
config.AddJsonFile("appsettings.json", true, true);
config.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true, true);
config.AddJsonFile($"RateLimitConfig.json", true, true);
})
.UseUrls("http://*:5001")
.UseStartup<Startup>()
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddConsole();
logging.SetMinimumLevel(LogLevel.Trace);
})
.UseNLog()
.UseStartup<Startup>();
.UseNLog();
}
}
using AutoMapper;
using FluentValidation;
using FluentValidation;
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using NLog.Extensions.Logging;
using Performance.DtoModels.AppSettings;
using Performance.DtoModels.AutoMapper;
using Performance.EntityModels;
using Performance.Api.Configurations;
using Performance.Infrastructure;
using Performance.Services;
using Performance.Services.Queues;
using Swashbuckle.AspNetCore.Swagger;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text;
......@@ -38,51 +26,32 @@ public Startup(IConfiguration configuration)
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
//LogHelper.Initialize(Configuration.GetSection("AppConnection:RedisConnectionString").Value, "MTEzMTAyMzEzNDYzMzY5MzE4NA");
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
#region appsetting注入
// appsettings.json
services.AddAppSettingConfiguration(Configuration);
services
.Configure<AppConnection>(Configuration.GetSection("AppConnection"))
.Configure<Application>(Configuration.GetSection("Application"))
.Configure<HuyiSmsConfig>(Configuration.GetSection("HuyiSmsConfig"))
.Configure<EmailOptions>(Configuration.GetSection("EmailOptions"))
.Configure<WebapiUrl>(Configuration.GetSection("WebapiUrl"));
#endregion appsetting注入
var connection = services.BuildServiceProvider().GetService<IOptions<AppConnection>>();
// memory cache
services.AddMemoryCache();
// graphql
services.AddGraphQLSchemaAndTypes();
#region json & fluentvalidation & filter
services
//筛选器配置
.AddMvc(option =>
{
//筛选器配置
option.Filters.Add<AuthenticationFilter>();
option.Filters.Add<ActionsFilter>();
option.Filters.Add<ExceptionsFilter>();
})
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
//json格式配置
.AddJsonOptions(json =>
{
json.SerializerSettings.Converters.Add(new IsoDateTimeConverterContent() { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" });
json.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented;
json.SerializerSettings.ContractResolver = new LowercaseContractResolver();
json.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Include;
json.SerializerSettings.DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat;
json.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc;
json.SerializerSettings.Culture = new CultureInfo("zh-CN");
json.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
})
//model验证
.AddJsonOptions(JsonOptions) //json格式配置
.AddFluentValidation(fv =>
{
//禁用其他以使FluentValidation是唯一执行的验证库
// model验证,禁用其他以使FluentValidation是唯一执行的验证库
fv.RunDefaultMvcValidationAfterFluentValidationExecutes = false;
var assembly = Assembly.Load("Performance.DtoModels");
......@@ -95,68 +64,22 @@ public void ConfigureServices(IServiceCollection services)
#endregion json & fluentvalidation & filter
#region automapper
Mapper.Initialize(cfg => cfg.AddProfile<AutoMapperConfigs>());
services.AddAutoMapper();
#endregion automapper
#region service注入 repoitory注入
services
.AddPerformanceService()
.AddPerformanceRepoitory();
#endregion service注入 repoitory注入
#region custom util
//huyi短信发送注入
services.AddScoped<HuyiSmsNotify>();
//用户身份信息服务
services.AddScoped<ClaimService>();
#endregion custom util
// dbcontext
services.AddDatabaseConfiguration();
#region email
// automapper
services.AddAutoMapperConfiguration();
//阿里邮箱配置
var emailOption = services.BuildServiceProvider().GetService<IOptions<EmailOptions>>();
//邮件发送
services.AddEmailUtil(options =>
{
options.Account = emailOption.Value.Account;
options.Password = emailOption.Value.Password;
options.SmtpServer = emailOption.Value.SmtpServer;
});
#endregion email
#region redis
//var csredis = new CSRedis.CSRedisClient(connection.Value.RedisConnectionString);
//RedisHelper.Initialization(csredis);
#endregion redis
services.AddMemoryCache();
// swagger
services.AddSwaggerConfiguration();
services.AddHostedService<QueuedHostedService>();
services.AddSingleton<IBackgroundTaskQueue, BackgroundTaskQueue>();
services.AddSingleton<IHubNotificationQueue, HubNotificationQueue>();
//#region hangfire
//services.AddHangfire(config =>
//{
// config.UseFilter(new AutomaticRetryAttribute { Attempts = 0 });
// config.UseStorage(new MySqlStorage(connection.Value.HangfireConnectionString));
//});
//#endregion hangfire
// service repository
services.AddDependencyInjectionConfiguration();
// signalr
services.AddSignalR();
// cors
services.AddCors(options =>
{
options.AddPolicy("SignalrCore", policy =>
......@@ -164,54 +87,6 @@ public void ConfigureServices(IServiceCollection services)
policy.SetIsOriginAllowed(origin => true).AllowAnyHeader().AllowAnyMethod().AllowCredentials();
});
});
#region //ef配置
services.AddDbContext<PerformanceDbContext>(options =>
{
options.UseMySQL(connection.Value.PerformanceConnectionString);
});
#endregion //ef配置
#region swagger
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Version = "v1.0", Title = "绩效API接口" });
var xmlPath = new string[]
{
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.Api.xml"),
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.DtoModels.xml"),
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.EntityModels.xml"),
};
var xmlPathsss = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "Performance.Api.xml");
c.IncludeXmlComments(xmlPathsss, true);
//foreach (var item in xmlPath)
//{
// c.IncludeXmlComments(item, true);
//}
#region Token绑定到ConfigureServices
var security = new Dictionary<string, IEnumerable<string>> { { "Performance API", new string[] { } }, };
c.AddSecurityRequirement(security);
c.AddSecurityDefinition("Performance API", new ApiKeyScheme
{
Description = "JWT授权(数据将在请求头中进行传输) 直接在下框中输入Bearer {token}(注意两者之间是一个空格)",
Name = "Authorization",
In = "HEADER"
});
#endregion Token绑定到ConfigureServices
});
#endregion swagger
ServiceLocator.Instance = services.BuildServiceProvider();
FluentScheduler.JobManager.Initialize(new JobRegistry());
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......@@ -226,41 +101,27 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
app.UseStatusCodePagesWithReExecute("/error/{0}");
}
#region Swagger
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint(Configuration["Application:SwaggerEndpoint"], "v1.0");
//c.SwaggerEndpoint("/swagger/v1/swagger.json", "v1.0");
c.RoutePrefix = "";
});
#endregion Swagger
//#region hangfire
//app.UseHangfireServer();
//app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new HangfireAuthorizationFilter() } });
//#endregion hangfire
app.UseMiddleware<RequestRateLimitingMiddleware>();
app.UseCors("SignalrCore");
app.UseSignalR(routes => routes.MapHub<AllotLogHub>("/performance/allotLogHub"));
app.UseMvc();
}
}
#region hangfire 权限
app.UseSwaggerSetup(Configuration);
}
public class HangfireAuthorizationFilter : Hangfire.Dashboard.IDashboardAuthorizationFilter
{
//这里需要配置权限规则
public bool Authorize(Hangfire.Dashboard.DashboardContext context)
private void JsonOptions(MvcJsonOptions json)
{
return true;
json.SerializerSettings.Converters.Add(new IsoDateTimeConverterContent() { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" });
json.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented;
json.SerializerSettings.ContractResolver = new LowercaseContractResolver();
json.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Include;
json.SerializerSettings.DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat;
json.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc;
json.SerializerSettings.Culture = new CultureInfo("zh-CN");
json.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
}
}
#endregion hangfire 权限
}
......@@ -36,5 +36,10 @@
"ImportFile": "http://localhost:5001/api/",
// 抽取uri
"HttpPost": "http://localhost:50997/api/"
},
"RateLimitingConfig": {
"Endpoints": [ "/api/second/savevalue", "/api/second/savedata", "/api/second/other/save" ],
"Period": "1", // 单位为秒
"Limit": 1
}
}
......@@ -137,7 +137,14 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AccountController.BatchSaveUser">
<member name="M:Performance.Api.Controllers.AccountController.GetBatchUserStructrue">
<summary>
批量新增用户表头
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AccountController.BatchSaveUser(Performance.DtoModels.UserCollectData)">
<summary>
批量新增用户
</summary>
......@@ -232,6 +239,13 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AllotController.AccountingVerify(System.Int32)">
<summary>
验证科室核算单元、工号
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AllotController.Recalculation(Performance.DtoModels.RecalculationRequest)">
<summary>
重新计算院领导绩效
......@@ -287,6 +301,13 @@
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AllotController.DownloadCurrentCalculationTable(System.Int32)">
<summary>
下载当前测算表
</summary>
<param name="allotid"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.BudgetController.Query(Performance.DtoModels.Request.BudgetRequest)">
<summary>
预算管理查询(包含金额、占比)
......@@ -488,13 +509,6 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ComputeController.OtherPerStats(System.Int32)">
<summary>
其他医院绩效统计
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.GetDrugtypeList(Performance.DtoModels.DrugpropRequest)">
<summary>
获取 药占比类型信息列表
......@@ -635,9 +649,16 @@
<param name="accountingId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.AccountingVerify(System.Int32)">
<member name="M:Performance.Api.Controllers.ConfigController.BatchAccountingStructrue(System.Int32)">
<summary>
核算单元及组别批量表头
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.BatchSaveAccounting(System.Int32,Performance.DtoModels.SaveCollectData)">
<summary>
核算单元及组别数据验证
核算单元及组别批量添加
</summary>
<param name="allotId"></param>
<returns></returns>
......@@ -767,14 +788,14 @@
<param name="allotid"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetAprList(Performance.EntityModels.per_apr_amount)">
<member name="M:Performance.Api.Controllers.EmployeeController.GetAprList(Performance.DtoModels.AllotIdRequest)">
<summary>
获取人员补充绩效列表
获取医院其他绩效列表
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetAprGroupList(Performance.EntityModels.per_apr_amount)">
<member name="M:Performance.Api.Controllers.EmployeeController.GetAprGroupList(Performance.DtoModels.AllotIdRequest)">
<summary>
医院其他绩效审核
</summary>
......@@ -790,21 +811,21 @@
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.InsertApr(Performance.EntityModels.per_apr_amount)">
<summary>
新增人员补充绩效
新增医院其他绩效
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.UpdateApr(Performance.EntityModels.per_apr_amount)">
<summary>
修改人员补充绩效
修改医院其他绩效
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.DeleteApr(Performance.EntityModels.per_apr_amount)">
<member name="M:Performance.Api.Controllers.EmployeeController.DeleteApr(Performance.DtoModels.IdRequest)">
<summary>
删除人员补充绩效
删除医院其他绩效
</summary>
<param name="request"></param>
<returns></returns>
......@@ -817,11 +838,25 @@
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.Import(Microsoft.AspNetCore.Http.IFormCollection)">
<summary>
上传人员绩效文件
上传医院其他绩效文件
</summary>
<param name="form"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetPerforTypeDict(System.Int32)">
<summary>
绩效类型字典
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.AprOverview(System.Int32)">
<summary>
医院其他绩效统计
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetEmployeeMessage(Performance.EntityModels.per_apr_amount)">
<summary>
自动获取人员信息
......@@ -839,17 +874,79 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetPerforTypeDict(System.Int32)">
<member name="M:Performance.Api.Controllers.EmployeeController.GetDeptAssessment(System.Int32)">
<summary>
绩效类型字典
材料科室考核
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetAprHideList(Performance.DtoModels.AllotIdRequest)">
<summary>
获取不公示其他绩效列表
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetAprHideGroupList(Performance.DtoModels.AllotIdRequest)">
<summary>
不公示其他绩效审核
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetAprHideDetail(Performance.EntityModels.per_apr_amount)">
<summary>
不公示其他绩效审核详情
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.InsertAprHide(Performance.EntityModels.per_apr_amount_hide)">
<summary>
新增不公示其他绩效
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.UpdateAprHide(Performance.EntityModels.per_apr_amount_hide)">
<summary>
修改不公示其他绩效
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.DeleteAprHide(Performance.DtoModels.IdRequest)">
<summary>
删除不公示其他绩效
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.AuditResultHide(Performance.DtoModels.AprAmountAuditRequest)">
<summary>
不公示其他绩效审核;驳回、成功
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.ImportAprHide(Microsoft.AspNetCore.Http.IFormCollection)">
<summary>
上传不公示其他绩效
</summary>
<param name="form"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetPerforTypeDictHide(System.Int32)">
<summary>
不公示其他绩效类型字典
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetDeptAssessment(System.Int32)">
<member name="M:Performance.Api.Controllers.EmployeeController.AprHideOverview(System.Int32)">
<summary>
材料科室考核
不公示其他绩效统计
</summary>
<param name="allotId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ExConfigController.Extract(Performance.DtoModels.ModModuleRequest)">
......@@ -1073,11 +1170,12 @@
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.PersonController.GetPersons(System.Int32)">
<member name="M:Performance.Api.Controllers.PersonController.GetPersons(System.Int32,Performance.DtoModels.PersonParamsRequest)">
<summary>
获取所有员工记录
</summary>
<param name="allotId"></param>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.PersonController.CreatePerson(Performance.DtoModels.PerEmployeeResponse)">
......@@ -1101,6 +1199,12 @@
<param name="employeeId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.PersonController.DownloadCurrentCalculationTable(System.Int32)">
<summary>
下载当前测算表
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.PersonController.GetDepartments(System.Int32)">
<summary>
获取所有科室记录
......@@ -1149,6 +1253,30 @@
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.PersonController.GetBatchPersonStructrue(System.Int32)">
<summary>
批量人员字典表头
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.PersonController.BathSavePerson(System.Int32,System.Int32,Performance.DtoModels.SaveCollectData)">
<summary>
批量添加人员信息
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.PersonController.GetDeptStructrue(System.Int32)">
<summary>
批量科室字典表头
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.PersonController.SaveDeptHands(System.Int32,Performance.DtoModels.SaveCollectData)">
<summary>
批量添加科室信息
</summary>
<returns></returns>
</member>
<member name="T:Performance.Api.Controllers.ReportController">
<summary>
报表
......
......@@ -74,6 +74,21 @@
相对
</summary>
</member>
<member name="P:Performance.DtoModels.AppSettings.RateLimitingConfig.Endpoints">
<summary>
路径
</summary>
</member>
<member name="P:Performance.DtoModels.AppSettings.RateLimitingConfig.Period">
<summary>
周期,单位为秒
</summary>
</member>
<member name="P:Performance.DtoModels.AppSettings.RateLimitingConfig.Limit">
<summary>
请求次数
</summary>
</member>
<member name="P:Performance.DtoModels.AppSettings.WebapiUrl.ImportFile">
<summary>
上传文件地址
......@@ -1829,9 +1844,14 @@
绩效Id
</summary>
</member>
<member name="P:Performance.DtoModels.AccoungingRequest.HospitalId">
<summary>
绩效Id
</summary>
</member>
<member name="P:Performance.DtoModels.AccoungingRequest.Type">
<summary>
1 返回accounting列表 2 返回核算单元 3 返回核算单元类型
1 返回accounting列表 2 返回核算单元类型 3 返回核算单元
</summary>
</member>
<member name="P:Performance.DtoModels.AccoungingRequest.UnitType">
......@@ -2880,6 +2900,11 @@
医院其他绩效
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeResponse.HideOtherPerfor">
<summary>
不公示其他绩效
</summary>
</member>
<member name="P:Performance.DtoModels.ComputeResponse.NightWorkPerfor">
<summary>
夜班费
......@@ -3166,7 +3191,12 @@
</member>
<member name="P:Performance.DtoModels.DeptResponse.AprPerforAmount">
<summary>
其他绩效
医院其他绩效
</summary>
</member>
<member name="P:Performance.DtoModels.DeptResponse.HideAprOtherPerforAmount">
<summary>
不公示其他绩效
</summary>
</member>
<member name="P:Performance.DtoModels.DirectorResponse.TypeName">
......
......@@ -220,6 +220,9 @@
<member name="P:Performance.EntityModels.PerformanceDbContext.per_apr_amount">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.per_apr_amount_hide">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.per_budget_amount">
<summary> 预算管理金额 </summary>
</member>
......@@ -2331,6 +2334,11 @@
只读 0、否 1、是
</summary>
</member>
<member name="P:Performance.EntityModels.ex_module.CheckScriptId">
<summary>
</summary>
</member>
<member name="T:Performance.EntityModels.ex_result">
<summary>
......@@ -4306,6 +4314,11 @@
是否在抽取数据0 否、1 是、2 抽取成功、3 抽取失败
</summary>
</member>
<member name="P:Performance.EntityModels.per_allot.ExtractTime">
<summary>
数据抽取起始时间
</summary>
</member>
<member name="P:Performance.EntityModels.per_allot.Generate">
<summary>
1、人事科提交重新生成 2、生成成功 3、原始数据修改
......@@ -4361,11 +4374,6 @@
录入科室
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount.AccountingUnit">
<summary>
核算单元
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount.Status">
<summary>
状态 1 未提交 2 等待审核 3 审核通过 4 驳回
......@@ -4396,6 +4404,96 @@
备注
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount.IsVerify">
<summary>
0 未通过验证 1 通过验证
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount.VerifyMessage">
<summary>
验证失败描述
</summary>
</member>
<member name="T:Performance.EntityModels.per_apr_amount_hide">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.Id">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.AllotId">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.PersonnelNumber">
<summary>
人员工号
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.DoctorName">
<summary>
医生姓名
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.PerforType">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.Amount">
<summary>
金额
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.TypeInDepartment">
<summary>
录入科室
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.Status">
<summary>
状态 1 未提交 2 等待审核 3 审核通过 4 驳回
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.AuditTime">
<summary>
审核时间
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.AuditUser">
<summary>
审核人
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.CreateDate">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.CreateUser">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.Remark">
<summary>
备注
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.IsVerify">
<summary>
0 未通过验证 1 通过验证
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount_hide.VerifyMessage">
<summary>
验证失败描述
</summary>
</member>
<member name="T:Performance.EntityModels.per_budget_amount">
<summary>
预算管理金额
......@@ -4856,6 +4954,16 @@
</summary>
</member>
<member name="P:Performance.EntityModels.per_dept_dic.IsVerify">
<summary>
0 未通过验证 1 通过验证
</summary>
</member>
<member name="P:Performance.EntityModels.per_dept_dic.VerifyMessage">
<summary>
验证失败描述
</summary>
</member>
<member name="T:Performance.EntityModels.per_employee">
<summary>
绩效人员表
......@@ -4981,6 +5089,16 @@
</summary>
</member>
<member name="P:Performance.EntityModels.per_employee.IsVerify">
<summary>
0 未通过验证 1 通过验证
</summary>
</member>
<member name="P:Performance.EntityModels.per_employee.VerifyMessage">
<summary>
验证失败描述
</summary>
</member>
<member name="T:Performance.EntityModels.per_first">
<summary>
首次上传文件地址(当医院存在标准库时,首次上传用户提交固定格式的excel,开发人员配置SQL脚本)
......@@ -7306,5 +7424,40 @@
费用
</summary>
</member>
<member name="P:Performance.EntityModels.view_per_apr_amount.UnitType">
<summary>
核算单元组别
</summary>
</member>
<member name="P:Performance.EntityModels.view_per_apr_amount.AccountingUnit">
<summary>
核算单元
</summary>
</member>
<member name="P:Performance.EntityModels.view_per_total_amount.UnitType">
<summary>
核算单元组别
</summary>
</member>
<member name="P:Performance.EntityModels.view_per_total_amount.AccountingUnit">
<summary>
核算单元
</summary>
</member>
<member name="P:Performance.EntityModels.view_per_total_amount.PersonnelNumber">
<summary>
工号
</summary>
</member>
<member name="P:Performance.EntityModels.view_per_total_amount.Amount">
<summary>
医院其他绩效
</summary>
</member>
<member name="P:Performance.EntityModels.view_per_total_amount.Use">
<summary>
是否被使用 默认false
</summary>
</member>
</members>
</doc>
namespace Performance.DtoModels.AppSettings
{
public class RateLimitingConfig
{
/// <summary>
/// 路径
/// </summary>
public string[] Endpoints { get; set; }
/// <summary>
/// 周期,单位为秒
/// </summary>
public double Period { get; set; }
/// <summary>
/// 请求次数
/// </summary>
public int Limit { get; set; }
}
}
......@@ -8,7 +8,12 @@ public class AccoungingRequest
public int AllotId { get; set; }
/// <summary>
/// 1 返回accounting列表 2 返回核算单元 3 返回核算单元类型
/// 绩效Id
/// </summary>
public int HospitalId { get; set; }
/// <summary>
/// 1 返回accounting列表 2 返回核算单元类型 3 返回核算单元
/// </summary>
public int Type { get; set; }
......@@ -17,4 +22,13 @@ public class AccoungingRequest
/// </summary>
public string UnitType { get; set; }
}
public enum AccountTypeEnum
{
List = 1,
UnitType = 2,
AccountingUnit = 3
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class AllotIdRequest
{
public int AllotId { get; set; }
}
public class IdRequest
{
public int Id { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class PerEmployeeRquest
{
public string AccountingUnit { get; set; }
public string Department { get; set; }
public string DoctorName { get; set; }
public string PersonnelNumber { get; set; }
public string JobCategory { get; set; }
public string Duty { get; set; }
public string JobTitle { get; set; }
public string UnitType { get; set; }
public int? AttendanceDay { get; set; }
public decimal? ReservedRatio { get; set; }
public string Remark { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class PersonParamsRequest
{
public const int MaxPageSize = 50;
public int PageNumber { get; set; } = 1;
private int _pageSize = 10;
public int PageSize
{
get { return _pageSize; }
set
{
_pageSize = value > MaxPageSize ? MaxPageSize : value;
}
}
public string SearchQuery { get; set; }
}
}
......@@ -65,6 +65,11 @@ public ComputeResponse(string source, string accountingUnit, string employeeName
public Nullable<decimal> OthePerfor { get; set; }
/// <summary>
/// 不公示其他绩效
/// </summary>
public Nullable<decimal> HideOtherPerfor { get; set; }
/// <summary>
/// 夜班费
/// </summary>
public Nullable<decimal> NightWorkPerfor { get; set; }
......
......@@ -90,6 +90,9 @@ public class DetailModule
/// <summary> 结算值 </summary>
public decimal? ItemValue { get; set; }
public decimal? OtherPerfor { get; set; }
public decimal? Attendance { get; set; }
public decimal? PostCoefficient { get; set; }
}
public class DetailModuleExtend : DetailModule
......
......@@ -174,8 +174,12 @@ public class DeptResponse
public Nullable<decimal> AssessLaterManagementFee { get; set; }
/// <summary>
/// 其他绩效
/// 医院其他绩效
/// </summary>
public Nullable<decimal> AprPerforAmount { get; set; }
/// <summary>
/// 不公示其他绩效
/// </summary>
public Nullable<decimal> HideAprOtherPerforAmount { get; set; }
}
}
......@@ -18,11 +18,30 @@ public class DeptdicResponse
public Deptdic LogisticsAccounting { get; set; }
public Deptdic SpecialAccounting { get; set; }
public DateTime? CreateTime { get; set; }
public int IsVerify { get; set; }
}
public class Deptdic
{
public int Id { get; set; }
public string AccountingUnit { get; set; }
public int IsVerify { get; set; }
public string VerifyMessage { get; set; }
}
public class DeptdicHands
{
public int HospitalId { get; set; }
public string HISDeptName { get; set; }
public string Department { get; set; }
public string OutDoctorAccounting { get; set; }
public string OutNurseAccounting { get; set; }
public string OutTechnicAccounting { get; set; }
public string InpatDoctorAccounting { get; set; }
public string InpatNurseAccounting { get; set; }
public string InpatTechnicAccounting { get; set; }
public string LogisticsAccounting { get; set; }
public string SpecialAccounting { get; set; }
public DateTime? CreateTime { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class UserHandsResponse
{
public string RealName { get; set; }
public string Login { get; set; }
public string Password { get; set; }
public string Mobile { get; set; }
public string Mail { get; set; }
public string Department { get; set; }
public string RoleName { get; set; }
public string HosName { get; set; }
}
}
......@@ -13,5 +13,6 @@ public enum ResponseType
NotFound = 5,
ParameterError = 6,
Disable = 7,
TooManyRequests = 8,
}
}
using System;
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;
......@@ -11,4 +12,14 @@ public class SaveCollectData
public string[] ColHeaders { get; set; }
public string[][] Data { get; set; }
}
public class UserCollectData
{
public int HospitalId { get; set; }
public int? CreateUser { get; set; }
public string[] ColHeaders { get; set; }
public string[][] Data { get; set; }
}
}
......@@ -158,6 +158,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<per_allot> per_allot { get; set; }
/// <summary> </summary>
public virtual DbSet<per_apr_amount> per_apr_amount { get; set; }
/// <summary> </summary>
public virtual DbSet<per_apr_amount_hide> per_apr_amount_hide { get; set; }
/// <summary> 预算管理金额 </summary>
public virtual DbSet<per_budget_amount> per_budget_amount { get; set; }
/// <summary> 预算管理占比 </summary>
......
......@@ -55,5 +55,10 @@ public class ex_module
/// 只读 0、否 1、是
/// </summary>
public Nullable<int> ReadOnly { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> CheckScriptId { get; set; }
}
}
......@@ -80,7 +80,12 @@ public class per_allot
/// 是否在抽取数据0 否、1 是、2 抽取成功、3 抽取失败
/// </summary>
public Nullable<int> IsExtracting { get; set; }
/// <summary>
/// 数据抽取起始时间
/// </summary>
public Nullable<DateTime> ExtractTime { get; set; }
/// <summary>
/// 1、人事科提交重新生成 2、生成成功 3、原始数据修改
/// </summary>
......
......@@ -7,83 +7,93 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("per_apr_amount")]
public class per_apr_amount
public class per_apr_amount
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
public int Id { get; set; }
/// <summary>
///
/// </summary>
public int AllotId { get; set; }
/// <summary>
/// 人员工号
/// </summary>
public string PersonnelNumber { get; set; }
/// <summary>
/// 医生姓名
/// </summary>
public string DoctorName { get; set; }
/// <summary>
///
/// </summary>
public string PerforType { get; set; }
/// <summary>
/// 金额
/// </summary>
public Nullable<decimal> Amount { get; set; }
/// <summary>
/// 录入科室
/// </summary>
public string TypeInDepartment { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
///// <summary>
///// 核算单元
///// </summary>
//public string AccountingUnit { get; set; }
/// <summary>
/// 状态 1 未提交 2 等待审核 3 审核通过 4 驳回
/// </summary>
public Nullable<int> Status { get; set; }
/// <summary>
/// 审核时间
/// </summary>
public Nullable<DateTime> AuditTime { get; set; }
/// <summary>
/// 审核人
/// </summary>
public Nullable<int> AuditUser { get; set; }
/// <summary>
///
/// </summary>
public Nullable<DateTime> CreateDate { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> CreateUser { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 0 未通过验证 1 通过验证
/// </summary>
public int? IsVerify { get; set; }
/// <summary>
/// 验证失败描述
/// </summary>
public string VerifyMessage { get; set; }
}
}
//-----------------------------------------------------------------------
// <copyright file=" per_apr_amount_hide.cs">
// * FileName: .cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("per_apr_amount_hide")]
public class per_apr_amount_hide
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
/// <summary>
///
/// </summary>
public int AllotId { get; set; }
/// <summary>
/// 人员工号
/// </summary>
public string PersonnelNumber { get; set; }
/// <summary>
/// 医生姓名
/// </summary>
public string DoctorName { get; set; }
/// <summary>
///
/// </summary>
public string PerforType { get; set; }
/// <summary>
/// 金额
/// </summary>
public Nullable<decimal> Amount { get; set; }
/// <summary>
/// 录入科室
/// </summary>
public string TypeInDepartment { get; set; }
/// <summary>
/// 状态 1 未提交 2 等待审核 3 审核通过 4 驳回
/// </summary>
public Nullable<int> Status { get; set; }
/// <summary>
/// 审核时间
/// </summary>
public Nullable<DateTime> AuditTime { get; set; }
/// <summary>
/// 审核人
/// </summary>
public Nullable<int> AuditUser { get; set; }
/// <summary>
///
/// </summary>
public Nullable<DateTime> CreateDate { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> CreateUser { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 0 未通过验证 1 通过验证
/// </summary>
public int? IsVerify { get; set; }
/// <summary>
/// 验证失败描述
/// </summary>
public string VerifyMessage { get; set; }
}
}
......@@ -7,58 +7,68 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
namespace Performance.EntityModels
{
/// <summary>
/// 科室字典表
/// </summary>
[Table("per_dept_dic")]
public class per_dept_dic
public class per_dept_dic
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
public int Id { get; set; }
/// <summary>
/// his系统科室名称
/// </summary>
public string HISDeptName { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 核算单元类型
/// </summary>
public string UnitType { get; set; }
/// <summary>
/// 来源住院/门诊
/// </summary>
public string Source { get; set; }
/// <summary>
/// 医院Id
/// </summary>
public Nullable<int> HospitalId { get; set; }
/// <summary>
///
/// </summary>
public Nullable<DateTime> CreateTime { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> CreateUser { get; set; }
/// <summary>
/// 0 未通过验证 1 通过验证
/// </summary>
public int? IsVerify { get; set; }
/// <summary>
/// 验证失败描述
/// </summary>
public string VerifyMessage { get; set; }
}
}
......@@ -125,7 +125,7 @@ public class per_employee
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
///
/// </summary>
......@@ -135,5 +135,15 @@ public class per_employee
///
/// </summary>
public Nullable<int> CreateUser { get; set; }
/// <summary>
/// 0 未通过验证 1 通过验证
/// </summary>
public int? IsVerify { get; set; }
/// <summary>
/// 验证失败描述
/// </summary>
public string VerifyMessage { get; set; }
}
}
namespace Performance.EntityModels
{
public class view_per_apr_amount : per_apr_amount
{
/// <summary>
/// 核算单元组别
/// </summary>
public string UnitType { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
}
public class view_per_total_amount
{
public view_per_total_amount() { }
public view_per_total_amount(string unitType, string accountingUnit, string personnelNumber, decimal amount, bool use = false)
{
UnitType = unitType;
AccountingUnit = accountingUnit;
PersonnelNumber = personnelNumber;
Amount = amount;
Use = use;
}
/// <summary>
/// 核算单元组别
/// </summary>
public string UnitType { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 工号
/// </summary>
public string PersonnelNumber { get; set; }
/// <summary>
/// 医院其他绩效
/// </summary>
public decimal Amount { get; set; }
/// <summary>
/// 是否被使用 默认false
/// </summary>
public bool Use { get; set; }
}
}
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Performance.Infrastructure.Models
{
......
......@@ -219,11 +219,5 @@ union all
return flag;
}
}
public int VerifyAccountingAndUnittype(int allotId)
{
return Execute("call proc_verify_accoungingunit_unittype(@allotId);", new { allotId });
}
}
}
//-----------------------------------------------------------------------
// <copyright file=" per_apr_amount.cs">
// * FileName: per_apr_amount.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// per_apr_amount Repository
/// </summary>
public partial class PerforPerapramountRepository : PerforRepository<per_apr_amount>
{
public List<view_per_apr_amount> GetFullAmount(Expression<Func<per_apr_amount, bool>> predicate)
{
var amounts = GetEntities(predicate);
if (amounts == null || !amounts.Any())
return new List<view_per_apr_amount>();
var ids = amounts.Select(w => w.AllotId).Distinct().ToList();
var employees = this.context.Set<per_employee>()
.Where(w => w.AllotId.HasValue && ids.Contains(w.AllotId.Value))
.Select(w => new
{
UnitType = w.UnitType,
AccountingUnit = w.AccountingUnit,
AllotId = w.AllotId,
PersonnelNumber = w.PersonnelNumber,
});
var res = from outer in amounts
join inner in employees
on new { outer.AllotId, outer.PersonnelNumber } equals new { AllotId = inner.AllotId ?? 0, inner.PersonnelNumber } into temp
from tt in temp.DefaultIfEmpty()
select new view_per_apr_amount
{
Id = outer.Id,
AllotId = outer.AllotId,
PersonnelNumber = outer.PersonnelNumber,
DoctorName = outer.DoctorName,
PerforType = outer.PerforType,
Amount = outer.Amount,
AccountingUnit = tt?.AccountingUnit ?? "",
UnitType = tt?.UnitType ?? "",
TypeInDepartment = outer.TypeInDepartment,
Status = outer.Status,
AuditTime = outer.AuditTime,
AuditUser = outer.AuditUser,
CreateDate = outer.CreateDate,
CreateUser = outer.CreateUser,
Remark = outer.Remark,
IsVerify = outer.IsVerify,
VerifyMessage = outer.VerifyMessage,
};
return res.ToList() ?? new List<view_per_apr_amount>();
}
}
}
//-----------------------------------------------------------------------
// <copyright file=" per_apr_amount.cs">
// * FileName: per_apr_amount.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// per_apr_amount Repository
/// </summary>
public partial class PerforPerapramounthideRepository : PerforRepository<per_apr_amount_hide>
{
public List<view_per_apr_amount> GetFullAmount(Expression<Func<per_apr_amount_hide, bool>> predicate)
{
var amounts = GetEntities(predicate);
if (amounts == null || !amounts.Any())
return new List<view_per_apr_amount>();
var ids = amounts.Select(w => w.AllotId).Distinct().ToList();
var employees = this.context.Set<per_employee>()
.Where(w => w.AllotId.HasValue && ids.Contains(w.AllotId.Value))
.Select(w => new
{
UnitType = w.UnitType,
AccountingUnit = w.AccountingUnit,
AllotId = w.AllotId,
PersonnelNumber = w.PersonnelNumber,
});
var res = from outer in amounts
join inner in employees
on new { outer.AllotId, outer.PersonnelNumber } equals new { AllotId = inner.AllotId ?? 0, inner.PersonnelNumber } into temp
from tt in temp.DefaultIfEmpty()
select new view_per_apr_amount
{
Id = outer.Id,
AllotId = outer.AllotId,
PersonnelNumber = outer.PersonnelNumber,
DoctorName = outer.DoctorName,
PerforType = outer.PerforType,
Amount = outer.Amount,
AccountingUnit = tt?.AccountingUnit ?? "",
UnitType = tt?.UnitType ?? "",
TypeInDepartment = outer.TypeInDepartment,
Status = outer.Status,
AuditTime = outer.AuditTime,
AuditUser = outer.AuditUser,
CreateDate = outer.CreateDate,
CreateUser = outer.CreateUser,
Remark = outer.Remark,
IsVerify = outer.IsVerify,
VerifyMessage = outer.VerifyMessage,
};
return res.ToList() ?? new List<view_per_apr_amount>();
}
}
}
//-----------------------------------------------------------------------
// <copyright file=" per_employee.cs">
// * FileName: per_employee.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Linq;
using System.Linq.Expressions;
using Performance.EntityModels;
using Performance.Infrastructure.Models;
namespace Performance.Repository
{
/// <summary>
/// per_employee Repository
/// </summary>
public partial class PerforPeremployeeRepository : PerforRepository<per_employee>
{
public new PageList<per_employee> GetEntitiesForPaging(int pageNumber, int pageSize, Expression<Func<per_employee, bool>> exp)
{
IQueryable<per_employee> queryableAuthors = context.Set<per_employee>().Where(exp).OrderBy(w => w.IsVerify).ThenBy(t => t.Id);
return PageList<per_employee>.Create(queryableAuthors, pageNumber, pageSize);
}
}
}
......@@ -4,6 +4,8 @@
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using Performance.EntityModels;
namespace Performance.Repository
......@@ -13,7 +15,7 @@ namespace Performance.Repository
/// </summary>
public partial class PerforPerapramountRepository : PerforRepository<per_apr_amount>
{
public PerforPerapramountRepository(PerformanceDbContext context) : base(context)
public PerforPerapramountRepository(PerformanceDbContext context) : base(context)
{
}
}
......
//-----------------------------------------------------------------------
// <copyright file=" per_apr_amount.cs">
// * FileName: per_apr_amount.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// per_apr_amount Repository
/// </summary>
public partial class PerforPerapramounthideRepository : PerforRepository<per_apr_amount_hide>
{
public PerforPerapramounthideRepository(PerformanceDbContext context) : base(context)
{
}
}
}
......@@ -440,6 +440,8 @@ public void Generate(per_allot allot)
UpdateAllotStates(allot.ID, (int)AllotStates.GenerateAccomplish, EnumHelper.GetDescription(AllotStates.GenerateAccomplish), generate);
perforCofdirectorRepository.SupplementaryData(allot.ID);
// 验证科室核算单元、工号
AccoungtingVerify(allot.ID);
//logManageService.WriteMsg("正在生成报表数据", "正在生成报表数据", 1, allot.ID, "ReceiveMessage", true);
//var res = reportService.ImportData(allot);
......@@ -474,6 +476,15 @@ public void GenerateReport(per_allot allot)
}
/// <summary>
/// 验证科室核算单元、工号
/// </summary>
/// <param name="allot"></param>
public void AccoungtingVerify(int allotId)
{
reportService.ExecProc("call proc_verify_accoungingunit_unittype(@allotId);", new { allotId });
}
/// <summary>
/// 重新计算院领导绩效
/// </summary>
/// <param name="allotId"></param>
......
using Performance.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using Performance.Repository;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
namespace Performance.Services
{
public class AprAmountService : IAutoInjection
{
private readonly PerforPeremployeeRepository _peremployeeRepository;
private readonly PerforPerapramountRepository _perapramountRepository;
//namespace Performance.Services
//{
// public class AprAmountService : IAutoInjection
// {
// private readonly PerforPeremployeeRepository _peremployeeRepository;
// private readonly PerforPerapramountRepository _perapramountRepository;
public AprAmountService(
PerforPeremployeeRepository peremployeeRepository,
PerforPerapramountRepository perapramountRepository)
{
_peremployeeRepository = peremployeeRepository;
_perapramountRepository = perapramountRepository;
}
// public AprAmountService(
// PerforPeremployeeRepository peremployeeRepository,
// PerforPerapramountRepository perapramountRepository)
// {
// _peremployeeRepository = peremployeeRepository;
// _perapramountRepository = perapramountRepository;
// }
/// <summary>
/// 获取医院其他绩效 默认审核通过 status = 3
/// 科室及核算组别使用人员字典
/// </summary>
/// <param name="allotId"></param>
/// <param name="status"></param>
/// <returns></returns>
public List<AprAmount> GetAprAmount(int allotId, int status = 3)
{
var perapramounts = _perapramountRepository.GetEntities(t => t.AllotId == allotId && t.Status == status);
var employees = _peremployeeRepository.GetEntities(t => t.AllotId == allotId);
// /// <summary>
// /// 获取医院其他绩效 默认审核通过 status = 3
// /// 科室及核算组别使用人员字典
// /// </summary>
// /// <param name="allotId"></param>
// /// <param name="status"></param>
// /// <returns></returns>
// public List<AprAmount> GetAprAmount(int allotId, int status = 3)
// {
// var perapramounts = _perapramountRepository.GetEntities(t => t.AllotId == allotId && t.Status == status);
// var employees = _peremployeeRepository.GetEntities(t => t.AllotId == allotId);
var result = perapramounts.Join(employees, amt => amt.PersonnelNumber, epy => epy.PersonnelNumber,
(amt, epy) => new AprAmount
{
AccountingUnit = epy.AccountingUnit,
UnitType = epy.UnitType,
PersonnelNumber = amt.PersonnelNumber,
DoctorName = amt.DoctorName,
PerforType = amt.PerforType,
Amount = amt.Amount
});
return result?.ToList() ?? new List<AprAmount>();
}
}
// var result = perapramounts.Join(employees, amt => amt.PersonnelNumber, epy => epy.PersonnelNumber,
// (amt, epy) => new AprAmount
// {
// AccountingUnit = epy.AccountingUnit,
// UnitType = epy.UnitType,
// PersonnelNumber = amt.PersonnelNumber,
// DoctorName = amt.DoctorName,
// PerforType = amt.PerforType,
// Amount = amt.Amount
// });
// return result?.ToList() ?? new List<AprAmount>();
// }
// }
public class AprAmount
{
/// <summary>
/// 核算单元
/// </summary>
public string UnitType { get; set; }
// public class AprAmount
// {
// /// <summary>
// /// 核算单元
// /// </summary>
// public string UnitType { get; set; }
/// <summary>
/// 人员工号
/// </summary>
public string PersonnelNumber { get; set; }
// /// <summary>
// /// 人员工号
// /// </summary>
// public string PersonnelNumber { get; set; }
/// <summary>
/// 医生姓名
/// </summary>
public string DoctorName { get; set; }
// /// <summary>
// /// 医生姓名
// /// </summary>
// public string DoctorName { get; set; }
/// <summary>
///
/// </summary>
public string PerforType { get; set; }
// /// <summary>
// ///
// /// </summary>
// public string PerforType { get; set; }
/// <summary>
/// 金额
/// </summary>
public Nullable<decimal> Amount { get; set; }
// /// <summary>
// /// 金额
// /// </summary>
// public Nullable<decimal> Amount { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
}
}
// /// <summary>
// /// 核算单元
// /// </summary>
// public string AccountingUnit { get; set; }
// }
//}
......@@ -32,9 +32,11 @@ public class ComputeService : IAutoInjection
private readonly PerforHospitalRepository hospitalRepository;
private readonly PerforPerapramountRepository perapramountRepository;
private readonly PerforPeremployeeRepository perforPeremployeeRepository;
private readonly PerforPerapramounthideRepository _hideRepository;
private readonly PerforCofworkitemRepository cofworkitemRepository;
public ComputeService(PerforResaccountRepository perforResaccountRepository,
public ComputeService(
PerforResaccountRepository perforResaccountRepository,
PerforPersheetRepository perforPerSheetRepository,
PerforImdataRepository perforImDataRepository,
PerforImheaderRepository perforImheaderRepository,
......@@ -49,6 +51,7 @@ public class ComputeService : IAutoInjection
PerforHospitalRepository hospitalRepository,
PerforPerapramountRepository perapramountRepository,
PerforPeremployeeRepository perforPeremployeeRepository,
PerforPerapramounthideRepository hideRepository,
PerforCofworkitemRepository cofworkitemRepository)
{
this.perforResaccountRepository = perforResaccountRepository;
......@@ -66,6 +69,7 @@ public class ComputeService : IAutoInjection
this.hospitalRepository = hospitalRepository;
this.perapramountRepository = perapramountRepository;
this.perforPeremployeeRepository = perforPeremployeeRepository;
_hideRepository = hideRepository;
this.cofworkitemRepository = cofworkitemRepository;
}
......@@ -468,25 +472,7 @@ public List<DeptResponse> GetOfficePerformance(int allotId)
public List<DeptResponse> GetAdminPerformance(int allotId)
{
var result = new List<DeptResponse>();
var amounts = perapramountRepository.GetEntities(t => t.AllotId == allotId && t.Status == 3) ?? new List<per_apr_amount>();
var employees = perforPeremployeeRepository.GetEntities(t => t.AllotId == allotId) ?? new List<per_employee>();
// 获取各科室 医院其他绩效
var otherPerformances = amounts.Join(employees,
outer => new { outer.AccountingUnit, outer.PersonnelNumber },
inner => new { inner.AccountingUnit, inner.PersonnelNumber },
(outer, inner) => new
{
AccountingUnit = outer.AccountingUnit,
UnitType = inner.UnitType,
PersonnelNumber = inner.PersonnelNumber,
PersonnelName = outer.DoctorName,
Amount = outer.Amount
})?.GroupBy(t => new { t.AccountingUnit, t.UnitType }).Select(t => new
{
AccountingUnit = t.Key.AccountingUnit,
UnitType = t.Key.UnitType == "行政后勤" ? "行政工勤" : t.Key.UnitType,
Amount = t.Sum(s => s.Amount)
});
//var employees = perforPeremployeeRepository.GetEntities(t => t.AllotId == allotId) ?? new List<per_employee>();
var clinicalTypes = new UnitType[] { UnitType.医生组, UnitType.其他医生组, UnitType.医技组, UnitType.其他医技组, UnitType.护理组, UnitType.其他护理组, UnitType.特殊核算组 };
var clinicalTypesString = clinicalTypes.Select(w => w.ToString()).ToList();
......@@ -507,6 +493,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
}
});
#region 临床科室
// 临床科室
var accounts = perforResaccountRepository.GetEntities(t => t.AllotID == allotId && clinicalTypesInt.Contains(t.UnitType.Value)) ?? new List<res_account>();
var clinicalResult = accounts.Select(t => new DeptResponse
......@@ -531,6 +518,9 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
});
result.AddRange(clinicalResult);
#endregion
#region 特殊核算组科室
// 特殊核算组科室
var specialunits = _perforResspecialunitRepository.GetEntities(t => t.AllotID == allotId) ?? new List<res_specialunit>();
......@@ -555,7 +545,9 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
RealGiveFee = t.Max(w => w.RealGiveFee),
}).Distinct();
result.AddRange(specialResult);
#endregion
#region 需要二次分配的行政科室
// 需要二次分配的行政科室
var needSecond = perforResaccountRepository.GetEntities(t => t.AllotID == allotId && t.UnitType.Value == (int)UnitType.行政后勤 && t.NeedSecondAllot == "是") ?? new List<res_account>();
var needSecondResult = needSecond.Select(t => new DeptResponse
......@@ -580,7 +572,9 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
});
result.AddRange(needSecondResult);
#endregion
#region 不需要二次分配的行政科室
// 不需要二次分配的行政科室
var officeTypes = new List<string> { "行政工勤", "行政高层", "行政中层" };
var computes = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && officeTypes.Contains(t.AccountType) && t.NeedSecondAllot == "否") ?? new List<res_compute>();
......@@ -605,14 +599,98 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
RealGiveFee = t.Sum(w => w.RealGiveFee),
}); ;
result.AddRange(officeResult);
// 医院其他绩效、科主任护士长管理绩效、合并实发
#endregion
#region 医院其他绩效 && 不公示其他绩效
var otherPerformances = perapramountRepository
.GetFullAmount(t => t.AllotId == allotId && t.Status == 3)
?.GroupBy(t => new { t.AccountingUnit, t.UnitType })
.Select(t => new view_per_total_amount(t.Key.UnitType.Replace("行政后勤", "行政工勤"), t.Key.AccountingUnit, "", t.Sum(s => s.Amount) ?? 0))
.ToList();
var hideOtherPerformances = _hideRepository
.GetFullAmount(t => t.AllotId == allotId && t.Status == 3)
?.GroupBy(t => new { t.AccountingUnit, t.UnitType })
.Select(t => new view_per_total_amount(t.Key.UnitType.Replace("行政后勤", "行政工勤"), t.Key.AccountingUnit, "", t.Sum(s => s.Amount) ?? 0))
.ToList();
// 医院其他绩效 / 不公示其他绩效、科主任护士长管理绩效、合并实发
foreach (var item in result)
{
item.AprPerforAmount = otherPerformances?.Where(w => w.AccountingUnit == item.AccountingUnit && w.UnitType == item.UnitName)?.Sum(w => w.Amount) ?? 0;
item.AprPerforAmount = 0;
item.HideAprOtherPerforAmount = 0;
// 医院其他绩效
var other = otherPerformances?.FirstOrDefault(w => w.AccountingUnit == item.AccountingUnit && w.UnitType == item.UnitName);
if (other != null)
{
other.Use = true;
item.AprPerforAmount = other?.Amount ?? 0;
}
// 不公示其他绩效
var hideOther = hideOtherPerformances?.FirstOrDefault(w => w.AccountingUnit == item.AccountingUnit && w.UnitType == item.UnitName);
if (hideOther != null)
{
hideOther.Use = true;
item.HideAprOtherPerforAmount = hideOther?.Amount ?? 0;
}
item.AssessLaterManagementFee = item.AssessLaterManagementFee ?? 0;
item.RealGiveFee = (item.RealGiveFee ?? 0) + item.AssessLaterManagementFee + item.AprPerforAmount;
item.RealGiveFee = (item.RealGiveFee ?? 0) + item.AssessLaterManagementFee + item.AprPerforAmount + item.HideAprOtherPerforAmount;
}
// 医院其他绩效匹配不上补充
var otherResult = otherPerformances
?.Where(w => w.Use == false)
.Select(t => new DeptResponse
{
UnitName = "医院其他绩效",
AccountingUnit = t.AccountingUnit,
Department = t.AccountingUnit,
PerforFee = 0,
WorkloadFee = 0,
AssessBeforeOtherFee = 0,
PerforTotal = 0,
ScoringAverage = 1,
Extra = 0,
MedicineExtra = 0,
MaterialsExtra = 0,
AssessLaterOtherFee = 0,
AssessLaterPerforTotal = 0,
AdjustFactor = 1,
AdjustLaterOtherFee = 0,
AprPerforAmount = t.Amount,
HideAprOtherPerforAmount = 0,
RealGiveFee = t.Amount,
}); ;
result.AddRange(otherResult);
// 不公示其他绩效匹配不上补充
var hideOtherResult = hideOtherPerformances
?.Where(w => w.Use == false)
.Select(t => new DeptResponse
{
UnitName = "不公示其他绩效",
AccountingUnit = t.AccountingUnit,
Department = t.AccountingUnit,
PerforFee = 0,
WorkloadFee = 0,
AssessBeforeOtherFee = 0,
PerforTotal = 0,
ScoringAverage = 1,
Extra = 0,
MedicineExtra = 0,
MaterialsExtra = 0,
AssessLaterOtherFee = 0,
AssessLaterPerforTotal = 0,
AdjustFactor = 1,
AdjustLaterOtherFee = 0,
AprPerforAmount = 0,
HideAprOtherPerforAmount = t.Amount,
RealGiveFee = t.Amount,
}); ;
result.AddRange(hideOtherResult);
#endregion
var enumItems = EnumHelper.GetItems<AccountUnitType>();
result = result.OrderBy(t => enumItems.FirstOrDefault(e => e.Name == t.UnitName)?.Value)/*.ThenBy(t => t.AccountingUnit)*/.ToList();
return result;
......@@ -720,22 +798,72 @@ public DeptDetailResponse GetDepartmentDetail(int allotId, int accountId, int ty
/// <returns></returns>
public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowManage, bool isEmpDic = false)
{
// 获取一次次绩效结果
var list = GetAllotPerformance(allotId, hospitalId, isShowManage);
// 人员字典
var employees = perforPeremployeeRepository.GetEntities(w => w.AllotId == allotId);
//// 获取医院其他绩效汇总结果
//var fullAmounts = GetTotalAmount(allotId);
// 获取一次绩效结果
var one = GetAllotPerformance(allotId, hospitalId, isShowManage);
// 获取二次绩效结果
var seconds = GetSecondPerformance(allotId);
if (seconds != null)
list?.AddRange(seconds);
var two = GetSecondPerformance(allotId);
var response = new List<ComputeResponse>();
if (one != null)
response.AddRange(one);
if (two != null)
response.AddRange(two);
// 医院其他绩效汇总
var totalAmounts = perapramountRepository
.GetFullAmount(t => t.AllotId == allotId && t.Status == 3)
?.GroupBy(w => new { w.AccountingUnit, w.UnitType, w.PersonnelNumber })
.Select(w => new view_per_total_amount(w.Key.UnitType, w.Key.AccountingUnit, w.Key.PersonnelNumber, w.Sum(t => t.Amount) ?? 0))
?.ToList();
// 医院其他绩效汇总
var totalAmounts_hide = _hideRepository
.GetFullAmount(t => t.AllotId == allotId && t.Status == 3)
?.GroupBy(w => new { w.AccountingUnit, w.UnitType, w.PersonnelNumber })
.Select(w => new view_per_total_amount(w.Key.UnitType, w.Key.AccountingUnit, w.Key.PersonnelNumber, w.Sum(t => t.Amount) ?? 0))
?.ToList();
// 补充医院其他绩效
AddAprAmount(response, totalAmounts, totalAmounts_hide);
// 补充一次二次分配不存在,但医院其他绩效的人员信息
var notMatchs1 = totalAmounts
?.Where(w => w.Use == false)
.Select(other =>
{
per_employee employee = employees?.FirstOrDefault(t => t.UnitType == other.UnitType && t.AccountingUnit == other.AccountingUnit && t.PersonnelNumber == other.PersonnelNumber);
var bc = new ComputeResponse("医院其他绩效", other.AccountingUnit, employee?.DoctorName ?? "", other.PersonnelNumber, employee?.JobTitle ?? "");
bc.UnitType = other.UnitType;
bc.OthePerfor = other.Amount;
bc.RealGiveFee = other.Amount;
return bc;
});
if (notMatchs1 != null)
response.AddRange(notMatchs1);
// 补充医院其他绩效
var result = AddAprAmount(allotId, list);
// 补充一次二次分配不存在,但不公示其他绩效的人员信息
var notMatchs2 = totalAmounts_hide
?.Where(w => w.Use == false)
.Select(other =>
{
per_employee employee = employees?.FirstOrDefault(t => t.UnitType == other.UnitType && t.AccountingUnit == other.AccountingUnit && t.PersonnelNumber == other.PersonnelNumber);
var bc = new ComputeResponse("不公示其他绩效", other.AccountingUnit, employee?.DoctorName ?? "", other.PersonnelNumber, employee?.JobTitle ?? "");
bc.UnitType = other.UnitType;
bc.HideOtherPerfor = other.Amount;
bc.RealGiveFee = other.Amount;
return bc;
});
if (notMatchs2 != null)
response.AddRange(notMatchs2);
// 预留比例
if (result != null)
if (response != null)
{
var types = new string[] { UnitType.行政高层.ToString(), UnitType.行政中层.ToString(), UnitType.行政后勤.ToString(), "行政工勤" };
var empDic = perforPeremployeeRepository.GetEntities(w => w.AllotId == allotId);
foreach (var item in result)
foreach (var item in response)
{
// 二次分配默认 调节系数100%
var adjust = item.Source == "二次绩效" ? 1 : (item.Adjust ?? 1);
......@@ -754,28 +882,50 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
}
item.OthePerfor = Math.Round((item.OthePerfor ?? 0), 2, MidpointRounding.AwayFromZero);
item.HideOtherPerfor = Math.Round((item.HideOtherPerfor ?? 0), 2, MidpointRounding.AwayFromZero);
item.NightWorkPerfor = Math.Round((item.NightWorkPerfor ?? 0), 2, MidpointRounding.AwayFromZero);
item.ShouldGiveFee = Math.Round(real + (item.OthePerfor ?? 0) + (item.NightWorkPerfor ?? 0), 2, MidpointRounding.AwayFromZero);
item.ShouldGiveFee = Math.Round(real + (item.OthePerfor ?? 0) + (item.HideOtherPerfor ?? 0) + (item.NightWorkPerfor ?? 0), 2, MidpointRounding.AwayFromZero);
item.ReservedRatio = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.ReservedRatio ?? 0;
item.ReservedRatio = employees?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.ReservedRatio ?? 0;
item.ReservedRatioFee = Math.Round(real * (item.ReservedRatio ?? 0), 2, MidpointRounding.AwayFromZero);
item.RealGiveFee = Math.Round(item.ShouldGiveFee - (item.ReservedRatioFee ?? 0) ?? 0, 2, MidpointRounding.AwayFromZero);
item.BankCard = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.BankCard ?? "";
// 姓名始终按人员字典显示
item.EmployeeName = employees?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.DoctorName ?? "";
item.BankCard = employees?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.BankCard ?? "";
// 人员信息使用人员字典中数据
if (isEmpDic)
{
item.AccountingUnit = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.AccountingUnit ?? "";
item.UnitType = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.UnitType ?? "";
item.EmployeeName = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.DoctorName ?? "";
item.AccountingUnit = employees?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.AccountingUnit ?? "";
item.UnitType = employees?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.UnitType ?? "";
}
}
}
return result?.OrderByDescending(t => t.AccountingUnit).ToList();
response.RemoveAll(w => w.PerforSumFee == 0 && w.PerforManagementFee == 0 && w.ShouldGiveFee == 0 && w.OthePerfor == 0 && w.HideOtherPerfor == 0 && w.RealGiveFee == 0);
return response?.OrderByDescending(t => t.UnitType).ThenBy(t => t.AccountingUnit).ToList();
}
///// <summary>
///// 合并医院其他绩效、不公示其他绩效
///// </summary>
///// <param name="allotId"></param>
///// <returns></returns>
//private List<view_per_apr_amount> GetTotalAmount(int allotId)
//{
// var fullAmounts1 = perapramountRepository.GetFullAmount(t => t.AllotId == allotId && t.Status == 3) ?? new List<view_per_apr_amount>();
// var fullAmounts2 = _hideRepository.GetFullAmount(t => t.AllotId == allotId && t.Status == 3) ?? new List<view_per_apr_amount>();
// var fullAmounts = new List<view_per_apr_amount>();
// if (fullAmounts1 != null && fullAmounts1.Any())
// fullAmounts.AddRange(fullAmounts1);
// if (fullAmounts2 != null && fullAmounts2.Any())
// fullAmounts.AddRange(fullAmounts2);
// return fullAmounts;
//}
/// <summary>
/// 获取一次次绩效结果
/// </summary>
......@@ -849,143 +999,59 @@ private List<ComputeResponse> GetAllotPerformance(int allotId, int hospitalId, i
/// <returns></returns>
private List<ComputeResponse> GetSecondPerformance(int allotId)
{
List<ComputeResponse> responses = new List<ComputeResponse>();
var again = _perforAgcomputeRepository.GetEntities(t => t.AllotId == allotId);
if (again != null && again.Any())
if (again == null || !again.Any())
{
var disAgains = again.Select(w => new
{
w.AllotId,
w.SecondId,
w.UnitType,
w.Department,
w.WorkPost,
w.JobNumber,
w.PersonName,
w.PerforSumFee,
w.OthePerfor,
w.NightWorkPerfor,
w.RealGiveFee
}).Distinct();
var group = disAgains
.GroupBy(t => new { t.UnitType, t.Department, t.WorkPost, t.JobNumber, t.PersonName })
.Select(t =>
{
var comp = new ComputeResponse("二次绩效", t.Key.Department, t.Key.PersonName, t.Key.JobNumber, t.Key.WorkPost);
comp.UnitType = t.Key.UnitType;
comp.PerforSumFee = t.Sum(g => g.PerforSumFee);
comp.NightWorkPerfor = t.Sum(g => g.NightWorkPerfor);
return comp;
});
return group?.ToList();
return responses;
}
return null;
var disAgains = again
.Select(w => new { w.AllotId, w.SecondId, w.UnitType, w.Department, w.WorkPost, w.JobNumber, w.PersonName, w.PerforSumFee, w.OthePerfor, w.NightWorkPerfor, w.RealGiveFee })
.Distinct();
responses = disAgains
.GroupBy(t => new { t.UnitType, t.Department, t.WorkPost, t.JobNumber, t.PersonName })
.Select(t =>
{
var comp = new ComputeResponse("二次绩效", t.Key.Department, t.Key.PersonName, t.Key.JobNumber, t.Key.WorkPost);
comp.UnitType = t.Key.UnitType;
comp.PerforSumFee = t.Sum(g => g.PerforSumFee);
comp.NightWorkPerfor = t.Sum(g => g.NightWorkPerfor);
return comp;
})?.ToList();
return responses;
}
/// <summary>
/// 添加额外绩效金额(基础绩效、其他绩效等)
/// </summary>
/// <param name="allotId"></param>
/// <param name="computes"></param>
public List<ComputeResponse> AddAprAmount(int allotId, List<ComputeResponse> computes)
/// <param name="totalAmounts">医院其他绩效</param>
/// <param name="totalAmounts_hide">不公示其他绩效</param>
public void AddAprAmount(List<ComputeResponse> computes, List<view_per_total_amount> totalAmounts, List<view_per_total_amount> totalAmounts_hide)
{
if (computes == null || !computes.Any())
return computes;
var list = perapramountRepository.GetEntities(t => t.AllotId == allotId && t.Status == 3);
if (list == null || !list.Any())
return computes;
List<string> uses = new List<string>();
foreach (var item in computes.GroupBy(w => new { w.AccountingUnit, w.JobNumber }))
foreach (var item in computes?.Where(w => !string.IsNullOrEmpty(w.JobNumber)).GroupBy(w => new { w.UnitType, w.AccountingUnit, w.JobNumber }))
{
// 补充过一次就不在补充了
var emp = computes.Where(w => w.AccountingUnit == item.Key.AccountingUnit && w.JobNumber == item.Key.JobNumber).OrderByDescending(w => w.Source).FirstOrDefault();
var apramount = list.Where(t => t.AccountingUnit == emp.AccountingUnit && !string.IsNullOrEmpty(t.PersonnelNumber) && emp.JobNumber?.Trim() == t.PersonnelNumber?.Trim());
var apramount1 = totalAmounts?.FirstOrDefault(t => t.UnitType == item.Key.UnitType && t.AccountingUnit == item.Key.AccountingUnit && item.Key.JobNumber?.Trim() == t.PersonnelNumber?.Trim());
// 如果医院其他绩效 已经被使用,则不再多次带出,防止单个人多次出现造成金额叠加
var tag = $"{(emp.AccountingUnit ?? "")}-{(emp.JobNumber ?? "")}";
if (apramount != null && !uses.Contains(tag))
if (apramount1 != null)
{
emp.OthePerfor = apramount?.Sum(w => w.Amount) ?? 0;
uses.Add(tag);
item.First().OthePerfor = apramount1.Amount;
apramount1.Use = true;
}
var apramount2 = totalAmounts_hide?.FirstOrDefault(t => t.UnitType == item.Key.UnitType && t.AccountingUnit == item.Key.AccountingUnit && item.Key.JobNumber?.Trim() == t.PersonnelNumber?.Trim());
// 如果医院其他绩效 已经被使用,则不再多次带出,防止单个人多次出现造成金额叠加
if (apramount2 != null)
{
item.First().HideOtherPerfor = apramount2.Amount;
apramount2.Use = true;
}
//foreach (var emp in computes)
//{
// if (!emp.OthePerfor.HasValue || emp.OthePerfor == 0)
// {
// var apramount = list.Where(t => t.AccountingUnit == emp.AccountingUnit
// && !string.IsNullOrEmpty(t.PersonnelNumber) && emp.JobNumber?.Trim() == t.PersonnelNumber?.Trim());
// emp.OthePerfor = apramount?.Sum(w => w.Amount) ?? 0;
// }
//}
}
return computes;
}
///// <summary>
///// 返回绩效发放列表
///// 科主任护士长返回管理绩效
///// </summary>
///// <param name="allotId">绩效ID</param>
///// <returns></returns>
//public List<ComputeResponse> AllManageCompute(int allotId)
//{
// var list = new List<ComputeResponse>();
// var mTypes = new[] { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString(), AccountUnitType.行政中层.ToString(), AccountUnitType.行政高层.ToString() };
// var allot = _perforRescomputeRepository.GetEntities(t => t.AllotID == allotId && mTypes.Contains(t.AccountType))?.OrderByDescending(t => t.AccountingUnit);
// if (allot != null && allot.Any(t => t.AllotID == allotId))
// {
// var types = new List<string> { AccountUnitType.护士长.ToString(), AccountUnitType.科主任.ToString() };
// list = allot.Select(t => new ComputeResponse
// {
// Source = "一次绩效",
// AccountingUnit = t.AccountingUnit,
// EmployeeName = t.EmployeeName,
// JobNumber = t.JobNumber,
// JobTitle = t.JobTitle,
// RealGiveFee = types.Contains(t.AccountType) ? t.ShouldGiveFee : t.RealGiveFee
// }).ToList();
// }
// var again = _perforAgcomputeRepository.GetEntities(t => t.AllotId == allotId);
// if (again != null && again.Any())
// {
// var group = again.GroupBy(t => new { t.Department, t.WorkPost, t.JobNumber, t.PersonName })
// .Select(t => new
// {
// department = t.Key.Department,
// jobtitle = t.Key.WorkPost,
// jobnumber = t.Key.JobNumber,
// name = t.Key.PersonName,
// fee = t.Sum(g => g.RealGiveFee)
// });
// list.AddRange(group.Select(t => new ComputeResponse
// {
// Source = "二次绩效",
// AccountingUnit = t.department,
// JobNumber = t.jobnumber,
// JobTitle = t.jobtitle,
// EmployeeName = t.name,
// RealGiveFee = t.fee
// }).OrderByDescending(t => t.AccountingUnit));
// }
// var result = AddAprAmount(allotId, list);
// if (result != null)
// {
// var empDic = perforPeremployeeRepository.GetEntities(w => w.AllotId == allotId);
// foreach (var item in result)
// {
// var temp = item.RealGiveFee ?? 0;
// item.ReservedRatio = empDic?.FirstOrDefault(w => w.DoctorName == item.EmployeeName && w.PersonnelNumber == item.JobNumber)?.ReservedRatio ?? 0;
// item.ReservedRatioFee = temp * item.ReservedRatio;
// item.RealGiveFee = temp - item.ReservedRatioFee;
// }
// }
// return result;
//}
#endregion 绩效发放列表
public res_compute GetComputeSingle(int computeid)
......@@ -1374,12 +1440,6 @@ public DeptDataDetails DeptOfficeDetail(int accountId)
Detail = new List<DetailDtos>()
};
var sheetType = new List<int>
{
(int)SheetType.AccountExtra, (int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess,
(int)SheetType.AccountScoreAverage, (int)SheetType.AccountAdjustLaterOtherFee
};
var detail = new DetailDtos
{
ItemName = "后勤人员",
......@@ -1397,7 +1457,10 @@ public DeptDataDetails DeptOfficeDetail(int accountId)
{
JobNumber = item.JobNumber,
ItemName = item.EmployeeName,
ItemValue = Math.Round(item.PerforTotal ?? 0, 2)
ItemValue = Math.Round(item.PerforTotal ?? 0, 2),
OtherPerfor = item.OtherPerfor,
Attendance = item.Attendance,
PostCoefficient = item.PostCoefficient,
});
}
}
......@@ -1406,6 +1469,11 @@ public DeptDataDetails DeptOfficeDetail(int accountId)
if (basicData == null || !basicData.Any()) return deptDetails;
var sheetType = new List<int>
{
(int)SheetType.AccountExtra, (int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess,
(int)SheetType.AccountScoreAverage, (int)SheetType.AccountAdjustLaterOtherFee
};
int groupBasis = 0;
foreach (var stype in sheetType)
{
......@@ -1427,6 +1495,31 @@ public DeptDataDetails DeptOfficeDetail(int accountId)
}
}
}
// 特殊 6.11个人岗位系数
var postSheet = persheet.FirstOrDefault(t => t.SheetType == (int)SheetType.PersonPostCoefficient);
if (postSheet != null)
{
groupBasis++;
var postDatas = basicData?.Where(w => w.SheetID == postSheet.ID && w.AccountingUnit == account?.AccountingUnit);
foreach (var post in postDatas?.GroupBy(w => new { w.JobNumber }))
{
var amount = post.FirstOrDefault(w => w.IsTotal == 1)?.CellValue ?? 0;
var items = post.Where(w => w.SheetID == postSheet.ID && w.IsTotal != 1)?.Select(t => new DetailModule
{
ItemName = t.TypeName,
CellValue = t.CellValue,
Factor = t.FactorValue,
ItemValue = t.IsFactor == 1 ? (t.CellValue * (t.FactorValue ?? 0)) : t.CellValue,
}).ToList();
if (items != null && items.Count > 0)
{
var itemName = $"个人系数({post.Key.JobNumber} {post.FirstOrDefault()?.EmployeeName})";
var item = new DetailDtos { ItemName = itemName, IncomeType = 5, OriginalType = postSheet.SheetType ?? 0, Amount = amount, GroupBasis = groupBasis, Items = items };
deptDetails.Detail.Add(item);
}
}
}
// 展示额外处理,根据禅道057
deptDetails.Pandect.ScoringAverage = deptDetails.Detail?.FirstOrDefault(w => w.OriginalType == (int)SheetType.AccountScoreAverage)?.Amount ?? deptDetails.Pandect.ScoringAverage;
deptDetails.Pandect.Extra = deptDetails.Detail?.FirstOrDefault(w => w.OriginalType == (int)SheetType.AccountExtra)?.Amount ?? deptDetails.Pandect.Extra;
......@@ -1763,44 +1856,45 @@ public res_baiscnorm EditHospitalAvg(ComputerAvgRequest request)
}
}
public List<Dictionary<string, string>> GetOtherPerStats(List<per_apr_amount> employees)
{
var others = new List<Dictionary<string, string>>();
if (employees == null)
return others;
var perForType = employees.Where(c => c.Status == 3).Select(t => t.PerforType).Distinct();
var doctorNum = employees.Where(c => c.Status == 3).Select(t => t.PersonnelNumber).Distinct().ToList();
//public List<Dictionary<string, string>> GetOtherPerStats(List<per_apr_amount> employees)
//{
// var others = new List<Dictionary<string, string>>();
// if (employees == null)
// return others;
if (!doctorNum.Any())
return others;
// var perForType = employees.Where(c => c.Status == 3).Select(t => t.PerforType).Distinct();
// var doctorNum = employees.Where(c => c.Status == 3).Select(t => t.PersonnelNumber).Distinct().ToList();
foreach (var num in doctorNum)
{
var dicData = new Dictionary<string, string>();
var amount = employees.Find(t => t.PersonnelNumber == num);
if (amount == null)
continue;
dicData.Add("核算单元", amount?.AccountingUnit ?? "");
dicData.Add("工号", amount?.PersonnelNumber ?? "");
dicData.Add("人员姓名", amount?.DoctorName ?? "");
// if (!doctorNum.Any())
// return others;
foreach (var type in perForType)
{
var emp = employees.Where(t => t.PerforType == type && t.PersonnelNumber == num)?.ToList();
if (!emp.Any())
dicData.Add(type, "0");
else
dicData.Add(type, Math.Round(Convert.ToDecimal(emp?.Sum(c => c.Amount))).ToString());
}
// foreach (var num in doctorNum)
// {
// var dicData = new Dictionary<string, string>();
// var amount = employees.Find(t => t.PersonnelNumber == num);
// if (amount == null)
// continue;
// dicData.Add("核算单元", amount?.AccountingUnit ?? "");
// dicData.Add("工号", amount?.PersonnelNumber ?? "");
// dicData.Add("人员姓名", amount?.DoctorName ?? "");
// foreach (var type in perForType)
// {
// var emp = employees.Where(t => t.PerforType == type && t.PersonnelNumber == num)?.ToList();
// if (!emp.Any())
// dicData.Add(type, "0");
// else
// dicData.Add(type, Math.Round(Convert.ToDecimal(emp?.Sum(c => c.Amount))).ToString());
// }
var sum = employees.Where(c => c.PersonnelNumber == num)?.Sum(t => t.Amount);
dicData.Add("合计", Math.Round(Convert.ToDecimal(sum), 0).ToString());
others.Add(dicData);
}
// var sum = employees.Where(c => c.PersonnelNumber == num)?.Sum(t => t.Amount);
// dicData.Add("合计", Math.Round(Convert.ToDecimal(sum), 0).ToString());
// others.Add(dicData);
// }
return others;
}
// return others;
//}
private decimal GetDecimal(decimal? value, decimal _ = 0)
{
......
......@@ -11,6 +11,7 @@
using System.Text;
using Performance.EntityModels.Entity;
using Performance.Repository.Repository;
using System.Linq.Expressions;
namespace Performance.Services
{
......@@ -643,15 +644,19 @@ public bool AgainDelete(CofAgainRequest request)
/// <returns></returns>
public List<cof_accounting> GetAccountingList(AccoungingRequest request)
{
switch (request.Type)
Expression<Func<cof_accounting, bool>> exp = t => t.AllotId == request.AllotId;
if (request.AllotId == 0)
{
case 1: //返回accounting列表
case 3: //返回核算单元类型
default:
return cofaccountingRepository.GetEntities(t => t.AllotId == request.AllotId);
case 2: //返回核算单元
return cofaccountingRepository.GetEntities(t => t.AllotId == request.AllotId && t.UnitType == request.UnitType);
var allots = perforPerAllotRepository.GetEntities(t => t.HospitalId == request.HospitalId);
if (allots == null || !allots.Any())
throw new PerformanceException("请先配置科室信息");
exp = t => allots.Select(a => a.ID).Contains(t.AllotId);
}
if (request.Type == (int)AccountTypeEnum.AccountingUnit && !string.IsNullOrEmpty(request.UnitType))
exp = exp.And(t => t.UnitType == request.UnitType);
return cofaccountingRepository.GetEntities(exp) ?? new List<cof_accounting>();
}
/// <summary>
......@@ -706,17 +711,63 @@ public bool AccountingDelete(int accountingId)
return cofaccountingRepository.Remove(entity);
}
public HandsonTable GetBatchAccountingStructrue(int AllotId)
{
var result = new HandsonTable((int)SheetType.Unidentifiable, Accounting.Select(t => t.Value).ToArray(), Accounting.Select(t => new collect_permission
{
HeadName = t.Value,
Visible = 1
}).ToList());
/// <summary>
/// 删除数据
/// </summary>
/// <param name="accountingId"></param>
/// <returns></returns>
public void AccoungtingVerify(int allotId)
if (result.Columns != null && result.Columns.Any())
{
foreach (var column in result.Columns)
{
if (column.Data == "核算组别")
{
column.Type = "autocomplete";
column.Source = EnumHelper.GetItems<UnitType>().Select(w => w.Description.Replace("行政后勤", "行政工勤")).ToArray();
column.Strict = true;
}
}
}
return result;
}
public bool BatchSaveAccounting(int allotId, SaveCollectData request)
{
_directorRepository.VerifyAccountingAndUnittype(allotId);
var dicData = CreateDataRow(0, allotId, request, Accounting);
var getAccounts = cofaccountingRepository.GetEntities(t => t.AllotId == allotId);
var unitType = EnumHelper.GetItems<UnitType>().Select(w => w.Description.Replace("行政后勤", "行政工勤")).ToArray();
List<cof_accounting> accounts = new List<cof_accounting>();
foreach (var item in dicData)
{
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<cof_accounting>(json);
if (!unitType.Contains(data?.UnitType) && !string.IsNullOrEmpty(data?.UnitType)) return false;
if (getAccounts != null)
if (getAccounts.Any(t => t.AccountingUnit == data?.AccountingUnit && t.UnitType == data?.UnitType)) continue;
var any = accounts.Any(t => t.AccountingUnit == data?.AccountingUnit && t.UnitType == data?.UnitType);
if (!string.IsNullOrEmpty(data.AccountingUnit) && !string.IsNullOrEmpty(data.UnitType) && !any)
{
accounts.Add(data);
}
}
if (accounts.Any())
cofaccountingRepository.AddRange(accounts.ToArray());
return true;
}
public static Dictionary<string, string> Accounting { get; } = new Dictionary<string, string>
{
{nameof(cof_accounting.AccountingUnit), "核算单元"},
{nameof(cof_accounting.UnitType), "核算组别"},
};
#endregion
#region Copy
......@@ -908,37 +959,37 @@ public List<TitleValue> WorkHeader(int allotId)
return null;
}
/// <summary>
/// 人员绩效额外金额
/// </summary>
private void CopyAprData(int prevAllotId, int allotId)
{
if (prevAllotId == 0) return;
var list = perapramountRepository.GetEntities(t => new List<int> { prevAllotId, allotId }.Contains(t.AllotId));
if (list == null || !list.Any(t => t.AllotId == prevAllotId)) return;
///// <summary>
///// 人员绩效额外金额
///// </summary>
//private void CopyAprData(int prevAllotId, int allotId)
//{
// if (prevAllotId == 0) return;
// var list = perapramountRepository.GetEntities(t => new List<int> { prevAllotId, allotId }.Contains(t.AllotId));
// if (list == null || !list.Any(t => t.AllotId == prevAllotId)) return;
if (list.Any(t => t.AllotId == allotId))
{
var prevData = list.Where(t => t.AllotId == prevAllotId);
var existData = list.Where(t => t.AllotId == allotId);
if (existData != null && existData.Any())
list = prevData.Where(t => !existData.Select(w => w.PersonnelNumber).Contains(t.PersonnelNumber)).ToList();
}
if (list.Any())
{
var data = list.Select(t => new per_apr_amount
{
Status = 2,
AllotId = allotId,
PersonnelNumber = t.PersonnelNumber,
DoctorName = t.DoctorName,
PerforType = t.PerforType,
Amount = t.Amount,
CreateDate = DateTime.Now
});
perapramountRepository.AddRange(data.ToArray());
}
}
// if (list.Any(t => t.AllotId == allotId))
// {
// var prevData = list.Where(t => t.AllotId == prevAllotId);
// var existData = list.Where(t => t.AllotId == allotId);
// if (existData != null && existData.Any())
// list = prevData.Where(t => !existData.Select(w => w.PersonnelNumber).Contains(t.PersonnelNumber)).ToList();
// }
// if (list.Any())
// {
// var data = list.Select(t => new per_apr_amount
// {
// Status = 2,
// AllotId = allotId,
// PersonnelNumber = t.PersonnelNumber,
// DoctorName = t.DoctorName,
// PerforType = t.PerforType,
// Amount = t.Amount,
// CreateDate = DateTime.Now
// });
// perapramountRepository.AddRange(data.ToArray());
// }
//}
#region HRP人员科室
......
......@@ -31,9 +31,12 @@ public class EmployeeService : IAutoInjection
private PerforUserroleRepository userroleRepository;
private PerforPeremployeeRepository peremployeeRepository;
private PerforUserRepository userRepository;
private readonly PerforRoleRepository _roleRepository;
private readonly PerforPerapramounthideRepository _hideRepository;
private ILogger<EmployeeService> logger;
public EmployeeService(PerforImemployeeRepository perforImemployeeRepository,
public EmployeeService(
PerforImemployeeRepository perforImemployeeRepository,
PerforPersheetRepository perforPersheetRepository,
PerforImdataRepository perforImdataRepository,
PerforPerallotRepository perforPerallotRepository,
......@@ -45,6 +48,8 @@ public class EmployeeService : IAutoInjection
PerforUserroleRepository userroleRepository,
PerforPeremployeeRepository peremployeeRepository,
PerforUserRepository userRepository,
PerforRoleRepository roleRepository,
PerforPerapramounthideRepository hideRepository,
ILogger<EmployeeService> logger)
{
this.perforImemployeeRepository = perforImemployeeRepository;
......@@ -59,6 +64,8 @@ public class EmployeeService : IAutoInjection
this.userroleRepository = userroleRepository;
this.peremployeeRepository = peremployeeRepository;
this.userRepository = userRepository;
_roleRepository = roleRepository;
_hideRepository = hideRepository;
this.logger = logger;
}
......@@ -386,6 +393,13 @@ public bool Audit(int allotId)
return perforPerallotRepository.Update(allot);
}
#region 医院其他绩效
/// <summary>
/// 获取所有医院其他绩效
/// </summary>
/// <param name="allotId"></param>
/// <param name="userId"></param>
/// <returns></returns>
public List<per_apr_amount> GetAprList(int allotId, int userId)
{
var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
......@@ -397,39 +411,62 @@ public List<per_apr_amount> GetAprList(int allotId, int userId)
else
list = perapramountRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0 && t.CreateUser == userId);
if (list != null && list.Any())
list = list.OrderBy(t => t.DoctorName).ToList();
list = list.OrderBy(w => w.IsVerify).ThenBy(t => t.DoctorName).ToList();
return list;
}
public List<per_apr_amount> GetAprList(int allotId, string department)
/// <summary>
/// 医院其他绩效审核详情
/// </summary>
/// <param name="allotId"></param>
/// <param name="department"></param>
/// <returns></returns>
public List<view_per_apr_amount> GetAprList(int allotId, string department)
{
var list = perapramountRepository.GetEntities(t => t.AllotId == allotId && t.Amount.HasValue && t.Amount != 0 && (t.TypeInDepartment ?? "") == department);
var list = perapramountRepository.GetFullAmount(t => t.AllotId == allotId && t.Amount.HasValue && t.Amount != 0 && (t.TypeInDepartment ?? "") == department);
if (list != null && list.Any())
list = list.OrderBy(t => t.DoctorName).ToList();
return list;
}
/// <summary>
/// 新增医院其他绩效
/// </summary>
/// <param name="request"></param>
/// <param name="userId"></param>
/// <returns></returns>
public bool InsertApr(per_apr_amount request, int userId)
{
if (request == null)
return false;
//var data = perapramountRepository.GetEntity(t => t.PersonnelNumber == request.PersonnelNumber && t.AllotId == request.AllotId);
//if (data != null)
// throw new PerformanceException("人员工号已存在");
if (string.IsNullOrEmpty(request.PersonnelNumber))
throw new PerformanceException("文件中存在“工号”为空的数据");
if (string.IsNullOrEmpty(request.PerforType) && request.Amount != 0)
throw new PerformanceException("文件中存在“绩效类型”为空的数据");
request.TypeInDepartment = GetTypeInDepartment(userId);
request.Status = 2;
request.CreateDate = DateTime.Now;
request.CreateUser = userId;
return perapramountRepository.Add(request);
}
/// <summary>
/// 修改医院其他绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public bool UpdateApr(per_apr_amount request)
{
if (request == null)
return false;
if (string.IsNullOrEmpty(request.PersonnelNumber))
throw new PerformanceException("文件中存在“工号”为空的数据");
if (string.IsNullOrEmpty(request.PerforType) && request.Amount != 0)
throw new PerformanceException("文件中存在“绩效类型”为空的数据");
var data = perapramountRepository.GetEntity(t => t.Id == request.Id);
if (data == null)
throw new PerformanceException("修改数据无效");
......@@ -438,13 +475,16 @@ public bool UpdateApr(per_apr_amount request)
data.PersonnelNumber = request.PersonnelNumber;
data.DoctorName = request.DoctorName;
data.PerforType = request.PerforType;
data.TypeInDepartment = request.TypeInDepartment;
data.AccountingUnit = request.AccountingUnit;
//data.AccountingUnit = request.AccountingUnit;
data.Amount = request.Amount;
return perapramountRepository.Update(data);
}
/// <summary>
/// 删除医院其他绩效
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public bool DeleteApr(int id)
{
var data = perapramountRepository.GetEntity(t => t.Id == id);
......@@ -489,7 +529,12 @@ public bool ConfirmAudit(int userid, AprAmountAuditRequest request)
}
return true;
}
/// <summary>
/// 上传导入医院其他绩效
/// </summary>
/// <param name="allotid"></param>
/// <param name="path"></param>
/// <param name="userid"></param>
public void ImpoerAprEmployees(int allotid, string path, int userid)
{
var userrole = userroleRepository.GetEntity(t => t.UserID == userid);
......@@ -532,7 +577,7 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
Dictionary<string, int> dict = new Dictionary<string, int>
{
{ "录入科室", -1 },{ "核算单元", -1 },{ "人员工号", -1 }, { "姓名", -1 }, { "绩效类型", -1 }, { "金额", -1 },
{ "人员工号", -1 }, { "姓名", -1 }, { "绩效类型", -1 }, { "金额", -1 },
};
foreach (var key in dict.Keys.ToList())
......@@ -543,7 +588,7 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
var entities = new List<per_apr_amount>();
var createtime = DateTime.Now;
var typeIn = GetTypeInDepartment(userid);
for (int rowindex = 1; rowindex < sheet.LastRowNum + 1; rowindex++)
{
var row = sheet.GetRow(rowindex);
......@@ -556,8 +601,8 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
DoctorName = dict["姓名"] < 0 ? "" : row.GetCell(dict["姓名"]).GetValue(),
PerforType = dict["绩效类型"] < 0 ? "" : row.GetCell(dict["绩效类型"]).GetValue(),
Amount = dict["金额"] < 0 ? 0 : ConvertHelper.To<decimal>(row.GetCell(dict["金额"]).GetValue(), 0),
TypeInDepartment = dict["录入科室"] < 0 ? "" : row.GetCell(dict["录入科室"]).GetValue(),
AccountingUnit = dict["核算单元"] < 0 ? "" : row.GetCell(dict["核算单元"]).GetValue(),
TypeInDepartment = typeIn,
//AccountingUnit = dict["核算单元"] < 0 ? "" : row.GetCell(dict["核算单元"]).GetValue(),
AllotId = allotid,
CreateDate = createtime,
CreateUser = userid,
......@@ -572,14 +617,14 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
throw new PerformanceException("文件中存在“工号”为空的数据");
if (entities.Any(w => string.IsNullOrEmpty(w.PerforType) && w.Amount != 0))
throw new PerformanceException("文件中存在“绩效类型”为空的数据");
if (entities.Any(w => string.IsNullOrEmpty(w.TypeInDepartment) && w.Amount != 0))
throw new PerformanceException("文件中存在“录入科室”为空的数据");
var employees = peremployeeRepository.GetEntities(w => w.AllotId == allotid);
foreach (var item in entities.Where(w => !string.IsNullOrEmpty(w.PersonnelNumber)))
{
item.AccountingUnit = employees?.FirstOrDefault(w => w.PersonnelNumber == item.PersonnelNumber)?.AccountingUnit ?? "";
}
//if (entities.Any(w => string.IsNullOrEmpty(w.TypeInDepartment) && w.Amount != 0))
// throw new PerformanceException("文件中存在“录入科室”为空的数据");
//var employees = peremployeeRepository.GetEntities(w => w.AllotId == allotid);
//foreach (var item in entities.Where(w => !string.IsNullOrEmpty(w.PersonnelNumber)))
//{
// item.AccountingUnit = employees?.FirstOrDefault(w => w.PersonnelNumber == item.PersonnelNumber)?.AccountingUnit ?? "";
//}
perapramountRepository.AddRange(entities.ToArray());
}
}
......@@ -594,22 +639,80 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
}
/// <summary>
/// 获取绩效类型字典
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public List<TitleValue> GetPerforTypeDict(int allotId)
{
var defaultTypes = new List<string> { "基础绩效", "管理绩效" };
var aprAmountList = perapramountRepository.GetEntities(w => w.AllotId == allotId);
if (aprAmountList != null && aprAmountList.Any(w => !defaultTypes.Contains(w.PerforType)))
{
var savedTypes = aprAmountList.Where(w => !defaultTypes.Contains(w.PerforType)).Select(t => t.PerforType).Distinct().OrderBy(t => t).ToList();
defaultTypes.AddRange(savedTypes);
}
return defaultTypes.Select(t => new TitleValue
{
Title = t,
Value = t
}).ToList();
}
/// <summary>
/// 医院其他绩效统计
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public List<Dictionary<string, string>> GetOtherPerStats(int allotId)
{
var others = new List<Dictionary<string, string>>();
var aprAmountList = perapramountRepository.GetFullAmount(w => w.AllotId == allotId && w.Status == 3);
var perForType = aprAmountList.Select(t => t.PerforType).Distinct();
foreach (var num in aprAmountList.Select(t => t.PersonnelNumber).Distinct())
{
var dicData = new Dictionary<string, string>();
var amount = aprAmountList.FirstOrDefault(t => t.PersonnelNumber == num);
if (amount == null) continue;
dicData.Add("核算单元", amount?.AccountingUnit ?? "");
dicData.Add("工号", amount?.PersonnelNumber ?? "");
dicData.Add("人员姓名", amount?.DoctorName ?? "");
foreach (var type in perForType)
{
var emp = aprAmountList.Where(t => t.PerforType == type && t.PersonnelNumber == num);
dicData.Add(type, Math.Round(emp?.Sum(c => c.Amount) ?? 0, 2).ToString());
}
var sum = aprAmountList.Where(c => c.PersonnelNumber == num)?.Sum(t => t.Amount);
dicData.Add("合计", Math.Round(sum ?? 0, 2).ToString());
others.Add(dicData);
}
return others;
}
#endregion
/// <summary>
/// 根据人员工号获取人员信息
/// </summary>
/// <param name="allotId"></param>
/// <param name="jobNumber"></param>
/// <returns></returns>
public per_apr_amount GetEmployeeMessage(int allotId, string personnelNumber, int userId)
public view_per_apr_amount GetEmployeeMessage(int allotId, string personnelNumber, int userId)
{
if (string.IsNullOrEmpty(personnelNumber)) return new per_apr_amount();
if (string.IsNullOrEmpty(personnelNumber)) return new view_per_apr_amount();
var user = userRepository.GetEntity(w => w.ID == userId && w.IsDelete == 1);
if (user == null) throw new PerformanceException("操作用户不存在或用户信息错误!");
var employee = peremployeeRepository.GetEntity(w => w.AllotId == allotId && w.PersonnelNumber.Trim() == personnelNumber.Trim());
if (employee == null) return new per_apr_amount();
if (employee == null) return new view_per_apr_amount();
return new per_apr_amount
return new view_per_apr_amount
{
AllotId = allotId,
PersonnelNumber = employee.PersonnelNumber,
......@@ -620,25 +723,14 @@ public per_apr_amount GetEmployeeMessage(int allotId, string personnelNumber, in
}
/// <summary>
/// 获取绩效类型字典
/// 更加用户ID获取录入科室
/// </summary>
/// <param name="allotId"></param>
/// <param name="userId"></param>
/// <returns></returns>
public List<TitleValue> GetPerforTypeDict(int allotId)
public string GetTypeInDepartment(int userId)
{
var defaultTypes = new List<string> { "基础绩效", "管理绩效" };
var aprAmountList = perapramountRepository.GetEntities(w => w.AllotId == allotId);
if (aprAmountList != null && aprAmountList.Any(w => !defaultTypes.Contains(w.PerforType)))
{
var savedTypes = aprAmountList.Where(w => !defaultTypes.Contains(w.PerforType)).Select(t => t.PerforType).Distinct().OrderBy(t => t).ToList();
defaultTypes.AddRange(savedTypes);
}
return defaultTypes.Select(t => new TitleValue
{
Title = t,
Value = t
}).ToList();
var user = userRepository.GetEntity(t => t.ID == userId);
return user?.Login ?? "";
}
#region 科室考核
......@@ -690,5 +782,300 @@ public List<TitleValue> GetPerforTypeDict(int allotId)
}
#endregion
#region 不公示其他绩效
/// <summary>
/// 获取所有医院其他绩效
/// </summary>
/// <param name="allotId"></param>
/// <param name="userId"></param>
/// <returns></returns>
public List<per_apr_amount_hide> GetAprHideList(int allotId, int userId)
{
var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
if (userrole == null) throw new PerformanceException("用户未绑定角色");
var list = new List<per_apr_amount_hide>();
if (new int[] { 1, 2, 5, 6 }.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办、院领导查看所有科室的数据
list = _hideRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0);
else
list = _hideRepository.GetEntities(t => t.AllotId == allotId && (t.Amount ?? 0) != 0 && t.CreateUser == userId);
if (list != null && list.Any())
list = list.OrderBy(w => w.IsVerify).ThenBy(t => t.DoctorName).ToList();
return list;
}
/// <summary>
/// 医院其他绩效审核详情
/// </summary>
/// <param name="allotId"></param>
/// <param name="department"></param>
/// <returns></returns>
public List<view_per_apr_amount> GetAprHideList(int allotId, string department)
{
var list = _hideRepository.GetFullAmount(t => t.AllotId == allotId && t.Amount.HasValue && t.Amount != 0 && (t.TypeInDepartment ?? "") == department);
if (list != null && list.Any())
list = list.OrderBy(t => t.DoctorName).ToList();
return list;
}
/// <summary>
/// 新增医院其他绩效
/// </summary>
/// <param name="request"></param>
/// <param name="userId"></param>
/// <returns></returns>
public bool InsertAprHide(per_apr_amount_hide request, int userId)
{
if (request == null)
return false;
if (string.IsNullOrEmpty(request.PersonnelNumber))
throw new PerformanceException("文件中存在“工号”为空的数据");
if (string.IsNullOrEmpty(request.PerforType) && request.Amount != 0)
throw new PerformanceException("文件中存在“绩效类型”为空的数据");
request.TypeInDepartment = GetTypeInDepartment(userId);
request.Status = 2;
request.CreateDate = DateTime.Now;
request.CreateUser = userId;
return _hideRepository.Add(request);
}
/// <summary>
/// 修改医院其他绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public bool UpdateAprHide(per_apr_amount_hide request)
{
if (request == null)
return false;
if (string.IsNullOrEmpty(request.PersonnelNumber))
throw new PerformanceException("文件中存在“工号”为空的数据");
if (string.IsNullOrEmpty(request.PerforType) && request.Amount != 0)
throw new PerformanceException("文件中存在“绩效类型”为空的数据");
var data = _hideRepository.GetEntity(t => t.Id == request.Id);
if (data == null)
throw new PerformanceException("修改数据无效");
data.Status = 2;
data.PersonnelNumber = request.PersonnelNumber;
data.DoctorName = request.DoctorName;
data.PerforType = request.PerforType;
//data.AccountingUnit = request.AccountingUnit;
data.Amount = request.Amount;
return _hideRepository.Update(data);
}
/// <summary>
/// 删除医院其他绩效
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public bool DeleteAprHide(int id)
{
var data = _hideRepository.GetEntity(t => t.Id == id);
if (data != null)
return _hideRepository.Remove(data);
return true;
}
/// <summary>
/// 审核医院其他绩效
/// </summary>
/// <param name="userid"></param>
/// <param name="request"></param>
/// <returns></returns>
public bool ConfirmAuditHide(int userid, AprAmountAuditRequest request)
{
if (request?.Members == null)
throw new PerformanceException("审核信息无效,请确认");
foreach (var item in request.Members)
{
if (string.IsNullOrEmpty(item.DoctorName) && string.IsNullOrEmpty(item.PersonnelNumber))
throw new PerformanceException("审核信息无效,请确认");
}
var allApramounts = _hideRepository.GetEntities(t => t.AllotId == request.AllotId);
foreach (var member in request.Members)
{
var apramounts = allApramounts?.Where(t => (t.DoctorName ?? "") == member.DoctorName && (t.PersonnelNumber ?? "") == member.PersonnelNumber);
if (apramounts == null)
throw new PerformanceException("审核信息无效,请确认");
foreach (var item in apramounts)
{
item.Status = (request.IsPass == 1) ? 3 : 4;
item.AuditUser = userid;
item.AuditTime = DateTime.Now;
item.Remark = request.Remark;
_hideRepository.UpdateRange(apramounts.ToArray());
}
}
return true;
}
/// <summary>
/// 上传导入医院其他绩效
/// </summary>
/// <param name="allotid"></param>
/// <param name="path"></param>
/// <param name="userid"></param>
public void ImpoerAprHideEmployees(int allotid, string path, int userid)
{
var userrole = userroleRepository.GetEntity(t => t.UserID == userid);
if (userrole == null) throw new PerformanceException("用户未绑定角色");
var data = new List<per_apr_amount_hide>();
if (new int[] { 1, 2, 5 }.Contains(userrole.RoleID)) // 绩效管理员、医院管理员、绩效核算办查看所有科室的数据
data = _hideRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0);
else
data = _hideRepository.GetEntities(t => t.AllotId == allotid && (t.Amount ?? 0) != 0 && t.CreateUser == userid);
if (data != null && data.Any())
_hideRepository.RemoveRange(data.ToArray());
try
{
IWorkbook workbook = null;
var version = FileHelper.GetExtension(path) == ".xlsx" ? ExcelVersion.xlsx : ExcelVersion.xls;
using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate))
{
workbook = (version == ExcelVersion.xlsx)
? (IWorkbook)(new XSSFWorkbook(fs))
: (IWorkbook)(new HSSFWorkbook(fs));
}
if (workbook == null) return;
var sheet = workbook.GetSheetAt(0);
var firstRow = sheet.GetRow(0);
Dictionary<int, string> excelheader = new Dictionary<int, string>();
for (int cellindex = 0; cellindex < firstRow.LastCellNum + 1; cellindex++)
{
var value = firstRow.GetCell(cellindex).GetValue();
if (!string.IsNullOrEmpty(value) && !excelheader.ContainsKey(cellindex))
excelheader.Add(cellindex, value);
}
if (excelheader == null || excelheader.Count == 0)
throw new PerformanceException("上传excel内容错误");
Dictionary<string, int> dict = new Dictionary<string, int>
{
{ "人员工号", -1 }, { "姓名", -1 }, { "绩效类型", -1 }, { "金额", -1 },
};
foreach (var key in dict.Keys.ToList())
{
if (excelheader.Any(w => w.Value == key))
dict[key] = excelheader.First(w => w.Value == key).Key;
}
var entities = new List<per_apr_amount_hide>();
var createtime = DateTime.Now;
var typeIn = GetTypeInDepartment(userid);
for (int rowindex = 1; rowindex < sheet.LastRowNum + 1; rowindex++)
{
var row = sheet.GetRow(rowindex);
if (row == null) continue;
var entity = new per_apr_amount_hide
{
Status = 2,
PersonnelNumber = dict["人员工号"] < 0 ? "" : row.GetCell(dict["人员工号"]).GetValue(),
DoctorName = dict["姓名"] < 0 ? "" : row.GetCell(dict["姓名"]).GetValue(),
PerforType = dict["绩效类型"] < 0 ? "" : row.GetCell(dict["绩效类型"]).GetValue(),
Amount = dict["金额"] < 0 ? 0 : ConvertHelper.To<decimal>(row.GetCell(dict["金额"]).GetValue(), 0),
TypeInDepartment = typeIn,
AllotId = allotid,
CreateDate = createtime,
CreateUser = userid,
};
entities.Add(entity);
}
// 补充核算单元
if (entities.Any())
{
if (entities.Any(w => string.IsNullOrEmpty(w.PersonnelNumber) && w.Amount != 0))
throw new PerformanceException("文件中存在“工号”为空的数据");
if (entities.Any(w => string.IsNullOrEmpty(w.PerforType) && w.Amount != 0))
throw new PerformanceException("文件中存在“绩效类型”为空的数据");
_hideRepository.AddRange(entities.ToArray());
}
}
catch (PerformanceException ex)
{
throw ex;
}
catch (Exception ex)
{
logger.LogError(ex.ToString());
}
}
/// <summary>
/// 获取绩效类型字典
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public List<TitleValue> GetPerforTypeDictHide(int allotId)
{
var defaultTypes = new List<string> { "基础绩效", "管理绩效" };
var aprAmountList = _hideRepository.GetEntities(w => w.AllotId == allotId);
if (aprAmountList != null && aprAmountList.Any(w => !defaultTypes.Contains(w.PerforType)))
{
var savedTypes = aprAmountList.Where(w => !defaultTypes.Contains(w.PerforType)).Select(t => t.PerforType).Distinct().OrderBy(t => t).ToList();
defaultTypes.AddRange(savedTypes);
}
return defaultTypes.Select(t => new TitleValue
{
Title = t,
Value = t
}).ToList();
}
/// <summary>
/// 医院其他绩效统计
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public List<Dictionary<string, string>> GetOtherPerStatsHide(int allotId)
{
var others = new List<Dictionary<string, string>>();
var aprAmountList = _hideRepository.GetFullAmount(w => w.AllotId == allotId && w.Status == 3);
var perForType = aprAmountList.Select(t => t.PerforType).Distinct();
foreach (var num in aprAmountList.Select(t => t.PersonnelNumber).Distinct())
{
var dicData = new Dictionary<string, string>();
var amount = aprAmountList.FirstOrDefault(t => t.PersonnelNumber == num);
if (amount == null) continue;
dicData.Add("核算单元", amount?.AccountingUnit ?? "");
dicData.Add("工号", amount?.PersonnelNumber ?? "");
dicData.Add("人员姓名", amount?.DoctorName ?? "");
foreach (var type in perForType)
{
var emp = aprAmountList.Where(t => t.PerforType == type && t.PersonnelNumber == num);
dicData.Add(type, Math.Round(emp?.Sum(c => c.Amount) ?? 0, 2).ToString());
}
var sum = aprAmountList.Where(c => c.PersonnelNumber == num)?.Sum(t => t.Amount);
dicData.Add("合计", Math.Round(sum ?? 0, 2).ToString());
others.Add(dicData);
}
return others;
}
#endregion
}
}
......@@ -31,6 +31,8 @@ public class ExConfigService : IAutoInjection
private readonly PerforModdicRepository moddicRepository;
private readonly QueryService queryService;
private readonly ILogger logger;
private readonly PerforCofdrugtypeRepository cofdrugtypeRepository;
private readonly PerforPerdeptdicRepository perdeptdicRepository;
public ExConfigService(PerforExtypeRepository extypeRepository,
PerforExscriptRepository exscriptRepository,
......@@ -45,7 +47,9 @@ public class ExConfigService : IAutoInjection
PerforExtractRepository extractRepository,
PerforModdicRepository moddicRepository,
QueryService queryService,
ILogger<ExConfigService> logger
ILogger<ExConfigService> logger,
PerforCofdrugtypeRepository cofdrugtypeRepository,
PerforPerdeptdicRepository perdeptdicRepository
)
{
this.extypeRepository = extypeRepository;
......@@ -62,6 +66,8 @@ ILogger<ExConfigService> logger
this.moddicRepository = moddicRepository;
this.queryService = queryService;
this.logger = logger;
this.cofdrugtypeRepository = cofdrugtypeRepository;
this.perdeptdicRepository = perdeptdicRepository;
}
#region Modules
......@@ -689,6 +695,8 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
public Dictionary<string, object> CheckHasNewDepartmentOrCategory(int allotId)
{
#region 改正
/*
var allot = perallotRepository.GetEntity(t => t.ID == allotId);
var allotList = perallotRepository.GetEntities(t => t.HospitalId == allot.HospitalId && new int[] { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive }.Contains(t.States));
......@@ -734,8 +742,99 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
if (noExistedTypename != null && noExistedTypename.Any())
stringBuilder.AppendLine($"新增费用类型:{string.Join(",", noExistedTypename)}");
paramtemers.Add(dic.Remark, stringBuilder.ToString());
paramtemers.Add(dic.Remark, stringBuilder.ToString());
}
return paramtemers; */
#endregion
var allot = perallotRepository.GetEntity(t => t.ID == allotId);
var drugTypes = cofdrugtypeRepository.GetEntities(t => t.AllotID == allot.ID && t.HospitalId == allot.HospitalId);
var deptDic = perdeptdicRepository.GetEntities(t => t.HospitalId == allot.HospitalId);
var moduleSheet = exmoduleRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.SheetType == (int)SheetType.Income);
if (moduleSheet == null || !moduleSheet.Any()) return null;
var moduleScript = moduleSheet.Select(t => t.CheckScriptId);
var scripts = exscriptRepository.GetEntities(t => moduleScript.Contains(t.Id));
if (scripts == null || !scripts.Any()) return null;
var scriptConfig = scripts.Select(t => t.ConfigId);
var hosConfig = hospitalconfigRepository.GetEntities(t => scriptConfig.Contains(t.Id));
if (hosConfig == null) return null;
Dictionary<string, object> paramtemers = new Dictionary<string, object>();
StringBuilder stringBuilder = new StringBuilder();
List<string> deparmants = new List<string>();
List<string> drugs = new List<string>();
List<per_dept_dic> deptList = new List<per_dept_dic>();
List<cof_drugtype> drugTypeList = new List<cof_drugtype>();
string defaultSource = "住院", defauleUnittype = UnitType.医生组.ToString();
foreach (var scr in scripts)
{
var conf = hosConfig.FirstOrDefault(t => t.Id == scr.ConfigId);
if (conf == null)
continue;
var data = queryService.QueryData(conf, allot, scr.ExecScript);
if (data == null || !data.Any()) continue;
foreach (var module in moduleSheet.Where(t => t.CheckScriptId == scr.Id))
{
var noExistedDepartment = data.Select(t => t.Department).Distinct().ToList();
var source = module.ModuleName.Contains(defaultSource) ? "住院" : "门诊";
if (deptDic != null && deptDic.Any(t => t.Source == source))
{
var deptDics = deptDic.Where(t => t.Source == source).Select(t => t.HISDeptName);
noExistedDepartment = data.Select(t => t.Department).Except(deptDics).Distinct().ToList();
}
if (noExistedDepartment != null && noExistedDepartment.Any()) // 系统科室、标准科室唯一,门诊、住院核算单元可能不一致,因此数据可重复
{
var dept = noExistedDepartment.Select(t => new per_dept_dic
{
HISDeptName = t,
UnitType = defauleUnittype,
Source = source,
HospitalId = allot.HospitalId,
IsVerify = 0,
VerifyMessage = "抽取前科室校验后补增科室",
CreateUser = 1
}).ToList();
deparmants.AddRange(noExistedDepartment.Where(t => !deparmants.Contains(t)));
deptList.AddRange(dept);
}
}
var typeNames = drugTypes.Select(t => t.Charge).Distinct();
var noExistedTypename = data.Select(t => t.Category).Distinct().Except(typeNames);
if (noExistedTypename != null && noExistedTypename.Any(t => !drugs.Contains(t)))
{
var drugType = noExistedTypename.Where(t => !drugs.Contains(t)).Select(t => new cof_drugtype
{
HospitalId = allot.HospitalId,
AllotID = allot.ID,
Charge = t
}).ToList();
drugs.AddRange(noExistedTypename.Where(t => !drugs.Contains(t)));
drugTypeList.AddRange(drugType);
}
}
if (deparmants != null && deparmants.Any())
{
var distinctedDept = deptList.ToDistinct().ToList();
distinctedDept.ForEach(t => t.CreateTime = DateTime.Now); //在去重前添加时间,可能造成时间不一致,无法去重
perdeptdicRepository.AddRange(distinctedDept.ToArray());
stringBuilder.AppendLine($"新增科室:{string.Join(",", deparmants.Distinct())}");
}
if (drugs != null && drugs.Any())
{
cofdrugtypeRepository.AddRange(drugTypeList.ToDistinct().ToArray());
stringBuilder.AppendLine($"新增费用类型:{string.Join(",", drugs.Distinct())}");
}
paramtemers.Add("新增科室或费用类型", stringBuilder.ToString());
return paramtemers;
}
......
using AutoMapper;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using Performance.DtoModels;
using Performance.DtoModels.AppSettings;
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Infrastructure.Models;
using Performance.Repository;
using Performance.Services.ExtractExcelService;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Text.RegularExpressions;
namespace Performance.Services
{
......@@ -26,6 +33,7 @@ public class PersonService : IAutoInjection
private readonly PerforRoleRepository perforRoleRepository;
private readonly PerforAgsecondallotRepository agsecondallotRepository;
private readonly Application application;
private readonly IHostingEnvironment evn;
private readonly Dictionary<string, (string, string)> dict = new Dictionary<string, (string, string)>
{
......@@ -47,7 +55,9 @@ public class PersonService : IAutoInjection
PerforUserroleRepository perforUserroleRepository,
PerforRoleRepository perforRoleRepository,
PerforAgsecondallotRepository agsecondallotRepository,
IOptions<Application> application)
IOptions<Application> application,
IHostingEnvironment evn
)
{
this.logger = logger;
this.perdeptdicRepository = perdeptdicRepository;
......@@ -58,6 +68,7 @@ public class PersonService : IAutoInjection
this.perforRoleRepository = perforRoleRepository;
this.agsecondallotRepository = agsecondallotRepository;
this.application = application.Value;
this.evn = evn;
}
/// <summary>
......@@ -176,12 +187,36 @@ public List<per_employee> GetPersons(int allotId, int userId)
var list = peremployeeRepository.GetEntities(exp);
if (list != null && list.Any())
return list.OrderBy(t => t.Id).ToList();
return list.OrderBy(w => w.IsVerify).ThenBy(t => t.Id).ToList();
return new List<per_employee>();
}
/// <summary>
/// 获取所有员工记录分页
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public PageList<per_employee> GetPersons(int allotId, int userId, PersonParamsRequest request)
{
var (dept, unittype) = GetDeptByUser(userId);
Expression<Func<per_employee, bool>> exp = t => t.AllotId == allotId;
if (!string.IsNullOrEmpty(dept) && unittype.Any())
{
exp = exp.And(t => t.AccountingUnit == dept && unittype.Contains(t.UnitType));
}
if (request != null && !string.IsNullOrEmpty(request.SearchQuery))
{
exp = exp.And(t => true && (t.AccountingUnit.Contains(request.SearchQuery) || t.DoctorName.Contains(request.SearchQuery) || t.Department.Contains(request.SearchQuery)));
}
var result = new List<per_employee>();
return peremployeeRepository.GetEntitiesForPaging(request.PageNumber, request.PageSize, exp);
}
/// <summary>
/// 新增员工信息
/// </summary>
/// <param name="request"></param>
......@@ -204,6 +239,7 @@ public per_employee CreatePerson(PerEmployeeResponse request)
int day = DateTime.DaysInMonth(allot.Year, allot.Month);
entity.Attendance = request.AttendanceDay / day;
entity.CreateTime = DateTime.Now;
entity.IsVerify = 0;
//CheckAccountingDept(request.HospitalId.Value, request.AccountingUnit, request.Department);
peremployeeRepository.Add(entity);
......@@ -320,10 +356,11 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId)
InpatTechnicAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.医技组.ToString() && group.Source == "住院")),
LogisticsAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.行政后勤.ToString())),
SpecialAccounting = GetDeptdic(t.FirstOrDefault(group => group.Department == t.Key.Department && group.HISDeptName == t.Key.HISDeptName && group.UnitType == UnitType.特殊核算组.ToString())),
CreateTime = t.Max(group => group.CreateTime)
CreateTime = t.Max(group => group.CreateTime),
IsVerify = t.Min(w => w.IsVerify) ?? 1,
});
return result.OrderByDescending(t => t.CreateTime).ThenBy(t => t.Department);
return result.OrderBy(w => w.IsVerify).ThenByDescending(t => t.CreateTime).ThenBy(t => t.Department);
}
private (string dept, string[] unittype) GetDeptByUser(int userId)
......@@ -354,12 +391,14 @@ public IEnumerable<DeptdicResponse> GetDepartments(int hospitalId)
private Deptdic GetDeptdic(per_dept_dic dic)
{
if (dic == null) return new Deptdic();
if (dic == null) return new Deptdic() { IsVerify = 1 };
return new Deptdic
{
Id = dic.Id,
AccountingUnit = dic.AccountingUnit
AccountingUnit = dic.AccountingUnit,
IsVerify = dic.IsVerify ?? 1,
VerifyMessage = dic.VerifyMessage,
};
}
......@@ -462,8 +501,10 @@ public bool UpdateDeptDic(DeptdicResponse request)
/// <returns></returns>
public bool DeleteDeptDic(DeptdicResponse request)
{
var deptdics = perdeptdicRepository.GetEntities(t => (t.HISDeptName ?? "") == request.HISDeptName
&& (t.Department ?? "") == request.Department && t.HospitalId == request.HospitalId);
if (request == null)
throw new PerformanceException("科室记录不存在!");
var deptdics = perdeptdicRepository.GetEntities(t => t.HISDeptName == request.HISDeptName && t.Department == request.Department && t.HospitalId == request.HospitalId);
if (deptdics == null || !deptdics.Any())
throw new PerformanceException("科室记录不存在!");
......@@ -591,5 +632,363 @@ private string[] GetUnitType(int userId)
return dict[role.Type.Value];
}
public HandsonTable GetBatchPersonStructrue(int hospitalId)
{
var result = new HandsonTable((int)SheetType.Unidentifiable, Person.Select(t => t.Item2).ToArray(), Person.Select(t => new collect_permission
{
HeadName = t.Item2,
Visible = 1
}).ToList());
var deptdics = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId);
var ss = deptdics?.Where(t => !new string[] { UnitType.专家组.ToString() }.Contains(t.UnitType));
if (result.Columns != null && result.Columns.Any())
{
foreach (var column in result.Columns)
{
if (column.Data == "人员类别")
{
column.Type = "autocomplete";
column.Source = EnumHelper.GetItems<UnitType>().Select(w => w.Description.Replace("行政后勤", "行政工勤")).ToArray();
column.Strict = true;
}
else if (new[] { "出勤天数", "预留比例" }.Contains(column.Data))
{
column.Type = "numeric";
column.NumericFormat = new NumericFormat { Pattern = "0,00" };
}
}
}
return result;
}
public HandsonTable GetDepartmentHands(int hospitalId)
{
HandsonTable handson = new HandsonTable((int)SheetType.Unidentifiable, DeptDic.Select(c => c.Value).ToArray(), DeptDic.Select(t => new collect_permission
{
HeadName = t.Value,
Visible = 1,
Readnoly = 0
}).ToList());
#region 科室下拉
//if (handson.Columns != null && handson.Columns.Any())
//{
// foreach (var column in handson.Columns)
// {
// if (column.Data == "标准科室")
// {
// column.Type = "autocomplete";
// column.Source = DeptDics(hospitalId, 2).Select(c => c.Value).ToArray();
// column.Strict = true;
// }
// else if (column.Data == "系统科室")
// {
// column.Type = "autocomplete";
// column.Source = DeptDics(hospitalId, 1).Select(c => c.Value).ToArray();
// column.Strict = true;
// }
// else if (new[] { "住院·核算单元医生组", "住院·核算单元护理组", "住院·核算单元医技组", "门诊·核算单元医生组", "门诊·核算单元护理组", "门诊·核算单元医技组" }.Contains(column.Data))
// {
// column.Type = "autocomplete";
// column.Source = DeptDics(hospitalId, 3).Select(c => c.Value).ToArray();
// column.Strict = true;
// }
// else if (column.Data == "行政后勤")
// {
// column.Type = "autocomplete";
// column.Source = DeptDics(hospitalId, 4).Select(c => c.Value).ToArray();
// column.Strict = true;
// }
// else if (column.Data == "特殊核算组")
// {
// column.Type = "autocomplete";
// column.Source = DeptDics(hospitalId, 5).Select(c => c.Value).ToArray();
// column.Strict = true;
// }
// }
//}
#endregion
return handson;
}
public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request)
{
var dict = new Dictionary<string, string>();
Person.ForEach(t => dict.Add(t.Item1, t.Item2));
var dicData = CreateDataRow(request, dict);
List<per_employee> employees = new List<per_employee>();
var persons = peremployeeRepository.GetEntities(t => t.HospitalId == HospitalId && t.AllotId == AllotId);
foreach (var item in dicData)
{
if (!string.IsNullOrEmpty(item["AttendanceDay"]) && !string.IsNullOrEmpty(item["ReservedRatio"]))
{
decimal attendanceDay = ConvertHelper.To<decimal>(item["AttendanceDay"]), reservedRatio = ConvertHelper.To<decimal>(item["ReservedRatio"]);
if ((!Regex.IsMatch(item["AttendanceDay"], "^(?:[0-2]*[0-9]?|30|31)$")) || (!Regex.IsMatch(item["ReservedRatio"], @"^(0.\d{1,2}|0|1)?$")))
return false;
}
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<per_employee>(json);
if (persons != null)
if (persons.Any(t => t.PersonnelNumber?.Trim() == data.PersonnelNumber?.Trim() && t.DoctorName?.Trim() == data.DoctorName?.Trim())) continue;
var any = employees.Any(w => w.Department?.Trim() == data.Department?.Trim() && w.DoctorName?.Trim() == data.DoctorName?.Trim());
if (!string.IsNullOrEmpty(data.Department?.Trim()) && !string.IsNullOrEmpty(data.AccountingUnit?.Trim()) && !string.IsNullOrEmpty(data.DoctorName?.Trim()) && !any)
{
data.HospitalId = HospitalId;
data.AllotId = AllotId;
data.DoctorName = data.DoctorName?.Trim();
data.PersonnelNumber = data.PersonnelNumber?.Trim();
data.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:dd"));
data.IsVerify = 0;
employees.Add(data);
}
}
if (employees.Any())
peremployeeRepository.AddRange(employees.ToArray());
return true;
}
public void SaveDeptDicHands(int HospitalId, SaveCollectData request)
{
var dicData = CreateDataRow(request, DeptDic);
var depts = perdeptdicRepository.GetEntities(t => t.HospitalId == HospitalId)?.Select(w => new { w.Department, w.HISDeptName }).Distinct();
List<per_dept_dic> deptDics = new List<per_dept_dic>();
foreach (var dic in dicData)
{
var json = JsonHelper.Serialize(dic);
var data = JsonHelper.Deserialize<DeptdicHands>(json);
if (depts != null)
if (depts.Any(t => t.Department?.Trim() == data.Department?.Trim())) continue;
var any = deptDics.Any(w => w.Department?.Trim() == data.Department?.Trim());
if (!string.IsNullOrEmpty(data.Department?.Trim()) && !any)
{
DeptDicList(HospitalId, deptDics, data);
}
}
if (deptDics.Any())
perdeptdicRepository.AddRange(deptDics.ToArray());
}
private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHands data)
{
var nowTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
#region 住院
if (!string.IsNullOrEmpty(data.InpatDoctorAccounting) || !string.IsNullOrEmpty(data.InpatNurseAccounting) || !string.IsNullOrEmpty(data.InpatTechnicAccounting))
{
if (!string.IsNullOrEmpty(data.InpatDoctorAccounting))
{
per_dept_dic deptDic = new per_dept_dic() { Source = "住院", HospitalId = HospitalId, Department = data.Department?.Trim(), HISDeptName = data.HISDeptName?.Trim(), CreateTime = nowTime };
deptDic.AccountingUnit = data.InpatDoctorAccounting?.Trim();
deptDic.UnitType = "医生组";
deptDics.Add(deptDic);
}
if (!string.IsNullOrEmpty(data.InpatNurseAccounting))
{
per_dept_dic deptDic = new per_dept_dic() { Source = "住院", HospitalId = HospitalId, Department = data.Department?.Trim(), HISDeptName = data.HISDeptName?.Trim(), CreateTime = nowTime };
deptDic.AccountingUnit = data.InpatNurseAccounting?.Trim();
deptDic.UnitType = "护理组";
deptDics.Add(deptDic);
}
if (!string.IsNullOrEmpty(data.InpatTechnicAccounting))
{
per_dept_dic deptDic = new per_dept_dic() { Source = "住院", HospitalId = HospitalId, Department = data.Department?.Trim(), HISDeptName = data.HISDeptName?.Trim(), CreateTime = nowTime };
deptDic.AccountingUnit = data.InpatTechnicAccounting?.Trim();
deptDic.UnitType = "医技组";
deptDics.Add(deptDic);
}
}
#endregion
#region 门诊
if (!string.IsNullOrEmpty(data.OutDoctorAccounting) || !string.IsNullOrEmpty(data.OutNurseAccounting) || !string.IsNullOrEmpty(data.OutTechnicAccounting))
{
if (!string.IsNullOrEmpty(data.OutDoctorAccounting))
{
per_dept_dic deptDic = new per_dept_dic() { Source = "门诊", HospitalId = HospitalId, Department = data.Department?.Trim(), HISDeptName = data.HISDeptName?.Trim(), CreateTime = nowTime };
deptDic.AccountingUnit = data.OutDoctorAccounting?.Trim();
deptDic.UnitType = "医生组";
deptDics.Add(deptDic);
}
if (!string.IsNullOrEmpty(data.OutNurseAccounting))
{
per_dept_dic deptDic = new per_dept_dic() { Source = "门诊", HospitalId = HospitalId, Department = data.Department?.Trim(), HISDeptName = data.HISDeptName?.Trim(), CreateTime = nowTime };
deptDic.AccountingUnit = data.OutNurseAccounting?.Trim();
deptDic.UnitType = "护理组";
deptDics.Add(deptDic);
}
if (!string.IsNullOrEmpty(data.OutTechnicAccounting))
{
per_dept_dic deptDic = new per_dept_dic() { Source = "门诊", HospitalId = HospitalId, Department = data.Department?.Trim(), HISDeptName = data.HISDeptName?.Trim(), CreateTime = nowTime };
deptDic.AccountingUnit = data.OutTechnicAccounting?.Trim();
deptDic.UnitType = "医技组";
deptDics.Add(deptDic);
}
}
#endregion
if (!string.IsNullOrEmpty(data.LogisticsAccounting))
{
per_dept_dic deptDic = new per_dept_dic()
{
HospitalId = HospitalId,
Department = data.Department?.Trim(),
HISDeptName = data.HISDeptName?.Trim(),
CreateTime = nowTime,
AccountingUnit = data.LogisticsAccounting?.Trim(),
UnitType = "行政后勤"
};
deptDics.Add(deptDic);
}
if (!string.IsNullOrEmpty(data.SpecialAccounting))
{
per_dept_dic deptDic = new per_dept_dic()
{
HospitalId = HospitalId,
Department = data.Department?.Trim(),
HISDeptName = data.HISDeptName?.Trim(),
CreateTime = nowTime,
AccountingUnit = data.LogisticsAccounting?.Trim(),
UnitType = "特殊核算组"
};
deptDics.Add(deptDic);
}
}
private List<Dictionary<string, string>> CreateDataRow(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);
allData.Add(baseData);
}
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 static List<(string, string, Func<per_employee, object>)> Person { get; } = new List<(string, string, Func<per_employee, object>)>
{
(nameof(per_employee.AccountingUnit), "核算单元", t => t.AccountingUnit),
(nameof(per_employee.Department), "科室名称", t => t.Department),
(nameof(per_employee.DoctorName), "姓名" ,t => t.DoctorName),
(nameof(per_employee.PersonnelNumber), "员工工号", t => t.PersonnelNumber),
(nameof(per_employee.JobCategory), "正式/临聘", t => t.JobCategory),
(nameof(per_employee.Duty), "职务", t => t.Duty),
(nameof(per_employee.JobTitle), "职称", t => t.JobTitle),
(nameof(per_employee.UnitType), "人员类别", t => t.UnitType),
(nameof(per_employee.AttendanceDay), "出勤天数", t => t.AttendanceDay),
(nameof(per_employee.ReservedRatio), "预留比例", t => t.ReservedRatio),
(nameof(per_employee.BankCard), "银行卡号", t => t.BankCard),
(nameof(per_employee.Remark), "备注", t => t.Remark),
};
private static Dictionary<string, string> DeptDic { get; } = new Dictionary<string, string>
{
{ nameof(DeptdicResponse.Department), "标准科室" },
{ nameof(DeptdicResponse.HISDeptName), "系统科室" },
{ nameof(DeptdicResponse.OutDoctorAccounting), "门诊·核算单元医生组" },
{ nameof(DeptdicResponse.OutNurseAccounting), "门诊·核算单元护理组" },
{ nameof(DeptdicResponse.OutTechnicAccounting), "门诊·核算单元医技组" },
{ nameof(DeptdicResponse.InpatDoctorAccounting), "住院·核算单元医生组" },
{ nameof(DeptdicResponse.InpatNurseAccounting), "住院·核算单元护理组" },
{ nameof(DeptdicResponse.InpatTechnicAccounting), "住院·核算单元医技组" },
{ nameof(DeptdicResponse.LogisticsAccounting), "行政后勤" },
{ nameof(DeptdicResponse.SpecialAccounting), "特殊核算组" }
};
public string GetPersonDictFile(int allotId, int userId)
{
var allot = perallotRepository.GetEntity(t => t.ID == allotId);
if (allot == null)
throw new PerformanceException("绩效记录不存在");
var data = GetPersons(allotId, userId) ?? new List<per_employee>();
var dpath = Path.Combine(evn.ContentRootPath, "Files", "Dictionary", $"{allot.HospitalId}");
FileHelper.CreateDirectory(dpath);
string filename = $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}人员字典-{DateTime.Now.ToString("yyyyMMddhhmmss")}.xlsx";
string filepath = Path.Combine(dpath, filename);
FileStream stream = new FileStream(filepath, FileMode.Create);
try
{
XSSFWorkbook workbook = new XSSFWorkbook();
ExcelStyle excelStyle = new ExcelStyle(workbook);
var style = excelStyle.SetBgkColorAndFormat(excelStyle.GetCellStyle());
ISheet sheet = workbook.CreateSheet("人员字典");
var header = sheet.CreateRow(0);
int cellIndex = 0;
foreach (var column in Person.Select(t => t.Item2))
{
var cell = header.CreateCell(cellIndex);
cell.SetCellValue(column);
cell.CellStyle = style;
cellIndex++;
}
int startIndex = 1;
foreach (var item in data)
{
var row = sheet.CreateRow(startIndex);
cellIndex = 0;
foreach (var field in Person.Select(t => t.Item3))
{
var cell = row.CreateCell(cellIndex);
cell.SetCellOValue(field?.Invoke(item));
cell.CellStyle = style;
cellIndex++;
}
startIndex++;
}
workbook.Write(stream);
}
catch (Exception ex)
{
Console.WriteLine("写入异常" + ex);
}
finally
{
stream.Close();
}
return filepath;
}
}
}
......@@ -481,7 +481,7 @@ private void SupplementOtherPerfor(ag_secondallot secondAllot, List<BodyItem> bo
{
if (bodyItems == null || !bodyItems.Any(w => w.RowNumber > -1)) return;
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == secondAllot.AllotId && t.Status == 3);
var perapramounts = perapramountRepository.GetFullAmount(t => t.AllotId == secondAllot.AllotId && t.Status == 3);
if (perapramounts == null || !perapramounts.Any()) return;
var rowNumberList = bodyItems.Where(w => w.RowNumber > -1).Select(w => w.RowNumber).Distinct().OrderBy(t => t).ToList();
......@@ -808,7 +808,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
private void SupplementSecondDetail(ag_secondallot second, List<per_employee> employees, List<ag_othersource> result, bool isTitlePerformance = true)
{
// 补充医院其他绩效 及 预留比例
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == second.AllotId && t.Status == 3);
var perapramounts = perapramountRepository.GetFullAmount(t => t.AllotId == second.AllotId && t.Status == 3);
var distPerformance = rescomputeRepository.GetEntities(t => t.AllotID == second.AllotId);
foreach (var item in result)
......
......@@ -55,6 +55,8 @@ public SecondAllotResponse GetSecondSavedData(int userId, int secondId, int empl
Workload_Ratio_Default = 0.8m,
DaysFullAttendance = DateTime.DaysInMonth(allot.Year, allot.Month)
};
head.TotalDistPerformance = second.RealGiveFee;
head.PaymentOfTheMonth = $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}月";
JObject jObject = JObject.Parse(JsonConvert.SerializeObject(head));
var headDynamic = agworktypesourceRepository.GetEntities(t => t.SecondId == secondId);
if (headDynamic != null && headDynamic.Any())
......@@ -185,7 +187,7 @@ private void SupplementOtherPerfor(ag_secondallot secondAllot, List<ag_bodysourc
{
if (bodyItems == null || !bodyItems.Any(w => w.RowNumber > -1)) return;
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == secondAllot.AllotId && t.Status == 3);
var perapramounts = perapramountRepository.GetFullAmount(t => t.AllotId == secondAllot.AllotId && t.Status == 3);
if (perapramounts == null || !perapramounts.Any()) return;
foreach (var rowitem in bodyItems)
......
......@@ -1521,7 +1521,8 @@ private List<ag_secondallot> SecondList(per_allot allot, List<res_account> accou
};
});
var enums = EnumHelper.GetItems<UnitType>();
return result.OrderBy(t => t.Status == 4 ? 2 : t.Status)
return result.Where(w => w.RealGiveFee != 0)
.OrderBy(t => t.Status == 4 ? 2 : t.Status)
.ThenBy(t => enums.FirstOrDefault(f => f.Name == t.UnitType)?.Value)
.ThenBy(t => t.Department)
.ToList();
......@@ -1574,14 +1575,14 @@ public bool AuditSubmit(ag_secondallot second, int userId)
if (temp == null)
throw new PerformanceException("选择模板不可用,请确定模板及数据是否存在!");
//bool method(decimal? submitDataAmount, decimal? realGiveFee)
//{
// if (!submitDataAmount.HasValue || !realGiveFee.HasValue)
// return false;
bool VerifySubmissioAmount(decimal? submitDataAmount, decimal? realGiveFee)
{
if (!submitDataAmount.HasValue || !realGiveFee.HasValue)
return false;
// decimal floatValue = 0.5m;
// return submitDataAmount >= (realGiveFee - floatValue) && submitDataAmount <= (realGiveFee + floatValue);
//}
decimal floatValue = 0.1m;
return submitDataAmount >= (realGiveFee - floatValue) && submitDataAmount <= (realGiveFee + floatValue);
}
if (temp.UseTempId == 6)
{
......@@ -1589,9 +1590,9 @@ public bool AuditSubmit(ag_secondallot second, int userId)
if (data == null || !data.Any())
throw new PerformanceException("提交时未检测到数据!");
//var total = data.Sum(t => t.RealAmount);
//if (!method(total, second.RealGiveFee))
// throw new PerformanceException("总金额与考核后金额不一致!");
var total = data.Sum(t => (t.DistPerformance ?? 0) + (t.NightWorkPerformance ?? 0)); // 其他模板 = 可分配绩效 + 夜班绩效
if (!VerifySubmissioAmount(total, second.RealGiveFee))
throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee},提交金额:{total}");
}
else if (new int[] { 7, 8 }.Contains(temp.UseTempId.Value))
{
......@@ -1599,16 +1600,20 @@ public bool AuditSubmit(ag_secondallot second, int userId)
if (data == null || !data.Any())
throw new PerformanceException("提交时未检测到数据!");
//var total = data.Where(t => t.ItemName == "实发绩效工资金额" && t.RowNumber > -1).GroupBy(t => t.RowNumber)
// .Sum(t => ConvertHelper.To<decimal>(t.OrderByDescending(o => o.ID).FirstOrDefault().ItemValue));
//if (!method(total, second.RealGiveFee))
// throw new PerformanceException("总金额与考核后金额不一致!");
var total = data.Where(t => new string[] { "可分配绩效", "夜班工作量绩效" }.Contains(t.ItemName) && t.RowNumber > -1).GroupBy(t => t.RowNumber)
.Sum(t => t.Sum(item => ConvertHelper.To<decimal>(item.ItemValue)));
if (!VerifySubmissioAmount(total, second.RealGiveFee))
throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee},提交金额:{total}");
}
else if (new int[] { 9, 10 }.Contains(temp.UseTempId.Value))
{
var data = agbodysourceRepository.GetEntities(t => t.SecondId == second.Id);
if (data == null || !data.Any())
throw new PerformanceException("提交时未检测到数据!");
var total = data.Sum(t => (t.DistPerformance ?? 0) + (t.NightWorkPerformance ?? 0));
if (!VerifySubmissioAmount(total, second.RealGiveFee))
throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee},提交金额:{total}");
}
second.UseTempId = temp.UseTempId;
second.Status = 2;
......@@ -2147,7 +2152,7 @@ public List<SecPrintResponse> Print(int secondId)
}
// 补充医院其他绩效 及 预留比例
var perapramounts = perapramountRepository.GetEntities(t => t.AllotId == second.AllotId && t.Status == 3);
var perapramounts = perapramountRepository.GetFullAmount(t => t.AllotId == second.AllotId && t.Status == 3);
var employees = personService.GetPerEmployee(second.AllotId.Value);
// 补充字典中该科室不存在,但有其它绩效的人员信息
......@@ -2324,26 +2329,26 @@ private List<SecondPerforResponse> GetAllotPerformance(int allotId, List<res_com
}).ToList();
}
public List<SecondPerforResponse> AddAprAmount(int allotId, List<SecondPerforResponse> computes)
{
if (computes == null || !computes.Any())
return computes;
//public List<SecondPerforResponse> AddAprAmount(int allotId, List<SecondPerforResponse> computes)
//{
// if (computes == null || !computes.Any())
// return computes;
var list = perapramountRepository.GetEntities(t => t.AllotId == allotId && t.Status == 3);
if (list == null || !list.Any())
return computes;
// var list = perapramountRepository.GetEntities(t => t.AllotId == allotId && t.Status == 3);
// if (list == null || !list.Any())
// return computes;
foreach (var item in computes.GroupBy(w => new { w.AccountingUnit, w.JobNumber }))
{
// 补充过一次就不在补充了
var emp = computes.Where(w => w.AccountingUnit == item.Key.AccountingUnit && w.JobNumber == item.Key.JobNumber)
.OrderByDescending(w => w.Source).FirstOrDefault();
var apramount = list.Where(t => t.AccountingUnit == emp.AccountingUnit
&& !string.IsNullOrEmpty(t.PersonnelNumber) && emp.JobNumber?.Trim() == t.PersonnelNumber?.Trim());
emp.OthePerfor = apramount?.Sum(w => w.Amount) ?? 0;
}
// foreach (var item in computes.GroupBy(w => new { w.AccountingUnit, w.JobNumber }))
// {
// // 补充过一次就不在补充了
// var emp = computes.Where(w => w.AccountingUnit == item.Key.AccountingUnit && w.JobNumber == item.Key.JobNumber)
// .OrderByDescending(w => w.Source).FirstOrDefault();
// var apramount = list.Where(t => t.AccountingUnit == emp.AccountingUnit
// && !string.IsNullOrEmpty(t.PersonnelNumber) && emp.JobNumber?.Trim() == t.PersonnelNumber?.Trim());
// emp.OthePerfor = apramount?.Sum(w => w.Amount) ?? 0;
// }
return computes;
}
// return computes;
//}
}
}
......@@ -30,6 +30,7 @@ public class UserService : IAutoInjection
private PerforResaccountRepository _resaccountRepository;
private PerforPerallotRepository _perallotRepository;
private PerforPerdeptdicRepository _perdeptdicRepository;
private readonly PerforCofaccountingRepository perforCofaccountingRepository;
public UserService(IOptions<Application> application,
PerforSmsRepository smsRepository,
......@@ -44,7 +45,8 @@ public class UserService : IAutoInjection
PerforImspecialunitRepository imspecialunitRepository,
PerforResaccountRepository resaccountRepository,
PerforPerallotRepository perallotRepository,
PerforPerdeptdicRepository perdeptdicRepository)
PerforPerdeptdicRepository perdeptdicRepository,
PerforCofaccountingRepository perforCofaccountingRepository)
{
this.application = application.Value;
this._userRepository = userRepository;
......@@ -60,6 +62,7 @@ public class UserService : IAutoInjection
this._resaccountRepository = resaccountRepository;
this._perallotRepository = perallotRepository;
this._perdeptdicRepository = perdeptdicRepository;
this.perforCofaccountingRepository = perforCofaccountingRepository;
}
/// <summary>
......@@ -695,5 +698,175 @@ public ApiResponse DeleteUser(int iD)
}
#endregion
public HandsonTable GetUserHandsFlat()
{
var result = new HandsonTable((int)SheetType.Unidentifiable, Users.Select(t => t.Value).ToArray(), Users.Select(t => new collect_permission
{
HeadName = t.Value,
Visible = 1
}).ToList());
if (result.Columns != null && result.Columns.Any())
{
foreach (var column in result.Columns)
{
if (column.Data == "角色")
{
column.Type = "autocomplete";
column.Source = _roleRepository.GetEntities().Select(t => t.RoleName).ToArray();
column.Strict = true;
}
else if (column.Data == "分配医院")
{
column.Type = "autocomplete";
column.Source = _hospitalRepository.GetEntities().Select(t => t.HosName).ToArray();
column.Strict = true;
}
}
}
return result;
}
public string SaveUserHandsFlat(UserCollectData request)
{
try
{
var dicData = CreateDataRow(request, Users);
var getUsers = _userRepository.GetEntities();
var roles = _roleRepository.GetEntities();
var hospitals = _hospitalRepository.GetEntities();
//hack:后续修改为accounting中的数据
var accounts = perforCofaccountingRepository.GetEntities();
//var allot = _perallotRepository.GetEntities(t => t.HospitalId == request.HospitalId);
//var res = accounts?.Join(allot, t => t.AllotId, w => w.ID, (t, w) => new cof_accounting { AccountingUnit = t.AccountingUnit }).Distinct();
List<sys_user> users = new List<sys_user>();
List<sys_user_role> userRoles = new List<sys_user_role>();
List<sys_user_hospital> userHoss = new List<sys_user_hospital>();
var roleArr = new[] { "护士长", "科主任", "特殊科室", "行政科室" };
var allDataList = dicData.Select(item => JsonHelper.Deserialize<UserHandsResponse>(JsonHelper.Serialize(item)));
var names = allDataList?.Select(w => w?.HosName).Distinct();
Dictionary<string, List<string>> res = new Dictionary<string, List<string>>();
foreach (var item in names)
{
if (item == null) return "必填项为空";
var HospitalId = hospitals.FirstOrDefault(w => w.HosName == item)?.ID;
var allot = _perallotRepository.GetEntities(t => t.HospitalId == HospitalId);
var accountingUnits = accounts?.Join(allot, t => t.AllotId, w => w.ID, (t, w) => t.AccountingUnit).Distinct().ToList();
res.Add(item, accountingUnits);
}
foreach (var data in allDataList)
{
if (string.IsNullOrEmpty(data.Login) || string.IsNullOrEmpty(data.RealName) || string.IsNullOrEmpty(data.RoleName) || string.IsNullOrEmpty(data.HosName)) return "必填项为空";
if (roleArr.Contains(data.RoleName) && res == null) return "科室字典为空";
if (users.Any(c => c.Login == data?.Login) && !string.IsNullOrEmpty(data.Login)
|| getUsers.Any(c => c.Login == data?.Login)) return "登录名重复";
if (roleArr.Contains(data.RoleName) && res[data.HosName] != null && !res[data.HosName].Any(t => t == data.Department))
return "核算单元填写错误";
var user = new sys_user
{
RealName = data.RealName,
CreateDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:dd")),
CreateUser = request.CreateUser,
Department = data?.Department ?? "",
IsDelete = 1,
Login = data.Login,
Password = data?.Password ?? "123456",
States = 1,
Mobile = data?.Mobile ?? "",
Mail = data?.Mail ?? ""
};
users.Add(user);
//var userRole = new sys_user_role
//{
// RoleID = (int)roles.FirstOrDefault(t => t.RoleName == data.RoleName)?.Type,
//};
//userRoles.Add(userRole);
//var userHos = new sys_user_hospital
//{
// HospitalID = hospitals.FirstOrDefault(t => t.HosName == data.HosName)?.ID
//};
//userHoss.Add(userHos);
}
_userRepository.AddRange(users.ToArray());
//var roleJoin = userRoles.Join(users, t => new { }, w => new { }, (t, w) => new sys_user_role { RoleID = t.RoleID, UserID = w.ID });
//var hosJoin = userHoss.Join(users, t => new { }, w => new { }, (t, w) => new sys_user_hospital { HospitalID = t.HospitalID, UserID = w.ID });
var joinData = users.Join(allDataList, outer => new { outer.Login, outer.RealName, Department = outer.Department ?? "" }, inner => new { inner.Login, inner.RealName, Department = inner.Department ?? "" }, (outer, inner) => new { outer, inner });
var roleJoin = joinData.Select(t => new sys_user_role
{
UserID = t.outer.ID,
RoleID = (int)roles.FirstOrDefault(r => r.RoleName == t.inner.RoleName)?.Type
});
_userroleRepository.AddRange(roleJoin.ToArray());
var hosJoin = joinData.Select(t => new sys_user_hospital
{
UserID = t.outer.ID,
HospitalID = hospitals.FirstOrDefault(h => h.HosName == t.inner.HosName)?.ID
});
_userhospitalRepository.AddRange(hosJoin.ToArray());
return "";
}
catch (Exception e)
{
throw e;
}
}
public static Dictionary<string, string> Users { get; } = new Dictionary<string, string>
{
{nameof(sys_user.RealName), "姓名"},
{nameof(sys_user.Login), "登录名"},
{nameof(sys_user.Password), "密码"},
{nameof(sys_user.Mobile), "手机号码"},
{nameof(sys_user.Mail), "邮箱"},
{nameof(sys_role.RoleName), "角色"},
{nameof(sys_hospital.HosName), "分配医院"},
{nameof(sys_user.Department), "核算单元"},
};
private List<Dictionary<string, string>> CreateDataRow(UserCollectData 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);
allData.Add(baseData);
}
return allData;
}
private Dictionary<string, string> CreateBaseData(UserCollectData 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;
}
}
}
\ No newline at end of file
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