Commit 95f75800 by 李承祥

医院新增开关,配置信息迁移,药占比获取

parent fa18ec39
...@@ -63,11 +63,12 @@ public ApiResponse List([FromBody]AllotRequest request) ...@@ -63,11 +63,12 @@ public ApiResponse List([FromBody]AllotRequest request)
/// <returns></returns> /// <returns></returns>
[Route("insert")] [Route("insert")]
[HttpPost] [HttpPost]
public ApiResponse<AllotResponse> Insert([CustomizeValidator(RuleSet = "Insert"), FromBody]AllotRequest request) public ApiResponse Insert([CustomizeValidator(RuleSet = "Insert"), FromBody]AllotRequest request)
{ {
var user = _claim.At(request); var user = _claim.At(request);
var result = _allotService.InsertAllot(request, user.UserID); var result = _allotService.InsertAllot(request, user.UserID);
return new ApiResponse<AllotResponse>(ResponseType.OK, result); _configService.Copy(result);
return new ApiResponse(ResponseType.OK, result);
} }
/// <summary> /// <summary>
...@@ -137,7 +138,6 @@ public ApiResponse Import([FromForm] IFormCollection form) ...@@ -137,7 +138,6 @@ public ApiResponse Import([FromForm] IFormCollection form)
if (!_allotService.Update(allot)) if (!_allotService.Update(allot))
return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传成功,修改状态失败"); return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传成功,修改状态失败");
_configService.Clear(allot.ID); _configService.Clear(allot.ID);
_configService.Copy(allot);
} }
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
......
...@@ -22,6 +22,10 @@ public class DrugpropRequest : ApiRequest ...@@ -22,6 +22,10 @@ public class DrugpropRequest : ApiRequest
/// 药占比对应系数 /// 药占比对应系数
/// </summary> /// </summary>
public decimal Value { get; set; } public decimal Value { get; set; }
/// <summary>
/// 费用名称
/// </summary>
public string ChargeType { get; set; }
public class DrugpropRequestValidator : AbstractValidator<DrugpropRequest> public class DrugpropRequestValidator : AbstractValidator<DrugpropRequest>
......
...@@ -39,6 +39,18 @@ public class HospitalRequest : ApiRequest ...@@ -39,6 +39,18 @@ public class HospitalRequest : ApiRequest
/// 是否开启年资系数 1 启用 2 禁用 /// 是否开启年资系数 1 启用 2 禁用
/// </summary> /// </summary>
public Nullable<int> IsOpenWorkYear { get; set; } public Nullable<int> IsOpenWorkYear { get; set; }
/// <summary>
/// 是否开启药占比系数 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenDrugprop { get; set; }
/// <summary>
/// 是否开启ICU有效收入系数 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenIncome { get; set; }
/// <summary>
/// 是否开启规模/效率绩效 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenDirector { get; set; }
} }
public class HospitalRequestValidator : AbstractValidator<HospitalRequest> public class HospitalRequestValidator : AbstractValidator<HospitalRequest>
......
...@@ -40,5 +40,10 @@ public class cof_drugprop ...@@ -40,5 +40,10 @@ 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; }
} }
} }
...@@ -110,5 +110,10 @@ public class res_accountdoctor ...@@ -110,5 +110,10 @@ public class res_accountdoctor
/// 实发绩效 /// 实发绩效
/// </summary> /// </summary>
public Nullable<decimal> RealGiveFee { get; set; } public Nullable<decimal> RealGiveFee { get; set; }
/// <summary>
/// 变更日志
/// </summary>
public string ChangeLog { get; set; }
} }
} }
...@@ -65,5 +65,20 @@ public class sys_hospital ...@@ -65,5 +65,20 @@ public class sys_hospital
/// 是否开启年资系数 1 启用 2 禁用 /// 是否开启年资系数 1 启用 2 禁用
/// </summary> /// </summary>
public Nullable<int> IsOpenWorkYear { get; set; } public Nullable<int> IsOpenWorkYear { get; set; }
/// <summary>
/// 是否开启药占比系数 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenDrugprop { get; set; }
/// <summary>
/// 是否开启ICU有效收入系数 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenIncome { get; set; }
/// <summary>
/// 是否开启规模/效率绩效 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenDirector { get; set; }
} }
} }
...@@ -49,7 +49,7 @@ public class ProcessComputService : IAutoInjection ...@@ -49,7 +49,7 @@ public class ProcessComputService : IAutoInjection
/// <returns></returns> /// <returns></returns>
public List<PerSheet> MergeAndSave(PerExcel excel, per_allot allot) public List<PerSheet> MergeAndSave(PerExcel excel, per_allot allot)
{ {
List<PerSheet> list = MergeCompute(excel); List<PerSheet> list = MergeCompute(excel, allot.ID);
Save(list, allot.ID); Save(list, allot.ID);
return list; return list;
} }
...@@ -175,7 +175,7 @@ private void Save(List<PerSheet> perSheets, int allotId) ...@@ -175,7 +175,7 @@ private void Save(List<PerSheet> perSheets, int allotId)
/// <summary> /// <summary>
/// 合并计算 /// 合并计算
/// </summary> /// </summary>
private List<PerSheet> MergeCompute(PerExcel excel) private List<PerSheet> MergeCompute(PerExcel excel, int allotid)
{ {
List<PerSheet> perSheet = new List<PerSheet>(); List<PerSheet> perSheet = new List<PerSheet>();
...@@ -197,7 +197,7 @@ private List<PerSheet> MergeCompute(PerExcel excel) ...@@ -197,7 +197,7 @@ private List<PerSheet> MergeCompute(PerExcel excel)
var workload1 = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.Workload && t.SheetName.Contains("医生组")); var workload1 = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.Workload && t.SheetName.Contains("医生组"));
workload1.SheetName = "医生组工作量绩效测算表"; workload1.SheetName = "医生组工作量绩效测算表";
var confs = GetDrugConfig(excel); var confs = GetDrugConfig(excel, allotid);
//医生组 一次计算 //医生组 一次计算
var onceWorkload1 = workloadCompute.OnceCompute(workload1, confs); var onceWorkload1 = workloadCompute.OnceCompute(workload1, confs);
//医生组 二次计算 //医生组 二次计算
...@@ -256,14 +256,21 @@ private List<PerSheet> MergeCompute(PerExcel excel) ...@@ -256,14 +256,21 @@ private List<PerSheet> MergeCompute(PerExcel excel)
/// </summary> /// </summary>
/// <param name="excel"></param> /// <param name="excel"></param>
/// <returns></returns> /// <returns></returns>
private List<CofDrugProp> GetDrugConfig(PerExcel excel) private List<CofDrugProp> GetDrugConfig(PerExcel excel, int allotid)
{ {
//计算药占比 //计算药占比
List<CofDrugProp> cofs = new List<CofDrugProp>(); List<CofDrugProp> cofs = new List<CofDrugProp>();
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 drugData = datalist.Where(t => t.TypeName == "西药费" || t.TypeName == "中成药费").GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) }); var chargeType = perforCofdrugpropRepository.GetEntities(t => t.AllotID == allotid)?.FirstOrDefault().ChargeType;
List<string> drugtype = new List<string>();
if (!string.IsNullOrEmpty(chargeType))
{
chargeType = chargeType.Replace("[", "").Replace("]", "").Replace("\"", "");
drugtype = chargeType.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
}
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) });
var cofList = perforCofdrugpropRepository.GetEntities(); var cofList = perforCofdrugpropRepository.GetEntities();
......
...@@ -79,7 +79,7 @@ public List<AllotResponse> GetAllotList(int? hospitalId) ...@@ -79,7 +79,7 @@ public List<AllotResponse> GetAllotList(int? hospitalId)
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
public AllotResponse InsertAllot(AllotRequest request, int userID) public per_allot InsertAllot(AllotRequest request, int userID)
{ {
var repAllot = _allotRepository.GetEntities(t => t.HospitalId == request.HospitalId && t.Year == request.Year && t.Month == request.Month); var repAllot = _allotRepository.GetEntities(t => t.HospitalId == request.HospitalId && t.Year == request.Year && t.Month == request.Month);
if (repAllot != null && repAllot.Count() > 0) if (repAllot != null && repAllot.Count() > 0)
...@@ -93,7 +93,7 @@ public AllotResponse InsertAllot(AllotRequest request, int userID) ...@@ -93,7 +93,7 @@ public AllotResponse InsertAllot(AllotRequest request, int userID)
if (!_allotRepository.Add(allot)) if (!_allotRepository.Add(allot))
throw new PerformanceException("保存失败"); throw new PerformanceException("保存失败");
return Mapper.Map<AllotResponse>(allot); return allot;
} }
/// <summary> /// <summary>
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.EntityModels; using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Repository; using Performance.Repository;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -42,7 +43,7 @@ public class ConfigService : IAutoInjection ...@@ -42,7 +43,7 @@ public class ConfigService : IAutoInjection
this.logdbug = logdbug; this.logdbug = logdbug;
} }
#region cof_director #region cof_director 规模/效率绩效配置
/// <summary> /// <summary>
/// 获取cof_director列表 /// 获取cof_director列表
/// </summary> /// </summary>
...@@ -101,7 +102,7 @@ public bool DireDelete(DirectorRequest request) ...@@ -101,7 +102,7 @@ public bool DireDelete(DirectorRequest request)
} }
#endregion #endregion
#region cof_drugprop #region cof_drugprop 药占比系数配置
/// <summary> /// <summary>
/// 获取cof_drugprop列表 /// 获取cof_drugprop列表
/// </summary> /// </summary>
...@@ -139,6 +140,7 @@ public DrugpropResponse DrugUpdate(DrugpropRequest request) ...@@ -139,6 +140,7 @@ 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("保存失败");
...@@ -160,7 +162,7 @@ public bool DrugDelete(DrugpropRequest request) ...@@ -160,7 +162,7 @@ public bool DrugDelete(DrugpropRequest request)
} }
#endregion #endregion
#region cof_income #region cof_income ICU有效收入配置
/// <summary> /// <summary>
/// 获取cof_income列表 /// 获取cof_income列表
/// </summary> /// </summary>
...@@ -219,7 +221,7 @@ public bool IncomeDelete(IncomeRequest request) ...@@ -219,7 +221,7 @@ public bool IncomeDelete(IncomeRequest request)
} }
#endregion #endregion
#region cof_workyear #region cof_workyear 年资系数配置
/// <summary> /// <summary>
/// 获取cof_drugprop列表 /// 获取cof_drugprop列表
/// </summary> /// </summary>
...@@ -303,11 +305,14 @@ public void Copy(per_allot allot) ...@@ -303,11 +305,14 @@ public void Copy(per_allot allot)
if (list[i].ID == allot.ID && (i - 1) >= 0) if (list[i].ID == allot.ID && (i - 1) >= 0)
allotId = list[i - 1].ID; allotId = list[i - 1].ID;
} }
var hospital = perforHospitalRepository.GetEntity(t => t.ID == allot.HospitalId);
var orgDirector = _directorRepository.GetEntities(t => t.AllotID == allot.ID); var orgDirector = _directorRepository.GetEntities(t => t.AllotID == allot.ID);
if (orgDirector == null || orgDirector.Count == 0) if (orgDirector == null || orgDirector.Count == 0)
{ {
var director = _directorRepository.GetEntities(t => t.AllotID == allotId) ?? _directorRepository.GetEntities(t => t.AllotID == -1); var director = _directorRepository.GetEntities(t => t.AllotID == allotId) ?? _directorRepository.GetEntities(t => t.AllotID == -1);
var newDirectors = director.Select(t => new cof_director { AllotID = allot.ID, JobTitle = t.JobTitle, TypeName = t.TypeName, Value = t.Value }); var newDirectors = director.Select(t => new cof_director { AllotID = allot.ID, JobTitle = t.JobTitle, TypeName = t.TypeName, Value = t.Value });
if (hospital != null && hospital?.IsOpenDirector == 2)
newDirectors = director.Select(t => new cof_director { AllotID = allot.ID, JobTitle = t.JobTitle, TypeName = t.TypeName, Value = 1 });
_directorRepository.AddRange(newDirectors.ToArray()); _directorRepository.AddRange(newDirectors.ToArray());
} }
...@@ -316,6 +321,8 @@ public void Copy(per_allot allot) ...@@ -316,6 +321,8 @@ public void Copy(per_allot allot)
{ {
var durgprop = _drugpropRepository.GetEntities(t => t.AllotID == allotId) ?? _drugpropRepository.GetEntities(t => t.AllotID == -1); var durgprop = _drugpropRepository.GetEntities(t => t.AllotID == allotId) ?? _drugpropRepository.GetEntities(t => t.AllotID == -1);
var newDurgprops = durgprop.Select(t => new cof_drugprop { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = t.Value }); var newDurgprops = durgprop.Select(t => new cof_drugprop { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = t.Value });
if (hospital != null && hospital?.IsOpenDrugprop == 2)
newDurgprops = durgprop.Select(t => new cof_drugprop { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = 1 });
_drugpropRepository.AddRange(newDurgprops.ToArray()); _drugpropRepository.AddRange(newDurgprops.ToArray());
} }
...@@ -324,6 +331,8 @@ public void Copy(per_allot allot) ...@@ -324,6 +331,8 @@ public void Copy(per_allot allot)
{ {
var income = _incomeRepository.GetEntities(t => t.AllotID == allotId) ?? _incomeRepository.GetEntities(t => t.AllotID == -1); var income = _incomeRepository.GetEntities(t => t.AllotID == allotId) ?? _incomeRepository.GetEntities(t => t.AllotID == -1);
var newIncomes = income.Select(t => new cof_income { AllotID = allot.ID, SheetNameKeyword = t.SheetNameKeyword, UnitName = t.UnitName, Value = t.Value }); var newIncomes = income.Select(t => new cof_income { AllotID = allot.ID, SheetNameKeyword = t.SheetNameKeyword, UnitName = t.UnitName, Value = t.Value });
if (hospital != null && hospital?.IsOpenIncome == 2)
newIncomes = income.Select(t => new cof_income { AllotID = allot.ID, SheetNameKeyword = t.SheetNameKeyword, UnitName = t.UnitName, Value = 1 });
_incomeRepository.AddRange(newIncomes.ToArray()); _incomeRepository.AddRange(newIncomes.ToArray());
} }
...@@ -332,7 +341,6 @@ public void Copy(per_allot allot) ...@@ -332,7 +341,6 @@ public void Copy(per_allot allot)
{ {
var workyear = _workyearRepository.GetEntities(t => t.AllotID == allotId) ?? _workyearRepository.GetEntities(t => t.AllotID == -1); var workyear = _workyearRepository.GetEntities(t => t.AllotID == allotId) ?? _workyearRepository.GetEntities(t => t.AllotID == -1);
var newWorkyears = workyear.Select(t => new cof_workyear { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = t.Value }); var newWorkyears = workyear.Select(t => new cof_workyear { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = t.Value });
var hospital = perforHospitalRepository.GetEntity(t => t.ID == allot.HospitalId);
if (hospital != null && hospital?.IsOpenWorkYear == 2) if (hospital != null && hospital?.IsOpenWorkYear == 2)
newWorkyears = workyear.Select(t => new cof_workyear { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = 1 }); newWorkyears = workyear.Select(t => new cof_workyear { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = 1 });
_workyearRepository.AddRange(newWorkyears.ToArray()); _workyearRepository.AddRange(newWorkyears.ToArray());
......
...@@ -72,7 +72,7 @@ public SheetType GetSheetType(string sheetName) ...@@ -72,7 +72,7 @@ public SheetType GetSheetType(string sheetName)
return SheetType.Unidentifiable; return SheetType.Unidentifiable;
} }
internal List<PerSheet> ProcessCompute(PerExcel excel) internal List<PerSheet> ProcessCompute(PerExcel excel, int allotid)
{ {
List<PerSheet> perSheet = new List<PerSheet>(); List<PerSheet> perSheet = new List<PerSheet>();
...@@ -95,7 +95,7 @@ internal List<PerSheet> ProcessCompute(PerExcel excel) ...@@ -95,7 +95,7 @@ internal List<PerSheet> ProcessCompute(PerExcel excel)
var workload1 = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.Workload && t.SheetName.Contains("医生组")); var workload1 = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.Workload && t.SheetName.Contains("医生组"));
workload1.SheetName = "医生组工作量绩效测算表"; workload1.SheetName = "医生组工作量绩效测算表";
var confs = GetDrugConfig(excel); var confs = GetDrugConfig(excel, allotid);
//医生组 一次计算 //医生组 一次计算
var onceWorkload1 = workloadCompute.OnceCompute(workload1, confs); var onceWorkload1 = workloadCompute.OnceCompute(workload1, confs);
//医生组 二次计算 //医生组 二次计算
...@@ -147,14 +147,21 @@ internal List<PerSheet> ProcessCompute(PerExcel excel) ...@@ -147,14 +147,21 @@ internal List<PerSheet> ProcessCompute(PerExcel excel)
/// </summary> /// </summary>
/// <param name="excel"></param> /// <param name="excel"></param>
/// <returns></returns> /// <returns></returns>
private List<CofDrugProp> GetDrugConfig(PerExcel excel) private List<CofDrugProp> GetDrugConfig(PerExcel excel, int allotid)
{ {
//计算药占比 //计算药占比
List<CofDrugProp> cofs = new List<CofDrugProp>(); List<CofDrugProp> cofs = new List<CofDrugProp>();
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 drugData = datalist.Where(t => t.TypeName == "西药费" || t.TypeName == "中成药费").GroupBy(t => t.AccountingUnit).Select(t => new { AccountingUnit = t.Key, SumValue = t.Sum(s => s.CellValue) }); var chargeType = _perforCofdrugpropRepository.GetEntities(t => t.AllotID == allotid)?.FirstOrDefault().ChargeType;
List<string> drugtype = new List<string>();
if (!string.IsNullOrEmpty(chargeType))
{
chargeType = chargeType.Replace("[", "").Replace("]", "").Replace("\"", "");
drugtype = chargeType.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
}
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) });
var cofList = _perforCofdrugpropRepository.GetEntities(); var cofList = _perforCofdrugpropRepository.GetEntities();
......
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