Commit 6cee8eb3 by lcx

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

parent 7e4c9653
......@@ -38,6 +38,8 @@ public ApiResponse List()
{
var userId = claimService.GetUserId();
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);
}
......
......@@ -63,7 +63,7 @@ public UserRequestValidator()
RuleFor(x => x.RealName).NotNull().NotEmpty();
RuleFor(x => x.Login).NotNull().NotEmpty();
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", () =>
......@@ -98,7 +98,7 @@ public UserRequestValidator()
return CustomValidator.IsMobile(pre);
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_
var deptAccounting = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountBasic);
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>();
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,
AccountingUnit = t.Key.AccountingUnit,
Department = t.Key.Department,
CellValue = t.Sum(g => g.CellValue)
}).ToList();
deptExtra = assessList.GroupBy(t => new { t.UnitType, t.AccountingUnit, t.Department }).Select(t => new PerData
{
UnitType = t.Key.UnitType,
AccountingUnit = t.Key.AccountingUnit,
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);
......
using Dapper;
using Dapper;
......@@ -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)
: AlllotExecute(email, hospital, configs, modules, items, specials, data, lastAllot, filePath);
: AlllotExecute(email, hospital, configs, modules, items, specials, data, lastAllot, filePath);
}
catch (Exception ex)
{
......@@ -917,7 +917,9 @@ private void WriteAccountBasic(ISheet sheet, IPerSheetDataRead sheetRead, bool i
{
if (pair.Value == -1) continue;
var cell = GetOrCreate(row, pair.Value);
cell.SetCellValue("");
var func = dict[pair.Key];
if (func != null)
OutToExcelCell(cell, func.Invoke(data));
}
data.IsDelete = 1;
}
......
......@@ -34,6 +34,7 @@ public class SecondAllotService : IAutoInjection
private readonly PerforAgworkloadtypeRepository perforAgworkloadtypeRepository;
private readonly PerforRoleRepository roleRepository;
private readonly PerforResspecialunitRepository resspecialunitRepository;
private readonly PersonService personService;
private readonly List<ag_tempitem> tempitems = new List<ag_tempitem>();
public SecondAllotService(IOptions<Application> application,
......@@ -53,7 +54,8 @@ public class SecondAllotService : IAutoInjection
PerforAgothersourceRepository perforAgothersourceRepository,
PerforAgworkloadtypeRepository perforAgworkloadtypeRepository,
PerforRoleRepository roleRepository,
PerforResspecialunitRepository resspecialunitRepository)
PerforResspecialunitRepository resspecialunitRepository,
PersonService personService)
{
this.application = application.Value;
this.perforUserRepository = perforUserRepository;
......@@ -73,6 +75,7 @@ public class SecondAllotService : IAutoInjection
this.perforAgworkloadtypeRepository = perforAgworkloadtypeRepository;
this.roleRepository = roleRepository;
this.resspecialunitRepository = resspecialunitRepository;
this.personService = personService;
this.tempitems = perforAgtempitemRepository.GetEntities();
}
......@@ -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>
......
......@@ -335,33 +335,34 @@ public List<sys_role> RoleList(int userId)
/// <returns></returns>
public List<TitleValue> Department(int hospitalId)
{
var allotList = _perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId);
var result = new List<string>();
if (allotList != null)
{
var idList = allotList.Select(s => s.ID).ToList();
//var department = _employeeRepository.GetEntities(t => t.Department != "" && idList.Contains(t.AllotID.Value)).Select(t => t.Department);
//if (department != null && department.Count() > 0)
// result.AddRange(department);
var department = _imaccountbasicRepository.GetEntities(t => !string.IsNullOrEmpty(t.DoctorAccountingUnit) && idList.Contains(t.AllotID.Value))?.Select(t => t.DoctorAccountingUnit);
if (department != null && department.Count() > 0)
result.AddRange(department);
// 特殊科室
department = _imspecialunitRepository.GetEntities(t => !string.IsNullOrEmpty(t.AccountingUnit) && idList.Contains(t.AllotID.Value))?.Select(t => t.AccountingUnit);
if (department != null && department.Count() > 0)
result.AddRange(department);
if (result != null && result.Any())
{
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 result = list.Select(t => t.AccountingUnit).Distinct().OrderBy(t => t);
//var allotList = _perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId);
//var result = new List<string>();
//if (allotList != null)
//{
// var idList = allotList.Select(s => s.ID).ToList();
// //var department = _employeeRepository.GetEntities(t => t.Department != "" && idList.Contains(t.AllotID.Value)).Select(t => t.Department);
// //if (department != null && department.Count() > 0)
// // result.AddRange(department);
// var department = _imaccountbasicRepository.GetEntities(t => !string.IsNullOrEmpty(t.DoctorAccountingUnit) && idList.Contains(t.AllotID.Value))?.Select(t => t.DoctorAccountingUnit);
// if (department != null && department.Count() > 0)
// result.AddRange(department);
// // 特殊科室
// department = _imspecialunitRepository.GetEntities(t => !string.IsNullOrEmpty(t.AccountingUnit) && idList.Contains(t.AllotID.Value))?.Select(t => t.AccountingUnit);
// if (department != null && department.Count() > 0)
// result.AddRange(department);
// if (result != null && result.Any())
// {
// 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 result = list.Select(t => t.AccountingUnit).Distinct().OrderBy(t => t);
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