Commit 4d39a83c by lcx

计算是否带入cmi、药占比系数

parent 037f3bb9
...@@ -30,6 +30,8 @@ public class ProcessComputService : IAutoInjection ...@@ -30,6 +30,8 @@ public class ProcessComputService : IAutoInjection
private readonly PerforRescomputeRepository perforRescomputeRepository; private readonly PerforRescomputeRepository perforRescomputeRepository;
private readonly LogManageService logManageService; private readonly LogManageService logManageService;
private readonly GuaranteeService guaranteeService; private readonly GuaranteeService guaranteeService;
private readonly PerforHospitalRepository hospitalRepository;
private readonly PerforPerallotRepository perallotRepository;
public ProcessComputService(PerforCofincomeRepository perforCofincomeRepository, public ProcessComputService(PerforCofincomeRepository perforCofincomeRepository,
PerforCofdrugpropRepository perforCofdrugpropRepository, PerforCofdrugpropRepository perforCofdrugpropRepository,
...@@ -44,7 +46,9 @@ public class ProcessComputService : IAutoInjection ...@@ -44,7 +46,9 @@ public class ProcessComputService : IAutoInjection
PerforCofcmiRepository perforCofcmiRepository, PerforCofcmiRepository perforCofcmiRepository,
PerforRescomputeRepository perforRescomputeRepository, PerforRescomputeRepository perforRescomputeRepository,
LogManageService logManageService, LogManageService logManageService,
GuaranteeService guaranteeService) GuaranteeService guaranteeService,
PerforHospitalRepository hospitalRepository,
PerforPerallotRepository perallotRepository)
{ {
this.perforCofincomeRepository = perforCofincomeRepository; this.perforCofincomeRepository = perforCofincomeRepository;
this.perforCofdrugpropRepository = perforCofdrugpropRepository; this.perforCofdrugpropRepository = perforCofdrugpropRepository;
...@@ -60,6 +64,8 @@ public class ProcessComputService : IAutoInjection ...@@ -60,6 +64,8 @@ public class ProcessComputService : IAutoInjection
this.perforRescomputeRepository = perforRescomputeRepository; this.perforRescomputeRepository = perforRescomputeRepository;
this.logManageService = logManageService; this.logManageService = logManageService;
this.guaranteeService = guaranteeService; this.guaranteeService = guaranteeService;
this.hospitalRepository = hospitalRepository;
this.perallotRepository = perallotRepository;
} }
///// <summary> ///// <summary>
...@@ -177,6 +183,11 @@ public void Save(List<PerSheet> perSheets, int allotId) ...@@ -177,6 +183,11 @@ public void Save(List<PerSheet> perSheets, int allotId)
/// </summary> /// </summary>
public (List<PerSheet> Sheets, List<PerSheet> MergeSheets) MergeCompute(PerExcel excel, int allotid) public (List<PerSheet> Sheets, List<PerSheet> MergeSheets) MergeCompute(PerExcel excel, int allotid)
{ {
var allot = perallotRepository.GetEntity(t => t.ID == allotid);
if (allot == null) throw new ArgumentNullException(nameof(per_allot));
var hospital = hospitalRepository.GetEntity(t => t.ID == allot.HospitalId);
if (hospital == null) throw new ArgumentNullException(nameof(sys_hospital));
List<PerSheet> perSheet = new List<PerSheet>(); List<PerSheet> perSheet = new List<PerSheet>();
//合并科室收入、支出 //合并科室收入、支出
...@@ -209,7 +220,7 @@ public void Save(List<PerSheet> perSheets, int allotId) ...@@ -209,7 +220,7 @@ public void Save(List<PerSheet> perSheets, int allotId)
//var onceWorkload1 = workloadCompute.OnceCompute(workload1, confs); //var onceWorkload1 = workloadCompute.OnceCompute(workload1, confs);
//医生组 二次计算 //医生组 二次计算
logManageService.WriteMsg("正在生成绩效", "医生组工作量计算", 1, allotid, "ReceiveMessage"); logManageService.WriteMsg("正在生成绩效", "医生组工作量计算", 1, allotid, "ReceiveMessage");
var twiceWorkloadResult1 = workloadCompute.TwiceCompute(workload1, confs, cmis, conitem, true); var twiceWorkloadResult1 = workloadCompute.TwiceCompute(workload1, hospital, confs, cmis, conitem, true);
twiceWorkloadResult1.Sheet.SheetType = SheetType.ComputeDoctorWorkload; twiceWorkloadResult1.Sheet.SheetType = SheetType.ComputeDoctorWorkload;
perSheet.Add(twiceWorkloadResult1.Sheet); perSheet.Add(twiceWorkloadResult1.Sheet);
...@@ -220,7 +231,7 @@ public void Save(List<PerSheet> perSheets, int allotId) ...@@ -220,7 +231,7 @@ public void Save(List<PerSheet> perSheets, int allotId)
//var onceWorkload2 = workloadCompute.OnceCompute(workload2); //var onceWorkload2 = workloadCompute.OnceCompute(workload2);
//护理组 二次计算 //护理组 二次计算
logManageService.WriteMsg("正在生成绩效", "护理组工作量计算", 1, allotid, "ReceiveMessage"); logManageService.WriteMsg("正在生成绩效", "护理组工作量计算", 1, allotid, "ReceiveMessage");
var twiceWorkloadResult2 = workloadCompute.TwiceCompute(workload2, confs, cmis, conitem); var twiceWorkloadResult2 = workloadCompute.TwiceCompute(workload2, hospital, confs, cmis, conitem);
twiceWorkloadResult2.Sheet.SheetType = SheetType.ComputeNurseWorkload; twiceWorkloadResult2.Sheet.SheetType = SheetType.ComputeNurseWorkload;
perSheet.Add(twiceWorkloadResult2.Sheet); perSheet.Add(twiceWorkloadResult2.Sheet);
......
...@@ -99,7 +99,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null) ...@@ -99,7 +99,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
/// </summary> /// </summary>
/// <param name="sheet"></param> /// <param name="sheet"></param>
/// <returns></returns> /// <returns></returns>
public (PerSheet Sheet, List<PerData> PerData) TwiceCompute(PerSheet sheet, List<CofDrugProp> confs = null, List<cof_cmi> cmis = null, List<cof_workitem> workitems = null, bool isDoctor = false) public (PerSheet Sheet, List<PerData> PerData) TwiceCompute(PerSheet sheet, sys_hospital hospital, List<CofDrugProp> confs = null, List<cof_cmi> cmis = null, List<cof_workitem> workitems = null, bool isDoctor = false)
{ {
//获取最大列坐标位置 //获取最大列坐标位置
int thiscell = sheet.PerHeader.OrderByDescending(t => t.PointCell).FirstOrDefault().PointCell + 1; int thiscell = sheet.PerHeader.OrderByDescending(t => t.PointCell).FirstOrDefault().PointCell + 1;
...@@ -115,7 +115,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null) ...@@ -115,7 +115,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
{ {
var ds = group.Select(t => var ds = group.Select(t =>
{ {
var (cellvalue, factor) = ComputValue(group, confs, cmis, workitems, isDoctor); var (cellvalue, factor) = ComputValue(group, hospital, confs, cmis, workitems, isDoctor);
var dto = new PerData var dto = new PerData
{ {
...@@ -140,7 +140,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null) ...@@ -140,7 +140,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
return (sheet, perDataList); return (sheet, perDataList);
} }
private (decimal?, decimal?) ComputValue(IGrouping<object, PerData> group, List<CofDrugProp> confs = null, List<cof_cmi> cmis = null, List<cof_workitem> workitems = null, bool isDoctor = false) private (decimal?, decimal?) ComputValue(IGrouping<object, PerData> group, sys_hospital hospital, List<CofDrugProp> confs = null, List<cof_cmi> cmis = null, List<cof_workitem> workitems = null, bool isDoctor = false)
{ {
var unittype = isDoctor ? new List<int> { (int)UnitType.医生组, (int)UnitType.医技组, (int)UnitType.专家组, (int)UnitType.其他医生组, (int)UnitType.其他医技组, (int)UnitType.特殊核算组 } : new List<int> { (int)UnitType.护理组, (int)UnitType.其他护理组 }; var unittype = isDoctor ? new List<int> { (int)UnitType.医生组, (int)UnitType.医技组, (int)UnitType.专家组, (int)UnitType.其他医生组, (int)UnitType.其他医技组, (int)UnitType.特殊核算组 } : new List<int> { (int)UnitType.护理组, (int)UnitType.其他护理组 };
...@@ -149,8 +149,8 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null) ...@@ -149,8 +149,8 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
return (group.Sum(s => s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue), null); return (group.Sum(s => s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue), null);
else else
{ {
var factor = confs?.FirstOrDefault(t => t.AccoutingUnit == group.First().AccountingUnit)?.Factor ?? 1; var factor = hospital.IsOpenDrugprop == 2 ? 1 : (confs?.FirstOrDefault(t => t.AccoutingUnit == group.First().AccountingUnit)?.Factor ?? 1);
var cmifactor = cmis?.FirstOrDefault(t => t.AccountingUnit == group.First().AccountingUnit && unittype.Contains(t.UnitType))?.Value ?? 1; var cmifactor = hospital.IsOpenCMIPercent == 2 ? 1 : (cmis?.FirstOrDefault(t => t.AccountingUnit == group.First().AccountingUnit && unittype.Contains(t.UnitType))?.Value ?? 1);
//需要乘系数的项 //需要乘系数的项
var fgroup = group.Where(t => workitems.Select(s => s.Item).Contains(t.TypeName)); var fgroup = group.Where(t => workitems.Select(s => s.Item).Contains(t.TypeName));
//需要乘系数的项 //需要乘系数的项
...@@ -171,7 +171,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null) ...@@ -171,7 +171,7 @@ public PerSheet OnceCompute(PerSheet sheet, List<CofDrugProp> confs = null)
value += ngroup.Sum(s => value += ngroup.Sum(s =>
{ {
var cellvalue = s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue; var cellvalue = s.IsFactor ? s.CellValue * s.FactorValue : s.CellValue;
if (workitems.Any(w => w.Type == 2) && workitems.Where(w => w.Type == 2).Select(q => q.Item).Contains(s.TypeName)) if (workitems.Any(w => w.Type == 1) && workitems.Where(w => w.Type == 1).Select(q => q.Item).Contains(s.TypeName))
{ {
cellvalue = cmifactor * cellvalue; cellvalue = cmifactor * 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