Commit 2cf9a257 by 唐仲阳

1

parents b73085c4 13fb3b8a
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
</ItemGroup>
</Project>
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;
}
}
}

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
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);
}
}
}
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>();
});
}
}
{
"$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"
}
}
}
}
namespace WebApplication1
{
public class SqlModel
{
public string CirculateSql { get; set; }
public string ExecuteSql { get; set; }
}
}
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();
});
}
}
}
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; }
}
}
<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>
{
"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;"
}
}
}
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
using Microsoft.AspNetCore.Authorization; using com.sun.tools.javac.util;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using QueryPlatform.Api.Infrastructure.Modules; using QueryPlatform.Api.Infrastructure.Modules;
using System; using System;
...@@ -15,8 +16,10 @@ public class DrugqueryController : Controller ...@@ -15,8 +16,10 @@ public class DrugqueryController : Controller
{ {
private readonly DrugqueryQueries _drugqueryQueries; private readonly DrugqueryQueries _drugqueryQueries;
private readonly HomeQueries _homeQueries; private readonly HomeQueries _homeQueries;
public DrugqueryController(DrugqueryQueries drugqueryQueries, HomeQueries homeQueries) private readonly ResourceQueries _resourceQueries;
public DrugqueryController(DrugqueryQueries drugqueryQueries, HomeQueries homeQueries, ResourceQueries resourceQueries)
{ {
_resourceQueries= resourceQueries;
_drugqueryQueries = drugqueryQueries; _drugqueryQueries = drugqueryQueries;
_homeQueries = homeQueries; _homeQueries = homeQueries;
} }
...@@ -134,6 +137,7 @@ public DrugqueryController(DrugqueryQueries drugqueryQueries, HomeQueries homeQu ...@@ -134,6 +137,7 @@ public DrugqueryController(DrugqueryQueries drugqueryQueries, HomeQueries homeQu
await semaphore.WaitAsync(); await semaphore.WaitAsync();
try try
{ {
_resourceQueries.LOG($"查询条件", "", num, "", $"{icd_or_diseaseCondition}{drugs}{materialNames}");
asynsDrugquery(sYS_Drugquery, icd_or_diseaseCondition, drugs, materialNames, num, type, zxr); asynsDrugquery(sYS_Drugquery, icd_or_diseaseCondition, drugs, materialNames, num, type, zxr);
} }
finally finally
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using NPoco;
using QueryPlatform.Api.Infrastructure.Hubs; using QueryPlatform.Api.Infrastructure.Hubs;
using QueryPlatform.Api.Infrastructure.Modules; using QueryPlatform.Api.Infrastructure.Modules;
using QueryPlatform.Api.Infrastructure.Queries; using QueryPlatform.Api.Infrastructure.Queries;
......
...@@ -24,11 +24,12 @@ protected override void Load(ContainerBuilder builder) ...@@ -24,11 +24,12 @@ protected override void Load(ContainerBuilder builder)
var Connection155 = configuration["ConnectionStrings:Connection155"]; var Connection155 = configuration["ConnectionStrings:Connection155"];
var Connection156 = configuration["ConnectionStrings:Connection156"]; var Connection156 = configuration["ConnectionStrings:Connection156"];
var Connection158 = configuration["ConnectionStrings:Connection158"]; var Connection158 = configuration["ConnectionStrings:Connection158"];
var lskxc = configuration["ConnectionStrings:lskxc"];
builder.RegisterType<HubNotificationQueue>().SingleInstance(); builder.RegisterType<HubNotificationQueue>().SingleInstance();
builder.Register(c => new UserStorage(configConnectionString)).InstancePerLifetimeScope(); builder.Register(c => new UserStorage(configConnectionString)).InstancePerLifetimeScope();
builder.Register(c => new UserQueries(configConnectionString)).InstancePerLifetimeScope(); builder.Register(c => new UserQueries(configConnectionString)).InstancePerLifetimeScope();
builder.Register(c => new ResourceQueries(Connection156, configConnectionString)).InstancePerLifetimeScope(); builder.Register(c => new ResourceQueries(Connection156, configConnectionString, lskxc)).InstancePerLifetimeScope();
builder.Register(c => new DrugqueryQueries(Connection156, configConnectionString)).InstancePerLifetimeScope(); builder.Register(c => new DrugqueryQueries(Connection156, configConnectionString)).InstancePerLifetimeScope();
builder.Register(c => new HomeQueries(configConnectionString, Connection156)).InstancePerLifetimeScope(); builder.Register(c => new HomeQueries(configConnectionString, Connection156)).InstancePerLifetimeScope();
builder.Register(c => new AnalysisQueries(Connection156, configConnectionString)).InstancePerLifetimeScope(); builder.Register(c => new AnalysisQueries(Connection156, configConnectionString)).InstancePerLifetimeScope();
......
...@@ -29,9 +29,9 @@ public Job(ILogger<Job> logger, DrugqueryQueries drugqueryQueries, HomeQueries h ...@@ -29,9 +29,9 @@ public Job(ILogger<Job> logger, DrugqueryQueries drugqueryQueries, HomeQueries h
{ {
var day = DateTime.Now.Day; var day = DateTime.Now.Day;
var time = DateTime.Now.ToString("HH:mm:ss"); var time = DateTime.Now.ToString("HH:mm:ss");
if (day == 8 && time == "09:39:01") if (day == 1 && time == "00:00:01")
{ {
// _drugqueryQueries.定时执行(); _drugqueryQueries.定时执行();
_homeQueries.SendMail("定时任务", "人群检索表 化验检查检索表合并成功"); _homeQueries.SendMail("定时任务", "人群检索表 化验检查检索表合并成功");
} }
} }
......
...@@ -54,6 +54,9 @@ public class SYS_Hospital ...@@ -54,6 +54,9 @@ public class SYS_Hospital
{ {
public int id { get; set; } public int id { get; set; }
public string HosName { get; set; } public string HosName { get; set; }
public string City { get; set; }
public string HosLevel { get; set; }
public string HosType { get; set; }
public string ExecOpenLink { get; set; } public string ExecOpenLink { get; set; }
public string ExecDatabase { get; set; } public string ExecDatabase { get; set; }
public string DataLoginName { get; set; } public string DataLoginName { get; set; }
...@@ -447,9 +450,8 @@ public class SYS_LOG ...@@ -447,9 +450,8 @@ public class SYS_LOG
public string 错误sql { get; set; } public string 错误sql { get; set; }
} }
public class DateExploration public class DateExploration
{ {
public int id { get; set; } public int Id { get; set; }
public int Id { get; internal set; }
public string Name1 { get; set; } public string Name1 { get; set; }
public string Name2 { get; set; } public string Name2 { get; set; }
public string Name3 { get; set; } public string Name3 { get; set; }
......
...@@ -912,19 +912,19 @@ public void ASSAYREPORT(long index, int id, string item_name = "") ...@@ -912,19 +912,19 @@ public void ASSAYREPORT(long index, int id, string item_name = "")
//第一层切割 //第一层切割
var sql2 = $@"UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,' var sql2 = $@"UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'
','&') prlong('将回车替换&') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'[','') ','&') print('将回车替换&') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'[','')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,']','')PRlong('将]替换 ') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,']','')print('将]替换 ')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,' ','`') prlong('将空格替换`') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,' ','`') print('将空格替换`')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`L','') prlong('将 `L 去除') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`L','') print('将 `L 去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`H','') prlong('将 `H 去除') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`H','') print('将 `H 去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`*','') prlong('将 `* 去除') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`*','') print('将 `* 去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`↑','')prlong('将 `↑去除') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`↑','')print('将 `↑去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`高','')prlong('将 `高 去除') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`高','')print('将 `高 去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`↓','')prlong('将 `↓去除') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`↓','')print('将 `↓去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`低','')prlong('将 `低 去除') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`低','')print('将 `低 去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'>','') prlong('将 > 去除') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'>','') print('将 > 去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'<','') prlong('将 < 去除') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'<','') print('将 < 去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=RIGHT(RESULTS,LEN(RESULTS)-1) WHERE LEFT(RESULTS,1)='`' prlong('将第一个字符为 ` 的去除') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=RIGHT(RESULTS,LEN(RESULTS)-1) WHERE LEFT(RESULTS,1)='`' print('将第一个字符为 ` 的去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&0','&') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&0','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&1','&') WHERE RESULTS NOT LIKE '&1`' UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&1','&') WHERE RESULTS NOT LIKE '&1`'
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&1`','&') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&1`','&')
...@@ -976,8 +976,8 @@ public void ASSAYREPORT(long index, int id, string item_name = "") ...@@ -976,8 +976,8 @@ public void ASSAYREPORT(long index, int id, string item_name = "")
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&47`','&') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&47`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&48`','&') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&48`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&49`','&') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&49`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&50`','&') prlong('将 &1`/2`/3`/4`/5`..... 改为&') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&50`','&') print('将 &1`/2`/3`/4`/5`..... 改为&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'【互】','') prlong('将 【互】去除') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'【互】','') print('将 【互】去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`') ---20次 UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`') ---20次
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`')
...@@ -998,7 +998,7 @@ public void ASSAYREPORT(long index, int id, string item_name = "") ...@@ -998,7 +998,7 @@ public void ASSAYREPORT(long index, int id, string item_name = "")
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`')prlong('将 多个连续``` 改为 `') UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'``','`')print('将 多个连续``` 改为 `')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&`','&')"; UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&`','&')";
//函数分列,换行 //函数分列,换行
...@@ -1139,7 +1139,7 @@ public void ASSAYREPORT(long index, int id, string item_name = "") ...@@ -1139,7 +1139,7 @@ public void ASSAYREPORT(long index, int id, string item_name = "")
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,50,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id} SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,50,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
)a WHERE [dbo].[fGetStrBySplit](RESULTS,1,'`') NOT LIKE '%名称%' )a WHERE [dbo].[fGetStrBySplit](RESULTS,1,'`') NOT LIKE '%名称%'
AND [dbo].[fGetStrBySplit](RESULTS,1,'`') <>'' AND [dbo].[fGetStrBySplit](RESULTS,1,'`') IS NOT NULL AND [dbo].[fGetStrBySplit](RESULTS,1,'`') <>'' AND [dbo].[fGetStrBySplit](RESULTS,1,'`') IS NOT NULL
prlong('临时数据生成中') print('临时数据生成中')
SELECT * into [dbo].[ASSAY_{index}_{id}] FROM ( SELECT * into [dbo].[ASSAY_{index}_{id}] FROM (
SELECT*FROM [dbo].[ASSAY1_{index}_{id}] SELECT*FROM [dbo].[ASSAY1_{index}_{id}]
...@@ -1159,7 +1159,7 @@ UNION ALL ...@@ -1159,7 +1159,7 @@ UNION ALL
AND a.ITEM_ENAME NOT LIKE '%审核%' AND a.ITEM_ENAME NOT LIKE '%审核%'
AND UNIT NOT LIKE '%备注%' AND UNIT NOT LIKE '%备注%'
AND a.UNIT NOT LIKE '%标本%'; AND a.UNIT NOT LIKE '%标本%';
prlong('临时数据生成完成');"; print('临时数据生成完成');";
connection.Execute(sql, commandTimeout: 60 * 60 * 5); connection.Execute(sql, commandTimeout: 60 * 60 * 5);
connection.Execute(sql2, commandTimeout: 60 * 60 * 5); connection.Execute(sql2, commandTimeout: 60 * 60 * 5);
connection.Execute(sql3, commandTimeout: 60 * 60 * 5); connection.Execute(sql3, commandTimeout: 60 * 60 * 5);
......
...@@ -1430,6 +1430,25 @@ public List<string> ceshi() ...@@ -1430,6 +1430,25 @@ public List<string> ceshi()
} }
public List<string> city_hosLevel_hosType(string type)
{
var dbs = "SELECT city,left(hosLevel,1)hosLevel,hosType FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] where isnull([ExecOpenLink],'')!='' and isnull([ExecDatabase],'')!=''";
var hoss = Connection(156).Query<SYS_Hospital>(dbs);
if (type == "city")
{
return hoss.Select(s => s.City.Replace(" ","")).Distinct().ToList();
}
else if (type == "hosLevel")
{
return hoss.Select(s => s.HosLevel.Replace(" ", "")).Distinct().ToList();
}
else if (type == "hosType")
{
return hoss.Select(s => s.HosType.Replace(" ", "")).Distinct().ToList();
}
return null;
}
/// <summary> /// <summary>
/// 游标 /// 游标
/// </summary> /// </summary>
......
...@@ -2,7 +2,12 @@ ...@@ -2,7 +2,12 @@
using DocumentFormat.OpenXml; using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging; using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing; using DocumentFormat.OpenXml.Wordprocessing;
using HtmlAgilityPack;
using java.sql;
using java.util.concurrent;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using OfficeOpenXml;
using PuppeteerSharp; using PuppeteerSharp;
using QueryPlatform.Api.Infrastructure.Modules; using QueryPlatform.Api.Infrastructure.Modules;
using System; using System;
...@@ -23,10 +28,12 @@ public class ResourceQueries ...@@ -23,10 +28,12 @@ public class ResourceQueries
{ {
private readonly string _Connection156; private readonly string _Connection156;
private readonly string _configConnectionString; private readonly string _configConnectionString;
public ResourceQueries(string Connection156, string configConnectionString) private readonly string _lskxc;
public ResourceQueries(string Connection156, string configConnectionString, string lskxc)
{ {
_Connection156 = Connection156; _Connection156 = Connection156;
_configConnectionString = configConnectionString; _configConnectionString = configConnectionString;
_lskxc = lskxc;
} }
/// <summary> /// <summary>
/// 查询所有项目 /// 查询所有项目
...@@ -99,6 +106,7 @@ public IEnumerable<dynamic> ShowITEM_NAME(int id) ...@@ -99,6 +106,7 @@ public IEnumerable<dynamic> ShowITEM_NAME(int id)
return sj; return sj;
} }
#region 入参
public class nffb public class nffb
{ {
public string n { get; set; } public string n { get; set; }
...@@ -400,13 +408,13 @@ UNION ALL ...@@ -400,13 +408,13 @@ UNION ALL
if (xz == 1) if (xz == 1)
{ {
string aa = await ConvertToPdf(htmlContent, PROJECT_NAME); string aa = await ConvertToExcl(htmlContent, PROJECT_NAME);
return (yearfb, dqfb, condition, PROJECT_NAME, ShowQuery3s, ShowQuery4s, aa, ShowQuery5s); return (yearfb, dqfb, condition, PROJECT_NAME, ShowQuery3s, ShowQuery4s, aa, ShowQuery5s);
} }
return (yearfb, dqfb, condition, PROJECT_NAME, ShowQuery3s, ShowQuery4s, null, ShowQuery5s); return (yearfb, dqfb, condition, PROJECT_NAME, ShowQuery3s, ShowQuery4s, null, ShowQuery5s);
} }
#endregion
/// <summary> /// <summary>
...@@ -492,6 +500,7 @@ public string ConvertHtmlToPdf(string html, string xmname) ...@@ -492,6 +500,7 @@ public string ConvertHtmlToPdf(string html, string xmname)
return outfilepath + "pdf"; return outfilepath + "pdf";
} }
public async System.Threading.Tasks.Task<string> ConvertToPdf(string html, string xmname) public async System.Threading.Tasks.Task<string> ConvertToPdf(string html, string xmname)
{ {
...@@ -523,6 +532,88 @@ public string ConvertHtmlToPdf(string html, string xmname) ...@@ -523,6 +532,88 @@ public string ConvertHtmlToPdf(string html, string xmname)
} }
public async System.Threading.Tasks.Task<string> ConvertToExcl(string html, string xmname)
{
// 从HTML字符串获取数据表
DataTable dataTable = ConvertHtmlToDataTable(html);
// 将数据表保存为Excel文件
return await SaveDataTableToExcel(dataTable, $@"{fwq}{xmname}人群分布{DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(1000, 9999).ToString()}.xlsx");
}
static DataTable ConvertHtmlToDataTable(string html)
{
DataTable dataTable = new DataTable();
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(html);
// 从HTML中提取表格数据
var tableNodes = doc.DocumentNode.SelectNodes("//table");
if (tableNodes != null && tableNodes.Count > 0)
{
var headers = tableNodes[0].SelectNodes(".//th");
if (headers != null)
{
foreach (var header in headers)
{
string headerText = header.InnerText.Trim();
if (!string.IsNullOrEmpty(headerText))
{
dataTable.Columns.Add(headerText);
}
}
}
var rows = tableNodes[0].SelectNodes(".//tr");
foreach (var row in rows)
{
DataRow dataRow = dataTable.NewRow();
var cells = row.SelectNodes(".//td");
for (int i = 0; i < cells.Count; i++)
{
string cellText = cells[i].InnerText.Trim();
if (i < dataTable.Columns.Count)
{
dataRow[i] = cellText;
}
}
dataTable.Rows.Add(dataRow);
}
}
return dataTable;
}
public async System.Threading.Tasks.Task<string> SaveDataTableToExcel(DataTable dataTable, string filePath)
{
FileInfo fileInfo = new FileInfo(filePath);
using (ExcelPackage package = new ExcelPackage(fileInfo))
{
ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Sheet1");
// 写入列标题
for (int i = 0; i < dataTable.Columns.Count; i++)
{
worksheet.Cells[1, i + 1].Value = dataTable.Columns[i].ColumnName;
}
// 写入行数据
for (int i = 0; i < dataTable.Rows.Count; i++)
{
for (int j = 0; j < dataTable.Columns.Count; j++)
{
worksheet.Cells[i + 2, j + 1].Value = dataTable.Rows[i][j];
}
}
package.Save();
}
string outfilepath = @$"https://lsk.suvalue.com/api/export/export/人群分布报告/{filePath.Replace($@"{fwq}", "")}";
return outfilepath + "xlsx";
}
/// <summary> /// <summary>
/// 创建流水表 /// 创建流水表
/// </summary> /// </summary>
...@@ -1476,7 +1567,7 @@ public void PullData(long indexs, string DatabaseName, string tableName, int dbz ...@@ -1476,7 +1567,7 @@ public void PullData(long indexs, string DatabaseName, string tableName, int dbz
} }
catch (Exception e) catch (Exception e)
{ {
LOG($"修复超时错误", "修复超时错误", indexs, "修复失败", $"报错:{e}"); // LOG($"修复超时错误", "修复超时错误", indexs, "修复失败", $"报错:{e}");
} }
finally finally
{ {
...@@ -1604,7 +1695,7 @@ public long QueryPatient(string tableName) ...@@ -1604,7 +1695,7 @@ public long QueryPatient(string tableName)
public List<服务器> 标准库fwq() public List<服务器> 标准库fwq()
{ {
DbConnection connection = new SqlConnection(_configConnectionString); DbConnection connection = new SqlConnection(_configConnectionString);
return connection.Query<服务器>($@"SELECT * FROM [SV_QueryPlatform].[dbo].[服务器] where type='标准库'").ToList(); return connection.Query<服务器>($@"SELECT * FROM [SV_QueryPlatform].[dbo].[服务器]").ToList();
} }
} }
......
...@@ -4,9 +4,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121. ...@@ -4,9 +4,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
--> -->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<DeleteExistingFiles>True</DeleteExistingFiles> <DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data> <ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform> <LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider> <PublishProvider>FileSystem</PublishProvider>
...@@ -15,6 +15,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. ...@@ -15,6 +15,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<SiteUrlToLaunchAfterPublish /> <SiteUrlToLaunchAfterPublish />
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<ProjectGuid>e9d630a1-10fd-4dcf-abc2-d827dd79d8d4</ProjectGuid> <ProjectGuid>e9d630a1-10fd-4dcf-abc2-d827dd79d8d4</ProjectGuid>
<SelfContained>false</SelfContained> <SelfContained>true</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
\ No newline at end of file
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
"Connection155": "Server=192.168.18.155;Database=DB_SV_Data_Config;User ID=sa;Password=Suvalue2016;Trusted_Connection=False;", "Connection155": "Server=192.168.18.155;Database=DB_SV_Data_Config;User ID=sa;Password=Suvalue2016;Trusted_Connection=False;",
"Connection156": "Server=192.168.18.156;Database=DB_SV_Data_Config;User ID=sa;Password=srv@Ashersa;Trusted_Connection=False;", "Connection156": "Server=192.168.18.156;Database=DB_SV_Data_Config;User ID=sa;Password=srv@Ashersa;Trusted_Connection=False;",
"Connection158": "Server=192.168.18.158;Database=DB_SV_Data_Config;User ID=sa;Password=Suvalue2016;Trusted_Connection=False;", "Connection158": "Server=192.168.18.158;Database=DB_SV_Data_Config;User ID=sa;Password=Suvalue2016;Trusted_Connection=False;",
"pg":"Host=192.168.18.185;Port=5432;Username=postgres;Password=Suvalue2016;Database=db_QueryPlatformcare_drgs;" "pg": "Host=192.168.18.185;Port=5432;Username=postgres;Password=Suvalue2016;Database=db_QueryPlatformcare_drgs;",
"lskxc": "4"
} }
} }
......
...@@ -198,7 +198,7 @@ ...@@ -198,7 +198,7 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="F:QueryPlatform.Api.Controllers.ResourceController.semaphore"> <member name="M:QueryPlatform.Api.Controllers.ResourceController.PullDataAsync(System.Int64,System.String,System.String,System.String)">
<summary> <summary>
拉取流水库数据 拉取流水库数据
</summary> </summary>
......
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