Commit e553510f by lcx

补充科室信息修改

parent c2e1679c
...@@ -1831,7 +1831,7 @@ ...@@ -1831,7 +1831,7 @@
</member> </member>
<member name="P:Performance.DtoModels.AccoungingRequest.Type"> <member name="P:Performance.DtoModels.AccoungingRequest.Type">
<summary> <summary>
1 返回accounting列表 2 返回核算单元类型 3 返回核算单元 1 返回accounting列表 2 返回核算单元 3 返回核算单元类型
</summary> </summary>
</member> </member>
<member name="P:Performance.DtoModels.AccoungingRequest.UnitType"> <member name="P:Performance.DtoModels.AccoungingRequest.UnitType">
......
...@@ -2331,6 +2331,11 @@ ...@@ -2331,6 +2331,11 @@
只读 0、否 1、是 只读 0、否 1、是
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ex_module.CheckScriptId">
<summary>
</summary>
</member>
<member name="T:Performance.EntityModels.ex_result"> <member name="T:Performance.EntityModels.ex_result">
<summary> <summary>
......
...@@ -770,68 +770,68 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin ...@@ -770,68 +770,68 @@ public string Judge(int allotId, int hospitalId, int useTemplate, ref bool isSin
List<cof_drugtype> drugTypeList = new List<cof_drugtype>(); List<cof_drugtype> drugTypeList = new List<cof_drugtype>();
string defaultSource = "住院", defauleUnittype = UnitType.医生组.ToString(); string defaultSource = "住院", defauleUnittype = UnitType.医生组.ToString();
foreach (var conf in hosConfig) foreach (var scr in scripts)
{ {
foreach (var scr in scripts) var conf = hosConfig.FirstOrDefault(t => t.Id == scr.ConfigId);
{ if (conf == null)
if (conf.Id != scr.ConfigId) continue; continue;
var data = queryService.QueryData(conf, allot, scr.ExecScript); var data = queryService.QueryData(conf, allot, scr.ExecScript);
if (data == null || !data.Any()) return null; if (data == null || !data.Any()) continue;
if (deptDic != null || deptDic.Any()) foreach (var module in moduleSheet.Where(t => t.CheckScriptId == scr.Id))
{
var noExistedDepartment = data.Select(t => t.Department).Distinct().ToList();
var source = module.ModuleName.Contains(defaultSource) ? "住院" : "门诊";
if (deptDic != null && deptDic.Any(t => t.Source == source))
{ {
var source = moduleSheet.FirstOrDefault(t => t.CheckScriptId == scr.Id)?.ModuleName.Contains(defaultSource) == true ? "住院" : "门诊"; var deptDics = deptDic.Where(t => t.Source == source).Select(t => t.HISDeptName);
var deptDics = deptDic.Select(t => new { t.Department, t.Source }); noExistedDepartment = data.Select(t => t.Department).Except(deptDics).Distinct().ToList();
var except = data.Where(c => deptDics.Select(t => t.Department).Distinct().Contains(c.Department) && deptDics.Select(t => t.Source).Distinct().Contains(source));
var noExistedDepartment = except.Select(t => t.Department+" "+source).Distinct();
if (!deptList.Any(t => noExistedDepartment.Contains(t.Department+" "+source) && t.Source == source))
{
var dept = noExistedDepartment.Select(t => new per_dept_dic
{
Department = t,
AccountingUnit = t,
UnitType = defauleUnittype,
Source = source,
HospitalId = allot.HospitalId,
IsVerify = 0,
VerifyMessage = "抽取前科室校验后补增科室",
CreateTime = DateTime.Now,
CreateUser = 1
});
deparmants.AddRange(noExistedDepartment);
deptList.AddRange(dept);
}
} }
if (noExistedDepartment != null && noExistedDepartment.Any()) // 系统科室、标准科室唯一,门诊、住院核算单元可能不一致,因此数据可重复
if (drugTypes != null || drugTypes.Any())
{ {
var typeNames = drugTypes.Select(t => t.Charge).Distinct(); var dept = noExistedDepartment.Select(t => new per_dept_dic
var noExistedTypename = data.Select(t => t.Category).Distinct().Except(typeNames);
if (!drugTypeList.Any(t => noExistedTypename.Contains(t.Charge)))
{ {
var drugType = noExistedTypename.Select(t => new cof_drugtype HISDeptName = t,
{ UnitType = defauleUnittype,
HospitalId = allot.HospitalId, Source = source,
AllotID = allot.ID, HospitalId = allot.HospitalId,
Charge = t IsVerify = 0,
}); VerifyMessage = "抽取前科室校验后补增科室",
drugs.AddRange(noExistedTypename); CreateUser = 1
drugTypeList.AddRange(drugType); }).ToList();
} deparmants.AddRange(noExistedDepartment.Where(t => !deparmants.Contains(t)));
deptList.AddRange(dept);
} }
} }
var typeNames = drugTypes.Select(t => t.Charge).Distinct();
var noExistedTypename = data.Select(t => t.Category).Distinct().Except(typeNames);
if (noExistedTypename != null && noExistedTypename.Any(t => !drugs.Contains(t)))
{
var drugType = noExistedTypename.Where(t => !drugs.Contains(t)).Select(t => new cof_drugtype
{
HospitalId = allot.HospitalId,
AllotID = allot.ID,
Charge = t
}).ToList();
drugs.AddRange(noExistedTypename.Where(t => !drugs.Contains(t)));
drugTypeList.AddRange(drugType);
}
} }
if (deparmants != null && deparmants.Any()) if (deparmants != null && deparmants.Any())
{ {
perdeptdicRepository.AddRange(deptList.ToArray()); var distinctedDept = deptList.ToDistinct().ToList();
stringBuilder.AppendLine($"新增科室:{string.Join(",", deparmants)}"); distinctedDept.ForEach(t => t.CreateTime = DateTime.Now); //在去重前添加时间,可能造成时间不一致,无法去重
perdeptdicRepository.AddRange(distinctedDept.ToArray());
stringBuilder.AppendLine($"新增科室:{string.Join(",", deparmants.Distinct())}");
} }
if (drugs != null && drugs.Any()) if (drugs != null && drugs.Any())
{ {
cofdrugtypeRepository.AddRange(drugTypeList.ToArray()); cofdrugtypeRepository.AddRange(drugTypeList.ToDistinct().ToArray());
stringBuilder.AppendLine($"新增费用类型:{string.Join(",", drugs)}"); stringBuilder.AppendLine($"新增费用类型:{string.Join(",", drugs.Distinct())}");
} }
paramtemers.Add("新增科室或费用类型", stringBuilder.ToString()); paramtemers.Add("新增科室或费用类型", stringBuilder.ToString());
......
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