Commit bc0908d8 by lcx

工作量模板去除核算科室

parent 12b390cb
......@@ -20,17 +20,20 @@ public class HistoryService : IAutoInjection
private readonly PerforReportoriginalsurgeryRepository reportoriginalsurgeryRepository;
private readonly PerforReportoriginalstaysRepository reportoriginalstaysRepository;
private readonly PerforReportoriginalpersontimeRepository reportoriginalpersontimeRepository;
private readonly PerforPerdeptdicRepository perdeptdicRepository;
public HistoryService(
ILogger<EmployeeService> logger,
PerforReportoriginalsurgeryRepository reportoriginalsurgeryRepository,
PerforReportoriginalstaysRepository reportoriginalstaysRepository,
PerforReportoriginalpersontimeRepository reportoriginalpersontimeRepository)
PerforReportoriginalpersontimeRepository reportoriginalpersontimeRepository,
PerforPerdeptdicRepository perdeptdicRepository)
{
this.logger = logger;
this.reportoriginalsurgeryRepository = reportoriginalsurgeryRepository;
this.reportoriginalstaysRepository = reportoriginalstaysRepository;
this.reportoriginalpersontimeRepository = reportoriginalpersontimeRepository;
this.perdeptdicRepository = perdeptdicRepository;
}
public void ImportHistoryData(int hospitalid, string path)
{
......@@ -80,9 +83,9 @@ private List<HistoryData> ReadExcelData(int hospitalid, string path)
var entities = new List<HistoryData>();
var config = new[]
{
new { sheetName = "工作量", columnNames = new string[] { "年份", "月份", "来源", "核算单元", "科室", "数量" } },
new { sheetName = "手术量", columnNames = new string[] { "年份", "月份", "来源", "核算单元", "科室", "数量" } },
new { sheetName = "住院天数", columnNames = new string[] { "年份", "月份", "来源", "核算单元", "科室", "数量" } },
new { sheetName = "工作量", columnNames = new string[] { "年份", "月份", "来源", "科室", "数量" } },
new { sheetName = "手术量", columnNames = new string[] { "年份", "月份", "来源", "科室", "数量" } },
new { sheetName = "住院天数", columnNames = new string[] { "年份", "月份", "来源", "科室", "数量" } },
};
IWorkbook workbook = null;
......@@ -140,13 +143,29 @@ private List<HistoryData> ReadExcelData(int hospitalid, string path)
Year = ConvertHelper.To<int>(row.GetCell(dict["年份"]).GetValue()),
Month = ConvertHelper.To<int>(row.GetCell(dict["月份"]).GetValue()),
SourceType = row.GetCell(dict["来源"]).GetValue(),
AccountingUnit = row.GetCell(dict["核算单元"]).GetValue(),
Department = row.GetCell(dict["科室"]).GetValue(),
ResultData = ConvertHelper.To<decimal>(row.GetCell(dict["数量"]).GetValue()),
};
//if (dict.ContainsKey("核算单元"))
// entity.AccountingUnit = row.GetCell(dict["核算单元"]).GetValue();
entities.Add(entity);
}
}
var departmentDict = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalid);
if (departmentDict != null && departmentDict.Any())
{
var unittype = EnumHelper.GetItems<UnitType>();
entities.ForEach(t =>
{
var accountingUnits = departmentDict.Where(w => w.Department == t.Department);
if (accountingUnits != null && accountingUnits.Any())
{
var accountingUnit = accountingUnits.OrderBy(o => (unittype.FirstOrDefault(f => f.Name == o.UnitType)?.Value) ?? int.MaxValue).FirstOrDefault(f => !string.IsNullOrEmpty(f.AccountingUnit))?.AccountingUnit;
t.AccountingUnit = accountingUnit;
}
});
}
return entities;
}
}
......
......@@ -74,7 +74,7 @@ public void CreateAllotPersons(int hospitalId, int allotId, int prevAllotId = -1
if (isExist) return;
List<per_employee> persons = new List<per_employee>();
if (new int[] { -1, 0 }.Contains(prevAllotId))
if (!new int[] { -1, 0 }.Contains(prevAllotId))
{
persons = peremployeeRepository.GetEntities(t => t.HospitalId == hospitalId && t.AllotId == prevAllotId);
if (persons == null || !persons.Any())
......
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