Commit 8adb1960 by lcx

大屏数据导入

parent eae556ea
......@@ -253,9 +253,6 @@
<member name="P:Performance.EntityModels.PerformanceDbContext.report_original_workload">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.report_performance_category">
<summary> </summary>
</member>
<member name="P:Performance.EntityModels.PerformanceDbContext.report_performance_person_tags">
<summary> </summary>
</member>
......@@ -5076,41 +5073,6 @@
预算
</summary>
</member>
<member name="T:Performance.EntityModels.report_performance_category">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.report_performance_category.Category">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.report_performance_category.HospitalId">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.report_performance_category.Original">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.report_performance_category.ItemName">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.report_performance_category.Year">
<summary>
</summary>
</member>
<member name="P:Performance.EntityModels.report_performance_category.Month">
<summary>
</summary>
</member>
<member name="T:Performance.EntityModels.report_performance_person_tags">
<summary>
......
......@@ -179,8 +179,6 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
/// <summary> </summary>
public virtual DbSet<report_original_workload> report_original_workload { get; set; }
/// <summary> </summary>
public virtual DbSet<report_performance_category> report_performance_category { get; set; }
/// <summary> </summary>
public virtual DbSet<report_performance_person_tags> report_performance_person_tags { get; set; }
/// <summary> </summary>
public virtual DbSet<report_performance_tags> report_performance_tags { get; set; }
......
//-----------------------------------------------------------------------
// <copyright file=" report_performance_category.cs">
// * FileName: .cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels
{
/// <summary>
///
/// </summary>
[Table("report_performance_category")]
public class report_performance_category
{
/// <summary>
///
/// </summary>
public string Category { get; set; }
/// <summary>
///
/// </summary>
public int HospitalId { get; set; }
/// <summary>
///
/// </summary>
public string Original { get; set; }
/// <summary>
///
/// </summary>
public string ItemName { get; set; }
/// <summary>
///
/// </summary>
public int Year { get; set; }
/// <summary>
///
/// </summary>
public int Month { get; set; }
}
}
//-----------------------------------------------------------------------
// <copyright file=" report_performance_category.cs">
// * FileName: report_performance_category.cs
// </copyright>
//-----------------------------------------------------------------------
using System;
using Performance.EntityModels;
namespace Performance.Repository
{
/// <summary>
/// report_performance_category Repository
/// </summary>
public partial class PerforReportperformancecategoryRepository : PerforRepository<report_performance_category>
{
public PerforReportperformancecategoryRepository(PerformanceDbContext context) : base(context)
{
}
}
}
......@@ -253,6 +253,7 @@ private void ImportBasicData(ISheet sheet, List<string> columns, int hospitalId,
};
data.Add(importdata);
}
logger.LogInformation($"{sheet.SheetName}共有{sheet.LastRowNum}行数据,读取到{data.Count}条记录");
if (data == null || !data.Any(t => t.Year != 0 && t.Month != 0)) return;
var dateTime = DateTime.Now;
......@@ -267,7 +268,9 @@ private void ImportBasicData(ISheet sheet, List<string> columns, int hospitalId,
var yearMonths = data.Select(t => $"{t.Year}-{t.Month}").Distinct();
hisimportdataRepository.DeleteFromQuery(t => t.HospitalId == hospitalId && yearMonths.Contains($"{t.Year}-{t.Month}") && t.Category == sheetName);
var entities = hisimportdataRepository.GetEntities(t => t.HospitalId == hospitalId && yearMonths.Contains($"{t.Year}-{t.Month}") && t.Category == sheetName);
if (entities != null && entities.Any())
hisimportdataRepository.BulkDelete(entities);
hisimportdataRepository.BulkInsert(data.Where(t => t.Year != 0 && t.Month != 0));
}
......@@ -301,7 +304,9 @@ private void ImporSummaryData(ISheet sheet, List<string> columns, int hospitalId
var yearMonths = data.Select(t => $"{t.Year}-{t.Month}").Distinct();
hisimportsummaryRepository.DeleteFromQuery(t => t.HospitalId == hospitalId && yearMonths.Contains($"{t.Year}-{t.Month}"));
var entities = hisimportsummaryRepository.GetEntities(t => t.HospitalId == hospitalId && yearMonths.Contains($"{t.Year}-{t.Month}"));
if (entities != null && entities.Any())
hisimportsummaryRepository.BulkDelete(entities);
hisimportsummaryRepository.BulkInsert(data.Where(t => t.Year != 0 && t.Month != 0));
}
......@@ -337,7 +342,9 @@ private void ImporAccountData(ISheet sheet, List<string> columns, int hospitalId
var yearMonths = data.Select(t => $"{t.Year}-{t.Month}").Distinct();
hisimportaccountRepository.DeleteFromQuery(t => t.HospitalId == hospitalId && yearMonths.Contains($"{t.Year}-{t.Month}"));
var entities = hisimportaccountRepository.GetEntities(t => t.HospitalId == hospitalId && yearMonths.Contains($"{t.Year}-{t.Month}"));
if (entities != null && entities.Any())
hisimportaccountRepository.BulkDelete(entities);
hisimportaccountRepository.BulkInsert(data.Where(t => t.Year != 0 && t.Month != 0));
}
......@@ -410,7 +417,9 @@ private void ImporClinicData(ISheet sheet, List<string> columns, int hospitalId,
var yearMonths = data.Select(t => $"{t.Year}-{t.Month}").Distinct();
hisimportclinicRepository.DeleteFromQuery(t => t.HospitalId == hospitalId && yearMonths.Contains($"{t.Year}-{t.Month}"));
var entities = hisimportclinicRepository.GetEntities(t => t.HospitalId == hospitalId && yearMonths.Contains($"{t.Year}-{t.Month}"));
if (entities != null && entities.Any())
hisimportclinicRepository.BulkDelete(entities);
hisimportclinicRepository.BulkInsert(data.Where(t => t.Year != 0 && t.Month != 0));
}
......@@ -482,7 +491,9 @@ private void ImporBasicnormData(ISheet sheet, List<string> columns, int hospital
var yearMonths = data.Select(t => $"{t.Year}-{t.Month}").Distinct();
hisimportbaiscnormRepository.DeleteFromQuery(t => t.HospitalId == hospitalId && yearMonths.Contains($"{t.Year}-{t.Month}"));
var entities = hisimportbaiscnormRepository.GetEntities(t => t.HospitalId == hospitalId && yearMonths.Contains($"{t.Year}-{t.Month}"));
if (entities != null && entities.Any())
hisimportbaiscnormRepository.BulkDelete(entities);
hisimportbaiscnormRepository.BulkInsert(data.Where(t => t.Year != 0 && t.Month != 0));
}
......@@ -498,7 +509,7 @@ private List<string> GetColumns(ISheet sheet, string sheetName, out string sourc
}
}
if (string.IsNullOrEmpty(sourceType)) return new List<string>(); ;
//if (string.IsNullOrEmpty(sourceType)) return new List<string>(); ;
var columnRow = sheet.GetOrCreate(0);
return columnRow.GetCellValues();
......
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