bug

parent 846d0fe4
...@@ -84,6 +84,6 @@ public class PerDataAccount : IPerData ...@@ -84,6 +84,6 @@ public class PerDataAccount : IPerData
/// <summary> /// <summary>
/// 实发绩效 /// 实发绩效
/// </summary> /// </summary>
public Nullable<decimal> GiveFee { get; set; } public Nullable<decimal> RealGiveFee { get; set; }
} }
} }
...@@ -25,7 +25,7 @@ public class DoctorResponse ...@@ -25,7 +25,7 @@ public class DoctorResponse
/// 分组名称(医生、护士) /// 分组名称(医生、护士)
/// </summary> /// </summary>
public string UnitName { get; set; } public string UnitName { get; set; }
/// <summary> /// <summary>
/// 核算单元 /// 核算单元
/// </summary> /// </summary>
...@@ -104,6 +104,6 @@ public class DoctorResponse ...@@ -104,6 +104,6 @@ public class DoctorResponse
/// <summary> /// <summary>
/// 实发绩效 /// 实发绩效
/// </summary> /// </summary>
public Nullable<decimal> GiveFee { get; set; } public Nullable<decimal> RealGiveFee { get; set; }
} }
} }
...@@ -104,6 +104,6 @@ public class NurseResponse ...@@ -104,6 +104,6 @@ public class NurseResponse
/// <summary> /// <summary>
/// 实发绩效 /// 实发绩效
/// </summary> /// </summary>
public Nullable<decimal> GiveFee { get; set; } public Nullable<decimal> RealGiveFee { get; set; }
} }
} }
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
// * history : Created by T4 2019-03-22 15:48:55 // * history : Created by T4 2019-03-22 15:48:55
// </copyright> // </copyright>
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
using System;
using Performance.EntityModels; using Performance.EntityModels;
using System;
using System.Collections.Generic;
namespace Performance.Repository namespace Performance.Repository
{ {
...@@ -14,24 +15,29 @@ namespace Performance.Repository ...@@ -14,24 +15,29 @@ namespace Performance.Repository
/// </summary> /// </summary>
public class PerforCofdirectorRepository : PerforRepository<cof_director> public class PerforCofdirectorRepository : PerforRepository<cof_director>
{ {
public PerforCofdirectorRepository(PerformanceDbContext context) : base(context) public PerforCofdirectorRepository(PerformanceDbContext context) : base(context)
{ {
} }
public int DeleteData(int allotId) public int DeleteData(int allotId)
{ {
return Execute("delete from im_accountbasic where allotid=@allotid;" + List<string> tableArray = new List<string>
"delete from im_data where allotid=@allotid;" + {
"delete from im_employee where allotid=@allotid;" + "im_accountbasic",
"delete from im_header where allotid=@allotid;" + "im_data",
"delete from im_specialunit where allotid=@allotid;" + "im_employee",
"delete from per_allot where allotid=@allotid;" + "im_header",
"delete from per_sheet where allotid=@allotid;" + "im_specialunit",
"delete from res_accountdoctor where allotid=@allotid;" + "per_sheet",
"delete from res_accountnurse where allotid=@allotid;" + "res_accountdoctor",
"delete from res_baiscnorm where allotid=@allotid;" + "res_accountnurse",
"delete from res_compute where allotid=@allotid;" + "res_baiscnorm",
"delete from res_specialunit where allotid=@allotid;" "res_compute",
, new { allotid = allotId }); "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) ...@@ -176,29 +176,37 @@ public bool Update(per_allot allot)
/// <param name="user"></param> /// <param name="user"></param>
public void Generate(per_allot allot, UserIdentity user) public void Generate(per_allot allot, UserIdentity user)
{ {
configService.Clear(allot.ID); try
_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)); configService.Clear(allot.ID);
SendEmail(allot, user.Mail, false); _allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.InCheckData, EnumHelper.GetDescription(AllotStates.InCheckData));
return; // 导出数据
} var excel = importDataService.ReadDataAndSave(allot);
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.InGenerate, EnumHelper.GetDescription(AllotStates.InGenerate)); if (!checkDataService.Check(excel, allot))
// 计算合并数据 {
List<PerSheet> list = processComputService.MergeAndSave(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); var baiscnormList = resultComputeService.Compute(allot, excel, baiscnorm);
resultComputeService.SpecialUnitCompute(excel, allot, baiscnormList); resultComputeService.SpecialUnitCompute(excel, allot, baiscnormList);
_allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.GenerateSucceed, EnumHelper.GetDescription(AllotStates.GenerateSucceed)); _allotRepository.UpdateAllotStates(allot.ID, (int)AllotStates.GenerateSucceed, EnumHelper.GetDescription(AllotStates.GenerateSucceed));
//发送邮件 //发送邮件
SendEmail(allot, user.Mail, true); 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) private void SendEmail(per_allot allot, string mail, bool isPass)
......
...@@ -88,14 +88,8 @@ public List<DoctorResponse> GetDoctorPerformance(int allotId) ...@@ -88,14 +88,8 @@ public List<DoctorResponse> GetDoctorPerformance(int allotId)
{ {
var list = _perforResAccountdoctorRepository.GetEntities(t => t.AllotID == allotId); var list = _perforResAccountdoctorRepository.GetEntities(t => t.AllotID == allotId);
List<DoctorResponse> doctor = Mapper.Map<List<DoctorResponse>>(list); List<DoctorResponse> doctor = Mapper.Map<List<DoctorResponse>>(list);
if (doctor != null) doctor?.ForEach(t => t.UnitName = "医生组");
{ return doctor;
foreach (var item in doctor)
{
item.UnitName = "医生组";
}
}
return Mapper.Map<List<DoctorResponse>>(doctor);
} }
/// <summary> /// <summary>
...@@ -107,14 +101,8 @@ public List<NurseResponse> GetNursePerformance(int allotId) ...@@ -107,14 +101,8 @@ public List<NurseResponse> GetNursePerformance(int allotId)
{ {
var list = _perforResAccountnurseRepository.GetEntities(t => t.AllotID == allotId); var list = _perforResAccountnurseRepository.GetEntities(t => t.AllotID == allotId);
List<NurseResponse> nurse = Mapper.Map<List<NurseResponse>>(list); List<NurseResponse> nurse = Mapper.Map<List<NurseResponse>>(list);
if (nurse != null) nurse?.ForEach(t => t.UnitName = "护理组");
{ return nurse;
foreach (var item in nurse)
{
item.UnitName = "护理组";
}
}
return Mapper.Map<List<NurseResponse>>(nurse);
} }
/// <summary> /// <summary>
...@@ -140,13 +128,15 @@ public DeptDetailResponse GetDepartmentDetail(DeptDetailRequest request) ...@@ -140,13 +128,15 @@ public DeptDetailResponse GetDepartmentDetail(DeptDetailRequest request)
if (sheetWorkload == null) if (sheetWorkload == null)
return null; return null;
var dataWorkloadList = _perforImDataRepository.GetEntities(t => t.SheetID == sheetWorkload.ID && t.IsTotal != 1 && t.AccountingUnit == doctor.AccountingUnit); 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); var sheetEconomic = sheetList.FirstOrDefault(t => t.SheetType == (int)SheetType.ComputeEconomic);
if (sheetEconomic == null) if (sheetEconomic == null)
return null; return null;
var dataEconomicList = _perforImDataRepository.GetEntities(t => t.SheetID == sheetEconomic.ID && t.UnitType == 1 && t.IsTotal != 1 && t.AccountingUnit == doctor.AccountingUnit); 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; return response;
} }
...@@ -171,6 +161,7 @@ public DeptDetailResponse GetDepartmentDetail(DeptDetailRequest request) ...@@ -171,6 +161,7 @@ public DeptDetailResponse GetDepartmentDetail(DeptDetailRequest request)
return null; return null;
var dataEconomicList = _perforImDataRepository.GetEntities(t => t.SheetID == sheetEconomic.ID && t.UnitType == 2 && t.IsTotal != 1 && t.AccountingUnit == nurse.AccountingUnit); 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 })); dataEconomicList.ForEach(t => response.Economic.Add(new DeptDetail { ItemName = t.TypeName, ItemValue = t.CellValue ?? 0 }));
return response;
} }
return null; return null;
......
...@@ -272,18 +272,7 @@ public bool WorkDelete(WorkyearRequest request) ...@@ -272,18 +272,7 @@ public bool WorkDelete(WorkyearRequest request)
/// <param name="allotId"></param> /// <param name="allotId"></param>
public void Clear(int allotId) public void Clear(int allotId)
{ {
var director = _directorRepository.GetEntities(t => t.AllotID == allotId); _directorRepository.DeleteData(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());
} }
......
...@@ -22,6 +22,7 @@ public class SheetSevice : IAutoInjection ...@@ -22,6 +22,7 @@ public class SheetSevice : IAutoInjection
private PerforImaccountbasicRepository _perforImaccountbasicRepository; private PerforImaccountbasicRepository _perforImaccountbasicRepository;
private PerforResAccountdoctorRepository _perforImaccountdoctorRepository; private PerforResAccountdoctorRepository _perforImaccountdoctorRepository;
private PerforResAccountnurseRepository _perforImaccountnurseRepository; private PerforResAccountnurseRepository _perforImaccountnurseRepository;
private PerforImspecialunitRepository _perforImspecialunitRepository;
public SheetSevice(PerforPerAllotRepository perforAllotRepository, public SheetSevice(PerforPerAllotRepository perforAllotRepository,
PerforPerSheetRepository perforImSheetRepository, PerforPerSheetRepository perforImSheetRepository,
...@@ -30,7 +31,8 @@ public class SheetSevice : IAutoInjection ...@@ -30,7 +31,8 @@ public class SheetSevice : IAutoInjection
PerforImEmployeeRepository perforImEmployeeRepository, PerforImEmployeeRepository perforImEmployeeRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository, PerforImaccountbasicRepository perforImaccountbasicRepository,
PerforResAccountdoctorRepository perforImaccountdoctorRepository, PerforResAccountdoctorRepository perforImaccountdoctorRepository,
PerforResAccountnurseRepository perforImaccountnurseRepository) PerforResAccountnurseRepository perforImaccountnurseRepository,
PerforImspecialunitRepository perforImspecialunitRepository)
{ {
_perforAllotRepository = perforAllotRepository; _perforAllotRepository = perforAllotRepository;
_perforImSheetRepository = perforImSheetRepository; _perforImSheetRepository = perforImSheetRepository;
...@@ -40,6 +42,7 @@ public class SheetSevice : IAutoInjection ...@@ -40,6 +42,7 @@ public class SheetSevice : IAutoInjection
_perforImaccountdoctorRepository = perforImaccountdoctorRepository; _perforImaccountdoctorRepository = perforImaccountdoctorRepository;
_perforImaccountnurseRepository = perforImaccountnurseRepository; _perforImaccountnurseRepository = perforImaccountnurseRepository;
_perforImaccountbasicRepository = perforImaccountbasicRepository; _perforImaccountbasicRepository = perforImaccountbasicRepository;
_perforImspecialunitRepository = perforImspecialunitRepository;
} }
/// <summary> /// <summary>
...@@ -76,6 +79,10 @@ public SheetExportResponse SheetExport(int sheetID) ...@@ -76,6 +79,10 @@ public SheetExportResponse SheetExport(int sheetID)
{ {
EmployeeExport(sheetID, response); EmployeeExport(sheetID, response);
} }
else if (sheet.SheetType == (int)SheetType.SpecialUnit)
{
SpecialUnitExport(sheetID, response);
}
else if (sheet.SheetType == (int)SheetType.AccountBasic) else if (sheet.SheetType == (int)SheetType.AccountBasic)
{ {
AccountBaiscExport(sheetID, response); AccountBaiscExport(sheetID, response);
...@@ -96,9 +103,47 @@ public SheetExportResponse SheetExport(int sheetID) ...@@ -96,9 +103,47 @@ public SheetExportResponse SheetExport(int sheetID)
return response; 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) 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); var dataList = _perforImDataRepository.GetEntities(t => t.SheetID == sheetID);
if (dataList == null || dataList.Count == 0) return; 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