Commit c2ff7db2 by 李承祥

修改数据提取中 获取核算单元的sql

parent f0358673
...@@ -18,11 +18,20 @@ public PerforImdataRepository(PerformanceDbContext context) : base(context) ...@@ -18,11 +18,20 @@ public PerforImdataRepository(PerformanceDbContext context) : base(context)
{ {
} }
public IEnumerable<im_data> GetAccountingUnit(List<int> sheetList, List<string> deptList, List<int> allotList) /// <summary>
/// 获取核算单元
/// </summary>
/// <param name="deptList">科室列表</param>
/// <param name="hospitalid">医院id</param>
/// <param name="sheetType">sheet模板类型</param>
/// <returns></returns>
public IEnumerable<im_data> GetAccountingUnit(int hospitalid, int sheettype, List<string> deptList)
{ {
string sql = "select distinct accountingUnit,department,unittype from im_data " + string sql = "select distinct im.accountingUnit,im.department,im.unittype from im_data im " +
"where sheetid in @sheetList and department in @deptList and allotid in @allotList"; "inner join per_allot allot on im.AllotID = allot.ID " +
return DapperQuery(sql, new { sheetList, deptList, allotList }, 1000 * 60 * 5); "inner join per_sheet sheet on im.SheetID = sheet.ID " +
"where allot.hospitalid = @hospitalid and sheet.sheettype = @sheettype and im.department in @deptList";
return DapperQuery(sql, new { hospitalid, sheettype, deptList }, 1000 * 60 * 5);
} }
} }
} }
...@@ -337,9 +337,7 @@ private bool WriteExcel(string newpath, string originalPath, List<PerSheet> shee ...@@ -337,9 +337,7 @@ private bool WriteExcel(string newpath, string originalPath, List<PerSheet> shee
//用于查询核算单元 //用于查询核算单元
var deptList = dataList.Where(t => t.ColumnName == "科室名称").Select(t => t.Value.ToString()).Distinct().ToList(); var deptList = dataList.Where(t => t.ColumnName == "科室名称").Select(t => t.Value.ToString()).Distinct().ToList();
var sheetIdList = perforPersheetRepository.GetEntities(t => t.SheetType == (int)sheet.SheetType).Select(t => t.ID).ToList(); var imdata = perforImdataRepository.GetAccountingUnit(hospitalId, (int)sheet.SheetType, deptList);
var allotIdList = perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId).Select(t => t.ID).ToList();
var imdata = perforImdataRepository.GetAccountingUnit(sheetIdList, deptList, allotIdList);
//创建数据行 //创建数据行
foreach (var pointRow in dataList.Select(t => t.RowNumber).Distinct().OrderBy(t => t)) foreach (var pointRow in dataList.Select(t => t.RowNumber).Distinct().OrderBy(t => t))
......
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