Commit c1a948f2 by lcx

医院人员分配额外金额,注释部分配置

parent b412f956
......@@ -29,7 +29,7 @@ public EmployeeController(EmployeeService employeeService, ClaimService claim)
/// <returns></returns>
[Route("getlist")]
[HttpPost]
public ApiResponse GetEmployeeList([CustomizeValidator(RuleSet = "Select"), FromBody]EmployeeRequest request)
public ApiResponse GetEmployeeList([CustomizeValidator(RuleSet = "Select"), FromBody] EmployeeRequest request)
{
var employee = employeeService.GetEmployeeList(request.AllotID, claim.GetUserId());
return new ApiResponse(ResponseType.OK, "ok", employee);
......@@ -42,7 +42,7 @@ public ApiResponse GetEmployeeList([CustomizeValidator(RuleSet = "Select"), From
/// <returns></returns>
[Route("insert")]
[HttpPost]
public ApiResponse Insert([CustomizeValidator(RuleSet = "Insert"), FromBody]EmployeeRequest request)
public ApiResponse Insert([CustomizeValidator(RuleSet = "Insert"), FromBody] EmployeeRequest request)
{
var employee = employeeService.Insert(request);
return new ApiResponse(ResponseType.OK, "ok", employee);
......@@ -55,7 +55,7 @@ public ApiResponse Insert([CustomizeValidator(RuleSet = "Insert"), FromBody]Empl
/// <returns></returns>
[Route("update")]
[HttpPost]
public ApiResponse Update([CustomizeValidator(RuleSet = "Update"), FromBody]EmployeeRequest request)
public ApiResponse Update([CustomizeValidator(RuleSet = "Update"), FromBody] EmployeeRequest request)
{
var employee = employeeService.Update(request);
return new ApiResponse(ResponseType.OK, "ok", employee);
......@@ -68,7 +68,7 @@ public ApiResponse Update([CustomizeValidator(RuleSet = "Update"), FromBody]Empl
/// <returns></returns>
[Route("delete")]
[HttpPost]
public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody]EmployeeRequest request)
public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody] EmployeeRequest request)
{
if (!employeeService.Delete(request))
return new ApiResponse(ResponseType.Fail);
......@@ -82,7 +82,7 @@ public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody]Empl
/// <returns></returns>
[Route("clinic/getlist")]
[HttpPost]
public ApiResponse GetEmployeeClinicList([CustomizeValidator(RuleSet = "Select"), FromBody]im_employee_clinic request)
public ApiResponse GetEmployeeClinicList([FromBody] im_employee_clinic request)
{
//if ((request.AllotID ?? 0) == 0)
// return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
......@@ -98,7 +98,7 @@ public ApiResponse GetEmployeeClinicList([CustomizeValidator(RuleSet = "Select")
/// <returns></returns>
[Route("clinic/insert")]
[HttpPost]
public ApiResponse InsertClinic([CustomizeValidator(RuleSet = "Insert"), FromBody]im_employee_clinic request)
public ApiResponse InsertClinic([FromBody] im_employee_clinic request)
{
if ((request.AllotID ?? 0) == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
......@@ -120,7 +120,7 @@ public ApiResponse InsertClinic([CustomizeValidator(RuleSet = "Insert"), FromBod
/// <returns></returns>
[Route("clinic/update")]
[HttpPost]
public ApiResponse UpdateClinic([CustomizeValidator(RuleSet = "Update"), FromBody]im_employee_clinic request)
public ApiResponse UpdateClinic([FromBody] im_employee_clinic request)
{
if ((request.AllotID ?? 0) == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
......@@ -141,7 +141,7 @@ public ApiResponse UpdateClinic([CustomizeValidator(RuleSet = "Update"), FromBod
/// <returns></returns>
[Route("clinic/delete")]
[HttpPost]
public ApiResponse DeleteClinic([CustomizeValidator(RuleSet = "Delete"), FromBody]im_employee_clinic request)
public ApiResponse DeleteClinic([FromBody] im_employee_clinic request)
{
if (request.ID == 0)
return new ApiResponse(ResponseType.ParameterError, "参数ID无效!");
......@@ -163,5 +163,71 @@ public ApiResponse Audit(int allotid)
var result = employeeService.Audit(allotid);
return result ? new ApiResponse(ResponseType.OK, "提交成功") : new ApiResponse(ResponseType.Fail, "提交失败");
}
/// <summary>
/// 获取人员补充绩效列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("apr/getlist")]
[HttpPost]
public ApiResponse GetAprList([FromBody] per_apr_amount request)
{
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.GetAprList(request.AllotId);
return new ApiResponse(ResponseType.OK, "ok", employee);
}
/// <summary>
/// 新增人员补充绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("apr/insert")]
[HttpPost]
public ApiResponse InsertApr([FromBody] per_apr_amount request)
{
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.InsertApr(request, claim.GetUserId());
return new ApiResponse(ResponseType.OK, "ok", employee);
}
/// <summary>
/// 修改人员补充绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("apr/update")]
[HttpPost]
public ApiResponse UpdateApr([FromBody] per_apr_amount request)
{
if (request.AllotId == 0)
return new ApiResponse(ResponseType.ParameterError, "参数AllotId无效!");
var employee = employeeService.UpdateApr(request);
return new ApiResponse(ResponseType.OK, "ok", employee);
}
/// <summary>
/// 删除人员补充绩效
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("apr/delete")]
[HttpPost]
public ApiResponse DeleteApr([FromBody] per_apr_amount request)
{
if (request.Id == 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效!");
if (!employeeService.DeleteApr(request.Id))
return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK);
}
}
}
\ No newline at end of file
......@@ -551,6 +551,34 @@
<param name="allotid"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.EmployeeController.GetAprList(Performance.EntityModels.per_apr_amount)">
<summary>
获取人员补充绩效列表
</summary>
<param name="request"></param>
<returns></returns>
</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)">
<summary>
删除人员补充绩效
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.GuaranteeController.Guarantee(Performance.DtoModels.GuaranteeRequest)">
<summary>
保底绩效配置列表
......
......@@ -142,6 +142,9 @@
<member name="P:Performance.EntityModels.PerformanceDbContext.per_allot">
<summary> 医院绩效分配 </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.per_apr_amount">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.per_budget_amount">
<summary> 预算管理金额 </summary>
</member>
......@@ -2595,7 +2598,7 @@
</member>
<member name="P:Performance.EntityModels.per_allot.Generate">
<summary>
1、人事科提交重新生成
1、人事科提交重新生成 2、生成成功 3、原始数据修改
</summary>
</member>
<member name="P:Performance.EntityModels.per_allot.ShowFormula">
......@@ -2603,6 +2606,51 @@
0 不显示 1 显示
</summary>
</member>
<member name="T:Performance.EntityModels.per_apr_amount">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount.Id">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount.AllotId">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount.PersonnelNumber">
<summary>
人员工号
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount.DoctorName">
<summary>
医生姓名
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount.PerforType">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount.Amount">
<summary>
金额
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount.CreateDate">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.per_apr_amount.CreateUser">
<summary>
</summary>
</member>
<member name="T:Performance.EntityModels.per_budget_amount">
<summary>
预算管理金额
......
......@@ -104,6 +104,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<per_againallot> per_againallot { get; set; }
/// <summary> 医院绩效分配 </summary>
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_budget_amount> per_budget_amount { get; set; }
/// <summary> 预算管理占比 </summary>
......
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// <copyright file=" ag_workload_type.cs">
// * FileName: .cs
// </copyright>
......
......@@ -82,7 +82,7 @@ public class per_allot
public Nullable<int> IsExtracting { get; set; }
/// <summary>
/// 1、人事科提交重新生成
/// 1、人事科提交重新生成 2、生成成功 3、原始数据修改
/// </summary>
public int Generate { get; set; }
......
//-----------------------------------------------------------------------
// <copyright file=" per_apr_amount.cs">
// * FileName: .cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("per_apr_amount")]
public class per_apr_amount
{
/// <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 Nullable<DateTime> CreateDate { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> CreateUser { get; set; }
}
}
......@@ -86,25 +86,70 @@ public int SupplementaryData(int allotid)
{
using (var connection = context.Database.GetDbConnection())
{
var sql = @"insert into cof_drugtype(allotid,charge) select
#region MyRegion
// var sql = @"insert into cof_drugtype(allotid,charge) select
//distinct @allotid allotid,typename charge
//from per_sheet sheet
// inner join im_data im on sheet.id = im.sheetid
// left join cof_drugtype dtype on sheet.allotid = dtype.allotid
// and im.typename != dtype.charge
//where sheet.allotid = @allotid and sheet.sheettype = 3 and im.typename not in
// (select charge from cof_drugtype where allotid = @allotid);
//insert into cof_depttype(allotid,charge) select
//distinct @allotid allotid,department charge
//from per_sheet sheet
// inner join im_data im on sheet.id = im.sheetid
// left join cof_depttype dtype on sheet.allotid = dtype.allotid
// and im.department != dtype.charge
//where sheet.allotid = @allotid and sheet.sheettype = 9 and im.department not in
// (select charge from cof_depttype where allotid = @allotid);";
#endregion
List<string> sqls = new List<string>
{
@"insert into cof_drugtype(allotid,charge) select
distinct @allotid allotid,typename charge
from per_sheet sheet
inner join im_data im on sheet.id = im.sheetid
left join cof_drugtype dtype on sheet.allotid = dtype.allotid
and im.typename != dtype.charge
where sheet.allotid = @allotid and sheet.sheettype = 3 and im.typename not in
(select charge from cof_drugtype where allotid = @allotid);
(select charge from cof_drugtype where allotid = @allotid);",
insert into cof_depttype(allotid,charge) select
@"insert into cof_depttype(allotid,charge) select
distinct @allotid allotid,department charge
from per_sheet sheet
inner join im_data im on sheet.id = im.sheetid
left join cof_depttype dtype on sheet.allotid = dtype.allotid
and im.department != dtype.charge
where sheet.allotid = @allotid and sheet.sheettype = 9 and im.department not in
(select charge from cof_depttype where allotid = @allotid);";
(select charge from cof_depttype where allotid = @allotid);",
@"insert into per_apr_amount(AllotId, PersonnelNumber, DoctorName)
select distinct @allotid AllotId, t.PersonnelNumber, t.DoctorName from
(
select AllotId,PeopleNumber PersonnelNumber,DoctorName from im_employee where allotid = @allotid
union all
select AllotId,PersonnelNumber,DoctorName from im_employee_clinic where allotid = @allotid
) t where DoctorName not in (select DoctorName from per_apr_amount where allotid = @allotid);"
};
return connection.Execute(sql, new { allotid }, commandTimeout: 60 * 60);
int flag = 0;
foreach (var sql in sqls)
{
try
{
flag = connection.Execute(sql, new { allotid }, commandTimeout: 60 * 60);
}
catch(Exception ex)
{
}
}
return flag;
}
}
}
......
//-----------------------------------------------------------------------
// <copyright file=" per_apr_amount.cs">
// * FileName: per_apr_amount.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// per_apr_amount Repository
/// </summary>
public partial class PerforPerapramountRepository : PerforRepository<per_apr_amount>
{
public PerforPerapramountRepository(PerformanceDbContext context) : base(context)
{
}
}
}
......@@ -15,17 +15,12 @@ namespace Performance.Services
public class ComputeService : IAutoInjection
{
private readonly PerforResaccountRepository perforResaccountRepository;
//private readonly PerforResaccountnurseRepository _perforResAccountnurseRepository;
private readonly PerforPersheetRepository _perforPerSheetRepository;
private readonly PerforImdataRepository _perforImDataRepository;
private readonly PerforImheaderRepository _perforImheaderRepository;
private readonly PerforRescomputeRepository _perforRescomputeRepository;
private readonly PerforResspecialunitRepository _perforResspecialunitRepository;
private readonly PerforPeragainallotRepository _perforPeragainallotRepository;
private readonly PerforUserRepository _perforUserRepository;
private readonly PerforAgemployeeRepository _perforAgemployeeRepository;
private readonly PerforResbaiscnormRepository perforResbaiscnormRepository;
private readonly PerforCofincomeRepository _perforCofincomeRepository;
private readonly PerforAgsecondallotRepository _perforAgsecondallotRepository;
private readonly PerforAgcomputeRepository _perforAgcomputeRepository;
private readonly PerforImemployeeclinicRepository _perforImemployeeclinicRepository;
......@@ -34,17 +29,12 @@ public class ComputeService : IAutoInjection
private readonly PerforHospitalRepository hospitalRepository;
public ComputeService(PerforResaccountRepository perforResaccountRepository,
//PerforResaccountnurseRepository perforResAccountnurseRepository,
PerforPersheetRepository perforPerSheetRepository,
PerforImdataRepository perforImDataRepository,
PerforImheaderRepository perforImheaderRepository,
PerforRescomputeRepository perforRescomputeRepository,
PerforResspecialunitRepository perforResspecialunitRepository,
PerforPeragainallotRepository perforPeragainallotRepository,
PerforUserRepository perforUserRepository,
PerforAgemployeeRepository perforAgemployeeRepository,
PerforResbaiscnormRepository perforResbaiscnormRepository,
PerforCofincomeRepository perforCofincomeRepository,
PerforAgsecondallotRepository perforAgsecondallotRepository,
PerforAgcomputeRepository perforAgcomputeRepository,
PerforImemployeeclinicRepository perforImemployeeclinicRepository,
......@@ -53,17 +43,12 @@ public class ComputeService : IAutoInjection
PerforHospitalRepository hospitalRepository)
{
this.perforResaccountRepository = perforResaccountRepository;
//this._perforResAccountnurseRepository = perforResAccountnurseRepository;
this._perforPerSheetRepository = perforPerSheetRepository;
this._perforImDataRepository = perforImDataRepository;
this._perforImheaderRepository = perforImheaderRepository;
this._perforRescomputeRepository = perforRescomputeRepository;
this._perforResspecialunitRepository = perforResspecialunitRepository;
this._perforPeragainallotRepository = perforPeragainallotRepository;
this._perforUserRepository = perforUserRepository;
this._perforAgemployeeRepository = perforAgemployeeRepository;
this.perforResbaiscnormRepository = perforResbaiscnormRepository;
this._perforCofincomeRepository = perforCofincomeRepository;
this._perforAgsecondallotRepository = perforAgsecondallotRepository;
this._perforAgcomputeRepository = perforAgcomputeRepository;
this._perforImemployeeclinicRepository = perforImemployeeclinicRepository;
......
......@@ -16,110 +16,224 @@ public class ConfigService : IAutoInjection
#region
private PerforCofdirectorRepository _directorRepository;
private PerforCofdrugpropRepository _drugpropRepository;
private PerforCofincomeRepository _incomeRepository;
private PerforCofworkyearRepository _workyearRepository;
private PerforCofworkitemRepository _workitemRepository;
private PerforCofagainRepository _againRepository;
private PerforCofdrugtypeRepository _drugtypeRepository;
private PerforPerallotRepository perforPerAllotRepository;
private PerforPeragainallotRepository perforPeragainallotRepository;
private PerforHospitalRepository perforHospitalRepository;
private PerforPersheetRepository perforPersheetRepository;
private PerforImheaderRepository perforImheaderRepository;
private PerforCofdepttypeRepository perforCofdepttypeRepository;
//private PerforLogdbugRepository logdbug;
private PerforPerapramountRepository perapramountRepository;
private readonly LogManageService logManageService;
public ConfigService(PerforCofdirectorRepository cofdirectorRepository,
PerforCofdrugpropRepository cofdrugpropRepository,
PerforCofincomeRepository cofincomeRepository,
PerforCofworkyearRepository cofworkyearRepository,
PerforCofagainRepository againRepository,
PerforCofdrugtypeRepository drugtypeRepository,
PerforPerallotRepository perforPerAllotRepository,
PerforPeragainallotRepository perforPeragainallotRepository,
PerforHospitalRepository perforHospitalRepository,
PerforCofworkitemRepository workitemRepository,
PerforPersheetRepository perforPersheetRepository,
PerforImheaderRepository perforImheaderRepository,
PerforCofdepttypeRepository perforCofdepttypeRepository,
//PerforLogdbugRepository logdbug
PerforPerapramountRepository perapramountRepository,
LogManageService logManageService)
{
this._directorRepository = cofdirectorRepository;
this._drugpropRepository = cofdrugpropRepository;
this._incomeRepository = cofincomeRepository;
this._workyearRepository = cofworkyearRepository;
this._workitemRepository = workitemRepository;
this._againRepository = againRepository;
this._drugtypeRepository = drugtypeRepository;
this.perforPerAllotRepository = perforPerAllotRepository;
this.perforPeragainallotRepository = perforPeragainallotRepository;
this.perforHospitalRepository = perforHospitalRepository;
this.perforPersheetRepository = perforPersheetRepository;
this.perforImheaderRepository = perforImheaderRepository;
this.perforCofdepttypeRepository = perforCofdepttypeRepository;
//this.logdbug = logdbug;
this.perapramountRepository = perapramountRepository;
this.logManageService = logManageService;
}
#endregion
#region cof_director 规模/效率绩效配置
/// <summary>
/// 获取cof_director列表
/// </summary>
/// <returns></returns>
public List<DirectorResponse> GetDireList(int allotId)
{
var list = _directorRepository.GetEntities(t => t.AllotID == allotId);
return Mapper.Map<List<DirectorResponse>>(list);
}
/// <summary>
/// 添加数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DirectorResponse DireInsert(DirectorRequest request)
{
var director = Mapper.Map<cof_director>(request);
if (!_directorRepository.Add(director))
throw new PerformanceException("保存失败");
return Mapper.Map<DirectorResponse>(director);
}
/// <summary>
/// 更新数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DirectorResponse DireUpdate(DirectorRequest request)
{
var director = _directorRepository.GetEntity(t => t.ID == request.ID);
if (null == director)
throw new PerformanceException($"ID不存在 :{request.ID}");
director.TypeName = request.TypeName;
director.JobTitle = request.JobTitle;
director.Value = request.Value;
if (!_directorRepository.Update(director))
throw new PerformanceException("保存失败");
return Mapper.Map<DirectorResponse>(director);
}
/// <summary>
/// 删除数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public bool DireDelete(DirectorRequest request)
{
var director = _directorRepository.GetEntity(t => t.ID == request.ID);
if (null == director)
throw new PerformanceException($"ID不存在 :{request.ID}");
#region 弃用
//#region cof_director 规模/效率绩效配置
///// <summary>
///// 获取cof_director列表
///// </summary>
///// <returns></returns>
//public List<DirectorResponse> GetDireList(int allotId)
//{
// var list = _directorRepository.GetEntities(t => t.AllotID == allotId);
// return Mapper.Map<List<DirectorResponse>>(list);
//}
///// <summary>
///// 添加数据
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public DirectorResponse DireInsert(DirectorRequest request)
//{
// var director = Mapper.Map<cof_director>(request);
// if (!_directorRepository.Add(director))
// throw new PerformanceException("保存失败");
// return Mapper.Map<DirectorResponse>(director);
//}
///// <summary>
///// 更新数据
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public DirectorResponse DireUpdate(DirectorRequest request)
//{
// var director = _directorRepository.GetEntity(t => t.ID == request.ID);
// if (null == director)
// throw new PerformanceException($"ID不存在 :{request.ID}");
// director.TypeName = request.TypeName;
// director.JobTitle = request.JobTitle;
// director.Value = request.Value;
// if (!_directorRepository.Update(director))
// throw new PerformanceException("保存失败");
// return Mapper.Map<DirectorResponse>(director);
//}
///// <summary>
///// 删除数据
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public bool DireDelete(DirectorRequest request)
//{
// var director = _directorRepository.GetEntity(t => t.ID == request.ID);
// if (null == director)
// throw new PerformanceException($"ID不存在 :{request.ID}");
// return _directorRepository.Remove(director);
//}
//#endregion
//#region cof_income ICU有效收入配置
///// <summary>
///// 获取cof_income列表
///// </summary>
///// <returns></returns>
//public List<IncomeResponse> GetIncomeList(int allotId)
//{
// var list = _incomeRepository.GetEntities(T => T.AllotID == allotId);
// return Mapper.Map<List<IncomeResponse>>(list);
//}
///// <summary>
///// 添加数据
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public IncomeResponse IncomeInsert(IncomeRequest request)
//{
// var income = Mapper.Map<cof_income>(request);
// if (!_incomeRepository.Add(income))
// throw new PerformanceException("保存失败");
// return Mapper.Map<IncomeResponse>(income);
//}
///// <summary>
///// 更新数据
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public IncomeResponse IncomeUpdate(IncomeRequest request)
//{
// var income = _incomeRepository.GetEntity(t => t.ID == request.ID);
// if (null == income)
// throw new PerformanceException($"ID不存在 :{request.ID}");
// income.SheetNameKeyword = request.SheetNameKeyword;
// income.UnitName = request.UnitName;
// income.Value = request.Value;
// if (!_incomeRepository.Update(income))
// throw new PerformanceException("保存失败");
// return Mapper.Map<IncomeResponse>(income);
//}
///// <summary>
///// 删除数据
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public bool IncomeDelete(IncomeRequest request)
//{
// var income = _incomeRepository.GetEntity(t => t.ID == request.ID);
// if (null == income)
// throw new PerformanceException($"ID不存在 :{request.ID}");
// return _incomeRepository.Remove(income);
//}
//#endregion
//#region cof_workyear 年资系数配置
///// <summary>
///// 获取cof_drugprop列表
///// </summary>
///// <returns></returns>
//public List<WorkyearResponse> GetWorkList(int allotId)
//{
// var list = _workyearRepository.GetEntities(t => t.AllotID == allotId);
// return Mapper.Map<List<WorkyearResponse>>(list);
//}
///// <summary>
///// 添加数据
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public WorkyearResponse WorkInsert(WorkyearRequest request)
//{
// var workyear = Mapper.Map<cof_workyear>(request);
// if (!_workyearRepository.Add(workyear))
// throw new PerformanceException("保存失败");
// return Mapper.Map<WorkyearResponse>(workyear);
//}
///// <summary>
///// 更新数据
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public WorkyearResponse WorkUpdate(WorkyearRequest request)
//{
// var workyear = _workyearRepository.GetEntity(t => t.ID == request.ID);
// if (null == workyear)
// throw new PerformanceException($"ID不存在 :{request.ID}");
// workyear.MaxRange = request.MaxRange;
// workyear.MinRange = request.MinRange;
// workyear.Value = request.Value;
// if (!_workyearRepository.Update(workyear))
// throw new PerformanceException("保存失败");
// return Mapper.Map<WorkyearResponse>(workyear);
//}
///// <summary>
///// 删除数据
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public bool WorkDelete(WorkyearRequest request)
//{
// var workyear = _workyearRepository.GetEntity(t => t.ID == request.ID);
// if (null == workyear)
// throw new PerformanceException($"ID不存在 :{request.ID}");
// return _workyearRepository.Remove(workyear);
//}
//#endregion
return _directorRepository.Remove(director);
}
#endregion
#region cof_drugprop 药占比系数配置
......@@ -244,124 +358,6 @@ public bool DrugtypeDelete(DrugpropRequest request)
}
#endregion
#region cof_income ICU有效收入配置
/// <summary>
/// 获取cof_income列表
/// </summary>
/// <returns></returns>
public List<IncomeResponse> GetIncomeList(int allotId)
{
var list = _incomeRepository.GetEntities(T => T.AllotID == allotId);
return Mapper.Map<List<IncomeResponse>>(list);
}
/// <summary>
/// 添加数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public IncomeResponse IncomeInsert(IncomeRequest request)
{
var income = Mapper.Map<cof_income>(request);
if (!_incomeRepository.Add(income))
throw new PerformanceException("保存失败");
return Mapper.Map<IncomeResponse>(income);
}
/// <summary>
/// 更新数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public IncomeResponse IncomeUpdate(IncomeRequest request)
{
var income = _incomeRepository.GetEntity(t => t.ID == request.ID);
if (null == income)
throw new PerformanceException($"ID不存在 :{request.ID}");
income.SheetNameKeyword = request.SheetNameKeyword;
income.UnitName = request.UnitName;
income.Value = request.Value;
if (!_incomeRepository.Update(income))
throw new PerformanceException("保存失败");
return Mapper.Map<IncomeResponse>(income);
}
/// <summary>
/// 删除数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public bool IncomeDelete(IncomeRequest request)
{
var income = _incomeRepository.GetEntity(t => t.ID == request.ID);
if (null == income)
throw new PerformanceException($"ID不存在 :{request.ID}");
return _incomeRepository.Remove(income);
}
#endregion
#region cof_workyear 年资系数配置
/// <summary>
/// 获取cof_drugprop列表
/// </summary>
/// <returns></returns>
public List<WorkyearResponse> GetWorkList(int allotId)
{
var list = _workyearRepository.GetEntities(t => t.AllotID == allotId);
return Mapper.Map<List<WorkyearResponse>>(list);
}
/// <summary>
/// 添加数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public WorkyearResponse WorkInsert(WorkyearRequest request)
{
var workyear = Mapper.Map<cof_workyear>(request);
if (!_workyearRepository.Add(workyear))
throw new PerformanceException("保存失败");
return Mapper.Map<WorkyearResponse>(workyear);
}
/// <summary>
/// 更新数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public WorkyearResponse WorkUpdate(WorkyearRequest request)
{
var workyear = _workyearRepository.GetEntity(t => t.ID == request.ID);
if (null == workyear)
throw new PerformanceException($"ID不存在 :{request.ID}");
workyear.MaxRange = request.MaxRange;
workyear.MinRange = request.MinRange;
workyear.Value = request.Value;
if (!_workyearRepository.Update(workyear))
throw new PerformanceException("保存失败");
return Mapper.Map<WorkyearResponse>(workyear);
}
/// <summary>
/// 删除数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public bool WorkDelete(WorkyearRequest request)
{
var workyear = _workyearRepository.GetEntity(t => t.ID == request.ID);
if (null == workyear)
throw new PerformanceException($"ID不存在 :{request.ID}");
return _workyearRepository.Remove(workyear);
}
#endregion
#region cof_workitem 工作量绩效
/// <summary>
/// 获取cof_workitem列表
......@@ -482,6 +478,66 @@ public bool DepttypeDelete(DrugpropRequest request)
}
#endregion
#region cof_again
/// <summary>
/// 获取cof_drugprop列表
/// </summary>
/// <returns></returns>
public List<cof_again> GetAgainList(int allotId)
{
var list = _againRepository.GetEntities(t => t.AllotID == allotId);
return list;
}
/// <summary>
/// 添加数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public cof_again AgainInsert(CofAgainRequest request)
{
var again = Mapper.Map<cof_again>(request);
if (!_againRepository.Add(again))
throw new PerformanceException("保存失败");
return again;
}
/// <summary>
/// 更新数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public cof_again AgainUpdate(CofAgainRequest request)
{
var again = _againRepository.GetEntity(t => t.ID == request.ID);
if (null == again)
throw new PerformanceException($"ID不存在 :{request.ID}");
again.Type = request.Type;
again.Department = request.Department;
again.TypeName = request.TypeName;
again.Value = request.Value;
if (!_againRepository.Update(again))
throw new PerformanceException("保存失败");
return again;
}
/// <summary>
/// 删除数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public bool AgainDelete(CofAgainRequest request)
{
var again = _againRepository.GetEntity(t => t.ID == request.ID);
if (null == again)
throw new PerformanceException($"ID不存在 :{request.ID}");
return _againRepository.Remove(again);
}
#endregion
#region Copy
/// <summary>
/// 复制报表基础配置
......@@ -498,15 +554,42 @@ public void Copy(per_allot allot)
allotId = list[i - 1].ID;
}
var hospital = perforHospitalRepository.GetEntity(t => t.ID == allot.HospitalId);
var orgDirector = _directorRepository.GetEntities(t => t.AllotID == allot.ID);
if (orgDirector == null || orgDirector.Count == 0)
{
var director = _directorRepository.GetEntities(t => t.AllotID == allotId) ?? _directorRepository.GetEntities(t => t.AllotID == -1);
var newDirectors = director.Select(t => new cof_director { AllotID = allot.ID, JobTitle = t.JobTitle, TypeName = t.TypeName, Value = t.Value });
if (hospital != null && hospital?.IsOpenDirector == 2)
newDirectors = director.Select(t => new cof_director { AllotID = allot.ID, JobTitle = t.JobTitle, TypeName = t.TypeName, Value = 1 });
_directorRepository.AddRange(newDirectors.ToArray());
}
CopyAprData(allotId, allot.ID);
#region 弃用
//var orgDirector = _directorRepository.GetEntities(t => t.AllotID == allot.ID);
//if (orgDirector == null || orgDirector.Count == 0)
//{
// var director = _directorRepository.GetEntities(t => t.AllotID == allotId) ?? _directorRepository.GetEntities(t => t.AllotID == -1);
// var newDirectors = director.Select(t => new cof_director { AllotID = allot.ID, JobTitle = t.JobTitle, TypeName = t.TypeName, Value = t.Value });
// if (hospital != null && hospital?.IsOpenDirector == 2)
// newDirectors = director.Select(t => new cof_director { AllotID = allot.ID, JobTitle = t.JobTitle, TypeName = t.TypeName, Value = 1 });
// _directorRepository.AddRange(newDirectors.ToArray());
//}
//var orgIncome = _incomeRepository.GetEntities(t => t.AllotID == allot.ID);
//if (orgIncome == null || orgIncome.Count == 0)
//{
// var income = _incomeRepository.GetEntities(t => t.AllotID == allotId) ?? _incomeRepository.GetEntities(t => t.AllotID == -1);
// var newIncomes = income.Select(t => new cof_income { AllotID = allot.ID, SheetNameKeyword = t.SheetNameKeyword, UnitName = t.UnitName, Value = t.Value });
// if (hospital != null && hospital?.IsOpenIncome == 2)
// newIncomes = income.Select(t => new cof_income { AllotID = allot.ID, SheetNameKeyword = t.SheetNameKeyword, UnitName = t.UnitName, Value = 1 });
// _incomeRepository.AddRange(newIncomes.ToArray());
//}
//var orgWorkyear = _workyearRepository.GetEntities(t => t.AllotID == allot.ID);
//if (orgWorkyear == null || orgWorkyear.Count == 0)
//{
// 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 });
// if (hospital != null && hospital?.IsOpenWorkYear == 2)
// newWorkyears = new List<cof_workyear> { new cof_workyear { AllotID = allot.ID, MaxRange = 1000, MinRange = 0, Value = 1 } };
// _workyearRepository.AddRange(newWorkyears.ToArray());
//}
#endregion
var orgDurgprop = _drugpropRepository.GetEntities(t => t.AllotID == allot.ID);
if (orgDurgprop == null || orgDurgprop.Count == 0)
......@@ -518,24 +601,15 @@ public void Copy(per_allot allot)
_drugpropRepository.AddRange(newDurgprops.ToArray());
}
var orgIncome = _incomeRepository.GetEntities(t => t.AllotID == allot.ID);
if (orgIncome == null || orgIncome.Count == 0)
var workItem = _workitemRepository.GetEntities(t => t.AllotID == allot.ID);
if (hospital != null && hospital?.IsOpenDrugprop == 1 && (workItem == null || workItem.Count == 0))
{
var income = _incomeRepository.GetEntities(t => t.AllotID == allotId) ?? _incomeRepository.GetEntities(t => t.AllotID == -1);
var newIncomes = income.Select(t => new cof_income { AllotID = allot.ID, SheetNameKeyword = t.SheetNameKeyword, UnitName = t.UnitName, Value = t.Value });
if (hospital != null && hospital?.IsOpenIncome == 2)
newIncomes = income.Select(t => new cof_income { AllotID = allot.ID, SheetNameKeyword = t.SheetNameKeyword, UnitName = t.UnitName, Value = 1 });
_incomeRepository.AddRange(newIncomes.ToArray());
}
var orgWorkyear = _workyearRepository.GetEntities(t => t.AllotID == allot.ID);
if (orgWorkyear == null || orgWorkyear.Count == 0)
workItem = _workitemRepository.GetEntities(t => t.AllotID == allotId);
if (workItem != null && workItem.Count > 0)
{
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 });
if (hospital != null && hospital?.IsOpenWorkYear == 2)
newWorkyears = new List<cof_workyear> { new cof_workyear { AllotID = allot.ID, MaxRange = 1000, MinRange = 0, Value = 1 } };
_workyearRepository.AddRange(newWorkyears.ToArray());
var newWorkItem = workItem.Select(t => new cof_workitem { AllotID = allot.ID, Item = t.Item });
_workitemRepository.AddRange(newWorkItem.ToArray());
}
}
var cofDrugtype = _drugtypeRepository.GetEntities(t => t.AllotID == allot.ID);
......@@ -556,17 +630,6 @@ public void Copy(per_allot allot)
perforCofdepttypeRepository.AddRange(newAgains.ToArray());
}
var workItem = _workitemRepository.GetEntities(t => t.AllotID == allot.ID);
if (hospital != null && hospital?.IsOpenDrugprop == 1 && (workItem == null || workItem.Count == 0))
{
workItem = _workitemRepository.GetEntities(t => t.AllotID == allotId);
if (workItem != null && workItem.Count > 0)
{
var newWorkItem = workItem.Select(t => new cof_workitem { AllotID = allot.ID, Item = t.Item });
_workitemRepository.AddRange(newWorkItem.ToArray());
}
}
var data = _againRepository.GetEntities(t => t.AllotID == allot.ID);
if (data == null || data.Count == 0)
{
......@@ -579,66 +642,6 @@ public void Copy(per_allot allot)
}
#endregion
#region cof_again
/// <summary>
/// 获取cof_drugprop列表
/// </summary>
/// <returns></returns>
public List<cof_again> GetAgainList(int allotId)
{
var list = _againRepository.GetEntities(t => t.AllotID == allotId);
return list;
}
/// <summary>
/// 添加数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public cof_again AgainInsert(CofAgainRequest request)
{
var again = Mapper.Map<cof_again>(request);
if (!_againRepository.Add(again))
throw new PerformanceException("保存失败");
return again;
}
/// <summary>
/// 更新数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public cof_again AgainUpdate(CofAgainRequest request)
{
var again = _againRepository.GetEntity(t => t.ID == request.ID);
if (null == again)
throw new PerformanceException($"ID不存在 :{request.ID}");
again.Type = request.Type;
again.Department = request.Department;
again.TypeName = request.TypeName;
again.Value = request.Value;
if (!_againRepository.Update(again))
throw new PerformanceException("保存失败");
return again;
}
/// <summary>
/// 删除数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public bool AgainDelete(CofAgainRequest request)
{
var again = _againRepository.GetEntity(t => t.ID == request.ID);
if (null == again)
throw new PerformanceException($"ID不存在 :{request.ID}");
return _againRepository.Remove(again);
}
#endregion
#region 清楚无效数据 Clear
/// <summary>
/// 清楚无效数据
......@@ -688,5 +691,27 @@ 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;
if (list.Any(t => t.AllotId == allotId))
{
var prevData = list.Where(t => t.AllotId == prevAllotId);
var existData = list.Where(t => t.AllotId == allotId);
list = prevData.Where(t => !existData.Select(w => w.PersonnelNumber).Contains(t.PersonnelNumber)).ToList();
}
if (list.Any())
{
list.ForEach(t => t.AllotId = allotId);
perapramountRepository.AddRange(list.ToArray());
}
}
}
}
using AutoMapper;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using NPOI.SS.Util;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Infrastructure;
......@@ -21,12 +22,15 @@ public class EmployeeService : IAutoInjection
private PerforImemployeeclinicRepository perforImemployeeclinicRepository;
private PerforUserhospitalRepository perforUserhospitalRepository;
private PerforPerallotRepository perallotRepository;
private PerforPerapramountRepository perapramountRepository;
public EmployeeService(PerforImemployeeRepository perforImemployeeRepository,
PerforPersheetRepository perforPersheetRepository,
PerforPerallotRepository perforPerallotRepository,
PerforImemployeeclinicRepository perforImemployeeclinicRepository,
PerforUserhospitalRepository perforUserhospitalRepository,
PerforPerallotRepository perallotRepository)
PerforPerallotRepository perallotRepository,
PerforPerapramountRepository perapramountRepository)
{
this.perforImemployeeRepository = perforImemployeeRepository;
this.perforPersheetRepository = perforPersheetRepository;
......@@ -34,6 +38,7 @@ public class EmployeeService : IAutoInjection
this.perforImemployeeclinicRepository = perforImemployeeclinicRepository;
this.perforUserhospitalRepository = perforUserhospitalRepository;
this.perallotRepository = perallotRepository;
this.perapramountRepository = perapramountRepository;
}
#region 行政人员
......@@ -262,5 +267,54 @@ public bool Audit(int allotId)
allot.Generate = (int)AllotGenerate.PersonnelOffice;
return perforPerallotRepository.Update(allot);
}
public List<per_apr_amount> GetAprList(int allotId)
{
var list = perapramountRepository.GetEntities(t => t.AllotId == allotId);
if (list != null && list.Any())
list = list.OrderBy(t => t.DoctorName).ToList();
return list;
}
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("人员工号已存在");
request.CreateDate = DateTime.Now;
request.CreateUser = userId;
return perapramountRepository.Add(request);
}
public bool UpdateApr(per_apr_amount request)
{
if (request == null)
return false;
var data = perapramountRepository.GetEntity(t => t.Id == request.Id);
if (data == null)
throw new PerformanceException("修改数据无效");
data.PersonnelNumber = request.PersonnelNumber;
data.DoctorName = request.DoctorName;
data.PerforType = request.PerforType;
data.Amount = request.Amount;
return perapramountRepository.Add(request);
}
public bool DeleteApr(int id)
{
var data = perapramountRepository.GetEntity(t => t.Id == id);
if (data != null)
return perapramountRepository.Remove(data);
return true;
}
}
}
......@@ -14,16 +14,13 @@ namespace Performance.Services
public class PerSheetService : IAutoInjection
{
private PerHeaderService _perHeader;
private PerforCofincomeRepository _perforCofincomeRepository;
private PerforCofdrugpropRepository _perforCofdrugpropRepository;
private PerforCofdrugtypeRepository _perforCofdrugtypeRepository;
public PerSheetService(PerHeaderService perHeader,
PerforCofincomeRepository perforCofincomeRepository,
PerforCofdrugpropRepository perforCofdrugpropRepository,
PerforCofdrugtypeRepository perforCofdrugtypeRepository)
{
_perHeader = perHeader;
_perforCofincomeRepository = perforCofincomeRepository;
_perforCofdrugpropRepository = perforCofdrugpropRepository;
_perforCofdrugtypeRepository = perforCofdrugtypeRepository;
}
......
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