Commit 8b9aafc9 by 钟博

Merge branch 'feature/个人账号登陆查询绩效' into develop

parents 86dd9971 c9b2aff2
...@@ -147,9 +147,9 @@ public ApiResponse<UserResponse> UpdateSelf([CustomizeValidator(RuleSet = "Self" ...@@ -147,9 +147,9 @@ public ApiResponse<UserResponse> UpdateSelf([CustomizeValidator(RuleSet = "Self"
/// <returns></returns> /// <returns></returns>
[Route("list")] [Route("list")]
[HttpPost] [HttpPost]
public ApiResponse<List<UserResponse>> List() public ApiResponse<List<UserResponse>> List([FromBody] UserRequest request)
{ {
var userList = _userService.GetUserList(_claim.GetUserId()); var userList = _userService.GetUserList(_claim.GetUserId(),request.Role);
return new ApiResponse<List<UserResponse>>(ResponseType.OK, "ok", userList); return new ApiResponse<List<UserResponse>>(ResponseType.OK, "ok", userList);
} }
......
...@@ -493,5 +493,18 @@ public IActionResult DownloadCurrentCalculationTable(int allotid) ...@@ -493,5 +493,18 @@ public IActionResult DownloadCurrentCalculationTable(int allotid)
var memi = provider.Mappings[".xlsx"]; var memi = provider.Mappings[".xlsx"];
return File(memoryStream, memi, Path.GetFileName(fileInfo.Name)); return File(memoryStream, memi, Path.GetFileName(fileInfo.Name));
} }
/// <summary>
/// 查询个人绩效
/// </summary>
/// <returns></returns>
[Route("owner/query")]
[HttpGet]
public ApiResponse GetOwnerPerformance()
{
var userid = _claim.GetUserId();
var res = _allotService.GetOwnerPerformance(userid);
return new ApiResponse(ResponseType.OK, res);
}
} }
} }
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.AccountController.List"> <member name="M:Performance.Api.Controllers.AccountController.List(Performance.DtoModels.UserRequest)">
<summary> <summary>
用户列表 用户列表
</summary> </summary>
...@@ -308,6 +308,12 @@ ...@@ -308,6 +308,12 @@
<param name="allotid"></param> <param name="allotid"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.AllotController.GetOwnerPerformance">
<summary>
查询个人绩效
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.BudgetController.Query(Performance.DtoModels.Request.BudgetRequest)"> <member name="M:Performance.Api.Controllers.BudgetController.Query(Performance.DtoModels.Request.BudgetRequest)">
<summary> <summary>
预算管理查询(包含金额、占比) 预算管理查询(包含金额、占比)
......
...@@ -3434,6 +3434,11 @@ ...@@ -3434,6 +3434,11 @@
行政后勤是否显示管理绩效按钮 1 是 2 否 行政后勤是否显示管理绩效按钮 1 是 2 否
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.HospitalResponse.IsOwnerQuery">
<summary>
是否开启个人绩效查询账号创建 1 是 2 否
</summary>
</member>
<member name="P:Performance.DtoModels.IncomeResponse.SheetNameKeyword"> <member name="P:Performance.DtoModels.IncomeResponse.SheetNameKeyword">
<summary> <summary>
关键字匹配 关键字匹配
...@@ -3474,6 +3479,26 @@ ...@@ -3474,6 +3479,26 @@
菜单状态 1 启用 2禁用 菜单状态 1 启用 2禁用
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.OwnerPerformanceDto.ShouldGiveFee">
<summary>
应发绩效
</summary>
</member>
<member name="P:Performance.DtoModels.OwnerPerformanceDto.ReservedRatio">
<summary>
预留比例
</summary>
</member>
<member name="P:Performance.DtoModels.OwnerPerformanceDto.ReservedRatioFee">
<summary>
预留金额
</summary>
</member>
<member name="P:Performance.DtoModels.OwnerPerformanceDto.RealGiveFee">
<summary>
实发绩效
</summary>
</member>
<member name="P:Performance.DtoModels.PerEmployeeResponse.WorkTime"> <member name="P:Performance.DtoModels.PerEmployeeResponse.WorkTime">
<summary> <summary>
参加工作时间 参加工作时间
......
...@@ -6897,6 +6897,11 @@ ...@@ -6897,6 +6897,11 @@
行政后勤是否显示管理绩效按钮 1 是 2 否 行政后勤是否显示管理绩效按钮 1 是 2 否
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.sys_hospital.IsOwnerQuery">
<summary>
是否开启个人绩效查询账号创建 1 是 2 否
</summary>
</member>
<member name="T:Performance.EntityModels.sys_hospitalconfig"> <member name="T:Performance.EntityModels.sys_hospitalconfig">
<summary> <summary>
...@@ -7407,5 +7412,40 @@ ...@@ -7407,5 +7412,40 @@
统计的HIS的原始科室名称 统计的HIS的原始科室名称
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.view_allot_result.Source">
<summary>
来源
</summary>
</member>
<member name="P:Performance.DtoModels.view_allot_result.PerforSumFee">
<summary>
业绩绩效
</summary>
</member>
<member name="P:Performance.DtoModels.view_allot_result.PerforManagementFee">
<summary>
管理绩效
</summary>
</member>
<member name="P:Performance.DtoModels.view_allot_result.NightWorkPerfor">
<summary>
夜班绩效
</summary>
</member>
<member name="P:Performance.DtoModels.view_allot_result.AdjustLaterOtherFee">
<summary>
调节后其他绩效
</summary>
</member>
<member name="P:Performance.DtoModels.view_allot_result.OtherPerfor">
<summary>
医院其他绩效
</summary>
</member>
<member name="P:Performance.DtoModels.view_allot_result.HideOtherPerfor">
<summary>
不公示其他绩效
</summary>
</member>
</members> </members>
</doc> </doc>
...@@ -244,6 +244,9 @@ public AutoMapperConfigs() ...@@ -244,6 +244,9 @@ public AutoMapperConfigs()
CreateMap<ag_headsource, SecPrintHeaderResponse>() CreateMap<ag_headsource, SecPrintHeaderResponse>()
.ForMember(dest => dest.TheTotalAllocationOfPerformanceResults, opt => opt.MapFrom(src => src.TotalDeptReward)) .ForMember(dest => dest.TheTotalAllocationOfPerformanceResults, opt => opt.MapFrom(src => src.TotalDeptReward))
.ReverseMap(); .ReverseMap();
CreateMap<view_allot_result, OwnerPerformanceDto>()
.ReverseMap();
} }
} }
} }
...@@ -114,4 +114,20 @@ public enum DataFormat ...@@ -114,4 +114,20 @@ public enum DataFormat
/// <summary> 日期 </summary> /// <summary> 日期 </summary>
日期 日期
} }
public enum Role
{
绩效管理员 = 1,
医院管理员 = 2,
护士长 = 3,
科主任 = 4,
绩效核算办 = 5,
院领导 = 6,
财务科 = 7,
人事科 = 8,
特殊科室 = 9,
行政科室 = 10,
数据收集 = 11,
绩效查询 = 12,
}
} }
...@@ -37,5 +37,10 @@ public class HospitalResponse ...@@ -37,5 +37,10 @@ public class HospitalResponse
/// 行政后勤是否显示管理绩效按钮 1 是 2 否 /// 行政后勤是否显示管理绩效按钮 1 是 2 否
/// </summary> /// </summary>
public Nullable<int> IsShowManageButton { get; set; } public Nullable<int> IsShowManageButton { get; set; }
/// <summary>
/// 是否开启个人绩效查询账号创建 1 是 2 否
/// </summary>
public Nullable<int> IsOwnerQuery { get; set; }
} }
} }
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class OwnerPerformanceDto : view_allot_result
{
public IEnumerable<OwnerPerformanceDto> Detail { get; set; }
/// <summary>
/// 应发绩效
/// </summary>
public decimal? ShouldGiveFee { get; set; }
/// <summary>
/// 预留比例
/// </summary>
public decimal? ReservedRatio { get; set; }
/// <summary>
/// 预留金额
/// </summary>
public decimal? ReservedRatioFee { get; set; }
/// <summary>
/// 实发绩效
/// </summary>
public decimal RealGiveFee { get; set; }
}
}
...@@ -18,4 +18,9 @@ public class PerEmployeeResponse : per_employee ...@@ -18,4 +18,9 @@ public class PerEmployeeResponse : per_employee
/// </summary> /// </summary>
public new string BirthDate { get; set; } public new string BirthDate { get; set; }
} }
public class PersonePassword : per_employee
{
public string Password { get; set; }
}
} }
...@@ -9,6 +9,7 @@ public class SaveCollectData ...@@ -9,6 +9,7 @@ public class SaveCollectData
{ {
public int SheetType { get; set; } public int SheetType { get; set; }
public string SheetName { get; set; } public string SheetName { get; set; }
public int? CreateUser { get; set; }
public string[] ColHeaders { get; set; } public string[] ColHeaders { get; set; }
public string[][] Data { get; set; } public string[][] Data { get; set; }
} }
...@@ -18,7 +19,7 @@ public class UserCollectData ...@@ -18,7 +19,7 @@ public class UserCollectData
public int HospitalId { get; set; } public int HospitalId { get; set; }
public int? CreateUser { get; set; } public int? CreateUser { get; set; }
public string[] ColHeaders { get; set; } public string[] ColHeaders { get; set; }
public string[][] Data { get; set; } public new string[][] Data { get; set; }
} }
......
...@@ -120,5 +120,10 @@ public class sys_hospital ...@@ -120,5 +120,10 @@ public class sys_hospital
/// 行政后勤是否显示管理绩效按钮 1 是 2 否 /// 行政后勤是否显示管理绩效按钮 1 是 2 否
/// </summary> /// </summary>
public Nullable<int> IsShowManageButton { get; set; } public Nullable<int> IsShowManageButton { get; set; }
/// <summary>
/// 是否开启个人绩效查询账号创建 1 是 2 否
/// </summary>
public Nullable<int> IsOwnerQuery { get; set; }
} }
} }
namespace Performance.DtoModels
{
public class view_allot_result
{
public int HospitalID { get; set; }
public int Year { get; set; }
public int Month { get; set; }
/// <summary>
/// 来源
/// </summary>
public string Source { get; set; }
public int AllotId { get; set; }
public int? SecondId { get; set; }
public string UnitType { get; set; }
public string AccountingUnit { get; set; }
public int? IsShowManage { get; set; }
public string EmployeeName { get; set; }
public string JobNumber { get; set; }
public string JobTitle { get; set; }
/// <summary>
/// 业绩绩效
/// </summary>
public decimal? PerforSumFee { get; set; }
/// <summary>
/// 管理绩效
/// </summary>
public decimal? PerforManagementFee { get; set; }
/// <summary>
/// 夜班绩效
/// </summary>
public decimal? NightWorkPerfor { get; set; }
/// <summary>
/// 调节后其他绩效
/// </summary>
public decimal? AdjustLaterOtherFee { get; set; }
/// <summary>
/// 医院其他绩效
/// </summary>
public decimal? OtherPerfor { get; set; }
/// <summary>
/// 不公示其他绩效
/// </summary>
public decimal? HideOtherPerfor { get; set; }
public decimal? RealPerformance { get; set; }
}
}
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels; using Performance.EntityModels;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -382,5 +383,11 @@ public List<EmployeeReservedDto> GetEmployeeReserved(int hospitalId, int year) ...@@ -382,5 +383,11 @@ public List<EmployeeReservedDto> GetEmployeeReserved(int hospitalId, int year)
string sql = "SELECT * FROM view_allot_result_report WHERE HospitalID=@HospitalID AND Year=@Year"; string sql = "SELECT * FROM view_allot_result_report WHERE HospitalID=@HospitalID AND Year=@Year";
return DapperQuery<EmployeeReservedDto>(sql, new { HospitalID = hospitalId, Year = year })?.ToList(); return DapperQuery<EmployeeReservedDto>(sql, new { HospitalID = hospitalId, Year = year })?.ToList();
} }
public List<view_allot_result> GetOwnerPerformance(List<int> hospitalId, string jobNumber)
{
string sql = "SELECT * FROM view_allot_result WHERE HospitalID IN @HospitalID AND JobNumber=@JobNumber";
return DapperQuery<view_allot_result>(sql, new { HospitalID = hospitalId, JobNumber = jobNumber })?.ToList();
}
} }
} }
...@@ -44,6 +44,7 @@ public class AllotService : IAutoInjection ...@@ -44,6 +44,7 @@ public class AllotService : IAutoInjection
private readonly UserService userService; private readonly UserService userService;
private PerforCofdirectorRepository perforCofdirectorRepository; private PerforCofdirectorRepository perforCofdirectorRepository;
private readonly PerforReportRepository _reportRepository; private readonly PerforReportRepository _reportRepository;
private readonly PerforPeremployeeRepository _perforPeremployeeRepository;
//private readonly IHubContext<AllotLogHub> hubContext; //private readonly IHubContext<AllotLogHub> hubContext;
private readonly LogManageService logManageService; private readonly LogManageService logManageService;
...@@ -78,6 +79,7 @@ public class AllotService : IAutoInjection ...@@ -78,6 +79,7 @@ public class AllotService : IAutoInjection
ReportService reportService, ReportService reportService,
PerforCofdirectorRepository perforCofdirectorRepository, PerforCofdirectorRepository perforCofdirectorRepository,
PerforReportRepository reportRepository, PerforReportRepository reportRepository,
PerforPeremployeeRepository perforPeremployeeRepository,
QueryDataService queryDataService) QueryDataService queryDataService)
{ {
_allotRepository = allotRepository; _allotRepository = allotRepository;
...@@ -107,6 +109,7 @@ public class AllotService : IAutoInjection ...@@ -107,6 +109,7 @@ public class AllotService : IAutoInjection
this.reportService = reportService; this.reportService = reportService;
this.perforCofdirectorRepository = perforCofdirectorRepository; this.perforCofdirectorRepository = perforCofdirectorRepository;
_reportRepository = reportRepository; _reportRepository = reportRepository;
_perforPeremployeeRepository = perforPeremployeeRepository;
this.queryDataService = queryDataService; this.queryDataService = queryDataService;
} }
...@@ -659,5 +662,80 @@ public List<EmployeeReservedDto> GetReserved(int hospitalId, int year, int useri ...@@ -659,5 +662,80 @@ public List<EmployeeReservedDto> GetReserved(int hospitalId, int year, int useri
return reserveds; return reserveds;
} }
/// <summary>
/// 查询个人绩效
/// </summary>
/// <param name="userid"></param>
/// <returns></returns>
public List<OwnerPerformanceDto> GetOwnerPerformance(int userid)
{
var user = userService.GetUser(userid);
if (user == null)
throw new PerformanceException("用户信息错误");
var roleType = roleService.GetUserRole(userid)?.FirstOrDefault()?.Type;
if (!roleType.HasValue)
throw new PerformanceException("用户信息错误");
if (roleType != (int)Role.绩效查询)
throw new PerformanceException("当前用户暂不支持绩效查询");
var hospitals = userService.GetUserHospital(userid);
string jobNumber = user.Login;
var owner = _reportRepository.GetOwnerPerformance(hospitals, jobNumber);
if (owner == null || !owner.Any())
return new List<OwnerPerformanceDto>();
var employees = _perforPeremployeeRepository.GetEntities(w => w.PersonnelNumber == jobNumber);
var res = owner
.GroupBy(w => new { w.AllotId, w.Year, w.Month, w.JobNumber })
.Select(w => new OwnerPerformanceDto
{
AllotId = w.Key.AllotId,
Year = w.Key.Year,
Month = w.Key.Month,
JobNumber = w.Key.JobNumber,
PerforSumFee = Math.Round(w.Sum(p => p.PerforSumFee) ?? 0, 2, MidpointRounding.AwayFromZero), // 业绩绩效
PerforManagementFee = Math.Round(w.Sum(p => p.PerforManagementFee) ?? 0, 2, MidpointRounding.AwayFromZero),// 管理绩效
NightWorkPerfor = Math.Round(w.Sum(p => p.NightWorkPerfor) ?? 0, 2, MidpointRounding.AwayFromZero),// 夜班绩效
AdjustLaterOtherFee = Math.Round(w.Sum(p => p.AdjustLaterOtherFee) ?? 0, 2, MidpointRounding.AwayFromZero), // 调节后其他绩效
OtherPerfor = Math.Round(w.Sum(p => p.OtherPerfor) ?? 0, 2, MidpointRounding.AwayFromZero), // 医院其他绩效
HideOtherPerfor = Math.Round(w.Sum(p => p.HideOtherPerfor) ?? 0, 2, MidpointRounding.AwayFromZero),// 不公示其他绩效
RealPerformance = Math.Round(w.Sum(p => p.RealPerformance) ?? 0, 2, MidpointRounding.AwayFromZero),// 中转使用: 业绩绩效+管理绩效+调节后其他绩效
Detail = w
.Where(p => p.Year == w.Key.Year && p.Month == w.Key.Month && p.JobNumber == w.Key.JobNumber)
.Select(detial =>
{
var dto = Mapper.Map<OwnerPerformanceDto>(detial);
// 应发绩效
dto.ShouldGiveFee = Math.Round((dto.RealPerformance ?? 0) + (dto.OtherPerfor ?? 0) + (dto.HideOtherPerfor ?? 0) + (dto.NightWorkPerfor ?? 0), 2, MidpointRounding.AwayFromZero);
dto.ReservedRatio = employees?.FirstOrDefault(emp => emp.AllotId == dto.AllotId && emp.PersonnelNumber == jobNumber)?.ReservedRatio ?? 0; // 预留比例
dto.ReservedRatioFee = Math.Round((dto.RealPerformance ?? 0) * (dto.ReservedRatio ?? 0), 2, MidpointRounding.AwayFromZero); // 预留绩效
dto.RealGiveFee = Math.Round(dto.ShouldGiveFee - (dto.ReservedRatioFee ?? 0) ?? 0, 2, MidpointRounding.AwayFromZero); // 实发绩效
return dto;
}),
})
.ToList();
foreach (var item in res)
{
item.UnitType = employees?.FirstOrDefault(w => w.AllotId == item.AllotId && w.PersonnelNumber == jobNumber)?.UnitType ?? "";
item.AccountingUnit = employees?.FirstOrDefault(w => w.AllotId == item.AllotId && w.PersonnelNumber == jobNumber)?.AccountingUnit ?? "";
item.EmployeeName = employees?.FirstOrDefault(w => w.AllotId == item.AllotId && w.PersonnelNumber == jobNumber)?.DoctorName ?? "";
// 全部是0的记录不显示
item.Detail = item.Detail.Where(w => !(w.PerforSumFee == 0 && w.PerforManagementFee == 0 && w.ShouldGiveFee == 0 && w.OtherPerfor == 0 && w.HideOtherPerfor == 0 && w.RealGiveFee == 0));
// 为了保证总额一致
item.ShouldGiveFee = Math.Round(item.Detail?.Sum(w => w.ShouldGiveFee) ?? 0, 2, MidpointRounding.AwayFromZero); // 应发绩效
item.ReservedRatio = employees?.FirstOrDefault(w => w.AllotId == item.AllotId && w.PersonnelNumber == jobNumber)?.ReservedRatio ?? 0; // 预留比例
item.ReservedRatioFee = Math.Round(item.Detail?.Sum(w => w.ReservedRatioFee) ?? 0, 2, MidpointRounding.AwayFromZero); // 预留绩效
item.RealGiveFee = Math.Round(item.Detail?.Sum(w => w.RealGiveFee) ?? 0, 2, MidpointRounding.AwayFromZero); // 实发绩效
}
return res?.OrderByDescending(w => w.Year).ThenByDescending(w => w.Month).ToList();
}
} }
} }
...@@ -32,6 +32,8 @@ public class PersonService : IAutoInjection ...@@ -32,6 +32,8 @@ public class PersonService : IAutoInjection
private readonly PerforUserroleRepository perforUserroleRepository; private readonly PerforUserroleRepository perforUserroleRepository;
private readonly PerforRoleRepository perforRoleRepository; private readonly PerforRoleRepository perforRoleRepository;
private readonly PerforAgsecondallotRepository agsecondallotRepository; private readonly PerforAgsecondallotRepository agsecondallotRepository;
private readonly PerforHospitalRepository perforHospitalRepository;
private readonly UserService userService;
private readonly Application application; private readonly Application application;
private readonly IHostingEnvironment evn; private readonly IHostingEnvironment evn;
...@@ -55,6 +57,8 @@ public class PersonService : IAutoInjection ...@@ -55,6 +57,8 @@ public class PersonService : IAutoInjection
PerforUserroleRepository perforUserroleRepository, PerforUserroleRepository perforUserroleRepository,
PerforRoleRepository perforRoleRepository, PerforRoleRepository perforRoleRepository,
PerforAgsecondallotRepository agsecondallotRepository, PerforAgsecondallotRepository agsecondallotRepository,
PerforHospitalRepository perforHospitalRepository,
UserService userService,
IOptions<Application> application, IOptions<Application> application,
IHostingEnvironment evn IHostingEnvironment evn
) )
...@@ -67,6 +71,8 @@ IHostingEnvironment evn ...@@ -67,6 +71,8 @@ IHostingEnvironment evn
this.perforUserroleRepository = perforUserroleRepository; this.perforUserroleRepository = perforUserroleRepository;
this.perforRoleRepository = perforRoleRepository; this.perforRoleRepository = perforRoleRepository;
this.agsecondallotRepository = agsecondallotRepository; this.agsecondallotRepository = agsecondallotRepository;
this.perforHospitalRepository = perforHospitalRepository;
this.userService = userService;
this.application = application.Value; this.application = application.Value;
this.evn = evn; this.evn = evn;
} }
...@@ -635,12 +641,19 @@ private string[] GetUnitType(int userId) ...@@ -635,12 +641,19 @@ private string[] GetUnitType(int userId)
public HandsonTable GetBatchPersonStructrue(int hospitalId) public HandsonTable GetBatchPersonStructrue(int hospitalId)
{ {
var result = new HandsonTable((int)SheetType.Unidentifiable, Person.Select(t => t.Item2).ToArray(), Person.Select(t => new collect_permission var hos = perforHospitalRepository.GetEntity(t => t.ID == hospitalId);
var cols = hos.IsOwnerQuery == 1 ? PersonPassword.Select(t => t.Item2).ToArray() : Person.Select(t => t.Item2).ToArray();
var permissions = hos.IsOwnerQuery == 1 ? PersonPassword.Select(t => new collect_permission
{ {
HeadName = t.Item2, HeadName = t.Item2,
Visible = 1 Visible = 1
}).ToList()); }).ToList() : Person.Select(t => new collect_permission
{
HeadName = t.Item2,
Visible = 1
}).ToList();
var result = new HandsonTable((int)SheetType.Unidentifiable,cols, permissions);
var deptdics = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId); var deptdics = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId);
var ss = deptdics?.Where(t => !new string[] { UnitType.专家组.ToString() }.Contains(t.UnitType)); var ss = deptdics?.Where(t => !new string[] { UnitType.专家组.ToString() }.Contains(t.UnitType));
if (result.Columns != null && result.Columns.Any()) if (result.Columns != null && result.Columns.Any())
...@@ -716,13 +729,54 @@ public HandsonTable GetDepartmentHands(int hospitalId) ...@@ -716,13 +729,54 @@ public HandsonTable GetDepartmentHands(int hospitalId)
public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request) public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request)
{ {
var dict = new Dictionary<string, string>(); var dict = new Dictionary<string, string>();
Person.ForEach(t => dict.Add(t.Item1, t.Item2)); //根据IsOwnerQuery是否等于1来过滤密码列
var hospital = perforHospitalRepository.GetEntity(t => t.ID == HospitalId);
if (hospital.IsOwnerQuery == 1)
{
PersonPassword.ForEach(t => dict.Add(t.Item1, t.Item2));
}
else
{
Person.ForEach(t => dict.Add(t.Item1, t.Item2));
}
var dicData = CreateDataRow(request, dict); var dicData = CreateDataRow(request, dict);
List<per_employee> employees = new List<per_employee>(); List<per_employee> employees = new List<per_employee>();
var persons = peremployeeRepository.GetEntities(t => t.HospitalId == HospitalId && t.AllotId == AllotId); var persons = peremployeeRepository.GetEntities(t => t.HospitalId == HospitalId && t.AllotId == AllotId);
//begin 绩效查询角色配置、查询信息
var usercollor = new UserCollectData
{
HospitalId = HospitalId,
CreateUser = request.CreateUser,
ColHeaders = UserService.Users.Values.ToArray(),
};
var role = perforRoleRepository.GetEntity(t => t.RoleName == "绩效查询");
var userRole = perforUserroleRepository.GetEntities(t => t.RoleID == role.ID).Select(t=>t.UserID);
var users = perforUserRepository.GetEntities(t => userRole.Contains(t.ID));
var newUsers = new List<string[]>();
//end
var delPersonsNum = new List<string>(); var delPersonsNum = new List<string>();
foreach (var item in dicData) foreach (var item in dicData)
{ {
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<per_employee>(json);
//begin 绩效查询角色
if (hospital.IsOwnerQuery == 1)
{
var isNewRole = !string.IsNullOrEmpty(data.PersonnelNumber?.Trim()) && !string.IsNullOrEmpty(item["Password"]);
var isRepeat = users.Any(t => t.RealName == data.DoctorName?.Trim() && t.Login == data.PersonnelNumber?.Trim());
if ( isNewRole && !isRepeat)
{
newUsers.Add(new[] { $"{data.DoctorName?.Trim()}", $"{data.PersonnelNumber?.Trim()}", $"{item["Password"]}", "", "", "绩效查询", $"{hospital.HosName}", $"{data.AccountingUnit?.Trim()}"});
}
}
//end
if (!string.IsNullOrEmpty(item["AttendanceDay"]) && !string.IsNullOrEmpty(item["ReservedRatio"])) if (!string.IsNullOrEmpty(item["AttendanceDay"]) && !string.IsNullOrEmpty(item["ReservedRatio"]))
{ {
decimal attendanceDay = ConvertHelper.To<decimal>(item["AttendanceDay"]), reservedRatio = ConvertHelper.To<decimal>(item["ReservedRatio"]); decimal attendanceDay = ConvertHelper.To<decimal>(item["AttendanceDay"]), reservedRatio = ConvertHelper.To<decimal>(item["ReservedRatio"]);
...@@ -730,8 +784,7 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request) ...@@ -730,8 +784,7 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request)
return false; return false;
} }
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<per_employee>(json);
if (persons != null) if (persons != null)
if (persons.Any(t => t.PersonnelNumber?.Trim() == data.PersonnelNumber?.Trim())) delPersonsNum.Add(data.PersonnelNumber); if (persons.Any(t => t.PersonnelNumber?.Trim() == data.PersonnelNumber?.Trim())) delPersonsNum.Add(data.PersonnelNumber);
...@@ -748,6 +801,13 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request) ...@@ -748,6 +801,13 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request)
employees.Add(data); employees.Add(data);
} }
} }
if (newUsers.Count > 0)
{
usercollor.Data = newUsers.ToArray();
userService.SaveUserHandsFlat(usercollor);
}
var delPerson = persons?.Where(t => delPersonsNum.Contains(t.PersonnelNumber)); var delPerson = persons?.Where(t => delPersonsNum.Contains(t.PersonnelNumber));
if (delPerson != null && delPerson.Any()) if (delPerson != null && delPerson.Any())
peremployeeRepository.RemoveRange(delPerson.ToArray()); peremployeeRepository.RemoveRange(delPerson.ToArray());
...@@ -911,6 +971,23 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan ...@@ -911,6 +971,23 @@ private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHan
return result; return result;
} }
public static List<(string, string, Func<PersonePassword, object>)> PersonPassword { get; } = new List<(string, string, Func<PersonePassword, object>)>
{
(nameof(PersonePassword.AccountingUnit), "核算单元", t => t.AccountingUnit),
(nameof(PersonePassword.Department), "科室名称", t => t.Department),
(nameof(PersonePassword.DoctorName), "姓名" ,t => t.DoctorName),
(nameof(PersonePassword.PersonnelNumber), "员工工号", t => t.PersonnelNumber),
(nameof(PersonePassword.JobCategory), "正式/临聘", t => t.JobCategory),
(nameof(PersonePassword.Duty), "职务", t => t.Duty),
(nameof(PersonePassword.JobTitle), "职称", t => t.JobTitle),
(nameof(PersonePassword.UnitType), "人员类别", t => t.UnitType),
(nameof(PersonePassword.AttendanceDay), "出勤天数", t => t.AttendanceDay),
(nameof(PersonePassword.ReservedRatio), "预留比例", t => t.ReservedRatio),
(nameof(PersonePassword.BankCard), "银行卡号", t => t.BankCard),
(nameof(PersonePassword.Password), "密码", t => t.Password),
(nameof(PersonePassword.Remark), "备注", t => t.Remark),
};
public static List<(string, string, Func<per_employee, object>)> Person { get; } = new List<(string, string, Func<per_employee, object>)> 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.AccountingUnit), "核算单元", t => t.AccountingUnit),
...@@ -1004,11 +1081,11 @@ public string GetPersonDictFile(int allotId, int userId) ...@@ -1004,11 +1081,11 @@ public string GetPersonDictFile(int allotId, int userId)
public bool ReloadPersonnel(int hospitalId, int allotId) public bool ReloadPersonnel(int hospitalId, int allotId)
{ {
var allotList = perallotRepository.GetEntities(w => w.HospitalId == hospitalId)?.OrderBy(s => s.Year).ThenBy(s => s.Month).ToList(); var allotList = perallotRepository.GetEntities(w => w.HospitalId == hospitalId)?.OrderBy(s => s.Year).ThenBy(s => s.Month).ToList();
if (allotList == null || !allotList.Any()) if (allotList == null || !allotList.Any())
throw new PerformanceException("加载失败,绩效记录不存在!"); throw new PerformanceException("加载失败,绩效记录不存在!");
var allot = allotList.FirstOrDefault(w => w.ID == allotId); var allot = allotList.FirstOrDefault(w => w.ID == allotId);
if (allot == null) if (allot == null)
throw new PerformanceException("加载失败,绩效记录不存在!"); throw new PerformanceException("加载失败,绩效记录不存在!");
var index = allotList.IndexOf(allot); var index = allotList.IndexOf(allot);
...@@ -1019,11 +1096,11 @@ public bool ReloadPersonnel(int hospitalId, int allotId) ...@@ -1019,11 +1096,11 @@ public bool ReloadPersonnel(int hospitalId, int allotId)
if (prevAllot == null) prevAllot.ID = -1; if (prevAllot == null) prevAllot.ID = -1;
var persons = peremployeeRepository.GetEntities(t => t.HospitalId == hospitalId && t.AllotId == prevAllot.ID); var persons = peremployeeRepository.GetEntities(t => t.HospitalId == hospitalId && t.AllotId == prevAllot.ID);
if (persons == null || !persons.Any()) if (persons == null || !persons.Any())
throw new PerformanceException("加载失败,未查询到上月人员信息!"); throw new PerformanceException("加载失败,未查询到上月人员信息!");
var i = peremployeeRepository.Execute($@"DELETE FROM per_employee WHERE HospitalId=@HospitalId and AllotId=@AllotId;", new { hospitalId, allotId }); var i = peremployeeRepository.Execute($@"DELETE FROM per_employee WHERE HospitalId=@HospitalId and AllotId=@AllotId;", new { hospitalId, allotId });
if (i <= 0) if (i <= 0)
throw new PerformanceException("加载失败,人员信息重置失败!"); throw new PerformanceException("加载失败,人员信息重置失败!");
int day = DateTime.DaysInMonth(allot.Year, allot.Month); int day = DateTime.DaysInMonth(allot.Year, allot.Month);
......
...@@ -129,12 +129,20 @@ public sys_role GetUserFirstRole(int userId) ...@@ -129,12 +129,20 @@ public sys_role GetUserFirstRole(int userId)
return role; return role;
} }
public List<int> GetUserHospital(int userId)
{
var userHospital = _userhospitalRepository.GetEntities(t => t.UserID == userId);
if (userHospital != null && userHospital.Any(w => w.HospitalID.HasValue))
return userHospital.Where(w => w.HospitalID.HasValue).Select(w => w.HospitalID.Value).ToList();
return new List<int>();
}
/// <summary> /// <summary>
/// 查询用户列表 /// 查询用户列表
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <returns></returns> /// <returns></returns>
public List<UserResponse> GetUserList(int userID) public List<UserResponse> GetUserList(int userID,int roleType=1)
{ {
var userRoles = _userroleRepository.GetEntities(); var userRoles = _userroleRepository.GetEntities();
var userHospitals = _userhospitalRepository.GetEntities(); var userHospitals = _userhospitalRepository.GetEntities();
...@@ -143,6 +151,18 @@ public List<UserResponse> GetUserList(int userID) ...@@ -143,6 +151,18 @@ public List<UserResponse> GetUserList(int userID)
var roles = _roleRepository.GetEntities(); var roles = _roleRepository.GetEntities();
var userrole = userRoles?.FirstOrDefault(t => t.UserID == userID); var userrole = userRoles?.FirstOrDefault(t => t.UserID == userID);
if (roleType == 12)
{
var jxQuery = userRoles.Where(t=>t.RoleID==roles?.FirstOrDefault(c=>c.RoleName=="绩效查询")?.ID).Select(t => t.UserID);
users = users.Where(t => jxQuery.Contains(t.ID)).ToList();
}
else
{
var jxQuery = userRoles.Where(t =>roles.Where(c => c.RoleName != "绩效查询").Select(c=>c.ID).Contains(t.RoleID)).Select(t => t.UserID);
users = users.Where(t => jxQuery.Contains(t.ID)).ToList();
}
if (userrole == null) if (userrole == null)
throw new PerformanceException("用户未配置角色"); throw new PerformanceException("用户未配置角色");
var role = roles?.FirstOrDefault(t => t.ID == userrole.RoleID); var role = roles?.FirstOrDefault(t => t.ID == userrole.RoleID);
...@@ -727,6 +747,11 @@ public HandsonTable GetUserHandsFlat() ...@@ -727,6 +747,11 @@ public HandsonTable GetUserHandsFlat()
return result; return result;
} }
/// <summary>
/// 批量保存用户
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public string SaveUserHandsFlat(UserCollectData request) public string SaveUserHandsFlat(UserCollectData request)
{ {
try try
......
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