调整结构

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