调整结构

parent 4911a85a
...@@ -168,29 +168,28 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri ...@@ -168,29 +168,28 @@ private void WriteDataToFile(int userId, per_allot allot, List<cust_script> scri
string accountUnit = ""; string accountUnit = "";
// “科室名称”必须存在 “来源”必须存在 // “科室名称”必须存在 “来源”必须存在
if (deptIndex > -1 && sourceIndex > -1) if (deptIndex > -1)
{ {
string[] atUnitTypeList = new string[] { };
string atSource = headers.ElementAt(sourceIndex); // 当前行“来源”
string atDepartment = temp.ElementAt(deptIndex).Value?.ToString() ?? ""; // 当前行“科室名称” string atDepartment = temp.ElementAt(deptIndex).Value?.ToString() ?? ""; // 当前行“科室名称”
string atUnitType = (unitIndex > -1) ? headers.ElementAt(unitIndex) : ""; // 当前行“核算单元类别” string atUnitType = (unitIndex > -1) ? headers.ElementAt(unitIndex) : ""; // 当前行“核算单元类别”
// 如果是科主任护士长 则取角色的 核算单元类别 // 如果是科主任护士长 则取角色的 核算单元类别
// 如果是核算办 则取数据中 核算单元类别
string[] atUnitTypeList = new string[] { };
if (isSecondAdmin && unitType.Any()) if (isSecondAdmin && unitType.Any())
{
atUnitTypeList = unitType; atUnitTypeList = unitType;
atSource = headers.ElementAt(sourceIndex);
}
// 如果是核算办 则取数据中 核算单元类别
else if (unitIndex > -1) else if (unitIndex > -1)
{
atUnitTypeList = new string[] { atUnitType }; atUnitTypeList = new string[] { atUnitType };
}
// 替换原始科室名称 // 替换原始科室名称
if (atUnitTypeList.Any() && !string.IsNullOrEmpty(atSource) && !string.IsNullOrEmpty(atDepartment)) if (atUnitTypeList.Any() && !string.IsNullOrEmpty(atDepartment))
{ {
accountUnit = depts.FirstOrDefault(w => atUnitTypeList.Contains(w.UnitType) && w.Source == atSource && w.HISDeptName == atDepartment) var tempDepts = depts.Where(w => atUnitTypeList.Contains(w.UnitType) && w.HISDeptName == atDepartment);
?.AccountingUnit ?? ""; string atSource = headers.ElementAt(sourceIndex); // 当前行“来源”
if (isSecondAdmin && unitType.Any(w => w == UnitType.特殊核算组.ToString() || w == UnitType.行政后勤.ToString()))
accountUnit = tempDepts.FirstOrDefault()?.AccountingUnit ?? "";
else
accountUnit = tempDepts.FirstOrDefault(w => w.Source == atSource)?.AccountingUnit ?? "";
} }
// 跳过写入EXCEL逻辑 // 跳过写入EXCEL逻辑
if (isSecondAdmin) if (isSecondAdmin)
...@@ -284,10 +283,10 @@ private bool IsSecondAdmin(int userId, out string[] unitType) ...@@ -284,10 +283,10 @@ private bool IsSecondAdmin(int userId, out string[] unitType)
{ {
Dictionary<int, string[]> pairs = new Dictionary<int, string[]> Dictionary<int, string[]> pairs = new Dictionary<int, string[]>
{ {
{ _options.Value.NurseRole, new string[] { "护理组" } }, { _options.Value.NurseRole, new string[] { UnitType.护理组.ToString() } },
{ _options.Value.DirectorRole, new string[] { "医生组", "医技组" } }, { _options.Value.DirectorRole, new string[] { UnitType.医生组.ToString(), UnitType.医技组.ToString() } },
{ _options.Value.SpecialRole, new string[] { "特殊核算组" } }, { _options.Value.SpecialRole, new string[] { UnitType.特殊核算组.ToString() } },
{ _options.Value.OfficeRole, new string[] { "行政后勤" } }, { _options.Value.OfficeRole, new string[] { UnitType.行政后勤.ToString() } },
}; };
var roleId = _roleService.GetRole(userId)?.FirstOrDefault().ID ?? 0; var roleId = _roleService.GetRole(userId)?.FirstOrDefault().ID ?? 0;
......
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