Commit 3a3d37de by 李承祥

导入导出增加系数和列

parent 0b903064
......@@ -156,8 +156,8 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody]Al
if (null == allot || string.IsNullOrEmpty(allot.Path))
throw new PerformanceException("当前绩效记录不存在或没有上传数据文件");
var user = _claim.At(request);
//_allotService.Generate(allot, user.Mail);
BackgroundJob.Enqueue(() => _allotService.Generate(allot, user.Mail));
_allotService.Generate(allot, user.Mail);
//BackgroundJob.Enqueue(() => _allotService.Generate(allot, user.Mail));
return new ApiResponse(ResponseType.OK);
}
......
......@@ -80,7 +80,7 @@ public AutoMapperConfigs()
CreateMap<im_employee, PerDataEmployee>();
CreateMap<PerDataAccountBaisc, PerDataAccountDoctor>()
.ForMember(dest => dest.AccountingUnit, opt => opt.MapFrom(src => src.AccountingUnit))
.ForMember(dest => dest.AccountingUnit, opt => opt.MapFrom(src => src.DoctorAccountingUnit))
.ForMember(dest => dest.Department, opt => opt.MapFrom(src => src.Department))
.ForMember(dest => dest.Number, opt => opt.MapFrom(src => src.DoctorNumber))
.ForMember(dest => dest.BasicFactor, opt => opt.MapFrom(src => src.DoctorBasicFactor))
......@@ -92,7 +92,7 @@ public AutoMapperConfigs()
.ForMember(dest => dest.AdjustFactor, opt => opt.MapFrom(src => src.DoctorAdjustFactor));
CreateMap<PerDataAccountBaisc, PerDataAccountNurse>()
.ForMember(dest => dest.AccountingUnit, opt => opt.MapFrom(src => src.AccountingUnit))
.ForMember(dest => dest.AccountingUnit, opt => opt.MapFrom(src => src.NurseAccountingUnit))
.ForMember(dest => dest.Department, opt => opt.MapFrom(src => src.Department))
.ForMember(dest => dest.Number, opt => opt.MapFrom(src => src.NurseNumber))
.ForMember(dest => dest.BasicFactor, opt => opt.MapFrom(src => src.NurseBasicFactor))
......
......@@ -7,9 +7,14 @@ namespace Performance.DtoModels
public class PerDataAccountBaisc : IPerData
{
/// <summary>
/// 核算单元
/// 核算单元(医生组)
/// </summary>
public string AccountingUnit { get; set; }
public string DoctorAccountingUnit { get; set; }
/// <summary>
/// 核算单元(护理组)
/// </summary>
public string NurseAccountingUnit { get; set; }
/// <summary>
/// 科室名称
......
......@@ -30,12 +30,17 @@ public class im_accountbasic
///
/// </summary>
public Nullable<int> SheetID { get; set; }
/// <summary>
/// 核算单元
/// 核算单元(医生组)
/// </summary>
public string AccountingUnit { get; set; }
public string DoctorAccountingUnit { get; set; }
/// <summary>
/// 核算单元(护理组)
/// </summary>
public string NurseAccountingUnit { get; set; }
/// <summary>
/// 科室
/// </summary>
......
......@@ -204,7 +204,7 @@ public bool CheckData(PerExcel excel, per_allot allot)
var dataList = sheet.PerData.Select(t => (PerDataAccountBaisc)t);
foreach (var item in dataList)
{
if (string.IsNullOrEmpty(item.AccountingUnit) && string.IsNullOrEmpty(item.Department))
if (string.IsNullOrEmpty(item.DoctorAccountingUnit) && string.IsNullOrEmpty(item.NurseAccountingUnit))
{
flag = false;
rowNumber.Add(item.RowNumber + 1);
......
......@@ -240,16 +240,19 @@ private List<PerSheet> MergeCompute(PerExcel excel, int allotid)
private PerSheet ComputeDoctor(IEnumerable<PerDataAccountBaisc> dataList, List<PerData> economicData, List<PerData> workloadData)
{
PerSheet doctorSheet = new PerSheet("医生组临床科室单元核算表", "医生组临床科室单元核算表", SheetType.ComputeDoctorAccount, new List<PerHeader>(), new List<IPerData>());
var data = new List<PerDataAccountDoctor>();
foreach (var dept in dataList)
{
if (string.IsNullOrEmpty(dept.AccountingUnit)) continue;
if (string.IsNullOrEmpty(dept.DoctorAccountingUnit)) continue;
var econDoctor = economicData.FirstOrDefault(t => t.UnitType == "医生组" && t.AccountingUnit == dept.AccountingUnit);
var workDoctor = workloadData.FirstOrDefault(t => t.UnitType == "医生组" && t.AccountingUnit == dept.AccountingUnit);
var econDoctor = economicData.FirstOrDefault(t => t.UnitType == "医生组" && t.AccountingUnit == dept.DoctorAccountingUnit);
var workDoctor = workloadData.FirstOrDefault(t => t.UnitType == "医生组" && t.AccountingUnit == dept.DoctorAccountingUnit);
var doctor = new PerDataAccountDoctor
{
AccountingUnit = dept.AccountingUnit,
Department = dept.AccountingUnit,
AccountingUnit = dept.DoctorAccountingUnit,
Department = dept.Department,
Number = dept.DoctorNumber,
BasicFactor = dept.DoctorBasicFactor,
SlopeFactor = dept.DoctorSlopeFactor,
......@@ -266,8 +269,23 @@ private PerSheet ComputeDoctor(IEnumerable<PerDataAccountBaisc> dataList, List<P
doctor.RealGiveFee = (doctor.PerforTotal * doctor.ScoringAverage + doctor.Extra + doctor.OtherPerfor2) * doctor.AdjustFactor;
doctor.Avg = doctor.Number == 0 ? 0 : doctor.PerforTotal / doctor.Number;
doctorSheet.PerData.Add(doctor);
data.Add(doctor);
}
var groupdata = from d in data
group d by new { d.AccountingUnit } into s
select new
{
AccountingUnit = s.Select(t => t.AccountingUnit).First(),
Avg = s.Sum(t => t.Number) == 0 ? 0 : s.Sum(t => t.RealGiveFee) / s.Sum(t => t.Number)
};
if (data != null && data.Any())
{
data.ForEach(t =>
{
t.Avg = groupdata.FirstOrDefault(group => group.AccountingUnit == t.AccountingUnit).Avg;
});
}
doctorSheet.PerData.AddRange(data);
return doctorSheet;
}
......@@ -280,15 +298,18 @@ private PerSheet ComputeDoctor(IEnumerable<PerDataAccountBaisc> dataList, List<P
private PerSheet ComputeNurse(IEnumerable<PerDataAccountBaisc> dataList, List<PerData> economicData, List<PerData> workloadData)
{
PerSheet nurseSheet = new PerSheet("护理组临床科室单元核算表", "护理组临床科室单元核算表", SheetType.ComputeNurseAccount, new List<PerHeader>(), new List<IPerData>());
var data = new List<PerDataAccountNurse>();
foreach (var dept in dataList)
{
if (string.IsNullOrEmpty(dept.Department)) continue;
if (string.IsNullOrEmpty(dept.NurseAccountingUnit)) continue;
var econNurse = economicData.FirstOrDefault(t => t.UnitType == "护理组" && t.AccountingUnit == dept.Department);
var workNurse = workloadData.FirstOrDefault(t => t.UnitType == "护理组" && t.AccountingUnit == dept.Department);
var econNurse = economicData.FirstOrDefault(t => t.UnitType == "护理组" && t.AccountingUnit == dept.NurseAccountingUnit);
var workNurse = workloadData.FirstOrDefault(t => t.UnitType == "护理组" && t.AccountingUnit == dept.NurseAccountingUnit);
var nurse = new PerDataAccountNurse
{
AccountingUnit = dept.Department,
AccountingUnit = dept.NurseAccountingUnit,
Department = dept.Department,
Number = dept.NurseNumber,
BasicFactor = dept.NurseBasicFactor,
......@@ -306,8 +327,23 @@ private PerSheet ComputeNurse(IEnumerable<PerDataAccountBaisc> dataList, List<Pe
nurse.RealGiveFee = (nurse.PerforTotal * nurse.ScoringAverage + nurse.Extra + nurse.OtherPerfor2) * nurse.AdjustFactor;
nurse.Avg = nurse.Number == 0 ? 0 : nurse.PerforTotal / nurse.Number;
nurseSheet.PerData.Add(nurse);
data.Add(nurse);
}
var groupdata = from d in data
group d by new { d.AccountingUnit } into s
select new
{
AccountingUnit = s.Select(t => t.AccountingUnit).First(),
Avg = s.Sum(t => t.Number) == 0 ? 0 : s.Sum(t => t.RealGiveFee) / s.Sum(t => t.Number)
};
if (data != null && data.Any())
{
data.ForEach(t =>
{
t.Avg = groupdata.FirstOrDefault(group => group.AccountingUnit == t.AccountingUnit).Avg;
});
}
nurseSheet.PerData.AddRange(data);
return nurseSheet;
}
......
......@@ -274,7 +274,7 @@ private void SendEmail(per_allot allot, string mail, int type, DateTime time)
$"您可以登录<a href=\"http://jixiao.suvalue.com\" target=\"_blank\">http://jixiao.suvalue.com</a>查看详细清空。</p>";
}
emailService.SendAsync(message);
//emailService.SendAsync(message);
}
/// <summary>
......
......@@ -339,8 +339,9 @@ private bool WriteExcel(string newpath, string originalPath, List<PerSheet> shee
var importRow = importSheet.CreateRow(maxHeaderRowNumber + i + 1);
Dictionary<string, Func<PerDataAccountBaisc, object>> keyValues = new Dictionary<string, Func<PerDataAccountBaisc, object>>
{
{ "核算单元(医生组)", (t) => t.AccountingUnit },
{ "核算单元(护理组)", (t) => t.Department },
{ "核算单元(医生组)", (t) => t.DoctorAccountingUnit },
{ "核算单元(护理组)", (t) => t.NurseAccountingUnit },
{ "科室名称", (t) => t.Department },
{ "医生组核算单元医生数量", (t) => t.DoctorNumber },
{ "医生组基础系数", (t) => t.DoctorBasicFactor },
{ "医生组倾斜系数", (t) => t.DoctorSlopeFactor },
......
......@@ -32,8 +32,9 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
PerDataAccountBaisc unifyUnit = new PerDataAccountBaisc();
unifyUnit.RowNumber = r;
unifyUnit.AccountingUnit = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元(医生组)").PointCell)?.ToString();
unifyUnit.Department = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元(护理组)").PointCell)?.ToString();
unifyUnit.DoctorAccountingUnit = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元(医生组)").PointCell)?.ToString();
unifyUnit.NurseAccountingUnit = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元(护理组)").PointCell)?.ToString();
unifyUnit.Department = row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "科室名称").PointCell)?.ToString();
unifyUnit.DoctorNumber = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "核算单元医生数量" && p.Parent.CellValue == "医生组").PointCell)?.ToString());
unifyUnit.DoctorBasicFactor = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "基础系数" && p.Parent.CellValue == "医生组").PointCell)?.ToString());
unifyUnit.DoctorSlopeFactor = ConvertHelper.To<decimal>(row.GetCell(perHeader.FirstOrDefault(p => p.CellValue == "倾斜系数" && p.Parent.CellValue == "医生组").PointCell)?.ToString());
......
......@@ -18,20 +18,22 @@ public class PerSheetDataReadExpend : IPerSheetDataRead
HeaderFirstRowNum = 1,
HeaderLastRowNum = 2,
HeaderFirstCellNum = 0,
DataFirstRowNum = 3,
DataFirstRowNum = 5,
AccountingUnit = new List<AccountingUnit>
{
new AccountingUnit
{
AccountingUnitCellNum = 0,
UnitType = "医生组",
DeptCellNum = 2
DeptCellNum = 2,
FactorRow = 4,
},
new AccountingUnit
{
AccountingUnitCellNum = 1,
UnitType = "护理组",
DeptCellNum = 2
DeptCellNum = 2,
FactorRow = 3,
},
}
};
......@@ -75,7 +77,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
CellValue = ConvertHelper.To<decimal?>(row.GetCell(athead.PointCell)?.ToString()),
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = unit.UnitType, //手动匹配
IsFactor = false,
FactorValue = ConvertHelper.To<decimal?>(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.ToString()),
IsFactor = true,
};
var lastcell = vhead.OrderByDescending(t => t.PointCell).First();
if (lastcell.CellValue.Contains("备注"))
......
......@@ -16,16 +16,17 @@ public class PerSheetDataReadOtherIncome : IPerSheetDataRead
public PerSheetPoint Point => new PerSheetPoint
{
HeaderFirstRowNum = 1,
HeaderLastRowNum = 1,
HeaderFirstRowNum = 2,
HeaderLastRowNum = 2,
HeaderFirstCellNum = 0,
DataFirstRowNum = 2,
DataFirstRowNum = 3,
AccountingUnit = new List<AccountingUnit>
{
new AccountingUnit
{
AccountingUnitCellNum = 0,
DeptCellNum = 1
DeptCellNum = 1,
FactorRow = 1,
}
}
};
......@@ -59,7 +60,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = GetUnitType(sheet.SheetName, perHeader),
IsFactor = false,
FactorValue = ConvertHelper.To<decimal?>(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.ToString()),
IsFactor = true,
};
dataList.Add(data);
......
......@@ -153,7 +153,7 @@ private void CommonExport(int sheetID, SheetExportResponse response)
List<string> sheetNames = new List<string> {
"1.1.1 门诊就诊收入","1.1.2 门诊执行收入","1.2.1 住院就诊收入",
"1.2.2 住院执行收入","1.3.1 转入ICU就诊收入","1.3.2 转入ICU执行收入",
"1.2.2 住院执行收入","1.3.1 转入ICU就诊收入","1.3.2 转入ICU执行收入","2.1 成本支出统计表"
};
//添加系数值
string sheetName = _perforImSheetRepository.GetEntity(t => t.ID == sheetID).SheetName;
......@@ -163,6 +163,11 @@ private void CommonExport(int sheetID, SheetExportResponse response)
factorhead.Data.Add(new Cell(0, "单元工作量绩效标准:", 1, 2, false, false));
response = AddFactor(response, factorhead, headList.ToList(), dataList, sheetName);
}
else if (sheetName.Contains("额外收入"))
{
factorhead.Data.Add(new Cell(0, "额外收入绩效标准:", 1, 2, false, false));
response = AddFactor(response, factorhead, headList.ToList(), dataList, sheetName);
}
else if (sheetNames.Contains(sheetName))
{
factorhead.Data.Add(new Cell(0, "护理组分割比例", 1, 3, false, false));
......@@ -347,61 +352,63 @@ private void AccountDoctorExport(int sheetID, SheetExportResponse response)
private void AccountBaiscExport(int sheetID, SheetExportResponse response)
{
var list = _perforImaccountbasicRepository.GetEntities(t => t.SheetID == sheetID)?.OrderByDescending(t => t.AccountingUnit);
var list = _perforImaccountbasicRepository.GetEntities(t => t.SheetID == sheetID)?.OrderByDescending(t => t.DoctorAccountingUnit);
if (list != null && list.Count() > 0)
{
var row1 = new Row(0);
row1.Data.Add(new Cell(1, "核算单元", 2, 1, false, false));
row1.Data.Add(new Cell(2, "科室", 2, 1, false, false));
row1.Data.Add(new Cell(3, "医生组", 1, 8, false, false));
row1.Data.Add(new Cell(11, "护士组", 1, 8, false, false));
row1.Data.Add(new Cell(1, "核算单元(医生组)", 2, 1, false, false));
row1.Data.Add(new Cell(2, "核算单元(护理组)", 2, 1, false, false));
row1.Data.Add(new Cell(3, "科室", 2, 1, false, false));
row1.Data.Add(new Cell(4, "医生组", 1, 8, false, false));
row1.Data.Add(new Cell(12, "护士组", 1, 8, false, false));
response.Header.Add(row1);
var row2 = new Row(1);
row2.Data.Add(new Cell(3, "核算单元医生数量", 1, 1, false, false));
row2.Data.Add(new Cell(4, "医生基础系数", 1, 1, false, false));
row2.Data.Add(new Cell(5, "倾斜系数", 1, 1, false, false));
row2.Data.Add(new Cell(6, "其他绩效1", 1, 1, false, false));
row2.Data.Add(new Cell(7, "其他绩效2", 1, 1, false, false));
row2.Data.Add(new Cell(8, "医院奖罚", 1, 1, false, false));
row2.Data.Add(new Cell(9, "考核对分率", 1, 1, false, false));
row2.Data.Add(new Cell(10, "调节系数", 1, 1, false, false));
row2.Data.Add(new Cell(11, "核算单元护士数量", 1, 1, false, false));
row2.Data.Add(new Cell(12, "医生基础系数", 1, 1, false, false));
row2.Data.Add(new Cell(13, "倾斜系数", 1, 1, false, false));
row2.Data.Add(new Cell(14, "其他绩效1", 1, 1, false, false));
row2.Data.Add(new Cell(15, "其他绩效2", 1, 1, false, false));
row2.Data.Add(new Cell(16, "医院奖罚", 1, 1, false, false));
row2.Data.Add(new Cell(17, "考核对分率", 1, 1, false, false));
row2.Data.Add(new Cell(18, "调节系数", 1, 1, false, false));
row2.Data.Add(new Cell(4, "核算单元医生数量", 1, 1, false, false));
row2.Data.Add(new Cell(5, "医生基础系数", 1, 1, false, false));
row2.Data.Add(new Cell(6, "倾斜系数", 1, 1, false, false));
row2.Data.Add(new Cell(7, "其他绩效1", 1, 1, false, false));
row2.Data.Add(new Cell(8, "其他绩效2", 1, 1, false, false));
row2.Data.Add(new Cell(9, "医院奖罚", 1, 1, false, false));
row2.Data.Add(new Cell(10, "考核对分率", 1, 1, false, false));
row2.Data.Add(new Cell(11, "调节系数", 1, 1, false, false));
row2.Data.Add(new Cell(12, "核算单元护士数量", 1, 1, false, false));
row2.Data.Add(new Cell(13, "医生基础系数", 1, 1, false, false));
row2.Data.Add(new Cell(14, "倾斜系数", 1, 1, false, false));
row2.Data.Add(new Cell(15, "其他绩效1", 1, 1, false, false));
row2.Data.Add(new Cell(16, "其他绩效2", 1, 1, false, false));
row2.Data.Add(new Cell(17, "医院奖罚", 1, 1, false, false));
row2.Data.Add(new Cell(18, "考核对分率", 1, 1, false, false));
row2.Data.Add(new Cell(19, "调节系数", 1, 1, false, false));
response.Header.Add(row2);
for (int i = 0; i < list.Count(); i++)
{
var item = list.ElementAt(i);
var rowbody = new Row(i);
rowbody.Data.Add(new Cell(1, item.AccountingUnit, 1, 1, false, false));
rowbody.Data.Add(new Cell(2, item.Department, 1, 1, false, false));
rowbody.Data.Add(new Cell(3, item.DoctorNumber, 1, 1, false, true));
rowbody.Data.Add(new Cell(4, item.DoctorBasicFactor, 1, 1, false, true));
rowbody.Data.Add(new Cell(5, item.DoctorSlopeFactor, 1, 1, false, true));
rowbody.Data.Add(new Cell(6, item.DoctorOtherPerfor1, 1, 1, false, true));
rowbody.Data.Add(new Cell(7, item.DoctorOtherPerfor2, 1, 1, false, true));
rowbody.Data.Add(new Cell(8, item.DoctorExtra, 1, 1, false, true));
rowbody.Data.Add(new Cell(9, item.DoctorScoringAverage, 1, 1, false, true));
rowbody.Data.Add(new Cell(10, item.DoctorAdjustFactor, 1, 1, false, true));
rowbody.Data.Add(new Cell(11, item.NurseNumber, 1, 1, false, true));
rowbody.Data.Add(new Cell(12, item.NurseBasicFactor, 1, 1, false, true));
rowbody.Data.Add(new Cell(13, item.NurseSlopeFactor, 1, 1, false, true));
rowbody.Data.Add(new Cell(14, item.NurseOtherPerfor1, 1, 1, false, true));
rowbody.Data.Add(new Cell(15, item.NurseOtherPerfor2, 1, 1, false, true));
rowbody.Data.Add(new Cell(16, item.NurseExtra, 1, 1, false, true));
rowbody.Data.Add(new Cell(17, item.NurseScoringAverage, 1, 1, false, true));
rowbody.Data.Add(new Cell(18, item.NurseAdjustFactor, 1, 1, false, true));
rowbody.Data.Add(new Cell(1, item.DoctorAccountingUnit, 1, 1, false, false));
rowbody.Data.Add(new Cell(2, item.NurseAccountingUnit, 1, 1, false, false));
rowbody.Data.Add(new Cell(3, item.Department, 1, 1, false, false));
rowbody.Data.Add(new Cell(4, item.DoctorNumber, 1, 1, false, true));
rowbody.Data.Add(new Cell(5, item.DoctorBasicFactor, 1, 1, false, true));
rowbody.Data.Add(new Cell(6, item.DoctorSlopeFactor, 1, 1, false, true));
rowbody.Data.Add(new Cell(7, item.DoctorOtherPerfor1, 1, 1, false, true));
rowbody.Data.Add(new Cell(8, item.DoctorOtherPerfor2, 1, 1, false, true));
rowbody.Data.Add(new Cell(9, item.DoctorExtra, 1, 1, false, true));
rowbody.Data.Add(new Cell(10, item.DoctorScoringAverage, 1, 1, false, true));
rowbody.Data.Add(new Cell(11, item.DoctorAdjustFactor, 1, 1, false, true));
rowbody.Data.Add(new Cell(12, item.NurseNumber, 1, 1, false, true));
rowbody.Data.Add(new Cell(13, item.NurseBasicFactor, 1, 1, false, true));
rowbody.Data.Add(new Cell(14, item.NurseSlopeFactor, 1, 1, false, true));
rowbody.Data.Add(new Cell(15, item.NurseOtherPerfor1, 1, 1, false, true));
rowbody.Data.Add(new Cell(16, item.NurseOtherPerfor2, 1, 1, false, true));
rowbody.Data.Add(new Cell(17, item.NurseExtra, 1, 1, false, true));
rowbody.Data.Add(new Cell(18, item.NurseScoringAverage, 1, 1, false, true));
rowbody.Data.Add(new Cell(19, item.NurseAdjustFactor, 1, 1, false, true));
response.Row.Add(rowbody);
}
}
......
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