Commit 6d1539c3 by 李承祥

新增绩效医院是增加是否开放年资系数,修改copy方法。人员名单不上传是,根据年月倒序取最后一次的人员名单。对于绩效人员的增删改。

parent 6e63e344
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Services;
namespace Performance.Api.Controllers
{
[Route("api/[controller]")]
public class EmployeeController : Controller
{
private EmployeeService employeeService;
public EmployeeController(EmployeeService employeeService)
{
this.employeeService = employeeService;
}
/// <summary>
/// 新增人员
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("insert")]
[HttpPost]
public ApiResponse Insert([CustomizeValidator(RuleSet = "Insert"), FromBody]EmployeeRequest request)
{
var employee = employeeService.Insert(request);
return new ApiResponse(ResponseType.OK, "ok", employee);
}
/// <summary>
/// 修改人员
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("update")]
[HttpPost]
public ApiResponse Update([CustomizeValidator(RuleSet = "Update"), FromBody]EmployeeRequest request)
{
var employee = employeeService.Update(request);
return new ApiResponse(ResponseType.OK, "ok", employee);
}
/// <summary>
/// 删除人员
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("delete")]
[HttpPost]
public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody]EmployeeRequest request)
{
if (!employeeService.Delete(request))
return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK);
}
}
}
\ No newline at end of file
...@@ -70,6 +70,7 @@ public AutoMapperConfigs() ...@@ -70,6 +70,7 @@ public AutoMapperConfigs()
.ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => src.UnitType == "医生组" ? 1 : (src.UnitType == "护理组" ? 2 : 0))); .ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => src.UnitType == "医生组" ? 1 : (src.UnitType == "护理组" ? 2 : 0)));
CreateMap<PerDataEmployee, im_employee>(); CreateMap<PerDataEmployee, im_employee>();
CreateMap<im_employee, PerDataEmployee>();
CreateMap<PerDataAccountBaisc, PerDataAccountDoctor>() CreateMap<PerDataAccountBaisc, PerDataAccountDoctor>()
.ForMember(dest => dest.AccountingUnit, opt => opt.MapFrom(src => src.AccountingUnit)) .ForMember(dest => dest.AccountingUnit, opt => opt.MapFrom(src => src.AccountingUnit))
...@@ -126,6 +127,7 @@ public AutoMapperConfigs() ...@@ -126,6 +127,7 @@ public AutoMapperConfigs()
CreateMap<per_againallot, AgainAllotResponse>(); CreateMap<per_againallot, AgainAllotResponse>();
CreateMap<res_compute, ComputeResponse>(); CreateMap<res_compute, ComputeResponse>();
CreateMap<EmployeeRequest, im_employee>();
} }
} }
} }
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class EmployeeRequest
{
/// <summary>
///
/// </summary>
public int ID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> AllotID { get; set; }
/// <summary>
/// sheet页id
/// </summary>
public Nullable<int> SheetID { get; set; }
/// <summary>
/// 科室类别(例如 医技科室 临床科室 其他科室)
/// </summary>
public string AccountType { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 科室名称
/// </summary>
public string Department { get; set; }
/// <summary>
/// 绩效基数核算参考对象
/// </summary>
public string FitPeople { get; set; }
/// <summary>
/// 医生姓名
/// </summary>
public string DoctorName { get; set; }
/// <summary>
/// 职称
/// </summary>
public string JobTitle { get; set; }
/// <summary>
/// 岗位系数
/// </summary>
public Nullable<decimal> PostCoefficient { get; set; }
/// <summary>
/// 参加工作时间
/// </summary>
public Nullable<DateTime> WorkTime { get; set; }
/// <summary>
/// 考核得分率
/// </summary>
public Nullable<decimal> ScoreAverageRate { get; set; }
/// <summary>
/// 出勤率
/// </summary>
public Nullable<decimal> Attendance { get; set; }
/// <summary>
/// 核算单元医生数
/// </summary>
public Nullable<int> PeopleNumber { get; set; }
/// <summary>
/// 工作量绩效
/// </summary>
public Nullable<decimal> Workload { get; set; }
/// <summary>
/// 其他绩效
/// </summary>
public Nullable<decimal> OtherPerfor { get; set; }
/// <summary>
/// 医院奖罚
/// </summary>
public Nullable<decimal> Punishment { get; set; }
/// <summary>
/// 调节系数
/// </summary>
public Nullable<decimal> Adjust { get; set; }
/// <summary>
/// 发放系数
/// </summary>
public Nullable<decimal> Grant { get; set; }
public class EmployeeRequestValidator : AbstractValidator<EmployeeRequest>
{
public EmployeeRequestValidator()
{
Action action = () =>
{
RuleFor(x => x.AllotID).NotNull().NotEmpty();
RuleFor(x => x.SheetID).NotNull().NotEmpty();
RuleFor(x => x.AccountingUnit).NotNull().NotEmpty();
RuleFor(x => x.DoctorName).NotNull().NotEmpty();
};
RuleSet("Insert", () =>
{
action();
});
RuleSet("Update", () =>
{
action();
RuleFor(x => x.ID).NotNull().GreaterThan(0);
});
RuleSet("Delete", () =>
{
RuleFor(x => x.ID).NotNull().GreaterThan(0);
});
}
}
}
}
...@@ -32,9 +32,13 @@ public class HospitalRequest : ApiRequest ...@@ -32,9 +32,13 @@ public class HospitalRequest : ApiRequest
/// </summary> /// </summary>
public string HosType { get; set; } public string HosType { get; set; }
/// <summary> /// <summary>
/// /// 医院状态 1 启用 2 禁用
/// </summary> /// </summary>
public Nullable<int> States { get; set; } public Nullable<int> States { get; set; }
/// <summary>
/// 是否开启年资系数 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenWorkYear { get; set; }
} }
public class HospitalRequestValidator : AbstractValidator<HospitalRequest> public class HospitalRequestValidator : AbstractValidator<HospitalRequest>
...@@ -47,6 +51,7 @@ public HospitalRequestValidator() ...@@ -47,6 +51,7 @@ public HospitalRequestValidator()
RuleFor(x => x.AreaCode).NotNull().NotEmpty().Length(1, 50); RuleFor(x => x.AreaCode).NotNull().NotEmpty().Length(1, 50);
RuleFor(x => x.HosLevel).NotNull().NotEmpty().Length(1, 50); RuleFor(x => x.HosLevel).NotNull().NotEmpty().Length(1, 50);
RuleFor(x => x.HosType).NotNull().NotEmpty().Length(1, 50); RuleFor(x => x.HosType).NotNull().NotEmpty().Length(1, 50);
RuleFor(x => x.IsOpenWorkYear).NotNull().InclusiveBetween(1, 2);
}; };
RuleSet("Insert", () => RuleSet("Insert", () =>
......
...@@ -60,5 +60,10 @@ public class sys_hospital ...@@ -60,5 +60,10 @@ public class sys_hospital
/// 医院状态 1 启用 2 禁用 /// 医院状态 1 启用 2 禁用
/// </summary> /// </summary>
public Nullable<int> States { get; set; } public Nullable<int> States { get; set; }
/// <summary>
/// 是否开启年资系数 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenWorkYear { get; set; }
} }
} }
...@@ -21,6 +21,7 @@ public class ImportDataService : IAutoInjection ...@@ -21,6 +21,7 @@ public class ImportDataService : IAutoInjection
{ {
private PerSheetService perSheetService; private PerSheetService perSheetService;
private PerforPersheetRepository perforPerSheetRepository; private PerforPersheetRepository perforPerSheetRepository;
private PerforPerallotRepository perforPerallotRepository;
private PerforImdataRepository perforImDataRepository; private PerforImdataRepository perforImDataRepository;
private PerforImheaderRepository perforImHeaderRepository; private PerforImheaderRepository perforImHeaderRepository;
private PerforImemployeeRepository perforImEmployeeRepository; private PerforImemployeeRepository perforImEmployeeRepository;
...@@ -29,6 +30,7 @@ public class ImportDataService : IAutoInjection ...@@ -29,6 +30,7 @@ public class ImportDataService : IAutoInjection
private PerforLogdbugRepository logdbug; private PerforLogdbugRepository logdbug;
public ImportDataService(PerSheetService perSheetService, public ImportDataService(PerSheetService perSheetService,
PerforPersheetRepository perforPerSheetRepository, PerforPersheetRepository perforPerSheetRepository,
PerforPerallotRepository perforPerallotRepository,
PerforImdataRepository perforImDataRepository, PerforImdataRepository perforImDataRepository,
PerforImheaderRepository perforImHeaderRepository, PerforImheaderRepository perforImHeaderRepository,
PerforImemployeeRepository perforImEmployeeRepository, PerforImemployeeRepository perforImEmployeeRepository,
...@@ -38,6 +40,7 @@ public class ImportDataService : IAutoInjection ...@@ -38,6 +40,7 @@ public class ImportDataService : IAutoInjection
{ {
this.perSheetService = perSheetService; this.perSheetService = perSheetService;
this.perforPerSheetRepository = perforPerSheetRepository; this.perforPerSheetRepository = perforPerSheetRepository;
this.perforPerallotRepository = perforPerallotRepository;
this.perforImDataRepository = perforImDataRepository; this.perforImDataRepository = perforImDataRepository;
this.perforImHeaderRepository = perforImHeaderRepository; this.perforImHeaderRepository = perforImHeaderRepository;
this.perforImEmployeeRepository = perforImEmployeeRepository; this.perforImEmployeeRepository = perforImEmployeeRepository;
...@@ -105,6 +108,22 @@ private void SaveEmployee(PerSheet sheet, int allotId) ...@@ -105,6 +108,22 @@ private void SaveEmployee(PerSheet sheet, int allotId)
var imsheet = new per_sheet { AllotID = allotId, SheetName = sheet.SheetName, Source = 1, SheetType = (int)sheet.SheetType }; var imsheet = new per_sheet { AllotID = allotId, SheetName = sheet.SheetName, Source = 1, SheetType = (int)sheet.SheetType };
perforPerSheetRepository.Add(imsheet); perforPerSheetRepository.Add(imsheet);
var dataList = sheet.PerData.Select(t => (PerDataEmployee)t); var dataList = sheet.PerData.Select(t => (PerDataEmployee)t);
//新上传名单中无人员名单,取到最后日期的数据
if (dataList == null || dataList.Count() <= 0)
{
var allot = perforPerallotRepository.GetEntity(t => t.ID == allotId);
var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == allot.HospitalId)
.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month);
foreach (var item in allotList)
{
var employeeList = perforImEmployeeRepository.GetEntities(t => t.AllotID == item.ID);
if (employeeList != null && employeeList.Count > 0)
{
dataList = Mapper.Map<List<PerDataEmployee>>(employeeList);
break;
}
}
}
List<im_employee> addList = new List<im_employee>(); List<im_employee> addList = new List<im_employee>();
foreach (var data in dataList) foreach (var data in dataList)
{ {
......
...@@ -19,6 +19,7 @@ public class ConfigService : IAutoInjection ...@@ -19,6 +19,7 @@ public class ConfigService : IAutoInjection
private PerforCofagainRepository _againRepository; private PerforCofagainRepository _againRepository;
private PerforPerallotRepository perforPerAllotRepository; private PerforPerallotRepository perforPerAllotRepository;
private PerforPeragainallotRepository perforPeragainallotRepository; private PerforPeragainallotRepository perforPeragainallotRepository;
private PerforHospitalRepository perforHospitalRepository;
private PerforLogdbugRepository logdbug; private PerforLogdbugRepository logdbug;
public ConfigService(PerforCofdirectorRepository cofdirectorRepository, public ConfigService(PerforCofdirectorRepository cofdirectorRepository,
PerforCofdrugpropRepository cofdrugpropRepository, PerforCofdrugpropRepository cofdrugpropRepository,
...@@ -27,6 +28,7 @@ public class ConfigService : IAutoInjection ...@@ -27,6 +28,7 @@ public class ConfigService : IAutoInjection
PerforCofagainRepository againRepository, PerforCofagainRepository againRepository,
PerforPerallotRepository perforPerAllotRepository, PerforPerallotRepository perforPerAllotRepository,
PerforPeragainallotRepository perforPeragainallotRepository, PerforPeragainallotRepository perforPeragainallotRepository,
PerforHospitalRepository perforHospitalRepository,
PerforLogdbugRepository logdbug) PerforLogdbugRepository logdbug)
{ {
this._directorRepository = cofdirectorRepository; this._directorRepository = cofdirectorRepository;
...@@ -36,6 +38,7 @@ public class ConfigService : IAutoInjection ...@@ -36,6 +38,7 @@ public class ConfigService : IAutoInjection
this._againRepository = againRepository; this._againRepository = againRepository;
this.perforPerAllotRepository = perforPerAllotRepository; this.perforPerAllotRepository = perforPerAllotRepository;
this.perforPeragainallotRepository = perforPeragainallotRepository; this.perforPeragainallotRepository = perforPeragainallotRepository;
this.perforHospitalRepository = perforHospitalRepository;
this.logdbug = logdbug; this.logdbug = logdbug;
} }
...@@ -329,6 +332,9 @@ public void Copy(per_allot allot) ...@@ -329,6 +332,9 @@ public void Copy(per_allot allot)
{ {
var workyear = _workyearRepository.GetEntities(t => t.AllotID == allotId) ?? _workyearRepository.GetEntities(t => t.AllotID == -1); var workyear = _workyearRepository.GetEntities(t => t.AllotID == allotId) ?? _workyearRepository.GetEntities(t => t.AllotID == -1);
var newWorkyears = workyear.Select(t => new cof_workyear { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = t.Value }); var newWorkyears = workyear.Select(t => new cof_workyear { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = t.Value });
var hospital = perforHospitalRepository.GetEntity(t => t.ID == allot.HospitalId);
if (hospital != null && hospital?.IsOpenWorkYear == 2)
newWorkyears = workyear.Select(t => new cof_workyear { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = 1 });
_workyearRepository.AddRange(newWorkyears.ToArray()); _workyearRepository.AddRange(newWorkyears.ToArray());
} }
} }
......
using AutoMapper;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Repository;
using Performance.Services.AllotCompute;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Performance.Services
{
public class EmployeeService : IAutoInjection
{
private PerforImemployeeRepository perforImemployeeRepository;
public EmployeeService(PerforImemployeeRepository perforImemployeeRepository)
{
this.perforImemployeeRepository = perforImemployeeRepository;
}
/// <summary>
/// 新增人员
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public im_employee Insert(EmployeeRequest request)
{
var employee = Mapper.Map<im_employee>(request);
perforImemployeeRepository.Add(employee);
return employee;
}
/// <summary>
/// 修改人员
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public im_employee Update(EmployeeRequest request)
{
var employee = perforImemployeeRepository.GetEntity(t => t.ID == request.ID);
if (employee == null)
throw new PerformanceException("该人员不存在");
employee.AccountingUnit = request.AccountingUnit;
employee.Department = request.Department ?? employee.Department;
employee.FitPeople = request.FitPeople ?? employee.FitPeople;
employee.DoctorName = request.DoctorName;
employee.JobTitle = request.JobTitle ?? employee.JobTitle;
perforImemployeeRepository.Update(employee);
return employee;
}
/// <summary>
/// 删除人员
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public bool Delete(EmployeeRequest request)
{
var employee = Mapper.Map<im_employee>(request);
return perforImemployeeRepository.Remove(employee);
}
}
}
...@@ -98,6 +98,7 @@ public HospitalResponse Update(HospitalRequest request) ...@@ -98,6 +98,7 @@ public HospitalResponse Update(HospitalRequest request)
hospital.HosType = request.HosType; hospital.HosType = request.HosType;
hospital.AreaCode = request.AreaCode; hospital.AreaCode = request.AreaCode;
hospital.States = request.States; hospital.States = request.States;
hospital.IsOpenWorkYear = request.IsOpenWorkYear;
if (!_hospitalRepository.Update(hospital)) if (!_hospitalRepository.Update(hospital))
throw new PerformanceException("保存失败"); throw new PerformanceException("保存失败");
......
...@@ -188,7 +188,7 @@ private void CommonExport(int sheetID, SheetExportResponse response) ...@@ -188,7 +188,7 @@ private void CommonExport(int sheetID, SheetExportResponse response)
factorhead.Data.Add(new Cell(0, "护理组分割比例:", 1, 3, false, false)); factorhead.Data.Add(new Cell(0, "护理组分割比例:", 1, 3, false, false));
response = AddFactor(response, factorhead, headList.ToList(), dataList, "护理组"); response = AddFactor(response, factorhead, headList.ToList(), dataList, "护理组");
var factorhead1 = new Row(response.Header.Count()); var factorhead1 = new Row(response.Header.Count());
factorhead1.Data.Add(new Cell(0, "医生组分割比例:", 1, 3, false, false)); factorhead1.Data.Add(new Cell(0, "医生组分割比例:", 1, 3, false, false));
response = AddFactor(response, factorhead1, headList.ToList(), dataList, "医生组"); response = AddFactor(response, factorhead1, headList.ToList(), dataList, "医生组");
} }
......
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