临床科室绩效测试表显示读取

parent b3f6e8c3
......@@ -588,6 +588,9 @@
<member name="F:Performance.DtoModels.SheetType.ClinicEmployee">
<summary> 临床人员名单 </summary>
</member>
<member name="F:Performance.DtoModels.SheetType.AccountBasicSpecial">
<summary> 特殊临床科室医护绩效测算基础 </summary>
</member>
<member name="T:Performance.DtoModels.AccountUnitType">
<summary>
核算单元类型
......
......@@ -78,6 +78,10 @@ public enum SheetType
/// <summary> 临床人员名单 </summary>
[Description("临床人员名单")]
ClinicEmployee = 15,
/// <summary> 特殊临床科室医护绩效测算基础 </summary>
[Description("特殊临床科室医护绩效测算基础")]
AccountBasicSpecial = 16,
}
/// <summary>
......
......@@ -64,6 +64,9 @@ public PerExcel ReadDataAndSave(per_allot allot)
{
var excel = Import(allot);
Save(excel, allot.ID);
var item = excel.PerSheet.FirstOrDefault(w => w.SheetType == SheetType.AccountBasicSpecial);
if (item != null)
excel.PerSheet.Remove(item);
return excel;
}
......@@ -92,7 +95,12 @@ private PerExcel Import(per_allot allot)
{
var sheet = workbook.GetSheetAt(i);
var sheetType = perSheetService.GetSheetType(sheet.SheetName);
// 保留临床科室测算表全部结构,用作展示,不做其他用途
if (sheetType == SheetType.AccountBasic)
{
var st = perSheetService.SheetAccountBasicSpecial(sheet, isnew);
excel.PerSheet.Add(st);
}
if (SheetType.Unidentifiable != sheetType)
{
logManageService.WriteMsg("开始读取excel文件", $"开始读取sheet -- {sheet.SheetName}", 1, allot.ID, "ReceiveMessage", true);
......@@ -196,8 +204,21 @@ private void SaveClinicEmployee(PerSheet sheet, int allotId)
/// <returns></returns>
private void SaveAccountBasic(PerSheet sheet, int allotId)
{
var imsheet = new per_sheet { AllotID = allotId, SheetName = sheet.SheetName, Source = 1, SheetType = (int)sheet.SheetType };
perforPerSheetRepository.Add(imsheet);
//var imsheet = new per_sheet { AllotID = allotId, SheetName = sheet.SheetName, Source = 1, SheetType = (int)sheet.SheetType };
//perforPerSheetRepository.Add(imsheet);
List<int> types = new List<int> { (int)SheetType.AccountBasicSpecial, (int)SheetType.AccountBasic };
var sheets = perforPerSheetRepository.GetEntities(w => w.AllotID == allotId && w.SheetType.HasValue && types.Contains(w.SheetType.Value));
var imsheet = sheets?.FirstOrDefault();
if (imsheet != null)
{
imsheet.SheetType = (int)SheetType.AccountBasic;
perforPerSheetRepository.Update(imsheet);
}
else
{
imsheet = new per_sheet { AllotID = allotId, SheetName = sheet.SheetName, Source = 1, SheetType = (int)sheet.SheetType };
perforPerSheetRepository.Add(imsheet);
}
var dataList = sheet.PerData.Select(t => (PerDataAccountBaisc)t);
List<im_accountbasic> addList = new List<im_accountbasic>();
......@@ -242,8 +263,23 @@ private void SaveSpecialUnit(PerSheet sheet, int allotId)
/// <returns></returns>
private void SaveCommon(PerSheet sheet, int allotId)
{
var imsheet = new per_sheet { AllotID = allotId, SheetName = sheet.SheetName, Source = 1, SheetType = (int)sheet.SheetType };
perforPerSheetRepository.Add(imsheet);
per_sheet imsheet = null;
List<int> types = new List<int> { (int)SheetType.AccountBasicSpecial, (int)SheetType.AccountBasic };
if (types.Any(type => type == (int)sheet.SheetType))
{
var sheets = perforPerSheetRepository.GetEntities(w => w.AllotID == allotId && w.SheetType.HasValue && types.Contains(w.SheetType.Value));
imsheet = sheets?.FirstOrDefault();
if (imsheet != null)
{
imsheet.SheetType = (int)SheetType.AccountBasic;
perforPerSheetRepository.Update(imsheet);
}
}
if (imsheet == null)
{
imsheet = new per_sheet { AllotID = allotId, SheetName = sheet.SheetName, Source = 1, SheetType = (int)sheet.SheetType };
perforPerSheetRepository.Add(imsheet);
}
List<im_header> addHeadList = new List<im_header>();
foreach (var header in sheet.PerHeader)
......
......@@ -45,11 +45,14 @@ public static IPerSheetDataRead GetDataRead(SheetType sheetType, bool isnew = fa
dataread = new PerSheetDataReadWorkload();
break;
case SheetType.AccountBasic:
dataread = new PerSheetDataReadDeptAccountingt();
dataread = new PerSheetDataReadDeptAccounting();
break;
case SheetType.SpecialUnit:
dataread = new PerSheetDataReadSpecialUnit();
break;
case SheetType.AccountBasicSpecial:
dataread = new PerSheetDataReadDeptAccountingSpecial();
break;
}
return dataread;
}
......
......@@ -27,6 +27,28 @@ public class PerSheetService : IAutoInjection
_perforCofdrugpropRepository = perforCofdrugpropRepository;
_perforCofdrugtypeRepository = perforCofdrugtypeRepository;
}
/// <summary>
/// 解析excel数据
/// </summary>
/// <param name="sheet"></param>
/// <returns></returns>
public PerSheet SheetAccountBasicSpecial(ISheet sheet, bool isnew)
{
PerSheet perSheet = new PerSheet
{
SheetName = sheet.SheetName,
SheetType = SheetType.AccountBasicSpecial,
ModuleName = EnumHelper.GetDescription(SheetType.AccountBasicSpecial),
};
var sheetRead = PerSheetDataFactory.GetDataRead(perSheet.SheetType, isnew);
var perHeader = _perHeader.GetPerHeader(sheet, sheetRead.Point);
var headerReverse = _perHeader.GetPerHeaderReverse(perHeader);
perSheet.PerHeader = perHeader;
perSheet.PerData = sheetRead.ReadData(sheet, headerReverse);
return perSheet;
}
/// <summary>
/// 解析excel数据
......
......@@ -11,7 +11,7 @@ namespace Performance.Services
/// <summary>
/// 临床科室单元核算表
/// </summary>
public class PerSheetDataReadDeptAccountingt : IPerSheetDataRead
public class PerSheetDataReadDeptAccounting : IPerSheetDataRead
{
public PerSheetPoint Point => new PerSheetPoint
{
......
using NPOI.SS.UserModel;
using Performance.DtoModels;
using Performance.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Performance.Services
{
/// <summary>
/// 临床科室单元核算表
/// </summary>
public class PerSheetDataReadDeptAccountingSpecial : IPerSheetDataRead
{
public PerSheetPoint Point => new PerSheetPoint
{
HeaderFirstRowNum = 1,
HeaderLastRowNum = 1,
HeaderFirstCellNum = 0,
DataFirstRowNum = 2,
AccountingUnit = new List<AccountingUnit>
{
new AccountingUnit
{
AccountingUnitCellNum = 1,
DeptCellNum = 2,
}
}
};
public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{
List<IPerData> dataList = new List<IPerData>();
var unit = Point.AccountingUnit.First();
//查询除了 核算单元 科室名称 有效数据列头位置
var vhead = perHeader.Where(t => t.PointCell > unit.DeptCellNum).OrderBy(t => t.PointCell);
for (int r = Point.DataFirstRowNum.Value; r < sheet.LastRowNum + 1; r++)
{
var row = sheet.GetRow(r);
if (row == null) continue;
for (int c = 0; c < vhead.Count(); c++)
{
var athead = vhead.ElementAt(c);
var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell));
if (!cellValue.HasValue || cellValue.Value == 0)
continue;
PerData data = new PerData
{
RowNumber = r,
SignID = athead.SignID,
AccountingUnit = row.GetCell(unit.AccountingUnitCellNum.Value)?.StringCellValue,
Department = row.GetCell(unit.DeptCellNum.Value)?.StringCellValue,
TypeName = athead?.CellValue,
CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = row.GetCell(0).ToString(),
FactorValue = 0,
IsFactor = false,
};
if (sheet.SheetName.Contains("医生组"))
data.UnitType = "医生组";
else if (sheet.SheetName.Contains("护理组"))
data.UnitType = "护理组";
dataList.Add(data);
}
}
return dataList;
}
}
}
......@@ -91,10 +91,10 @@ public SheetExportResponse SheetExport(int sheetID)
{
SpecialUnitExport(sheetID, response);
}
else if (sheet.SheetType == (int)SheetType.AccountBasic)
{
AccountBaiscExport(sheetID, response);
}
//else if (sheet.SheetType == (int)SheetType.AccountBasic)
//{
// AccountBaiscExport(sheetID, response);
//}
else if (sheet.SheetType == (int)SheetType.ComputeDoctorAccount)
{
AccountDoctorExport(sheetID, response);
......@@ -235,7 +235,19 @@ private void CommonExport(int sheetID, SheetExportResponse response)
rowbody = new Row(rowNumber ?? 0);
response.Row.Add(rowbody);
}
if (head.CellValue.Contains("核算单元"))
if (head.CellValue.Contains("核算单元类型"))
{
var value = dataList.FirstOrDefault(t => t.RowNumber == rowNumber).UnitType;
rowbody.Data.Add(new Cell(head.PointCell.Value, ((UnitType)value).ToString(), 1, 1, false, false));
}
else if (head.CellValue.Contains("核算单元人员数量"))
{
var data = dataList.FirstOrDefault(t => t.RowNumber == rowNumber && t.SignID == head.SignID);
var value = data?.CellValue;
if (value.HasValue && value.Value > 0)
rowbody.Data.Add(new Cell(head.PointCell.Value, value, 1, 1, data.IsTotal == 1, true, data.Annotation));
}
else if (head.CellValue.Contains("核算单元"))
{
if (head.CellValue.Contains("医生组"))
{
......
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