Commit 326b249f by 钟博

Merge branch 'feature/粘贴数据过滤' into develop

parents 8ae4fdda 34a16fa9
...@@ -720,6 +720,7 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request) ...@@ -720,6 +720,7 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request)
var dicData = CreateDataRow(request, dict); var dicData = CreateDataRow(request, dict);
List<per_employee> employees = new List<per_employee>(); List<per_employee> employees = new List<per_employee>();
var persons = peremployeeRepository.GetEntities(t => t.HospitalId == HospitalId && t.AllotId == AllotId); var persons = peremployeeRepository.GetEntities(t => t.HospitalId == HospitalId && t.AllotId == AllotId);
var delPersonsNum =new List<string>();
foreach (var item in dicData) foreach (var item in dicData)
{ {
if (!string.IsNullOrEmpty(item["AttendanceDay"]) && !string.IsNullOrEmpty(item["ReservedRatio"])) if (!string.IsNullOrEmpty(item["AttendanceDay"]) && !string.IsNullOrEmpty(item["ReservedRatio"]))
...@@ -732,7 +733,8 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request) ...@@ -732,7 +733,8 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request)
var json = JsonHelper.Serialize(item); var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<per_employee>(json); var data = JsonHelper.Deserialize<per_employee>(json);
if (persons != null) if (persons != null)
if (persons.Any(t => t.PersonnelNumber?.Trim() == data.PersonnelNumber?.Trim() && t.DoctorName?.Trim() == data.DoctorName?.Trim())) continue; if (persons.Any(t => t.PersonnelNumber?.Trim() == data.PersonnelNumber?.Trim())) delPersonsNum.Add(data.PersonnelNumber);
var any = employees.Any(w => w.Department?.Trim() == data.Department?.Trim() && w.DoctorName?.Trim() == data.DoctorName?.Trim()); var any = employees.Any(w => w.Department?.Trim() == data.Department?.Trim() && w.DoctorName?.Trim() == data.DoctorName?.Trim());
if (!string.IsNullOrEmpty(data.Department?.Trim()) && !string.IsNullOrEmpty(data.AccountingUnit?.Trim()) && !string.IsNullOrEmpty(data.DoctorName?.Trim()) && !any) if (!string.IsNullOrEmpty(data.Department?.Trim()) && !string.IsNullOrEmpty(data.AccountingUnit?.Trim()) && !string.IsNullOrEmpty(data.DoctorName?.Trim()) && !any)
...@@ -746,6 +748,8 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request) ...@@ -746,6 +748,8 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request)
employees.Add(data); employees.Add(data);
} }
} }
var delPerson = persons.Where(t => delPersonsNum.Contains(t.PersonnelNumber)).ToArray();
peremployeeRepository.RemoveRange(delPerson);
if (employees.Any()) if (employees.Any())
peremployeeRepository.AddRange(employees.ToArray()); peremployeeRepository.AddRange(employees.ToArray());
...@@ -755,23 +759,27 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request) ...@@ -755,23 +759,27 @@ public bool BathSavePerson(int AllotId, int HospitalId, SaveCollectData request)
public void SaveDeptDicHands(int HospitalId, SaveCollectData request) public void SaveDeptDicHands(int HospitalId, SaveCollectData request)
{ {
var dicData = CreateDataRow(request, DeptDic); var dicData = CreateDataRow(request, DeptDic);
var depts = perdeptdicRepository.GetEntities(t => t.HospitalId == HospitalId)?.Select(w => new { w.Department, w.HISDeptName }).Distinct(); var deptDic = perdeptdicRepository.GetEntities(t => t.HospitalId == HospitalId);
var depts =deptDic?.Select(w => new { w.Department, w.HISDeptName }).Distinct();
List<per_dept_dic> deptDics = new List<per_dept_dic>(); List<per_dept_dic> deptDics = new List<per_dept_dic>();
var delDepartment = new List<string>();
foreach (var dic in dicData) foreach (var dic in dicData)
{ {
var json = JsonHelper.Serialize(dic); var json = JsonHelper.Serialize(dic);
var data = JsonHelper.Deserialize<DeptdicHands>(json); var data = JsonHelper.Deserialize<DeptdicHands>(json);
if (depts != null) if (depts != null)
if (depts.Any(t => t.Department?.Trim() == data.Department?.Trim())) continue; if (depts.Any(t => t.HISDeptName?.Trim() == data.HISDeptName?.Trim())) delDepartment.Add(data.HISDeptName);
var any = deptDics.Any(w => w.Department?.Trim() == data.Department?.Trim()); var any = deptDics.Any(w => w.HISDeptName?.Trim() == data.HISDeptName?.Trim());
if (!string.IsNullOrEmpty(data.Department?.Trim()) && !any) if (!string.IsNullOrEmpty(data.HISDeptName?.Trim()) && !any)
{ {
DeptDicList(HospitalId, deptDics, data); DeptDicList(HospitalId, deptDics, data);
} }
} }
var delDept = deptDic.Where(t => delDepartment.Contains(t.HISDeptName)).ToArray();
perdeptdicRepository.RemoveRange(delDept);
if (deptDics.Any()) if (deptDics.Any())
perdeptdicRepository.AddRange(deptDics.ToArray()); perdeptdicRepository.AddRange(deptDics.ToArray());
} }
......
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