科室绩效详情

parent 3cec2fbd
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
using Newtonsoft.Json.Linq;
using Performance.DtoModels;
using Performance.DtoModels.AppSettings;
using Performance.Infrastructure;
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 ComputeController : Controller
{
private ComputeService _computeService;
private AllotService _allotService;
public ComputeController(AllotService allotService,
ComputeService computeService)
{
_allotService = allotService;
_computeService = computeService;
}
[Route("deptdetail")]
[HttpPost]
public ApiResponse<DeptDetailResponse> DeptDetail([FromBody]DeptDetailRequest request)
{
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
DeptDetailResponse response = _computeService.GetDepartmentDetail(request);
return new ApiResponse<DeptDetailResponse>(ResponseType.OK, response);
}
}
}
\ No newline at end of file
...@@ -98,7 +98,9 @@ public AutoMapperConfigs() ...@@ -98,7 +98,9 @@ public AutoMapperConfigs()
CreateMap<PerDataAccountBaisc, im_accountbasic>(); CreateMap<PerDataAccountBaisc, im_accountbasic>();
CreateMap<PerDataSpecialUnit, im_specialunit>(); CreateMap<PerDataSpecialUnit, im_specialunit>();
CreateMap<PerDataAccountDoctor, res_accountdoctor>(); CreateMap<PerDataAccountDoctor, res_accountdoctor>();
CreateMap<res_accountdoctor, PerDataAccount>();
CreateMap<PerDataAccountNurse, res_accountnurse>(); CreateMap<PerDataAccountNurse, res_accountnurse>();
CreateMap<res_accountnurse, PerDataAccount>();
CreateMap<res_accountdoctor, ComputeSource>(); CreateMap<res_accountdoctor, ComputeSource>();
CreateMap<res_accountnurse, ComputeSource>(); CreateMap<res_accountnurse, ComputeSource>();
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class PerDataAccount : IPerData
{
/// <summary>
/// 核算单元
/// </summary>
public string AccountingUnit { get; set; }
/// <summary>
/// 科室
/// </summary>
public string Department { get; set; }
/// <summary>
/// 核算单元医生数量
/// </summary>
public Nullable<decimal> Number { get; set; }
/// <summary>
/// 医生基础系数
/// </summary>
public Nullable<decimal> BasicFactor { get; set; }
/// <summary>
/// 倾斜系数
/// </summary>
public Nullable<decimal> SlopeFactor { get; set; }
/// <summary>
/// 其他绩效1
/// </summary>
public Nullable<decimal> OtherPerfor1 { get; set; }
/// <summary>
/// 其他绩效2
/// </summary>
public Nullable<decimal> OtherPerfor2 { get; set; }
/// <summary>
/// 医院奖罚
/// </summary>
public Nullable<decimal> Extra { get; set; }
/// <summary>
/// 考核对分率
/// </summary>
public Nullable<decimal> ScoringAverage { get; set; }
/// <summary>
/// 调节系数
/// </summary>
public Nullable<decimal> AdjustFactor { get; set; }
/// <summary>
/// 科室业绩
/// </summary>
public Nullable<decimal> Income { get; set; }
/// <summary>
/// 业绩绩效
/// </summary>
public Nullable<decimal> PerforFee { get; set; }
/// <summary>
/// 工作量绩效
/// </summary>
public Nullable<decimal> WorkloadFee { get; set; }
/// <summary>
/// 绩效合计
/// </summary>
public Nullable<decimal> PerforTotal { get; set; }
/// <summary>
/// 人均绩效
/// </summary>
public Nullable<decimal> Avg { get; set; }
/// <summary>
/// 实发绩效
/// </summary>
public Nullable<decimal> GiveFee { get; set; }
}
}
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
/// <summary>
/// 查看科室绩效详情
/// </summary>
public class DeptDetailRequest : ApiRequest
{
/// <summary>
/// 绩效id
/// </summary>
public int AllotId { get; set; }
/// <summary>
/// 绩效类型(1 医生组、 2 护理组)
/// </summary>
public int Type { get; set; }
/// <summary>
/// 汇总ID
/// </summary>
public int AccountID { get; set; }
}
public class DetailRequestValidator : AbstractValidator<DeptDetailRequest>
{
public DetailRequestValidator()
{
RuleFor(x => x.AllotId).NotNull().GreaterThan(0);
RuleFor(x => x.Type).NotNull().InclusiveBetween(1, 2);
RuleFor(x => x.AccountID).NotNull().GreaterThan(0);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class DeptDetailResponse
{
public PerDataAccount Pandect { get; set; }
public List<DeptDetail> Economic { get; set; }
public List<DeptDetail> Workload { get; set; }
}
public class DeptDetail
{
public string ItemName { get; set; }
public decimal ItemValue { get; set; }
}
}
using AutoMapper;
using Performance.DtoModels;
using Performance.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Performance.Services
{
public class ComputeService : IAutoInjection
{
private PerforResAccountdoctorRepository _perforResAccountdoctorRepository;
private PerforResAccountnurseRepository _perforResAccountnurseRepository;
private PerforPerSheetRepository _perforPerSheetRepository;
private PerforImDataRepository _perforImDataRepository;
public ComputeService(PerforResAccountdoctorRepository perforResAccountdoctorRepository,
PerforResAccountnurseRepository perforResAccountnurseRepository,
PerforPerSheetRepository perforPerSheetRepository,
PerforImDataRepository perforImDataRepository)
{
_perforResAccountdoctorRepository = perforResAccountdoctorRepository;
_perforResAccountnurseRepository = perforResAccountnurseRepository;
_perforPerSheetRepository = perforPerSheetRepository;
_perforImDataRepository = perforImDataRepository;
}
/// <summary>
/// 返回科室详情
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DeptDetailResponse GetDepartmentDetail(DeptDetailRequest request)
{
var sheetList = _perforPerSheetRepository.GetEntities(t => t.AllotID == request.AllotId);
if (request.Type == 1)
{
var doctor = _perforResAccountdoctorRepository.GetEntity(t => t.AllotID == request.AllotId && t.ID == request.AccountID);
DeptDetailResponse response = new DeptDetailResponse()
{
Pandect = Mapper.Map<PerDataAccount>(doctor),
Economic = new List<DeptDetail>(),
Workload = new List<DeptDetail>()
};
var sheetWorkload = sheetList.FirstOrDefault(t => t.SheetType == (int)SheetType.ComputeDoctorWorkload);
if (sheetWorkload == null)
return null;
var dataWorkloadList = _perforImDataRepository.GetEntities(t => t.SheetID == sheetWorkload.ID && t.IsTotal != 1 && t.AccountingUnit == doctor.AccountingUnit);
dataWorkloadList.ForEach(t => response.Workload.Add(new DeptDetail { ItemName = t.TypeName, ItemValue = t.CellValue ?? 0 }));
var sheetEconomic = sheetList.FirstOrDefault(t => t.SheetType == (int)SheetType.ComputeEconomic);
if (sheetEconomic == null)
return null;
var dataEconomicList = _perforImDataRepository.GetEntities(t => t.SheetID == sheetEconomic.ID && t.UnitType == 1 && t.IsTotal != 1 && t.AccountingUnit == doctor.AccountingUnit);
dataEconomicList.ForEach(t => response.Economic.Add(new DeptDetail { ItemName = t.TypeName, ItemValue = t.CellValue ?? 0 }));
return response;
}
else if (request.Type == 2)
{
var nurse = _perforResAccountnurseRepository.GetEntity(t => t.AllotID == request.AllotId && t.ID == request.AccountID);
DeptDetailResponse response = new DeptDetailResponse()
{
Pandect = Mapper.Map<PerDataAccount>(nurse),
Economic = new List<DeptDetail>(),
Workload = new List<DeptDetail>()
};
var sheetWorkload = sheetList.FirstOrDefault(t => t.SheetType == (int)SheetType.ComputeNurseWorkload);
if (sheetWorkload == null)
return null;
var dataWorkloadList = _perforImDataRepository.GetEntities(t => t.SheetID == sheetWorkload.ID && t.IsTotal != 1 && t.AccountingUnit == nurse.AccountingUnit);
dataWorkloadList.ForEach(t => response.Workload.Add(new DeptDetail { ItemName = t.TypeName, ItemValue = t.CellValue ?? 0 }));
var sheetEconomic = sheetList.FirstOrDefault(t => t.SheetType == (int)SheetType.ComputeEconomic);
if (sheetEconomic == null)
return null;
var dataEconomicList = _perforImDataRepository.GetEntities(t => t.SheetID == sheetEconomic.ID && t.UnitType == 2 && t.IsTotal != 1 && t.AccountingUnit == nurse.AccountingUnit);
dataEconomicList.ForEach(t => response.Economic.Add(new DeptDetail { ItemName = t.TypeName, ItemValue = t.CellValue ?? 0 }));
}
return null;
}
}
}
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