Commit b23fcbbf by tangzhongyang

no message

parent 54dd7884
...@@ -169,9 +169,15 @@ public void Inquire(SYS_QueryConditions sYS_Query) ...@@ -169,9 +169,15 @@ public void Inquire(SYS_QueryConditions sYS_Query)
sYS_Query.type = 1; //疾病查询 sYS_Query.type = 1; //疾病查询
resourceQueries.DiagInquire(sYS_Query.icd, sYS_Query.diseaseName); resourceQueries.DiagInquire(sYS_Query.icd, sYS_Query.diseaseName);
} }
else else if (sYS_Query.drugName.Length > 1)
{ {
throw new DomainException($@"材料费只支持单独查询!"); sYS_Query.type = 2; //药品查询
resourceQueries.DrugInquire(sYS_Query.drugName);
}
else if (sYS_Query.materialName.Length > 1)
{
sYS_Query.type = 3; //材料查询
resourceQueries.MaterialInquire(sYS_Query.materialName);
} }
} }
} }
......
...@@ -66,11 +66,8 @@ public bool CancelProject(int id) ...@@ -66,11 +66,8 @@ public bool CancelProject(int id)
if (COMPLETE_MARK.Count() > 0) if (COMPLETE_MARK.Count() > 0)
throw new DomainException("该项目已经执行完毕,不能取消!!!"); throw new DomainException("该项目已经执行完毕,不能取消!!!");
else else
result = connection.Execute("update [SV_MEDIC_STATISTICS].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK = 22 where and COMPLETE_MARK != 22 id= " + id) > 0 ? true : false; return result = connection.Execute("update [SV_MEDIC_STATISTICS].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK = 31 where and COMPLETE_MARK != 22 id= " + id) > 0 ? true : false;
if (result) LOG("停止中","",id,"查询平台","");
return connection.Execute("delete [SV_MEDIC_STATISTICS].[dbo].[MEDIC_SEARCH_RECORD] where COMPLETE_MARK = 22 and id= " + id) > 0 ? true : false;
else
throw new DomainException("该项目强行停止,但是删除记录失败,请执行delete [SV_MEDIC_STATISTICS].[dbo].[MEDIC_SEARCH_RECORD] where COMPLETE_MARK = 22 and id= " + id);
} }
return false; return false;
} }
...@@ -1149,12 +1146,176 @@ SELECT DISTINCT ...@@ -1149,12 +1146,176 @@ SELECT DISTINCT
} }
} }
//查询所有医院
public List<SYS_Hospital> showHospitals()
{
var sql = "";
using (DbConnection connection156 = new SqlConnection(_Connection156))
{
// sys_hospital156找医院
sql = @$"SELECT top 2
ExecOpenLink ,
ExecDatabase
FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital]
WHERE ExecOpenLink <>'' AND ExecOpenLink IS NOT NULL
AND ExecDatabase <>'' AND ExecDatabase IS NOT NULL
";
List<SYS_Hospital> hospitals = connection156.Query<SYS_Hospital>(sql).ToList();
return hospitals;
}
return null; ;
}
//判断是否取消
public int qx(int id)
{
using (DbConnection configConnection = new SqlConnection(_configConnectionString))
{
var sql = @$"SELECT COMPLETE_MARK FROM [SV_QueryPlatform].[dbo].[MEDIC_SEARCH_RECORD] where id ={id}";
int[] A = configConnection.Query<int>(sql).ToArray();
return A[0];
}
}
//Inquire //Inquire
/// <summary> /// <summary>
/// diag查询平台 /// diag查询平台
/// </summary> /// </summary>
public void DiagInquire(string [] icd, string []diseaseNam) public void DiagInquire(int type,string [] icd, string []diseaseName)
{
int indexs = -1;
int num = 0;
var sql = "";
var ITEM = "[@ExecOpenLink].[@ExecDatabase]";
//数组拼接条件
var icd_or_diseaseCondition = "";
foreach (var icdname in icd)
{
icd_or_diseaseCondition = icd_or_diseaseCondition + $"or icd like '%{icdname}%' ";
}
foreach (var disease in diseaseName)
{
icd_or_diseaseCondition = icd_or_diseaseCondition + $"or DISEASE_NAME like '%{disease}%' ";
}
icd_or_diseaseCondition = icd_or_diseaseCondition.Substring(2, icd_or_diseaseCondition.Length - 2);
//------------------------------查询------------------------//
//1.调医院
List<SYS_Hospital> hospitals = showHospitals();
using (DbConnection configConnection = new SqlConnection(_configConnectionString)) // DefaultConnection
using (DbConnection connection151 = new SqlConnection(_Connection151))
using (DbConnection connection152 = new SqlConnection(_Connection152))
using (DbConnection connection153 = new SqlConnection(_Connection153))
using (DbConnection connection154 = new SqlConnection(_Connection154))
using (DbConnection connection155 = new SqlConnection(_Connection155))
using (DbConnection connection156 = new SqlConnection(_Connection156))
using (DbConnection connection158 = new SqlConnection(_Connection158))
{
try
{
sql = " ";
//添加一条查询记录
connection156.Execute(sql, commandTimeout: 60 * 60 * 5);
sql = ShowSql($"SELECT_DIAG_{type}")[0];
Dictionary<string, object> pairs = new Dictionary<string, object> { };
foreach (var hos in hospitals)
{
pairs.Clear();
// 存在 // 不存在
pairs.TryAdd($"@{nameof(hos.ExecOpenLink)}", hos.ExecOpenLink);
pairs.TryAdd($"@{nameof(hos.ExecDatabase)}", hos.ExecDatabase);
pairs.TryAdd($"@{nameof(indexs)}", indexs);
// sql 数据源导出csv 导入csv 到connection
if (qx(indexs) != 31)
{
sql = sql.Replace("@condition", icd_or_diseaseCondition);
foreach (var item1 in pairs)
{
ITEM = ITEM.Replace(item1.Key, item1.Value.ToString());
sql = sql.Replace(item1.Key, item1.Value.ToString());
}
if (hos.ExecOpenLink == "192.168.18.151")
num = num + connection151.Execute(sql, commandTimeout: 60 * 60 * 5);
else if (hos.ExecOpenLink == "192.168.18.152")
num = num + connection152.Execute(sql, commandTimeout: 60 * 60 * 5);
else if (hos.ExecOpenLink == "192.168.18.153")
num = num + connection153.Execute(sql, commandTimeout: 60 * 60 * 5);
else if (hos.ExecOpenLink == "192.168.18.154")
num = num + connection154.Execute(sql, commandTimeout: 60 * 60 * 5);
else if (hos.ExecOpenLink == "192.168.18.155")
num = num + connection155.Execute(sql, commandTimeout: 60 * 60 * 5);
else if (hos.ExecOpenLink == "192.168.18.156")
num = num + connection156.Execute(sql, commandTimeout: 60 * 60 * 5);
else if (hos.ExecOpenLink == "192.168.18.158")
num = num + connection158.Execute(sql, commandTimeout: 60 * 60 * 5);
LOG($"查询成功,{num}行", $"{ITEM}", indexs, "查询平台", "");
}
else
{
configConnection.Execute("update [SV_QueryPlatform].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK = 23 where and COMPLETE_MARK != 22 id= " + indexs);
if (qx(indexs) == 23)//取消
{
LOG("停止成功", "", indexs, "查询平台", "");
}
}
}
configConnection.Execute("update [SV_MEDIC_STATISTICS].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK = 22 where and COMPLETE_MARK != 22 id= " + indexs);
LOG("查询结束", "", indexs, "查询平台", "");
}
catch (Exception e)
{
LOG($"查询失败", $"{ITEM}", indexs, "查询平台", sql);
}
}
}
//Inquire
/// <summary>
///Drug查询平台
/// </summary>
public void DrugInquire(int id,int type ,string[] drugName)
{
var sql = "";
//数组拼接条件
var drugCondition = "";
foreach (var drug in drugName)
{ {
drugCondition = drugCondition + $"or ITEM_NAME like '%{drug}%' ";
}
drugCondition=drugCondition.Substring(2, drugCondition.Length - 2);
List<SYS_Hospital> hospitals = showHospitals();
using (DbConnection configConnection = new SqlConnection(_configConnectionString)) // DefaultConnection
using (DbConnection connection151 = new SqlConnection(_Connection151))
using (DbConnection connection152 = new SqlConnection(_Connection152))
using (DbConnection connection153 = new SqlConnection(_Connection153))
using (DbConnection connection154 = new SqlConnection(_Connection154))
using (DbConnection connection155 = new SqlConnection(_Connection155))
using (DbConnection connection156 = new SqlConnection(_Connection156))
using (DbConnection connection158 = new SqlConnection(_Connection158))
{
}
}
//Inquire
/// <summary>
///Drug查询平台
/// </summary>
public void MaterialInquire(string[] materialName)
{
} }
} }
} }
\ No newline at end of file
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