@@ -167,13 +165,11 @@ public IEnumerable<dynamic> ShowLog(long indexs, string tableName)
catch(Exceptione)
{
throwe;
}
finally
{
semaphore.Release();
}
}
resourceQueries.Connection(181).Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET DataPullTime=getdate() WHERE indexs={indexs} and tableName='{tableName}'");
configConnection.Execute(@$"update [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK = 23,END_TIME=getdate(),log='{sql2.Replace("'","''")}' where COMPLETE_MARK != 22 and id= "+Indexs);
@@ -342,14 +342,17 @@ public void Drugquery(long typefee, long type1_2, string drugs, string[] drugNam
}
if(Countnum($@"SELECT count(*) FROM [SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] where hos_id=cast(right('{item.ExecDatabase}',3)as int) and indexs={Indexs}",configConnection)>0)
{
varsql3=$@"IF EXISTS(SELECT * FROM [{item.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'MEDIC_PERSON_INFORMATION_{Indexs}')
varsql3="";
if(typefee==1)
{
sql3=$@"IF EXISTS(SELECT * FROM [{item.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'MEDIC_PERSON_INFORMATION_{Indexs}')
drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs};
A.REG_TIME,B.ID AREA_ID,{Indexs} INDEXS,cast( RIGHT ( '{item.ExecDatabase}', 3 ) AS int ) HOS_ID,
C.BIRTHDAY,C.SEX,1 TYPE,A.DEPT_NAME into [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}
FROM {item.ExecDatabase}.[dbo].OUT_REG_INFO A
JOIN (SELECT DISTINCT REG_CODE,D.ID FROM {item.ExecDatabase}.[dbo].{mzb} E
join [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] D ON {(typefee==1?"E.ITEM_NAME":"REPLACE(REPLACE(E.MEDIC_GENERAL_NAME,E.MEDIC_SPEC,''),' ','')")} = D.ITEM_NAME AND ISNULL(E.MEDIC_AREA,'') = ISNULL(D.MEDIC_AREA,'') AND INDEXS={Indexs} AND HOS_ID = cast( RIGHT ( '{item.ExecDatabase}', 3 ) AS int ))B
join [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] D ON E.ITEM_NAME = D.ITEM_NAME AND ISNULL(E.MEDIC_AREA,'') = ISNULL(D.MEDIC_AREA,'') AND INDEXS={Indexs} AND HOS_ID = cast( RIGHT ( '{item.ExecDatabase}', 3 ) AS int ))B
ON A.REG_CODE = B.REG_CODE
JOIN {item.ExecDatabase}.[dbo].PUB_PATIENT C ON A.PERSON_CODE = C.PERSON_CODE
WHERE A.REG_CODE = B.REG_CODE AND A.PERSON_CODE = C.PERSON_CODE
...
...
@@ -359,11 +362,41 @@ UNION ALL
C.BIRTHDAY,C.SEX,1 TYPE,A.OUT_DEPT_NAME
FROM {item.ExecDatabase}.[dbo].INPAT_REG_INFO A
JOIN(SELECT DISTINCT REG_CODE,D.ID FROM {item.ExecDatabase}.[dbo].{zyb} E
JOIN [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] D ON {(typefee==1?"E.ITEM_NAME":"REPLACE(REPLACE(E.ITEM_NAME,E.MEDIC_SPEC,''),' ','')")} = D.ITEM_NAME
AND ISNULL(E.MEDIC_AREA,'') = ISNULL(D.MEDIC_AREA,'') AND INDEXS={Indexs} AND HOS_ID = cast( RIGHT ( '{item.ExecDatabase}', 3 ) AS int ))B
JOIN [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] D ON E.ITEM_NAME = D.ITEM_NAME AND ISNULL(E.MEDIC_AREA,'') = ISNULL(D.MEDIC_AREA,'') AND INDEXS={Indexs} AND HOS_ID = cast( RIGHT ( '{item.ExecDatabase}', 3 ) AS int ))B
ON A.REG_CODE = B.REG_CODE
JOIN {item.ExecDatabase}.[dbo].PUB_PATIENT C ON A.PERSON_CODE = C.PERSON_CODE
WHERE A.REG_CODE = B.REG_CODE AND A.PERSON_CODE = C.PERSON_CODE";
}
else
{
varoutwhere="";
varinpatwhere="";
foreach(vardrugindrugName)
{
outwhere=outwhere+@$"{(!string.IsNullOrEmpty(outwhere)?" or ":"")} REPLACE(REPLACE(MEDIC_GENERAL_NAME,MEDIC_SPEC,''),' ','') like '%{drug}%'";
inpatwhere=inpatwhere+@$"{(!string.IsNullOrEmpty(inpatwhere)?" or ":"")} REPLACE(REPLACE(ITEM_NAME,MEDI_SPEC,''),' ','') like '%{drug}%'";
}
sql3=$@"IF EXISTS(SELECT * FROM [{item.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'MEDIC_PERSON_INFORMATION_{Indexs}')
drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs};
vardbs="SELECT city,left(hosLevel,1)hosLevel,hosType FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] where isnull([ExecOpenLink],'')!='' and isnull([ExecDatabase],'')!=''";
Connection(181).Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =2 ,DataPullTime=getdate() WHERE indexs={indexs} and tableName='{tableName.Replace(" ","")}'");
//try
//{
longrs=QueryPatient(tableName);
sql=ShowSql($"{biao}",2)[0];
if(hos.ExecDatabase=="HOS_631337112")
{
sql=sql.Replace("HOS_ID=CAST(RIGHT('@ExecDatabase',3)as int)","HOS_ID>=112 and HOS_ID<=138");
sql=sql.Replace("ORG_CODE=CAST(RIGHT('@ExecDatabase',3)as int)","ORG_CODE>=112 and ORG_CODE<=138");
Connection(181).Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET DataPullTime=getdate() WHERE indexs={indexs} and tableName='{tableName}'");
Connection(181).Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =5 WHERE indexs={indexs} and tableName='{tableName.Replace(" ","")}'");//拉取完成
Connection(181).Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =2 ,DataPullTime=getdate() WHERE indexs={indexs} and tableName='{tableName.Replace(" ","")}'");
//try
//{
longrs=QueryPatient(tableName);
sql=ShowSql($"{biao}",2)[0];
if(hos.ExecDatabase=="HOS_631337112")
{
sql=sql.Replace("HOS_ID=CAST(RIGHT('@ExecDatabase',3)as int)","HOS_ID>=112 and HOS_ID<=138");
sql=sql.Replace("ORG_CODE=CAST(RIGHT('@ExecDatabase',3)as int)","ORG_CODE>=112 and ORG_CODE<=138");
Connection(181).Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET DataPullTime=getdate() WHERE indexs={indexs} and tableName='{tableName}'");