Commit c6911236 by ruyun.zhang@suvalue.com

Merge remote-tracking branch 'origin/develop' into develop

parents 9648d504 06e22d87
......@@ -845,7 +845,7 @@ public ApiResponse CopyDropDown()
new CopyDrop{Label="收入费用类别",Value="drugTypes"},
new CopyDrop{Label="支出费用类别",Value="drugTypeDisburses"},
new CopyDrop{Label="费用类别系数",Value="drugTypeFactors"},
new CopyDrop{Label="科室类型",Value="deptTypes"},
/* new CopyDrop{Label="科室类型",Value="deptTypes"},*/
new CopyDrop{Label="二次绩效配置",Value="agains"},
new CopyDrop{Label="核算单元及组别",Value="accountings"},
}; ;
......
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>D:\publish</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -8,7 +8,7 @@
},
"AppConnection": {
//"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"PerformanceConnectionString": "server=192.168.18.166;database=db_performance_screen;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"PerformanceConnectionString": "server=192.168.18.166;database=db_test_srfy;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"HangfireConnectionString": "server=192.168.18.166;database=db_hangfire;uid=root;pwd=1234qwer;port=3306;allow user variables=true;",
"RedisConnectionString": "116.62.245.55:6379,defaultDatabase=2"
},
......
......@@ -191,5 +191,26 @@ public void BulkDelete(IEnumerable<TEntity> entities)
}
#endregion Bulk
public int InsertExecute(IEnumerable<TEntity> data)
{
if (data == null || !data.Any()) return 0;
try
{
string tableName = typeof(TEntity).Name.ToLower();
string database = context.Database.GetDbConnection().Database;
var query = $"select distinct lower(column_name) from information_schema.columns where table_schema = '{database}' and lower(table_name) = '{tableName}' and lower(column_name) <> 'id'";
var columns = DapperQuery<string>(query, new { });
if (columns == null || !columns.Any()) return 0;
var exec = $"insert into {tableName}({string.Join(", ", columns)}) values({string.Join(", ", columns.Select(t => "@" + t))});";
return Execute(exec, data, commandTimeout: 1000 * 60 * 60);
}
catch
{
return 0;
}
}
}
}
......@@ -1095,47 +1095,55 @@ public void NewCopy(CopyRequest request)
case "workItems":
logger.LogInformation($"copy workItems");
var workItems = _workitemRepository.GetEntities(t => t.AllotID == allot.ID);
if (workItems == null || !workItems.Any())
//先判断是否为空,不为空删除再执行下面的代码
if (workItems!=null)
{
_workitemRepository.RemoveRange(workItems.ToArray());
}
workItems = _workitemRepository.GetEntities(t => t.AllotID == allotId) ?? _workitemRepository.GetEntities(t => t.AllotID == -1);
if (workItems != null && workItems.Any())
{
var newWorkItems = workItems.Select(t => new cof_workitem { AllotID = allot.ID, Type = t.Type, Item = t.Item });
_workitemRepository.AddRange(newWorkItems.ToArray());
}
}
break;
case "drugTypes":
logger.LogInformation($"copy drugTypes");
var drugTypes = _drugtypeRepository.GetEntities(t => t.AllotID == allot.ID && t.HospitalId == allot.HospitalId);
if (drugTypes == null || !drugTypes.Any())
if (drugTypes!=null)
{
_drugtypeRepository.RemoveRange(drugTypes.ToArray());
}
var Types = _drugtypeRepository.GetEntities(t => t.AllotID == allot.ID && t.HospitalId == allot.HospitalId);
drugTypes = _drugtypeRepository.GetEntities(t => t.AllotID == allotId) ?? _drugtypeRepository.GetEntities(t => t.AllotID == -1);
if (drugTypes != null && drugTypes.Any())
{
var newDrugTypes = drugTypes.Select(t => new cof_drugtype { HospitalId = allot.HospitalId, AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
_drugtypeRepository.AddRange(newDrugTypes.ToArray());
}
}
break;
case "drugTypeDisburses":
logger.LogInformation($"copy drugTypeDisburses");
var drugTypeDisburses = drugtypeDisburseRepository.GetEntities(t => t.AllotID == allot.ID && t.HospitalId == allot.HospitalId);
if (drugTypeDisburses == null || !drugTypeDisburses.Any())
if (drugTypeDisburses!=null)
{
drugtypeDisburseRepository.RemoveRange(drugTypeDisburses.ToArray());
}
drugTypeDisburses = drugtypeDisburseRepository.GetEntities(t => t.AllotID == allotId) ?? drugtypeDisburseRepository.GetEntities(t => t.AllotID == -1);
if (drugTypeDisburses != null && drugTypeDisburses.Any())
{
var newDrugTypeDisburses = drugTypeDisburses.Select(t => new cof_drugtype_disburse { HospitalId = allot.HospitalId, AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
drugtypeDisburseRepository.AddRange(newDrugTypeDisburses.ToArray());
}
}
break;
case "drugTypeFactors":
logger.LogInformation($"copy drugTypeFactors");
var drugTypeFactors = cofdrugtypefactorRepository.GetEntities(t => t.AllotID == allot.ID);
if (drugTypeFactors == null || !drugTypeFactors.Any())
if (drugTypeFactors!=null)
{
cofdrugtypefactorRepository.RemoveRange(drugTypeFactors.ToArray());
}
drugTypeFactors = cofdrugtypefactorRepository.GetEntities(t => t.AllotID == allotId) ?? cofdrugtypefactorRepository.GetEntities(t => t.AllotID == -1);
if (drugTypeFactors != null && drugTypeFactors.Any())
{
......@@ -1151,26 +1159,28 @@ public void NewCopy(CopyRequest request)
});
cofdrugtypefactorRepository.AddRange(newDrugtypeFactors.ToArray());
}
}
break;
case "deptTypes":
logger.LogInformation($"copy deptTypes");
var deptTypes = perforCofdepttypeRepository.GetEntities(t => t.AllotID == allot.ID);
if (deptTypes == null || !deptTypes.Any())
if (deptTypes!=null)
{
perforCofdepttypeRepository.RemoveRange(deptTypes.ToArray());
}
deptTypes = perforCofdepttypeRepository.GetEntities(t => t.AllotID == allotId) ?? perforCofdepttypeRepository.GetEntities(t => t.AllotID == -1);
if (deptTypes != null && deptTypes.Any())
{
var newDeptTypes = deptTypes.Select(t => new cof_depttype { AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
perforCofdepttypeRepository.AddRange(newDeptTypes.ToArray());
}
}
break;
case "agains":
logger.LogInformation($"copy agains");
var agains = _againRepository.GetEntities(t => t.AllotID == allot.ID);
if (agains == null || !agains.Any())
if (agains!=null)
{
_againRepository.RemoveRange(agains.ToArray());
}
agains = _againRepository.GetEntities(t => t.AllotID == allotId) ?? _againRepository.GetEntities(t => t.AllotID == -1);
if (agains != null && agains.Any())
{
......@@ -1178,20 +1188,20 @@ public void NewCopy(CopyRequest request)
var newAgains = agains.Select(t => new cof_again { AllotID = allot.ID, Type = t.Type, Department = t.Department, TypeName = t.TypeName, Value = t.TypeName == "满勤天数" ? days : t.Value });
_againRepository.AddRange(newAgains.ToArray());
}
}
break;
case "accountings":
logger.LogInformation($"copy accountings");
var accountings = cofaccountingRepository.GetEntities(t => t.AllotId == allot.ID);
if (accountings == null || !accountings.Any())
if (accountings!=null)
{
cofaccountingRepository.RemoveRange(accountings.ToArray());
}
accountings = cofaccountingRepository.GetEntities(t => t.AllotId == allotId) ?? cofaccountingRepository.GetEntities(t => t.AllotId == -1);
if (accountings != null && accountings.Any())
{
var newAccountings = accountings.Select(t => new cof_accounting { AllotId = allot.ID, UnitType = t.UnitType, AccountingUnit = t.AccountingUnit });
cofaccountingRepository.AddRange(newAccountings.ToArray());
}
}
break;
default:
break;
......
......@@ -134,7 +134,7 @@ private void Employee(per_allot allot, List<sys_hospitalconfig> configs, IEnumer
{
data = data.GroupJoin(hrpDepartments, outer => new { department = outer.Department }, inner => new { department = inner.HRPDepartment }, (outer, inner) => new { outer, inner }).Select(t =>
{
t.outer.AccountingUnit = t.inner?.FirstOrDefault()?.AccountingUnit;
t.outer.AccountingUnit = t.inner?.FirstOrDefault()?.AccountingUnit ?? t.outer.AccountingUnit;
return t.outer;
}).ToList();
}
......@@ -191,7 +191,8 @@ private void JudgeDataEqual(List<string> columns, List<per_employee> emps, List<
{ nameof(per_employee.BankCard), (t) => t.BankCard },
};
if (columns.Contains(nameof(per_employee.PersonnelNumber))) columns.Remove(nameof(per_employee.PersonnelNumber));
if (columns.Contains(nameof(per_employee.PersonnelNumber).ToLower())) columns.Remove(nameof(per_employee.PersonnelNumber).ToLower());
if (!columns.Contains(nameof(per_employee.AccountingUnit).ToLower())) columns.Add(nameof(per_employee.AccountingUnit).ToLower());
List<per_employee> updateData = new List<per_employee>();
foreach (var emp in emps)
......
......@@ -203,8 +203,15 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo
try
{
try
{
if (!pools.ContainsKey(config.Id))
pools.Add(config.Id, ConnectionBuilder.Create((DatabaseType)config.DataBaseType, config.DbSource, config.DbName, config.DbUser, config.DbPassword));
}
catch
{
logService.ReturnTheLog(allot.ID, groupName, 2, "数据库连接", $"数据库“{config.DbName}”连接失败", 3, isSingle);
}
IDbConnection connection = pools[config.Id];
......@@ -229,7 +236,7 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo
AllotId = allot.ID,
CreateTime = CreateTime,
}).ToList();
exresultRepository.AddRange(result.ToArray());
exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result);
});
}
......@@ -238,8 +245,7 @@ private List<ex_result> ExtractModuleData(per_allot allot, string groupName, boo
}
catch (Exception ex)
{
logger.LogError($"数据库“{config.DbName}”连接失败: {ex}; {Infrastructure.JsonHelper.Serialize(script)}");
logService.ReturnTheLog(allot.ID, groupName, 2, "数据库连接", $"数据库“{config.DbName}”连接失败", 3, isSingle);
logger.LogError($"typeId: {typeId}提取数据异常{ex}{Infrastructure.JsonHelper.Serialize(script)}");
}
}
}
......@@ -301,7 +307,7 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
AllotId = allot.ID,
CreateTime = CreateTime,
}).ToList();
exresultRepository.AddRange(result.ToArray());
exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result);
});
}
......@@ -364,7 +370,7 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
AllotId = allot.ID,
CreateTime = CreateTime,
}).ToList();
exresultRepository.AddRange(result.ToArray());
exresultRepository.InsertExecute(result.ToArray());
data.AddRange(result);
});
}
......
......@@ -91,7 +91,9 @@ public void CreateAllotPersons(int hospitalId, int allotId, int prevAllotId = -1
if (allot == null) throw new PerformanceException("绩效信息错误!");
var isExist = (peremployeeRepository.GetEntities(t => t.HospitalId == hospitalId && t.AllotId == allotId)?.Count ?? 0) > 0;
if (isExist) return;
//如果为空则先删除在执行下面的代码
if (isExist) { peremployeeRepository.DeleteFromQuery(u => u.HospitalId == hospitalId && u.AllotId == allotId);}
List<per_employee> persons = new List<per_employee>();
if (!new int[] { -1, 0 }.Contains(prevAllotId))
......
......@@ -225,7 +225,7 @@ public void ImportAllotData(int hospitalId, string filePath)
{
hisimportbaiscnormRepository.DeleteFromQuery(t => t.HospitalId == hospitalId && t.Year == item.Year && t.Month == item.Month);
}
hisimportbaiscnormRepository.BulkInsert(basicnormData);
hisimportbaiscnormRepository.InsertExecute(basicnormData);
}
#endregion 科室总绩效 人均绩效
......@@ -276,7 +276,7 @@ private void ImportBasicData(ISheet sheet, List<string> columns, int hospitalId,
{
hisimportdataRepository.DeleteFromQuery(t => t.HospitalId == hospitalId && t.Category == sheetName && t.Year == item.Year && t.Month == item.Month);
}
hisimportdataRepository.BulkInsert(data.Where(t => t.Year != 0 && t.Month != 0));
hisimportdataRepository.InsertExecute(data.Where(t => t.Year != 0 && t.Month != 0));
}
private void ImporAccountData(ISheet sheet, List<string> columns, int hospitalId, List<per_allot> allots, List<his_import_baiscnorm> basicnormData)
......@@ -342,7 +342,7 @@ private void ImporAccountData(ISheet sheet, List<string> columns, int hospitalId
{
hisimportaccountRepository.DeleteFromQuery(t => t.HospitalId == hospitalId && t.Year == item.Year && t.Month == item.Month);
}
hisimportaccountRepository.BulkInsert(data.Where(t => t.Year != 0 && t.Month != 0));
hisimportaccountRepository.InsertExecute(data.Where(t => t.Year != 0 && t.Month != 0));
#endregion his_import_account
}
......@@ -377,7 +377,7 @@ private void ImporAccountTag(ISheet sheet, List<string> columns, int hospitalId)
});
reportperformancetagsRepository.DeleteFromQuery(t => t.HospitalId == hospitalId);
reportperformancetagsRepository.BulkInsert(data.Where(t => !string.IsNullOrEmpty(t.UnitType) && !string.IsNullOrEmpty(t.AccountingUnit)));
reportperformancetagsRepository.InsertExecute(data.Where(t => !string.IsNullOrEmpty(t.UnitType) && !string.IsNullOrEmpty(t.AccountingUnit)));
}
private void ImporClinicData(ISheet sheet, List<string> columns, int hospitalId, List<per_allot> allots, List<his_import_baiscnorm> basicnormData)
......@@ -445,7 +445,7 @@ private void ImporClinicData(ISheet sheet, List<string> columns, int hospitalId,
{
hisimportclinicRepository.DeleteFromQuery(t => t.HospitalId == hospitalId && t.Year == item.Year && t.Month == item.Month);
}
hisimportclinicRepository.BulkInsert(data.Where(t => t.Year != 0 && t.Month != 0));
hisimportclinicRepository.InsertExecute(data.Where(t => t.Year != 0 && t.Month != 0));
#endregion his_import_clinic
}
......@@ -482,7 +482,7 @@ private void ImporClinicTag(ISheet sheet, List<string> columns, int hospitalId)
});
reportperformancepersontagsRepository.DeleteFromQuery(t => t.HospitalId == hospitalId);
reportperformancepersontagsRepository.BulkInsert(data.Where(t => !string.IsNullOrEmpty(t.PersonnelName) && !string.IsNullOrEmpty(t.PersonnelNumber)));
reportperformancepersontagsRepository.InsertExecute(data.Where(t => !string.IsNullOrEmpty(t.PersonnelName) && !string.IsNullOrEmpty(t.PersonnelNumber)));
}
private List<string> GetColumns(ISheet sheet, string sheetName, out string sourceType)
......
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