Commit c1e4cd41 by 李承祥

开单医院读取数据修改

parent f7df1761
...@@ -168,7 +168,8 @@ public bool CheckData(PerExcel excel, per_allot allot) ...@@ -168,7 +168,8 @@ public bool CheckData(PerExcel excel, per_allot allot)
{ {
var doctor = item.Where(t => t.UnitType == "医生组").FirstOrDefault(); var doctor = item.Where(t => t.UnitType == "医生组").FirstOrDefault();
var nurse = item.Where(t => t.UnitType == "护理组").FirstOrDefault(); var nurse = item.Where(t => t.UnitType == "护理组").FirstOrDefault();
if (string.IsNullOrEmpty(doctor.AccountingUnit) && string.IsNullOrEmpty(nurse.AccountingUnit)) var technician = item.Where(t => t.UnitType == "医技组").FirstOrDefault();
if (string.IsNullOrEmpty(doctor?.AccountingUnit) && string.IsNullOrEmpty(nurse?.AccountingUnit) && string.IsNullOrEmpty(technician?.AccountingUnit))
{ {
flag = false; flag = false;
rowNumber.Add(doctor.RowNumber + 1); rowNumber.Add(doctor.RowNumber + 1);
......
...@@ -15,10 +15,10 @@ public class PerSheetDataReadBillIncome : IPerSheetDataRead ...@@ -15,10 +15,10 @@ public class PerSheetDataReadBillIncome : IPerSheetDataRead
{ {
public PerSheetPoint Point => new PerSheetPoint public PerSheetPoint Point => new PerSheetPoint
{ {
HeaderFirstRowNum = 6, HeaderFirstRowNum = 5,
HeaderLastRowNum = 6, HeaderLastRowNum = 5,
HeaderFirstCellNum = 0, HeaderFirstCellNum = 0,
DataFirstRowNum = 7, DataFirstRowNum = 6,
AccountingUnit = new List<AccountingUnit> AccountingUnit = new List<AccountingUnit>
{ {
//核算单元(医技组) //核算单元(医技组)
...@@ -52,11 +52,11 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -52,11 +52,11 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
{ {
List<IPerData> dataList = new List<IPerData>(); List<IPerData> dataList = new List<IPerData>();
var prevRow = sheet.GetRow(5);
//循环 当前有几个核算单元 //循环 当前有几个核算单元
foreach (var unit in Point.AccountingUnit) foreach (var unit in Point.AccountingUnit)
{ {
if (unit.UnitType == "医技组") continue;
//查询除了 核算单元 科室名称 有效数据列头位置 //查询除了 核算单元 科室名称 有效数据列头位置
var vhead = perHeader.Where(t => !Point.AccountingUnit.Select(p => p.AccountingUnitCellNum).Contains(t.PointCell) var vhead = perHeader.Where(t => !Point.AccountingUnit.Select(p => p.AccountingUnitCellNum).Contains(t.PointCell)
&& !Point.AccountingUnit.Select(p => p.DeptCellNum).Contains(t.PointCell)).OrderBy(t => t.PointCell); && !Point.AccountingUnit.Select(p => p.DeptCellNum).Contains(t.PointCell)).OrderBy(t => t.PointCell);
...@@ -71,25 +71,12 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -71,25 +71,12 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell)); var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell));
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
string accountingUnit, department;
if (unit.AccountingUnitCellNum.Value == -1)
{
if (prevRow == null) continue;
accountingUnit = prevRow.GetCell(athead.PointCell).StringCellValue;
if (string.IsNullOrEmpty(accountingUnit) || r != Point.DataFirstRowNum.Value) continue;
department = accountingUnit;
}
else
{
accountingUnit = row.GetCell(unit.AccountingUnitCellNum.Value)?.ToString();
department = row.GetCell(unit.DeptCellNum.Value)?.ToString();
}
PerData data = new PerData PerData data = new PerData
{ {
RowNumber = r, RowNumber = r,
SignID = athead.SignID, SignID = athead.SignID,
AccountingUnit = accountingUnit, AccountingUnit = row.GetCell(unit.AccountingUnitCellNum.Value)?.ToString(),
Department = department, Department = row.GetCell(unit.DeptCellNum.Value)?.ToString(),
TypeName = athead?.CellValue, TypeName = athead?.CellValue,
CellValue = cellValue, CellValue = cellValue,
Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
...@@ -101,6 +88,36 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -101,6 +88,36 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
} }
} }
} }
var tunit = Point.AccountingUnit[0];
var rownum = sheet.LastRowNum + 1;
var technicianRow = sheet.GetRow(4);
if (technicianRow != null)
{
//查询除了 核算单元 科室名称 有效数据列头位置
var vhead = perHeader.Where(t => !Point.AccountingUnit.Select(p => p.AccountingUnitCellNum).Contains(t.PointCell)
&& !Point.AccountingUnit.Select(p => p.DeptCellNum).Contains(t.PointCell)).OrderBy(t => t.PointCell);
for (int c = 0; c < vhead.Count(); c++)
{
var athead = vhead.ElementAt(c);
var cellValue = technicianRow.GetCell(athead.PointCell).StringCellValue;
if (string.IsNullOrEmpty(cellValue))
continue;
PerData data = new PerData
{
RowNumber = rownum,
SignID = athead.SignID,
AccountingUnit = cellValue,
Department = cellValue,
TypeName = athead?.CellValue,
CellValue = dataList.Select(t => (PerData)t)?.Where(t => t.TypeName == athead.CellValue).Sum(t => t.CellValue) ?? 0,
Annotation = technicianRow.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = tunit.UnitType, //手动匹配
FactorValue = ConvertHelper.To<decimal?>(sheet.GetRow(tunit.FactorRow.Value).GetCell(athead.PointCell)?.ToString()),
IsFactor = true,
};
dataList.Add(data);
}
}
return dataList; return dataList;
} }
} }
......
...@@ -169,14 +169,14 @@ private void CommonExport(int sheetID, SheetExportResponse response) ...@@ -169,14 +169,14 @@ private void CommonExport(int sheetID, SheetExportResponse response)
if (sheet.SheetType == (int)SheetType.Income && !headList.Select(t => t.CellValue).Contains("医技组")) if (sheet.SheetType == (int)SheetType.Income && !headList.Select(t => t.CellValue).Contains("医技组"))
{ {
var technicianvalue = new Row(response.Header.Count()); technicianvalue.Data.Add(new Cell(0, "医技组核算收入", 1, 4, false, false)); //var technicianvalue = new Row(response.Header.Count()); technicianvalue.Data.Add(new Cell(0, "医技组核算收入", 1, 4, false, false));
response.Header.Add(technicianvalue); //response.Header.Add(technicianvalue);
var technicianhead = new Row(response.Header.Count()); technicianhead.Data.Add(new Cell(0, "医技组核算单元", 1, 4, false, false)); var technicianhead = new Row(response.Header.Count()); technicianhead.Data.Add(new Cell(0, "医技组核算单元", 1, 4, false, false));
response.Header.Add(technicianhead); response.Header.Add(technicianhead);
foreach (var technician in dataList.Where(t => t.UnitType == 3)) foreach (var technician in dataList.Where(t => t.UnitType == 3))
{ {
var header = headList.First(t => t.CellValue == technician.TypeName); var header = headList.First(t => t.CellValue == technician.TypeName);
technicianvalue.Data.Add(new Cell(header.PointCell.Value, technician.CellValue, header.MergeRow.Value, header.MergeCell.Value, header.IsTotal == 1, false)); //technicianvalue.Data.Add(new Cell(header.PointCell.Value, technician.CellValue, header.MergeRow.Value, header.MergeCell.Value, header.IsTotal == 1, false));
technicianhead.Data.Add(new Cell(header.PointCell.Value, technician.AccountingUnit, header.MergeRow.Value, header.MergeCell.Value, header.IsTotal == 1, false)); technicianhead.Data.Add(new Cell(header.PointCell.Value, technician.AccountingUnit, header.MergeRow.Value, header.MergeCell.Value, header.IsTotal == 1, false));
} }
} }
......
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