Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
queryPlatform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
唐仲阳
queryPlatform
Commits
0e46ff0b
Commit
0e46ff0b
authored
Aug 30, 2023
by
tangzhongyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
272deee2
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
396 additions
and
13 deletions
+396
-13
api/WebApplication1.rar
+0
-0
api/WebApplication1/WebApplication1/DBHelper/DBHelper.csproj
+11
-0
api/WebApplication1/WebApplication1/DBHelper/DBHelpers.cs
+74
-0
api/WebApplication1/WebApplication1/WebApplication1.sln
+31
-0
api/WebApplication1/WebApplication1/WebApplication1/Controllers/CursorController.cs
+18
-0
api/WebApplication1/WebApplication1/WebApplication1/Program.cs
+26
-0
api/WebApplication1/WebApplication1/WebApplication1/Properties/launchSettings.json
+31
-0
api/WebApplication1/WebApplication1/WebApplication1/SqlModel.cs
+8
-0
api/WebApplication1/WebApplication1/WebApplication1/Startup.cs
+59
-0
api/WebApplication1/WebApplication1/WebApplication1/WeatherForecast.cs
+15
-0
api/WebApplication1/WebApplication1/WebApplication1/WebApplication1.csproj
+15
-0
api/WebApplication1/WebApplication1/WebApplication1/appsettings.Development.json
+12
-0
api/WebApplication1/WebApplication1/WebApplication1/appsettings.json
+10
-0
api/queryPlaform.Api/Controllers/HomeController.cs
+18
-7
api/queryPlaform.Api/Infrastructure/Models/SYS_MODELS.cs
+21
-0
api/queryPlaform.Api/Infrastructure/Queries/HomeQueries.cs
+47
-6
No files found.
api/WebApplication1.rar
0 → 100644
View file @
0e46ff0b
File added
api/WebApplication1/WebApplication1/DBHelper/DBHelper.csproj
0 → 100644
View file @
0e46ff0b
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
</ItemGroup>
</Project>
api/WebApplication1/WebApplication1/DBHelper/DBHelpers.cs
0 → 100644
View file @
0e46ff0b
using
System
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Data.Common
;
using
System.Data.SqlClient
;
using
System.Data.SqlTypes
;
using
System.Linq
;
namespace
DBHelper
{
public
class
DBHelpers
{
public
static
string
ConectionString
=
"server=192.168.18.151;User Id=sa;Password=Suvalue2016;"
;
public
DBHelpers
()
{
}
/// <summary>
/// 执行循环的sql
/// </summary>
/// <param name="SQLString"></param>
/// <returns>表名集合</returns>
public
static
List
<
string
>
Query
(
string
CirculateSql
)
{
List
<
string
>
tableName
=
new
List
<
string
>();
using
(
SqlConnection
connection
=
new
SqlConnection
(
ConectionString
))
{
using
(
SqlCommand
cmd
=
new
SqlCommand
(
CirculateSql
,
connection
))
{
connection
.
Open
();
SqlDataReader
result
=
cmd
.
ExecuteReader
();
while
(
result
.
Read
())
{
tableName
.
Add
(
result
[
"name"
].
ToString
());
}
connection
.
Close
();
return
tableName
;
}
}
}
/// <summary>
/// 遍历表名,并执行sql
/// </summary>
/// <param name="tableName"></param>
/// <returns>受影响的行数(-1:执行的sql为空 -2:未找到表)</returns>
public
static
int
Add
(
List
<
string
>
tableName
,
string
ExcuteSql
){
int
count
=
0
;
if
(
ExcuteSql
==
""
||
ExcuteSql
==
null
)
{
count
=
-
1
;
return
count
;
}
else
if
(
tableName
.
Count
==
0
)
{
count
=
-
2
;
return
count
;
}
using
(
SqlConnection
connection
=
new
SqlConnection
(
ConectionString
))
{
connection
.
Open
();
foreach
(
var
name
in
tableName
)
{
SqlCommand
cmd
=
connection
.
CreateCommand
();
cmd
.
CommandText
=
ExcuteSql
.
Replace
(
"[@name]"
,
"["
+
name
+
"]"
);
count
+=
cmd
.
ExecuteNonQuery
();
ExcuteSql
=
ExcuteSql
.
Replace
(
"["
+
name
+
"]"
,
"[@name]"
);
}
connection
.
Close
();
}
return
count
;
}
}
}
api/WebApplication1/WebApplication1/WebApplication1.sln
0 → 100644
View file @
0e46ff0b
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34018.315
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication1", "WebApplication1\WebApplication1.csproj", "{EF8E5F21-FE45-4812-B60F-5375F6C51C01}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DBHelper", "DBHelper\DBHelper.csproj", "{CB7F6E84-B3B5-46FA-80A2-88EC633828B3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EF8E5F21-FE45-4812-B60F-5375F6C51C01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF8E5F21-FE45-4812-B60F-5375F6C51C01}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF8E5F21-FE45-4812-B60F-5375F6C51C01}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF8E5F21-FE45-4812-B60F-5375F6C51C01}.Release|Any CPU.Build.0 = Release|Any CPU
{CB7F6E84-B3B5-46FA-80A2-88EC633828B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB7F6E84-B3B5-46FA-80A2-88EC633828B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB7F6E84-B3B5-46FA-80A2-88EC633828B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB7F6E84-B3B5-46FA-80A2-88EC633828B3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C360C5EB-C4AE-4FDF-9AAD-406E0050028B}
EndGlobalSection
EndGlobal
api/WebApplication1/WebApplication1/WebApplication1/Controllers/CursorController.cs
0 → 100644
View file @
0e46ff0b
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
System.Collections.Generic
;
namespace
WebApplication1.Controllers
{
[
Route
(
"api/[controller]"
)]
[
ApiController
]
public
class
CursorController
:
ControllerBase
{
[
HttpPost
(
"Demo"
)]
public
int
Demo
([
FromBody
]
SqlModel
Sql
)
{
List
<
string
>
TableNames
=
DBHelper
.
DBHelpers
.
Query
(
Sql
.
CirculateSql
);
return
DBHelper
.
DBHelpers
.
Add
(
TableNames
,
Sql
.
ExecuteSql
);
}
}
}
api/WebApplication1/WebApplication1/WebApplication1/Program.cs
0 → 100644
View file @
0e46ff0b
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Logging
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
WebApplication1
{
public
class
Program
{
public
static
void
Main
(
string
[]
args
)
{
CreateHostBuilder
(
args
).
Build
().
Run
();
}
public
static
IHostBuilder
CreateHostBuilder
(
string
[]
args
)
=>
Host
.
CreateDefaultBuilder
(
args
)
.
ConfigureWebHostDefaults
(
webBuilder
=>
{
webBuilder
.
UseStartup
<
Startup
>();
});
}
}
api/WebApplication1/WebApplication1/WebApplication1/Properties/launchSettings.json
0 → 100644
View file @
0e46ff0b
{
"$schema"
:
"http://json.schemastore.org/launchsettings.json"
,
"iisSettings"
:
{
"windowsAuthentication"
:
false
,
"anonymousAuthentication"
:
true
,
"iisExpress"
:
{
"applicationUrl"
:
"http://localhost:41905"
,
"sslPort"
:
44327
}
},
"profiles"
:
{
"IIS Express"
:
{
"commandName"
:
"IISExpress"
,
"launchBrowser"
:
true
,
"launchUrl"
:
"swagger"
,
"environmentVariables"
:
{
"ASPNETCORE_ENVIRONMENT"
:
"Development"
}
},
"WebApplication1"
:
{
"commandName"
:
"Project"
,
"dotnetRunMessages"
:
"true"
,
"launchBrowser"
:
true
,
"launchUrl"
:
"swagger"
,
"applicationUrl"
:
"https://localhost:5001;http://localhost:5000"
,
"environmentVariables"
:
{
"ASPNETCORE_ENVIRONMENT"
:
"Development"
}
}
}
}
api/WebApplication1/WebApplication1/WebApplication1/SqlModel.cs
0 → 100644
View file @
0e46ff0b
namespace
WebApplication1
{
public
class
SqlModel
{
public
string
CirculateSql
{
get
;
set
;
}
public
string
ExecuteSql
{
get
;
set
;
}
}
}
api/WebApplication1/WebApplication1/WebApplication1/Startup.cs
0 → 100644
View file @
0e46ff0b
using
Microsoft.AspNetCore.Builder
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.HttpsPolicy
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.OpenApi.Models
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
WebApplication1
{
public
class
Startup
{
public
Startup
(
IConfiguration
configuration
)
{
Configuration
=
configuration
;
}
public
IConfiguration
Configuration
{
get
;
}
// This method gets called by the runtime. Use this method to add services to the container.
public
void
ConfigureServices
(
IServiceCollection
services
)
{
services
.
AddControllers
();
services
.
AddSwaggerGen
(
c
=>
{
c
.
SwaggerDoc
(
"v1"
,
new
OpenApiInfo
{
Title
=
"WebApplication1"
,
Version
=
"v1"
});
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public
void
Configure
(
IApplicationBuilder
app
,
IWebHostEnvironment
env
)
{
if
(
env
.
IsDevelopment
())
{
app
.
UseDeveloperExceptionPage
();
app
.
UseSwagger
();
app
.
UseSwaggerUI
(
c
=>
c
.
SwaggerEndpoint
(
"/swagger/v1/swagger.json"
,
"WebApplication1 v1"
));
}
app
.
UseHttpsRedirection
();
app
.
UseRouting
();
app
.
UseAuthorization
();
app
.
UseEndpoints
(
endpoints
=>
{
endpoints
.
MapControllers
();
});
}
}
}
api/WebApplication1/WebApplication1/WebApplication1/WeatherForecast.cs
0 → 100644
View file @
0e46ff0b
using
System
;
namespace
WebApplication1
{
public
class
WeatherForecast
{
public
DateTime
Date
{
get
;
set
;
}
public
int
TemperatureC
{
get
;
set
;
}
public
int
TemperatureF
=>
32
+
(
int
)(
TemperatureC
/
0.5556
);
public
string
Summary
{
get
;
set
;
}
}
}
api/WebApplication1/WebApplication1/WebApplication1/WebApplication1.csproj
0 → 100644
View file @
0e46ff0b
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DBHelper\DBHelper.csproj" />
</ItemGroup>
</Project>
api/WebApplication1/WebApplication1/WebApplication1/appsettings.Development.json
0 → 100644
View file @
0e46ff0b
{
"Logging"
:
{
"LogLevel"
:
{
"Default"
:
"Information"
,
"Microsoft"
:
"Warning"
,
"Microsoft.Hosting.Lifetime"
:
"Information"
},
"Connection"
:
{
"ConnectionString"
:
"Host=192.168.18.187;Port=5432;Username=postgres;Password=Suvalue2016;Database=db_healthcare_drgs_gongcheng;SearchPath=public;"
}
}
}
api/WebApplication1/WebApplication1/WebApplication1/appsettings.json
0 → 100644
View file @
0e46ff0b
{
"Logging"
:
{
"LogLevel"
:
{
"Default"
:
"Information"
,
"Microsoft"
:
"Warning"
,
"Microsoft.Hosting.Lifetime"
:
"Information"
}
},
"AllowedHosts"
:
"*"
}
api/queryPlaform.Api/Controllers/HomeController.cs
View file @
0e46ff0b
...
@@ -22,12 +22,12 @@ public class HomeController : Controller
...
@@ -22,12 +22,12 @@ public class HomeController : Controller
{
{
private
readonly
HomeQueries
_homeQueries
;
private
readonly
HomeQueries
_homeQueries
;
private
readonly
IWebHostEnvironment
_environment
;
private
readonly
IWebHostEnvironment
_environment
;
private
readonly
IHubContext
<
NotificationHub
>
_hubContext
;
private
readonly
IHubContext
<
NotificationHub
>
_hubContext
;
public
HomeController
(
HomeQueries
homeQueries
,
IWebHostEnvironment
environment
,
IHubContext
<
NotificationHub
>
hubContext
)
public
HomeController
(
HomeQueries
homeQueries
,
IWebHostEnvironment
environment
,
IHubContext
<
NotificationHub
>
hubContext
)
{
{
_homeQueries
=
homeQueries
;
_homeQueries
=
homeQueries
;
_environment
=
environment
;
_environment
=
environment
;
_hubContext
=
hubContext
;
_hubContext
=
hubContext
;
}
}
/// <summary>
/// <summary>
/// 查询所有项目记录
/// 查询所有项目记录
...
@@ -123,7 +123,7 @@ public IEnumerable<dynamic> Funca()
...
@@ -123,7 +123,7 @@ public IEnumerable<dynamic> Funca()
{
{
var
DemandQuery
=
_homeQueries
.
FuncaQuery
();
var
DemandQuery
=
_homeQueries
.
FuncaQuery
();
return
DemandQuery
;
return
DemandQuery
;
}
}
//[HttpGet("lingchuanglujingjiancha")]
//[HttpGet("lingchuanglujingjiancha")]
//[AllowAnonymous]
//[AllowAnonymous]
...
@@ -215,7 +215,7 @@ public IActionResult Update(DATAEXTRACT dataExtract)
...
@@ -215,7 +215,7 @@ public IActionResult Update(DATAEXTRACT dataExtract)
//网站拉取json
//网站拉取json
[
HttpPost
(
"Ybyp"
)]
[
HttpPost
(
"Ybyp"
)]
[
AllowAnonymous
]
[
AllowAnonymous
]
public
async
Task
<
IActionResult
>
Ybyp
(
int
dqy
,
int
zys
)
public
async
Task
<
IActionResult
>
Ybyp
(
int
dqy
,
int
zys
)
{
{
for
(
long
i
=
dqy
;
i
<=
zys
;
i
++)
for
(
long
i
=
dqy
;
i
<=
zys
;
i
++)
{
{
...
@@ -232,7 +232,7 @@ public IActionResult Update(DATAEXTRACT dataExtract)
...
@@ -232,7 +232,7 @@ public IActionResult Update(DATAEXTRACT dataExtract)
using
(
var
response
=
await
client
.
SendAsync
(
request
))
using
(
var
response
=
await
client
.
SendAsync
(
request
))
{
{
response
.
EnsureSuccessStatusCode
();
response
.
EnsureSuccessStatusCode
();
var
body
=
await
response
.
Content
.
ReadAsStringAsync
();
var
body
=
await
response
.
Content
.
ReadAsStringAsync
();
_homeQueries
.
Ybyp
(
body
,
i
);
_homeQueries
.
Ybyp
(
body
,
i
);
}
}
...
@@ -311,7 +311,17 @@ public IActionResult ceshi()
...
@@ -311,7 +311,17 @@ public IActionResult ceshi()
{
{
return
Ok
(
_homeQueries
.
ceshi
());
return
Ok
(
_homeQueries
.
ceshi
());
}
}
}
[
HttpPost
(
"Cursor"
)]
[
AllowAnonymous
]
public
string
Cursor
([
FromBody
]
CursorModel
Sql
)
{
return
_homeQueries
.
Cursor
(
Sql
);
}
}
}
}
\ No newline at end of file
api/queryPlaform.Api/Infrastructure/Models/SYS_MODELS.cs
View file @
0e46ff0b
...
@@ -103,6 +103,27 @@ public class SYS_YIYUAN
...
@@ -103,6 +103,27 @@ public class SYS_YIYUAN
public
long
hosid
{
get
;
set
;
}
public
long
hosid
{
get
;
set
;
}
public
string
hosname
{
get
;
set
;
}
public
string
hosname
{
get
;
set
;
}
}
}
public
class
CursorModel
{
/// <summary>
/// 地区
/// </summary>
public
string
City
{
get
;
set
;
}
/// <summary>
/// 医院等级
/// </summary>
public
string
HosLevel
{
get
;
set
;
}
/// <summary>
/// 医院类型
/// </summary>
public
string
HosType
{
get
;
set
;
}
/// <summary>
/// 执行sql
/// </summary>
public
string
ExecuteSql
{
get
;
set
;
}
}
public
class
DATAEXTRACT
public
class
DATAEXTRACT
{
{
public
long
HOS_ID
{
get
;
set
;
}
public
long
HOS_ID
{
get
;
set
;
}
...
...
api/queryPlaform.Api/Infrastructure/Queries/HomeQueries.cs
View file @
0e46ff0b
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
namespace
QueryPlatform.Api.Infrastructure.Queries
namespace
QueryPlatform.Api.Infrastructure.Queries
{
{
public
class
HomeQueries
public
class
HomeQueries
{
{
private
readonly
string
_configConnectionString
;
private
readonly
string
_configConnectionString
;
...
@@ -1412,12 +1412,52 @@ public List<string> ceshi()
...
@@ -1412,12 +1412,52 @@ public List<string> ceshi()
return
errs
;
return
errs
;
}
}
/// <summary>
/// 游标
/// </summary>
/// <returns></returns>
public
string
Cursor
(
CursorModel
model
)
{
var
dbs
=
"SELECT * FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] where isnull([ExecOpenLink],'')!='' and isnull([ExecDatabase],'')!=''"
;
string
Return
=
@"执行结束"
;
string
condition
=
""
;
if
(
string
.
IsNullOrEmpty
(
model
.
ExecuteSql
))
{
Return
=
"请填写全!"
;
return
Return
;
}
if
(!
string
.
IsNullOrEmpty
(
model
.
City
))
{
dbs
=
dbs
+
$" and City like '%
{
model
.
City
}
%'"
;
condition
=
"医院区域:"
+
model
.
City
;
}
if
(!
string
.
IsNullOrEmpty
(
model
.
HosLevel
))
{
dbs
=
dbs
+
$" and HosLevel like '%
{
model
.
HosLevel
}
%'"
;
condition
=
condition
+(
string
.
IsNullOrEmpty
(
condition
)?(
"医院等级:"
+
model
.
City
):
(
@"
医院等级:"
+
model
.
HosLevel
));
}
if
(!
string
.
IsNullOrEmpty
(
model
.
HosType
))
{
condition
=
condition
+(
string
.
IsNullOrEmpty
(
condition
)
?
(
"医院类型:"
+
model
.
HosType
)
:
(
@"
医院类型:"
+
model
.
HosType
));
}
return
condition
+
Return
;
}
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment