bug

parent 846d0fe4
......@@ -84,6 +84,6 @@ public class PerDataAccount : IPerData
/// <summary>
/// 实发绩效
/// </summary>
public Nullable<decimal> GiveFee { get; set; }
public Nullable<decimal> RealGiveFee { get; set; }
}
}
......@@ -25,7 +25,7 @@ public class DoctorResponse
/// 分组名称(医生、护士)
/// </summary>
public string UnitName { get; set; }
/// <summary>
/// 核算单元
/// </summary>
......@@ -104,6 +104,6 @@ public class DoctorResponse
/// <summary>
/// 实发绩效
/// </summary>
public Nullable<decimal> GiveFee { get; set; }
public Nullable<decimal> RealGiveFee { get; set; }
}
}
......@@ -104,6 +104,6 @@ public class NurseResponse
/// <summary>
/// 实发绩效
/// </summary>
public Nullable<decimal> GiveFee { get; set; }
public Nullable<decimal> RealGiveFee { get; set; }
}
}
......@@ -4,8 +4,9 @@
// * history : Created by T4 2019-03-22 15:48:55
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
using System;
using System.Collections.Generic;
namespace Performance.Repository
{
......@@ -14,24 +15,29 @@ namespace Performance.Repository
/// </summary>
public class PerforCofdirectorRepository : PerforRepository<cof_director>
{
public PerforCofdirectorRepository(PerformanceDbContext context) : base(context)
public PerforCofdirectorRepository(PerformanceDbContext context) : base(context)
{
}
public int DeleteData(int allotId)
{
return Execute("delete from im_accountbasic where allotid=@allotid;" +
"delete from im_data where allotid=@allotid;" +
"delete from im_employee where allotid=@allotid;" +
"delete from im_header where allotid=@allotid;" +
"delete from im_specialunit where allotid=@allotid;" +
"delete from per_allot where allotid=@allotid;" +
"delete from per_sheet where allotid=@allotid;" +
"delete from res_accountdoctor where allotid=@allotid;" +
"delete from res_accountnurse where allotid=@allotid;" +
"delete from res_baiscnorm where allotid=@allotid;" +
"delete from res_compute where allotid=@allotid;" +
"delete from res_specialunit where allotid=@allotid;"
, new { allotid = allotId });
List<string> tableArray = new List<string>
{
"im_accountbasic",
"im_data",
"im_employee",
"im_header",
"im_specialunit",
"per_sheet",
"res_accountdoctor",
"res_accountnurse",
"res_baiscnorm",
"res_compute",
"res_specialunit",
};
string sql = "";
tableArray.ForEach(t => sql += $"delete from {t} where allotid=@allotId;");
return Execute(sql, new { allotId });
}
}
}
......@@ -176,29 +176,37 @@ public bool Update(per_allot allot)
/// <param name="user"></param>
public void Generate(per_allot allot, UserIdentity user)
{
configService.Clear(allot.ID);
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.InCheckData, EnumHelper.GetDescription(AllotStates.InCheckData));
// 导出数据
var excel = importDataService.ReadDataAndSave(allot);
if (!checkDataService.Check(excel, allot))
try
{
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.CheckFail, EnumHelper.GetDescription(AllotStates.CheckFail));
SendEmail(allot, user.Mail, false);
return;
}
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.InGenerate, EnumHelper.GetDescription(AllotStates.InGenerate));
// 计算合并数据
List<PerSheet> list = processComputService.MergeAndSave(excel, allot);
configService.Clear(allot.ID);
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.InCheckData, EnumHelper.GetDescription(AllotStates.InCheckData));
// 导出数据
var excel = importDataService.ReadDataAndSave(allot);
if (!checkDataService.Check(excel, allot))
{
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.CheckFail, EnumHelper.GetDescription(AllotStates.CheckFail));
SendEmail(allot, user.Mail, false);
return;
}
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.InGenerate, EnumHelper.GetDescription(AllotStates.InGenerate));
// 计算合并数据
List<PerSheet> list = processComputService.MergeAndSave(excel, allot);
var baiscnorm = baiscNormService.NurseBaiscnorm(list);
var baiscnorm = baiscNormService.NurseBaiscnorm(list);
// 计算最总数据
var baiscnormList = resultComputeService.Compute(allot, excel, baiscnorm);
resultComputeService.SpecialUnitCompute(excel, allot, baiscnormList);
// 计算最总数据
var baiscnormList = resultComputeService.Compute(allot, excel, baiscnorm);
resultComputeService.SpecialUnitCompute(excel, allot, baiscnormList);
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.GenerateSucceed, EnumHelper.GetDescription(AllotStates.GenerateSucceed));
//发送邮件
SendEmail(allot, user.Mail, true);
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.GenerateSucceed, EnumHelper.GetDescription(AllotStates.GenerateSucceed));
//发送邮件
SendEmail(allot, user.Mail, true);
}
catch (Exception ex)
{
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.GenerateFail, EnumHelper.GetDescription(AllotStates.GenerateFail));
throw ex;
}
}
private void SendEmail(per_allot allot, string mail, bool isPass)
......
......@@ -88,14 +88,8 @@ public List<DoctorResponse> GetDoctorPerformance(int allotId)
{
var list = _perforResAccountdoctorRepository.GetEntities(t => t.AllotID == allotId);
List<DoctorResponse> doctor = Mapper.Map<List<DoctorResponse>>(list);
if (doctor != null)
{
foreach (var item in doctor)
{
item.UnitName = "医生组";
}
}
return Mapper.Map<List<DoctorResponse>>(doctor);
doctor?.ForEach(t => t.UnitName = "医生组");
return doctor;
}
/// <summary>
......@@ -107,14 +101,8 @@ public List<NurseResponse> GetNursePerformance(int allotId)
{
var list = _perforResAccountnurseRepository.GetEntities(t => t.AllotID == allotId);
List<NurseResponse> nurse = Mapper.Map<List<NurseResponse>>(list);
if (nurse != null)
{
foreach (var item in nurse)
{
item.UnitName = "护理组";
}
}
return Mapper.Map<List<NurseResponse>>(nurse);
nurse?.ForEach(t => t.UnitName = "护理组");
return nurse;
}
/// <summary>
......@@ -140,13 +128,15 @@ public DeptDetailResponse GetDepartmentDetail(DeptDetailRequest request)
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 }));
if (dataWorkloadList != null && dataWorkloadList.Count > 0)
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 }));
if (dataEconomicList != null && dataEconomicList.Count > 0)
dataEconomicList.ForEach(t => response.Economic.Add(new DeptDetail { ItemName = t.TypeName, ItemValue = t.CellValue ?? 0 }));
return response;
}
......@@ -171,6 +161,7 @@ public DeptDetailResponse GetDepartmentDetail(DeptDetailRequest request)
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 response;
}
return null;
......
......@@ -272,18 +272,7 @@ public bool WorkDelete(WorkyearRequest request)
/// <param name="allotId"></param>
public void Clear(int allotId)
{
var director = _directorRepository.GetEntities(t => t.AllotID == allotId);
if (director != null)
_directorRepository.RemoveRange(director.ToArray());
var durgprop = _drugpropRepository.GetEntities(t => t.AllotID == allotId);
if (durgprop != null)
_drugpropRepository.RemoveRange(durgprop.ToArray());
var income = _incomeRepository.GetEntities(t => t.AllotID == allotId);
if (income != null)
_incomeRepository.RemoveRange(income.ToArray());
var workyear = _workyearRepository.GetEntities(t => t.AllotID == allotId);
if (workyear != null)
_workyearRepository.RemoveRange(workyear.ToArray());
_directorRepository.DeleteData(allotId);
}
......
......@@ -22,6 +22,7 @@ public class SheetSevice : IAutoInjection
private PerforImaccountbasicRepository _perforImaccountbasicRepository;
private PerforResAccountdoctorRepository _perforImaccountdoctorRepository;
private PerforResAccountnurseRepository _perforImaccountnurseRepository;
private PerforImspecialunitRepository _perforImspecialunitRepository;
public SheetSevice(PerforPerAllotRepository perforAllotRepository,
PerforPerSheetRepository perforImSheetRepository,
......@@ -30,7 +31,8 @@ public class SheetSevice : IAutoInjection
PerforImEmployeeRepository perforImEmployeeRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository,
PerforResAccountdoctorRepository perforImaccountdoctorRepository,
PerforResAccountnurseRepository perforImaccountnurseRepository)
PerforResAccountnurseRepository perforImaccountnurseRepository,
PerforImspecialunitRepository perforImspecialunitRepository)
{
_perforAllotRepository = perforAllotRepository;
_perforImSheetRepository = perforImSheetRepository;
......@@ -40,6 +42,7 @@ public class SheetSevice : IAutoInjection
_perforImaccountdoctorRepository = perforImaccountdoctorRepository;
_perforImaccountnurseRepository = perforImaccountnurseRepository;
_perforImaccountbasicRepository = perforImaccountbasicRepository;
_perforImspecialunitRepository = perforImspecialunitRepository;
}
/// <summary>
......@@ -76,6 +79,10 @@ public SheetExportResponse SheetExport(int sheetID)
{
EmployeeExport(sheetID, response);
}
else if (sheet.SheetType == (int)SheetType.SpecialUnit)
{
SpecialUnitExport(sheetID, response);
}
else if (sheet.SheetType == (int)SheetType.AccountBasic)
{
AccountBaiscExport(sheetID, response);
......@@ -96,9 +103,47 @@ public SheetExportResponse SheetExport(int sheetID)
return response;
}
private void SpecialUnitExport(int sheetID, SheetExportResponse response)
{
var list = _perforImspecialunitRepository.GetEntities(t => t.SheetID == sheetID);
if (list != null && list.Count() > 0)
{
var row = new Row(0);
row.Data.Add(new Cell(1, "核算单元", 1, 1, false, false));
row.Data.Add(new Cell(2, "科室", 1, 1, false, false));
row.Data.Add(new Cell(3, "人数", 1, 1, false, true));
row.Data.Add(new Cell(4, "量化指标", 1, 1, false, true));
row.Data.Add(new Cell(5, "数量", 1, 1, false, true));
row.Data.Add(new Cell(6, "量化指标绩效分值", 1, 1, false, true));
row.Data.Add(new Cell(7, "考核得分率", 1, 1, false, true));
row.Data.Add(new Cell(8, "其他绩效", 1, 1, false, true));
row.Data.Add(new Cell(9, "医院奖罚", 1, 1, false, true));
row.Data.Add(new Cell(10, "调节系数", 1, 1, false, true));
response.Header.Add(row);
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.Number, 1, 1, false, true));
rowbody.Data.Add(new Cell(4, item.QuantitativeIndicators, 1, 1, false, true));
rowbody.Data.Add(new Cell(5, item.Quantity, 1, 1, false, true));
rowbody.Data.Add(new Cell(6, item.QuantitativeIndicatorsValue, 1, 1, false, true));
rowbody.Data.Add(new Cell(7, item.ScoringAverage, 1, 1, false, true));
rowbody.Data.Add(new Cell(8, item.OtherPerfor, 1, 1, false, true));
rowbody.Data.Add(new Cell(9, item.Punishment, 1, 1, false, true));
rowbody.Data.Add(new Cell(10, item.Adjust, 1, 1, false, true));
response.Row.Add(rowbody);
}
}
}
private void CommonExport(int sheetID, SheetExportResponse response)
{
var headList = _perforImHeaderRepository.GetEntities(t => t.SheetID == sheetID).OrderBy(t => t.PointCell);
var headList = _perforImHeaderRepository.GetEntities(t => t.SheetID == sheetID)?.OrderBy(t => t.PointCell);
if (headList == null) return;
var dataList = _perforImDataRepository.GetEntities(t => t.SheetID == sheetID);
if (dataList == null || dataList.Count == 0) return;
......
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