Commit fd981073 by lcx

Merge branch 'hotfix/删除his_data、ex_result数据'

parents 4645cddc 95be6f76
...@@ -76,6 +76,7 @@ public int DeleteAllotData(int allotId) ...@@ -76,6 +76,7 @@ public int DeleteAllotData(int allotId)
"im_employee_logistics", "im_employee_logistics",
"im_header", "im_header",
"im_specialunit", "im_specialunit",
"his_data",
"log_check", "log_check",
"per_employee", "per_employee",
"per_sheet", "per_sheet",
......
...@@ -123,10 +123,7 @@ public void ClearResultData(int allotid) ...@@ -123,10 +123,7 @@ public void ClearResultData(int allotid)
if (connection.State != ConnectionState.Open) connection.Open(); if (connection.State != ConnectionState.Open) connection.Open();
try try
{ {
string update = "update ex_result set isdelete = 1 where allotid = @allotid "; string clear = "delete from ex_result where allotid = @allotid;";
connection.Execute(update, new { allotid }, commandTimeout: 60 * 60);
string clear = "delete from ex_result where allotid = @allotid and isdelete = 1 and createtime < (select min(createtime) from (select distinct createtime from ex_result where allotid = @allotid and isdelete = 1 order by createtime desc limit 4) t);";
connection.Execute(clear, new { allotid }, commandTimeout: 60 * 60); connection.Execute(clear, new { allotid }, commandTimeout: 60 * 60);
} }
catch (Exception) catch (Exception)
......
...@@ -232,7 +232,8 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri ...@@ -232,7 +232,8 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri
var data = queryService.QueryData<HisData>(config, script.ExecScript, allot, isSingle); var data = queryService.QueryData<HisData>(config, script.ExecScript, allot, isSingle);
if (data == null || !data.Any()) return; if (data == null || !data.Any()) return;
var hisdata = hisdataRepository.GetEntities(t => t.AllotId == allot.ID && t.SourceType == script.SourceType && t.Category == script.Category); var hisdata = hisdataRepository.GetEntities(t => t.HospitalId == allot.HospitalId && t.Year == allot.Year && t.Month == allot.Month
&& t.SourceType == script.SourceType && t.Category == script.Category);
if (hisdata != null && hisdata.Any()) if (hisdata != null && hisdata.Any())
{ {
hisdataRepository.RemoveRange(hisdata.ToArray()); hisdataRepository.RemoveRange(hisdata.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