审核通过后同步数据到ex_result

parent 0214a744
......@@ -3594,6 +3594,16 @@
创建时间
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result.IsDelete">
<summary>
1 删除 0 未删除
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result.FromSource">
<summary>
数据来源 0 提取 1 录入
</summary>
</member>
<member name="P:Performance.EntityModels.ex_result_gather.Id">
<summary>
......
......@@ -129,10 +129,18 @@ public enum Status
}
}
public enum AuditGatherEnum
public class EnumResult
{
未审核 = 0,
未通过 = 1,
已通过 = 2,
public enum AuditGather
{
未审核 = 0,
未通过 = 1,
已通过 = 2,
}
public enum FromSource
{
提取 = 0,
录入 = 1,
}
}
}
......@@ -76,9 +76,13 @@ public class ex_result
/// </summary>
public Nullable<DateTime> CreateTime { get; set; }
// /// <summary>
// /// 1 删除 0 未删除
// /// </summary>
/// <summary>
/// 1 删除 0 未删除
/// </summary>
public int IsDelete { get; set; }
/// <summary>
/// 数据来源 0 提取 1 录入
/// </summary>
public int FromSource { get; set; }
}
}
......@@ -1412,14 +1412,14 @@ public GatherResponse GetGatherTotal(Gather gather)
exp = exp.And(t => t.Category.Contains(gather.SearchQuery) || t.Source.Contains(gather.SearchQuery) || t.Department.Contains(gather.SearchQuery));
}
var user = userRepository.GetEntities();
var userLogin= user.FirstOrDefault(t => t.ID == gather.UserId);
var userLogin = user.FirstOrDefault(t => t.ID == gather.UserId);
if (userLogin.Login != "admin")
{
var userSource = perforcollectpermissionRepository.GetEntities(t => t.UserId == gather.UserId)
.Select(s => Regex.Replace(s.SheetName.Replace(" ", "").Replace(".", ""), "[0-9]", ""))
.Distinct().ToList();
exp = exp.And(t => userSource.Contains(t.Source));
var hasDepartment = perdeptdicRepository.GetEntities(p=>p.AccountingUnit.Contains(userLogin.Department)).Select(s=>s.HISDeptName).Distinct().ToList();
var hasDepartment = perdeptdicRepository.GetEntities(p => p.AccountingUnit.Contains(userLogin.Department)).Select(s => s.HISDeptName).Distinct().ToList();
exp = exp.And(t => hasDepartment.Contains(t.Department));
}
......@@ -1435,9 +1435,9 @@ public GatherResponse GetGatherTotal(Gather gather)
Login = user.FirstOrDefault(t => t.ID == s.Key.Submitter).Login,
CreateTime = s.Max(t => t.CreateTime).ToString("d"),
AuditTime = s.Max(t => t.AuditTime)?.ToString("d"),
States = s.Any(w => w.States == (int)AuditGatherEnum.未通过) ? "未通过"
: s.Count() == s.Where(w => w.States == (int)AuditGatherEnum.已通过).Count() ? "已通过"
: s.Count() == s.Where(w => w.States == (int)AuditGatherEnum.未审核).Count() ? "未审核" : "未知",
States = s.Any(w => w.States == (int)EnumResult.AuditGather.未通过) ? "未通过"
: s.Count() == s.Where(w => w.States == (int)EnumResult.AuditGather.已通过).Count() ? "已通过"
: s.Count() == s.Where(w => w.States == (int)EnumResult.AuditGather.未审核).Count() ? "未审核" : "未知",
Remark = s.FirstOrDefault()?.Remark,
});
......@@ -1600,9 +1600,9 @@ public ApiResponse SaveGatherHands(int allotId, SaveGatherData saveGather)
{ "错误原因", "数值不能等于0" },
});
var ExistsDeptData = departments.FirstOrDefault(w => w.AllotId == allotId
&& (w.Department != null && w.Department.Contains(newGather[i].Department))
|| (w.HISDeptName !=null && w.HISDeptName.Contains(newGather[i].Department))
var ExistsDeptData = departments.FirstOrDefault(w => w.AllotId == allotId
&& (w.Department != null && w.Department.Contains(newGather[i].Department))
|| (w.HISDeptName != null && w.HISDeptName.Contains(newGather[i].Department))
);
if (ExistsDeptData == null)
error.Add(new Dictionary<string, string>
......@@ -1616,7 +1616,7 @@ public ApiResponse SaveGatherHands(int allotId, SaveGatherData saveGather)
{ "错误原因", $"科室字典中不存在科室[{newGather[i].Department}]" },
});
var ExistNameData = employees.FirstOrDefault(w => w.AllotId == allotId && (w.DoctorName!=null && w.DoctorName == newGather[i].DoctorName));
var ExistNameData = employees.FirstOrDefault(w => w.AllotId == allotId && (w.DoctorName != null && w.DoctorName == newGather[i].DoctorName));
if (ExistNameData == null)
error.Add(new Dictionary<string, string>
{
......@@ -1629,7 +1629,7 @@ public ApiResponse SaveGatherHands(int allotId, SaveGatherData saveGather)
{ "错误原因", $"人员字典中不存在医生姓名[{newGather[i].DoctorName}]" },
});
var ExistNumberData = employees.FirstOrDefault(w => w.AllotId == allotId && (w.PersonnelNumber!= null && w.PersonnelNumber == newGather[i].PersonnelNumber));
var ExistNumberData = employees.FirstOrDefault(w => w.AllotId == allotId && (w.PersonnelNumber != null && w.PersonnelNumber == newGather[i].PersonnelNumber));
if (ExistNumberData == null)
error.Add(new Dictionary<string, string>
{
......@@ -1642,9 +1642,9 @@ public ApiResponse SaveGatherHands(int allotId, SaveGatherData saveGather)
{ "错误原因", $"人员字典中不存在工号[{newGather[i].PersonnelNumber}]" },
});
if((ExistNumberData == null || ExistNumberData.DoctorName != newGather[i].DoctorName)
if ((ExistNumberData == null || ExistNumberData.DoctorName != newGather[i].DoctorName)
|| (ExistNameData == null || ExistNameData.PersonnelNumber != newGather[i].PersonnelNumber))
error.Add(new Dictionary<string, string>
error.Add(new Dictionary<string, string>
{
{ "行号", $"第{i+1}行" },
{ "科室", newGather[i].Department??"" },
......@@ -1763,14 +1763,15 @@ public void SyncDataToResult(int allotId)
var sheets = perforPersheetRepository.GetEntities(t => t.AllotID == allotId && new[] { 3, 4, 7 }.Contains(t.SheetType.Value));
if (sheets == null || !sheets.Any()) return;
var data = exresultgatherRepository.GetEntities(w => w.AllotId == allotId);
var data = exresultgatherRepository.GetEntities(w => w.AllotId == allotId && w.States == (int)EnumResult.AuditGather.已通过);
if (data == null || !data.Any()) return;
exresultRepository.DeleteFromQuery(w => w.AllotId == allotId && w.FromSource == (int)EnumResult.FromSource.录入);
var syncData = _mapper.Map<List<ex_result>>(data);
syncData.ForEach(x =>
{
x.Id = 0;
x.FromSource = (int)EnumResult.FromSource.录入;
x.Source = sheets.FirstOrDefault(t => t.SheetName.Contains(x.Source))?.SheetName ?? x.Source;
});
exresultRepository.AddRange(syncData.ToArray());
......@@ -1811,17 +1812,22 @@ public void AuditGather(List<Gather> gather)
datas.ForEach(d =>
{
d.AuditTime = DateTime.Now;
d.States = (int)AuditGatherEnum.已通过;
d.States = (int)EnumResult.AuditGather.已通过;
d.Remark = null;
});
else if (gatherFirst.Status == "失败")
datas.ForEach(d =>
{
d.AuditTime = DateTime.Now;
d.States = (int)AuditGatherEnum.未通过;
d.States = (int)EnumResult.AuditGather.未通过;
d.Remark = gatherFirst.Remark;
});
exresultgatherRepository.UpdateRange(datas.ToArray());
if (gatherFirst.Status == "通过")
{
SyncDataToResult(gatherFirst.AllotId);
}
}
}
......
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