Commit b489a8c8 by 李承祥

保底绩效相关配置

parent 0656f781
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Performance.Api.Controllers
{
[Route("api/[controller]")]
public class GuaranteeController
{
private readonly GuaranteeService guaranteeService;
public GuaranteeController(GuaranteeService guaranteeService)
{
this.guaranteeService = guaranteeService;
}
#region cof_guarantee
/// <summary>
/// 保底绩效配置列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("list")]
[HttpPost]
public ApiResponse<List<cof_guarantee>> Guarantee([CustomizeValidator(RuleSet = "Select"), FromBody]GuaranteeRequest request)
{
var list = guaranteeService.Guarantee(request.AllotId);
return new ApiResponse<List<cof_guarantee>>(ResponseType.OK, "ok", list);
}
/// <summary>
/// 新增保底绩效配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("insert")]
[HttpPost]
public ApiResponse<cof_guarantee> GuarantInsert([CustomizeValidator(RuleSet = "Insert"), FromBody]GuaranteeRequest request)
{
var entity = guaranteeService.GuarantInsert(request);
if (entity.Id > 0)
return new ApiResponse<cof_guarantee>(ResponseType.OK, "新增配置成功", entity);
return new ApiResponse<cof_guarantee>(ResponseType.Fail, "新增配置失败", entity);
}
/// <summary>
/// 修改保底绩效配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("update")]
[HttpPost]
public ApiResponse<cof_guarantee> GuarantUpdate([CustomizeValidator(RuleSet = "Update"), FromBody]GuaranteeRequest request)
{
var result = guaranteeService.GuarantUpdate(request);
return new ApiResponse<cof_guarantee>(ResponseType.OK, "修改配置成功", result);
}
/// <summary>
/// 删除保底绩效配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("delete")]
[HttpPost]
public ApiResponse<cof_guarantee> GuarantDelete([CustomizeValidator(RuleSet = "Delete"), FromBody]GuaranteeRequest request)
{
var result = guaranteeService.GuarantDelete(request.Id);
if (result)
return new ApiResponse<cof_guarantee>(ResponseType.OK, "删除配置成功");
return new ApiResponse<cof_guarantee>(ResponseType.Fail, "删除配置失败");
}
/// <summary>
/// 医院核算单元
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("accountingunit")]
[HttpPost]
public ApiResponse<List<TitleValue>> Accounting([CustomizeValidator(RuleSet = "Select"), FromBody]GuaranteeRequest request)
{
var result = guaranteeService.Accounting(request.AllotId);
return new ApiResponse<List<TitleValue>>(ResponseType.OK, "医院核算单元列表", result);
}
#endregion
}
}
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class GuaranteeRequest
{
/// <summary> </summary>
public int Id { get; set; }
/// <summary> </summary>
public int AllotId { get; set; }
/// <summary> 优先级 </summary>
public int Priority { get; set; }
/// <summary> 核算单元类型 1 医生组 2 护理组 3 医技组 </summary>
public Nullable<int> UnitType { get; set; }
/// <summary> 保底科室 </summary>
public string Target { get; set; }
/// <summary> 保底来源科室 </summary>
public string Source { get; set; }
}
public class GuaranteeRequestValidator : AbstractValidator<GuaranteeRequest>
{
public GuaranteeRequestValidator()
{
RuleSet("Select", () =>
{
RuleFor(x => x.AllotId).NotNull().NotEmpty().GreaterThan(0);
});
RuleSet("Insert", () =>
{
RuleFor(x => x.AllotId).NotNull().GreaterThan(0);
RuleFor(x => x.Priority).NotNull().GreaterThan(0);
});
RuleSet("Update", () =>
{
RuleFor(x => x.Id).NotNull().GreaterThan(0);
});
RuleSet("Delete", () =>
{
RuleFor(x => x.Id).NotNull().GreaterThan(0);
});
}
}
}
......@@ -40,6 +40,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<cof_drugprop> cof_drugprop { get; set; }
/// <summary> 药占比费用列头名称 </summary>
public virtual DbSet<cof_drugtype> cof_drugtype { get; set; }
/// <summary> 保底科室配置 </summary>
public virtual DbSet<cof_guarantee> cof_guarantee { get; set; }
/// <summary> ICU医生护士有效收入汇总计算系数 </summary>
public virtual DbSet<cof_income> cof_income { get; set; }
/// <summary> 特殊绩效项指标 </summary>
......
//-----------------------------------------------------------------------
// <copyright file=" cof_guarantee.cs">
// * FileName: 保底科室配置.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
/// 保底科室配置
/// </summary>
[Table("cof_guarantee")]
public class cof_guarantee
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> AllotId { get; set; }
/// <summary>
/// 优先级
/// </summary>
public Nullable<int> Priority { get; set; }
/// <summary>
/// 核算单元类型 1 医生组 2 护理组 3 医技组
/// </summary>
public Nullable<int> UnitType { get; set; }
/// <summary>
/// 保底科室
/// </summary>
public string Target { get; set; }
/// <summary>
/// 保底来源科室
/// </summary>
public string Source { get; set; }
}
}
......@@ -160,7 +160,7 @@ public class res_compute
/// 变更日志
/// </summary>
public string ChangeLog { get; set; }
/// <summary>
///
/// </summary>
......
//-----------------------------------------------------------------------
// <copyright file=" cof_guarantee.cs">
// * FileName: cof_guarantee.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// cof_guarantee Repository
/// </summary>
public partial class PerforCofguaranteeRepository : PerforRepository<cof_guarantee>
{
public PerforCofguaranteeRepository(PerformanceDbContext context) : base(context)
{
}
}
}
using AutoMapper;
using Performance.DtoModels;
using Performance.EntityModels;
using Performance.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Performance.Services
{
public class GuaranteeService
{
private readonly PerforPerallotRepository perforPerAllotRepository;
private readonly PerforImdataRepository perforImdataRepository;
private readonly PerforCofguaranteeRepository perforCofguaranteeRepository;
public GuaranteeService(PerforPerallotRepository perforPerAllotRepository,
PerforImdataRepository perforImdataRepository,
PerforCofguaranteeRepository perforCofguaranteeRepository)
{
this.perforPerAllotRepository = perforPerAllotRepository;
this.perforImdataRepository = perforImdataRepository;
this.perforCofguaranteeRepository = perforCofguaranteeRepository;
}
#region cof_guarantee
/// <summary>
/// 保底绩效配置列表
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public List<cof_guarantee> Guarantee(int allotId)
{
var list = perforCofguaranteeRepository.GetEntities(t => t.AllotId == allotId);
return list?.OrderBy(t => t.Priority).ThenBy(t => t.Target).ToList();
}
/// <summary>
/// 新增保底绩效配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public cof_guarantee GuarantInsert(GuaranteeRequest request)
{
var guarantee = Mapper.Map<cof_guarantee>(request);
perforCofguaranteeRepository.Add(guarantee);
return guarantee;
}
/// <summary>
/// 修改保底绩效配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public cof_guarantee GuarantUpdate(GuaranteeRequest request)
{
var guarantee = perforCofguaranteeRepository.GetEntity(t => t.Id == request.Id);
if (guarantee == null)
throw new PerformanceException("request.Id 参数错误");
guarantee.UnitType = request.UnitType;
guarantee.Priority = request.Priority;
guarantee.Target = request.Target;
guarantee.Source = request.Source;
if (!perforCofguaranteeRepository.Update(guarantee))
throw new PerformanceException("保存失败");
return Mapper.Map<cof_guarantee>(request);
}
/// <summary>
/// 删除保底绩效配置
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public bool GuarantDelete(int id)
{
var guarantee = perforCofguaranteeRepository.GetEntity(t => t.Id == id);
if (guarantee == null)
return false;
return perforCofguaranteeRepository.Remove(guarantee);
}
/// <summary>
/// 医院核算单元
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public List<TitleValue> Accounting(int allotId)
{
List<TitleValue> result = new List<TitleValue>();
var allot = perforPerAllotRepository.GetEntity(t => t.ID == allotId);
if (allot == null)
return result;
var allotIds = perforPerAllotRepository.GetEntities(t => t.HospitalId == allot.HospitalId).Select(t => t.ID);
var data = perforImdataRepository.GetEntities(t => allotIds.Contains(t.AllotID.Value))?.Select(t => t.AccountingUnit);
if (data != null && data.Any())
{
data = data.Distinct().Where(t => !string.IsNullOrEmpty(t)).OrderBy(t => t).ToList();
result.AddRange(data.Select(t => new TitleValue { Title = t, Value = t }));
}
return result;
}
#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