Commit cc249204 by 李承祥

计算药占比时,费用类别判断;药占比费用类别(drugtype)相关功能

parent a58751ff
...@@ -46,7 +46,7 @@ public ApiResponse<List<DirectorResponse>> GetDireList([CustomizeValidator(RuleS ...@@ -46,7 +46,7 @@ public ApiResponse<List<DirectorResponse>> GetDireList([CustomizeValidator(RuleS
/// <returns></returns> /// <returns></returns>
[Route("direinsert")] [Route("direinsert")]
[HttpPost] [HttpPost]
public ApiResponse<DirectorResponse> DireInsert([FromBody]DirectorRequest request) public ApiResponse<DirectorResponse> DireInsert([CustomizeValidator(RuleSet = "Insert"), FromBody]DirectorRequest request)
{ {
var director = _configService.DireInsert(request); var director = _configService.DireInsert(request);
return new ApiResponse<DirectorResponse>(ResponseType.OK, director); return new ApiResponse<DirectorResponse>(ResponseType.OK, director);
...@@ -101,7 +101,7 @@ public ApiResponse<List<DrugpropResponse>> GetDrugList([CustomizeValidator(RuleS ...@@ -101,7 +101,7 @@ public ApiResponse<List<DrugpropResponse>> GetDrugList([CustomizeValidator(RuleS
/// <returns></returns> /// <returns></returns>
[Route("druginsert")] [Route("druginsert")]
[HttpPost] [HttpPost]
public ApiResponse<DrugpropResponse> DrugInsert([FromBody]DrugpropRequest request) public ApiResponse<DrugpropResponse> DrugInsert([CustomizeValidator(RuleSet = "Insert"), FromBody]DrugpropRequest request)
{ {
var drugprop = _configService.DrugInsert(request); var drugprop = _configService.DrugInsert(request);
return new ApiResponse<DrugpropResponse>(ResponseType.OK, drugprop); return new ApiResponse<DrugpropResponse>(ResponseType.OK, drugprop);
...@@ -135,6 +135,62 @@ public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody]Drug ...@@ -135,6 +135,62 @@ public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody]Drug
} }
#endregion #endregion
#region drugprop
/// <summary>
/// 获取 药占比类型信息列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("dtypelist")]
[HttpPost]
public ApiResponse GetDrugtypeList([CustomizeValidator(RuleSet = "Select"), FromBody]DrugpropRequest request)
{
var list = _configService.GetDrugtypeList(request.AllotID);
return new ApiResponse(ResponseType.OK, "ok", list);
}
/// <summary>
/// 新增药占比类型
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("dtypeinsert")]
[HttpPost]
public ApiResponse DrugtypeInsert([CustomizeValidator(RuleSet = "Insert"), FromBody]DrugpropRequest request)
{
var drugprop = _configService.DrugtypeInsert(request);
return new ApiResponse(ResponseType.OK, drugprop);
}
/// <summary>
/// 修改药占比类型
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("dtypeupdate")]
[HttpPost]
public ApiResponse DrugtypeUpdate([CustomizeValidator(RuleSet = "Update"), FromBody]DrugpropRequest request)
{
var drugprop = _configService.DrugtypeUpdate(request);
return new ApiResponse(ResponseType.OK, drugprop);
}
/// <summary>
/// 删除药占比类型
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("dtypedelete")]
[HttpPost]
public ApiResponse DrugtypeDelete([CustomizeValidator(RuleSet = "Delete"), FromBody]DrugpropRequest request)
{
if (!_configService.DrugtypeDelete(request))
return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK);
}
#endregion
#region income #region income
/// <summary> /// <summary>
/// 获取ICU有效收入配置列表 /// 获取ICU有效收入配置列表
...@@ -156,7 +212,7 @@ public ApiResponse<List<IncomeResponse>> GetIncomeList([CustomizeValidator(RuleS ...@@ -156,7 +212,7 @@ public ApiResponse<List<IncomeResponse>> GetIncomeList([CustomizeValidator(RuleS
/// <returns></returns> /// <returns></returns>
[Route("incomeinsert")] [Route("incomeinsert")]
[HttpPost] [HttpPost]
public ApiResponse<IncomeResponse> Insert([FromBody]IncomeRequest request) public ApiResponse<IncomeResponse> Insert([CustomizeValidator(RuleSet = "Insert"), FromBody]IncomeRequest request)
{ {
var income = _configService.IncomeInsert(request); var income = _configService.IncomeInsert(request);
return new ApiResponse<IncomeResponse>(ResponseType.OK, income); return new ApiResponse<IncomeResponse>(ResponseType.OK, income);
...@@ -211,7 +267,7 @@ public ApiResponse<List<WorkyearResponse>> GetWorkList([CustomizeValidator(RuleS ...@@ -211,7 +267,7 @@ public ApiResponse<List<WorkyearResponse>> GetWorkList([CustomizeValidator(RuleS
/// <returns></returns> /// <returns></returns>
[Route("workinsert")] [Route("workinsert")]
[HttpPost] [HttpPost]
public ApiResponse<WorkyearResponse> WorkyearInsert([FromBody]WorkyearRequest request) public ApiResponse<WorkyearResponse> WorkyearInsert([CustomizeValidator(RuleSet = "Insert"), FromBody]WorkyearRequest request)
{ {
var workyear = _configService.WorkInsert(request); var workyear = _configService.WorkInsert(request);
return new ApiResponse<WorkyearResponse>(ResponseType.OK, workyear); return new ApiResponse<WorkyearResponse>(ResponseType.OK, workyear);
...@@ -266,7 +322,7 @@ public ApiResponse GetAgainList([CustomizeValidator(RuleSet = "Select"), FromBod ...@@ -266,7 +322,7 @@ public ApiResponse GetAgainList([CustomizeValidator(RuleSet = "Select"), FromBod
/// <returns></returns> /// <returns></returns>
[Route("cofagaininsert")] [Route("cofagaininsert")]
[HttpPost] [HttpPost]
public ApiResponse AgainInsert([FromBody]CofAgainRequest request) public ApiResponse AgainInsert([CustomizeValidator(RuleSet = "Insert"), FromBody]CofAgainRequest request)
{ {
var workyear = _configService.AgainInsert(request); var workyear = _configService.AgainInsert(request);
return new ApiResponse(ResponseType.OK, workyear); return new ApiResponse(ResponseType.OK, workyear);
......
...@@ -36,6 +36,11 @@ public CofAgainRequestValidator() ...@@ -36,6 +36,11 @@ public CofAgainRequestValidator()
RuleFor(x => x.AllotID).NotNull().NotEmpty().GreaterThan(0); RuleFor(x => x.AllotID).NotNull().NotEmpty().GreaterThan(0);
}); });
RuleSet("Insert", () =>
{
RuleFor(x => x.AllotID).NotNull().GreaterThan(0);
});
RuleSet("Update", () => RuleSet("Update", () =>
{ {
RuleFor(x => x.ID).NotNull().GreaterThan(0); RuleFor(x => x.ID).NotNull().GreaterThan(0);
......
...@@ -33,6 +33,11 @@ public DirectorRequestValidator() ...@@ -33,6 +33,11 @@ public DirectorRequestValidator()
RuleFor(x => x.AllotID).NotNull().NotEmpty().GreaterThan(0); RuleFor(x => x.AllotID).NotNull().NotEmpty().GreaterThan(0);
}); });
RuleSet("Insert", () =>
{
RuleFor(x => x.AllotID).NotNull().GreaterThan(0);
});
RuleSet("Update", () => RuleSet("Update", () =>
{ {
RuleFor(x => x.ID).NotNull().GreaterThan(0); RuleFor(x => x.ID).NotNull().GreaterThan(0);
......
...@@ -25,7 +25,7 @@ public class DrugpropRequest : ApiRequest ...@@ -25,7 +25,7 @@ public class DrugpropRequest : ApiRequest
/// <summary> /// <summary>
/// 费用名称 /// 费用名称
/// </summary> /// </summary>
public string ChargeType { get; set; } public string Charge { get; set; }
public class DrugpropRequestValidator : AbstractValidator<DrugpropRequest> public class DrugpropRequestValidator : AbstractValidator<DrugpropRequest>
...@@ -37,6 +37,11 @@ public DrugpropRequestValidator() ...@@ -37,6 +37,11 @@ public DrugpropRequestValidator()
RuleFor(x => x.AllotID).NotNull().NotEmpty().GreaterThan(0); RuleFor(x => x.AllotID).NotNull().NotEmpty().GreaterThan(0);
}); });
RuleSet("Insert", () =>
{
RuleFor(x => x.AllotID).NotNull().GreaterThan(0);
});
RuleSet("Update", () => RuleSet("Update", () =>
{ {
RuleFor(x => x.ID).NotNull().GreaterThan(0); RuleFor(x => x.ID).NotNull().GreaterThan(0);
......
...@@ -33,6 +33,11 @@ public IncomeRequestValidator() ...@@ -33,6 +33,11 @@ public IncomeRequestValidator()
RuleFor(x => x.AllotID).NotNull().NotEmpty().GreaterThan(0); RuleFor(x => x.AllotID).NotNull().NotEmpty().GreaterThan(0);
}); });
RuleSet("Insert", () =>
{
RuleFor(x => x.AllotID).NotNull().GreaterThan(0);
});
RuleSet("Update", () => RuleSet("Update", () =>
{ {
RuleFor(x => x.ID).NotNull().GreaterThan(0); RuleFor(x => x.ID).NotNull().GreaterThan(0);
......
...@@ -34,6 +34,11 @@ public WorkyearRequestValidator() ...@@ -34,6 +34,11 @@ public WorkyearRequestValidator()
RuleFor(x => x.AllotID).NotNull().NotEmpty().GreaterThan(0); RuleFor(x => x.AllotID).NotNull().NotEmpty().GreaterThan(0);
}); });
RuleSet("Insert", () =>
{
RuleFor(x => x.AllotID).NotNull().GreaterThan(0);
});
RuleSet("Update", () => RuleSet("Update", () =>
{ {
RuleFor(x => x.ID).NotNull().GreaterThan(0); RuleFor(x => x.ID).NotNull().GreaterThan(0);
......
...@@ -38,6 +38,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options) ...@@ -38,6 +38,8 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public virtual DbSet<cof_director> cof_director { get; set; } public virtual DbSet<cof_director> cof_director { get; set; }
/// <summary> 工作量门诊药占比系数 <summary> /// <summary> 工作量门诊药占比系数 <summary>
public virtual DbSet<cof_drugprop> cof_drugprop { get; set; } public virtual DbSet<cof_drugprop> cof_drugprop { get; set; }
/// <summary> 药占比费用列头名称 <summary>
public virtual DbSet<cof_drugtype> cof_drugtype { get; set; }
/// <summary> ICU医生护士有效收入汇总计算系数 <summary> /// <summary> ICU医生护士有效收入汇总计算系数 <summary>
public virtual DbSet<cof_income> cof_income { get; set; } public virtual DbSet<cof_income> cof_income { get; set; }
/// <summary> 工龄对应绩效系数配置 <summary> /// <summary> 工龄对应绩效系数配置 <summary>
......
...@@ -40,10 +40,5 @@ public class cof_drugprop ...@@ -40,10 +40,5 @@ public class cof_drugprop
/// 药占比对应系数 /// 药占比对应系数
/// </summary> /// </summary>
public Nullable<decimal> Value { get; set; } public Nullable<decimal> Value { get; set; }
/// <summary>
/// 费用名称
/// </summary>
public string ChargeType { get; set; }
} }
} }
//-----------------------------------------------------------------------
// <copyright file=" cof_drugtype.cs">
// * FileName: 药占比费用列头名称.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
/// 药占比费用列头名称
/// </summary>
[Table("cof_drugtype")]
public class cof_drugtype
{
/// <summary>
///
/// </summary>
[Key]
public int ID { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> AllotID { get; set; }
/// <summary>
/// 费用名称
/// </summary>
public string Charge { get; set; }
}
}
//-----------------------------------------------------------------------
// <copyright file=" cof_drugtype.cs">
// * FileName: cof_drugtype.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// cof_drugtype Repository
/// </summary>
public partial class PerforCofdrugtypeRepository : PerforRepository<cof_drugtype>
{
public PerforCofdrugtypeRepository(PerformanceDbContext context) : base(context)
{
}
}
}
...@@ -23,6 +23,7 @@ public class ProcessComputService : IAutoInjection ...@@ -23,6 +23,7 @@ public class ProcessComputService : IAutoInjection
private PerforImemployeeRepository perforImEmployeeRepository; private PerforImemployeeRepository perforImEmployeeRepository;
private PerforResaccountdoctorRepository perforResAccountdoctorRepository; private PerforResaccountdoctorRepository perforResAccountdoctorRepository;
private PerforResaccountnurseRepository perforResAccountnurseRepository; private PerforResaccountnurseRepository perforResAccountnurseRepository;
private PerforCofdrugtypeRepository perforCofdrugtypeRepository;
public ProcessComputService(PerforCofincomeRepository perforCofincomeRepository, public ProcessComputService(PerforCofincomeRepository perforCofincomeRepository,
PerforCofdrugpropRepository perforCofdrugpropRepository, PerforCofdrugpropRepository perforCofdrugpropRepository,
PerforPersheetRepository perforPerSheetRepository, PerforPersheetRepository perforPerSheetRepository,
...@@ -30,7 +31,8 @@ public class ProcessComputService : IAutoInjection ...@@ -30,7 +31,8 @@ public class ProcessComputService : IAutoInjection
PerforImheaderRepository perforImHeaderRepository, PerforImheaderRepository perforImHeaderRepository,
PerforImemployeeRepository perforImEmployeeRepository, PerforImemployeeRepository perforImEmployeeRepository,
PerforResaccountdoctorRepository perforResAccountdoctorRepository, PerforResaccountdoctorRepository perforResAccountdoctorRepository,
PerforResaccountnurseRepository perforResAccountnurseRepository) PerforResaccountnurseRepository perforResAccountnurseRepository,
PerforCofdrugtypeRepository perforCofdrugtypeRepository)
{ {
this.perforCofincomeRepository = perforCofincomeRepository; this.perforCofincomeRepository = perforCofincomeRepository;
this.perforCofdrugpropRepository = perforCofdrugpropRepository; this.perforCofdrugpropRepository = perforCofdrugpropRepository;
...@@ -40,6 +42,7 @@ public class ProcessComputService : IAutoInjection ...@@ -40,6 +42,7 @@ public class ProcessComputService : IAutoInjection
this.perforImEmployeeRepository = perforImEmployeeRepository; this.perforImEmployeeRepository = perforImEmployeeRepository;
this.perforResAccountdoctorRepository = perforResAccountdoctorRepository; this.perforResAccountdoctorRepository = perforResAccountdoctorRepository;
this.perforResAccountnurseRepository = perforResAccountnurseRepository; this.perforResAccountnurseRepository = perforResAccountnurseRepository;
this.perforCofdrugtypeRepository = perforCofdrugtypeRepository;
} }
/// <summary> /// <summary>
...@@ -264,10 +267,7 @@ private List<CofDrugProp> GetDrugConfig(PerExcel excel, int allotid) ...@@ -264,10 +267,7 @@ private List<CofDrugProp> GetDrugConfig(PerExcel excel, int allotid)
var incomeSheet = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.Income && t.SheetName.Contains("门诊") && t.SheetName.Contains("就诊")); var incomeSheet = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.Income && t.SheetName.Contains("门诊") && t.SheetName.Contains("就诊"));
var datalist = incomeSheet.PerData.Select(t => (PerData)t); var datalist = incomeSheet.PerData.Select(t => (PerData)t);
var chargeType = perforCofdrugpropRepository.GetEntities(t => t.AllotID == allotid)?.FirstOrDefault().ChargeType; var drugtype = perforCofdrugtypeRepository.GetEntities(t => t.AllotID == allotid)?.Select(t => t.Charge).ToList();
List<string> drugtype = new List<string>();
if (!string.IsNullOrEmpty(chargeType))
drugtype = JArray.Parse(chargeType).ToObject<List<string>>();
var drugData = datalist.Where(t => drugtype.Contains(t.TypeName)).GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) }); var drugData = datalist.Where(t => drugtype.Contains(t.TypeName)).GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) });
var allData = datalist.GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) }); var allData = datalist.GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) });
......
...@@ -18,6 +18,7 @@ public class ConfigService : IAutoInjection ...@@ -18,6 +18,7 @@ public class ConfigService : IAutoInjection
private PerforCofincomeRepository _incomeRepository; private PerforCofincomeRepository _incomeRepository;
private PerforCofworkyearRepository _workyearRepository; private PerforCofworkyearRepository _workyearRepository;
private PerforCofagainRepository _againRepository; private PerforCofagainRepository _againRepository;
private PerforCofdrugtypeRepository _drugtypeRepository;
private PerforPerallotRepository perforPerAllotRepository; private PerforPerallotRepository perforPerAllotRepository;
private PerforPeragainallotRepository perforPeragainallotRepository; private PerforPeragainallotRepository perforPeragainallotRepository;
private PerforHospitalRepository perforHospitalRepository; private PerforHospitalRepository perforHospitalRepository;
...@@ -27,6 +28,7 @@ public class ConfigService : IAutoInjection ...@@ -27,6 +28,7 @@ public class ConfigService : IAutoInjection
PerforCofincomeRepository cofincomeRepository, PerforCofincomeRepository cofincomeRepository,
PerforCofworkyearRepository cofworkyearRepository, PerforCofworkyearRepository cofworkyearRepository,
PerforCofagainRepository againRepository, PerforCofagainRepository againRepository,
PerforCofdrugtypeRepository drugtypeRepository,
PerforPerallotRepository perforPerAllotRepository, PerforPerallotRepository perforPerAllotRepository,
PerforPeragainallotRepository perforPeragainallotRepository, PerforPeragainallotRepository perforPeragainallotRepository,
PerforHospitalRepository perforHospitalRepository, PerforHospitalRepository perforHospitalRepository,
...@@ -37,6 +39,7 @@ public class ConfigService : IAutoInjection ...@@ -37,6 +39,7 @@ public class ConfigService : IAutoInjection
this._incomeRepository = cofincomeRepository; this._incomeRepository = cofincomeRepository;
this._workyearRepository = cofworkyearRepository; this._workyearRepository = cofworkyearRepository;
this._againRepository = againRepository; this._againRepository = againRepository;
this._drugtypeRepository = drugtypeRepository;
this.perforPerAllotRepository = perforPerAllotRepository; this.perforPerAllotRepository = perforPerAllotRepository;
this.perforPeragainallotRepository = perforPeragainallotRepository; this.perforPeragainallotRepository = perforPeragainallotRepository;
this.perforHospitalRepository = perforHospitalRepository; this.perforHospitalRepository = perforHospitalRepository;
...@@ -140,7 +143,6 @@ public DrugpropResponse DrugUpdate(DrugpropRequest request) ...@@ -140,7 +143,6 @@ public DrugpropResponse DrugUpdate(DrugpropRequest request)
drugprop.MaxRange = request.MaxRange; drugprop.MaxRange = request.MaxRange;
drugprop.MinRange = request.MinRange; drugprop.MinRange = request.MinRange;
drugprop.Value = request.Value; drugprop.Value = request.Value;
drugprop.ChargeType = request.ChargeType;
if (!_drugpropRepository.Update(drugprop)) if (!_drugpropRepository.Update(drugprop))
throw new PerformanceException("保存失败"); throw new PerformanceException("保存失败");
...@@ -162,6 +164,67 @@ public bool DrugDelete(DrugpropRequest request) ...@@ -162,6 +164,67 @@ public bool DrugDelete(DrugpropRequest request)
} }
#endregion #endregion
#region cof_drugtype 药占比类别配置
/// <summary>
/// 获取cof_drugprop列表
/// </summary>
/// <returns></returns>
public List<cof_drugtype> GetDrugtypeList(int allotId)
{
var list = _drugtypeRepository.GetEntities(t => t.AllotID == allotId);
return list;
}
/// <summary>
/// 添加数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public cof_drugtype DrugtypeInsert(DrugpropRequest request)
{
var entity = new cof_drugtype
{
AllotID = request.AllotID,
Charge = request.Charge
};
if (!_drugtypeRepository.Add(entity))
throw new PerformanceException("保存失败");
return entity;
}
/// <summary>
/// 更新数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public cof_drugtype DrugtypeUpdate(DrugpropRequest request)
{
var entity = _drugtypeRepository.GetEntity(t => t.ID == request.ID);
if (null == entity)
throw new PerformanceException($"ID不存在 :{request.ID}");
entity.Charge = request.Charge;
if (!_drugtypeRepository.Update(entity))
throw new PerformanceException("保存失败");
return entity;
}
/// <summary>
/// 删除数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public bool DrugtypeDelete(DrugpropRequest request)
{
var entity = _drugtypeRepository.GetEntity(t => t.ID == request.ID);
if (null == entity)
throw new PerformanceException($"ID不存在 :{request.ID}");
return _drugtypeRepository.Remove(entity);
}
#endregion
#region cof_income ICU有效收入配置 #region cof_income ICU有效收入配置
/// <summary> /// <summary>
/// 获取cof_income列表 /// 获取cof_income列表
...@@ -346,6 +409,14 @@ public void Copy(per_allot allot) ...@@ -346,6 +409,14 @@ public void Copy(per_allot allot)
_workyearRepository.AddRange(newWorkyears.ToArray()); _workyearRepository.AddRange(newWorkyears.ToArray());
} }
var cofDrugtype = _drugtypeRepository.GetEntities(t => t.AllotID == allot.ID);
if (cofDrugtype == null || cofDrugtype.Count == 0)
{
var drugtype = _drugtypeRepository.GetEntities(t => t.AllotID == allotId) ?? _drugtypeRepository.GetEntities(t => t.AllotID == -1);
var newAgains = drugtype.Select(t => new cof_drugtype { AllotID = allot.ID, Charge = t.Charge });
_drugtypeRepository.AddRange(newAgains.ToArray());
}
var data = _againRepository.GetEntities(t => t.AllotID == allot.ID); var data = _againRepository.GetEntities(t => t.AllotID == allot.ID);
if (data == null || data.Count == 0) if (data == null || data.Count == 0)
{ {
...@@ -415,6 +486,7 @@ public bool AgainDelete(CofAgainRequest request) ...@@ -415,6 +486,7 @@ public bool AgainDelete(CofAgainRequest request)
} }
#endregion #endregion
/// <summary> /// <summary>
/// 清除二次绩效中无效数据 /// 清除二次绩效中无效数据
/// </summary> /// </summary>
......
...@@ -16,13 +16,16 @@ public class PerSheetService : IAutoInjection ...@@ -16,13 +16,16 @@ public class PerSheetService : IAutoInjection
private PerHeaderService _perHeader; private PerHeaderService _perHeader;
private PerforCofincomeRepository _perforCofincomeRepository; private PerforCofincomeRepository _perforCofincomeRepository;
private PerforCofdrugpropRepository _perforCofdrugpropRepository; private PerforCofdrugpropRepository _perforCofdrugpropRepository;
private PerforCofdrugtypeRepository _perforCofdrugtypeRepository;
public PerSheetService(PerHeaderService perHeader, public PerSheetService(PerHeaderService perHeader,
PerforCofincomeRepository perforCofincomeRepository, PerforCofincomeRepository perforCofincomeRepository,
PerforCofdrugpropRepository perforCofdrugpropRepository) PerforCofdrugpropRepository perforCofdrugpropRepository,
PerforCofdrugtypeRepository perforCofdrugtypeRepository)
{ {
_perHeader = perHeader; _perHeader = perHeader;
_perforCofincomeRepository = perforCofincomeRepository; _perforCofincomeRepository = perforCofincomeRepository;
_perforCofdrugpropRepository = perforCofdrugpropRepository; _perforCofdrugpropRepository = perforCofdrugpropRepository;
_perforCofdrugtypeRepository = perforCofdrugtypeRepository;
} }
/// <summary> /// <summary>
...@@ -155,10 +158,7 @@ private List<CofDrugProp> GetDrugConfig(PerExcel excel, int allotid) ...@@ -155,10 +158,7 @@ private List<CofDrugProp> GetDrugConfig(PerExcel excel, int allotid)
var incomeSheet = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.Income && t.SheetName.Contains("门诊") && t.SheetName.Contains("就诊")); var incomeSheet = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.Income && t.SheetName.Contains("门诊") && t.SheetName.Contains("就诊"));
var datalist = incomeSheet.PerData.Select(t => (PerData)t); var datalist = incomeSheet.PerData.Select(t => (PerData)t);
var chargeType = _perforCofdrugpropRepository.GetEntities(t => t.AllotID == allotid)?.FirstOrDefault().ChargeType; var drugtype = _perforCofdrugtypeRepository.GetEntities(t => t.AllotID == allotid)?.Select(t => t.Charge).ToList();
List<string> drugtype = new List<string>();
if (!string.IsNullOrEmpty(chargeType))
drugtype = JArray.Parse(chargeType).ToObject<List<string>>();
var drugData = datalist.Where(t => drugtype.Contains(t.TypeName)).GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) }); var drugData = datalist.Where(t => drugtype.Contains(t.TypeName)).GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) });
var allData = datalist.GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) }); var allData = datalist.GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) });
......
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