Commit dd3fa5b6 by lcx

Merge branch 'yubei/人员额外绩效金额' into 20200618合并分支

# Conflicts:
#	performance/Performance.Api/wwwroot/Performance.Api.xml
#	performance/Performance.EntityModels/Context/PerformanceDbContext.cs
#	performance/Performance.Services/DFExtractService.cs
parents 579b37c8 56de6598
......@@ -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,73 @@ 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 result = employeeService.InsertApr(request, claim.GetUserId());
return result ? new ApiResponse(ResponseType.OK, "添加成功", request) :
new ApiResponse(ResponseType.Fail, "添加失败");
}
/// <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 result = employeeService.UpdateApr(request);
return result ? new ApiResponse(ResponseType.OK, "修改成功", request) :
new ApiResponse(ResponseType.Fail, "修改失败");
}
/// <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
......@@ -148,6 +148,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>
......@@ -2659,6 +2662,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>
预算管理金额
......
......@@ -116,6 +116,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>
......@@ -30,12 +30,12 @@ public class ag_workload_type
///
/// </summary>
public string TypeName { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 科室类型
/// </summary>
......
//-----------------------------------------------------------------------
// <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);"
};
int flag = 0;
foreach (var sql in sqls)
{
try
{
flag = connection.Execute(sql, new { allotid }, commandTimeout: 60 * 60);
}
catch(Exception ex)
{
return connection.Execute(sql, new { allotid }, commandTimeout: 60 * 60);
}
}
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,61 +15,49 @@ 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;
private readonly PerforImemployeeRepository _perforImemployeeRepository;
private readonly PerforPerallotRepository perforPerallotRepository;
private readonly PerforHospitalRepository hospitalRepository;
private readonly PerforPerapramountRepository perapramountRepository;
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,
PerforImemployeeRepository perforImemployeeRepository,
PerforPerallotRepository perforPerallotRepository,
PerforHospitalRepository hospitalRepository)
PerforHospitalRepository hospitalRepository,
PerforPerapramountRepository perapramountRepository)
{
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;
this._perforImemployeeRepository = perforImemployeeRepository;
this.perforPerallotRepository = perforPerallotRepository;
this.hospitalRepository = hospitalRepository;
this.perapramountRepository = perapramountRepository;
}
public int IsShowManage(int allotId)
......@@ -411,7 +399,7 @@ public List<ComputeResponse> AllCompute(int allotId)
RealGiveFee = t.fee
}).OrderByDescending(t => t.AccountingUnit));
}
return list;
return AddAprAmount(allotId, list);
}
/// <summary>
......@@ -459,7 +447,7 @@ public List<ComputeResponse> AllManageCompute(int allotId)
RealGiveFee = t.fee
}).OrderByDescending(t => t.AccountingUnit));
}
return list;
return AddAprAmount(allotId, list);
}
public res_compute GetComputeSingle(int computeid)
......@@ -745,5 +733,52 @@ public ag_secondallot GetAccountId(int secondId, out int accountId)
}
return second;
}
/// <summary>
/// 添加额外绩效金额(基础绩效、其他绩效等)
/// </summary>
/// <param name="allotId"></param>
/// <param name="computes"></param>
private List<ComputeResponse> AddAprAmount(int allotId, List<ComputeResponse> computes)
{
if (computes == null || !computes.Any())
return computes;
var list = perapramountRepository.GetEntities(t => t.AllotId == allotId);
if (list == null || !list.Any())
return computes;
var source = new string[] { "一次绩效", "二次绩效" };
foreach (var item in list.Where(t => t.Amount.HasValue))
{
var flag = false;
foreach (var s in source)
{
if (flag) continue;
var emp = computes.FirstOrDefault(t => t.Source == s && t.JobNumber == item.PersonnelNumber && t.EmployeeName == item.DoctorName);
if (emp != null)
{
emp.RealGiveFee += item.Amount;
flag = true;
continue;
}
emp = computes.FirstOrDefault(t => t.Source == s && t.JobNumber == item.PersonnelNumber);
if (emp != null)
{
emp.RealGiveFee += item.Amount;
flag = true;
continue;
}
emp = computes.FirstOrDefault(t => t.Source == s && t.EmployeeName == item.DoctorName);
if (emp != null)
{
emp.RealGiveFee += item.Amount;
flag = true;
continue;
}
}
}
return computes;
}
}
}
//using Dapper;
//using Dapper;
//using Microsoft.AspNetCore.Hosting;
//using Microsoft.Extensions.Logging;
//using NPOI.SS.UserModel;
......
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.Update(data);
}
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