Commit 8817e11d by lcx

Merge branch 'feature/配置核算单元及类型' into develop

parents a8f0381f 7ebf76c4
......@@ -258,7 +258,7 @@ public ConfigController(ConfigService configService, AllotService allotService)
[HttpPost]
public ApiResponse GetDrugtypeList([CustomizeValidator(RuleSet = "Select"), FromBody] DrugpropRequest request)
{
var list = _configService.GetDrugtypeList(request.HospitalId,request.AllotID);
var list = _configService.GetDrugtypeList(request.HospitalId, request.AllotID);
return new ApiResponse(ResponseType.OK, "ok", list);
}
......@@ -523,6 +523,80 @@ public ApiResponse DepttypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB
//}
#endregion
#region accounting
/// <summary>
/// 获取cof_accounting列表
/// </summary>
/// <param name="allotId"></param>
/// <param name="type">1 返回accounting列表 2 返回核算单元类型 3 返回核算单元</param>
/// <returns></returns>
[Route("accountinglist/{allotId}/{type}")]
[HttpPost]
public ApiResponse GetAccountingList([FromRoute] int allotId, int type)
{
if (allotId == 0 || !new int[] { 1, 2, 3 }.Contains(type))
return new ApiResponse(ResponseType.ParameterError);
var list = _configService.GetAccountingList(allotId) ?? new List<cof_accounting>();
switch (type)
{
case 1:
default: //返回accounting列表
return new ApiResponse(ResponseType.OK, "ok", list);
case 2: //返回核算单元类型
return new ApiResponse(ResponseType.OK, "ok", list.Select(t => new TitleValue { Title = t.UnitType, Value = t.UnitType }).ToDistinct());
case 3: //返回核算单元
return new ApiResponse(ResponseType.OK, "ok", list.Select(t => new TitleValue { Title = t.AccountingUnit, Value = t.AccountingUnit }).ToDistinct());
}
}
/// <summary>
/// 新增cof_accounting
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("accountinginsert")]
[HttpPost]
public ApiResponse AccountingInsert([FromBody] cof_accounting request)
{
if (request.AllotId == 0 || string.IsNullOrEmpty(request.UnitType) || string.IsNullOrEmpty(request.AccountingUnit))
return new ApiResponse(ResponseType.ParameterError);
var drugprop = _configService.AccountingInsert(request);
return new ApiResponse(ResponseType.OK, drugprop);
}
/// <summary>
/// 修改cof_accounting
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("accountingupdate")]
[HttpPost]
public ApiResponse AccountingUpdate([FromBody] cof_accounting request)
{
if (request.AllotId == 0 || string.IsNullOrEmpty(request.UnitType) || string.IsNullOrEmpty(request.AccountingUnit))
return new ApiResponse(ResponseType.ParameterError);
var drugprop = _configService.AccountingUpdate(request);
return new ApiResponse(ResponseType.OK, drugprop);
}
/// <summary>
/// 删除cof_accounting
/// </summary>
/// <param name="accountingId"></param>
/// <returns></returns>
[Route("accountingdelete/{accountingId}")]
[HttpPost]
public ApiResponse AccountingDelete([FromRoute] int accountingId)
{
if (!_configService.AccountingDelete(accountingId))
return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK);
}
#endregion
/// <summary>
/// 获取工作量绩效列头
/// </summary>
......@@ -537,7 +611,7 @@ public ApiResponse WorkHeader([CustomizeValidator(RuleSet = "Select"), FromBody]
}
#region HRP人员科室
/// <summary>
/// 获取HRP人员科室
/// </summary>
......@@ -569,7 +643,7 @@ public ApiResponse SaveHrpDept(int hospitalId, int allotId, [FromBody] SaveColle
if (hospitalId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "HospitalId无效");
if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
_configService.SaveDepttypeHands(hospitalId, allotId, request);
return new ApiResponse(ResponseType.OK);
}
......@@ -597,11 +671,11 @@ public ApiResponse GetSecondaryAlias()
[HttpPost]
public ApiResponse SaveSecondaryAlias([FromBody] SaveCollectData request)
{
_configService.SaveSecondaryAlias(request);
return new ApiResponse(ResponseType.OK);
}
#endregion
}
}
\ No newline at end of file
......@@ -137,6 +137,13 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.AccountController.BatchSaveUser">
<summary>
批量新增用户
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="T:Performance.Api.Controllers.AgainAllotController">
<summary>
科室二次分配
......@@ -600,6 +607,35 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.GetAccountingList(System.Int32,System.Int32)">
<summary>
获取cof_accounting列表
</summary>
<param name="allotId"></param>
<param name="type"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.AccountingInsert(Performance.EntityModels.cof_accounting)">
<summary>
新增cof_accounting
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.AccountingUpdate(Performance.EntityModels.cof_accounting)">
<summary>
修改cof_accounting
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.AccountingDelete(System.Int32)">
<summary>
删除cof_accounting
</summary>
<param name="accountingId"></param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ConfigController.WorkHeader(Performance.DtoModels.WorkItemRequest)">
<summary>
获取工作量绩效列头
......
......@@ -73,6 +73,9 @@
<member name="P:Performance.EntityModels.PerformanceDbContext.as_tempcolumns">
<summary> 考核列头 </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_accounting">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.cof_again">
<summary> </summary>
</member>
......@@ -1623,6 +1626,31 @@
排序
</summary>
</member>
<member name="T:Performance.EntityModels.cof_accounting">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.cof_accounting.Id">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.cof_accounting.AllotId">
<summary>
绩效Id
</summary>
</member>
<member name="P:Performance.EntityModels.cof_accounting.UnitType">
<summary>
核算单元类型
</summary>
</member>
<member name="P:Performance.EntityModels.cof_accounting.AccountingUnit">
<summary>
核算单元
</summary>
</member>
<member name="T:Performance.EntityModels.cof_again">
<summary>
......
......@@ -59,7 +59,9 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<as_tempassess> as_tempassess { get; set; }
/// <summary> 考核列头 </summary>
public virtual DbSet<as_tempcolumns> as_tempcolumns { get; set; }
/// <summary> </summary>
/// <summary> </summary>
public virtual DbSet<cof_accounting> cof_accounting { get; set; }
/// <summary> </summary>
public virtual DbSet<cof_again> cof_again { get; set; }
/// <summary> </summary>
public virtual DbSet<cof_alias> cof_alias { get; set; }
......
//-----------------------------------------------------------------------
// <copyright file=" cof_accounting.cs">
// * FileName: .cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("cof_accounting")]
public class cof_accounting
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
/// <summary>
/// 绩效Id
/// </summary>
public int AllotId { get; set; }
/// <summary>
/// 核算单元类型
/// </summary>
public string UnitType { get; set; }
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
}
}
......@@ -56,6 +56,7 @@ public int DeleteAllotData(int allotId)
List<string> tableArray = new List<string>
{
"ag_secondallot",
"cof_accounting",
"cof_again",
"cof_check",
"cof_cmi",
......
//-----------------------------------------------------------------------
// <copyright file=" cof_accounting.cs">
// * FileName: cof_accounting.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// cof_accounting Repository
/// </summary>
public class PerforCofaccountingRepository : PerforRepository<cof_accounting>
{
public PerforCofaccountingRepository(PerformanceDbContext context) : base(context)
{
}
}
}
......@@ -17,23 +17,24 @@ namespace Performance.Services
public class ConfigService : IAutoInjection
{
#region
private PerforCofdirectorRepository _directorRepository;
//private PerforCofdrugpropRepository _drugpropRepository;
private PerforCofworkitemRepository _workitemRepository;
private PerforCofagainRepository _againRepository;
private PerforCofdrugtypeRepository _drugtypeRepository;
private PerforPerallotRepository perforPerAllotRepository;
private PerforHospitalRepository perforHospitalRepository;
private PerforPersheetRepository perforPersheetRepository;
private PerforImheaderRepository perforImheaderRepository;
private PerforCofdepttypeRepository perforCofdepttypeRepository;
private PerforPerapramountRepository perapramountRepository;
//private PerforCofcmiRepository perforCofcmiRepository;
private PerforCofHrpDeptRepository perforCofHrpDeptRepository;
private PerforCofaliasRepository perforCofaliasRepository;
private PersonService personService;
private LogManageService logManageService;
private ILogger<ConfigService> logger;
private readonly PerforCofdirectorRepository _directorRepository;
//private readonly PerforCofdrugpropRepository _drugpropRepository;
private readonly PerforCofworkitemRepository _workitemRepository;
private readonly PerforCofagainRepository _againRepository;
private readonly PerforCofdrugtypeRepository _drugtypeRepository;
private readonly PerforPerallotRepository perforPerAllotRepository;
private readonly PerforHospitalRepository perforHospitalRepository;
private readonly PerforPersheetRepository perforPersheetRepository;
private readonly PerforImheaderRepository perforImheaderRepository;
private readonly PerforCofdepttypeRepository perforCofdepttypeRepository;
private readonly PerforPerapramountRepository perapramountRepository;
//private readonly PerforCofcmiRepository perforCofcmiRepository;
private readonly PerforCofHrpDeptRepository perforCofHrpDeptRepository;
private readonly PerforCofaliasRepository perforCofaliasRepository;
private readonly PerforCofaccountingRepository cofaccountingRepository;
private readonly PersonService personService;
private readonly LogManageService logManageService;
private readonly ILogger<ConfigService> logger;
public ConfigService(PerforCofdirectorRepository cofdirectorRepository,
//PerforCofdrugpropRepository cofdrugpropRepository,
......@@ -49,6 +50,7 @@ public class ConfigService : IAutoInjection
//PerforCofcmiRepository perforCofcmiRepository,
PerforCofHrpDeptRepository perforCofHrpDeptRepository,
PerforCofaliasRepository perforCofaliasRepository,
PerforCofaccountingRepository cofaccountingRepository,
PersonService personService,
LogManageService logManageService,
ILogger<ConfigService> logger)
......@@ -67,6 +69,7 @@ public class ConfigService : IAutoInjection
//this.perforCofcmiRepository = perforCofcmiRepository;
this.perforCofHrpDeptRepository = perforCofHrpDeptRepository;
this.perforCofaliasRepository = perforCofaliasRepository;
this.cofaccountingRepository = cofaccountingRepository;
this.personService = personService;
this.logManageService = logManageService;
this.logger = logger;
......@@ -632,6 +635,72 @@ public bool AgainDelete(CofAgainRequest request)
#endregion
#region cof_accounting 核算单元及类别(4.1)配置
/// <summary>
/// 获取cof_accounting列表
/// </summary>
/// <returns></returns>
public List<cof_accounting> GetAccountingList(int allotId)
{
var list = cofaccountingRepository.GetEntities(t => t.AllotId == allotId);
return list;
}
/// <summary>
/// 添加数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public cof_accounting AccountingInsert(cof_accounting request)
{
var entity = new cof_accounting
{
AllotId = request.AllotId,
UnitType = request.UnitType,
AccountingUnit = request.AccountingUnit
};
if (!cofaccountingRepository.Add(entity))
throw new PerformanceException("保存失败");
return entity;
}
/// <summary>
/// 更新数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public cof_accounting AccountingUpdate(cof_accounting request)
{
var entity = cofaccountingRepository.GetEntity(t => t.Id == request.Id);
if (null == entity)
throw new PerformanceException($"ID不存在 :{request.Id}");
entity.AllotId = request.AllotId;
entity.UnitType = request.UnitType;
entity.AccountingUnit = request.AccountingUnit;
if (!cofaccountingRepository.Update(entity))
throw new PerformanceException("保存失败");
return entity;
}
/// <summary>
/// 删除数据
/// </summary>
/// <param name="accountingId"></param>
/// <returns></returns>
public bool AccountingDelete(int accountingId)
{
var entity = cofaccountingRepository.GetEntity(t => t.Id == accountingId);
if (null == entity)
throw new PerformanceException($"ID不存在 :{accountingId}");
return cofaccountingRepository.Remove(entity);
}
#endregion
#region Copy
/// <summary>
......@@ -745,6 +814,16 @@ public void Copy(per_allot allot)
{ AllotID = allot.ID, Type = t.Type, Department = t.Department, TypeName = t.TypeName, Value = t.TypeName == "满勤天数" ? days : t.Value });
_againRepository.AddRange(newAgains.ToArray());
}
logger.LogInformation($"accounting");
var accountings = cofaccountingRepository.GetEntities(t => t.AllotId == allot.ID);
if (accountings == null || accountings.Count == 0)
{
var prevData = cofaccountingRepository.GetEntities(t => t.AllotId == allotId);
var newData = prevData?.Select(t => new cof_accounting { AllotId = allot.ID, UnitType = t.UnitType, AccountingUnit = t.AccountingUnit });
if (newData != null && newData.Any())
cofaccountingRepository.AddRange(newData.ToArray());
}
}
#endregion
......
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