Commit 698a7786 by lcx

cof_accounting实体、仓储、数据操作

parent a8f0381f
...@@ -258,7 +258,7 @@ public ConfigController(ConfigService configService, AllotService allotService) ...@@ -258,7 +258,7 @@ public ConfigController(ConfigService configService, AllotService allotService)
[HttpPost] [HttpPost]
public ApiResponse GetDrugtypeList([CustomizeValidator(RuleSet = "Select"), FromBody] DrugpropRequest request) 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); return new ApiResponse(ResponseType.OK, "ok", list);
} }
...@@ -523,6 +523,80 @@ public ApiResponse DepttypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB ...@@ -523,6 +523,80 @@ public ApiResponse DepttypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB
//} //}
#endregion #endregion
#region accounting
/// <summary>
/// 获取cof_accounting列表
/// </summary>
/// <param name="allotId"></param>
/// <param name="type"></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>
/// 获取工作量绩效列头 /// 获取工作量绩效列头
/// </summary> /// </summary>
...@@ -537,7 +611,7 @@ public ApiResponse WorkHeader([CustomizeValidator(RuleSet = "Select"), FromBody] ...@@ -537,7 +611,7 @@ public ApiResponse WorkHeader([CustomizeValidator(RuleSet = "Select"), FromBody]
} }
#region HRP人员科室 #region HRP人员科室
/// <summary> /// <summary>
/// 获取HRP人员科室 /// 获取HRP人员科室
/// </summary> /// </summary>
...@@ -569,7 +643,7 @@ public ApiResponse SaveHrpDept(int hospitalId, int allotId, [FromBody] SaveColle ...@@ -569,7 +643,7 @@ public ApiResponse SaveHrpDept(int hospitalId, int allotId, [FromBody] SaveColle
if (hospitalId <= 0) if (hospitalId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "HospitalId无效"); return new ApiResponse(ResponseType.Fail, "参数错误", "HospitalId无效");
if (allotId <= 0) if (allotId <= 0)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效"); return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
_configService.SaveDepttypeHands(hospitalId, allotId, request); _configService.SaveDepttypeHands(hospitalId, allotId, request);
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
...@@ -597,11 +671,11 @@ public ApiResponse GetSecondaryAlias() ...@@ -597,11 +671,11 @@ public ApiResponse GetSecondaryAlias()
[HttpPost] [HttpPost]
public ApiResponse SaveSecondaryAlias([FromBody] SaveCollectData request) public ApiResponse SaveSecondaryAlias([FromBody] SaveCollectData request)
{ {
_configService.SaveSecondaryAlias(request); _configService.SaveSecondaryAlias(request);
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
#endregion #endregion
} }
} }
\ No newline at end of file
...@@ -59,7 +59,9 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options) ...@@ -59,7 +59,9 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<as_tempassess> as_tempassess { get; set; } public virtual DbSet<as_tempassess> as_tempassess { get; set; }
/// <summary> 考核列头 </summary> /// <summary> 考核列头 </summary>
public virtual DbSet<as_tempcolumns> as_tempcolumns { get; set; } 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; } public virtual DbSet<cof_again> cof_again { get; set; }
/// <summary> </summary> /// <summary> </summary>
public virtual DbSet<cof_alias> cof_alias { get; set; } 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) ...@@ -56,6 +56,7 @@ public int DeleteAllotData(int allotId)
List<string> tableArray = new List<string> List<string> tableArray = new List<string>
{ {
"ag_secondallot", "ag_secondallot",
"cof_accounting",
"cof_again", "cof_again",
"cof_check", "cof_check",
"cof_cmi", "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 ...@@ -17,23 +17,24 @@ namespace Performance.Services
public class ConfigService : IAutoInjection public class ConfigService : IAutoInjection
{ {
#region #region
private PerforCofdirectorRepository _directorRepository; private readonly PerforCofdirectorRepository _directorRepository;
//private PerforCofdrugpropRepository _drugpropRepository; //private readonly PerforCofdrugpropRepository _drugpropRepository;
private PerforCofworkitemRepository _workitemRepository; private readonly PerforCofworkitemRepository _workitemRepository;
private PerforCofagainRepository _againRepository; private readonly PerforCofagainRepository _againRepository;
private PerforCofdrugtypeRepository _drugtypeRepository; private readonly PerforCofdrugtypeRepository _drugtypeRepository;
private PerforPerallotRepository perforPerAllotRepository; private readonly PerforPerallotRepository perforPerAllotRepository;
private PerforHospitalRepository perforHospitalRepository; private readonly PerforHospitalRepository perforHospitalRepository;
private PerforPersheetRepository perforPersheetRepository; private readonly PerforPersheetRepository perforPersheetRepository;
private PerforImheaderRepository perforImheaderRepository; private readonly PerforImheaderRepository perforImheaderRepository;
private PerforCofdepttypeRepository perforCofdepttypeRepository; private readonly PerforCofdepttypeRepository perforCofdepttypeRepository;
private PerforPerapramountRepository perapramountRepository; private readonly PerforPerapramountRepository perapramountRepository;
//private PerforCofcmiRepository perforCofcmiRepository; //private readonly PerforCofcmiRepository perforCofcmiRepository;
private PerforCofHrpDeptRepository perforCofHrpDeptRepository; private readonly PerforCofHrpDeptRepository perforCofHrpDeptRepository;
private PerforCofaliasRepository perforCofaliasRepository; private readonly PerforCofaliasRepository perforCofaliasRepository;
private PersonService personService; private readonly PerforCofaccountingRepository cofaccountingRepository;
private LogManageService logManageService; private readonly PersonService personService;
private ILogger<ConfigService> logger; private readonly LogManageService logManageService;
private readonly ILogger<ConfigService> logger;
public ConfigService(PerforCofdirectorRepository cofdirectorRepository, public ConfigService(PerforCofdirectorRepository cofdirectorRepository,
//PerforCofdrugpropRepository cofdrugpropRepository, //PerforCofdrugpropRepository cofdrugpropRepository,
...@@ -49,6 +50,7 @@ public class ConfigService : IAutoInjection ...@@ -49,6 +50,7 @@ public class ConfigService : IAutoInjection
//PerforCofcmiRepository perforCofcmiRepository, //PerforCofcmiRepository perforCofcmiRepository,
PerforCofHrpDeptRepository perforCofHrpDeptRepository, PerforCofHrpDeptRepository perforCofHrpDeptRepository,
PerforCofaliasRepository perforCofaliasRepository, PerforCofaliasRepository perforCofaliasRepository,
PerforCofaccountingRepository cofaccountingRepository,
PersonService personService, PersonService personService,
LogManageService logManageService, LogManageService logManageService,
ILogger<ConfigService> logger) ILogger<ConfigService> logger)
...@@ -67,6 +69,7 @@ public class ConfigService : IAutoInjection ...@@ -67,6 +69,7 @@ public class ConfigService : IAutoInjection
//this.perforCofcmiRepository = perforCofcmiRepository; //this.perforCofcmiRepository = perforCofcmiRepository;
this.perforCofHrpDeptRepository = perforCofHrpDeptRepository; this.perforCofHrpDeptRepository = perforCofHrpDeptRepository;
this.perforCofaliasRepository = perforCofaliasRepository; this.perforCofaliasRepository = perforCofaliasRepository;
this.cofaccountingRepository = cofaccountingRepository;
this.personService = personService; this.personService = personService;
this.logManageService = logManageService; this.logManageService = logManageService;
this.logger = logger; this.logger = logger;
...@@ -632,6 +635,72 @@ public bool AgainDelete(CofAgainRequest request) ...@@ -632,6 +635,72 @@ public bool AgainDelete(CofAgainRequest request)
#endregion #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 #region Copy
/// <summary> /// <summary>
...@@ -745,6 +814,16 @@ public void Copy(per_allot allot) ...@@ -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 }); { AllotID = allot.ID, Type = t.Type, Department = t.Department, TypeName = t.TypeName, Value = t.TypeName == "满勤天数" ? days : t.Value });
_againRepository.AddRange(newAgains.ToArray()); _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 #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