Commit 6cee8eb3 by lcx

科室来源更改为 字典,生成时无sheet5.1兼容

parent 7e4c9653
...@@ -38,6 +38,8 @@ public ApiResponse List() ...@@ -38,6 +38,8 @@ public ApiResponse List()
{ {
var userId = claimService.GetUserId(); var userId = claimService.GetUserId();
var result = secondAllotService.GetSecondList(userId); var result = secondAllotService.GetSecondList(userId);
if (result != null && result.Any())
result = result.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).ToList();
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
} }
......
...@@ -63,7 +63,7 @@ public UserRequestValidator() ...@@ -63,7 +63,7 @@ public UserRequestValidator()
RuleFor(x => x.RealName).NotNull().NotEmpty(); RuleFor(x => x.RealName).NotNull().NotEmpty();
RuleFor(x => x.Login).NotNull().NotEmpty(); RuleFor(x => x.Login).NotNull().NotEmpty();
RuleFor(x => x.Mobile).NotNull().NotEmpty().Must((pre) => { return CustomValidator.IsMobile(pre); }); RuleFor(x => x.Mobile).NotNull().NotEmpty().Must((pre) => { return CustomValidator.IsMobile(pre); });
RuleFor(x => x.Mail).EmailAddress().When(pre => { return !string.IsNullOrEmpty(pre.Mail); }); //RuleFor(x => x.Mail).EmailAddress().When(pre => { return !string.IsNullOrEmpty(pre.Mail); });
}; };
RuleSet("Insert", () => RuleSet("Insert", () =>
...@@ -98,7 +98,7 @@ public UserRequestValidator() ...@@ -98,7 +98,7 @@ public UserRequestValidator()
return CustomValidator.IsMobile(pre); return CustomValidator.IsMobile(pre);
return true; return true;
}); });
RuleFor(x => x.Mail).EmailAddress().When(pre => { return !string.IsNullOrEmpty(pre.Mail); }); //RuleFor(x => x.Mail).EmailAddress().When(pre => { return !string.IsNullOrEmpty(pre.Mail); });
}); });
} }
} }
......
...@@ -246,18 +246,21 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, List<res_ ...@@ -246,18 +246,21 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, List<res_
var deptAccounting = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountBasic); var deptAccounting = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountBasic);
var accountList = deptAccounting.PerData.Select(t => (PerDataAccountBaisc)t); var accountList = deptAccounting.PerData.Select(t => (PerDataAccountBaisc)t);
var deptAccountAssess = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountAssess);
var assessList = deptAccountAssess.PerData.Select(t => (PerData)t);
var deptExtra = new List<PerData>(); var deptExtra = new List<PerData>();
if (isFirst && assessList != null && assessList.Any()) var deptAccountAssess = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountAssess);
if (deptAccountAssess != null && deptAccountAssess.PerData != null)
{ {
deptExtra = assessList.GroupBy(t => new { t.UnitType, t.AccountingUnit, t.Department }).Select(t => new PerData var assessList = deptAccountAssess.PerData?.Select(t => (PerData)t);
if (isFirst && assessList != null && assessList.Any())
{ {
UnitType = t.Key.UnitType, deptExtra = assessList.GroupBy(t => new { t.UnitType, t.AccountingUnit, t.Department }).Select(t => new PerData
AccountingUnit = t.Key.AccountingUnit, {
Department = t.Key.Department, UnitType = t.Key.UnitType,
CellValue = t.Sum(g => g.CellValue) AccountingUnit = t.Key.AccountingUnit,
}).ToList(); Department = t.Key.Department,
CellValue = t.Sum(g => g.CellValue)
}).ToList();
}
} }
var economicData = perSheet.FirstOrDefault(t => t.SheetType == SheetType.ComputeEconomic)?.PerData.Select(t => (PerData)t); var economicData = perSheet.FirstOrDefault(t => t.SheetType == SheetType.ComputeEconomic)?.PerData.Select(t => (PerData)t);
......
using Dapper; using Dapper;
...@@ -128,7 +128,7 @@ public string ExtractData(int allotId, string email, int hospitalId, string file ...@@ -128,7 +128,7 @@ public string ExtractData(int allotId, string email, int hospitalId, string file
} }
return lastAllot == null ? TemplateExecute(email, hospital, configs, modules, items, specials, data) return lastAllot == null ? TemplateExecute(email, hospital, configs, modules, items, specials, data)
: AlllotExecute(email, hospital, configs, modules, items, specials, data, lastAllot, filePath); : AlllotExecute(email, hospital, configs, modules, items, specials, data, lastAllot, filePath);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -917,7 +917,9 @@ private void WriteAccountBasic(ISheet sheet, IPerSheetDataRead sheetRead, bool i ...@@ -917,7 +917,9 @@ private void WriteAccountBasic(ISheet sheet, IPerSheetDataRead sheetRead, bool i
{ {
if (pair.Value == -1) continue; if (pair.Value == -1) continue;
var cell = GetOrCreate(row, pair.Value); var cell = GetOrCreate(row, pair.Value);
cell.SetCellValue(""); var func = dict[pair.Key];
if (func != null)
OutToExcelCell(cell, func.Invoke(data));
} }
data.IsDelete = 1; data.IsDelete = 1;
} }
......
...@@ -34,6 +34,7 @@ public class SecondAllotService : IAutoInjection ...@@ -34,6 +34,7 @@ public class SecondAllotService : IAutoInjection
private readonly PerforAgworkloadtypeRepository perforAgworkloadtypeRepository; private readonly PerforAgworkloadtypeRepository perforAgworkloadtypeRepository;
private readonly PerforRoleRepository roleRepository; private readonly PerforRoleRepository roleRepository;
private readonly PerforResspecialunitRepository resspecialunitRepository; private readonly PerforResspecialunitRepository resspecialunitRepository;
private readonly PersonService personService;
private readonly List<ag_tempitem> tempitems = new List<ag_tempitem>(); private readonly List<ag_tempitem> tempitems = new List<ag_tempitem>();
public SecondAllotService(IOptions<Application> application, public SecondAllotService(IOptions<Application> application,
...@@ -53,7 +54,8 @@ public class SecondAllotService : IAutoInjection ...@@ -53,7 +54,8 @@ public class SecondAllotService : IAutoInjection
PerforAgothersourceRepository perforAgothersourceRepository, PerforAgothersourceRepository perforAgothersourceRepository,
PerforAgworkloadtypeRepository perforAgworkloadtypeRepository, PerforAgworkloadtypeRepository perforAgworkloadtypeRepository,
PerforRoleRepository roleRepository, PerforRoleRepository roleRepository,
PerforResspecialunitRepository resspecialunitRepository) PerforResspecialunitRepository resspecialunitRepository,
PersonService personService)
{ {
this.application = application.Value; this.application = application.Value;
this.perforUserRepository = perforUserRepository; this.perforUserRepository = perforUserRepository;
...@@ -73,6 +75,7 @@ public class SecondAllotService : IAutoInjection ...@@ -73,6 +75,7 @@ public class SecondAllotService : IAutoInjection
this.perforAgworkloadtypeRepository = perforAgworkloadtypeRepository; this.perforAgworkloadtypeRepository = perforAgworkloadtypeRepository;
this.roleRepository = roleRepository; this.roleRepository = roleRepository;
this.resspecialunitRepository = resspecialunitRepository; this.resspecialunitRepository = resspecialunitRepository;
this.personService = personService;
this.tempitems = perforAgtempitemRepository.GetEntities(); this.tempitems = perforAgtempitemRepository.GetEntities();
} }
...@@ -327,6 +330,19 @@ public SecondResponse GetSecondDetail(UseTempRequest request) ...@@ -327,6 +330,19 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
}; };
} }
private void GetEmployees(int allotId, int userId)
{
Dictionary<int, Func<per_employee, object>> dict = new Dictionary<int, Func<per_employee, object>>
{
{ 19, (t) => t.DoctorName },
{ 20, (t) => t.JobTitle },
{ 22, (t) => t.AttendanceDay },
};
var employees = personService.GetPersons(allotId, userId);
var list = new List<BodyItem>();
}
/// <summary> /// <summary>
/// 根据已保存的数据返回 /// 根据已保存的数据返回
/// </summary> /// </summary>
......
...@@ -335,33 +335,34 @@ public List<sys_role> RoleList(int userId) ...@@ -335,33 +335,34 @@ public List<sys_role> RoleList(int userId)
/// <returns></returns> /// <returns></returns>
public List<TitleValue> Department(int hospitalId) public List<TitleValue> Department(int hospitalId)
{ {
var allotList = _perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId); //var allotList = _perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId);
var result = new List<string>(); //var result = new List<string>();
if (allotList != null) //if (allotList != null)
{ //{
var idList = allotList.Select(s => s.ID).ToList(); // var idList = allotList.Select(s => s.ID).ToList();
//var department = _employeeRepository.GetEntities(t => t.Department != "" && idList.Contains(t.AllotID.Value)).Select(t => t.Department); // //var department = _employeeRepository.GetEntities(t => t.Department != "" && idList.Contains(t.AllotID.Value)).Select(t => t.Department);
//if (department != null && department.Count() > 0) // //if (department != null && department.Count() > 0)
// result.AddRange(department); // // result.AddRange(department);
var department = _imaccountbasicRepository.GetEntities(t => !string.IsNullOrEmpty(t.DoctorAccountingUnit) && idList.Contains(t.AllotID.Value))?.Select(t => t.DoctorAccountingUnit); // var department = _imaccountbasicRepository.GetEntities(t => !string.IsNullOrEmpty(t.DoctorAccountingUnit) && idList.Contains(t.AllotID.Value))?.Select(t => t.DoctorAccountingUnit);
if (department != null && department.Count() > 0) // if (department != null && department.Count() > 0)
result.AddRange(department); // result.AddRange(department);
// 特殊科室 // // 特殊科室
department = _imspecialunitRepository.GetEntities(t => !string.IsNullOrEmpty(t.AccountingUnit) && idList.Contains(t.AllotID.Value))?.Select(t => t.AccountingUnit); // department = _imspecialunitRepository.GetEntities(t => !string.IsNullOrEmpty(t.AccountingUnit) && idList.Contains(t.AllotID.Value))?.Select(t => t.AccountingUnit);
if (department != null && department.Count() > 0) // if (department != null && department.Count() > 0)
result.AddRange(department); // result.AddRange(department);
if (result != null && result.Any()) // if (result != null && result.Any())
{ // {
result = result.Distinct().OrderBy(t => t).ToList(); // result = result.Distinct().OrderBy(t => t).ToList();
} // }
} //}
//var list = _perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId);
//if (list == null || !list.Any()) return new List<TitleValue>(); var list = _perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalId);
if (list == null || !list.Any()) return new List<TitleValue>();
//var result = list.Select(t => t.AccountingUnit).Distinct().OrderBy(t => t);
var result = list.Select(t => t.AccountingUnit).Distinct().OrderBy(t => t);
return result?.Select(t => new TitleValue { Title = t, Value = t }).ToList(); return result?.Select(t => new TitleValue { Title = t, Value = t }).ToList();
} }
......
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