Commit 8011008c by tangzhongyang

queryPlatform2.0

parent 94acbadf
[*.cs]
# Default severity for analyzer diagnostics with category 'Style'
dotnet_analyzer_diagnostic.category-Style.severity = none
# Default severity for all analyzer diagnostics
dotnet_analyzer_diagnostic.severity = none
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using Health.Api.Infrastructure;
//using Health.Api.Infrastructure.Models;
using Health.Api.Infrastructure.Modules;
using Health.Api.Infrastructure.Queries;
using Health.Api.Infrastructure.Request;
using Health.Infra;
namespace Health.Api.Controllers
{
[Authorize]
[Route("api/resource")]
[ApiController]
public class ResourceController : ControllerBase
{
private readonly IMemoryCache _cache;
private readonly ResourceQueries resourceQueries;
public ResourceController(
IMemoryCache cache,
ResourceQueries resourceQueries)
{
this._cache = cache;
this.resourceQueries = resourceQueries;
}
/// <summary>
/// 查询当月项目
/// </summary>
/// <param name="source"> </param>
/// <returns></returns>
[HttpGet("ItemQuery")]
[AllowAnonymous]
public IEnumerable<dynamic> ItemQuery( )
{
var ItemQueryList = resourceQueries.ItemQuery( );
return ItemQueryList;
}
/// <summary>
/// 取消正在查询项目
/// </summary>
/// <param name="id">id </param>
/// <returns></returns>
[HttpPost("CancelProject")]
[AllowAnonymous]
public bool CancelProject(int id)
{
bool ItemQueryList = resourceQueries.CancelProject(id);
return ItemQueryList;
}
/// <summary>
/// 查询项目报告
/// </summary>
/// <param name="source">药品 疾病 同查 全部 </param>
/// <returns></returns>
[HttpPost("ProjectReport")]
[AllowAnonymous]
public (IEnumerable<dynamic> yearDistribution, IEnumerable<dynamic> regionalDistribution ,string queryCriteria,string title) ProjectReport([FromBody] SYS_Cs sYS_Cs)
{
return resourceQueries.ProjectReport(sYS_Cs.id, sYS_Cs.MEDIC_AREA, sYS_Cs.item_name, sYS_Cs.GENERIC_NAME, sYS_Cs.PROJECT_NAME, sYS_Cs.icd, sYS_Cs.DISEASE_NAME);
}
/// <summary>
/// 查询流水库表
/// </summary>
/// <returns></returns>
[HttpPost("QueryFlowDatabase")]
[AllowAnonymous]
public IEnumerable<dynamic> QueryFlowDatabase()
{
return resourceQueries.QueryFlowDatabase();
}
/// <summary>
/// 查询药品产地
/// </summary>
/// <returns></returns>
[HttpPost("ShowMEDIC_AREA")]
[AllowAnonymous]
public (IEnumerable<dynamic>, IEnumerable<dynamic>) ShowMEDIC_AREA(int id, int paseIndex)
{
return resourceQueries.ShowMEDIC_AREA(id, paseIndex);
}
/// <summary>
/// 查询名称产地
/// </summary>
/// <returns></returns>
[HttpPost("ShowITEM_NAME")]
[AllowAnonymous]
public (IEnumerable<dynamic>, IEnumerable<dynamic>) ShowITEM_NAME(int id, int paseIndex)
{
return resourceQueries.ShowITEM_NAME(id, paseIndex);
}
/// <summary>
/// 建立流水库表
/// </summary>
/// <returns></returns>
[HttpPost("EstablishFlowDatabaseTable")]
[AllowAnonymous]
public bool EstablishFlowDatabaseTable([FromBody] SYS_EstablishFlowDatabaseTable sYS_EstablishFlows)
{
return resourceQueries.EstablishFlowDatabaseTable(sYS_EstablishFlows.tableName, sYS_EstablishFlows.sql, sYS_EstablishFlows.id, sYS_EstablishFlows.remarks); ;
}
/// <summary>
/// 建立流水库
/// </summary>
/// <returns></returns>
[HttpPost("CreateAFlow_Library")]
[AllowAnonymous]
public bool CreateAFlow_Library(string DatabaseName,int indexs)
{
return resourceQueries.CreateAFlow_Library(DatabaseName,indexs);
}
/// <summary>
/// 查询日志
/// </summary>
/// <returns></returns>
[HttpPost("ShowLog")]
[AllowAnonymous]
public (IEnumerable<dynamic>, IEnumerable<dynamic>) ShowLog(int indexs, int paseIndex, string type)
{
return resourceQueries.ShowLog(indexs,paseIndex,type);
}
/// <summary>
/// 拉取流水库数据
/// </summary>
/// <returns></returns>
[HttpPost("PullData")]
[AllowAnonymous]
public void PullData(int indexs,string DatabaseName,string tableName)
{
resourceQueries.PullData(indexs, DatabaseName, tableName, "PUB_PATIENT");
//拉取登记
resourceQueries.PullData(indexs, DatabaseName, tableName, "OUT_REG_INFO");
resourceQueries.PullData(indexs, DatabaseName, tableName, "INPAT_REG_INFO");
//拉取诊断
resourceQueries.PullData(indexs, DatabaseName, tableName, "OUT_DIAG");
resourceQueries.PullData(indexs, DatabaseName, tableName, "INPAT_DIAG");
resourceQueries.PullData(indexs, DatabaseName, tableName, "OPS_INFO");
resourceQueries.PullData(indexs, DatabaseName, tableName, "ASSAY_REPORT");
resourceQueries.PullData(indexs, DatabaseName, tableName, "EXEC_REPORT");
resourceQueries.PullData1(indexs, DatabaseName, tableName, "OUT_PRES");
resourceQueries.PullData1(indexs, DatabaseName, tableName, "OUT_FEE");
resourceQueries.PullData1(indexs, DatabaseName, tableName, "INPAT_ORDER");
resourceQueries.PullData1(indexs, DatabaseName, tableName, "INPAT_FEE");
}
}
}
namespace Health.Api.Infrastructure.Modules
{
public class SYS_Cs
{
public int id { get; set; }
public string MEDIC_AREA { get; set; }
public string item_name { get; set; }
public string GENERIC_NAME { get; set; }
public string PROJECT_NAME { get; set; }
public string DISEASE_NAME { get; set; }
public string icd { get; set; }
}
public class SYS_EstablishFlowDatabaseTable
{
public int id { get; set; }
public string tableName { get; set; }
public string sql { get; set; }
public string remarks { get; set; }
}
}
namespace Health.Api.Infrastructure.Modules
{
public class SYS_Hospital
{
public int ID { get; set; }
public string HosName { get; set; }
public string ExecOpenLink { get; set; }
public string ExecDatabase { get; set; }
public string DataLoginName { get; set; }
public string DataPassword { get; set; }
}
public class 服务器
{
public string 服务器ip { get; set; }
public string 数据库账号 { get; set; }
public string 数据库密码 { get; set; }
}
public class hosid
{
public int id { get; set; }
}
public class jcid
{
public int COUNT1 { get; set; }
public int COUNT2 { get; set; }
}
public class SYS_Drugquery
{
/// <summary>
/// 1 命中查询 2其他查询
/// </summary>
public int type1_2 { get; set; }
/// <summary>
/// ICD编码
/// </summary>
public string[] icd { get; set; }
/// <summary>
/// 疾病名称
/// </summary>
public string[] diseaseName { get; set; }
/// <summary>
/// 药品
/// </summary>
public string[] drugName { get; set; }
/// <summary>
/// 材料费
/// </summary>
public string[] materialName { get; set; }
/// <summary>
/// 项目,名称
/// </summary>
public string peojectName { get; set; }
}
}
using Dapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Data.SqlClient;
//using Health.Api.Infrastructure.Models;
using Health.Api.Infrastructure.Modules;
using Health.Api.Infrastructure.Request;
using Health.Infra;
using StackExchange.Profiling;
using StackExchange.Profiling.Data;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Threading.Tasks;
using static UtilExtensions;
namespace Health.Api.Infrastructure.Queries
{
public class ResourceQueries
{
private readonly string _Connection156;
private readonly string _configConnectionString;
private readonly string _Connection151;
private readonly string _Connection152;
private readonly string _Connection153;
private readonly string _Connection154;
private readonly string _Connection155;
private readonly string _Connection158;
//private List<Common> a;
bool state = true;
public ResourceQueries(string Connection156, string configConnectionString, string Connection151, string Connection152, string Connection153, string Connection154, string Connection155, string Connection158)
{
_Connection156 = Connection156;
_configConnectionString = configConnectionString;
_Connection151 = Connection151;
_Connection152 = Connection152;
_Connection153 = Connection153;
_Connection154 = Connection154;
_Connection155 = Connection155;
_Connection158 = Connection158;
}
/// <summary>
/// 查询所有项目
/// </summary>
public IEnumerable<dynamic> ItemQuery()
{
DbConnection connection = new SqlConnection(_configConnectionString);
var query = @" SELECT ID, PROJECT_NAME, GENERIC_NAME, DISEASE_NAME, ICD,
COMPLETE_MARK, search_time
FROM [SV_QueryPlatform].[dbo].[MEDIC_SEARCH_RECORD] order by id DESC ";
return connection.Query(query).ToList();
}
/// <summary>
/// 停止正在查询项目
/// </summary>
public bool CancelProject(int id)
{
DbConnection connection = new SqlConnection(_configConnectionString);
//确定该项目在执行中
IEnumerable<dynamic> COMPLETE_MARK = connection.Query("select COMPLETE_MARK FROM [SV_QueryPlatform].[dbo].[MEDIC_SEARCH_RECORD] where COMPLETE_MARK =22 and id=" + id);
if (COMPLETE_MARK.Count() > 0)
throw new DomainException("该项目已经执行完毕,不能取消!!!");
else
LOG("停止中", "", id, "查询平台", "");
return connection.Execute("update [SV_QueryPlatform].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK = 31 where and COMPLETE_MARK != 22 id= " + id) > 0 ? true : false;
}
public (IEnumerable<dynamic>, IEnumerable<dynamic>) ShowMEDIC_AREA(int id, int paseIndex)
{
DbConnection connection = new SqlConnection(_configConnectionString);
IEnumerable<dynamic> sj = connection.Query($@"select*FROM(
SELECT ROW_NUMBER() OVER(ORDER BY getdate())AS id,* FROM(
SELECT DISTINCT
[MEDIC_AREA]
FROM [SV_QueryPlatform_].[dbo].[MEDIC_AREA_{id}] WHERE INDEXS={id} AND MEDIC_AREA IS NOT NULL AND MEDIC_AREA<>''
)a
)b
WHERE id<={paseIndex}*10 and id>({paseIndex}-1)*10
").ToList();
IEnumerable<dynamic> zon = connection.Query($@" SELECT CAST(COUNT(*)AS MONEY)totalCount ,{paseIndex} paseIndex FROM(
SELECT DISTINCT
[MEDIC_AREA]
FROM [SV_QueryPlatform_].[dbo].[MEDIC_AREA_{id}] WHERE INDEXS={id} AND MEDIC_AREA IS NOT NULL AND MEDIC_AREA<>''
)a").ToList();
return (sj, zon);
}
public (IEnumerable<dynamic>, IEnumerable<dynamic>) ShowITEM_NAME(int id, int paseIndex)
{
DbConnection connection = new SqlConnection(_configConnectionString);
IEnumerable<dynamic> sj = connection.Query($@"select*FROM(
SELECT ROW_NUMBER() OVER(ORDER BY getdate())AS id,* FROM(
SELECT DISTINCT
[ITEM_NAME]
FROM [SV_QueryPlatform_].[dbo].[MEDIC_AREA_{id}] WHERE INDEXS={id} AND ITEM_NAME IS NOT NULL AND ITEM_NAME<>''
)a
)b
WHERE id<={paseIndex}*10 and id>({paseIndex}-1)*10
").ToList();
IEnumerable<dynamic> zon = connection.Query($@" SELECT CAST(COUNT(*)AS MONEY)totalCount ,{paseIndex} paseIndex FROM(
SELECT DISTINCT
[ITEM_NAME]
FROM [SV_QueryPlatform_].[dbo].[MEDIC_AREA_{id}] WHERE INDEXS={id} AND ITEM_NAME IS NOT NULL AND ITEM_NAME<>''
)a").ToList();
return (sj, zon);
}
/// <summary>
/// 删除MEDIC_PERSON_INFORMATION_存储过程表的记录
/// </summary>
public bool deleteShow()
{
DbConnection connection = new SqlConnection(_configConnectionString);
return connection.Execute("delete [SV_QueryPlatform].[dbo].[MEDIC_PERSON_INFORMATION_存储过程表]") >= 0 ? true : false;
}
/// <summary>
/// 添加本次查询的记录到 MEDIC_PERSON_INFORMATION_存储过程表
/// </summary>
public bool addShow(int id, string MEDIC_AREA, string ITEM_NAME)
{
if (MEDIC_AREA is null)
MEDIC_AREA = "1=1";
else
{
MEDIC_AREA = MEDIC_AREA.Replace(",", ",");
MEDIC_AREA = "MEDIC_AREA LIKE '%" + MEDIC_AREA.Replace(",", " %' or MEDIC_AREA like '%") + "%'";
}
if (ITEM_NAME is null)
ITEM_NAME = "and (1=1)";
else
{
ITEM_NAME = ITEM_NAME.Replace(",", ",");
ITEM_NAME = " ITEM_NAME LIKE '%" + ITEM_NAME.Replace(",", " %' or ITEM_NAME like '%") + "%'";
ITEM_NAME = "and (" + ITEM_NAME + ")";
}
DbConnection connection = new SqlConnection(_configConnectionString);
var AddQuery = $@"
insert into [SV_QueryPlatform].[dbo].[MEDIC_PERSON_INFORMATION_存储过程表]
( HOS_ID, MASTER_INDEX, BIRTHDAY, SEX, PERSON_CODE, PERSON_ID, REG_CODE, REG_ID, REG_SOURCE, REG_TIME, AREA_ID, INDEXS, TYPE, DEPT_NAME, MEDIC_AREA)
SELECT a.HOS_ID,MASTER_INDEX,BIRTHDAY,SEX,PERSON_CODE,PERSON_ID,REG_CODE,REG_ID,REG_SOURCE,REG_TIME,AREA_ID,a.INDEXS,a.TYPE,DEPT_NAME,a.MEDIC_AREA
FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{id}] a
left join [SV_QueryPlatform_].[dbo].[MEDIC_AREA_{id}] b on a.AREA_ID = b.ID AND a.INDEXS=b.INDEXS AND a.TYPE=b.TYPE
where({MEDIC_AREA}) {ITEM_NAME} and a.TYPE = 1 AND a.INDEXS IN(" + id + ")";
return connection.Execute(AddQuery, commandTimeout: 60 * 60 * 5) >= 0 ? true : false;
}
/// <summary>
///报告展示(疾病展示所有,药品可以填写)
/// </summary>
public (IEnumerable<dynamic>, IEnumerable<dynamic>, string, string) ProjectReport(int id, string MEDIC_AREA, string item_name, string GENERIC_NAME, string PROJECT_NAME, string icd, string DISEASE_NAME)
{
bool result = deleteShow();
if (result)
result = addShow(id, MEDIC_AREA == "" ? null : MEDIC_AREA, item_name == "" ? null : item_name);
else
throw new DomainException("请重试!!!");
if (result)
return Show(id, MEDIC_AREA == "" ? null : MEDIC_AREA, GENERIC_NAME == "" ? null : GENERIC_NAME, PROJECT_NAME == "" ? null : PROJECT_NAME, icd == "" ? null : icd, DISEASE_NAME == "" ? null : DISEASE_NAME);
return (null, null, null, null);
}
/// <summary>
/// 展示结果
/// </summary>
public (IEnumerable<dynamic>, IEnumerable<dynamic>, string, string) Show(int id, string MEDIC_AREA, string GENERIC_NAME, string PROJECT_NAME, string icd, string DISEASE_NAME)
{
DbConnection connection = new SqlConnection(_configConnectionString);
var ShowQuery1 = $@"SELECT * FROM (
SELECT '总'n,COUNT(*)RS FROM (
SELECT DISTINCT HOS_ID,MASTER_INDEX
FROM [SV_QueryPlatform].[dbo].[MEDIC_PERSON_INFORMATION_存储过程表] WHERE TYPE=1 AND INDEXS IN ({id})) S
union all
SELECT cast(N as nvarchar(10))n,COUNT(*)RS FROM (
SELECT DISTINCT YEAR([REG_TIME])N, HOS_ID,MASTER_INDEX
FROM [SV_QueryPlatform].[dbo].[MEDIC_PERSON_INFORMATION_存储过程表] WHERE TYPE=1 AND INDEXS IN ({id}) AND YEAR(REG_TIME)>=2014
) S GROUP BY N
UNION ALL
SELECT '2013'N,COUNT(*)RS FROM (
SELECT DISTINCT HOS_ID,MASTER_INDEX
FROM [SV_QueryPlatform].[dbo].[MEDIC_PERSON_INFORMATION_存储过程表] WHERE TYPE=1 AND INDEXS IN({id})
AND YEAR(REG_TIME)<=2013 ) S
)S PIVOT (SUM(RS) FOR N IN ([2013],[2014],[2015],[2016],[2017],[2018],[2019],[2020],[2021],[总]))V";
var ShowQuery2 = $@"SELECT '医院区域'classification, PROVINCE hospital,COUNT(DISTINCT case when CODE is not null then code else HOS_ID end)hospitalsSUM,COUNT(*)patientSUM FROM (
SELECT DISTINCT HOS_ID,MASTER_INDEX,replace([Province],' ','')PROVINCE,CODE
FROM (SELECT DISTINCT HOS_ID,MASTER_INDEX
FROM [SV_QueryPlatform].[dbo].[MEDIC_PERSON_INFORMATION_存储过程表] WHERE TYPE=1 AND INDEXS IN ({id})) A
JOIN [192.168.18.156].[DB_SV_DATA_CONFIG].[DBO].[SYS_HOSPITAL] B ON A.HOS_ID=B.ID
) N GROUP BY PROVINCE
UNION ALL
SELECT '医院级别'JB,HOSLEVEL,COUNT(DISTINCT case when CODE is not null then code else HOS_ID end ),COUNT(*)RS FROM (
SELECT DISTINCT HOS_ID,MASTER_INDEX,PROVINCE,CODE,
CASE WHEN HOSLEVEL LIKE '%三%' THEN '三级' WHEN HOSLEVEL LIKE '%二%' THEN '二级'
ELSE '一级' END HOSLEVEL,
HOSTYPE FROM (SELECT DISTINCT HOS_ID,MASTER_INDEX
FROM [SV_QueryPlatform].[dbo].[MEDIC_PERSON_INFORMATION_存储过程表] WHERE TYPE=1 AND INDEXS IN ({id})) A
JOIN [192.168.18.156].[DB_SV_DATA_CONFIG].[DBO].[SYS_HOSPITAL] B ON A.HOS_ID=B.ID
) N GROUP BY HOSLEVEL
UNION ALL
SELECT '医院类别'LB,HOSTYPE,COUNT(DISTINCT case when CODE is not null then code else HOS_ID end),COUNT(*)RS FROM (
SELECT DISTINCT HOS_ID,MASTER_INDEX,CODE,
HOSTYPE FROM (SELECT DISTINCT HOS_ID,MASTER_INDEX
FROM [SV_QueryPlatform].[dbo].[MEDIC_PERSON_INFORMATION_存储过程表] WHERE TYPE=1 AND INDEXS IN({id}) ) A
JOIN [192.168.18.156].[DB_SV_DATA_CONFIG].[DBO].[SYS_HOSPITAL] B ON A.HOS_ID=B.ID
) N GROUP BY HOSTYPE
UNION ALL
SELECT '总览'ZL,'医院数',COUNT(DISTINCT case when CODE is not null then code else HOS_ID end),COUNT(*)RS FROM (
SELECT DISTINCT HOS_ID,MASTER_INDEX,CODE,
HOSTYPE FROM (SELECT DISTINCT HOS_ID,MASTER_INDEX
FROM [SV_QueryPlatform].[dbo].[MEDIC_PERSON_INFORMATION_存储过程表] WHERE TYPE=1 AND INDEXS IN({id}) ) A
JOIN [192.168.18.156].[DB_SV_DATA_CONFIG].[DBO].[SYS_HOSPITAL] B ON A.HOS_ID=B.ID ) N ";
IEnumerable<dynamic> yearfb = connection.Query(ShowQuery1);
IEnumerable<dynamic> dqfb = connection.Query(ShowQuery2).ToList();
var condition = "";
if (!string.IsNullOrEmpty(icd)) condition = "ICD:" + icd;
if (!string.IsNullOrEmpty(DISEASE_NAME)) condition = condition + @"疾病名称:" + DISEASE_NAME;
if (!string.IsNullOrEmpty(GENERIC_NAME)) condition = condition + @"药品名称:" + GENERIC_NAME;
if (!string.IsNullOrEmpty(MEDIC_AREA)) condition = condition + @"产地:" + MEDIC_AREA;
return (yearfb, dqfb, condition, PROJECT_NAME);
}
/// <summary>
/// 创建流水表
/// </summary>
public bool EstablishFlowDatabaseTable(string PROJECT_NAME, string sql, int id, string remarks)
{
DbConnection connection = new SqlConnection(_configConnectionString);
int isfilter = 1;
if (connection.Query("select *from [SV_QueryPlatform].[dbo].[FlowReservoirStatus] where tableName like '%" + PROJECT_NAME + "%'").Count() > 0)
{
throw new DomainException(PROJECT_NAME + "流水库表已存在!");
}
else
{
if (sql == "" || sql == null)
{
isfilter = 0;
sql = $"SELECT distinct MASTER_INDEX,hos_id FROM[192.168.18.156].[SV_MEDIC_STATISTICS].[dbo].[MEDIC_PERSON_INFORMATION] WHERE indexs = {id} and TYPE = 1";
}
if (connection.Execute($@"INSERT INTO[SV_QueryPlatform].[dbo].[FlowReservoirStatus]([tableName] ,[createDate] ,[state],indexs,isfilter,[sql],remarks)
select'{PROJECT_NAME}', getdate(), 0,{id} ,{isfilter},'INSERT INTO[SV_QueryPlatform].[dbo].[{PROJECT_NAME}]([MASTER_INDEX],[HOS_ID]){sql }','{remarks}'") > 0 ? true : false)
{
connection.Execute(@"CREATE TABLE [SV_QueryPlatform].[dbo].[" + PROJECT_NAME + "]([MASTER_INDEX][INT] NULL,[HOS_ID][INT] NULL) ON[PRIMARY]");
if (connection.Query(@"select * from[SV_QueryPlatform].sys.tables WHERE name = '" + PROJECT_NAME + "'").Count() > 0 ? true : false)
{
return connection.Execute("INSERT INTO [SV_QueryPlatform].[dbo].[" + PROJECT_NAME + "]([MASTER_INDEX],[HOS_ID])" + sql) > 0 ? true : false;
}
else
{
throw new DomainException("创建 [SV_QueryPlatform].[dbo].[" + PROJECT_NAME + "]流水库表成功,插入人群时报错!插入数据先病人再医院编码");
}
}
else
{
throw new DomainException("创建 [SV_QueryPlatform].[dbo].[" + PROJECT_NAME + "]流水库表失败");
}
}
}
/// <summary>
/// 查询日志
/// </summary>
public (IEnumerable<dynamic>, IEnumerable<dynamic>) ShowLog(int indexs, int paseIndex, string type)
{
using (DbConnection connection = new SqlConnection(_configConnectionString))
{
type = string.IsNullOrEmpty(type) ? "" : $"AND LEFT(type,2)='{type}'";
return (connection.Query($@" select*FROM(
SELECT ROW_NUMBER() OVER(ORDER BY getdate())AS id,* FROM(
SELECT INDEXS, hos_code, LOG, CreateDate, type, case when type not like '%成功%' then 错误sql else '' end [错误sql]
FROM [SV_QueryPlatform].[dbo].[SYS_LOG] WHERE indexs ={indexs} {type}
)a )b WHERE id<={paseIndex}*20 and id>({paseIndex}-1)*20").ToList(),
connection.Query($@"SELECT COUNT(*),CAST(COUNT(*)AS MONEY)totalCount ,{paseIndex} paseIndex
FROM [SV_QueryPlatform].[dbo].[SYS_LOG] WHERE indexs ={indexs} {type}
SELECT *FROM [SV_QueryPlatform].[dbo].[SYS_LOG] WHERE indexs =5226 ORDER BY CreateDate DESC").ToList());
}
}
/// <summary>
/// 查询流水表
/// </summary>
public IEnumerable<dynamic> QueryFlowDatabase()
{
using (DbConnection connection = new SqlConnection(_configConnectionString))
{
CheckTimeout();
return connection.Query(@"SELECT * FROM[SV_QueryPlatform].[dbo].[FlowReservoirStatus]").ToList();
}
}
/// <summary>
/// 日志
/// </summary>
public void LOG(string LOG, string hos_code, int indexs, string? type, string? sql)
{
using (DbConnection connection = new SqlConnection(_configConnectionString))
{
sql = sql.Replace("'", "''");
connection.Execute($@"INSERT INTO[SV_QueryPlatform].[dbo].[SYS_LOG]([INDEXS] ,hos_code,[createDate] ,[LOG],type,[错误sql])
select'{indexs}','{hos_code}', getdate(),'{LOG} ','{type}','{sql}'");
}
}
/// <summary>
/// sql查询
/// </summary>
public string[] ShowSql(string TableName)
{
var sql = "";
using (DbConnection connection = new SqlConnection(_configConnectionString))
{
sql = $@" SELECT sql FROM [SV_QueryPlatform].[dbo].[Execute_SQL] WHERE type=1 AND TableName ='{TableName}' ";
string[] A = connection.Query<string>(sql).ToArray();
return A;
}
}
/// <summary>
/// 创建流水库
/// </summary>
public bool CreateAFlow_Library(string DatabaseName, int indexs)
{
//建立流水库脚本
using (DbConnection connection = new SqlConnection(_configConnectionString))
{
var sql = $@"CREATE DATABASE [DB_{DatabaseName}] CONTAINMENT = NONE ON PRIMARY ( NAME = N'DB_{DatabaseName}', FILENAME = N'e:\database\DB_{DatabaseName}.mdf' , SIZE = 1454080KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) LOG ON ( NAME = N'DB_{DatabaseName}_log', FILENAME = N'e:\database\DB_{DatabaseName}_log.ldf' , SIZE = 388544KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)ALTER DATABASE [DB_{DatabaseName}] SET COMPATIBILITY_LEVEL = 120
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
EXEC [DB_{DatabaseName}].[dbo].[sp_fulltext_database] @action = 'enable'
ALTER DATABASE [DB_{DatabaseName}] SET ANSI_NULL_DEFAULT OFF
ALTER DATABASE [DB_{DatabaseName}] SET ANSI_NULLS OFF
ALTER DATABASE [DB_{DatabaseName}] SET ANSI_PADDING OFF
ALTER DATABASE [DB_{DatabaseName}] SET ANSI_WARNINGS OFF
ALTER DATABASE [DB_{DatabaseName}] SET ARITHABORT OFF
ALTER DATABASE [DB_{DatabaseName}] SET AUTO_CLOSE OFF
ALTER DATABASE [DB_{DatabaseName}] SET AUTO_SHRINK OFF
ALTER DATABASE [DB_{DatabaseName}] SET AUTO_UPDATE_STATISTICS ON
ALTER DATABASE [DB_{DatabaseName}] SET CURSOR_CLOSE_ON_COMMIT OFF
ALTER DATABASE [DB_{DatabaseName}] SET CURSOR_DEFAULT GLOBAL
ALTER DATABASE [DB_{DatabaseName}] SET CONCAT_NULL_YIELDS_NULL OFF
ALTER DATABASE [DB_{DatabaseName}] SET NUMERIC_ROUNDABORT OFF
ALTER DATABASE [DB_{DatabaseName}] SET QUOTED_IDENTIFIER OFF
ALTER DATABASE [DB_{DatabaseName}] SET RECURSIVE_TRIGGERS OFF
ALTER DATABASE [DB_{DatabaseName}] SET DISABLE_BROKER
ALTER DATABASE [DB_{DatabaseName}] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
ALTER DATABASE [DB_{DatabaseName}] SET DATE_CORRELATION_OPTIMIZATION OFF
ALTER DATABASE [DB_{DatabaseName}] SET TRUSTWORTHY OFF
ALTER DATABASE [DB_{DatabaseName}] SET ALLOW_SNAPSHOT_ISOLATION OFF
ALTER DATABASE [DB_{DatabaseName}] SET PARAMETERIZATION SIMPLE
ALTER DATABASE [DB_{DatabaseName}] SET READ_COMMITTED_SNAPSHOT OFF
ALTER DATABASE [DB_{DatabaseName}] SET HONOR_BROKER_PRIORITY OFF
ALTER DATABASE [DB_{DatabaseName}] SET RECOVERY FULL
ALTER DATABASE [DB_{DatabaseName}] SET MULTI_USER
ALTER DATABASE [DB_{DatabaseName}] SET PAGE_VERIFY CHECKSUM
ALTER DATABASE [DB_{DatabaseName}] SET DB_CHAINING OFF
ALTER DATABASE [DB_{DatabaseName}] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
ALTER DATABASE [DB_{DatabaseName}] SET TARGET_RECOVERY_TIME = 0 SECONDS
ALTER DATABASE [DB_{DatabaseName}] SET DELAYED_DURABILITY = DISABLED
ALTER DATABASE [DB_{DatabaseName}] SET READ_WRITE ";
connection.Execute(sql);
if (connection.Query("select name from dbo.sysdatabases where name='DB_" + DatabaseName + "'").Count() > 0 ? true : false)
{
try
{
LOG($@"创建DB_{DatabaseName} 流水库成功!", "", indexs, "", "");
sql = $@" CREATE TABLE [DB_{DatabaseName}].[dbo].[ASSAY_REPORT](
[REPORT_ID] [bigint] IDENTITY(1,1) NOT NULL,
[REPORT_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[REPORT_TIME] [datetime] NULL,
[SPECIMEN_TYPE] [nvarchar](max) NULL,
[ASSAY_ITEM_CODE] [nvarchar](max) NULL,
[ASSAY_ITEM_NAME] [nvarchar](max) NULL,
[ITEM_ENAME] [nvarchar](max) NULL,
[UNIT] [nvarchar](max) NULL,
[RESULTS] [nvarchar](max) NULL,
[REFRANGE] [nvarchar](max) NULL,
[RESULTSTATUS] [nvarchar](max) NULL,
[REG_SOURCE] [int] NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
CONSTRAINT [PK_ASSAY_REPORT] PRIMARY KEY CLUSTERED
(
[REPORT_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[EXEC_REPORT](
[REPORT_ID] [bigint]IDENTITY(1,1) NOT NULL,
[REPORT_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[ORDER_ID] [bigint] NULL,
[ORDER_CODE] [nvarchar](max) NULL,
[PATIENT_MEDICALREC] [nvarchar](max) NULL,
[EXAMINE_NAME] [nvarchar](max) NULL,
[EXAMINE_SHOW] [nvarchar](max) NULL,
[EXAMINE_RESULT] [nvarchar](max) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[REPORT_TIME] [datetime] NULL,
[REG_SOURCE] [int] NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
CONSTRAINT [PK_EXEC_REPORT] PRIMARY KEY CLUSTERED
(
[REPORT_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[INPAT_DIAG](
[DIAG_ID] [bigint]IDENTITY(1,1) NOT NULL,
[DIAG_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[ICD] [nvarchar](max) NULL,
[DISEASE_NAME] [nvarchar](max) NULL,
[REMARKS] [nvarchar](max) NULL,
[TYPE] [nvarchar](max) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[DIAG_TIME] [datetime] NULL,
[CURE_STATUS] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
CONSTRAINT [PK_INPAT_DIAG] PRIMARY KEY CLUSTERED
(
[DIAG_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[INPAT_FEE](
[CHARGE_ID] [bigint] IDENTITY(1,1) NOT NULL,
[CHARGE_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[CATERY] [nvarchar](max) NULL,
[ITEM_TYPE] [nvarchar](max) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[ITEM_NAME] [nvarchar](max) NULL,
[UNITPRICE] [money] NULL,
[QUANTITY] [money] NULL,
[CATEGORY] [nvarchar](max) NULL,
[UNIT] [nvarchar](max) NULL,
[FEE] [money] NULL,
[CHARGE_TIME] [datetime] NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[DEPT_CODE] [nvarchar](max) NULL,
[DEPT_NAME] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[I_TYPE_NAME] [nvarchar](max) NULL,
[MEDIC_AREA] [nvarchar](max) NULL,
EXEC_DEPT_CODE NVARCHAR(max)null,
EXEC_DEPT_NAME NVARCHAR(max)null,
EXEC_EMP_CODE NVARCHAR(max)null,
EXEC_EMP_NAME varbinary(max) NULL
CONSTRAINT [PK_INPAT_FEE] PRIMARY KEY CLUSTERED
(
[CHARGE_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[INPAT_ORDER](
[ORDER_ID] [bigint] IDENTITY(1,1) NOT NULL,
[ORDER_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[MEDICAL_ORDER_TYPE] [nvarchar](max) NULL,
[ITEM_TYPE] [nvarchar](max) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[ITEM_NAME] [nvarchar](max) NULL,
[SKINTEST] [nvarchar](max) NULL,
[MEDI_SPEC] [nvarchar](max) NULL,
[EACH_DOSE] [nvarchar](max) NULL,
[MEDI_DOSE_UNIT] [nvarchar](max) NULL,
[MEDIC_USE_QUANTITY] [nvarchar](max) NULL,
[MEDI_USE_UNIT] [nvarchar](max) NULL,
[MEDIC_USE_PLAN] [nvarchar](max) NULL,
[MEDIC_USE_MODE] [nvarchar](max) NULL,
[MEDIC_QUANTITY] [nvarchar](max) NULL,
[UNITPRICE] [money] NULL,
[MEDICAL_ORDER_DAYS] [nvarchar](max) NULL,
[INTAKE_START_TIME] [datetime] NULL,
[INTAKE_END_TIME] [datetime] NULL,
[INTAKE_DATES] [int] NULL,
[REMARKS] [nvarchar](max) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[MEDIC_AREA] [nvarchar](max) NULL,
CONSTRAINT [PK_INPAT_ORDER] PRIMARY KEY CLUSTERED
(
[ORDER_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[INPAT_REG_INFO](
[REG_ID] [bigint] IDENTITY(1,1) NOT NULL,
[REG_CODE] [nvarchar](100) NULL,
[PERSON_ID] [bigint] NULL,
[PERSON_CODE] [nvarchar](100) NULL,
[IN_DEPT_CODE] [nvarchar](max) NULL,
[IN_DEPT_NAME] [nvarchar](max) NULL,
[WARD_NAME] [nvarchar](max) NULL,
[EMP_CODE_INCHARGE] [nvarchar](max) NULL,
[EMP_NAME_INCHARGE] [varbinary](max) NULL,
[EMP_CODE_RESIDENT] [nvarchar](max) NULL,
[EMP_NAME_RESIDENT] [varbinary](max) NULL,
[INHOS_TIME] [datetime] NULL,
[OUTHOS_TIME] [datetime] NULL,
[CARD_TYPE] [nvarchar](max) NULL,
[CARD_ID] [nvarchar](max) NULL,
[HEIGHT] [nvarchar](max) NULL,
[WEIGHT] [nvarchar](max) NULL,
[INHOS_STATUS] [nvarchar](max) NULL,
[OUTHOS_STATUS] [nvarchar](max) NULL,
[F_DIAG] [nvarchar](max) NULL,
[I_DEPT_NAME] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[I_CARD_TYPE] [nvarchar](max) NULL,
[WAISTLINE] [nvarchar](max) NULL,
[TOTAL_FEE] [money] NULL,
[PAY_FEE] [money] NULL,
OUT_DEPT_CODE NVARCHAR(max) null,
OUT_DEPT_NAME NVARCHAR(max)null,
SOURCE NVARCHAR(max)null
CONSTRAINT [PK_INPAT_REG_INFO] PRIMARY KEY CLUSTERED
(
[REG_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[OPS_INFO](
[OPS_ID] [bigint] IDENTITY(1,1) NOT NULL,
[OPS_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[ORDER_ID] [bigint] NULL,
[ORDER_CODE] [nvarchar](max) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[ITEM_NAME] [nvarchar](max) NULL,
[PODX] [nvarchar](max) NULL,
[RESULTS] [nvarchar](max) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[OPS_LEVEL] [nvarchar](max) NULL,
[WOUND_LEVEL] [nvarchar](max) NULL,
[START_TIME] [datetime] NULL,
[END_TIME] [datetime] NULL,
[F_HELPER] [varbinary](max) NULL,
[S_HELPER] [varbinary](max) NULL,
[F_ANAESTHESIA] [varbinary](max) NULL,
[S_ANAESTHESIA] [varbinary](max) NULL,
[DEPT_CODE] [nvarchar](max) NULL,
[DEPT_NAME] [nvarchar](max) NULL,
[CURE_STATUS] [nvarchar](max) NULL,
[ANESTHESIA_METHOD] [nvarchar](max) NULL,
[ELECTIVE_SURGERY] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[ICD_9_CM] [nvarchar](max) NULL,
[I_ITEM_NAME] [nvarchar](max) NULL,
[I_ICD_9_CM] [nvarchar](max) NULL,
CONSTRAINT [PK_OPS_INFO] PRIMARY KEY CLUSTERED
(
[OPS_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[OUT_DIAG](
[DIAG_ID] [bigint] IDENTITY(1,1) NOT NULL,
[DIAG_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[ICD] [nvarchar](max) NULL,
[DISEASE_NAME] [nvarchar](max) NULL,
[DIAG_TIME] [datetime] NULL,
[REMARKS] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
CONSTRAINT [PK_OUT_DIAG] PRIMARY KEY CLUSTERED
(
[DIAG_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[OUT_FEE](
[CHARGE_ID] [bigint]IDENTITY(1,1) NOT NULL,
[CHARGE_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[CATERY] [nvarchar](max) NULL,
[ITEM_TYPE] [nvarchar](max) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[ITEM_NAME] [nvarchar](max) NULL,
[UNITPRICE] [money] NULL,
[CATEGORY] [nvarchar](max) NULL,
[QUANTITY] [money] NULL,
[UNIT] [nvarchar](max) NULL,
[FEE] [money] NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[DEPT_CODE] [nvarchar](max) NULL,
[DEPT_NAME] [nvarchar](max) NULL,
[CHARGE_TIME] [datetime] NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[I_TYPE_NAME] [nvarchar](max) NULL,
[MEDIC_AREA] [nvarchar](max) NULL,
EXEC_DEPT_CODE NVARCHAR(max)null,
EXEC_DEPT_NAME NVARCHAR(max)null,
EXEC_EMP_CODE NVARCHAR(max)null,
EXEC_EMP_NAME varbinary(max) NULL
CONSTRAINT [PK_OUT_FEE] PRIMARY KEY CLUSTERED
(
[CHARGE_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[OUT_PRES](
[PRES_ID] [bigint] IDENTITY(1,1) NOT NULL,
[PRES_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[GROUPNO] [nvarchar](max) NULL,
[NO] [nvarchar](max) NULL,
[PRES_TIME] [datetime] NULL,
[PRES_TYPE] [nvarchar](max) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[MEDIC_CLASS] [nvarchar](max) NULL,
[MEDIC_GENERAL_NAME] [nvarchar](max) NULL,
[MEDIC_NAME] [nvarchar](max) NULL,
[MEDIC_TYPE] [nvarchar](max) NULL,
[MEDIC_SPEC] [nvarchar](max) NULL,
[MEDIC_AREA] [nvarchar](max) NULL,
[MEDIC_USE_QUANTITY] [nvarchar](max) NULL,
[MEDIC_USE_UNIT] [nvarchar](max) NULL,
[MEDIC_USE_CODE] [nvarchar](max) NULL,
[MEDIC_USE_MODE] [nvarchar](max) NULL,
[MEDIC_DAYS] [nvarchar](max) NULL,
[MEDIC_QUANTITY] [nvarchar](max) NULL,
[MEDIC_UNIT] [nvarchar](max) NULL,
[SKINTEST] [nvarchar](max) NULL,
[MEDIC_REMARK] [nvarchar](max) NULL,
[MEDIC_INSUREANCE_TYPE] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
CONSTRAINT [PK_OUT_PRES] PRIMARY KEY CLUSTERED
(
[PRES_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[OUT_REG_INFO](
[REG_ID] [bigint] IDENTITY(1,1) NOT NULL,
[REG_CODE] [nvarchar](100) NULL,
[PERSON_ID] [bigint] NULL,
[PERSON_CODE] [nvarchar](100) NULL,
[REG_TIME] [datetime] NULL,
[REG_EMP_CODE] [nvarchar](max) NULL,
[REG_EMP_NAME] [varbinary](max) NULL,
[DEPT_CODE] [nvarchar](max) NULL,
[DEPT_NAME] [nvarchar](max) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[CARD_TYPE] [nvarchar](max) NULL,
[CARD_ID] [nvarchar](max) NULL,
[REG_TYPE] [nvarchar](max) NULL,
[F_DIAG] [nvarchar](max) NULL,
[I_DEPT_NAME] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[I_CARD_TYPE] [nvarchar](max) NULL,
[TOTAL_FEE] [money] NULL,
[PAY_FEE] [money] NULL,
CONSTRAINT [PK_OUT_REG_INFO] PRIMARY KEY CLUSTERED
(
[REG_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[PUB_PATIENT](
[PERSON_ID] [bigint]IDENTITY(1,1) NOT NULL,
[PERSON_CODE] [nvarchar](100) NULL,
[SEX] [nvarchar](max) NULL,
[BIRTHDAY] [datetime] NULL,
[MARRIED] [nvarchar](max) NULL,
[PROVINCE] [nvarchar](max) NULL,
[CITY] [nvarchar](max) NULL,
[COUNTY] [nvarchar](max) NULL,
[OCCUPATION] [nvarchar](max) NULL,
[BLOOD] [nvarchar](max) NULL,
[ID_CARD] [varbinary](max) NULL,
[NATION] [nvarchar](max) NULL,
[NATIONALITY] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[EDUCATIONAL_LEVEL] [nvarchar](max) NULL,
[MASTER_INDEX] nvarchar(MAX)NULL,
CONSTRAINT [PK_PUB_PATIENT] PRIMARY KEY CLUSTERED
(
[PERSON_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING ON ";
connection.Execute(sql);
LOG($@"创建DB_{DatabaseName} 流水库表结构成功!", "", indexs, "", "");
sql = $@" CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[ASSAY_REPORT]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[ASSAY_REPORT]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[EXEC_REPORT]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[EXEC_REPORT]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[INPAT_FEE]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[INPAT_FEE]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[INPAT_ORDER]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[INPAT_ORDER]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[INPAT_REG_INFO]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_PERSON_ID] ON[DB_{DatabaseName}].[dbo].[INPAT_REG_INFO]
(
[PERSON_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_PERSON_CODE] ON[DB_{DatabaseName}].[dbo].[INPAT_REG_INFO]
(
[PERSON_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[OPS_INFO]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[OPS_INFO]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[OUT_DIAG]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[OUT_DIAG]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[INPAT_DIAG]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[INPAT_DIAG]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[OUT_FEE]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[OUT_FEE]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[OUT_PRES]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[OUT_PRES]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_PERSON_ID] ON[DB_{DatabaseName}].[dbo].[OUT_REG_INFO]
(
[PERSON_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[OUT_REG_INFO]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_PERSON_CODE] ON[DB_{DatabaseName}].[dbo].[OUT_REG_INFO]
(
[PERSON_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_PERSON_CODE] ON[DB_{DatabaseName}].[dbo].[PUB_PATIENT]
(
[PERSON_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
ALTER DATABASE[DB_{DatabaseName}] SET READ_WRITE";
connection.Execute(sql);
LOG($@"创建DB_{DatabaseName} 流水库索引成功!", "", indexs, "", "");
return connection.Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =1 ,DatabaseName='DB_{DatabaseName}' WHERE indexs={indexs}") > 0 ? true : false;
}
catch (Exception e)
{
LOG($@"创建DB_{DatabaseName} 流水库操作时出错!", "", indexs, "", "");
throw new DomainException($@"创建DB_{DatabaseName} 流水库操作时出错!");
}
}
return false;
}
}
public void CheckTimeout()
{
using (DbConnection connection = new SqlConnection(_configConnectionString)) // DefaultConnection
{
string[] id = connection.Query<string>("select ID from [SV_QueryPlatform].[dbo].[FlowReservoirStatus] where[state] = 2 and DATEDIFF(HOUR, DataPullTime, getdate()) >3").ToArray();
foreach (var item in id)
{
connection.Execute($@" update [dbo].[FlowReservoirStatus] set state= 4 where id={item}");
}
}
}
/// <summary>
/// 拉取病人表
/// </summary>
public void PullData(int indexs, string DatabaseName, string tableName, string biao)
{
var sql = "";
//建立流水库脚本
// DefaultConnection
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))
{
// sys_hospital156找医院
sql = @$"
SELECT DISTINCT
ExecOpenLink ,
ExecDatabase
FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A
JOIN [192.168.18.181].[SV_QueryPlatform].[dbo].[{tableName}] B ON A.ID = B.HOS_ID
LEFT JOIN ( SELECT *
FROM [192.168.18.181].[SV_QueryPlatform].[dbo].[SYS_LOG]
WHERE INDEXS = {indexs}
AND LOG = '{biao}'
) C ON A.ID = CAST(LEFT(RIGHT(C.hos_code, 4),3) AS INT)
WHERE hos_code IS NULL;
";
List<SYS_Hospital> hospitals = connection156.Query<SYS_Hospital>(sql).ToList();
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);
pairs.TryAdd($"@{nameof(DatabaseName)}", DatabaseName);
pairs.TryAdd($"@{nameof(tableName)}", tableName);
pairs.TryAdd($"@{nameof(biao)}", biao);
var ITEM = "[@ExecOpenLink].[@ExecDatabase]";
//拉取病人表
configConnection.Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =2 ,DataPullTime=getdate() WHERE indexs={indexs}");
try
{
sql = ShowSql($"{biao}")[0];
foreach (var item1 in pairs)
{
ITEM = ITEM.Replace(item1.Key, item1.Value.ToString());
sql = sql.Replace(item1.Key, item1.Value.ToString());
}
int num = 0;
if (hos.ExecOpenLink == "192.168.18.151")
num = connection151.Execute(sql, commandTimeout: 60 * 60 * 5);
else if (hos.ExecOpenLink == "192.168.18.152")
num = connection152.Execute(sql, commandTimeout: 60 * 60 * 5);
else if (hos.ExecOpenLink == "192.168.18.153")
num = connection153.Execute(sql, commandTimeout: 60 * 60 * 5);
else if (hos.ExecOpenLink == "192.168.18.154")
num = connection154.Execute(sql, commandTimeout: 60 * 60 * 5);
else if (hos.ExecOpenLink == "192.168.18.155")
num = connection155.Execute(sql, commandTimeout: 60 * 60 * 5);
else if (hos.ExecOpenLink != "192.168.18.156")
num = connection156.Execute(sql, commandTimeout: 60 * 60 * 5);
else if (hos.ExecOpenLink == "192.168.18.158")
num = connection158.Execute(sql, commandTimeout: 60 * 60 * 5);
configConnection.Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET DataPullTime=getdate() WHERE indexs={indexs}");
if (num >= 0) { LOG($"{biao}", ITEM, indexs, "成功,返回行数:" + num, sql); }
}
catch (Exception e)
{
LOG($"{biao}", ITEM, indexs, "错误", sql);
state = false;
PullData(indexs, DatabaseName, tableName, biao);//跳过错误执行未执行的医院
}
}
}
using (DbConnection configConnection = new SqlConnection(_configConnectionString))
{
if (state == false)
configConnection.Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =3 WHERE indexs={indexs}");
else
configConnection.Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =5 WHERE indexs={indexs}");//拉取完成
}
}
public void PullData1(int indexs, string DatabaseName, string tableName, string biao)
{
var sql = "";
var sql_count = "";
int count = 0;
//建立流水库脚本
// DefaultConnection
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))
{
// sys_hospital156找医院
sql = @$"
SELECT DISTINCT
ExecOpenLink ,
ExecDatabase
FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A
JOIN [192.168.18.181].[SV_QueryPlatform].[dbo].[{tableName}] B ON A.ID = B.HOS_ID
LEFT JOIN ( SELECT *
FROM [192.168.18.181].[SV_QueryPlatform].[dbo].[SYS_LOG]
WHERE INDEXS = {indexs}
AND LOG = '{biao}'
) C ON A.ID = CAST(LEFT(RIGHT(C.hos_code, 4),3) AS INT)
WHERE hos_code IS NULL;";
List<SYS_Hospital> hospitals = connection156.Query<SYS_Hospital>(sql).ToList();
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);
pairs.TryAdd($"@{nameof(DatabaseName)}", DatabaseName);
pairs.TryAdd($"@{nameof(tableName)}", tableName);
pairs.TryAdd($"@{nameof(biao)}", biao);
// sql 数据源导出csv 导入csv 到connection
var ITEM = "[@ExecOpenLink].[@ExecDatabase]";
//拉取病人表
configConnection.Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =2 ,DataPullTime=getdate() WHERE indexs={indexs}");
try
{
sql = ShowSql($"{biao}")[0];
if (biao == "INPAT_ORDER" || biao == "INPAT_FEE")
{
sql_count = ShowSql("INPAT_REG_INFO_COUNT")[0];
}
else if (biao == "OUT_PRES" || biao == "OUT_FEE")
{
sql_count = ShowSql("OUT_REG_INFO_COUNT")[0];
}
foreach (var item1 in pairs)
{
sql_count = sql_count.Replace(item1.Key, item1.Value.ToString());
ITEM = ITEM.Replace(item1.Key, item1.Value.ToString());
sql = sql.Replace(item1.Key, item1.Value.ToString());
}
count = configConnection.Query(sql_count, commandTimeout: 60 * 60 * 5).Count();
int num = 0;
int paseIndex = 1;
for (int i = count % 2000 > 0 ? (count / 2000) + 1 : count / 2000; i > 0; i--)
{
sql = ShowSql($"{biao}")[0];
foreach (var item1 in pairs)
{
sql = sql.Replace(item1.Key, item1.Value.ToString());
}
sql = sql.Replace("@paseIndex", paseIndex.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);
configConnection.Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET DataPullTime=getdate() WHERE indexs={indexs}");
// if (num >= 0 && i>1) { LOG($"{biao}" + paseIndex.ToString() + "/" + (count % 2000 > 0 ? (count / 2000) + 1 : count / 2000).ToString(), ITEM, indexs, "成功,返回行数:" + num, sql); }
paseIndex = paseIndex + 1;
}
LOG($"{biao}", ITEM, indexs, "成功,返回行数:" + num, sql);
}
catch (Exception e)
{
LOG($"{biao}", ITEM, indexs, "失败", sql);
state = false;
PullData1(indexs, DatabaseName, tableName, biao);//跳过错误执行未执行的医院
}
}
}
using (DbConnection configConnection = new SqlConnection(_configConnectionString))
{
if (state == false)
configConnection.Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =3 WHERE indexs={indexs}");
else
configConnection.Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =5 WHERE indexs={indexs}");//拉取完成
}
}
}
}
<?xml version="1.0"?>
<doc>
<assembly>
<name>QueryPlatform.Api</name>
</assembly>
<members>
<member name="M:Health.Api.Controllers.AccountController.Login(Health.Api.Infrastructure.Request.LoginRequest)">
<summary>
登录授权
</summary>
<remarks>
Sample request:
POST /Todo
{
"Account": "admin",
"Password": "1111"
}
</remarks>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.AccountController.Refresh">
<summary>
刷新登录JWT TOKEN
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.AnalysisController.HosListInquire(System.Int32,System.String,System.Int32)">
<summary>
医院展示
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.AnalysisController.ParseInquire(System.String,System.Int32)">
<summary>
数据解析
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.DrugqueryController.Drugquery(Health.Api.Infrastructure.Modules.SYS_Drugquery)">
<summary>
查询病人疾病信息和药品信息//type1=疾病//type2药品
</summary>
<param name="sYS_Drugquery"></param>
</member>
<member name="M:Health.Api.Controllers.ResourceController.ItemQuery">
<summary>
查询当月项目
</summary>
<param name="source"> </param>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.ResourceController.CancelProject(System.Int32)">
<summary>
取消正在查询项目
</summary>
<param name="id">id </param>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.ResourceController.ProjectReport(Health.Api.Infrastructure.Modules.SYS_Cs)">
<summary>
查询项目报告
</summary>
<param name="source">药品 疾病 同查 全部 </param>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.ResourceController.QueryFlowDatabase">
<summary>
查询流水库表
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.ResourceController.ShowMEDIC_AREA(System.Int32,System.Int32)">
<summary>
查询药品产地
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.ResourceController.ShowITEM_NAME(System.Int32,System.Int32)">
<summary>
查询名称产地
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.ResourceController.EstablishFlowDatabaseTable(Health.Api.Infrastructure.Modules.SYS_EstablishFlowDatabaseTable)">
<summary>
建立流水库表
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.ResourceController.CreateAFlow_Library(System.String,System.Int32)">
<summary>
建立流水库
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.ResourceController.ShowLog(System.Int32,System.Int32,System.String)">
<summary>
查询日志
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.ResourceController.PullData(System.Int32,System.String,System.String)">
<summary>
拉取流水库数据
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.UserController.Info">
<summary>
用户信息
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.UserController.Update(Health.Api.Infrastructure.Request.UserRequest)">
<summary>
用户修改
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.UserController.Get(System.String)">
<summary>
查询用户列表
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.UserController.Post(Health.Api.Infrastructure.Request.UserRequest)">
<summary>
新增用户
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.UserController.Delete(System.Int32)">
<summary>
删除
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.UserController.Disable(System.Int32,System.Boolean)">
<summary>
禁用
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="M:Health.Api.Controllers.UserController.Reset(System.Int32)">
<summary>
重置密码
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="P:Health.Api.ApiResponse`1.Message">
<summary>
消息内容。
</summary>
</member>
<member name="P:Health.Api.ApiResponse`1.Data">
<summary>
返回数据。
</summary>
</member>
<member name="F:Health.Api.ResponseType.OK">
<summary>
执行成功
</summary>
</member>
<member name="F:Health.Api.ResponseType.BadRequest">
<summary>
参数错误
</summary>
</member>
<member name="F:Health.Api.ResponseType.Unauthorized">
<summary>
身份认证未授权
</summary>
</member>
<member name="F:Health.Api.ResponseType.NotFound">
<summary>
资源无效
</summary>
</member>
<member name="F:Health.Api.ResponseType.InternalServerError">
<summary>
内部错误
</summary>
</member>
<member name="F:Health.Api.ResponseType.NotImplemented">
<summary>
不支持请求
</summary>
</member>
<member name="P:Health.Api.Infrastructure.Domain.SearchPathInfo.TempPath">
<summary>
临时文件目录
</summary>
</member>
<member name="P:Health.Api.Infrastructure.Domain.SearchPathInfo.NetworkPath">
<summary>
网络路径
</summary>
</member>
<member name="F:Health.Api.Infrastructure.Enums.DiseaseType.g1">
<summary>
高血压
</summary>
</member>
<member name="F:Health.Api.Infrastructure.Enums.DiseaseType.g2">
<summary>
糖尿病
</summary>
</member>
<member name="F:Health.Api.Infrastructure.Enums.DiseaseType.g3">
<summary>
高血脂
</summary>
</member>
<member name="T:Health.Api.Infrastructure.Middlewares.DecodeResponseMiddleware">
<summary>
解码中间件
</summary>
</member>
<member name="T:Health.Api.Infrastructure.Middlewares.DoubleRequestMiddleware">
<summary>
解码中间件
</summary>
</member>
<member name="P:Health.Api.Infrastructure.Modules.SYS_Drugquery.type1_2">
<summary>
1 命中查询 2其他查询
</summary>
</member>
<member name="P:Health.Api.Infrastructure.Modules.SYS_Drugquery.icd">
<summary>
ICD编码
</summary>
</member>
<member name="P:Health.Api.Infrastructure.Modules.SYS_Drugquery.diseaseName">
<summary>
疾病名称
</summary>
</member>
<member name="P:Health.Api.Infrastructure.Modules.SYS_Drugquery.drugName">
<summary>
药品
</summary>
</member>
<member name="P:Health.Api.Infrastructure.Modules.SYS_Drugquery.materialName">
<summary>
材料费
</summary>
</member>
<member name="P:Health.Api.Infrastructure.Modules.SYS_Drugquery.peojectName">
<summary>
项目,名称
</summary>
</member>
<member name="P:Health.Api.Infrastructure.Modules.SYS_USER.IsDelete">
<summary>
true 删除 false 正常
</summary>
</member>
<member name="P:Health.Api.Infrastructure.Page.Index">
<summary>
页码
</summary>
</member>
<member name="P:Health.Api.Infrastructure.Page.Size">
<summary>
页行数 默认30
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.AnalysisQueries.HosListInquire(System.String,System.Int32)">
<summary>
医院展示
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.DrugqueryQueries.DrugqueryIndexs">
<summary>
获取到最大的那条记录id
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Infrastructure.Queries.DrugqueryQueries.Complete_MarkId(System.Int32)">
<summary>
获取到最大的那条记录Complete_MarkId
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Infrastructure.Queries.DrugqueryQueries.Countnum(System.String,System.Data.Common.DbConnection)">
<summary>
传入sql 连接 返回int
</summary>
<returns></returns>
</member>
<member name="M:Health.Api.Infrastructure.Queries.DrugqueryQueries.SqlAdd(Health.Api.Infrastructure.Modules.SYS_Drugquery,System.Int32)">
<summary>
插入查询记录表
</summary>
<param name="sYS_Drugquery"></param>
</member>
<member name="M:Health.Api.Infrastructure.Queries.DrugqueryQueries.Diseasequery(System.Int32,System.Int32,System.String[],System.String[],System.Int32)">
<summary>
查询疾病对应的病人信息
</summary>
<param name="type">类型1</param>
<param name="icd">ICD编码</param>
<param name="diseaseName">疾病名称</param>
<param name="type1_2">类型</param>
</member>
<member name="M:Health.Api.Infrastructure.Queries.DrugqueryQueries.Drugquery(System.Int32,System.Int32,System.String[],System.Int32)">
<summary>
查询药品信息
</summary>
<param name="type">类型2</param>
<param name="type1_2">他因</param>
<param name="drugName">药品名称</param>
</member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.ItemQuery">
<summary>
查询所有项目
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.CancelProject(System.Int32)">
<summary>
停止正在查询项目
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.deleteShow">
<summary>
删除MEDIC_PERSON_INFORMATION_存储过程表的记录
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.addShow(System.Int32,System.String,System.String)">
<summary>
添加本次查询的记录到 MEDIC_PERSON_INFORMATION_存储过程表
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.ProjectReport(System.Int32,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary>
报告展示(疾病展示所有,药品可以填写)
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.Show(System.Int32,System.String,System.String,System.String,System.String,System.String)">
<summary>
展示结果
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.EstablishFlowDatabaseTable(System.String,System.String,System.Int32,System.String)">
<summary>
创建流水表
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.ShowLog(System.Int32,System.Int32,System.String)">
<summary>
查询日志
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.QueryFlowDatabase">
<summary>
查询流水表
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.LOG(System.String,System.String,System.Int32,System.String,System.String)">
<summary>
日志
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.ShowSql(System.String)">
<summary>
sql查询
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.CreateAFlow_Library(System.String,System.Int32)">
<summary>
创建流水库
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.PullData(System.Int32,System.String,System.String,System.String)">
<summary>
拉取病人表
</summary>
</member>
<member name="M:Health.Api.Infrastructure.Queries.UserStorage.Update(Health.Api.Infrastructure.Request.UserRequest)">
<summary>
修改密码
</summary>
<param name="userId"></param>
<param name="oldPassword"></param>
<param name="newPassword"></param>
<returns></returns>
</member>
<member name="M:Health.Api.Infrastructure.Queries.UserStorage.Update(System.Int32,System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
<summary>
修改用户信息
</summary>
<param name="userId"></param>
<param name="delete"></param>
<param name="reset"></param>
<returns></returns>
</member>
<member name="P:Health.Api.Infrastructure.Request.LoginRequest.Account">
<summary>
账号
</summary>
</member>
<member name="P:Health.Api.Infrastructure.Request.LoginRequest.Password">
<summary>
密码
</summary>
</member>
<member name="P:Health.Api.Infrastructure.JwtResult.AccessToken">
<summary>
Access Token
</summary>
</member>
<member name="P:Health.Api.Infrastructure.JwtResult.TokenType">
<summary>
token 类型
</summary>
</member>
<member name="P:Health.Api.Infrastructure.JwtResult.AuthTime">
<summary>
授权时间
</summary>
</member>
<member name="P:Health.Api.Infrastructure.JwtResult.ExpiresAt">
<summary>
过期时间
</summary>
</member>
</members>
</doc>
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using Health.Api.Infrastructure;
//using Health.Api.Infrastructure.Models;
using Health.Api.Infrastructure.Modules;
using Health.Api.Infrastructure.Queries;
using Health.Api.Infrastructure.Request;
using Health.Infra;
namespace Health.Api.Controllers
{
[Authorize]
[Route("api/resource")]
[ApiController]
public class AnalysisController : Controller
{
private readonly AnalysisQueries _aQueries;
private readonly IMemoryCache _cache;
public AnalysisController(IMemoryCache cache,AnalysisQueries aQueries)
{
this._cache = cache;
this._aQueries = aQueries;
}
/// <summary>
/// 医院展示
/// </summary>
/// <returns></returns>
[HttpPost("HosListInquire")]
[AllowAnonymous]
public (IEnumerable<dynamic>, IEnumerable<dynamic>) HosListInquire(int paseIndex, string hos_name, int hos_id)
{
return _aQueries.HosListInquire(paseIndex, hos_name, hos_id);
}
/// <summary>
/// 数据解析
/// </summary>
/// <returns></returns>
[HttpPost("ParseInquire")]
[AllowAnonymous]
public void ParseInquire(string zxr, int hosid)
{
int id = _aQueries.JX_SCJXJL(hosid, zxr);//1.生成解析记录
_aQueries.JX_GXID(id, hosid);//更新reg_id,master_index
_aQueries.JX_DIC_DIAG(id, hosid);//更新标准库里DIC_DIAG_SUMMARY里的标准字段
_aQueries.JX_DIC_FEE(id, hosid);//新建费用查询字典表
_aQueries.JX_ADD_DA_Disease(id, hosid);//未匹配上的诊断导入到DA_Disease表中
_aQueries.JX_DIC_DRUG_ATC(id, hosid);//匹配更新标准库 DIC_DRUG_ATC的标准字段
_aQueries.JX_ADD_DA_Drug(id, hosid);//未匹配上的导入 [dbo].[DA_Drug] 做处理
//对导入的药品跑权重
_aQueries.JX_DRUG_DATA_QZ(id, hosid);
//对导入的诊断做处理,剔除无效字符
_aQueries.JX_DA_DIAGNOSIS_DATA(id, hosid);
//新导入的诊断跑权重,生成标准科室,标准一级诊断,标准二级诊断
_aQueries.JX_DIAGNOSIS_DATA_QZ(id, hosid);
}
}
}
using Health.Api.Infrastructure.Modules;
using Health.Api.Infrastructure.Queries;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Caching.Memory;
using System.Data.Common;
namespace Health.Api.Controllers
{
public class DrugqueryController : Controller
{
private readonly IMemoryCache _cache;
private readonly ResourceQueries resourceQueries;
private readonly DrugqueryQueries drugqueryQueries;
public DrugqueryController(
IMemoryCache cache,
ResourceQueries resourceQueries,
DrugqueryQueries drugqueryQueries)
{
this._cache = cache;
this.resourceQueries = resourceQueries;
this.drugqueryQueries = drugqueryQueries;
}
/// <summary>
/// 查询病人疾病信息和药品信息//type1=疾病//type2药品
/// </summary>
/// <param name="sYS_Drugquery"></param>
[HttpPost("Drugquery")]
[AllowAnonymous]
public void Drugquery(SYS_Drugquery sYS_Drugquery)
{
int type = 0;
if ((sYS_Drugquery.icd!=null || sYS_Drugquery.diseaseName!=null) && sYS_Drugquery.drugName==null && sYS_Drugquery.materialName==null)
{
type = 1;//1疾病
int num =drugqueryQueries.SqlAdd(sYS_Drugquery, type);
drugqueryQueries.Diseasequery(type, sYS_Drugquery.type1_2, sYS_Drugquery.icd,sYS_Drugquery.diseaseName,num);
}
else if (sYS_Drugquery.drugName!=null && sYS_Drugquery.diseaseName == null && sYS_Drugquery.icd == null && sYS_Drugquery.materialName == null)
{
type = 2;//2药品
int num = drugqueryQueries.SqlAdd(sYS_Drugquery, type);
drugqueryQueries.Drugquery(type, sYS_Drugquery.type1_2, sYS_Drugquery.drugName,num);
}
else if(sYS_Drugquery.materialName!=null && sYS_Drugquery.diseaseName==null && sYS_Drugquery.icd == null && sYS_Drugquery.drugName == null)
{
type = 3;//3材料
int num = drugqueryQueries.SqlAdd(sYS_Drugquery, type);
drugqueryQueries.Drugquery(type, sYS_Drugquery.type1_2, sYS_Drugquery.materialName,num);
}
else
{
throw new DomainException("只能单类型查询!!");
}
}
}
}
using Microsoft.AspNetCore.Mvc;
namespace Health.Api.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
}
}
using Dapper;
using Health.Api.Infrastructure.Modules;
using Microsoft.Data.SqlClient;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
namespace Health.Api.Infrastructure.Queries
{
public class DrugqueryQueries
{
private readonly string _Connection156;
private readonly string _configConnectionString;
//private List<Common> a;
bool state = true;
public DrugqueryQueries(string Connection156, string configConnectionString)
{
_Connection156 = Connection156;
_configConnectionString = configConnectionString;
}
//查询所有医院
public List<SYS_Hospital> showHospitals()
{
DbConnection connection156 = new SqlConnection(_Connection156);
// sys_hospital156找医院
var sql = @$"SELECT
ExecOpenLink ,
ExecDatabase
FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital]
WHERE ExecOpenLink <>'' AND ExecOpenLink IS NOT NULL
AND ExecDatabase <>'' AND ExecDatabase IS NOT NULL
";
return connection156.Query<SYS_Hospital>(sql).ToList();
}
/// <summary>
/// 获取到最大的那条记录id
/// </summary>
/// <returns></returns>
public int DrugqueryIndexs()
{
var indexs = "";
using (DbConnection configConnection = new SqlConnection(_configConnectionString))
{
indexs = @$"SELECT max(id) id FROM [SV_QueryPlatform].[dbo].[MEDIC_SEARCH_RECORD]";
int a = configConnection.Query<int>(indexs).FirstOrDefault();
return a;
}
return 0;
}
/// <summary>
/// 获取到最大的那条记录Complete_MarkId
/// </summary>
/// <returns></returns>
public int Complete_MarkId(int Indexs)
{
DbConnection configConnection = new SqlConnection(_configConnectionString);
return configConnection.Query<int>(@$"select COMPLETE_MARK from [SV_QueryPlatform].[dbo].[MEDIC_SEARCH_RECORD] where id={Indexs} ").FirstOrDefault();
}
/// <summary>
///传入sql 连接 返回int
/// </summary>
/// <returns></returns>
public int Countnum(string sql, DbConnection configConnection)
{
int c = configConnection.Query<int>(sql).FirstOrDefault();
return c;
}
/// <summary>
/// 插入查询记录表
/// </summary>
/// <param name="sYS_Drugquery"></param>
public int SqlAdd(SYS_Drugquery sYS_Drugquery, int type)
{
string peojectName = sYS_Drugquery.peojectName;
string drugName = "";
string diseaseName = "";
string icd = "";
string lx = "";
if (type == 1)
{
lx = "疾病"; if (sYS_Drugquery.diseaseName != null) foreach (var item in sYS_Drugquery.diseaseName) { diseaseName = string.Join(",", sYS_Drugquery.diseaseName); }
if (sYS_Drugquery.icd != null) foreach (var item in sYS_Drugquery.icd) { icd = string.Join(",", sYS_Drugquery.icd); }
}
else if (type == 2) { lx = "药品"; foreach (var item in sYS_Drugquery.drugName) { drugName = string.Join(",", sYS_Drugquery.drugName); } }
else if (type == 3) { lx = "材料"; foreach (var item in sYS_Drugquery.materialName) { drugName = string.Join(",", sYS_Drugquery.materialName); } }
DbConnection connection = new SqlConnection(_configConnectionString);
var sql = @$"INSERT INTO [SV_QueryPlatform].[dbo].[MEDIC_SEARCH_RECORD]([HOS_TYPE],[PROJECT_NAME],[GENERIC_NAME],[COMMODITY_NAME],[DISEASE_NAME],[ICD],
[COMPLETE_MARK],[search_time],type ,[TYPE1_2] )
VALUES(0,'{peojectName}','{ drugName}',null,'{diseaseName}',
'{icd}',21,getdate(),'{lx}','{sYS_Drugquery.type1_2}')";
connection.Execute(sql, commandTimeout: 60 * 60 * 5);
sql = @$"select max(id) from [SV_QueryPlatform].[dbo].[MEDIC_SEARCH_RECORD]
where PROJECT_NAME='{peojectName}' and GENERIC_NAME='{drugName}' and DISEASE_NAME='{diseaseName}'
and icd='{icd}' and type='{lx}' and [TYPE1_2]='{sYS_Drugquery.type1_2}'";
int num = connection.Query<int>(sql).FirstOrDefault();
//添加一条查询记录
sql = $@"CREATE TABLE [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{num}](
[ID] [int] IDENTITY(1,1) NOT NULL,
[HOS_ID] [int] NULL,
[MASTER_INDEX] [int] NULL,
[BIRTHDAY] [datetime2](7) NULL,
[SEX] [nvarchar](50) NULL,
[PERSON_CODE] [nvarchar](50) NULL,
[PERSON_ID] [int] NULL,
[REG_CODE] [nvarchar](50) NULL,
[REG_ID] [int] NULL,
[REG_SOURCE] [nvarchar](50) NULL,
[REG_TIME] [datetime2](7) NULL,
[AREA_ID] [int] NULL,
[INDEXS] [int] NULL,
[TYPE] [int] NULL,
[DEPT_NAME] [nvarchar](50) NULL,
[MEDIC_AREA] [nvarchar](max) NULL,
CONSTRAINT [PK_MEDIC_PERSON_INFORMATIONaa_{num}] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] ";
connection.Execute(sql, commandTimeout: 60 * 60 * 5);
sql = $@"CREATE TABLE [SV_QueryPlatform_].[dbo].[MEDIC_AREA_{num}](
[ID] [int] IDENTITY(1,1) NOT NULL,
[HOS_ID] [int] NULL,
[ITEM_NAME] [nvarchar](500) NULL,
[MEDIC_AREA] [nvarchar](50) NULL,
[TYPE] [int] NULL,
[INDEXS] [nvarchar](50) NULL,
[MEDIC_NAME] [nvarchar](50) NULL
) ON [PRIMARY]";
connection.Execute(sql, commandTimeout: 60 * 60 * 5);
return num;
}
/// <summary>
/// 查询疾病对应的病人信息
/// </summary>
/// <param name="type">类型1</param>
/// <param name="icd">ICD编码</param>
/// <param name="diseaseName">疾病名称</param>
/// <param name="type1_2">类型</param>
public void Diseasequery(int type, int type1_2, string[] icd, string[] diseaseName, int Indexs)
{
var sql = "";
int num = 0;
int CompleteMar = 0;
var icd_or_diseaseCondition = "";
if (icd != null)
{
foreach (var icdname in icd)
{
if (!string.IsNullOrEmpty(icdname))
icd_or_diseaseCondition = icd_or_diseaseCondition + $"or icd like '%{icdname}%'";
}
}
if (diseaseName != null)
{
foreach (var disease in diseaseName)
{
if (!string.IsNullOrEmpty(disease))
icd_or_diseaseCondition = icd_or_diseaseCondition + $"or DISEASE_NAME like '%{disease}%'";
}
}
icd_or_diseaseCondition = icd_or_diseaseCondition.Substring(2, icd_or_diseaseCondition.Length - 2);
DbConnection configConnection = new SqlConnection(_configConnectionString);
List<SYS_Hospital> hos = configConnection.Query<SYS_Hospital>(@$"SELECT ExecOpenLink ,ExecDatabase FROM [192.168.18.156].[DB_SV_Data_Config].[dbo].[SYS_Hospital] WHERE ExecOpenLink <>'' AND ExecOpenLink IS NOT NULL AND ExecDatabase <>'' AND ExecDatabase IS NOT NULL ").ToList();
服务器 fwq = new 服务器();
var msConnectionString = "";
var countsql = 0;
foreach (var item in hos)
{
//统计执行的多少家医院
countsql++;
var fwqsql = $"SELECT [服务器ip],[数据库账号],[数据库密码] FROM [SV_QueryPlatform].[dbo].[服务器] where [服务器ip] ='{item.ExecOpenLink}'";
fwq = configConnection.Query<服务器>(fwqsql).FirstOrDefault();
msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", item.ExecOpenLink, item.ExecDatabase, fwq.数据库账号, fwq.数据库密码);
var sql2 = "";
using (DbConnection conn = new SqlConnection(msConnectionString))
{
//获取MEDIC_SEARCH_RECORD表的id和COMPLETE_MARK
CompleteMar = Complete_MarkId(Indexs);
if (CompleteMar == 23)
{
throw new DomainException("查询失败!!");
}
if (CompleteMar == 31)
{
throw new DomainException("查询取消!!");
}
try
{
//判断状态 21在执行
if (CompleteMar == 21)
{
if (Countnum($@"SELECT count(*) FROM {item.ExecDatabase}.dbo.SYSOBJECTS WHERE NAME = 'DIC_DIAG_SUMMARY'", conn) > 0)
{
if (Countnum($@"SELECT count(*) a FROM {item.ExecDatabase}.[dbo].[DIC_DIAG_SUMMARY] where {icd_or_diseaseCondition} ", conn) > 0)
{
sql2 = $@" IF EXISTS(SELECT * FROM [{item.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'MEDIC_PERSON_INFORMATION_{Indexs}')
drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs};
SELECT C.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,A.REG_CODE,A.REG_ID,1 REG_SOURCE,A.REG_TIME, {Indexs}Indexs,a.org_Code 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 ,
(SELECT DISTINCT REG_ID FROM
{item.ExecDatabase}.[DBO].OUT_DIAG WHERE {icd_or_diseaseCondition}) B,
{item.ExecDatabase}.[DBO].PUB_PATIENT C WHERE A.REG_ID=B.REG_ID AND A.PERSON_ID=C.PERSON_ID
UNION ALL
SELECT C.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,A.REG_CODE,A.REG_ID,2 REG_SOURCE,A.INHOS_TIME,{Indexs},a.org_Code hos_id,C.BIRTHDAY,C.SEX,1 TYPE,A.OUT_DEPT_NAME FROM
{item.ExecDatabase}.[DBO].INPAT_REG_INFO A , (SELECT DISTINCT REG_ID FROM {item.ExecDatabase}.[DBO].INPAT_DIAG WHERE {icd_or_diseaseCondition}) B,
{item.ExecDatabase}.[DBO].PUB_PATIENT C
WHERE A.REG_ID=B.REG_ID AND A.PERSON_ID=C.PERSON_ID";
conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@" insert into [SV_QueryPlatform_].[dbo].MEDIC_PERSON_INFORMATION_{Indexs }
( [HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],
[REG_TIME], AREA_ID,[INDEXS],[TYPE],[DEPT_NAME] )
SELECT [HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],
[REG_TIME],null AREA_ID,[INDEXS],[TYPE],[DEPT_NAME]
From [{item.ExecOpenLink}].[{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
//LOG($"查询成功,{num}行", $"{ITEM}", Indexs, "查询平台", "");
if (type1_2 == 2)
{
sql2 = $@"IF EXISTS(SELECT * FROM [{item.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'MEDIC_PERSON_INFORMATION_{Indexs}_2')
drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2;
SELECT A.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,B.REG_CODE,B.REG_ID,1 REG_SOURCE,B.REG_TIME,A.BIRTHDAY,A.SEX,2 TYPE, {Indexs} Indexs , b.org_code hos_id,B.DEPT_NAME into [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2
FROM {item.ExecDatabase}.[DBO].PUB_PATIENT A, {item.ExecDatabase}.[DBO].OUT_REG_INFO B,
(SELECT DISTINCT MASTER_INDEX FROM {item.ExecDatabase}.[DBO].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS= {Indexs} AND HOS_ID = cast(right('{item.ExecDatabase}',3)as int)) C
WHERE A.PERSON_ID=B.PERSON_ID AND A.MASTER_INDEX=C.MASTER_INDEX
UNION ALL
SELECT A.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,B.REG_CODE,B.REG_ID,2 REG_SOURCE,B.INHOS_TIME,A.BIRTHDAY,A.SEX,2 TYPE,{Indexs} , b.org_code,B.OUT_DEPT_NAME
FROM {item.ExecDatabase}.[DBO].PUB_PATIENT A, {item.ExecDatabase}.[DBO].INPAT_REG_INFO B,
(SELECT DISTINCT MASTER_INDEX FROM {item.ExecDatabase}.[DBO].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS={Indexs} AND HOS_ID = cast(right('{item.ExecDatabase}',3)as int)) C
WHERE A.PERSON_ID=B.PERSON_ID AND A.MASTER_INDEX=C.MASTER_INDEX ;";
conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@"INSERT INTO [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}]([HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME],AREA_ID,[INDEXS],[TYPE],[DEPT_NAME])
select [HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME],null,
[INDEXS],[TYPE],[DEPT_NAME]
From [{item.ExecOpenLink}].[{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@" DELETE FROM M FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}] M
INNER JOIN (SELECT * FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS = {Indexs}
AND HOS_ID =cast(right('{item.ExecDatabase}',3)as int) AND TYPE = 1) N
ON M.INDEXS = N.INDEXS AND M.HOS_ID = N.HOS_ID AND M.MASTER_INDEX = N.MASTER_INDEX
AND M.PERSON_ID = N.PERSON_ID AND M.REG_ID = N.REG_ID
AND M.REG_SOURCE = N.REG_SOURCE AND M.TYPE = 2 ;";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@" drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2;";
num = num + conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
// LOG($"查询成功,{num}行", $"{ITEM}", Indexs, "查询平台", "");
}
sql2 = $@" drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}; ";
num = num + conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
}
}
}
catch (Exception e)
{
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);
}
}
}
if (countsql == hos.Count)
{
configConnection.Execute("update [SV_QueryPlatform].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK = 22,END_TIME=getdate() where COMPLETE_MARK != 22 and id= " + Indexs);
}
else
{
configConnection.Execute("update [SV_QueryPlatform].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK = 23,END_TIME=getdate() where COMPLETE_MARK != 22 and id= " + Indexs);
}
}
/// <summary>
/// 查询药品信息
/// </summary>
/// <param name="type">类型2</param>
/// <param name="type1_2">他因</param>
/// <param name="drugName">药品名称</param>
public void Drugquery(int type, int type1_2, string[] drugName , int Indexs)
{
var sql = "";
int num = 0;
int CompleteMar = 0;
var drugs = "";
if (drugName != null)
{
foreach (var drug in drugName)
{
if (!string.IsNullOrEmpty(drug))
drugs = drugs + $"or item_name like '%{drug}%'";
}
}
drugs = drugs.Substring(2, drugs.Length - 2);
DbConnection configConnection = new SqlConnection(_configConnectionString);
List<SYS_Hospital> hos = configConnection.Query<SYS_Hospital>(@$"SELECT ExecOpenLink ,ExecDatabase FROM [192.168.18.156].[DB_SV_Data_Config].[dbo].[SYS_Hospital] WHERE ExecOpenLink <>'' AND ExecOpenLink IS NOT NULL AND ExecDatabase <>'' AND ExecDatabase IS NOT NULL ").ToList();
服务器 fwq = new 服务器();
var msConnectionString = "";
var countsql = 0;
var sql2 = "";
foreach (var item in hos)
{
//统计执行的多少家医院
countsql++;
var fwqsql = $"SELECT [服务器ip],[数据库账号],[数据库密码] FROM [SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{item.ExecOpenLink}'";
fwq = configConnection.Query<服务器>(fwqsql).FirstOrDefault();
msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", item.ExecOpenLink, item.ExecDatabase, fwq.数据库账号, fwq.数据库密码);
using (DbConnection conn = new SqlConnection(msConnectionString))
{
CompleteMar = Complete_MarkId(Indexs);
if (CompleteMar == 23)
{
throw new DomainException("查询失败!!");
}
if (CompleteMar == 31)
{
throw new DomainException("查询停止!!");
}
try
{
//判断状态 21在执行
if (CompleteMar == 21)
{
if (Countnum($@"SELECT count(*) FROM {item.ExecDatabase}.dbo.SYSOBJECTS WHERE NAME = 'DIC_FEE_SUMMARY'", conn) > 0)
{
if (Countnum($@"SELECT count(*) a FROM {item.ExecDatabase}.[dbo].[DIC_FEE_SUMMARY] where {drugs} ", conn) > 0)
{
//药品信息查询语句
foreach (var drug in drugName)
{
sql2 = $@"insert into [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] (
[HOS_ID] ,[ITEM_NAME] ,[MEDIC_NAME],[MEDIC_AREA],[INDEXS] )
select cast(right('{item.ExecDatabase}',3)as int) hos_id,ITEM_NAME,
'{drug}'MEDIC_NAME,medic_area medic_area,{Indexs} INDEXS from {item.ExecDatabase}.[dbo].[DIC_FEE_SUMMARY]
WHERE [ITEM_NAME] like '%{drug}%' GROUP BY ITEM_NAME,MEDIC_AREA ";
conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
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)
{
var sql3 = $@"IF EXISTS(SELECT * FROM [{item.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'MEDIC_PERSON_INFORMATION_{Indexs}')
drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs};
SELECT C.MASTER_INDEX MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,A.REG_CODE,A.REG_ID,'1'REG_SOURCE,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, (SELECT DISTINCT REG_ID,D.ID FROM {item.ExecDatabase}.[DBO].OUT_FEE E,
(SELECT * FROM [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] WHERE INDEXS={Indexs} AND (MEDIC_AREA IS NULL OR MEDIC_AREA ='')) D
WHERE HOS_ID = cast(right('{item.ExecDatabase}',3)as int) AND E.ITEM_NAME=D.ITEM_NAME
UNION ALL
SELECT DISTINCT REG_ID,D.ID FROM {item.ExecDatabase}.[DBO].OUT_FEE E,
(SELECT * FROM [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] WHERE INDEXS= {Indexs} AND MEDIC_AREA IS NOT NULL AND MEDIC_AREA!='') D
WHERE HOS_ID = cast(right('{item.ExecDatabase}',3)as int) AND E.ITEM_NAME=D.ITEM_NAME AND E.MEDIC_AREA=D.MEDIC_AREA ) B,{item.ExecDatabase}.[DBO].PUB_PATIENT C
WHERE A.REG_ID=B.REG_ID AND A.PERSON_ID=C.PERSON_ID
UNION ALL
SELECT C.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,A.REG_CODE,A.REG_ID,2 REG_SOURCE,A.INHOS_TIME,B.ID,{Indexs} ,cast(right('{item.ExecDatabase}',3)as int),C.BIRTHDAY,C.SEX,1,A.OUT_DEPT_NAME FROM
{item.ExecDatabase}.[DBO].INPAT_REG_INFO A,
(SELECT DISTINCT REG_ID,D.ID FROM {item.ExecDatabase}.[DBO].INPAT_FEE E,
(SELECT * FROM [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] WHERE INDEXS= {Indexs} AND (MEDIC_AREA IS NULL OR MEDIC_AREA ='')) D
WHERE HOS_ID = cast(right('{item.ExecDatabase}',3)as int) AND E.ITEM_NAME=D.ITEM_NAME
UNION ALL
SELECT DISTINCT REG_ID,D.ID FROM [DBO].INPAT_FEE E,
(SELECT * FROM [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] WHERE INDEXS= {Indexs} AND MEDIC_AREA IS NOT NULL AND MEDIC_AREA!='') D
WHERE HOS_ID = cast(right('{item.ExecDatabase}',3)as int) AND E.ITEM_NAME=D.ITEM_NAME AND E.MEDIC_AREA=D.MEDIC_AREA) B, [DBO].PUB_PATIENT C WHERE A.REG_ID=B.REG_ID AND A.PERSON_ID=C.PERSON_ID";
num = num + conn.Execute(sql3, commandTimeout: 60 * 60 * 5);
sql2 = $@"insert into [SV_QueryPlatform_].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}([HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME],AREA_ID,[INDEXS],[TYPE],[DEPT_NAME])
SELECT [HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME], AREA_ID,[INDEXS],[TYPE],[DEPT_NAME] From [{item.ExecOpenLink}].[{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
if (type1_2 == 2)
{
sql2 = $@"IF EXISTS(SELECT * FROM [{item.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'MEDIC_PERSON_INFORMATION_{Indexs}_2')
drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2;
SELECT A.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,B.REG_CODE,B.REG_ID,1 REG_SOURCE,B.REG_TIME,A.BIRTHDAY,A.SEX,2 TYPE, {Indexs} Indexs , b.org_code hos_id,B.DEPT_NAME into [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2
FROM {item.ExecDatabase}.[DBO].PUB_PATIENT A, {item.ExecDatabase}.[DBO].OUT_REG_INFO B,
(SELECT DISTINCT MASTER_INDEX FROM {item.ExecDatabase}.[DBO].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS= {Indexs} AND HOS_ID = cast(right('{item.ExecDatabase}',3)as int)) C
WHERE A.PERSON_ID=B.PERSON_ID AND A.MASTER_INDEX=C.MASTER_INDEX
UNION ALL
SELECT A.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,B.REG_CODE,B.REG_ID,2 REG_SOURCE,B.INHOS_TIME,A.BIRTHDAY,A.SEX,2 TYPE,{Indexs} , b.org_code,B.OUT_DEPT_NAME
FROM {item.ExecDatabase}.[DBO].PUB_PATIENT A, {item.ExecDatabase}.[DBO].INPAT_REG_INFO B,
(SELECT DISTINCT MASTER_INDEX FROM {item.ExecDatabase}.[DBO].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS={Indexs} AND HOS_ID = cast(right('{item.ExecDatabase}',3)as int)) C
WHERE A.PERSON_ID=B.PERSON_ID AND A.MASTER_INDEX=C.MASTER_INDEX;";
conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@"INSERT INTO [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}]([HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME],AREA_ID,[INDEXS],[TYPE],[DEPT_NAME])
select [HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME],null,[INDEXS],[TYPE],[DEPT_NAME] From [{item.ExecOpenLink}].[{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@" DELETE FROM M FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}] M
INNER JOIN (SELECT * FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS = {Indexs}
AND HOS_ID =cast(right('{item.ExecDatabase}',3)as int) AND TYPE = 1) N
ON M.INDEXS = N.INDEXS AND M.HOS_ID = N.HOS_ID AND M.MASTER_INDEX = N.MASTER_INDEX
AND M.PERSON_ID = N.PERSON_ID AND M.REG_ID = N.REG_ID
AND M.REG_SOURCE = N.REG_SOURCE AND M.TYPE = 2 ;";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@" drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2;";
num = num + conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
sql2 = $@" drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}; ";
num = num + conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
}
}
}
catch (Exception e)
{
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);
}
}
}
//判断是否查完全部医院
if (countsql == hos.Count)
{
configConnection.Execute("update [SV_QueryPlatform].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK = 22,END_TIME=getdate() where COMPLETE_MARK != 22 and id= " + Indexs);
}
configConnection.Execute("update [SV_QueryPlatform].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK = 23,END_TIME=getdate() where COMPLETE_MARK != 22 and id= " + Indexs);
}
}
}
namespace Health.Api.Infrastructure.Queries
{
public class HomeQueries
{
private readonly string _configConnectionString;
//private List<Common> a;
bool state = true;
public HomeQueries( string configConnectionString)
{
_configConnectionString = configConnectionString;
}
}
}
using Health.Api.Infrastructure; using Microsoft.AspNetCore.Authorization;
using Health.Api.Infrastructure.Queries;
using Health.Api.Infrastructure.Request;
using Health.Infra;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using QueryPlatform.Api.Infrastructure;
using QueryPlatform.Api.Infrastructure.Queries;
using QueryPlatform.Api.Infrastructure.Request;
using QueryPlatform.Infra;
using System; using System;
using System.Net; using System.Net;
using System.Security.Claims; using System.Security.Claims;
namespace Health.Api.Controllers namespace QueryPlatform.Api.Controllers
{ {
[Authorize] [Authorize]
[Route("api/account")] [Route("api/account")]
...@@ -20,16 +20,12 @@ public class AccountController : ControllerBase ...@@ -20,16 +20,12 @@ public class AccountController : ControllerBase
private readonly UserQueries _userQueries; private readonly UserQueries _userQueries;
private readonly JwtOption _jwtOption; private readonly JwtOption _jwtOption;
public AccountController( public AccountController(IUserIdentity identity, IOptions<JwtOption> options, UserQueries userQueries)
IUserIdentity identity,
IOptions<JwtOption> options,
UserQueries userQueries)
{ {
_identity = identity; _identity = identity;
_userQueries = userQueries; _userQueries = userQueries;
_jwtOption = options.Value; _jwtOption = options.Value;
} }
/// <summary> /// <summary>
/// 登录授权 /// 登录授权
/// </summary> /// </summary>
...@@ -58,14 +54,13 @@ public ActionResult Login([FromBody] LoginRequest request) ...@@ -58,14 +54,13 @@ public ActionResult Login([FromBody] LoginRequest request)
var claims = new[] var claims = new[]
{ {
new Claim(ClaimTypes.Sid, user.ID.ToString()), new Claim(ClaimTypes.Sid, user.id.ToString()),
new Claim(ClaimTypes.Surname, user.RealName), new Claim(ClaimTypes.Surname, user.RealName),
new Claim(ClaimTypes.Name, user.Login), new Claim(ClaimTypes.Name, user.Login),
}; };
var jwt = new JwtToken(_jwtOption).GenerateToken(claims); var jwt = new JwtToken(_jwtOption).GenerateToken(claims);
return Ok(jwt); return Ok(jwt);
} }
/// <summary> /// <summary>
/// 刷新登录JWT TOKEN /// 刷新登录JWT TOKEN
/// </summary> /// </summary>
......
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using QueryPlatform.Api.Infrastructure.Modules;
using QueryPlatform.Api.Infrastructure.Queries;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace QueryPlatform.Api.Controllers
{
[Authorize]
[Route("api/resource")]
[ApiController]
public class AnalysisController : Controller
{
private readonly AnalysisQueries _aQueries;
private readonly HomeQueries _homeQueries;
private readonly IMemoryCache _cache;
public AnalysisController(IMemoryCache cache, AnalysisQueries aQueries, HomeQueries homeQueries)
{
_cache = cache;
_homeQueries = homeQueries;
_aQueries = aQueries;
}
/// <summary>
/// 医院展示
/// </summary>
/// <returns></returns>
[HttpPost("HosListInquire")]
[AllowAnonymous]
public (IEnumerable<dynamic>, IEnumerable<dynamic>) HosListInquire(int paseIndex, string hos_name, int? hos_id)
{
return _aQueries.HosListInquire(paseIndex, hos_name, hos_id);
}
/// <summary>
/// 数据解析
/// </summary>
/// <returns></returns>
private static SemaphoreSlim semaphore = new SemaphoreSlim(1, 1);
[HttpPost("ParseInquire")]
[AllowAnonymous]
public async Task ParseInquireAsync(Sys_cs sys_)
{
int id = _aQueries.JX_SCJXJL(sys_.hosid, sys_.zxr);//1.生成解析记录
_aQueries.updateztZ(id, sys_.hosid, "等待执行");
await semaphore.WaitAsync();
try
{
if (sys_.num <= 1)
{
_aQueries.updateztZ(id, sys_.hosid, "--1更新reg_id,master_index");
_aQueries.JX_GXID(id, sys_.hosid);//1更新reg_id,master_index
}
if (sys_.num <= 2)
{
_aQueries.updateztZ(id, sys_.hosid, "--2更新标准库里DIC_DIAG_SUMMARY里的标准字段");
_aQueries.JX_DIC_DIAG(id, sys_.hosid);//2更新标准库里DIC_DIAG_SUMMARY里的标准字段
}
if (sys_.num <= 3)
{
_aQueries.updateztZ(id, sys_.hosid, "--3新建费用查询字典表");
_aQueries.JX_DIC_FEE(id, sys_.hosid);//3新建费用查询字典表
}
if (sys_.num <= 4)
{
_aQueries.updateztZ(id, sys_.hosid, "--4未匹配上的诊断导入到DA_Disease表中");
_aQueries.JX_ADD_DA_Disease(id, sys_.hosid);//4未匹配上的诊断导入到DA_Disease表中
}
if (sys_.num <= 5)
{
_aQueries.updateztZ(id, sys_.hosid, "--5匹配更新标准库 DIC_DRUG_ATC的标准字段");
_aQueries.JX_DIC_DRUG_ATC(id, sys_.hosid);//5匹配更新标准库 DIC_DRUG_ATC的标准字段
}
if (sys_.num <= 6)
{
_aQueries.updateztZ(id, sys_.hosid, "--6未匹配上的导入 [dbo].[DA_Drug] 做处理");
_aQueries.JX_ADD_DA_Drug(id, sys_.hosid);//6未匹配上的导入 [dbo].[DA_Drug] 做处理
}
if (sys_.num <= 7)
{
_aQueries.updateztZ(id, sys_.hosid, "--7对导入的药品跑权重");
_aQueries.JX_DRUG_DATA_QZ(id, sys_.hosid);//7对导入的药品跑权重
}
if (sys_.num <= 8)
{
_aQueries.updateztZ(id, sys_.hosid, "--8对导入的诊断做处理,剔除无效字符");
_aQueries.JX_DA_DIAGNOSIS_DATA(id, sys_.hosid);//8对导入的诊断做处理,剔除无效字符
}
if (sys_.num <= 9)
{
_aQueries.updateztZ(id, sys_.hosid, "--9新导入的诊断跑权重,生成标准科室,标准一级诊断,标准二级诊断");
_aQueries.JX_DIAGNOSIS_DATA_QZ(sys_.hosid);//9新导入的诊断跑权重,生成标准科室,标准一级诊断,标准二级诊断
}
if (sys_.num <= 10)
{
_aQueries.updateztZ(id, sys_.hosid, "--10更新DIC_DIAG_GATHER里的标准字段");
_aQueries.JX_REMATCH_DIAG(id, sys_.hosid);//10更新DIC_DIAG_GATHER里的标准字段
}
if (sys_.num <= 11)
{
_aQueries.updateztZ(id, sys_.hosid, "--11更新标准库里DIC_DIAG_SUMMARY里的标准字段");
_aQueries.JX_DIC_DIAG(id, sys_.hosid);//11更新标准库里DIC_DIAG_SUMMARY里的标准字段
}
if (sys_.num <= 12)
{
_aQueries.updateztZ(id, sys_.hosid, "--12调用函数更新out_reg_info标准诊断");
_aQueries.JX_UPDATE_REG_INFO(id, sys_.hosid);//12调用函数更新out_reg_info标准诊断
}
if (sys_.num <= 13)
{
_aQueries.updateztZ(id, sys_.hosid, "--13医保(1--插入card_type表,2--更改SOURCE ,3--修改登记表i_card_type)");
_aQueries.JX_REMOVE_CARD_TYPE(id, sys_.hosid);//13医保(1--插入card_type表,2--更改SOURCE ,3--修改登记表i_card_type)
}
if (sys_.num <= 14)
{
_aQueries.updateztZ(id, sys_.hosid, "--14费用分类");
_aQueries.JX_INSERT_CATEGORY(id, sys_.hosid);//14费用分类
}
if (sys_.num <= 15)
{
_aQueries.updateztZ(id, sys_.hosid, "执行完成");//15解析结束
}
_homeQueries.SendMail("医院解析提醒", @$"医院编号:{sys_.hosid} 解析结束!请前去确认是否需要费用分类。", sys_.zxr);
}
catch (Exception ex)
{
_homeQueries.SendMail("医院解析提醒", @$"医院编号:{sys_.hosid} 解析失败!错误日志:{ex}", sys_.zxr);
_aQueries.updateztZ(id, sys_.hosid, "执行失败");//解析结束
throw;
}
finally
{
semaphore.Release();
}
}
/// <summary>
/// 下拉框
/// </summary>
/// <returns></returns>
[HttpPost("JxLx")]
[AllowAnonymous]
public IEnumerable<dynamic> JxLx()
{
return _aQueries.JxLx();
}
}
}
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using QueryPlatform.Api.Infrastructure.Modules;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace QueryPlatform.Api.Infrastructure.Queries
{
[Authorize]
[Route("api/resource")]
[ApiController]
public class DrugqueryController : Controller
{
private readonly DrugqueryQueries _drugqueryQueries;
private readonly HomeQueries _homeQueries;
public DrugqueryController(DrugqueryQueries drugqueryQueries, HomeQueries homeQueries)
{
_drugqueryQueries = drugqueryQueries;
_homeQueries = homeQueries;
}
/// /// <summary>
/// 查询病人疾病信息和药品信息 type1=疾病 type2药品
/// </summary>
/// <returns></returns>
private static SemaphoreSlim semaphore = new SemaphoreSlim(1, 1);
[HttpPost("Drugquery")]
[AllowAnonymous]
public async Task Drugquery([FromBody] SYS_Drugquery sYS_Drugquery, string zxr)
{
var icd_or_diseaseCondition = "";
long type = 0;
long num = 0;
var drugs = "";
var materialNames = "";
if (sYS_Drugquery.icd != null)
{
foreach (var icdname in sYS_Drugquery.icd)
{
if (!string.IsNullOrEmpty(icdname))
icd_or_diseaseCondition = icd_or_diseaseCondition + $"or icd like '%{icdname}%'";
}
}
if (sYS_Drugquery.diseaseName != null)
{
foreach (var disease in sYS_Drugquery.diseaseName)
{
if (!string.IsNullOrEmpty(disease))
icd_or_diseaseCondition = icd_or_diseaseCondition + $"or DISEASE_NAME like '%{disease}%'";
}
}
if (icd_or_diseaseCondition.Length > 0)
{
icd_or_diseaseCondition = icd_or_diseaseCondition.Substring(2, icd_or_diseaseCondition.Length - 2);
}
if (sYS_Drugquery.drugName != null)
{
foreach (var drug in sYS_Drugquery.drugName)
{
if (!string.IsNullOrEmpty(drug))
drugs = drugs + $"or item_name like '%{drug}%'";
}
}
if (drugs.Length > 0)
{
drugs = drugs.Substring(2, drugs.Length - 2);
}
if (sYS_Drugquery.materialName != null)
{
foreach (var materialname in sYS_Drugquery.materialName)
{
if (!string.IsNullOrEmpty(materialname))
materialNames = materialNames + $"or item_name like '%{materialname}%'";
}
}
if (materialNames.Length > 0)
{
materialNames = materialNames.Substring(2, materialNames.Length - 2);
}
if (!string.IsNullOrEmpty(icd_or_diseaseCondition) && string.IsNullOrEmpty(drugs) && string.IsNullOrEmpty(materialNames))
{
type = 1;//1疾病
num = _drugqueryQueries.SqlAdd(sYS_Drugquery, type, zxr);
}
else if (!string.IsNullOrEmpty(drugs) && string.IsNullOrEmpty(icd_or_diseaseCondition) && string.IsNullOrEmpty(materialNames))
{
type = 2;//2药品
num = _drugqueryQueries.SqlAdd(sYS_Drugquery, type, zxr);
}
else if (!string.IsNullOrEmpty(materialNames) && string.IsNullOrEmpty(drugs) && string.IsNullOrEmpty(materialNames))
{
type = 3;//3材料
num = _drugqueryQueries.SqlAdd(sYS_Drugquery, type, zxr);
}
await semaphore.WaitAsync();
try
{
asynsDrugquery(sYS_Drugquery, icd_or_diseaseCondition, drugs, materialNames, num, type, zxr);
}
finally
{
semaphore.Release();
}
}
private void asynsDrugquery(SYS_Drugquery sYS_Drugquery, string icd_or_diseaseCondition, string drugs, string materialNames, long num, long type, string zxr)
{
_drugqueryQueries.updateCOMPLETE_MARK(num, 21);
try
{
if (type == 1)
{
var tasks = new List<Task>();
//_drugqueryQueries.Diseasequery(sYS_Drugquery.type1_2, icd_or_diseaseCondition, num, 1, zxr);
tasks.Add(Task.Factory.StartNew(() => _drugqueryQueries.Diseasequery(sYS_Drugquery.type1_2, icd_or_diseaseCondition, num, 1, zxr)));
tasks.Add(Task.Factory.StartNew(() => _drugqueryQueries.Diseasequery(sYS_Drugquery.type1_2, icd_or_diseaseCondition, num, 2, zxr)));
tasks.Add(Task.Factory.StartNew(() => _drugqueryQueries.Diseasequery(sYS_Drugquery.type1_2, icd_or_diseaseCondition, num, 3, zxr)));
tasks.Add(Task.Factory.StartNew(() => _drugqueryQueries.Diseasequery(sYS_Drugquery.type1_2, icd_or_diseaseCondition, num, 4, zxr)));
Task.WaitAll(tasks.ToArray());
_drugqueryQueries.updateCOMPLETE_MARK(num, 22);
_homeQueries.SendMail(@$"药品/疾病/材料平台提醒", @$" { "疾病"}{sYS_Drugquery.peojectName}拉取结束!", zxr);
}
else if (type == 2)
{
var tasks = new List<Task>();
tasks.Add(Task.Factory.StartNew(() => _drugqueryQueries.Drugquery(sYS_Drugquery.typefee, sYS_Drugquery.type1_2, drugs, sYS_Drugquery.drugName, num, 1, zxr)));
tasks.Add(Task.Factory.StartNew(() => _drugqueryQueries.Drugquery(sYS_Drugquery.typefee, sYS_Drugquery.type1_2, drugs, sYS_Drugquery.drugName, num, 2, zxr)));
tasks.Add(Task.Factory.StartNew(() => _drugqueryQueries.Drugquery(sYS_Drugquery.typefee, sYS_Drugquery.type1_2, drugs, sYS_Drugquery.drugName, num, 3, zxr)));
tasks.Add(Task.Factory.StartNew(() => _drugqueryQueries.Drugquery(sYS_Drugquery.typefee, sYS_Drugquery.type1_2, drugs, sYS_Drugquery.drugName, num, 4, zxr)));
Task.WaitAll(tasks.ToArray());
_drugqueryQueries.updateCOMPLETE_MARK(num, 22);
_homeQueries.SendMail(@$"药品/疾病/材料平台提醒", @$" {"药品"}{sYS_Drugquery.peojectName}拉取结束!", zxr);
}
else if (type == 3)
{
var tasks = new List<Task>();
tasks.Add(Task.Factory.StartNew(() => _drugqueryQueries.材料query(sYS_Drugquery.type1_2, materialNames, sYS_Drugquery.materialName, num, 1, zxr)));
tasks.Add(Task.Factory.StartNew(() => _drugqueryQueries.材料query(sYS_Drugquery.type1_2, materialNames, sYS_Drugquery.materialName, num, 2, zxr)));
tasks.Add(Task.Factory.StartNew(() => _drugqueryQueries.材料query(sYS_Drugquery.type1_2, materialNames, sYS_Drugquery.materialName, num, 3, zxr)));
tasks.Add(Task.Factory.StartNew(() => _drugqueryQueries.材料query(sYS_Drugquery.type1_2, materialNames, sYS_Drugquery.materialName, num, 4, zxr)));
Task.WaitAll(tasks.ToArray());
_drugqueryQueries.updateCOMPLETE_MARK(num, 22);
_homeQueries.SendMail(@$"药品/疾病/材料平台提醒", @$" { "材料"}{sYS_Drugquery.peojectName}拉取结束!", zxr);
}
else
{
throw new DomainException("只能单类型查询!!");
}
}
catch (Exception e)
{
throw e;
}
}
/// /// <summary>
/// 化验检查检索
/// </summary>
/// <returns></returns>
[HttpPost("化验检查query")]
[AllowAnonymous]
public void 化验检查query(int indexs, string project_name, string[] commodity_name, int type, string zxr, int bz = 0)
{
int id = _drugqueryQueries.SqlAssayAdd(indexs, project_name, commodity_name, type);
int ids = _drugqueryQueries.indexsId(indexs);
var item_name = "";
if (commodity_name != null)
{
foreach (var item in commodity_name)
{
if (!string.IsNullOrEmpty(item))
{
if (type == 1)
item_name = item_name + $"or ASSAY_ITEM_NAME like '%{item}%' or ITEM_ENAME like '%{item}%' or RESULTS like '%{item}%'";
if (type == 2)
item_name = item_name + $"or EXAMINE_NAME like '%{item}%'";
}
}
if (item_name.Length > 0)
{
item_name = item_name.Substring(2, item_name.Length - 2);
}
}
///////////////////////------------进入业务------------/////////////////////////////
_drugqueryQueries.化验query(type, indexs, id, 1, zxr, ids);//建人群中转表
_drugqueryQueries.化验query(type, indexs, id, 2, zxr);//各服务器建临时表
_drugqueryQueries.化验query(type, indexs, id, 3, zxr, ids, item_name);//各服务器开始拉取
_drugqueryQueries.化验query(type, indexs, id, 4, zxr);//删除各服务器临时表
if (type == 1)//检查自动跳过
{
_drugqueryQueries.化验query(type, indexs, id, 5, zxr, 0, item_name);//切割化验
}
_drugqueryQueries.化验query(type, indexs, id, 6, zxr);//结束
_homeQueries.SendMail(@$"化验检查拉取提醒", @$"{(type == 1 ? "化验" : "检查")}:{project_name} 拉取结束!", zxr);
}
[HttpPost("delete")]
[AllowAnonymous]
public void delete(long type, long indexs, int id, long bz, string zxr)
{
_drugqueryQueries.化验query(type, indexs, id, bz, zxr);
}
[HttpPost("MEDIC_SEARCH_RECORD_ASSAY")]
[AllowAnonymous]
public IEnumerable<dynamic> MEDIC_SEARCH_RECORD_ASSAY(int id)
{
return _drugqueryQueries.MEDIC_SEARCH_RECORD_ASSAY(id);
}
/// <summary>
/// 需求探索
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("DemandExploration")]
[AllowAnonymous]
public IEnumerable<dynamic> DemandExploration(int id)
{
return _drugqueryQueries.MEDIC_SEARCH_RECORD_ASSAY(id);
}
}
}
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using QueryPlatform.Api.Infrastructure.Modules;
using QueryPlatform.Api.Infrastructure.Queries;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace QueryPlatform.Api.Controllers
{
[Authorize]
[Route("api/resource")]
[ApiController]
public class HomeController : Controller
{
private readonly HomeQueries _homeQueries;
private readonly IWebHostEnvironment environment;
public HomeController(HomeQueries homeQueries, IWebHostEnvironment environment)
{
this._homeQueries = homeQueries;
this.environment = environment;
}
/// <summary>
/// 查询所有项目记录
/// </summary>
/// <returns></returns>
[HttpGet("DemamdQuery")]
[AllowAnonymous]
public (IEnumerable<dynamic>, IEnumerable<dynamic>) DemamdQuery(long paseIndex, string Demand_Name)
{
return _homeQueries.DemandQuery(paseIndex == 0 ? 1 : paseIndex, Demand_Name);
}
[HttpGet("ceshi")]
[AllowAnonymous]
public List<string> ceshi(string title, string content, string zxr = "")
{
return _homeQueries.ceshi();
}
/// <summary>
/// 查询子表的记录
/// </summary>
/// <returns></returns>
[HttpGet("DemamdQuery_")]
[AllowAnonymous]
public IEnumerable<dynamic> DemamdQuery_(int id)
{
var DemandQuery = _homeQueries.DemandQueryfu(id);
return DemandQuery;
}
/// <summary>
/// 添加需求记录
/// </summary>
/// <param name="sYS_Demand"></param>
[HttpPost("DemandAdd")]
[AllowAnonymous]
public void DemandAdd([FromBody] SYS_DEMAND sYS_Demand)
{
_homeQueries.Demand(sYS_Demand);
}
/// <summary>
/// 添加子表数据
/// </summary>
/// <param name="sYS_DemandSublist"></param>
[HttpPost("DemandAddfu")]
[AllowAnonymous]
public void DemandAddfu([FromForm] SYS_DEMANDSUBLIS sYS_DemandSublist)
{
_homeQueries.Demandfu(sYS_DemandSublist, environment.WebRootPath);
}
/// <summary>
/// 添加服务器
/// </summary>
/// <param name="servers"></param>
[HttpPost("ServersAdd")]
[AllowAnonymous]
public void ServersAdd(服务器 servers)
{
if (!string.IsNullOrEmpty(servers.服务器ip) && !string.IsNullOrEmpty(servers.数据库账号) && !string.IsNullOrEmpty(servers.数据库密码))
{
_homeQueries.ServersConfiguration(servers);
}
}
/// <summary>
/// 展示服务器
/// </summary>
[HttpPost("ServersShow")]
[AllowAnonymous]
public IEnumerable<dynamic> ServersShow()
{
return _homeQueries.ServersShow();
}
/// <summary>
/// 存储函数
/// </summary>
[HttpPost("Funcadd")]
[AllowAnonymous]
public void Funcadd([FromBody] COMMONLYUSED commonly)
{
if (!string.IsNullOrEmpty(commonly.Name) && !string.IsNullOrEmpty(commonly.value))
{
_homeQueries.FuncaConfiguration(commonly);
}
}
/// <summary>
/// 存储函数展示
/// </summary>
/// <returns></returns>
[HttpGet("Funca")]
[AllowAnonymous]
public IEnumerable<dynamic> Funca()
{
var DemandQuery = _homeQueries.FuncaQuery();
return DemandQuery;
}
//[HttpGet("lingchuanglujingjiancha")]
//[AllowAnonymous]
//public IEnumerable<dynamic> lingchuanglujingjiancha(string name)
//{
// var DemandQuery = _homeQueries.lingchuanglujingjiancha(name);
// return DemandQuery;
//}
/// <summary>
/// 查询记录导出
/// </summary>
/// <returns></returns>
[HttpGet("Executes")]
[AllowAnonymous]
public string Executes(DateTime StartTime, DateTime EndTime)
{
return _homeQueries.Executes(StartTime, EndTime, environment.WebRootPath);
}
/// <summary>
/// 南海核对数据下拉框
/// </summary>
/// <returns></returns>
[HttpPost("YiYuanShow")]
[AllowAnonymous]
public List<SYS_YIYUAN> YiYuanShow()
{
List<SYS_YIYUAN> yy = new List<SYS_YIYUAN>();
yy.Add(new SYS_YIYUAN { hosid = 42, hosname = "广东省佛山市南海区人民医院" });
yy.Add(new SYS_YIYUAN { hosid = 43, hosname = "广东省中西医结合医院" });
yy.Add(new SYS_YIYUAN { hosid = 44, hosname = "广东省佛山市南海区中医院沙头分院" });
yy.Add(new SYS_YIYUAN { hosid = 45, hosname = "广东省佛山市南海区妇幼保健院" });
yy.Add(new SYS_YIYUAN { hosid = 46, hosname = "广东省人民医院南海医院" });
yy.Add(new SYS_YIYUAN { hosid = 48, hosname = "广东省佛山市南海区第四人民医院" });
yy.Add(new SYS_YIYUAN { hosid = 49, hosname = "广东省佛山市南海区第五人民医院" });
yy.Add(new SYS_YIYUAN { hosid = 50, hosname = "广东省佛山市南海区第六人民医院" });
yy.Add(new SYS_YIYUAN { hosid = 52, hosname = "广东省佛山市南海区第八人民医院" });
yy.Add(new SYS_YIYUAN { hosid = 53, hosname = "广东省佛山市南海区第九人民医院" });
yy.Add(new SYS_YIYUAN { hosid = 58, hosname = "广东省佛山市南海区公共卫生医院" });
yy.Add(new SYS_YIYUAN { hosid = 61, hosname = "广东省佛山市南海经济开发区人民医院" });
yy.Add(new SYS_YIYUAN { hosid = 92, hosname = "广东省佛山市南海区第七人民医院" });
yy.Add(new SYS_YIYUAN { hosid = 105, hosname = "广东省佛山市南海区桂城医院" });
yy.Add(new SYS_YIYUAN { hosid = 106, hosname = "南方医科大学第七附属医院" });
return yy;
}
/// <summary>
/// 单家医院核对数据
/// </summary>
/// <returns></returns>
[HttpPost("YiYuanHeDui")]
[AllowAnonymous]
public IEnumerable<dynamic> YiYuanHeDui(long hos_id, string year)
{
return _homeQueries.YiYuanHeDui(hos_id, year);
}
/// <summary>
/// 数据抽取登记展示列表
/// </summary>
/// <returns></returns>
[HttpGet("ExtractQuery")]
[AllowAnonymous]
public (IEnumerable<dynamic>, IEnumerable<dynamic>) ExtractQuery(long paseIndex)
{
return _homeQueries.ExtractShou(paseIndex == 0 ? 1 : paseIndex);
}
/// <summary>
/// 数据抽取登记新增数据
/// </summary>
/// <returns></returns>
[HttpPost("AddExtract")]
[AllowAnonymous]
public void AddExtract(SYS_EXTRACT sYS_Extract)
{
_homeQueries.Add(sYS_Extract);
}
/// <summary>
/// 数据抽取登记修改
/// </summary>
/// <param name=""></param>
/// <param name="dataExtract"></param>
/// <returns></returns>
[HttpPost("Update")]
[AllowAnonymous]
public IActionResult Update(DATAEXTRACT dataExtract)
{
_homeQueries.Update(dataExtract);
return Ok();
}
//网站拉取json
//[HttpPost("Ybyp")]
//[AllowAnonymous]
//public async Task<IActionResult> Ybyp()
//{
// for (long i = 1188; i <= 2104; i++)
// {
// var client = new HttpClient();
// var request = new HttpRequestMessage
// {
// Method = HttpMethod.Post,
// RequestUri = new Uri("https://code.nhsa.gov.cn/yp/getPublishGoodsDataInfo.html?companyNameSc=&registeredProductName=&approvalCode=&batchNumber=20220920&_search=false&nd=1663825733775&rows=100&page="+i+"&sidx=&sord=asc"),
// Content = new StringContent("{\r\n\"companyNameSc\":null,\r\n\"registeredProductName\": null,\r\n\"approvalCode\": null,\r\n\"batchNumber\": \"20220920\",\r\n\"_search\": false,\r\n\"nd\": \"1663825733775\",\r\n\"rows\": 100,\r\n\"page\": "+i+",\r\n\"sidx\":null,\r\n\"sord\": \"asc\",\r\n}")
// {
// Headers = { ContentType = new MediaTypeHeaderValue("text/plain") }
// }
// };
// using (var response = await client.SendAsync(request))
// {
// response.EnsureSuccessStatusCode();
// var body = await response.Content.ReadAsStringAsync();
// _homeQueries.Ybyp(body, i);
// }
// }
// return Ok();
//}
/// <summary>
/// 邮箱推送
/// </summary>
/// <param name="title">邮箱标题</param>
/// <param name="content">内容</param>
/// <param name="zxr">推送人</param>
/// <returns></returns>
[HttpPost("SendMail")]
[AllowAnonymous]
public IActionResult SendMail(string title, string content, string zxr = "")
{
_homeQueries.SendMail(title, content, zxr);
return Ok();
}
#region 导出病人数据
private static SemaphoreSlim semaphore = new SemaphoreSlim(1, 1);
[HttpGet("DownloadOrders")]
[AllowAnonymous]
public async Task<string> DownloadOrdersAsync(string ExportTableName)
{
await semaphore.WaitAsync();
var export = "";
try
{
export = _homeQueries.Excelex(ExportTableName, environment.WebRootPath); ;
}
catch (Exception e)
{
export = e.ToString();
}
finally
{
semaphore.Release();
}
return export;
}
#endregion
#region 导入病人数据
[HttpPost("ExcelToDataTable1")]
[AllowAnonymous]
public IActionResult ExcelToDataTable1(IFormFile file)
{
var export = _homeQueries.ExcelToDataTables(file);
return Ok(export);
}
#endregion
#region 游标数据拉取
[HttpPost("AutomaticCursor")]
[AllowAnonymous]
public IActionResult AutomaticCursor()
{
//tis
// _homeQueries.SendMail(title, content, zxr);
return Ok();
}
#endregion
[HttpPost("ceshi")]
[AllowAnonymous]
public IActionResult ceshi()
{
return Ok(_homeQueries.ceshi());
}
}
}
\ No newline at end of file
namespace QueryPlatform.Api.Controllers
{
//internal interface IUserIdentity
//{
//}
}
\ No newline at end of file
using Dapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using QueryPlatform.Api.Infrastructure;
//using QueryPlatform.Api.Infrastructure.Models;
using QueryPlatform.Api.Infrastructure.Modules;
using QueryPlatform.Api.Infrastructure.Queries;
using QueryPlatform.Infra;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace QueryPlatform.Api.Controllers
{
[Authorize]
[Route("api/resource")]
[ApiController]
public class ResourceController : ControllerBase
{
private readonly IMemoryCache _cache;
private readonly ResourceQueries resourceQueries;
private readonly IWebHostEnvironment _webHostEnvironment;
private readonly DrugqueryQueries drugqueryQueries;
private readonly HomeQueries homeQueries;
private readonly IUserIdentity _iuserIdentity;
private readonly UserQueries _userQueries;
public ResourceController(IMemoryCache cache, ResourceQueries resourceQueries, HomeQueries homeQueries, DrugqueryQueries drugqueryQueries, IUserIdentity iuserIdentity, UserQueries userQueries, IWebHostEnvironment webHostEnvironment)
{
this._cache = cache;
this.homeQueries = homeQueries;
this.drugqueryQueries = drugqueryQueries;
this.resourceQueries = resourceQueries;
this._iuserIdentity = (UserIdentity)iuserIdentity;
this._userQueries = userQueries;
_webHostEnvironment = webHostEnvironment;
}
/// <summary>
/// 查询当月项目
/// </summary>
/// <returns></returns>
[HttpGet("ItemQuery")]
[AllowAnonymous]
public (IEnumerable<dynamic>, IEnumerable<dynamic>) ItemQuery(string name, long paseIndex)
{
return resourceQueries.ItemQuery(name, paseIndex);
}
/// <summary>
/// 取消正在查询项目
/// </summary>m
/// <param name="id">id </param>
/// <returns></returns>
[HttpPost("CancelProject")]
[AllowAnonymous]
public bool CancelProject(int id)
{
bool ItemQueryList = resourceQueries.CancelProject(id);
return ItemQueryList;
}
/// <summary>
/// 查询项目报告
/// </summary>
/// <returns></returns>
[HttpPost("ProjectReport")]
[AllowAnonymous]
public async Task<(IEnumerable<dynamic>, IEnumerable<dynamic>, string, string, IEnumerable<dynamic>, IEnumerable<dynamic>, string, IEnumerable<dynamic>)> ProjectReport([FromBody] SYS_Cs sYS_Cs)
{
return await resourceQueries.ProjectReport1(sYS_Cs.id, sYS_Cs.MEDIC_AREA, sYS_Cs.item_name, sYS_Cs.GENERIC_NAME, sYS_Cs.PROJECT_NAME, sYS_Cs.icd, sYS_Cs.DISEASE_NAME, _webHostEnvironment.WebRootPath, 0);
}
/// <summary>
/// 下载项目报告
/// </summary>
/// <returns></returns>
[HttpPost("DownloadFile")]
[AllowAnonymous]
public async Task<string> DownloadFileAsync([FromBody] SYS_Cs sYS_Cs)
{
var dz = await resourceQueries.ProjectReport1(sYS_Cs.id, sYS_Cs.MEDIC_AREA, sYS_Cs.item_name, sYS_Cs.GENERIC_NAME, sYS_Cs.PROJECT_NAME, sYS_Cs.icd, sYS_Cs.DISEASE_NAME, _webHostEnvironment.WebRootPath, 1);
return dz.Item7;
}
/// <summary>
/// 查询流水库表
/// </summary>
/// <returns></returns>
[HttpPost("QueryFlowDatabase")]
[AllowAnonymous]
public (IEnumerable<dynamic>, IEnumerable<dynamic>) QueryFlowDatabase(long paseIndex)
{
return resourceQueries.QueryFlowDatabase(paseIndex);
}
/// <summary>
/// 查询药品产地
/// </summary>
/// <returns></returns>
[HttpPost("ShowMEDIC_AREA")]
[AllowAnonymous]
public IEnumerable<dynamic> ShowMEDIC_AREA(int id)
{
return resourceQueries.ShowMEDIC_AREA(id);
}
/// <summary>
/// 查询名称产地
/// </summary>
/// <returns></returns>
[HttpPost("ShowITEM_NAME")]
[AllowAnonymous]
public IEnumerable<dynamic> ShowITEM_NAME(int id)
{
return resourceQueries.ShowITEM_NAME(id);
}
/// <summary>
/// 建立流水库表
/// </summary>
/// <returns></returns>
[HttpPost("EstablishFlowDatabaseTable")]
[AllowAnonymous]
public bool EstablishFlowDatabaseTable([FromBody] SYS_EstablishFlowDatabaseTable sYS_EstablishFlows)
{
return resourceQueries.EstablishFlowDatabaseTable(sYS_EstablishFlows.tableName.Replace(" ", ""), sYS_EstablishFlows.sql, sYS_EstablishFlows.id, sYS_EstablishFlows.remarks); ;
}
/// <summary>
/// 建立流水库
/// </summary>
/// <returns></returns>
[HttpPost("CreateAFlow_Library")]
[AllowAnonymous]
public bool CreateAFlow_Library(string DatabaseName, long indexs)
{
return resourceQueries.CreateAFlow_Library(DatabaseName, indexs);
}
/// <summary>
/// 查询日志
/// </summary>
/// <returns></returns>
[HttpPost("ShowLog")]
[AllowAnonymous]
public IEnumerable<dynamic> ShowLog(long indexs, string tableName)
{
return resourceQueries.ShowLog(indexs, tableName);
}
/// <summary>
/// 拉取流水库数据
/// </summary>
/// <returns></returns>
private static SemaphoreSlim semaphore = new SemaphoreSlim(1, 1);
[HttpPost("PullData")]
[AllowAnonymous]
public async Task PullDataAsync(long indexs, string DatabaseName, string tableName, string zxr)
{
resourceQueries.pullstate(indexs, tableName);
await semaphore.WaitAsync();
try
{
resourceQueries.PullData(indexs, DatabaseName, tableName);
homeQueries.SendMail("流水库拉取提醒", @$"流水库:{DatabaseName}拉取结束,请查看日志。有没有需要特殊处理的医院", zxr);
}
catch (Exception e)
{
throw e;
}
finally
{
semaphore.Release();
}
resourceQueries.Connection(181).Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET DataPullTime=getdate() WHERE indexs={indexs} and tableName='{tableName}'");
}
/// <summary>
/// 操作人展示
/// </summary>
/// <returns></returns>
[HttpGet("ZxrQuery")]
[AllowAnonymous]
public IEnumerable<dynamic> ZxrQuery()
{
var user = _userQueries.GetUserById(_iuserIdentity.UserId);
return homeQueries.ZxrQuery(user);
}
/// <summary>
/// 可生成sql
/// </summary>
/// <returns></returns>
[HttpGet("DateExplorationSql")]
[AllowAnonymous]
public IEnumerable<dynamic> DateExplorationSql()
{
return homeQueries.DateExplorationSql();
}
/// <summary>
/// 生成sql
/// </summary>
/// <returns></returns>
[HttpPost("DateExploration")]
[AllowAnonymous]
public string DateExploration(int RetrievalId, List<DateExploration> dateExplorations)
{
int ids = drugqueryQueries.indexsId(RetrievalId);
var sql = "------生成时间:" + DateTime.Now.ToString();
var name = "";
try
{
if (homeQueries.DateExplorationSql1(dateExplorations) >= 1)
{
sql = sql + @"
--------------------------------------------------------------------------------
" + homeQueries.DateExploration(-1, "", @$"MEDIC_PERSON_INFORMATION_{ids}", RetrievalId);
}
List<DES> des = homeQueries.DESIsAssay();
foreach (var item in dateExplorations.Where(w => des.Select(s => s.id).Contains(w.Id)).Select(s => s.Name2).Distinct())
{
sql = sql + @"
" + homeQueries.DateExploration(-2, item, @$"MEDIC_PERSON_INFORMATION_{ids}", 0);
}
foreach (var item in dateExplorations.OrderBy(o => o.Id))
{
name = "";
if (!string.IsNullOrEmpty(item.Name1))
name = name + "," + item.Name1;
if (!string.IsNullOrEmpty(item.Name2))
name = name + "," + item.Name2;
if (!string.IsNullOrEmpty(item.Name3))
name = name + "," + item.Name3;
if (!string.IsNullOrEmpty(item.Name4))
name = name + "," + item.Name4;
if (!string.IsNullOrEmpty(item.Name5))
name = name + "," + item.Name5;
if (!string.IsNullOrEmpty(item.Name6))
name = name + "," + item.Name6;
if (!string.IsNullOrEmpty(item.Name7))
name = name + "," + item.Name7;
if (!string.IsNullOrEmpty(item.Name8))
name = name + "," + item.Name8;
if (!string.IsNullOrEmpty(item.Name9))
name = name + "," + item.Name9;
if (!string.IsNullOrEmpty(item.Name10))
name = name + "," + item.Name10;
name = name.Substring(1);
sql = sql +
@"
--------------------------------------------------------------------------------
" + homeQueries.DateExploration(item.Id, name, @$"MEDIC_PERSON_INFORMATION_{ids}", RetrievalId);
}
}
catch (Exception e)
{
sql = "先填写输入框后勾选";
}
return sql;
}
[HttpGet("lingchuanglujingjiancha")]
[AllowAnonymous]
public IEnumerable<dynamic> lingchuanglujingjiancha(string name)
{
var DemandQuery = homeQueries.lingchuanglujingjiancha(name);
return DemandQuery;
}
}
}
using Health.Api.Infrastructure.Modules; using Microsoft.AspNetCore.Mvc;
using Health.Api.Infrastructure.Queries; using QueryPlatform.Api.Infrastructure.Modules;
using Health.Api.Infrastructure.Request; using QueryPlatform.Api.Infrastructure.Queries;
using Health.Infra; using QueryPlatform.Api.Infrastructure.Request;
using Microsoft.AspNetCore.Mvc; using QueryPlatform.Infra;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
namespace Health.Api.Controllers namespace QueryPlatform.Api.Controllers
{ {
[Route("api/user")] [Route("api/user")]
[ApiController] [ApiController]
...@@ -16,17 +16,12 @@ public class UserController : ControllerBase ...@@ -16,17 +16,12 @@ public class UserController : ControllerBase
private readonly UserStorage _userStorage; private readonly UserStorage _userStorage;
private readonly UserQueries _userQueries; private readonly UserQueries _userQueries;
public UserController( public UserController(IUserIdentity identity, UserStorage userStorage, UserQueries userQueries)
IUserIdentity identity,
UserStorage userStorage,
UserQueries userQueries)
{ {
_identity = identity; _identity = identity;
_userStorage = userStorage; _userStorage = userStorage;
_userQueries = userQueries; _userQueries = userQueries;
} }
/// <summary> /// <summary>
/// 用户信息 /// 用户信息
/// </summary> /// </summary>
...@@ -41,7 +36,6 @@ public ActionResult Info() ...@@ -41,7 +36,6 @@ public ActionResult Info()
return Ok(user); return Ok(user);
} }
/// <summary> /// <summary>
/// 用户修改 /// 用户修改
/// </summary> /// </summary>
...@@ -66,7 +60,6 @@ public IActionResult Update(UserRequest request) ...@@ -66,7 +60,6 @@ public IActionResult Update(UserRequest request)
_userStorage.Update(request); _userStorage.Update(request);
return Ok(); return Ok();
} }
/// <summary> /// <summary>
/// 查询用户列表 /// 查询用户列表
/// </summary> /// </summary>
...@@ -78,7 +71,6 @@ public IActionResult Get(string realname) ...@@ -78,7 +71,6 @@ public IActionResult Get(string realname)
var users = _userQueries.GetUsers(realname); var users = _userQueries.GetUsers(realname);
return Ok(users); return Ok(users);
} }
/// <summary> /// <summary>
/// 新增用户 /// 新增用户
/// </summary> /// </summary>
...@@ -95,7 +87,6 @@ public IActionResult Post(UserRequest request) ...@@ -95,7 +87,6 @@ public IActionResult Post(UserRequest request)
return Ok(user); return Ok(user);
} }
/// <summary> /// <summary>
/// 删除 /// 删除
/// </summary> /// </summary>
......
// This file is used by Code Analysis to malongain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE0058:永远不会使用表达式值", Justification = "<挂起>", Scope = "member", Target = "~M:QueryPlatform.Api.Startup.Configure(Microsoft.AspNetCore.Builder.IApplicationBuilder,Microsoft.AspNetCore.Hosting.IWebHostEnvironment)")]
using Health.Infra; using QueryPlatform.Infra;
using System.ComponentModel; using System.ComponentModel;
namespace Health.Api namespace QueryPlatform.Api
{ {
public class ApiResponse<TEntity> public class ApiResponse<TEntity>
where TEntity : class, new() where TEntity : class, new()
...@@ -96,12 +96,13 @@ public enum ResponseType ...@@ -96,12 +96,13 @@ public enum ResponseType
/// 内部错误 /// 内部错误
/// </summary> /// </summary>
[Description("内部错误")] [Description("内部错误")]
InternalServerError = 500, longernalServerError = 500,
/// <summary> /// <summary>
/// 不支持请求 /// 不支持请求
/// </summary> /// </summary>
[Description("不支持请求")] [Description("不支持请求")]
NotImplemented = 501, NotImplemented = 501,
Fail = 502,
} }
} }
using Autofac; using Autofac;
using Health.Api.Infrastructure.Queries;
using Health.Api.Infrastructure.Queues;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Health.Api.Infrastructure.Queries; using QueryPlatform.Api.Infrastructure.Queries;
using QueryPlatform.Api.Infrastructure.Queues;
namespace Health.Api.Infrastructure.AutofacModules namespace QueryPlatform.Api.Infrastructure.AutofacModules
{ {
public class QueriesModule : Autofac.Module public class QueriesModule : Autofac.Module
{ {
...@@ -27,19 +26,14 @@ protected override void Load(ContainerBuilder builder) ...@@ -27,19 +26,14 @@ protected override void Load(ContainerBuilder builder)
var Connection158 = configuration["ConnectionStrings:Connection158"]; var Connection158 = configuration["ConnectionStrings:Connection158"];
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,Connection151,Connection152,Connection153,Connection154,Connection155,Connection158)).InstancePerLifetimeScope(); builder.Register(c => new DrugqueryQueries(Connection156, configConnectionString)).InstancePerLifetimeScope();
builder.Register(c => new DrugqueryQueries(Connection156, configConnectionString )).InstancePerLifetimeScope();
builder.Register(c => new HomeQueries(configConnectionString)).InstancePerLifetimeScope(); builder.Register(c => new HomeQueries(configConnectionString)).InstancePerLifetimeScope();
builder.Register(c => new AnalysisQueries(Connection156, configConnectionString)).InstancePerLifetimeScope();
builder.Register(c => new AnalysisQueries(Connection156, configConnectionString )).InstancePerLifetimeScope();
} }
} }
} }
\ No newline at end of file
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Health.Api namespace QueryPlatform.Api
{ {
public class SearchContext : DbContext public class SearchContext : DbContext
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
using System.IO.Compression; using System.IO.Compression;
using System.Linq; using System.Linq;
namespace Health.Api.Infrastructure.Domain namespace QueryPlatform.Api.Infrastructure.Domain
{ {
public class SearchPathInfo public class SearchPathInfo
{ {
......
using System.ComponentModel; using System.ComponentModel;
namespace Health.Api.Infrastructure.Enums namespace QueryPlatform.Api.Infrastructure.Enums
{ {
public enum DiseaseType public enum DiseaseType
{ {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Health.Api.Infrastructure.Filters namespace QueryPlatform.Api.Infrastructure.Filters
{ {
public class ArgumentsActionFilter : IActionFilter public class ArgumentsActionFilter : IActionFilter
{ {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
using System.Linq; using System.Linq;
using System.Net; using System.Net;
namespace Health.Api.Infrastructure.Filters namespace QueryPlatform.Api.Infrastructure.Filters
{ {
public class HttpGlobalExceptionFilter : IExceptionFilter public class HttpGlobalExceptionFilter : IExceptionFilter
{ {
...@@ -63,7 +63,7 @@ public void OnException(ExceptionContext context) ...@@ -63,7 +63,7 @@ public void OnException(ExceptionContext context)
} }
else else
{ {
var result = new InternalServerErrorResponse var result = new longernalServerErrorResponse
{ {
Status = Status.Failed, Status = Status.Failed,
Message = "请求发生一个未知错误,请参考错误信息。", Message = "请求发生一个未知错误,请参考错误信息。",
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
using System.Linq; using System.Linq;
using System.Net; using System.Net;
namespace Health.Api.Infrastructure.Filters namespace QueryPlatform.Api.Infrastructure.Filters
{ {
public class ValidateModelFilter : IResultFilter public class ValidateModelFilter : IResultFilter
{ {
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Health.Api namespace QueryPlatform.Api.Infrastructure
{ {
public class HealthCheck public class QueryPlatformCheck
{ {
public static Task WriteResponse(HttpContext context, HealthReport result) public static Task WriteResponse(HttpContext context, HealthReport result)
{ {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
using System.Security.Claims; using System.Security.Claims;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Health.Api.Infrastructure.Hubs namespace QueryPlatform.Api.Infrastructure.Hubs
{ {
[Authorize] [Authorize]
public class NotificationHub : Hub public class NotificationHub : Hub
......
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using QueryPlatform.Api.Infrastructure.Queries;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Test.Web.Host.Model
{
public class Job : BackgroundService
{
private readonly DrugqueryQueries _drugqueryQueries;
private readonly HomeQueries _homeQueries;
private readonly ILogger<Job> _logger;
public Job(ILogger<Job> logger, DrugqueryQueries drugqueryQueries, HomeQueries homeQueries)
{
_logger = logger;
_drugqueryQueries = drugqueryQueries;
_homeQueries = homeQueries;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
await new TaskFactory().StartNew(() =>
{
try
{
var day = DateTime.Now.Day;
var time = DateTime.Now.ToString("HH:mm:ss");
if (day == 8 && time == "09:39:01")
{
// _drugqueryQueries.定时执行();
_homeQueries.SendMail("定时任务", "人群检索表 化验检查检索表合并成功");
}
}
catch (Exception e)
{
_homeQueries.SendMail("定时任务", "人群检索表 化验检查检索表合并失败。 错误日志:" + e.ToString());
throw;
}
Thread.Sleep(1 * 1000);
});
}
}
}
}
\ No newline at end of file
using Health.Infra; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using QueryPlatform.Infra;
namespace Health.Api.Infrastructure namespace QueryPlatform.Api.Infrastructure
{ {
public class JsonHelper : IJsonConverter public class JsonHelper : IJsonConverter
{ {
...@@ -11,12 +12,30 @@ public class JsonHelper : IJsonConverter ...@@ -11,12 +12,30 @@ public class JsonHelper : IJsonConverter
public JsonHelper(IOptions<MvcNewtonsoftJsonOptions> options) public JsonHelper(IOptions<MvcNewtonsoftJsonOptions> options)
{ {
_serializerSettings = options.Value.SerializerSettings; IsoDateTimeConverter datetimeConverter = new IsoDateTimeConverterContent
}
public T Deserialize<T>(string json)
{ {
return JsonConvert.DeserializeObject<T>(json, _serializerSettings); DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
};
_serializerSettings = new JsonSerializerSettings
{
MissingMemberHandling = MissingMemberHandling.Ignore,
NullValueHandling = NullValueHandling.Ignore,
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
};
_serializerSettings.Converters.Add(datetimeConverter);
_serializerSettings.ContractResolver = new LowercaseContractResolver();
_serializerSettings = options.Value.SerializerSettings;
} }
//public static T Deserialize<T>(string json)
//{
// return JsonConvert.DeserializeObject<T>(json);
//}
/// <summary>
/// 将指定的 JSON 数据反序列化成指定对象。
/// </summary>
/// <typeparam name="T">对象类型。</typeparam>
/// <param name="json">JSON 数据。</param>
/// <returns></returns>
public string Serialize(object @object) public string Serialize(object @object)
{ {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Health.Api.Infrastructure.Middlewares namespace QueryPlatform.Api.Infrastructure.Middlewares
{ {
/// <summary> /// <summary>
/// 解码中间件 /// 解码中间件
......
using EasyCaching.Core; using EasyCaching.Core;
using Health.Infra;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Newtonsoft.Json; using Newtonsoft.Json;
using QueryPlatform.Infra;
using System; using System;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Health.Api.Infrastructure.Middlewares namespace QueryPlatform.Api.Infrastructure.Middlewares
{ {
/// <summary> /// <summary>
/// 解码中间件 /// 解码中间件
......
using Microsoft.AspNetCore.Http;
using System;
namespace QueryPlatform.Api.Infrastructure.Modules
{
public class SYS_DEMAND
{
/// <summary>
/// ID
/// </summary>
public int id { get; set; }
/// <summary>
/// indexs
/// </summary>
public long INDEXS { get; set; }
/// <summary>
/// 需求描述
/// </summary>
public string Demand_Describe { get; set; }
/// <summary>
/// 需求名称
/// </summary>
public string Demand_Name { get; set; }
/// <summary>
/// 需求者
/// </summary>
public string Demand_User { get; set; }
}
public class SYS_DEMANDSUBLIS
{
/// <summary>
/// ID
/// </summary>
public int id { get; set; }
public IFormFile file { get; set; }
/// <summary>
/// 上传人
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
}
public class 服务器
{
public string 服务器ip { get; set; }
public string 数据库账号 { get; set; }
public string 数据库密码 { get; set; }
}
public class SYS_Hospital
{
public int id { get; set; }
public string HosName { get; set; }
public string ExecOpenLink { get; set; }
public string ExecDatabase { get; set; }
public string DataLoginName { get; set; }
public string DataPassword { get; set; }
}
public class MEDIC_SEARCH_RECORD
{
public int id { get; set; }
public DateTime end_time { get; set; }
}
public class SYS_Cs
{
public int id { get; set; }
public string MEDIC_AREA { get; set; }
public string item_name { get; set; }
public string GENERIC_NAME { get; set; }
public string PROJECT_NAME { get; set; }
public string DISEASE_NAME { get; set; }
public string icd { get; set; }
}
public class SYS_EstablishFlowDatabaseTable
{
public int id { get; set; }
public string tableName { get; set; }
public string sql { get; set; }
public string remarks { get; set; }
}
public class COMMONLYUSED
{
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 函数内容
/// </summary>
public string value { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remarks { get; set; }
}
public class SYS_YIYUAN
{
public long hosid { get; set; }
public string hosname { get; set; }
}
public class DATAEXTRACT
{
public long HOS_ID { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime START_TIME { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime END_TIME { get; set; }
/// <summary>
/// 备注信息
/// </summary>
public string REMARK { get; set; }
}
public class SYS_EXTRACT
{
/// <summary>
/// 医院编号
/// </summary>
public long HOS_ID { get; set; }
/// <summary>
/// 服务器
/// </summary>
public string SERVER { get; set; }
/// <summary>
/// 数据库名称
/// </summary>
public string NAME { get; set; }
/// <summary>
/// 医院名称
/// </summary>
public string HOS_NAME { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime START_TIME { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime END_TIME { get; set; }
/// <summary>
/// 备注信息
/// </summary>
public string REMARK { get; set; }
/// <summary>
/// 执行人
/// </summary>
public string Executor { get; set; }
}
public class PUB_PATIENT
{
public long 病人编码 { get; set; }
public string 医院病人编码 { get; set; }
public string 性别 { get; set; }
public string 出生日期 { get; set; }
public string 标准地域 { get; set; }
public string 民族 { get; set; }
public string 国籍 { get; set; }
public long 创建机构 { get; set; }
public string 病人主索引 { get; set; }
}
public class OUT_REG_INFO
{
public long 挂号序号 { get; set; }
public string 医院挂号序号 { get; set; }
public long 病人编码 { get; set; }
public string 医院病人编码 { get; set; }
public string 挂号时间 { get; set; }
public string 医院挂号科室 { get; set; }
public string 医院科室名称 { get; set; }
public string 医保类型 { get; set; }
public string 急诊_门诊 { get; set; }
public string 标准一级诊断 { get; set; }
public string 标准科室 { get; set; }
public long 创建机构 { get; set; }
public string 上传时间 { get; set; }
public string 是否医保 { get; set; }
public string 总费用 { get; set; }
public string 自付费用 { get; set; }
}
public class OUT_PRES
{
public long 处方编号 { get; set; }
public string 医院处方编号 { get; set; }
public long 挂号序号 { get; set; }
public string 医院挂号序号 { get; set; }
public string 组号 { get; set; }
public string 处方序号 { get; set; }
public string 处方时间 { get; set; }
public string 处方类型 { get; set; }
public string 药品代码 { get; set; }
public string 药品分类 { get; set; }
public string 药品通用名称 { get; set; }
public string 药品名称 { get; set; }
public string 药品剂型 { get; set; }
public string 药品规格 { get; set; }
public string 药品产地 { get; set; }
public string 每次用量 { get; set; }
public string 用量单位 { get; set; }
public string 用法编码 { get; set; }
public string 给药方式 { get; set; }
public string 配药天数 { get; set; }
public string 配药数量 { get; set; }
public string 配药单位 { get; set; }
public string 皮试结果 { get; set; }
public string 用药备注 { get; set; }
public string 医保分类 { get; set; }
public string 创建机构 { get; set; }
}
public class OUT_FEE
{
public long 收费号 { get; set; }
public string 上传收费号 { get; set; }
public long 挂号序号 { get; set; }
public string 医院挂号序号 { get; set; }
public string 项目种类 { get; set; }
public string 上传费用代码 { get; set; }
public string 费用名称 { get; set; }
public string 单价 { get; set; }
public string 费用类别 { get; set; }
public string 数量 { get; set; }
public string 单位 { get; set; }
public string 金额 { get; set; }
public string 科室编码 { get; set; }
public string 科室名称 { get; set; }
public string 收费日期 { get; set; }
public long 创建机构 { get; set; }
public string 标准分类名称 { get; set; }
public string 药品产地 { get; set; }
public string 执行科室编码 { get; set; }
public string 执行科室名称 { get; set; }
}
public class OUT_DIAG
{
public long 诊断序号 { get; set; }
public string 医院诊断序号 { get; set; }
public long 挂号序号 { get; set; }
public string 医院挂号序号 { get; set; }
public string 诊断编号 { get; set; }
public string 诊断编码 { get; set; }
public string 疾病名称 { get; set; }
public string 诊断日期 { get; set; }
public string 备注 { get; set; }
public long 创建机构 { get; set; }
}
public class INPAT_REG_INFO
{
public long 住院序号 { get; set; }
public string 医院住院序号 { get; set; }
public long 病人编码 { get; set; }
public string 医院病人编号 { get; set; }
public string 上传入院科室 { get; set; }
public string 入院科室名称 { get; set; }
public string 病区名称 { get; set; }
public string 入院时间 { get; set; }
public string 出院时间 { get; set; }
public string 医保类型 { get; set; }
public string 身高 { get; set; }
public string 体重 { get; set; }
public string 入院情况 { get; set; }
public string 出院情况 { get; set; }
public string 标准一级诊断 { get; set; }
public string 标准科室 { get; set; }
public string 创建机构 { get; set; }
public string 是否医保 { get; set; }
public string 腰围 { get; set; }
public string 总费用 { get; set; }
public string 自付费用 { get; set; }
public string 出院科室编码 { get; set; }
public string 出院科室名称 { get; set; }
public string 住院病人的来源 { get; set; }
}
public class INPAT_ORDER
{
public long 医嘱序号 { get; set; }
public string 上传医嘱序号 { get; set; }
public long 住院序号 { get; set; }
public string 医院住院序号 { get; set; }
public string 医嘱类型 { get; set; }
public string 项目种类 { get; set; }
public string 费用代码 { get; set; }
public string 费用名称 { get; set; }
public string 皮试结果 { get; set; }
public string 药品规格 { get; set; }
public string 每次剂量 { get; set; }
public string 剂量单位 { get; set; }
public string 用量个数 { get; set; }
public string 用量单位 { get; set; }
public string 药品用法 { get; set; }
public string 给药方式 { get; set; }
public string 配药数量 { get; set; }
public double 单价 { get; set; }
public string 医嘱天数 { get; set; }
public string 开始服药日期 { get; set; }
public string 结束服药日期 { get; set; }
public long 用药天数 { get; set; }
public string 备注 { get; set; }
public long 创建机构 { get; set; }
public string 药品产地 { get; set; }
}
public class INPAT_FEE
{
public long 收费号 { get; set; }
public string 医院收费序号 { get; set; }
public string 费用类别 { get; set; }
public long 住院序号 { get; set; }
public string 医院住院序号 { get; set; }
public string 项目种类 { get; set; }
public string 医院费用代码 { get; set; }
public string 费用名称 { get; set; }
public string 单价 { get; set; }
public string 数量 { get; set; }
public string 药量单位 { get; set; }
public string 金额 { get; set; }
public string 收费日期 { get; set; }
public string 科室编码 { get; set; }
public string 科室名称 { get; set; }
public long 创建机构 { get; set; }
public string 标准分类名称 { get; set; }
public string 药品产地 { get; set; }
public string 执行科室编码 { get; set; }
public string 执行科室名称 { get; set; }
}
public class INPAT_DIAG
{
public long 诊断序号 { get; set; }
public string 医院诊断序号 { get; set; }
public long 住院序号 { get; set; }
public string 医院住院序号 { get; set; }
public string 诊断编号 { get; set; }
public string 编码 { get; set; }
public string 疾病名称 { get; set; }
public string 备注 { get; set; }
public string 诊断类型 { get; set; }
public string 诊断时间 { get; set; }
public string 治愈状态 { get; set; }
public long 创建机构 { get; set; }
}
public class EXEC_REPORT
{
public long 报告单编号 { get; set; }
public string 医院报告编号 { get; set; }
public long 病人序号 { get; set; }
public string 医院病人序号 { get; set; }
public long 医嘱序号 { get; set; }
public string 医院医嘱序号 { get; set; }
public string 简要病史 { get; set; }
public string 项目名称 { get; set; }
public string 诊断表现 { get; set; }
public string 诊断结论 { get; set; }
public string 报告时间 { get; set; }
public long 患者来源 { get; set; }
public long 创建机构 { get; set; }
}
public class ASSAY_REPORT
{
public long 化验报告编码 { get; set; }
public string 医院报告编码 { get; set; }
public long 病人序号 { get; set; }
public string 医院病人序号 { get; set; }
public string 报告时间 { get; set; }
public string 标本类型 { get; set; }
public string 化验项目代码 { get; set; }
public string 项目名称 { get; set; }
public string 项目e文名 { get; set; }
public string 结构单位 { get; set; }
public string 结果单位 { get; set; }
public string 参考范围 { get; set; }
public string 结果状态 { get; set; }
public long 患者来源 { get; set; }
public long 创建机构 { get; set; }
}
public class OPS_INFO
{
public long 手术编号 { get; set; }
public string 医院手术编号 { get; set; }
public long 住院序号 { get; set; }
public string 医院住院序号 { get; set; }
public long 医嘱序号 { get; set; }
public string 医院医嘱序号 { get; set; }
public string 医院费用编码 { get; set; }
public string 手术名称 { get; set; }
public string 术前诊断 { get; set; }
public string 手术结果 { get; set; }
public string 手术等级 { get; set; }
public string 手术创口等级 { get; set; }
public string 手术开始时间 { get; set; }
public string 手术结束时间 { get; set; }
public string 科室编码 { get; set; }
public string 科室名称 { get; set; }
public string 愈合程度 { get; set; }
public string 麻醉方式 { get; set; }
public string 择期手术 { get; set; }
public long 创建机构 { get; set; }
public string 手术操作编码 { get; set; }
public string 标准手术名称 { get; set; }
public string 标准手术操作编码 { get; set; }
}
public class PUBPATIENT
{
public string MASTER_INDEX { get; set; }
public string HOS_ID { get; set; }
}
public class SYS_LOG
{
public int id { get; set; }
public long INDEXS { get; set; }
public string HOS_CODE { get; set; }
public string IP { get; set; }
public string HOS { get; set; }
public string LOG { get; set; }
public DateTime CreateDate { get; set; }
public string type { get; set; }
public string 错误sql { get; set; }
}
public class DateExploration
{
public int id { get; set; }
public int Id { get; internal set; }
public string Name1 { get; set; }
public string Name2 { get; set; }
public string Name3 { get; set; }
public string Name4 { get; set; }
public string Name5 { get; set; }
public string Name6 { get; set; }
public string Name7 { get; set; }
public string Name8 { get; set; }
public string Name9 { get; set; }
public string Name10 { get; set; }
}
public class DES
{
public int id { get; set; }
public int IsAssay { get; set; }
}
public class Sys_cs
{
public string zxr { get; set; }
public int hosid { get; set; }
public int num { get; set; }
}
public class SYS_Drugquery
{
/// <summary>
/// 1 命中查询 2全部查询
/// </summary>
public int type1_2 { get; set; }
public int typefee { get; set; }
/// <summary>
/// ICD编码
/// </summary>
public string[] icd { get; set; }
/// <summary>
/// 疾病名称
/// </summary>
public string[] diseaseName { get; set; }
/// <summary>
/// 药品名称
/// </summary>
public string[] drugName { get; set; }
/// <summary>
/// 材料名称
/// </summary>
public string[] materialName { get; set; }
/// <summary>
/// 项目名称
/// </summary>
public string peojectName { get; set; }
}
public class abc
{
public string 疾病史 { get; set; }
public string 传染病史 { get; set; }
public string 手术史外伤史 { get; set; }
public string 过敏史 { get; set; }
public string 重要药物应用史 { get; set; }
public string 预防接种史 { get; set; }
public string 输血史 { get; set; }
}
public class aaaa
{
public string zyh { get; set; }
public string jws { get; set; }
}
}
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Health.Api.Infrastructure.Modules namespace QueryPlatform.Api.Infrastructure.Modules
{ {
[Table("SYS_USER")] [Table("SYS_USER")]
public class SYS_USER public class SYS_USER
{ {
[Key] [Key]
public long ID { get; set; } public int id { get; set; }
public DateTime CreateDate { get; set; } public DateTime CreateDate { get; set; }
public string RealName { get; set; } public string RealName { get; set; }
public string Login { get; set; } public string Login { get; set; }
...@@ -25,4 +25,19 @@ public class SYS_USER ...@@ -25,4 +25,19 @@ public class SYS_USER
public bool IsDelete { get; set; } public bool IsDelete { get; set; }
public bool IsDisable { get; set; } public bool IsDisable { get; set; }
} }
[Table("Mailboxs")]
public class Mailboxs
{
public string mailbox { get; set; }
public string password { get; set; }
public long type { get; set; }
public string UserName { get; set; }
public string UserNames { get; set; }
public string jurisdiction { get; set; }
}
public class user
{
public string UserName { get; set; }
}
} }
using System; using System;
namespace Health.Api.Infrastructure namespace QueryPlatform.Api.Infrastructure
{ {
public class Notification public class Notification
{ {
public Notification(int userId, string method, PushContent body) public Notification(long userId, string method, PushContent body)
{ {
UserId = userId; UserId = userId;
Method = method; Method = method;
Body = body; Body = body;
} }
public int UserId { get; set; } public long UserId { get; set; }
public string Method { get; set; } public string Method { get; set; }
public PushContent Body { get; set; } public PushContent Body { get; set; }
......
using System.Collections.Generic; using System.Collections.Generic;
namespace Health.Api.Infrastructure namespace QueryPlatform.Api.Infrastructure
{ {
public class Page public class Page
{ {
public Page() : this(1, 30) { } public Page() : this(1, 30) { }
public Page(int index) : this(index, 30) { } public Page(long index) : this(index, 30) { }
public Page(int index, int size) public Page(long index, long size)
{ {
Index = index; Index = index;
Size = size; Size = size;
...@@ -16,29 +16,29 @@ public Page(int index, int size) ...@@ -16,29 +16,29 @@ public Page(int index, int size)
/// <summary> /// <summary>
/// 页码 /// 页码
/// </summary> /// </summary>
public int Index { get; set; } public long Index { get; set; }
/// <summary> /// <summary>
/// 页行数 默认30 /// 页行数 默认30
/// </summary> /// </summary>
public int Size { get; set; } public long Size { get; set; }
} }
public class Page<TEntity> : Page public class Page<TEntity> : Page
{ {
public Page(int total, IEnumerable<TEntity> data) public Page(long total, IEnumerable<TEntity> data)
{ {
Total = total; Total = total;
Data = data; Data = data;
} }
public Page(int index, int size, int total, IEnumerable<TEntity> data) public Page(long index, long size, long total, IEnumerable<TEntity> data)
: base(index, size) : base(index, size)
{ {
Total = total; Total = total;
Data = data; Data = data;
} }
public int Total { get; set; } public long Total { get; set; }
public IEnumerable<TEntity> Data { get; set; } public IEnumerable<TEntity> Data { get; set; }
} }
} }
using Dapper; using Dapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
//using Health.Api.Infrastructure.Models; using QueryPlatform.Api.Infrastructure.Modules;
using Health.Api.Infrastructure.Modules;
using Health.Api.Infrastructure.Request;
using Health.Infra;
using StackExchange.Profiling;
using StackExchange.Profiling.Data;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.Common; using System.Data.Common;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
using static UtilExtensions;
namespace Health.Api.Infrastructure.Queries namespace QueryPlatform.Api.Infrastructure.Queries
{ {
public class AnalysisQueries public class AnalysisQueries
{ {
private readonly string _Connection156; private readonly string _Connection156;
private readonly string _configConnectionString; private readonly string _configConnectionString;
//private List<Common> a;
bool state = true;
public AnalysisQueries(string Connection156, string configConnectionString) public AnalysisQueries(string Connection156, string configConnectionString)
{ {
_Connection156 = Connection156; _Connection156 = Connection156;
_configConnectionString = configConnectionString; _configConnectionString = configConnectionString;
} }
public DbConnection Connection(int ip, string y = "", string t = "")
//Inquire
/// <summary>
///医院展示
/// </summary>
public IEnumerable<dynamic> HosListInquire(string hos_name, int hos_id)
{ {
using (DbConnection connection = new SqlConnection(_Connection156)) if (ip == 156)
{ {
string where = " "; return new SqlConnection((y == "") ? _Connection156 : _Connection156.Replace(y, t));
if (!string.IsNullOrEmpty(hos_name))
{
where = where + " and [HosName] like '%" + hos_name + "%'";
} }
if (hos_id != 0) if (ip == 181)
{ {
where = where + " and id =" + hos_id; return new SqlConnection((y == "") ? _configConnectionString : _configConnectionString.Replace(y, t));
} }
var query = @" SELECT [ID] 编号,[CODE] 编码,[HosName] 医院名称,[HosLevel] 医院等级,[HosType] 医院类型,[ExecOpenLink] 服务器,[ExecDatabase] 数据库, Replace([Province],' ','') 省份, Replace([Region],' ','') 市, Replace([City],' ','') 区 return new SqlConnection();
FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] where id<>1 " + where;
return connection.Query(query).ToList();
} }
public DbConnection Connection(int ip, string configConnectionString)
{
if (ip == 0)
{
return new SqlConnection(configConnectionString);
} }
return new SqlConnection();
public (IEnumerable<dynamic>, IEnumerable<dynamic>) HosListInquire(int paseIndex, string hos_name, int hos_id) }
public IEnumerable<dynamic> JxLx()
{ {
using (DbConnection connection = new SqlConnection(_Connection156)) var query = @" SELECT [id] ,[Remarks] FROM [SV_QueryPlatform].[dbo].[AnalyticMethodList]";
return Connection(181).Query(query).ToList();
}
public (IEnumerable<dynamic>, IEnumerable<dynamic>) HosListInquire(int paseIndex, string hos_name, int? hos_id)
{ {
string where = " "; string where = " ";
if (!string.IsNullOrEmpty(hos_name)) if (!string.IsNullOrEmpty(hos_name))
{ {
where = where + " and [HosName] like '%" + hos_name + "%'"; where = where + " and [HosName] like '%" + hos_name + "%'";
} }
if (hos_id != 0) if (hos_id != null)
{ {
where = where + " and id =" + hos_id; where = where + " and id =" + hos_id;
} }
IEnumerable<dynamic> sj = connection.Query($@"select*FROM( IEnumerable<dynamic> sj = Connection(181).Query($@"select*FROM(
SELECT ROW_NUMBER() OVER(ORDER BY getdate())AS id,* FROM( SELECT ROW_NUMBER() OVER(ORDER BY ts desc,解析 )AS id,* FROM(SELECT
SELECT DISTINCT A.[ID] 编号,[HosName] 医院名称,[HosLevel] 医院等级,[HosType] 医院类型,[ExecOpenLink] 服务器,[ExecDatabase] 数据库, Replace([Province],' ','') 省份,
[ID] 编号,[CODE] 编码,[HosName] 医院名称,[HosLevel] 医院等级,[HosType] 医院类型,[ExecOpenLink] 服务器,[ExecDatabase] 数据库, Replace([Province],' ','') 省份, Replace([Region],' ','') 市, Replace([City],' ','') 区, (SELECT concat('执行人:',czr,' 当前状态:',status,case when ts <>'' and ts is not null then concat(' 提示:',ts) else '' end ) FROM [dbo].[解析任务] where hos_id =a.id
Replace([Region],' ','') 市, Replace([City],' ','') 区 and ksdate=(select max(ksdate ) from [dbo].[解析任务] where hos_id =a.id)) 解析日志 ,
FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] WHERE id<>1 { where} )a )b WHERE id<={paseIndex}*10 and id>({paseIndex} - 1)*10 ").ToList(); case
IEnumerable<dynamic> zon = connection.Query($@" SELECT CAST(COUNT(*)AS MONEY)totalCount ,{paseIndex} paseIndex FROM( when (SELECT status FROM [SV_QueryPlatform].[dbo].[解析任务] where hos_id =a.id and ksdate=(select max(ksdate ) from [dbo].[解析任务] where hos_id =a.id)) is null then 1
when (SELECT status FROM [SV_QueryPlatform].[dbo].[解析任务] where hos_id =a.id and ksdate=(select max(ksdate ) from [dbo].[解析任务] where hos_id =a.id))in ('执行完成','执行失败') then 1
else 0 end 解析,
case
when (SELECT ts FROM [SV_QueryPlatform].[dbo].[解析任务] where hos_id =a.id and ksdate=(select max(ksdate ) from [dbo].[解析任务] where hos_id =a.id)) like '%category未分类%' then 1
else 0 end ts
FROM [192.168.18.156].[DB_SV_Data_Config].[dbo].[SYS_Hospital] A
WHERE A.id<>1 and ExecOpenLink is not null and ExecDatabase is not null and
ExecOpenLink !='' and ExecDatabase !='' {where} )a )b WHERE id<={paseIndex}*10 and id>({paseIndex} - 1)*10 ").ToList();
IEnumerable<dynamic> zon = Connection(181).Query($@" SELECT CAST(COUNT(*)AS MONEY)totalCount ,{paseIndex} paseIndex FROM(
SELECT DISTINCT * SELECT DISTINCT *
FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] WHERE id<>1 " + where + ")a").ToList(); FROM [192.168.18.156].[DB_SV_Data_Config].[dbo].[SYS_Hospital] WHERE id<>1 and ExecOpenLink is not null and ExecDatabase is not null and
ExecOpenLink !='' and ExecDatabase !='' { where })a").ToList();
return (sj, zon); return (sj, zon);
} }
return (null, null); public void updatezt(int id, int hos_id, string log, string ts)
}
private void updatezt(int id, int hos_id, string status, string log)
{ {
using (DbConnection configConnection = new SqlConnection(_configConnectionString)) Connection(181).Execute(@$" insert into [SV_QueryPlatform].[dbo].[SYS_LOG_解析] ([INDEXS],[hos_code],[LOG],[CreateDate]) select '{id}','{hos_id}','{log}',getdate()");
{ Connection(181).Execute(@$"update [SV_QueryPlatform].[dbo].[解析任务] set [updatedate]=getdate(),log='{log}',ts=concat(ts,'','{(ts == null ? "" : ts)}') where hos_id={hos_id} and id={id}");
configConnection.Execute(@$"update [SV_QueryPlatform].[dbo].[解析任务] set [status]='{status}',[updatedate]=getdate(),log='{log}' where hos_id={hos_id} and id={id}");
} }
public void updateztZ(int id, int hos_id, string status)
{
Connection(181).Execute(@$" insert into [SV_QueryPlatform].[dbo].[SYS_LOG_解析] ([INDEXS],[hos_code],[LOG],[CreateDate]) select '{id}','{hos_id}','{status}',getdate()");
Connection(181).Execute(@$"update [SV_QueryPlatform].[dbo].[解析任务] set [status]='{status}',[updatedate]=getdate() where hos_id={hos_id} and id={id}");
} }
//1.解析执行sql /// <summary>
/// 解析执行sql
/// </summary>
/// <param name="sql"></param>
/// <param name="hos_id"></param>
/// <param name="id"></param>
/// <param name="hos"></param>
private void JX_zx(string sql, int hos_id, int id, SYS_Hospital hos) private void JX_zx(string sql, int hos_id, int id, SYS_Hospital hos)
{ {
DbConnection configConnection = new SqlConnection(_configConnectionString);
服务器 fwq = configConnection.Query<服务器>($"SELECT [服务器ip],[数据库账号],[数据库密码] FROM[SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{hos.ExecOpenLink}'").FirstOrDefault(); 服务器 fwq = Connection(181).Query<服务器>($"SELECT [服务器ip],[数据库账号],[数据库密码] FROM[SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{hos.ExecOpenLink}'").FirstOrDefault();
var msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", hos.ExecOpenLink, hos.ExecDatabase, fwq.数据库账号, fwq.数据库密码); var msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", hos.ExecOpenLink, hos.ExecDatabase, fwq.数据库账号, fwq.数据库密码);
// DefaultConnection // DefaultConnection
using (DbConnection conn = new SqlConnection(msConnectionString))
{
try try
{ {
conn.Execute(sql, commandTimeout: 60 * 60 * 12); Connection(0, msConnectionString).Execute(sql, commandTimeout: 60 * 60 * 12);
} }
catch (Exception e) catch (Exception ex)
{ {
configConnection.Execute(@$"update [SV_QueryPlatform].[dbo].[解析任务] set [status]='失败',[updatedate]=getdate() where hos_id={hos_id} and id={id}"); Connection(181).Execute(@$"update [SV_QueryPlatform].[dbo].[解析任务] set [status]='失败',[updatedate]=getdate() where hos_id={hos_id} and id={id}");
} throw;
} }
} }
//1.解析执行sql返回数字 /// <summary>
/// 解析执行sql返回数字
/// </summary>
/// <param name="sql"></param>
/// <param name="hos_id"></param>
/// <param name="id"></param>
/// <param name="hos"></param>
/// <returns></returns>
private int JX_zx_int(string sql, int hos_id, int id, SYS_Hospital hos) private int JX_zx_int(string sql, int hos_id, int id, SYS_Hospital hos)
{ {
DbConnection configConnection = new SqlConnection(_configConnectionString); 服务器 fwq = Connection(181).Query<服务器>($"SELECT [服务器ip],[数据库账号],[数据库密码] FROM[SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{hos.ExecOpenLink}'").FirstOrDefault();
服务器 fwq = configConnection.Query<服务器>($"SELECT [服务器ip],[数据库账号],[数据库密码] FROM[SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{hos.ExecOpenLink}'").FirstOrDefault();
var msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", hos.ExecOpenLink, hos.ExecDatabase, fwq.数据库账号, fwq.数据库密码); var msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", hos.ExecOpenLink, hos.ExecDatabase, fwq.数据库账号, fwq.数据库密码);
// DefaultConnection // DefaultConnection
using (DbConnection conn = new SqlConnection(msConnectionString))
{
try try
{ {
return conn.Query<hosid>(sql).FirstOrDefault().id; int num = Connection(0, msConnectionString).Query<int>(sql, 60 * 60 * 12).FirstOrDefault();
return num;
} }
catch (Exception e) catch (Exception)
{ {
configConnection.Execute(@$"update [SV_QueryPlatform].[dbo].[解析任务] set [status]='失败',[updatedate]=getdate(),log=[status]+{sql} where hos_id={hos_id} and id={id}"); Connection(181).Execute(@$"update [SV_QueryPlatform].[dbo].[解析任务] set [status]='失败',[updatedate]=getdate(),log=[status]+{sql} where hos_id={hos_id} and id={id}");
} }
return 0; return 0;
} }
} /// <summary>
/// 生成一条解析记录
/// </summary>
//生成一条解析记录 /// <param name="hos_id"></param>
/// <param name="czr"></param>
/// <returns></returns>
public int JX_SCJXJL(int hos_id, string czr) public int JX_SCJXJL(int hos_id, string czr)
{ {
var sql = ""; var sql = @$" insert into [dbo].[解析任务]( [updatedate], [status], [ksdate], [hos_id], [czr])VALUES(getdate(),'开始解析',getdate(),{hos_id},'{czr}') ";
using (DbConnection configConnection = new SqlConnection(_configConnectionString)) // DefaultConnection Connection(181).Execute(sql, commandTimeout: 60 * 60 * 10);
{ return Connection(181).Query<int>($@" select max(id)id from [dbo].[解析任务] where hos_id={hos_id} ").FirstOrDefault();
sql = @$" insert into [dbo].[解析任务]( [updatedate], [status], [ksdate], [hos_id], [czr])VALUES(getdate(),'开始解析',getdate(),{hos_id},'{czr}') ";
configConnection.Execute(sql, commandTimeout: 60 * 60 * 10);
return configConnection.Query<hosid>($@" select max(id)id from [dbo].[解析任务] where hos_id={hos_id} ").FirstOrDefault().id;
} }
return 0; /// <summary>
/// 默认
/// </summary>
/// <param name="id"></param>
/// <param name="hos_id"></param>
public void JX_MR(int id, int hos_id)
{
updatezt(id, hos_id, "", null);
} }
//1.更新id org_code m_index /// <summary>
/// 更新id org_code m_index
/// </summary>
/// <param name="id"></param>
/// <param name="hos_id"></param>
public void JX_GXID(int id, int hos_id) public void JX_GXID(int id, int hos_id)
{ {
var sql = ""; var sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
SYS_Hospital hos = new SYS_Hospital(); SYS_Hospital hos = Connection(156).Query<SYS_Hospital>(sql).FirstOrDefault();
using (DbConnection connection156 = new SqlConnection(_Connection156))
{
updatezt(id, hos_id, "处理org_code", "");
sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
hos = connection156.Query<SYS_Hospital>(sql).FirstOrDefault();
}
sql = @$" update [{hos.ExecDatabase}].[dbo].[ASSAY_REPORT] set org_code={hos_id} where org_code<>{hos_id} sql = @$" update [{hos.ExecDatabase}].[dbo].[ASSAY_REPORT] set org_code={hos_id} where org_code<>{hos_id}
update [{hos.ExecDatabase}].[dbo].[DIC_DEPT] set org_code={hos_id} where org_code<>{hos_id} update [{hos.ExecDatabase}].[dbo].[DIC_DEPT] set org_code={hos_id} where org_code<>{hos_id}
update [{hos.ExecDatabase}].[dbo].[DIC_DIAG] set org_code={hos_id} where org_code<>{hos_id} update [{hos.ExecDatabase}].[dbo].[DIC_DIAG] set org_code={hos_id} where org_code<>{hos_id}
...@@ -172,32 +184,14 @@ public void JX_GXID(int id, int hos_id) ...@@ -172,32 +184,14 @@ public void JX_GXID(int id, int hos_id)
update [{hos.ExecDatabase}].[dbo].[OUT_FEE] set org_code={hos_id} where org_code<>{hos_id} update [{hos.ExecDatabase}].[dbo].[OUT_FEE] set org_code={hos_id} where org_code<>{hos_id}
update [{hos.ExecDatabase}].[dbo].[OUT_PRES] set org_code={hos_id} where org_code<>{hos_id} update [{hos.ExecDatabase}].[dbo].[OUT_PRES] set org_code={hos_id} where org_code<>{hos_id}
update [{hos.ExecDatabase}].[dbo].[OUT_REG_INFO] set org_code={hos_id} where org_code<>{hos_id}"; update [{hos.ExecDatabase}].[dbo].[OUT_REG_INFO] set org_code={hos_id} where org_code<>{hos_id}";
updatezt(id, hos_id, "处理org_code", sql); updatezt(id, hos_id, "修改org_code不等于医院id的数据" + sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
sql = $@"
SELECT (
SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[OUT_REG_INFO] A JOIN [{hos.ExecDatabase}].[dbo].[PUB_PATIENT] b ON A.PERSON_CODE=b.PERSON_CODE WHERE A.PERSON_ID!=b.PERSON_ID OR A.PERSON_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[OUT_DIAG] A JOIN [{hos.ExecDatabase}].[dbo].OUT_REG_INFO b ON A.REG_CODE=b.REG_CODE WHERE A.REG_ID!=b.REG_ID OR A.REG_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[OUT_FEE]A JOIN [{hos.ExecDatabase}].[dbo].OUT_REG_INFO b ON A.REG_CODE=b.REG_CODE WHERE A.REG_ID!=b.REG_ID OR A.REG_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[OUT_PRES]A JOIN [{hos.ExecDatabase}].[dbo].OUT_REG_INFO b ON A.REG_code=b.reg_code WHERE A.REG_ID!=b.REG_ID OR A.REG_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[inpat_REG_INFO] A JOIN [{hos.ExecDatabase}].[dbo].[PUB_PATIENT] b ON b.PERSON_CODE=a.PERSON_CODE WHERE A.PERSON_ID!=b.PERSON_ID OR A.PERSON_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[inpat_diag] A JOIN [{hos.ExecDatabase}].[dbo].[inpat_reg_info] b ON b.REG_CODE=a.REG_CODE WHERE A.REG_ID!=b.REG_ID OR A.REG_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[inpat_order] A JOIN [{hos.ExecDatabase}].[dbo].[inpat_reg_info] b ON b.REG_CODE=a.REG_CODE WHERE A.REG_ID!=b.REG_ID OR A.REG_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[inpat_fee] A JOIN [{hos.ExecDatabase}].[dbo].[inpat_reg_info] b ON b.REG_CODE=a.REG_CODE WHERE A.REG_ID!=b.REG_ID OR A.REG_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[ops_info] A JOIN [{hos.ExecDatabase}].[dbo].[inpat_reg_info] b ON b.REG_CODE=a.REG_CODE WHERE A.REG_ID!=b.REG_ID OR A.REG_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].EXEC_REPORT A JOIN [{hos.ExecDatabase}].[dbo].OUT_REG_INFO B ON a.REG_CODE=B.REG_CODE and REG_Source=1 WHERE A.REG_ID!=b.REG_ID OR A.REG_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[EXEC_REPORT] A JOIN [{hos.ExecDatabase}].[dbo].INPAT_REG_INFO B ON a.REG_CODE=B.REG_CODE and REG_Source=2 WHERE A.REG_ID!=b.REG_ID OR A.REG_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[ASSAY_REPORT] A JOIN [{hos.ExecDatabase}].[dbo].[OUT_REG_INFO] B ON a.REG_CODE=B.REG_CODE and REG_Source=1 WHERE A.REG_ID!=b.REG_ID OR A.REG_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[ASSAY_REPORT] A JOIN [{hos.ExecDatabase}].[dbo].[INPAT_REG_INFO] B ON a.REG_CODE=B.REG_CODE and REG_Source=2 WHERE A.REG_ID!=b.REG_ID OR A.REG_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[NIS_RECORD] A JOIN [{hos.ExecDatabase}].[dbo].[OUT_REG_INFO] B ON a.REG_CODE=B.REG_CODE and REG_Source=1 WHERE A.REG_ID!=b.REG_ID OR A.REG_ID IS NULL
)+(SELECT COUNT(1) FROM [{hos.ExecDatabase}].[dbo].[NIS_RECORD] A JOIN [{hos.ExecDatabase}].[dbo].[INPAT_REG_INFO] B ON a.REG_CODE=B.REG_CODE and REG_Source=2 WHERE A.REG_ID!=b.REG_ID OR A.REG_ID IS NULL
)id";
updatezt(id, hos_id, "检查id是否更新", sql);
//判断id是否修 //判断id是否修
//判断MASTER_INDEX是否修改 //判断MASTER_INDEX是否修改
sql = $@"SELECT COUNT(1)id FROM [{hos.ExecDatabase}].[dbo].PUB_PATIENT sql = $@"SELECT COUNT(1)id FROM [{hos.ExecDatabase}].[dbo].PUB_PATIENT
where MASTER_INDEX is null"; where MASTER_INDEX is null";
updatezt(id, hos_id, "更新MASTER_INDEX", "判断MASTER_INDEX是否修改" + sql.Replace("'", "''")); updatezt(id, hos_id, "判断MASTER_INDEX是否修改" + sql.Replace("'", "''"), null);
if (JX_zx_int(sql, hos_id, id, hos) > 0 && hos.ExecDatabase.Length == 13) if (JX_zx_int(sql, hos_id, id, hos) > 0 && hos.ExecDatabase.Length == 13)
{ {
sql = $@" IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'PATIENT') sql = $@" IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'PATIENT')
...@@ -208,13 +202,10 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'PATIEN ...@@ -208,13 +202,10 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'PATIEN
DROP TABLE [{hos.ExecDatabase}].dbo.PATIENT_STORE1 DROP TABLE [{hos.ExecDatabase}].dbo.PATIENT_STORE1
IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'PATIENT_STORE2') IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'PATIENT_STORE2')
DROP TABLE [{hos.ExecDatabase}].dbo.PATIENT_STORE2 DROP TABLE [{hos.ExecDatabase}].dbo.PATIENT_STORE2
CREATE TABLE [{hos.ExecDatabase}].dbo.PATIENT (PERSON_ID INT,ID_CARD NVARCHAR(max),CARD_ID NVARCHAR(max),NEWPERSON_ID INT) CREATE TABLE [{hos.ExecDatabase}].dbo.PATIENT (PERSON_ID int,ID_CARD NVARCHAR(max),CARD_ID NVARCHAR(max),NEWPERSON_ID int)
CREATE TABLE [{hos.ExecDatabase}].dbo.PATIENT_NOTNULL(PERSON_ID INT,CODE NVARCHAR(50),NEWPERSON_ID INT) CREATE TABLE [{hos.ExecDatabase}].dbo.PATIENT_NOTNULL(PERSON_ID int,CODE NVARCHAR(50),NEWPERSON_ID int)
CREATE TABLE [{hos.ExecDatabase}].dbo.PATIENT_STORE1(PERSON_ID INT,CODE NVARCHAR(50),NEWPERSON_ID INT) CREATE TABLE [{hos.ExecDatabase}].dbo.PATIENT_STORE1(PERSON_ID int,CODE NVARCHAR(50),NEWPERSON_ID int)
CREATE TABLE [{hos.ExecDatabase}].dbo.PATIENT_STORE2(PERSON_ID INT,CODE NVARCHAR(50),NEWPERSON_ID INT) CREATE TABLE [{hos.ExecDatabase}].dbo.PATIENT_STORE2(PERSON_ID int,CODE NVARCHAR(50),NEWPERSON_ID int)
CREATE NONCLUSTERED INDEX [INDEX_PATIENT] ON [{hos.ExecDatabase}].[dbo].[PATIENT]
([ID_CARD] ASC, [CARD_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
CREATE NONCLUSTERED INDEX [INDEX_PATIENT_NOTNULL] ON [{hos.ExecDatabase}].[dbo].[PATIENT_NOTNULL] ([CODE] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) CREATE NONCLUSTERED INDEX [INDEX_PATIENT_NOTNULL] ON [{hos.ExecDatabase}].[dbo].[PATIENT_NOTNULL] ([CODE] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
CREATE NONCLUSTERED INDEX [INDEX_PATIENT_STORE1] ON [{hos.ExecDatabase}].[dbo].[PATIENT_STORE1] ([CODE] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) CREATE NONCLUSTERED INDEX [INDEX_PATIENT_STORE1] ON [{hos.ExecDatabase}].[dbo].[PATIENT_STORE1] ([CODE] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
CREATE NONCLUSTERED INDEX [INDEX_PATIENT_STORE2] ON [{hos.ExecDatabase}].[dbo].[PATIENT_STORE2] ([CODE] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) CREATE NONCLUSTERED INDEX [INDEX_PATIENT_STORE2] ON [{hos.ExecDatabase}].[dbo].[PATIENT_STORE2] ([CODE] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
...@@ -225,14 +216,14 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'PATIEN ...@@ -225,14 +216,14 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'PATIEN
CREATE NONCLUSTERED INDEX [INDEX2_PATIENT_NOTNULL] ON [{hos.ExecDatabase}].[dbo].[PATIENT_NOTNULL] ([PERSON_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) CREATE NONCLUSTERED INDEX [INDEX2_PATIENT_NOTNULL] ON [{hos.ExecDatabase}].[dbo].[PATIENT_NOTNULL] ([PERSON_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
CREATE NONCLUSTERED INDEX [INDEX2_PATIENT_STORE1] ON [{hos.ExecDatabase}].[dbo].[PATIENT_STORE1] ([PERSON_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) CREATE NONCLUSTERED INDEX [INDEX2_PATIENT_STORE1] ON [{hos.ExecDatabase}].[dbo].[PATIENT_STORE1] ([PERSON_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
CREATE NONCLUSTERED INDEX [INDEX2_PATIENT_STORE2] ON [{hos.ExecDatabase}].[dbo].[PATIENT_STORE2] ([PERSON_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)"; CREATE NONCLUSTERED INDEX [INDEX2_PATIENT_STORE2] ON [{hos.ExecDatabase}].[dbo].[PATIENT_STORE2] ([PERSON_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)";
updatezt(id, hos_id, "更新MASTER_INDEX", "创建需要使用的表" + sql.Replace("'", "''")); updatezt(id, hos_id, "创建需要使用的表" + sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
//判断病人表中主索引列是否有值 //判断病人表中主索引列是否有值
sql = @$" SELECT CASE WHEN MAX(MASTER_INDEX) IS NULL THEN 0 ELSE MAX(MASTER_INDEX) END id FROM [{hos.ExecDatabase}].[DBO].PUB_PATIENT where MASTER_INDEX is not null; "; sql = @$" SELECT CASE WHEN MAX(MASTER_INDEX) IS NULL THEN 0 ELSE MAX(MASTER_INDEX) END id FROM [{hos.ExecDatabase}].[DBO].PUB_PATIENT where MASTER_INDEX is not null; ";
updatezt(id, hos_id, "更新MASTER_INDEX", "判断病人表中主索引列是否有值" + sql.Replace("'", "''")); updatezt(id, hos_id, "判断病人表中主索引列是否有值" + sql.Replace("'", "''"), null);
int COUNT = JX_zx_int(sql, hos_id, id, hos); int COUNT = JX_zx_int(sql, hos_id, id, hos);
sql = @$" SELECT COUNT(1) id FROM [{hos.ExecDatabase}].[DBO].PUB_PATIENT where MASTER_INDEX is null "; sql = @$" SELECT COUNT(1) id FROM [{hos.ExecDatabase}].[DBO].PUB_PATIENT where MASTER_INDEX is null ";
...@@ -251,19 +242,20 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'PATIEN ...@@ -251,19 +242,20 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'PATIEN
UNION UNION
SELECT DJ.PERSON_ID, CARD_ID FROM [{hos.ExecDatabase}].[DBO].[INPAT_REG_INFO] DJ GROUP BY DJ.PERSON_ID,CARD_ID) TA ) TAB1 SELECT DJ.PERSON_ID, CARD_ID FROM [{hos.ExecDatabase}].[DBO].[INPAT_REG_INFO] DJ GROUP BY DJ.PERSON_ID,CARD_ID) TA ) TAB1
ON TAB.PERSON_ID=TAB1.PERSON_ID GROUP BY TAB.PERSON_ID,ID_CARD,CARD_ID;"; ON TAB.PERSON_ID=TAB1.PERSON_ID GROUP BY TAB.PERSON_ID,ID_CARD,CARD_ID;";
updatezt(id, hos_id, "更新MASTER_INDEX", "将病人的医保号和身份证号集中放在一张表中" + sql.Replace("'", "''")); updatezt(id, hos_id, "将病人的医保号和身份证号集中放在一张表中" + sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
//获取最大的master_index的值 //获取最大的master_index的值
sql = @$" select case when max(NEWPERSON_ID) is null then 0 else max(NEWPERSON_ID) end id from [{hos.ExecDatabase}].[dbo].[PATIENT]"; sql = @$" select case when max(NEWPERSON_ID) is null then 0 else max(NEWPERSON_ID) end id from [{hos.ExecDatabase}].[dbo].[PATIENT]";
updatezt(id, hos_id, "更新MASTER_INDEX", "获取最大的master_index的值" + sql.Replace("'", "''")); updatezt(id, hos_id, "获取最大的master_index的值" + sql.Replace("'", "''"), null);
int mark = JX_zx_int(sql, hos_id, id, hos); int mark = JX_zx_int(sql, hos_id, id, hos);
//置空不符合规范的身份证号和医保号 //置空不符合规范的身份证号和医保号
//更新无医保号且无身份证号的病人 //更新无医保号且无身份证号的病人
sql = $@"IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'tablea') sql = $@"IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'tablea')
DROP TABLE [{hos.ExecDatabase}].dbo.tablea DROP TABLE [{hos.ExecDatabase}].dbo.tablea
UPDATE [{hos.ExecDatabase}].[dbo].PATIENT SET ID_CARD = NULL WHERE ID_CARD NOT LIKE '[0-9]%' OR LEN(ID_CARD)<=15 OR ID_CARD LIKE '%8888%' OR ID_CARD LIKE '%0000%' UPDATE [{hos.ExecDatabase}].[dbo].PATIENT SET ID_CARD = NULL WHERE ID_CARD NOT LIKE '[0-9]%' OR LEN(ID_CARD)<=15 OR ID_CARD LIKE '%8888%' OR ID_CARD LIKE '%00000%'
UPDATE [{hos.ExecDatabase}].[dbo].PATIENT SET CARD_ID = NULL WHERE CARD_ID NOT LIKE '[0-9]%' OR LEN(CARD_ID)<6 UPDATE [{hos.ExecDatabase}].[dbo].PATIENT SET CARD_ID = NULL WHERE CARD_ID NOT LIKE '[0-9]%' OR LEN(CARD_ID)<6
create table [{hos.ExecDatabase}].[dbo].tablea (id int primary key identity({COUNT + mark + 1},1),[code] nvarchar(200)) create table [{hos.ExecDatabase}].[dbo].tablea (id int primary key identity({COUNT + mark + 1},1),[code] nvarchar(200))
insert into [{hos.ExecDatabase}].[dbo].tablea(code) insert into [{hos.ExecDatabase}].[dbo].tablea(code)
...@@ -274,15 +266,17 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'PATIEN ...@@ -274,15 +266,17 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'PATIEN
UNION ALL UNION ALL
select PERSON_ID,CARD_ID CODE, NEWPERSON_ID from [{hos.ExecDatabase}].[dbo].PATIENT WHERE NEWPERSON_ID IS NULL select PERSON_ID,CARD_ID CODE, NEWPERSON_ID from [{hos.ExecDatabase}].[dbo].PATIENT WHERE NEWPERSON_ID IS NULL
drop table [{hos.ExecDatabase}].[dbo].tablea"; drop table [{hos.ExecDatabase}].[dbo].tablea";
updatezt(id, hos_id, "更新MASTER_INDEX", "置空不符合规范的身份证号和医保号&&更新无医保号且无身份证号的病人" + sql.Replace("'", "''")); updatezt(id, hos_id, "置空不符合规范的身份证号和医保号&&更新无医保号且无身份证号的病人" + sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
//递归更新身份证或者医保号相同的主索引 //递归更新身份证或者医保号相同的主索引
mark = (mark == 0) ? COUNT : mark;
sql = $@"IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'table2') sql = $@"IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'table2')
DROP TABLE [{hos.ExecDatabase}].dbo.table2 DROP TABLE [{hos.ExecDatabase}].dbo.table2
create table [{hos.ExecDatabase}].[DBO].table2 (id int primary key identity({mark + 1},1),[code] nvarchar(200)) create table [{hos.ExecDatabase}].[DBO].table2 (id int primary key identity({mark + 1},1),[code] nvarchar(200))
insert into [{hos.ExecDatabase}].[DBO].PATIENT_STORE1(PERSON_ID,CODE,NEWPERSON_ID)select PERSON_ID,CODE, NEWPERSON_ID from [{hos.ExecDatabase}].[DBO].PATIENT_NOTNULL insert into [{hos.ExecDatabase}].[DBO].PATIENT_STORE1(PERSON_ID,CODE,NEWPERSON_ID)select PERSON_ID,CODE, NEWPERSON_ID from [{hos.ExecDatabase}].[DBO].PATIENT_NOTNULL
DECLARE @COUNT INT WHILE 1=1 DECLARE @COUNT int WHILE 1=1
BEGIN BEGIN
truncate table [{hos.ExecDatabase}].[DBO].PATIENT_STORE2 truncate table [{hos.ExecDatabase}].[DBO].PATIENT_STORE2
insert into [{hos.ExecDatabase}].[DBO].PATIENT_STORE2 (PERSON_ID,CODE,NEWPERSON_ID) select A.PERSON_ID,B.CODE,B.PERSON_ID NEWPERSON_ID from [{hos.ExecDatabase}].[DBO].PATIENT_STORE1 A JOIN [{hos.ExecDatabase}].[DBO].PATIENT_NOTNULL B ON A.CODE = B.CODE GROUP BY A.PERSON_ID,B.PERSON_ID,b.CODE insert into [{hos.ExecDatabase}].[DBO].PATIENT_STORE2 (PERSON_ID,CODE,NEWPERSON_ID) select A.PERSON_ID,B.CODE,B.PERSON_ID NEWPERSON_ID from [{hos.ExecDatabase}].[DBO].PATIENT_STORE1 A JOIN [{hos.ExecDatabase}].[DBO].PATIENT_NOTNULL B ON A.CODE = B.CODE GROUP BY A.PERSON_ID,B.PERSON_ID,b.CODE
...@@ -290,44 +284,40 @@ UNION ALL ...@@ -290,44 +284,40 @@ UNION ALL
SELECT @COUNT=COUNT(1) FROM [{hos.ExecDatabase}].[DBO].PATIENT_STORE2 A LEFT JOIN [{hos.ExecDatabase}].[DBO].PATIENT_STORE1 B ON A.PERSON_ID = B.PERSON_ID and A.NEWPERSON_ID = B.NEWPERSON_ID AND A.CODE = B.CODE WHERE B.PERSON_ID IS NULL SELECT @COUNT=COUNT(1) FROM [{hos.ExecDatabase}].[DBO].PATIENT_STORE2 A LEFT JOIN [{hos.ExecDatabase}].[DBO].PATIENT_STORE1 B ON A.PERSON_ID = B.PERSON_ID and A.NEWPERSON_ID = B.NEWPERSON_ID AND A.CODE = B.CODE WHERE B.PERSON_ID IS NULL
IF @COUNT=0 BREAK IF @COUNT=0 BREAK
truncate table [{hos.ExecDatabase}].[DBO].PATIENT_STORE1 truncate table [{hos.ExecDatabase}].[DBO].PATIENT_STORE1
INSERT INTO [{hos.ExecDatabase}].[DBO].PATIENT_STORE1 (PERSON_ID,CODE,NEWPERSON_ID) SELECT PERSON_ID,CODE,NEWPERSON_ID FROM [{hos.ExecDatabase}].[DBO].PATIENT_STORE2 GROUP BY PERSON_ID,CODE,NEWPERSON_ID INSERT intO [{hos.ExecDatabase}].[DBO].PATIENT_STORE1 (PERSON_ID,CODE,NEWPERSON_ID) SELECT PERSON_ID,CODE,NEWPERSON_ID FROM [{hos.ExecDatabase}].[DBO].PATIENT_STORE2 GROUP BY PERSON_ID,CODE,NEWPERSON_ID
END END
insert into [{hos.ExecDatabase}].[DBO].table2(code) SELECT DISTINCT A.NEWPERSON_ID FROM [{hos.ExecDatabase}].[DBO].PATIENT_STORE2 A ORDER BY NEWPERSON_ID insert into [{hos.ExecDatabase}].[DBO].table2(code) SELECT DISTINCT A.NEWPERSON_ID FROM [{hos.ExecDatabase}].[DBO].PATIENT_STORE2 A ORDER BY NEWPERSON_ID
UPDATE [{hos.ExecDatabase}].[DBO].PATIENT_STORE2 SET NEWPERSON_ID = b.id from [{hos.ExecDatabase}].[DBO].table2 b where [{hos.ExecDatabase}].[DBO].[PATIENT_STORE2].NEWPERSON_ID = b.code UPDATE [{hos.ExecDatabase}].[DBO].PATIENT_STORE2 SET NEWPERSON_ID = b.id from [{hos.ExecDatabase}].[DBO].table2 b where [{hos.ExecDatabase}].[DBO].[PATIENT_STORE2].NEWPERSON_ID = b.code
update [{hos.ExecDatabase}].[DBO].[PATIENT] set NEWPERSON_ID = b.NEWPERSON_ID from (SELECT PERSON_ID,MIN(NEWPERSON_ID) NEWPERSON_ID FROM [{hos.ExecDatabase}].[DBO].PATIENT_STORE2 GROUP BY PERSON_ID) b where [{hos.ExecDatabase}].[DBO].[PATIENT].PERSON_ID = b.PERSON_ID update [{hos.ExecDatabase}].[DBO].[PATIENT] set NEWPERSON_ID = b.NEWPERSON_ID from (SELECT PERSON_ID,MIN(NEWPERSON_ID) NEWPERSON_ID FROM [{hos.ExecDatabase}].[DBO].PATIENT_STORE2 GROUP BY PERSON_ID) b where [{hos.ExecDatabase}].[DBO].[PATIENT].PERSON_ID = b.PERSON_ID
drop table [{hos.ExecDatabase}].dbo.table2"; drop table [{hos.ExecDatabase}].dbo.table2";
updatezt(id, hos_id, "更新MASTER_INDEX", "递归更新身份证或者医保号相同的主索引" + sql.Replace("'", "''")); updatezt(id, hos_id, "递归更新身份证或者医保号相同的主索引" + sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
sql = $@"UPDATE [{hos.ExecDatabase}].dbo.PATIENT SET NEWPERSON_ID = B.MASTER_INDEX FROM (SELECT A.NEWPERSON_ID,B.MASTER_INDEX FROM [{hos.ExecDatabase}].dbo.PATIENT A JOIN [{hos.ExecDatabase}].dbo.PUB_PATIENT B ON A.ID_CARD = B.ID_CARD WHERE B.MASTER_INDEX IS NOT NULL AND B.ID_CARD LIKE '[0-9]%' AND LEN(B.ID_CARD)>=15 AND B.ID_CARD NOT LIKE '%8888%' AND B.ID_CARD NOT LIKE '%0000%' GROUP BY A.NEWPERSON_ID,B.MASTER_INDEX) B WHERE PATIENT.NEWPERSON_ID = B.NEWPERSON_ID sql = $@"UPDATE [{hos.ExecDatabase}].dbo.PATIENT SET NEWPERSON_ID = B.MASTER_INDEX FROM (SELECT A.NEWPERSON_ID,B.MASTER_INDEX FROM [{hos.ExecDatabase}].dbo.PATIENT A JOIN [{hos.ExecDatabase}].dbo.PUB_PATIENT B ON A.ID_CARD = B.ID_CARD WHERE B.MASTER_INDEX IS NOT NULL AND B.ID_CARD LIKE '[0-9]%' AND LEN(B.ID_CARD)>=15 AND B.ID_CARD NOT LIKE '%8888%' AND B.ID_CARD NOT LIKE '%0000%' GROUP BY A.NEWPERSON_ID,B.MASTER_INDEX) B WHERE PATIENT.NEWPERSON_ID = B.NEWPERSON_ID
UPDATE [{hos.ExecDatabase}].dbo.PATIENT SET NEWPERSON_ID = B.MASTER_INDEX FROM (SELECT A.NEWPERSON_ID,B.MASTER_INDEX FROM [{hos.ExecDatabase}].dbo.PATIENT A JOIN ( SELECT B.CARD_ID,MASTER_INDEX FROM [{hos.ExecDatabase}].dbo.[PUB_PATIENT] A LEFT JOIN [{hos.ExecDatabase}].dbo.OUT_REG_INFO B ON A.PERSON_CODE = B.PERSON_CODE WHERE A.MASTER_INDEX IS NOT NULL AND A.ID_CARD LIKE '[0-9]%' AND LEN(A.ID_CARD)>=15 AND A.ID_CARD NOT LIKE '%8888%' AND A.ID_CARD NOT LIKE '%0000%' AND B.CARD_ID LIKE '[0-9]%' AND LEN(B.CARD_ID)>=6 AND B.CARD_ID IS NOT NULL UNION SELECT B.CARD_ID,MASTER_INDEX FROM [{hos.ExecDatabase}].dbo.[PUB_PATIENT] A LEFT JOIN [{hos.ExecDatabase}].dbo.INPAT_REG_INFO B ON A.PERSON_CODE = B.PERSON_CODE WHERE A.MASTER_INDEX IS NOT NULL AND A.ID_CARD LIKE '[0-9]%' AND LEN(A.ID_CARD)>=15 AND A.ID_CARD NOT LIKE '%8888%' AND A.ID_CARD NOT LIKE '%0000%' AND B.CARD_ID LIKE '[0-9]%' AND LEN(B.CARD_ID)>=6 AND B.CARD_ID IS NOT NULL ) B ON A.CARD_ID = B.CARD_ID GROUP BY A.NEWPERSON_ID,B.MASTER_INDEX ) B WHERE PATIENT.NEWPERSON_ID = B.NEWPERSON_ID"; UPDATE [{hos.ExecDatabase}].dbo.PATIENT SET NEWPERSON_ID = B.MASTER_INDEX FROM (SELECT A.NEWPERSON_ID,B.MASTER_INDEX FROM [{hos.ExecDatabase}].dbo.PATIENT A JOIN ( SELECT B.CARD_ID,MASTER_INDEX FROM [{hos.ExecDatabase}].dbo.[PUB_PATIENT] A LEFT JOIN [{hos.ExecDatabase}].dbo.OUT_REG_INFO B ON A.PERSON_CODE = B.PERSON_CODE WHERE A.MASTER_INDEX IS NOT NULL AND A.ID_CARD LIKE '[0-9]%' AND LEN(A.ID_CARD)>=15 AND A.ID_CARD NOT LIKE '%8888%' AND A.ID_CARD NOT LIKE '%0000%' AND B.CARD_ID LIKE '[0-9]%' AND LEN(B.CARD_ID)>=6 AND B.CARD_ID IS NOT NULL UNION SELECT B.CARD_ID,MASTER_INDEX FROM [{hos.ExecDatabase}].dbo.[PUB_PATIENT] A LEFT JOIN [{hos.ExecDatabase}].dbo.INPAT_REG_INFO B ON A.PERSON_CODE = B.PERSON_CODE WHERE A.MASTER_INDEX IS NOT NULL AND A.ID_CARD LIKE '[0-9]%' AND LEN(A.ID_CARD)>=15 AND A.ID_CARD NOT LIKE '%8888%' AND A.ID_CARD NOT LIKE '%0000%' AND B.CARD_ID LIKE '[0-9]%' AND LEN(B.CARD_ID)>=6 AND B.CARD_ID IS NOT NULL ) B ON A.CARD_ID = B.CARD_ID GROUP BY A.NEWPERSON_ID,B.MASTER_INDEX ) B WHERE PATIENT.NEWPERSON_ID = B.NEWPERSON_ID";
updatezt(id, hos_id, "更新MASTER_INDEX", "同步ID_CARD或医保号相同的病人主索引.." + sql.Replace("'", "''")); updatezt(id, hos_id, "同步ID_CARD或医保号相同的病人主索引.." + sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
sql = $@"UPDATE [{hos.ExecDatabase}].dbo.PUB_PATIENT SET MASTER_INDEX=NEWPERSON_ID FROM (SELECT [PERSON_ID],NEWPERSON_ID FROM [{hos.ExecDatabase}].dbo.PATIENT GROUP BY [PERSON_ID], NEWPERSON_ID) TAB,[{hos.ExecDatabase}].dbo.PUB_PATIENT B WHERE B.PERSON_ID=TAB.PERSON_ID; sql = $@"UPDATE [{hos.ExecDatabase}].dbo.PUB_PATIENT SET MASTER_INDEX=NEWPERSON_ID FROM (SELECT [PERSON_ID],NEWPERSON_ID FROM [{hos.ExecDatabase}].dbo.PATIENT GROUP BY [PERSON_ID], NEWPERSON_ID) TAB,[{hos.ExecDatabase}].dbo.PUB_PATIENT B WHERE B.PERSON_ID=TAB.PERSON_ID;
"; ";
updatezt(id, hos_id, "更新MASTER_INDEX", "将数据更新回病人登记表.." + sql.Replace("'", "''")); updatezt(id, hos_id, "将数据更新回病人登记表.." + sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
sql = $@"DROP TABLE[{ hos.ExecDatabase}].dbo.PATIENT sql = $@"DROP TABLE[{ hos.ExecDatabase}].dbo.PATIENT
DROP TABLE[{ hos.ExecDatabase}].dbo.PATIENT_NOTNULL DROP TABLE[{ hos.ExecDatabase}].dbo.PATIENT_NOTNULL
DROP TABLE[{ hos.ExecDatabase}].dbo.PATIENT_STORE1 DROP TABLE[{ hos.ExecDatabase}].dbo.PATIENT_STORE1
DROP TABLE[{ hos.ExecDatabase}].dbo.PATIENT_STORE2"; DROP TABLE[{ hos.ExecDatabase}].dbo.PATIENT_STORE2";
updatezt(id, hos_id, "更新MASTER_INDEX", "删除临时表.." + sql.Replace("'", "''")); updatezt(id, hos_id, "删除临时表.." + sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
} }
} }
} }
public void JX_DIC_DIAG(int id, int hos_id) public void JX_DIC_DIAG(int id, int hos_id)
{ {
var sql = ""; var sql = "";
SYS_Hospital hos = new SYS_Hospital(); SYS_Hospital hos = new SYS_Hospital();
using (DbConnection connection156 = new SqlConnection(_Connection156))
{
sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; "; sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
hos = connection156.Query<SYS_Hospital>(sql).FirstOrDefault(); hos = Connection(156).Query<SYS_Hospital>(sql).FirstOrDefault();
}
sql = @$" IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'DIC_DIAG_SUMMARY') sql = @$" IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'DIC_DIAG_SUMMARY')
drop table [{hos.ExecDatabase}].[dbo].[DIC_DIAG_SUMMARY]; drop table [{hos.ExecDatabase}].[dbo].[DIC_DIAG_SUMMARY];
CREATE TABLE [{hos.ExecDatabase}].[dbo].[DIC_DIAG_SUMMARY]( CREATE TABLE [{hos.ExecDatabase}].[dbo].[DIC_DIAG_SUMMARY](
...@@ -344,14 +334,14 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'DIC_DI ...@@ -344,14 +334,14 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'DIC_DI
CREATE TABLE [dbo].[DIC_DIAG_GATHER]( CREATE TABLE [dbo].[DIC_DIAG_GATHER](
[ID] [int] IDENTITY(1,1) NOT NULL, [ID] [int] IDENTITY(1,1) NOT NULL,
[DISEASE_NAME] [nvarchar](500) NULL, [DISEASE_NAME] [nvarchar](500) NULL,
[ICD_ID] INT NULL, [ICD_ID] int NULL,
[I_ICD_CODE] [nvarchar](50) NULL, [I_ICD_CODE] [nvarchar](50) NULL,
[I_DEPT_NAME] [nvarchar](100) NULL, [I_DEPT_NAME] [nvarchar](100) NULL,
[DIAGNOSIS] [nvarchar](200) NULL, [DIAGNOSIS] [nvarchar](200) NULL,
[DISEASE] [nvarchar](200) NULL [DISEASE] [nvarchar](200) NULL
); );
INSERT INTO [{hos.ExecDatabase}].[dbo].[DIC_DIAG_SUMMARY]([DISEASE_NAME],[ICD])select disease_name,max(icd) from [{hos.ExecDatabase}].[dbo].[OUT_DIAG]where disease_name IS NOT NULL AND disease_name !='' group by disease_name union select disease_name,max(icd) from [{hos.ExecDatabase}].[dbo].[INPAT_DIAG]where disease_name IS NOT NULL AND disease_name !='' group by disease_name"; INSERT intO [{hos.ExecDatabase}].[dbo].[DIC_DIAG_SUMMARY]([DISEASE_NAME],[ICD])select disease_name,max(icd) from [{hos.ExecDatabase}].[dbo].[OUT_DIAG]where disease_name IS NOT NULL AND disease_name !='' group by disease_name union select disease_name,max(icd) from [{hos.ExecDatabase}].[dbo].[INPAT_DIAG]where disease_name IS NOT NULL AND disease_name !='' group by disease_name";
updatezt(id, hos_id, "创建诊断项目汇总表", sql.Replace("'", "''")); updatezt(id, hos_id, sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
//复制DA_Disease这张表 //复制DA_Disease这张表
...@@ -360,10 +350,14 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'DIC_DI ...@@ -360,10 +350,14 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'DIC_DI
{ {
fwq = "[192.168.18.156]."; fwq = "[192.168.18.156].";
} }
sql = @$"SELECT * into [{hos.ExecDatabase}].dbo.DA_Disease FROM {fwq}[SV_DATA_CONFIG].[dbo].[DA_Disease]; sql = @$"
IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'DA_Disease') drop table [{hos.ExecDatabase}].dbo.DA_Disease;
SELECT * into [{hos.ExecDatabase}].dbo.DA_Disease FROM {fwq}[SV_DATA_CONFIG].[dbo].[DA_Disease];
IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'DA_DISEASE_ICD') drop table [{hos.ExecDatabase}].[dbo].[DA_DISEASE_ICD];
SELECT * into [{hos.ExecDatabase}].dbo.DA_DISEASE_ICD FROM {fwq}[SV_DATA_CONFIG].[dbo].[DA_DISEASE_ICD]; SELECT * into [{hos.ExecDatabase}].dbo.DA_DISEASE_ICD FROM {fwq}[SV_DATA_CONFIG].[dbo].[DA_DISEASE_ICD];
IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'DIC_ICD') drop table [{hos.ExecDatabase}].[dbo].[DIC_ICD];
SELECT * into [{hos.ExecDatabase}].dbo.DIC_ICD FROM {fwq}[SV_DATA_CONFIG].[dbo].[DIC_ICD];"; SELECT * into [{hos.ExecDatabase}].dbo.DIC_ICD FROM {fwq}[SV_DATA_CONFIG].[dbo].[DIC_ICD];";
updatezt(id, hos_id, "复制DA_Disease这张表", sql.Replace("'", "''")); updatezt(id, hos_id, sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
//匹配诊断 //匹配诊断
...@@ -371,31 +365,26 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'DIC_DI ...@@ -371,31 +365,26 @@ IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'DIC_DI
SET ICD_CODE = d.I_ICD,[F_DIAG] = d.I_CLASS_DISEASE, SET ICD_CODE = d.I_ICD,[F_DIAG] = d.I_CLASS_DISEASE,
[S_DIAG] = d.I_DISEASE, [I_DEPT_NAME] = d.I_DEPARTMENT FROM [{hos.ExecDatabase}].[dbo].[DIC_DIAG_SUMMARY] t, [S_DIAG] = d.I_DISEASE, [I_DEPT_NAME] = d.I_DEPARTMENT FROM [{hos.ExecDatabase}].[dbo].[DIC_DIAG_SUMMARY] t,
[{hos.ExecDatabase}].[dbo].[DA_Disease] d WHERE t.DISEASE_NAME = d.[HOSPITAL_DISEASE] and(isnull(d.HOSPITAL_DISEASE, '') <> ''); [{hos.ExecDatabase}].[dbo].[DA_Disease] d WHERE t.DISEASE_NAME = d.[HOSPITAL_DISEASE] and(isnull(d.HOSPITAL_DISEASE, '') <> '');
insert into [{hos.ExecDatabase}].[dbo].[DIC_DIAG_GATHER](DISEASE_NAME,ICD_ID, I_ICD_CODE,I_DEPT_NAME,DIAGNOSIS,DISEASE) insert into [{hos.ExecDatabase}].[dbo].[DIC_DIAG_GATHER](DISEASE_NAME,ICD_ID, I_ICD_CODE,I_DEPT_NAME,DIAGNOSIS,DISEASE)
select [DISEASE_NAME],d.id ICD_ID,d.icd I_ICD_CODE,[DEPARTMENT] I_DEPT_NAME,[DIAGNOSIS],[DISEASE] from select [DISEASE_NAME],d.id ICD_ID,d.icd I_ICD_CODE,[DEPARTMENT] I_DEPT_NAME,[DIAGNOSIS],[DISEASE] from
(select distinct [DISEASE_NAME] from [{hos.ExecDatabase}].[dbo].[DIC_DIAG_SUMMARY] ) a (select distinct [DISEASE_NAME] from [{hos.ExecDatabase}].[dbo].[DIC_DIAG_SUMMARY] ) a
left join [{hos.ExecDatabase}].[dbo].[DA_Disease] b on a.DISEASE_NAME=b.[HOSPITAL_DISEASE] left join [{hos.ExecDatabase}].[dbo].[DA_Disease] b on a.DISEASE_NAME=b.[HOSPITAL_DISEASE]
left join [{hos.ExecDatabase}].[dbo].[DA_DISEASE_ICD] c on b.id=c.DISEASE_ID left join [{hos.ExecDatabase}].[dbo].[DA_DISEASE_ICD] c on b.id=c.DISEASE_ID
left join [{hos.ExecDatabase}].[dbo].[DIC_ICD] d on c.ICD_ID=d.ID left join [{hos.ExecDatabase}].[dbo].[DIC_ICD] d on c.ICD_ID=d.ID
DROP TABLE [{hos.ExecDatabase}].[dbo].DA_Disease;
DROP TABLE [{hos.ExecDatabase}].[dbo].DA_DISEASE_ICD;
DROP TABLE[{hos.ExecDatabase}].[dbo]. DIC_ICD
"; ";
updatezt(id, hos_id, "更新DIC_DIAG_GATHER", sql.Replace("'", "''")); updatezt(id, hos_id, sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
// //
} }
public void JX_DIC_FEE(int id, int hos_id) public void JX_DIC_FEE(int id, int hos_id)
{ {
var sql = ""; var sql = "";
SYS_Hospital hos = new SYS_Hospital(); SYS_Hospital hos = new SYS_Hospital();
using (DbConnection connection156 = new SqlConnection(_Connection156))
{
sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; "; sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
hos = connection156.Query<SYS_Hospital>(sql).FirstOrDefault(); hos = Connection(156).Query<SYS_Hospital>(sql).FirstOrDefault();
}
sql = @$" IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'DIC_FEE_SUMMARY') sql = @$" IF EXISTS(SELECT * FROM [{hos.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'DIC_FEE_SUMMARY')
drop table [{hos.ExecDatabase}].[dbo].[DIC_FEE_SUMMARY]; drop table [{hos.ExecDatabase}].[dbo].[DIC_FEE_SUMMARY];
...@@ -407,7 +396,7 @@ public void JX_DIC_FEE(int id, int hos_id) ...@@ -407,7 +396,7 @@ public void JX_DIC_FEE(int id, int hos_id)
[MEDIC_AREA] [nvarchar](200) NULL [MEDIC_AREA] [nvarchar](200) NULL
); );
"; ";
updatezt(id, hos_id, "DIC_FEE_SUMMARY表的生成", sql.Replace("'", "''")); updatezt(id, hos_id, sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
var fwq = ""; var fwq = "";
if (hos.ExecOpenLink != "192.168.18.156") if (hos.ExecOpenLink != "192.168.18.156")
...@@ -415,27 +404,23 @@ public void JX_DIC_FEE(int id, int hos_id) ...@@ -415,27 +404,23 @@ public void JX_DIC_FEE(int id, int hos_id)
fwq = "[192.168.18.156]."; fwq = "[192.168.18.156].";
} }
//复制DA_Disease这张表 //复制DA_Disease这张表
sql = @$" INSERT INTO [dbo].[DIC_FEE_SUMMARY]([ITEM_NAME],MEDIC_AREA,CATEGORY,I_TYPE_NAME) sql = @$" INSERT intO [dbo].[DIC_FEE_SUMMARY]([ITEM_NAME],MEDIC_AREA,CATEGORY,I_TYPE_NAME)
SELECT t2.item_name,t2.medic_area,t2.category,t1.insurance_category FROM {fwq}[DB_SV_Data_Config].dbo.DA_Hos_Category t1 RIGHT JOIN ( SELECT t2.item_name,t2.medic_area,t2.category,t1.insurance_category FROM {fwq}[DB_SV_Data_Config].dbo.DA_Hos_Category t1 RIGHT JOIN (
SELECT category,item_name,medic_area FROM [dbo].[OUT_FEE] WHERE ITEM_NAME IS NOT NULL AND ITEM_NAME !='' GROUP BY category,item_name,medic_area SELECT category,item_name,medic_area FROM [dbo].[OUT_FEE] WHERE ITEM_NAME IS NOT NULL AND ITEM_NAME !='' GROUP BY category,item_name,medic_area
UNION UNION
SELECT category,item_name,medic_area FROM [dbo].INPAT_FEE WHERE ITEM_NAME IS NOT NULL AND ITEM_NAME !='' GROUP BY category,item_name,medic_area) t2 SELECT category,item_name,medic_area FROM [dbo].INPAT_FEE WHERE ITEM_NAME IS NOT NULL AND ITEM_NAME !='' GROUP BY category,item_name,medic_area) t2
ON t1.category = t2.category"; ON t1.category = t2.category";
updatezt(id, hos_id, "从费用中取出不重复的费用", sql.Replace("'", "''")); updatezt(id, hos_id, sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
} }
public void JX_ADD_DA_Disease(int id, int hos_id) public void JX_ADD_DA_Disease(int id, int hos_id)
{ {
var sql = ""; var sql = "";
SYS_Hospital hos = new SYS_Hospital(); SYS_Hospital hos = new SYS_Hospital();
using (DbConnection connection156 = new SqlConnection(_Connection156))
{
sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; "; sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
hos = connection156.Query<SYS_Hospital>(sql).FirstOrDefault(); hos = Connection(156).Query<SYS_Hospital>(sql).FirstOrDefault();
}
var fwq = ""; var fwq = "";
if (hos.ExecOpenLink != "192.168.18.156") if (hos.ExecOpenLink != "192.168.18.156")
{ {
...@@ -445,7 +430,7 @@ public void JX_ADD_DA_Disease(int id, int hos_id) ...@@ -445,7 +430,7 @@ public void JX_ADD_DA_Disease(int id, int hos_id)
select DISTINCT {hos_id} ,DISEASE_NAME ,0 from [{hos.ExecDatabase}].[dbo].[DIC_DIAG_GATHER] A select DISTINCT {hos_id} ,DISEASE_NAME ,0 from [{hos.ExecDatabase}].[dbo].[DIC_DIAG_GATHER] A
LEFT JOIN {fwq}[SV_DATA_CONFIG].[dbo].[DA_Disease] B ON A.DISEASE_NAME=B.HOSPITAL_DISEASE WHERE B.ID IS NULL; LEFT JOIN {fwq}[SV_DATA_CONFIG].[dbo].[DA_Disease] B ON A.DISEASE_NAME=B.HOSPITAL_DISEASE WHERE B.ID IS NULL;
"; ";
updatezt(id, hos_id, "插入标准诊断到诊断字典【累增】", sql.Replace("'", "''")); updatezt(id, hos_id, sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
} }
...@@ -453,11 +438,8 @@ public void JX_DIC_DRUG_ATC(int id, int hos_id) ...@@ -453,11 +438,8 @@ public void JX_DIC_DRUG_ATC(int id, int hos_id)
{ {
var sql = ""; var sql = "";
SYS_Hospital hos = new SYS_Hospital(); SYS_Hospital hos = new SYS_Hospital();
using (DbConnection connection156 = new SqlConnection(_Connection156))
{
sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; "; sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
hos = connection156.Query<SYS_Hospital>(sql).FirstOrDefault(); hos = Connection(156).Query<SYS_Hospital>(sql).FirstOrDefault();
}
var fwq = ""; var fwq = "";
if (hos.ExecOpenLink != "192.168.18.156") if (hos.ExecOpenLink != "192.168.18.156")
{ {
...@@ -474,7 +456,7 @@ public void JX_DIC_DRUG_ATC(int id, int hos_id) ...@@ -474,7 +456,7 @@ public void JX_DIC_DRUG_ATC(int id, int hos_id)
[MEDIC_AREA] [nvarchar](200) NULL [MEDIC_AREA] [nvarchar](200) NULL
); );
SELECT * into dbo.DA_Hos_Category FROM {fwq}[DB_SV_Data_Config].[dbo].[DA_Hos_Category] SELECT * into dbo.DA_Hos_Category FROM {fwq}[DB_SV_Data_Config].[dbo].[DA_Hos_Category]
INSERT INTO [dbo].[DIC_DRUG_ATC]( INSERT intO [dbo].[DIC_DRUG_ATC](
[ITEM_NAME],MEDIC_AREA,TYPE_NAME) [ITEM_NAME],MEDIC_AREA,TYPE_NAME)
SELECT DISTINCT ITEM_NAME,MEDIC_AREA,[Keyword] SELECT DISTINCT ITEM_NAME,MEDIC_AREA,[Keyword]
FROM [DBO].[OUT_FEE] A,[dbo].[DA_Hos_Category] C FROM [DBO].[OUT_FEE] A,[dbo].[DA_Hos_Category] C
...@@ -492,7 +474,7 @@ public void JX_DIC_DRUG_ATC(int id, int hos_id) ...@@ -492,7 +474,7 @@ public void JX_DIC_DRUG_ATC(int id, int hos_id)
{fwq}[SV_DATA_CONFIG].[dbo].[DA_Drug] b {fwq}[SV_DATA_CONFIG].[dbo].[DA_Drug] b
where b.CommonName is not null and b.DrugName=a.ITEM_NAME; where b.CommonName is not null and b.DrugName=a.ITEM_NAME;
DROP TABLE DA_Drug"; DROP TABLE DA_Drug";
updatezt(id, hos_id, "创建诊断项目汇总表", sql.Replace("'", "''")); updatezt(id, hos_id, sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
...@@ -501,11 +483,8 @@ public void JX_ADD_DA_Drug(int id, int hos_id) ...@@ -501,11 +483,8 @@ public void JX_ADD_DA_Drug(int id, int hos_id)
{ {
var sql = ""; var sql = "";
SYS_Hospital hos = new SYS_Hospital(); SYS_Hospital hos = new SYS_Hospital();
using (DbConnection connection156 = new SqlConnection(_Connection156))
{
sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; "; sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
hos = connection156.Query<SYS_Hospital>(sql).FirstOrDefault(); hos = Connection(156).Query<SYS_Hospital>(sql).FirstOrDefault();
}
var fwq = ""; var fwq = "";
if (hos.ExecOpenLink != "192.168.18.156") if (hos.ExecOpenLink != "192.168.18.156")
{ {
...@@ -523,60 +502,53 @@ public void JX_ADD_DA_Drug(int id, int hos_id) ...@@ -523,60 +502,53 @@ public void JX_ADD_DA_Drug(int id, int hos_id)
left join (select distinct drugname,medic_area from {fwq}[SV_DATA_CONFIG].[dbo].[DA_Drug] ) b on a.ITEM_NAME=b.DrugName left join (select distinct drugname,medic_area from {fwq}[SV_DATA_CONFIG].[dbo].[DA_Drug] ) b on a.ITEM_NAME=b.DrugName
where a.medic_area is null and b.drugname is null ) m where a.medic_area is null and b.drugname is null ) m
"; ";
updatezt(id, hos_id, "将未匹配到的药品插入到DA_Drug表中【累增】", sql.Replace("'", "''")); updatezt(id, hos_id, sql.Replace("'", "''"), null);
JX_zx(sql, hos_id, id, hos); JX_zx(sql, hos_id, id, hos);
} }
public void JX_DRUG_DATA_QZ(int id, int hos_id) public void JX_DRUG_DATA_QZ(int id, int hos_id)
{ {
var sql = ""; var sql = "";
int num = 0; int num = 0;
SYS_Hospital hos = new SYS_Hospital(); SYS_Hospital hos = new SYS_Hospital();
using (DbConnection configConnection = new SqlConnection(_configConnectionString)) // DefaultConnection
using (DbConnection connection156 = new SqlConnection(_Connection156))
{
sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; "; sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
hos = connection156.Query<SYS_Hospital>(sql).FirstOrDefault(); hos = Connection(156).Query<SYS_Hospital>(sql).FirstOrDefault();
sql = @$" select count(1)from [SV_QueryPlatform].[dbo].[权重执行sql] where type ='药品' "; sql = @$" select count(1)from [SV_QueryPlatform].[dbo].[权重执行sql] where type ='药品' ";
num = configConnection.Query<int>(sql).FirstOrDefault(); num = Connection(181).Query<int>(sql).FirstOrDefault();
int i = 1; int i = 1;
updatezt(id, hos_id, "更新药品权重", sql.Replace("'", "''")); updatezt(id, hos_id, sql.Replace("'", "''"), null);
for (i = 1; i < num + 1; i++) for (i = 1; i < num + 1; i++)
{ {
sql = @$" select execsql from [SV_QueryPlatform].[dbo].[权重执行sql] where type ='药品' and id={i} "; sql = @$" select execsql from [SV_QueryPlatform].[dbo].[权重执行sql] where type ='药品' and id={i} ";
string zxsql = configConnection.Query<string>(sql).FirstOrDefault(); string zxsql = Connection(181).Query<string>(sql).FirstOrDefault();
connection156.Execute(sql, commandTimeout: 60 * 60 * 12); updatezt(id, hos_id, zxsql.Replace("'", "''"), null);
Connection(156).Execute(zxsql, commandTimeout: 60 * 60 * 12);
} }
sql = @$" update SV_DATA_CONFIG.[dbo].[DA_Drug] set ISEXEC = 0 where ISEXEC is null ; sql = @$" update SV_DATA_CONFIG.[dbo].[DA_Drug] set ISEXEC = 0 where ISEXEC is null ;
update SV_DATA_CONFIG.[dbo].[DA_Drug] set iscompletion = 0 where iscompletion is null"; update SV_DATA_CONFIG.[dbo].[DA_Drug] set iscompletion = 0 where iscompletion is null";
connection156.Query<int>(sql).FirstOrDefault(); Connection(156).Query<int>(sql).FirstOrDefault();
}
} }
public void JX_DA_DIAGNOSIS_DATA(int id, int hos_id) public void JX_DA_DIAGNOSIS_DATA(int id, int hos_id)
{ {
var sql = ""; var sql = "";
SYS_Hospital hos = new SYS_Hospital(); SYS_Hospital hos = new SYS_Hospital();
DbConnection configConnection = new SqlConnection(_configConnectionString);
DbConnection connection156 = new SqlConnection(_Connection156);
sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; "; sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
hos = connection156.Query<SYS_Hospital>(sql).FirstOrDefault(); hos = Connection(156).Query<SYS_Hospital>(sql).FirstOrDefault();
sql = @$" UPDATE [SV_DATA_CONFIG].[dbo].[DA_Disease] SET [FILTER_DISEASE] = HOSPITAL_DISEASE where IS_FILTER = 0 ; sql = @$" UPDATE [SV_DATA_CONFIG].[dbo].[DA_Disease] SET [FILTER_DISEASE] = HOSPITAL_DISEASE where IS_FILTER = 0 ;
update [SV_DATA_CONFIG].[dbo].DA_DISEASE set FILTER_DISEASE = replace(FILTER_DISEASE,CHAR(13),'') where IS_FILTER = 0 and CHARINDEX(CHAR(13),FILTER_DISEASE) > 0; update [SV_DATA_CONFIG].[dbo].DA_DISEASE set FILTER_DISEASE = replace(FILTER_DISEASE,CHAR(13),'') where IS_FILTER = 0 and CHARINDEX(CHAR(13),FILTER_DISEASE) > 0;
update [SV_DATA_CONFIG].[dbo].DA_DISEASE set FILTER_DISEASE = replace(FILTER_DISEASE,CHAR(9),'') where IS_FILTER = 0 and CHARINDEX(CHAR(19),FILTER_DISEASE) > 0; update [SV_DATA_CONFIG].[dbo].DA_DISEASE set FILTER_DISEASE = replace(FILTER_DISEASE,CHAR(9),'') where IS_FILTER = 0 and CHARINDEX(CHAR(19),FILTER_DISEASE) > 0;
update [SV_DATA_CONFIG].[dbo].DA_DISEASE set FILTER_DISEASE = replace(FILTER_DISEASE,CHAR(10),'') where IS_FILTER = 0 and CHARINDEX(CHAR(10),FILTER_DISEASE) > 0;"; update [SV_DATA_CONFIG].[dbo].DA_DISEASE set FILTER_DISEASE = replace(FILTER_DISEASE,CHAR(10),'') where IS_FILTER = 0 and CHARINDEX(CHAR(10),FILTER_DISEASE) > 0;";
updatezt(id, hos_id, "剔除起始位 DA_Diagnosis_Data type=2的无效字符", sql.Replace("'", "''")); updatezt(id, hos_id, sql.Replace("'", "''"), null);
connection156.Execute(sql, commandTimeout: 60 * 60 * 12); Connection(156).Execute(sql, commandTimeout: 60 * 60 * 12);
sql = @$" select ' update [SV_DATA_CONFIG].[dbo].DA_DISEASE sql = @$" select ' update [SV_DATA_CONFIG].[dbo].DA_DISEASE
set FILTER_DISEASE = replace(FILTER_DISEASE,'''+[data]+''','''+[REPLACE]+''') set FILTER_DISEASE = replace(FILTER_DISEASE,'''+[data]+''','''+[REPLACE]+''')
where IS_FILTER = 0 and CHARINDEX('''+[data]+''',FILTER_DISEASE) > 0 ' from 特殊字符替换 "; where IS_FILTER = 0 and CHARINDEX('''+[data]+''',FILTER_DISEASE) > 0 ' from 特殊字符替换 ";
string[] zxsqls = configConnection.Query<string>(sql).ToArray(); string[] zxsqls = Connection(181).Query<string>(sql).ToArray();
foreach (var item in zxsqls) foreach (var item in zxsqls)
{ {
connection156.Execute(item, commandTimeout: 60 * 60 * 12); Connection(156).Execute(item, commandTimeout: 60 * 60 * 12);
} }
sql = @$" update [SV_DATA_CONFIG].[dbo].DA_DISEASE set FILTER_DISEASE = REPLACE( FILTER_DISEASE,substring(FILTER_DISEASE, sql = @$" update [SV_DATA_CONFIG].[dbo].DA_DISEASE set FILTER_DISEASE = REPLACE( FILTER_DISEASE,substring(FILTER_DISEASE,
...@@ -593,17 +565,14 @@ public void JX_DA_DIAGNOSIS_DATA(int id, int hos_id) ...@@ -593,17 +565,14 @@ public void JX_DA_DIAGNOSIS_DATA(int id, int hos_id)
on t1.HOSPITAL_DISEASE = t2.DISEASE and t2.STATE = 1 where t1.IS_FILTER = 0 on t1.HOSPITAL_DISEASE = t2.DISEASE and t2.STATE = 1 where t1.IS_FILTER = 0
UPDATE [SV_DATA_CONFIG].[dbo].[DA_Disease] SET IS_FILTER = 1 WHERE IS_FILTER = 0 UPDATE [SV_DATA_CONFIG].[dbo].[DA_Disease] SET IS_FILTER = 1 WHERE IS_FILTER = 0
"; ";
connection156.Execute(sql, commandTimeout: 60 * 60 * 12); Connection(156).Execute(sql, commandTimeout: 60 * 60 * 12);
} }
public void JX_DIAGNOSIS_DATA_QZ(int hos_id)
public void JX_DIAGNOSIS_DATA_QZ(int id, int hos_id)
{ {
var sql = ""; var sql = "";
SYS_Hospital hos = new SYS_Hospital(); SYS_Hospital hos = new SYS_Hospital();
DbConnection configConnection = new SqlConnection(_configConnectionString);
DbConnection connection156 = new SqlConnection(_Connection156.Replace("DB_SV_Data_Config", "SV_DATA_CONFIG"));
sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; "; sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
hos = connection156.Query<SYS_Hospital>(sql).FirstOrDefault(); hos = Connection(156, "DB_SV_Data_Config", "SV_DATA_CONFIG").Query<SYS_Hospital>(sql).FirstOrDefault();
sql = @$" insert into da_disease_icd(disease_id,icd_id) select tab.disease_id,tab.icd_id from ( select id as disease_id,2450 as icd_id from dbo.da_disease where 1=1 and ( hospital_disease like '%高血压心脏病伴心力衰竭%' and hospital_disease not like '%?%' and hospital_disease not like '%待排%' ) ) tab left join da_disease_icd t1 on t1.disease_id = tab.disease_id and t1.icd_id = tab.icd_id where t1.id is null sql = @$" insert into da_disease_icd(disease_id,icd_id) select tab.disease_id,tab.icd_id from ( select id as disease_id,2450 as icd_id from dbo.da_disease where 1=1 and ( hospital_disease like '%高血压心脏病伴心力衰竭%' and hospital_disease not like '%?%' and hospital_disease not like '%待排%' ) ) tab left join da_disease_icd t1 on t1.disease_id = tab.disease_id and t1.icd_id = tab.icd_id where t1.id is null
insert into da_disease_icd(disease_id,icd_id) select tab.disease_id,tab.icd_id from ( select id as disease_id,2454 as icd_id from dbo.da_disease where 1=1 and ( hospital_disease like '%高血压肾脏病不伴有肾衰竭%' and hospital_disease not like '%?%' and hospital_disease not like '%待排%' ) ) tab left join da_disease_icd t1 on t1.disease_id = tab.disease_id and t1.icd_id = tab.icd_id where t1.id is null insert into da_disease_icd(disease_id,icd_id) select tab.disease_id,tab.icd_id from ( select id as disease_id,2454 as icd_id from dbo.da_disease where 1=1 and ( hospital_disease like '%高血压肾脏病不伴有肾衰竭%' and hospital_disease not like '%?%' and hospital_disease not like '%待排%' ) ) tab left join da_disease_icd t1 on t1.disease_id = tab.disease_id and t1.icd_id = tab.icd_id where t1.id is null
insert into da_disease_icd(disease_id,icd_id) select tab.disease_id,tab.icd_id from ( select id as disease_id,2460 as icd_id from dbo.da_disease where 1=1 and ( hospital_disease like '%高血压(肾性)%' and hospital_disease not like '%?%' and hospital_disease not like '%待排%' ) ) tab left join da_disease_icd t1 on t1.disease_id = tab.disease_id and t1.icd_id = tab.icd_id where t1.id is null insert into da_disease_icd(disease_id,icd_id) select tab.disease_id,tab.icd_id from ( select id as disease_id,2460 as icd_id from dbo.da_disease where 1=1 and ( hospital_disease like '%高血压(肾性)%' and hospital_disease not like '%?%' and hospital_disease not like '%待排%' ) ) tab left join da_disease_icd t1 on t1.disease_id = tab.disease_id and t1.icd_id = tab.icd_id where t1.id is null
...@@ -671,17 +640,209 @@ public void JX_DIAGNOSIS_DATA_QZ(int id, int hos_id) ...@@ -671,17 +640,209 @@ public void JX_DIAGNOSIS_DATA_QZ(int id, int hos_id)
update da_disease set i_department='心内科',i_class_disease='高血压病',i_icd='I10.x05',i_disease='高血压Ⅱ期',is_exec=1,exec_date=getdate() where 1=1 and filter_disease like '高血压%' and hospital_disease like '%高血压2%' and is_exec is null update da_disease set i_department='心内科',i_class_disease='高血压病',i_icd='I10.x05',i_disease='高血压Ⅱ期',is_exec=1,exec_date=getdate() where 1=1 and filter_disease like '高血压%' and hospital_disease like '%高血压2%' and is_exec is null
update da_disease set i_department='心内科',i_class_disease='高血压病',i_icd='I10.x06',i_disease='高血压Ⅲ期',is_exec=1,exec_date=getdate() where 1=1 and filter_disease like '高血压%' and hospital_disease like '%高血压3%' and is_exec is null update da_disease set i_department='心内科',i_class_disease='高血压病',i_icd='I10.x06',i_disease='高血压Ⅲ期',is_exec=1,exec_date=getdate() where 1=1 and filter_disease like '高血压%' and hospital_disease like '%高血压3%' and is_exec is null
"; ";
connection156.Execute(sql, commandTimeout: 60 * 60 * 12); Connection(156, "DB_SV_Data_Config", "SV_DATA_CONFIG").Execute(sql, commandTimeout: 60 * 60 * 12);
sql = $@"update SV_DATA_CONFIG.dbo.da_disease set i_department=t2.DEPARTMENT,i_class_disease=t2.DIAGNOSIS,i_icd=t2.ICD,i_disease=t2.DISEASE,is_exec=2,exec_date=getdate(), sql = $@"update SV_DATA_CONFIG.dbo.da_disease set i_department=t2.DEPARTMENT,i_class_disease=t2.DIAGNOSIS,i_icd=t2.ICD,i_disease=t2.DISEASE,is_exec=2,exec_date=getdate(),
REMARK = 'sql脚本执行' FROM SV_DATA_CONFIG.dbo.DA_Disease T1 JOIN (select distinct DEPARTMENT,ICD,diagnosis,disease from SV_DATA_CONFIG.dbo.DIC_ICD where state = 1 ) T2 ON REMARK = 'sql脚本执行' FROM SV_DATA_CONFIG.dbo.DA_Disease T1 JOIN (select distinct DEPARTMENT,ICD,diagnosis,disease from SV_DATA_CONFIG.dbo.DIC_ICD where state = 1 ) T2 ON
T1.filter_disease like '%'+t2.disease+'%' and t1.hospital_disease like '%'+t2.disease+'%' where t1.is_exec is null ; T1.filter_disease like '%'+t2.disease+'%' and t1.hospital_disease like '%'+t2.disease+'%' where t1.is_exec is null ;
INSERT INTO SV_DATA_CONFIG.[dbo].[DA_DISEASE_ICD] (DISEASE_ID,ICD_ID)
INSERT intO SV_DATA_CONFIG.[dbo].[DA_DISEASE_ICD] (DISEASE_ID,ICD_ID)
SELECT A.ID,B.ID FROM SV_DATA_CONFIG.DBO.DA_Disease A SELECT A.ID,B.ID FROM SV_DATA_CONFIG.DBO.DA_Disease A
JOIN SV_DATA_CONFIG.DBO.DIC_ICD B ON A.I_ICD = B.ICD JOIN SV_DATA_CONFIG.DBO.DIC_ICD B ON A.I_ICD = B.ICD
WHERE A.IS_EXEC = 2 AND A.I_ICD IS NOT NULL; WHERE A.IS_EXEC = 2 AND A.I_ICD IS NOT NULL;
update SV_DATA_CONFIG.DBO.DA_Disease set is_exec = 1 where IS_EXEC = 2; update SV_DATA_CONFIG.DBO.DA_Disease set is_exec = 1 where IS_EXEC = 2;
update SV_DATA_CONFIG.dbo.DA_Disease set IS_EXEC = 0 where IS_EXEC is null ;"; update SV_DATA_CONFIG.dbo.DA_Disease set IS_EXEC = 0 where IS_EXEC is null ;";
connection156.Execute(sql, commandTimeout: 60 * 60 * 12);
Connection(156, "DB_SV_Data_Config", "SV_DATA_CONFIG").Execute(sql, commandTimeout: 60 * 60 * 12);
}
public void JX_REMATCH_DIAG(int id, int hos_id)
{
var sql = "";
SYS_Hospital hos = new SYS_Hospital();
sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
hos = Connection(156, "DB_SV_Data_Config", "SV_DATA_CONFIG").Query<SYS_Hospital>(sql).FirstOrDefault();
服务器 fwq = Connection(181).Query<服务器>($"SELECT [服务器ip],[数据库账号],[数据库密码] FROM[SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{hos.ExecOpenLink}'").FirstOrDefault();
var msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", hos.ExecOpenLink, hos.ExecDatabase, fwq.数据库账号, fwq.数据库密码);
sql = $@"
UPDATE [dbo].[DIC_DIAG_GATHER] SET [ICD_ID]=T.ICD_ID ,[I_ICD_CODE]=T.I_ICD_CODE ,[I_DEPT_NAME]=T.I_DEPT_NAME ,[DIAGNOSIS]=T.DIAGNOSIS ,[DISEASE]=T.DISEASE
FROM (select [DISEASE_NAME],d.id ICD_ID,d.icd I_ICD_CODE,[DEPARTMENT] I_DEPT_NAME,[DIAGNOSIS],[DISEASE] from
(select distinct [DISEASE_NAME] from [dbo].[DIC_DIAG_GATHER] )a left join [dbo].[DA_Disease] b on a.DISEASE_NAME=b.[HOSPITAL_DISEASE]
left join [dbo].[DA_DISEASE_ICD] c on b.id=c.DISEASE_ID left join [dbo].[DIC_ICD] d on c.ICD_ID=d.ID
WHERE (isnull(B.HOSPITAL_DISEASE,'')<>'')) T
WHERE T.[DISEASE_NAME]=[DIC_DIAG_GATHER].[DISEASE_NAME];
DROP TABLE DA_Disease
DROP TABLE DA_DISEASE_ICD
DROP TABLE DIC_ICD";
updatezt(id, hos_id, sql.Replace("'", "''"), null);
Connection(0, msConnectionString).Execute(sql, commandTimeout: 60 * 60 * 12);
}
public void JX_UPDATE_REG_INFO(int id, int hos_id)
{
var sql = "";
SYS_Hospital hos = new SYS_Hospital();
sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
hos = Connection(156, "DB_SV_Data_Config", "SV_DATA_CONFIG").Query<SYS_Hospital>(sql).FirstOrDefault();
服务器 fwq = Connection(181).Query<服务器>($"SELECT [服务器ip],[数据库账号],[数据库密码] FROM[SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{hos.ExecOpenLink}'").FirstOrDefault();
var msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", hos.ExecOpenLink, hos.ExecDatabase, fwq.数据库账号, fwq.数据库密码);
sql = $@" SELECT REG_ID, [I_DEPT_NAME],DIAGNOSIS intO OUT_TABLE
FROM (SELECT M.REG_ID,M.DISEASE_NAME,M.ICD_ID,M.I_ICD_CODE,M.I_DEPT_NAME,M.DIAGNOSIS,M.DISEASE
FROM (SELECT REG_ID,DIAG_ID,T.* FROM OUT_DIAG A JOIN
(SELECT A.* FROM [dbo].[DIC_DIAG_GATHER] A
JOIN (SELECT DISEASE_NAME,MAX(ID) ID
FROM [dbo].[DIC_DIAG_GATHER] WHERE ICD_ID IS NOT NULL
GROUP BY DISEASE_NAME) B
ON A.ID=B.ID) T
ON A.DISEASE_NAME=T.DISEASE_NAME) M JOIN
(SELECT REG_ID,DIAG_TIME,MIN(DIAG_ID) DIAG_ID ---一对多的取时间最小且有标准值的诊断
FROM OUT_DIAG A JOIN (SELECT A.* FROM [dbo].[DIC_DIAG_GATHER] A
JOIN (SELECT DISEASE_NAME,MAX(ID) ID ---一对多的取最大的ID
FROM [dbo].[DIC_DIAG_GATHER] WHERE ICD_ID IS NOT NULL
GROUP BY DISEASE_NAME) B
ON A.ID=B.ID) T
ON A.DISEASE_NAME=T.DISEASE_NAME
GROUP BY REG_ID,DIAG_TIME) N
ON M.DIAG_ID=N.DIAG_ID ) TT
UPDATE [dbo].[OUT_REG_INFO] SET [I_DEPT_NAME]=NULL,[F_DIAG]=NULL;
UPDATE [dbo].[OUT_REG_INFO]
SET [I_DEPT_NAME] = B.[I_DEPT_NAME],
[F_DIAG] = B.DIAGNOSIS
FROM OUT_TABLE B WHERE [OUT_REG_INFO].REG_ID = B.REG_ID
DROP TABLE OUT_TABLE
SELECT REG_ID,[I_DEPT_NAME],DIAGNOSIS intO INPAT_TABLE
FROM
(SELECT M.REG_ID,M.DISEASE_NAME,M.ICD_ID,M.I_ICD_CODE,M.I_DEPT_NAME,M.DIAGNOSIS,M.DISEASE
FROM (SELECT REG_ID,DIAG_ID,T.* FROM INPAT_DIAG A JOIN
(SELECT A.* FROM [dbo].[DIC_DIAG_GATHER] A
JOIN (SELECT DISEASE_NAME,MAX(ID) ID
FROM [dbo].[DIC_DIAG_GATHER] WHERE ICD_ID IS NOT NULL
GROUP BY DISEASE_NAME) B
ON A.ID=B.ID) T
ON A.DISEASE_NAME=T.DISEASE_NAME) M JOIN
(SELECT REG_ID,DIAG_TIME,MIN(DIAG_ID)DIAG_ID FROM INPAT_DIAG A JOIN
(SELECT A.* FROM [dbo].[DIC_DIAG_GATHER] A
JOIN (SELECT DISEASE_NAME,MAX(ID) ID
FROM [dbo].[DIC_DIAG_GATHER] WHERE ICD_ID IS NOT NULL
GROUP BY DISEASE_NAME) B
ON A.ID=B.ID) T
ON A.DISEASE_NAME=T.DISEASE_NAME
GROUP BY REG_ID,DIAG_TIME) N
ON M.DIAG_ID=N.DIAG_ID ) T
UPDATE [dbo].[INPAT_REG_INFO] SET [I_DEPT_NAME]=NULL,[F_DIAG]=NULL;
UPDATE [dbo].[INPAT_REG_INFO]
SET [I_DEPT_NAME] = B.[I_DEPT_NAME],
[F_DIAG] = B.DIAGNOSIS
FROM INPAT_TABLE B WHERE [INPAT_REG_INFO].REG_ID = B.REG_ID
DROP TABLE INPAT_TABLE";
updatezt(id, hos_id, sql.Replace("'", "''"), null);
Connection(0, msConnectionString).Execute(sql, commandTimeout: 60 * 60 * 12);
}
public void JX_REMOVE_CARD_TYPE(int id, int hos_id)
{
var sql = "";
SYS_Hospital hos = new SYS_Hospital();
sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
hos = Connection(156, "DB_SV_Data_Config", "SV_DATA_CONFIG").Query<SYS_Hospital>(sql).FirstOrDefault();
服务器 fwq = Connection(181).Query<服务器>($"SELECT [服务器ip],[数据库账号],[数据库密码] FROM[SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{hos.ExecOpenLink}'").FirstOrDefault();
var msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", hos.ExecOpenLink, hos.ExecDatabase, fwq.数据库账号, fwq.数据库密码);
sql = $@"
INSERT intO DB_SV_DATA_CONFIG.[dbo].[DA_CARD_TYPE]
(CARDTYPE,[HOS_CODE],update_time)
SELECT t2.CARD_TYPE,t2.ORG_CODE,getdate()
FROM DB_SV_DATA_CONFIG.dbo.[DA_CARD_TYPE] t1
RIGHT JOIN (
SELECT CARD_TYPE,ORG_CODE
FROM [{hos.ExecOpenLink}].[{hos.ExecDatabase}].[DBO].[OUT_REG_INFO] a
GROUP BY a.CARD_TYPE,a.ORG_CODE
UNION
SELECT CARD_TYPE,ORG_CODE
FROM [{hos.ExecOpenLink}].[{hos.ExecDatabase}].[DBO].[INPAT_REG_INFO] b
GROUP BY b.CARD_TYPE,b.ORG_CODE) t2
ON t1.CARDTYPE = t2.CARD_TYPE
WHERE t1.id IS NULL and t2.CARD_TYPE is not null; ";
updatezt(id, hos_id, sql.Replace("'", "''"), null);
Connection(156, "DB_SV_Data_Config", "SV_DATA_CONFIG").Execute(sql, commandTimeout: 60 * 60 * 12);
sql = $@"UPDATE DB_SV_DATA_CONFIG.[dbo].[DA_CARD_TYPE] SET SOURCE=(case when CARDTYPE LIKE '%农%' then '1'
when (CARDTYPE like '%保%' or CARDTYPE like '%合%疗%' or CARDTYPE like '%居民%'or CARDTYPE like '%职工%') then '2' else '0' end) where [SOURCE] is null ";
updatezt(id, hos_id, sql.Replace("'", "''"), null);
Connection(156, "DB_SV_Data_Config", "SV_DATA_CONFIG").Execute(sql, commandTimeout: 60 * 60 * 12);
sql = $@" UPDATE [DBO].[OUT_REG_INFO] SET I_CARD_TYPE=
( CASE WHEN [CARD_TYPE]like '%农%'or [CARD_TYPE] like '%合%疗%' or [CARD_TYPE] like '%保%' or CARD_TYPE like '%居民%' or CARD_TYPE like '%职工%'
THEN '医保' ELSE '自费' END )
UPDATE [DBO].[INPAT_REG_INFO] SET I_CARD_TYPE=
( CASE WHEN [CARD_TYPE]like '%农%'or [CARD_TYPE] like '%合%疗%' or [CARD_TYPE] like '%保%' or CARD_TYPE like '%居民%' or CARD_TYPE like '%职工%'
THEN '医保' ELSE '自费' END )
UPDATE [DBO].[OUT_REG_INFO] SET I_CARD_TYPE='自费' WHERE CARD_TYPE IS NULL;
UPDATE [DBO].[INPAT_REG_INFO] SET I_CARD_TYPE='自费' WHERE CARD_TYPE IS NULL; ";
updatezt(id, hos_id, sql.Replace("'", "''"), null);
Connection(0, msConnectionString).Execute(sql, commandTimeout: 60 * 60 * 12);
}
public void JX_INSERT_CATEGORY(int id, int hos_id)
{
var sql = "";
SYS_Hospital hos = new SYS_Hospital();
sql = @$" SELECT DISTINCT ExecOpenLink , ExecDatabase FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A WHERE id ={hos_id}; ";
hos = Connection(156, "DB_SV_Data_Config", "SV_DATA_CONFIG").Query<SYS_Hospital>(sql).FirstOrDefault();
服务器 fwq = Connection(181).Query<服务器>($"SELECT [服务器ip],[数据库账号],[数据库密码] FROM[SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{hos.ExecOpenLink}'").FirstOrDefault();
var msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", hos.ExecOpenLink, hos.ExecDatabase, fwq.数据库账号, fwq.数据库密码);
sql = $@"INSERT intO [DB_SV_Data_Config].[dbo].[DA_Hos_Category]
([category],[HospitalID])
SELECT t2.category,org_code
FROM [DB_SV_Data_Config].dbo.DA_Hos_Category t1
RIGHT JOIN (SELECT category,org_code
FROM [{hos.ExecOpenLink}].[{hos.ExecDatabase}].[dbo].[OUT_FEE]
GROUP BY category,org_code
UNION
SELECT category,org_code
FROM [{hos.ExecOpenLink}].[{hos.ExecDatabase}].[dbo].INPAT_FEE
GROUP BY category,org_code) t2
ON t1.category = t2.category
WHERE t1.id IS NULL and t2.category is not null;";
updatezt(id, hos_id, sql.Replace("'", "''"), null);
int num = Connection(156, "DB_SV_Data_Config", "SV_DATA_CONFIG").Execute(sql, commandTimeout: 60 * 60 * 12);
if (num > 0)
{
updatezt(id, hos_id, sql.Replace("'", "''"), "您有category未分类,请到156配置库下添加category!!!select*from [192.168.18.156].[DB_SV_Data_Config].[dbo].[DA_Hos_Category] where HospitalID=" + hos_id);
}
sql = $@"UPDATE [dbo].[OUT_FEE]
SET I_TYPE_NAME = B.insurance_category
FROM [dbo].[OUT_FEE] t LEFT JOIN [192.168.18.156].DB_SV_DATA_CONFIG.[dbo].[DA_Hos_Category] B
ON B.CATEGORY=t.CATEGORY;
UPDATE [dbo].[INPAT_FEE]
SET I_TYPE_NAME = B.insurance_category
FROM [dbo].[INPAT_FEE] t LEFT JOIN [192.168.18.156].DB_SV_DATA_CONFIG.[dbo].[DA_Hos_Category] B
ON B.CATEGORY=t.CATEGORY;
UPDATE [dbo].[OUT_FEE]
SET I_TYPE_NAME = B.Keyword
FROM [dbo].[OUT_FEE] t LEFT JOIN [192.168.18.156].DB_SV_DATA_CONFIG.[dbo].[DA_Hos_Category] B
ON B.CATEGORY=t.CATEGORY
where I_TYPE_NAME = '挂号/诊查费' or I_TYPE_NAME = '手术/麻醉费' or I_TYPE_NAME = '床位/护理费'
UPDATE [dbo].[INPAT_FEE]
SET I_TYPE_NAME = B.Keyword
FROM [dbo].[INPAT_FEE] t LEFT JOIN [192.168.18.156].DB_SV_DATA_CONFIG.[dbo].[DA_Hos_Category] B
ON B.CATEGORY=t.CATEGORY
where I_TYPE_NAME = '挂号/诊查费' or I_TYPE_NAME = '手术/麻醉费' or I_TYPE_NAME = '床位/护理费'";
Connection(0, msConnectionString).Execute(sql, commandTimeout: 60 * 60 * 12);
} }
} }
} }
using Dapper;
using Microsoft.Data.SqlClient;
using QueryPlatform.Api.Infrastructure.Modules;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Threading.Tasks;
namespace QueryPlatform.Api.Infrastructure.Queries
{
public class DrugqueryQueries
{
private readonly string _Connection156;
private readonly string _configConnectionString;
public DrugqueryQueries(string Connection156, string configConnectionString)
{
_Connection156 = Connection156;
_configConnectionString = configConnectionString;
}
/// <summary>
/// 查询所有医院
/// </summary>
/// <returns></returns>
public List<SYS_Hospital> showHospitals()
{
DbConnection connection156 = new SqlConnection(_Connection156);
// sys_hospital156找医院
var sql = @$"SELECT
ExecOpenLink ,
ExecDatabase
FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital]
WHERE ExecOpenLink <>'' AND ExecOpenLink IS NOT NULL
AND ExecDatabase <>'' AND ExecDatabase IS NOT NULL
";
return connection156.Query<SYS_Hospital>(sql).ToList();
}
/// <summary>
/// 获取到最大的那条记录Complete_MarkId
/// </summary>
/// <returns></returns>
public long Complete_MarkId(long Indexs)
{
DbConnection configConnection = new SqlConnection(_configConnectionString);
return configConnection.Query<long>(@$"select COMPLETE_MARK from [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] where id={Indexs} ").FirstOrDefault();
}
public long ASSAY_Complete_MarkId(int id)
{
DbConnection configConnection = new SqlConnection(_configConnectionString);
return configConnection.Query<long>(@$"select COMPLETE_MARK from [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD_ASSAY] where id={id} ").FirstOrDefault();
}
/// <summary>
///传入sql 连接 返回long
/// </summary>
/// <returns></returns>
public long Countnum(string sql, DbConnection configConnection)
{
long c = configConnection.Query<long>(sql, commandTimeout: 1000000).FirstOrDefault();
return c;
}
public long SqlAdd(SYS_Drugquery sYS_Drugquery, long type, string zxr)
{
string peojectName = sYS_Drugquery.peojectName;
string drugName = "";
string diseaseName = "";
string icd = "";
string lx = "";
if (type == 1)
{
lx = "疾病"; if (sYS_Drugquery.diseaseName != null) foreach (var item in sYS_Drugquery.diseaseName) { diseaseName = string.Join(",", sYS_Drugquery.diseaseName); }
if (sYS_Drugquery.icd != null) foreach (var item in sYS_Drugquery.icd) { icd = string.Join(",", sYS_Drugquery.icd); }
}
else if (type == 2) { lx = "药品"; foreach (var item in sYS_Drugquery.drugName) { drugName = string.Join(",", sYS_Drugquery.drugName); } }
else if (type == 3) { lx = "材料"; foreach (var item in sYS_Drugquery.materialName) { drugName = string.Join(",", sYS_Drugquery.materialName); } }
DbConnection connection = new SqlConnection(_configConnectionString);
var sql = @$"INSERT into [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD]([HOS_TYPE],[PROJECT_NAME],[GENERIC_NAME],[COMMODITY_NAME],[DISEASE_NAME],[ICD],
[COMPLETE_MARK],[search_time],type ,[TYPE1_2],zxr )
VALUES(0,'{peojectName}','{ drugName}',null,'{diseaseName}',
'{icd}',0,getdate(),'{lx}','{sYS_Drugquery.type1_2}','{zxr}')";
connection.Execute(sql, commandTimeout: 60 * 60 * 5);
sql = @$"select max(id) from [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD]
where PROJECT_NAME='{peojectName}' and GENERIC_NAME='{drugName}' and DISEASE_NAME='{diseaseName}'
and icd='{icd}' and type='{lx}' and [TYPE1_2]='{sYS_Drugquery.type1_2}'";
long num = connection.Query<long>(sql).FirstOrDefault();
//添加一条查询记录
sql = $@"CREATE TABLE [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{num}](
[ID] [int] IDENTITY(1,1) NOT NULL,
[HOS_ID] [int] NULL,
[MASTER_INDEX] [int] NULL,
[BIRTHDAY] [datetime2](7) NULL,
[SEX] [nvarchar](50) NULL,
[PERSON_CODE] [nvarchar](50) NULL,
[PERSON_ID] [int] NULL,
[REG_CODE] [nvarchar](50) NULL,
[REG_ID] [int] NULL,
[REG_SOURCE] [nvarchar](50) NULL,
[REG_TIME] [datetime2](7) NULL,
[AREA_ID] [int] NULL,
[INDEXS] [int] NULL,
[TYPE] [int] NULL,
[DEPT_NAME] [nvarchar](50) NULL,
[MEDIC_AREA] [nvarchar](max) NULL,
CONSTRAint [PK_MEDIC_PERSON_INFORMATIONaa_{num}] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
";
connection.Execute(sql, commandTimeout: 60 * 60 * 5);
sql = $@"CREATE TABLE [SV_QueryPlatform_].[dbo].[MEDIC_AREA_{num}](
[ID] [int] IDENTITY(1,1) NOT NULL,
[HOS_ID] [int] NULL,
[ITEM_NAME] [nvarchar](500) NULL,
[MEDIC_AREA] [nvarchar](500) NULL,
[TYPE] [int] NULL,
[INDEXS] [nvarchar](50) NULL,
[MEDIC_NAME] [nvarchar](50) NULL
) ON [PRIMARY]";
connection.Execute(sql, commandTimeout: 60 * 60 * 5);
return num;
}
public void updateCOMPLETE_MARK(long Indexs, long COMPLETE_MARK)
{
DbConnection configConnection = new SqlConnection(_configConnectionString);
if (COMPLETE_MARK == 22)
{
configConnection.Execute(@$"update [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK = 22,END_TIME=getdate() where COMPLETE_MARK != 22 and id= {Indexs}");
}
if (COMPLETE_MARK == 21)
{
configConnection.Execute(@$"update [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK=21 where COMPLETE_MARK =0 and id={Indexs}");
}
}
public void Diseasequery(long type1_2, string icd_or_diseaseCondition, long Indexs, long ip, string zxr)
{
var where = "";
long num = 0;
long CompleteMar = 0;
DbConnection configConnection = new SqlConnection(_configConnectionString);
if (ip == 1)
{
where = @$"and ExecOpenLink in ('192.168.18.151', '192.168.18.152', '192.168.18.153') ";
}
else if (ip == 2)
{
where = @$"and ExecOpenLink in ('192.168.18.154', '192.168.18.155', '192.168.18.156')";
}
else if (ip == 3)
{
where = @$"and ExecOpenLink in ('192.168.18.157', '192.168.18.158')";
}
else if (ip == 4)
{
where = "and ExecOpenLink not in ('192.168.18.151', '192.168.18.152', '192.168.18.153','192.168.18.154', '192.168.18.155', '192.168.18.156','192.168.18.157', '192.168.18.158')";
}
List<SYS_Hospital> hos = configConnection.Query<SYS_Hospital>(@$"SELECT ExecOpenLink ,ExecDatabase FROM [192.168.18.156].[DB_SV_Data_Config].[dbo].[SYS_Hospital]
WHERE ExecOpenLink <>'' AND ExecOpenLink IS NOT NULL AND ExecDatabase <>'' AND ExecDatabase IS NOT NULL {where}", commandTimeout: 1000000).ToList();
服务器 fwq = new 服务器();
var msConnectionString = "";
foreach (var item in hos)
{
var fwqsql = $"SELECT [服务器ip],[数据库账号],[数据库密码] FROM [SV_QueryPlatform].[dbo].[服务器] where [服务器ip] ='{item.ExecOpenLink}'";
fwq = configConnection.Query<服务器>(fwqsql).FirstOrDefault();
msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", item.ExecOpenLink, item.ExecDatabase, fwq.数据库账号, fwq.数据库密码);
var sql2 = "";
using (DbConnection conn = new SqlConnection(msConnectionString))
{
//获取MEDIC_SEARCH_RECORD表的id和COMPLETE_MARK
CompleteMar = Complete_MarkId(Indexs);
if (CompleteMar == 23)
{
throw new DomainException("查询失败!!");
}
if (CompleteMar == 31)
{
throw new DomainException("查询取消!!");
}
try
{
//判断状态 21在执行
if (CompleteMar == 21)
{
if (Countnum($@"SELECT count(*) FROM {item.ExecDatabase}.dbo.SYSOBJECTS WHERE NAME = 'DIC_DIAG_SUMMARY'", conn) > 0)
{
if (Countnum($@"SELECT count(*) a FROM {item.ExecDatabase}.[dbo].[DIC_DIAG_SUMMARY] where {icd_or_diseaseCondition} ", conn) > 0)
{
sql2 = $@" IF EXISTS(SELECT * FROM [{item.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'MEDIC_PERSON_INFORMATION_{Indexs}')
drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs};
SELECT C.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,A.REG_CODE,A.REG_ID,1 REG_SOURCE,A.REG_TIME, {Indexs}Indexs,a.org_Code 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 ,
(SELECT DISTINCT REG_ID FROM
{item.ExecDatabase}.[DBO].OUT_DIAG WHERE {icd_or_diseaseCondition}) B,
{item.ExecDatabase}.[DBO].PUB_PATIENT C WHERE A.REG_ID=B.REG_ID AND A.PERSON_ID=C.PERSON_ID
UNION ALL
SELECT C.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,A.REG_CODE,A.REG_ID,2 REG_SOURCE,A.INHOS_TIME,{Indexs},a.org_Code hos_id,C.BIRTHDAY,C.SEX,1 TYPE,A.OUT_DEPT_NAME FROM
{item.ExecDatabase}.[DBO].INPAT_REG_INFO A , (SELECT DISTINCT REG_ID FROM {item.ExecDatabase}.[DBO].INPAT_DIAG WHERE {icd_or_diseaseCondition}) B,
{item.ExecDatabase}.[DBO].PUB_PATIENT C
WHERE A.REG_ID=B.REG_ID AND A.PERSON_ID=C.PERSON_ID";
conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@" insert into [SV_QueryPlatform_].[dbo].MEDIC_PERSON_INFORMATION_{Indexs }
( [HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],
[REG_TIME], AREA_ID,[INDEXS],[TYPE],[DEPT_NAME] )
SELECT [HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],
[REG_TIME],null AREA_ID,[INDEXS],[TYPE],[DEPT_NAME]
From [{item.ExecOpenLink}].[{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
//LOG($"查询成功,{num}行", $"{ITEM}", Indexs, "查询平台", "");
if (type1_2 == 2)
{
sql2 = $@"IF EXISTS(SELECT * FROM [{item.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'MEDIC_PERSON_INFORMATION_{Indexs}_2')
drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2;
SELECT A.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,B.REG_CODE,B.REG_ID,1 REG_SOURCE,B.REG_TIME,A.BIRTHDAY,A.SEX,2 TYPE, {Indexs} Indexs , b.org_code hos_id,B.DEPT_NAME into [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2
FROM {item.ExecDatabase}.[DBO].PUB_PATIENT A, {item.ExecDatabase}.[DBO].OUT_REG_INFO B,
(SELECT DISTINCT MASTER_INDEX FROM {item.ExecDatabase}.[DBO].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS= {Indexs} AND HOS_ID = cast(right('{item.ExecDatabase}',3)as int)) C
WHERE A.PERSON_ID=B.PERSON_ID AND A.MASTER_INDEX=C.MASTER_INDEX
UNION ALL
SELECT A.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,B.REG_CODE,B.REG_ID,2 REG_SOURCE,B.INHOS_TIME,A.BIRTHDAY,A.SEX,2 TYPE,{Indexs} , b.org_code,B.OUT_DEPT_NAME
FROM {item.ExecDatabase}.[DBO].PUB_PATIENT A, {item.ExecDatabase}.[DBO].INPAT_REG_INFO B,
(SELECT DISTINCT MASTER_INDEX FROM {item.ExecDatabase}.[DBO].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS={Indexs} AND HOS_ID = cast(right('{item.ExecDatabase}',3)as int)) C
WHERE A.PERSON_ID=B.PERSON_ID AND A.MASTER_INDEX=C.MASTER_INDEX ;";
conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@"INSERT into [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}]([HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME],AREA_ID,[INDEXS],[TYPE],[DEPT_NAME])
select [HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME],null,
[INDEXS],[TYPE],[DEPT_NAME]
From [{item.ExecOpenLink}].[{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@" DELETE FROM M FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}] M
INNER JOIN (SELECT * FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS = {Indexs}
AND HOS_ID =cast(right('{item.ExecDatabase}',3)as int) AND TYPE = 1) N
ON M.INDEXS = N.INDEXS AND M.HOS_ID = N.HOS_ID AND M.MASTER_INDEX = N.MASTER_INDEX
AND M.PERSON_ID = N.PERSON_ID AND M.REG_ID = N.REG_ID
AND M.REG_SOURCE = N.REG_SOURCE AND M.TYPE = 2 ;";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@" drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2;";
num = num + conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
// LOG($"查询成功,{num}行", $"{ITEM}", Indexs, "查询平台", "");
}
sql2 = $@" drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}; ";
num = num + conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
}
}
}
catch (Exception ex)
{
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);
HomeQueries home = new HomeQueries(_configConnectionString);
home.SendMail(@$"药品/疾病/材料平台提醒", @$"疾病拉取失败 {icd_or_diseaseCondition} 错误日志:{ex.ToString().Replace("'", "''")}", zxr);
}
}
}
}
public void Drugquery(long typefee, long type1_2, string drugs, string[] drugName, long Indexs, long ip, string zxr)
{
var where = "";
long num = 0;
long CompleteMar = 0;
if (ip == 1)
{
where = @$"and ExecOpenLink in ('192.168.18.151', '192.168.18.152', '192.168.18.153') ";
}
else if (ip == 2)
{
where = @$"and ExecOpenLink in ('192.168.18.154', '192.168.18.155', '192.168.18.156')";
}
else if (ip == 3)
{
where = @$"and ExecOpenLink in ('192.168.18.157', '192.168.18.158')";
}
else if (ip == 4)
{
where = "and ExecOpenLink not in ('192.168.18.151', '192.168.18.152', '192.168.18.153','192.168.18.154', '192.168.18.155', '192.168.18.156','192.168.18.157', '192.168.18.158')";
}
DbConnection configConnection = new SqlConnection(_configConnectionString);
List<SYS_Hospital> hos = configConnection.Query<SYS_Hospital>(@$"SELECT ExecOpenLink ,ExecDatabase FROM [192.168.18.156].[DB_SV_Data_Config].[dbo].[SYS_Hospital]
WHERE ExecOpenLink <>'' AND ExecOpenLink IS NOT NULL AND ExecDatabase <>'' AND ExecDatabase IS NOT NULL {where}").ToList();
服务器 fwq = new 服务器();
var msConnectionString = "";
var countsql = 0;
var sql2 = "";
var mzb = "";
var zyb = "";
if (typefee == 1) { mzb = "OUT_FEE"; zyb = "INPAT_FEE"; }
if (typefee == 2) { mzb = "OUT_PRES"; zyb = "INPAT_ORDER"; }
foreach (var item in hos)
{
//统计执行的多少家医院
countsql++;
var fwqsql = $"SELECT [服务器ip],[数据库账号],[数据库密码] FROM [SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{item.ExecOpenLink}'";
fwq = configConnection.Query<服务器>(fwqsql).FirstOrDefault();
msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", item.ExecOpenLink, item.ExecDatabase, fwq.数据库账号, fwq.数据库密码);
using (DbConnection conn = new SqlConnection(msConnectionString))
{
CompleteMar = Complete_MarkId(Indexs);
if (CompleteMar == 23)
{
throw new DomainException("查询失败!!");
}
if (CompleteMar == 31)
{
throw new DomainException("查询停止!!");
}
try
{
//判断状态 21在执行
if (CompleteMar == 21)
{
if (Countnum($@"SELECT count(*) FROM {item.ExecDatabase}.dbo.SYSOBJECTS WHERE NAME = 'DIC_FEE_SUMMARY'", conn) > 0)
{
if (Countnum($@"SELECT count(*) a FROM {item.ExecDatabase}.[dbo].[DIC_FEE_SUMMARY] where {drugs} ", conn) > 0)
{
//药品信息查询语句
foreach (var drug in drugName)
{
sql2 = $@"insert into [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] (
[HOS_ID] ,[ITEM_NAME] ,[MEDIC_NAME],[MEDIC_AREA],[INDEXS] )
select cast(right('{item.ExecDatabase}',3)as int) hos_id,ITEM_NAME,
'{drug}'MEDIC_NAME,medic_area medic_area,{Indexs} INDEXS from {item.ExecDatabase}.[dbo].[DIC_FEE_SUMMARY]
WHERE [ITEM_NAME] like '%{drug}%' GROUP BY ITEM_NAME,MEDIC_AREA ";
conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
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)
{
var sql3 = $@"IF EXISTS(SELECT * FROM [{item.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'MEDIC_PERSON_INFORMATION_{Indexs}')
drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs};
SELECT C.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,A.REG_CODE,A.REG_ID,'1' REG_SOURCE,
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_ID,D.ID FROM {item.ExecDatabase}.[dbo].{mzb} E 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_ID = B.REG_ID
JOIN {item.ExecDatabase}.[dbo].PUB_PATIENT C ON A.PERSON_ID = C.PERSON_ID
UNION ALL
SELECT C.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,A.REG_CODE,A.REG_ID,'2' REG_SOURCE,
A.INHOS_TIME,B.ID AREA_ID,{Indexs} INDEXS,cast( RIGHT ( '{item.ExecDatabase}', 3 ) AS int ) HOS_ID,
C.BIRTHDAY,C.SEX,1 TYPE,A.OUT_DEPT_NAME
FROM {item.ExecDatabase}.[dbo].INPAT_REG_INFO A
JOIN(SELECT DISTINCT REG_ID,D.ID FROM {item.ExecDatabase}.[dbo].{zyb} E 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_ID = B.REG_ID
JOIN {item.ExecDatabase}.[dbo].PUB_PATIENT C ON A.PERSON_ID = C.PERSON_ID
WHERE A.REG_ID = B.REG_ID AND A.PERSON_ID = C.PERSON_ID";
num = num + conn.Execute(sql3, commandTimeout: 60 * 60 * 5);
sql2 = $@"insert into [SV_QueryPlatform_].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}([HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME],AREA_ID,[INDEXS],[TYPE],[DEPT_NAME])
SELECT [HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME], AREA_ID,[INDEXS],[TYPE],[DEPT_NAME] From [{item.ExecOpenLink}].[{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
if (type1_2 == 2)
{
sql2 = $@"IF EXISTS(SELECT * FROM [{item.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'MEDIC_PERSON_INFORMATION_{Indexs}_2')
drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2;
SELECT A.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,B.REG_CODE,B.REG_ID,1 REG_SOURCE,B.REG_TIME,A.BIRTHDAY,A.SEX,2 TYPE, {Indexs} Indexs , b.org_code hos_id,B.DEPT_NAME into [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2
FROM {item.ExecDatabase}.[DBO].PUB_PATIENT A, {item.ExecDatabase}.[DBO].OUT_REG_INFO B,
(SELECT DISTINCT MASTER_INDEX FROM {item.ExecDatabase}.[DBO].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS= {Indexs} AND HOS_ID = cast(right('{item.ExecDatabase}',3)as int)) C
WHERE A.PERSON_ID=B.PERSON_ID AND A.MASTER_INDEX=C.MASTER_INDEX
UNION ALL
SELECT A.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,B.REG_CODE,B.REG_ID,2 REG_SOURCE,B.INHOS_TIME,A.BIRTHDAY,A.SEX,2 TYPE,{Indexs} , b.org_code,B.OUT_DEPT_NAME
FROM {item.ExecDatabase}.[DBO].PUB_PATIENT A, {item.ExecDatabase}.[DBO].INPAT_REG_INFO B,
(SELECT DISTINCT MASTER_INDEX FROM {item.ExecDatabase}.[DBO].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS={Indexs} AND HOS_ID = cast(right('{item.ExecDatabase}',3)as int)) C
WHERE A.PERSON_ID=B.PERSON_ID AND A.MASTER_INDEX=C.MASTER_INDEX;";
conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@"INSERT into [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}]([HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME],AREA_ID,[INDEXS],[TYPE],[DEPT_NAME])
select [HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME],null,[INDEXS],[TYPE],[DEPT_NAME] From [{item.ExecOpenLink}].[{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@" DELETE FROM M FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}] M
INNER JOIN (SELECT * FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS = {Indexs}
AND HOS_ID =cast(right('{item.ExecDatabase}',3)as int) AND TYPE = 1) N
ON M.INDEXS = N.INDEXS AND M.HOS_ID = N.HOS_ID AND M.MASTER_INDEX = N.MASTER_INDEX
AND M.PERSON_ID = N.PERSON_ID AND M.REG_ID = N.REG_ID
AND M.REG_SOURCE = N.REG_SOURCE AND M.TYPE = 2 ;";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@" drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2;";
num = num + conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
sql2 = $@" drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}; ";
num = num + conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
}
}
}
catch (Exception ex)
{
configConnection.Execute($"update [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK = 23,END_TIME=getdate(),log='ex:{ex.ToString()}sql:{ sql2.Replace("'", "''")}' where COMPLETE_MARK != 22 and id= " + Indexs);
HomeQueries home = new HomeQueries(_configConnectionString);
home.SendMail(@$"药品/疾病/材料平台提醒", @$"药品拉取失败{string.Join(",", drugName)} 错误日志:{ex.ToString().Replace("'", "''")}", zxr);
}
}
}
}
public long ItemQuery()
{
DbConnection connection = new SqlConnection(_configConnectionString);
var sql = $@"SELECT * FROM [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] where COMPLETE_MARK<>22 and COMPLETE_MARK<>31 ";
long count = connection.Query(sql).Count();
return count;
}
public void 材料query(long type1_2, string drugs, string[] drugName, long Indexs, long ip, string zxr)
{
var where = "";
long num = 0;
long CompleteMar = 0;
if (ip == 1)
{
where = @$"and ExecOpenLink in ('192.168.18.151', '192.168.18.152', '192.168.18.153') ";
}
else if (ip == 2)
{
where = @$"and ExecOpenLink in ('192.168.18.154', '192.168.18.155', '192.168.18.156')";
}
else if (ip == 3)
{
where = @$"and ExecOpenLink in ('192.168.18.157', '192.168.18.158')";
}
else if (ip == 4)
{
where = "and ExecOpenLink not in ('192.168.18.151', '192.168.18.152', '192.168.18.153','192.168.18.154', '192.168.18.155', '192.168.18.156','192.168.18.157', '192.168.18.158')";
}
DbConnection configConnection = new SqlConnection(_configConnectionString);
List<SYS_Hospital> hos = configConnection.Query<SYS_Hospital>(@$"SELECT ExecOpenLink ,ExecDatabase FROM [192.168.18.156].[DB_SV_Data_Config].[dbo].[SYS_Hospital]
WHERE ExecOpenLink <>'' AND ExecOpenLink IS NOT NULL AND ExecDatabase <>'' AND ExecDatabase IS NOT NULL {where}").ToList();
服务器 fwq = new 服务器();
var msConnectionString = "";
var countsql = 0;
var sql2 = "";
foreach (var item in hos)
{
//统计执行的多少家医院
countsql++;
var fwqsql = $"SELECT [服务器ip],[数据库账号],[数据库密码] FROM [SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{item.ExecOpenLink}'";
fwq = configConnection.Query<服务器>(fwqsql).FirstOrDefault();
msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", item.ExecOpenLink, item.ExecDatabase, fwq.数据库账号, fwq.数据库密码);
using (DbConnection conn = new SqlConnection(msConnectionString))
{
CompleteMar = Complete_MarkId(Indexs);
if (CompleteMar == 23)
{
throw new DomainException("查询失败!!");
}
if (CompleteMar == 31)
{
throw new DomainException("查询停止!!");
}
try
{
//判断状态 21在执行
if (CompleteMar == 21)
{
if (Countnum($@"SELECT count(*) FROM {item.ExecDatabase}.dbo.SYSOBJECTS WHERE NAME = 'DIC_FEE_SUMMARY'", conn) > 0)
{
if (Countnum($@"SELECT count(*) a FROM {item.ExecDatabase}.[dbo].[DIC_FEE_SUMMARY] where {drugs} ", conn) > 0)
{
//药品信息查询语句
foreach (var drug in drugName)
{
sql2 = $@"insert into [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] (
[HOS_ID] ,[ITEM_NAME] ,[MEDIC_NAME],[MEDIC_AREA],[INDEXS] )
select cast(right('{item.ExecDatabase}',3)as int) hos_id,ITEM_NAME,
'{drug}'MEDIC_NAME,medic_area medic_area,{Indexs} INDEXS from {item.ExecDatabase}.[dbo].[DIC_FEE_SUMMARY]
WHERE [ITEM_NAME] like '%{drug}%' GROUP BY ITEM_NAME,MEDIC_AREA ";
conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
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)
{
var sql3 = $@"IF EXISTS(SELECT * FROM [{item.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'MEDIC_PERSON_INFORMATION_{Indexs}')
drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs};
SELECT C.MASTER_INDEX MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,A.REG_CODE,A.REG_ID,'1'REG_SOURCE,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, (SELECT DISTINCT REG_ID,D.ID FROM {item.ExecDatabase}.[DBO].OUT_FEE E,
(SELECT * FROM [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] WHERE INDEXS={Indexs} AND (MEDIC_AREA IS NULL OR MEDIC_AREA ='')) D
WHERE HOS_ID = cast(right('{item.ExecDatabase}',3)as int) AND E.ITEM_NAME=D.ITEM_NAME
UNION ALL
SELECT DISTINCT REG_ID,D.ID FROM {item.ExecDatabase}.[DBO].OUT_FEE E,
(SELECT * FROM [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] WHERE INDEXS= {Indexs} AND MEDIC_AREA IS NOT NULL AND MEDIC_AREA!='') D
WHERE HOS_ID = cast(right('{item.ExecDatabase}',3)as int) AND E.ITEM_NAME=D.ITEM_NAME AND E.MEDIC_AREA=D.MEDIC_AREA ) B,{item.ExecDatabase}.[DBO].PUB_PATIENT C
WHERE A.REG_ID=B.REG_ID AND A.PERSON_ID=C.PERSON_ID
UNION ALL
SELECT C.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,A.REG_CODE,A.REG_ID,2 REG_SOURCE,A.INHOS_TIME,B.ID,{Indexs} ,cast(right('{item.ExecDatabase}',3)as int),C.BIRTHDAY,C.SEX,1,A.OUT_DEPT_NAME FROM
{item.ExecDatabase}.[DBO].INPAT_REG_INFO A,
(SELECT DISTINCT REG_ID,D.ID FROM {item.ExecDatabase}.[DBO].INPAT_FEE E,
(SELECT * FROM [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] WHERE INDEXS= {Indexs} AND (MEDIC_AREA IS NULL OR MEDIC_AREA ='')) D
WHERE HOS_ID = cast(right('{item.ExecDatabase}',3)as int) AND E.ITEM_NAME=D.ITEM_NAME
UNION ALL
SELECT DISTINCT REG_ID,D.ID FROM [DBO].INPAT_FEE E,
(SELECT * FROM [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_AREA_{Indexs}] WHERE INDEXS= {Indexs} AND MEDIC_AREA IS NOT NULL AND MEDIC_AREA!='') D
WHERE HOS_ID = cast(right('{item.ExecDatabase}',3)as int) AND E.ITEM_NAME=D.ITEM_NAME AND E.MEDIC_AREA=D.MEDIC_AREA) B, [DBO].PUB_PATIENT C WHERE A.REG_ID=B.REG_ID AND A.PERSON_ID=C.PERSON_ID";
num = num + conn.Execute(sql3, commandTimeout: 60 * 60 * 5);
sql2 = $@"insert into [SV_QueryPlatform_].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}([HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME],AREA_ID,[INDEXS],[TYPE],[DEPT_NAME])
SELECT [HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME], AREA_ID,[INDEXS],[TYPE],[DEPT_NAME] From [{item.ExecOpenLink}].[{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
if (type1_2 == 2)
{
sql2 = $@"IF EXISTS(SELECT * FROM [{item.ExecDatabase}].dbo.SYSOBJECTS WHERE NAME = 'MEDIC_PERSON_INFORMATION_{Indexs}_2')
drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2;
SELECT A.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,B.REG_CODE,B.REG_ID,1 REG_SOURCE,B.REG_TIME,A.BIRTHDAY,A.SEX,2 TYPE, {Indexs} Indexs , b.org_code hos_id,B.DEPT_NAME into [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2
FROM {item.ExecDatabase}.[DBO].PUB_PATIENT A, {item.ExecDatabase}.[DBO].OUT_REG_INFO B,
(SELECT DISTINCT MASTER_INDEX FROM {item.ExecDatabase}.[DBO].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS= {Indexs} AND HOS_ID = cast(right('{item.ExecDatabase}',3)as int)) C
WHERE A.PERSON_ID=B.PERSON_ID AND A.MASTER_INDEX=C.MASTER_INDEX
UNION ALL
SELECT A.MASTER_INDEX,A.PERSON_CODE,A.PERSON_ID,B.REG_CODE,B.REG_ID,2 REG_SOURCE,B.INHOS_TIME,A.BIRTHDAY,A.SEX,2 TYPE,{Indexs} , b.org_code,B.OUT_DEPT_NAME
FROM {item.ExecDatabase}.[DBO].PUB_PATIENT A, {item.ExecDatabase}.[DBO].INPAT_REG_INFO B,
(SELECT DISTINCT MASTER_INDEX FROM {item.ExecDatabase}.[DBO].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS={Indexs} AND HOS_ID = cast(right('{item.ExecDatabase}',3)as int)) C
WHERE A.PERSON_ID=B.PERSON_ID AND A.MASTER_INDEX=C.MASTER_INDEX;";
conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@"INSERT into [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}]([HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME],AREA_ID,[INDEXS],[TYPE],[DEPT_NAME])
select [HOS_ID],[MASTER_INDEX],[BIRTHDAY],[SEX],[PERSON_CODE],[PERSON_ID],[REG_CODE],[REG_ID],[REG_SOURCE],[REG_TIME],null,[INDEXS],[TYPE],[DEPT_NAME] From [{item.ExecOpenLink}].[{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@" DELETE FROM M FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}] M
INNER JOIN (SELECT * FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{Indexs}] WHERE INDEXS = {Indexs}
AND HOS_ID =cast(right('{item.ExecDatabase}',3)as int) AND TYPE = 1) N
ON M.INDEXS = N.INDEXS AND M.HOS_ID = N.HOS_ID AND M.MASTER_INDEX = N.MASTER_INDEX
AND M.PERSON_ID = N.PERSON_ID AND M.REG_ID = N.REG_ID
AND M.REG_SOURCE = N.REG_SOURCE AND M.TYPE = 2 ;";
num = num + configConnection.Execute(sql2, commandTimeout: 60 * 60 * 5);
sql2 = $@" drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}_2;";
num = num + conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
sql2 = $@" drop table [{item.ExecDatabase}].[dbo].MEDIC_PERSON_INFORMATION_{Indexs}; ";
num = num + conn.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
}
}
}
catch (Exception ex)
{
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);
HomeQueries home = new HomeQueries(_configConnectionString);
home.SendMail(@$"药品/疾病/材料平台提醒", @$"材料拉取失败 {string.Join(",", drugName)} 错误日志:{ex.ToString().Replace("'", "''")}", zxr);
}
}
}
}
public void 化验拉取(long indexs, long type, string item_name, long ip, int id, int ids)
{
DbConnection configConnection = new SqlConnection(_configConnectionString.Replace("SV_QueryPlatform", "SV_QueryPlatform_"));
var sql = "";
var where = "";
if (ip < 9)
{
where = @$"and ExecOpenLink ='192.168.18.15{ip}'";
}
else if (ip == 9)
{
where = "and ExecOpenLink not in ('192.168.18.151', '192.168.18.152', '192.168.18.153','192.168.18.154', '192.168.18.155', '192.168.18.156','192.168.18.157', '192.168.18.158')";
}
List<SYS_Hospital> hos = configConnection.Query<SYS_Hospital>(@$"
SELECT ExecOpenLink, ExecDatabase
FROM [192.168.18.156].[DB_SV_Data_Config].[dbo].[SYS_Hospital] a
JOIN (SELECT DISTINCT HOS_ID FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{ids}] where indexs={indexs})b ON a.id=b.HOS_ID
WHERE ExecOpenLink<>'' AND ExecOpenLink IS NOT NULL AND ExecDatabase<>'' AND ExecDatabase IS NOT NULL {where}", commandTimeout: 1000000).ToList();
foreach (var item in hos)
{
//统计执行的多少家医院
var fwqsql = $"SELECT [服务器ip],[数据库账号],[数据库密码] FROM [SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{item.ExecOpenLink}'";
服务器 fwq = configConnection.Query<服务器>(fwqsql).FirstOrDefault();
var msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", item.ExecOpenLink, item.ExecDatabase, fwq.数据库账号, fwq.数据库密码);
using (DbConnection conn = new SqlConnection(msConnectionString))
{
long CompleteMar = ASSAY_Complete_MarkId(id);
if (CompleteMar != 21)
{
throw new DomainException("查询失败!!");
}
else
{
if (type == 1)
{
sql = @$"
SELECT a.[MASTER_INDEX], [REPORT_CODE], b.[REG_ID], b.[REG_CODE], [EMP_CODE], [EMP_NAME], [REPORT_TIME], [SPECIMEN_TYPE], [ASSAY_ITEM_CODE],
[ASSAY_ITEM_NAME], [ITEM_ENAME], [UNIT], [RESULTS], [REFRANGE], [RESULTSTATUS], a.[REG_SOURCE], [ORG_CODE], [UPLOAD_TIME] into [{item.ExecDatabase}].dbo.ASSAY_REPORT_{indexs}_{id}
FROM (select *from msdb.[dbo].[MEDIC_PERSON_INFORMATION_化验检查_{indexs}_{id}] where HOS_ID=cast(right('{item.ExecDatabase}',3)as int) )a
JOIN (SELECT * FROM [{item.ExecDatabase}].[dbo].[ASSAY_REPORT] where {(item_name == "" ? "1=1" : item_name)} ) b
ON a.REG_CODE=b.REG_CODE AND a.REG_SOURCE=b.REG_SOURCE AND b.ORG_CODE=a.HOS_ID";
conn.Execute(sql, commandTimeout: 1000000);
sql = @$" insert into[192.168.18.181].[SV_QueryPlatform_].dbo.ASSAY_REPORT_{indexs}_{id}
([MASTER_INDEX], [REPORT_CODE], [REG_ID], [REG_CODE], [EMP_CODE], [EMP_NAME], [REPORT_TIME], [SPECIMEN_TYPE], [ASSAY_ITEM_CODE],
[ASSAY_ITEM_NAME], [ITEM_ENAME], [UNIT], [RESULTS], [REFRANGE], [RESULTSTATUS], [REG_SOURCE], [ORG_CODE], [UPLOAD_TIME])
select [MASTER_INDEX], [REPORT_CODE], [REG_ID], [REG_CODE], [EMP_CODE], [EMP_NAME], [REPORT_TIME], [SPECIMEN_TYPE], [ASSAY_ITEM_CODE],
[ASSAY_ITEM_NAME], [ITEM_ENAME], [UNIT], [RESULTS], [REFRANGE], [RESULTSTATUS], [REG_SOURCE], [ORG_CODE], [UPLOAD_TIME]
From [{item.ExecDatabase}].dbo.ASSAY_REPORT_{indexs}_{id}
where RESULTS LIKE '%项目%' OR RESULTS LIKE '%结果%' OR RESULTS LIKE '%单位%' OR RESULTS LIKE '%范围%'";
conn.Execute(sql, commandTimeout: 1000000);
sql = @$"
insert into [192.168.18.181].[SV_QueryPlatform_].dbo.ASSAY_REPORT_FORMAT_{indexs}_{id}
([MASTER_INDEX], [REPORT_CODE], [REG_ID], [REG_CODE], [EMP_CODE], [EMP_NAME], [REPORT_TIME], [SPECIMEN_TYPE], [ASSAY_ITEM_CODE],
[ASSAY_ITEM_NAME], [ITEM_ENAME], [UNIT], [RESULTS], [REFRANGE], [RESULTSTATUS], [REG_SOURCE], [ORG_CODE], [UPLOAD_TIME])
select [MASTER_INDEX], [REPORT_CODE], [REG_ID], [REG_CODE], [EMP_CODE], [EMP_NAME], [REPORT_TIME], [SPECIMEN_TYPE], [ASSAY_ITEM_CODE],
[ASSAY_ITEM_NAME], [ITEM_ENAME], [UNIT], [RESULTS], [REFRANGE], [RESULTSTATUS], [REG_SOURCE], [ORG_CODE], [UPLOAD_TIME]
From [{item.ExecDatabase}].dbo.ASSAY_REPORT_{indexs}_{id}
where RESULTS not LIKE '%项目%' and RESULTS not LIKE '%结果%' and RESULTS not LIKE '%单位%' and RESULTS not LIKE '%范围%' ;";
conn.Execute(sql, commandTimeout: 60 * 60 * 5);
sql = @$" drop table [{item.ExecDatabase}].dbo.ASSAY_REPORT_{indexs}_{id} ;";
conn.Execute(sql, commandTimeout: 1000000);
}
if (type == 2)
{
sql = @$"
insert into [192.168.18.181].[SV_QueryPlatform_].dbo.EXEC_REPORT_{indexs}_{id}
([MASTER_INDEX], [REPORT_CODE], [REG_ID], [REG_CODE], [ORDER_ID], [ORDER_CODE], [PATIENT_MEDICALREC], [EXAMINE_NAME], [EXAMINE_SHOW],[EXAMINE_RESULT], [EMP_CODE], [EMP_NAME], [REPORT_TIME],[REG_SOURCE], [ORG_CODE], [UPLOAD_TIME])
SELECT a.[MASTER_INDEX], [REPORT_CODE], b.[REG_ID], b.[REG_CODE], [ORDER_ID], [ORDER_CODE], [PATIENT_MEDICALREC], [EXAMINE_NAME], [EXAMINE_SHOW], [EXAMINE_RESULT], [EMP_CODE], [EMP_NAME], [REPORT_TIME], a.[REG_SOURCE], [ORG_CODE], [UPLOAD_TIME]
FROM (select *from msdb.[dbo].[MEDIC_PERSON_INFORMATION_化验检查_{indexs}_{id}] where HOS_ID=cast(right('{item.ExecDatabase}',3)as int) ) a
JOIN(SELECT * FROM [{item.ExecDatabase}].[dbo].[EXEC_REPORT] where {(item_name == "" ? "1=1" : item_name)} ) b ON a.REG_CODE=b.REG_CODE AND a.REG_SOURCE=b.REG_SOURCE AND b.ORG_CODE=a.HOS_ID;
";
conn.Execute(sql, commandTimeout: 1000000);
}
}
}
}
}
public int indexsId(int indexs)
{
DbConnection connection = new SqlConnection(_configConnectionString.Replace("SV_QueryPlatform", "SV_QueryPlatform_"));
var sql = $@"select id,end_time From [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] where id ={indexs}";
MEDIC_SEARCH_RECORD msr = connection.Query<MEDIC_SEARCH_RECORD>(sql, commandTimeout: 60 * 60 * 5).First();//拼接
int ids = msr.id;
if (msr.end_time.Year != DateTime.Now.Year || msr.end_time.Month != DateTime.Now.Month)
{
ids = int.Parse(msr.end_time.Year.ToString() + msr.end_time.Month.ToString());
}
return ids;
}
public void 化验query(long type, long indexs, int id, long bz, string zxr, int ids = 0, string item_name = "")
{
DbConnection configConnection = new SqlConnection(_configConnectionString);
List<string> hos = configConnection.Query<string>(@$"
SELECT distinct ExecOpenLink
FROM [192.168.18.156].[DB_SV_Data_Config].[dbo].[SYS_Hospital] a
WHERE ExecOpenLink<>'' AND ExecOpenLink IS NOT NULL AND ExecDatabase<>'' AND ExecDatabase IS NOT NULL").ToList();
try
{
if (bz == 1)
{
var sql = $@"SELECT distinct REG_CODE,REG_SOURCE,HOS_ID,MASTER_INDEX into [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_化验检查_{indexs}_{id}]
FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{ids}]
WHERE INDEXS={indexs}";
configConnection.Execute(sql, commandTimeout: 1000000);
}
if (bz == 2)
{
var sql = "";
var msConnectionString = "";
DbConnection conn = null;
foreach (var item in hos)
{
var fwqsql = $"SELECT [服务器ip],[数据库账号],[数据库密码] FROM [SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{item}'";
服务器 fwq = configConnection.Query<服务器>(fwqsql).FirstOrDefault();
msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", item, "msdb", fwq.数据库账号, fwq.数据库密码);
conn = new SqlConnection(msConnectionString);
if (type == 1)
{
sql = @$"
select * into msdb.[dbo].[MEDIC_PERSON_INFORMATION_化验检查_{indexs}_{id}]
from [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_化验检查_{indexs}_{id}]";
}
if (type == 2)
{
sql = @$"
select * into msdb.[dbo].[MEDIC_PERSON_INFORMATION_化验检查_{indexs}_{id}]
from [192.168.18.181].[SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_化验检查_{indexs}_{id}]";
}
conn.Execute(sql, commandTimeout: 1000000);
}
msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", "192.168.18.181", "SV_QueryPlatform_", "sa", "Suvalue2016");
conn = new SqlConnection(msConnectionString);
sql = @$"drop table [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_化验检查_{indexs}_{id}]";
conn.Execute(sql, commandTimeout: 1000000);
}
if (bz == 3)
{
var tasks = new List<Task>();
tasks.Add(Task.Factory.StartNew(() => 化验拉取(indexs, type, item_name, 1, id, ids)));
tasks.Add(Task.Factory.StartNew(() => 化验拉取(indexs, type, item_name, 2, id, ids)));
tasks.Add(Task.Factory.StartNew(() => 化验拉取(indexs, type, item_name, 3, id, ids)));
tasks.Add(Task.Factory.StartNew(() => 化验拉取(indexs, type, item_name, 4, id, ids)));
tasks.Add(Task.Factory.StartNew(() => 化验拉取(indexs, type, item_name, 5, id, ids)));
tasks.Add(Task.Factory.StartNew(() => 化验拉取(indexs, type, item_name, 6, id, ids)));
tasks.Add(Task.Factory.StartNew(() => 化验拉取(indexs, type, item_name, 7, id, ids)));
tasks.Add(Task.Factory.StartNew(() => 化验拉取(indexs, type, item_name, 8, id, ids)));
tasks.Add(Task.Factory.StartNew(() => 化验拉取(indexs, type, item_name, 9, id, ids)));
Task.WaitAll(tasks.ToArray());
}
if (bz == 4)
{
foreach (var item in hos)
{
var fwqsql = $"SELECT [服务器ip],[数据库账号],[数据库密码] FROM [SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{item}'";
服务器 fwq = configConnection.Query<服务器>(fwqsql).FirstOrDefault();
var msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", item, "msdb", fwq.数据库账号, fwq.数据库密码);
var sql = "";
using (DbConnection conn = new SqlConnection(msConnectionString))
{
if (type == 1)
{
sql = @$"
drop table [dbo].[MEDIC_PERSON_INFORMATION_化验检查_{indexs}_{id}]";
}
if (type == 2)
{
sql = @$"
drop table[dbo].[MEDIC_PERSON_INFORMATION_化验检查_{indexs}_{id}]";
}
conn.Execute(sql, commandTimeout: 100000);
}
}
}
if (bz == 5)
{
ASSAYREPORT(indexs, id, item_name);
}
if (bz == 6)
{
configConnection.Execute(@$"update [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD_ASSAY]
set COMPLETE_MARK = 22,END_TIME=getdate() where COMPLETE_MARK not in (23, 22) and id= " + id);
}
}
catch (Exception ex)
{
var sql = $"update [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD_ASSAY] set COMPLETE_MARK = 23,END_TIME=getdate(),log='步骤{bz} 错误:{ex.ToString().Replace("'", "''").Distinct()}' where id={id}";
configConnection.Execute(sql);
HomeQueries home = new HomeQueries(_configConnectionString);
home.SendMail(@$"化验拉取提醒", @$"{(type == 1 ? "化验" : "检查")} 拉取失败! indexs:{indexs} id:{id} 报错步骤:{bz} 错误日志:{ex.ToString().Replace("'", "''")}", zxr);
throw;
}
}
public int SqlAssayAdd(int indexs, string project_name, string[] commodity_name, int type)
{
DbConnection connection = new SqlConnection(_configConnectionString.Replace("SV_QueryPlatform", "SV_QueryPlatform_"));
var sql = @$"
INSERT into [dbo].[MEDIC_SEARCH_RECORD_ASSAY]([Indexs],[PROJECT_NAME],[COMMODITY_NAME],[COMPLETE_MARK],[search_time],[TYPE],[END_TIME],[log])
VALUES({indexs},'{project_name}','{string.Join(",", commodity_name)}',21,getdate(),{type},null,null)";
connection.Execute(sql, commandTimeout: 60 * 60 * 5);
sql = @$"SELECT max(id) id FROM[SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD_ASSAY] where Indexs={indexs} and project_name='{project_name}'
and COMMODITY_NAME='{string.Join(",", commodity_name)}' and COMPLETE_MARK=21 and TYPE={type} and END_TIME is null and log is null ";
int id = connection.Query<int>(sql).FirstOrDefault();
if (type == 1)
{
sql = @$"
CREATE TABLE[dbo].[ASSAY_REPORT_FORMAT_{indexs}_{id}] (
[REPORT_ID][BIGint] IDENTITY(1, 1) NOT NULL,
[MASTER_INDEX] [int] NULL,
[REPORT_CODE][NVARCHAR] (MAX)NULL,
[REG_ID][BIGint] NULL,
[REG_CODE][NVARCHAR] (100) NULL,
[EMP_CODE][NVARCHAR] (MAX)NULL,
[EMP_NAME][VARBINARY] (MAX)NULL,
[REPORT_TIME][DATETIME] NULL,
[SPECIMEN_TYPE][NVARCHAR] (MAX)NULL,
[ASSAY_ITEM_CODE][NVARCHAR] (MAX)NULL,
[ASSAY_ITEM_NAME][NVARCHAR] (MAX)NULL,
[ITEM_ENAME][NVARCHAR] (MAX)NULL,
[UNIT][NVARCHAR] (MAX)NULL,
[RESULTS][NVARCHAR] (MAX)NULL,
[REFRANGE][NVARCHAR] (MAX)NULL,
[RESULTSTATUS][NVARCHAR] (MAX)NULL,
[REG_SOURCE][int] NULL,
[ORG_CODE][int] NOT NULL,
[UPLOAD_TIME] [DATETIME] NULL
) ON[PRIMARY] TEXTIMAGE_ON[PRIMARY]
CREATE NONCLUSTERED INDEX ASSAY_REPORT_FORMAT_h_m_{indexs}_{id} ON[SV_QueryPlatform_].[dbo].[ASSAY_REPORT_FORMAT_{indexs}_{id}]([MASTER_INDEX],[ORG_CODE])
CREATE TABLE[dbo].[ASSAY_REPORT_{indexs}_{id}] (
[REPORT_ID][BIGint] IDENTITY(1, 1) NOT NULL,
[MASTER_INDEX] [int] NULL,
[REPORT_CODE][NVARCHAR] (MAX)NULL,
[REG_ID][BIGint] NULL,
[REG_CODE][NVARCHAR] (100) NULL,
[EMP_CODE][NVARCHAR] (MAX)NULL,
[EMP_NAME][VARBINARY] (MAX)NULL,
[REPORT_TIME][DATETIME] NULL,
[SPECIMEN_TYPE][NVARCHAR] (MAX)NULL,
[ASSAY_ITEM_CODE][NVARCHAR] (MAX)NULL,
[ASSAY_ITEM_NAME][NVARCHAR] (MAX)NULL,
[ITEM_ENAME][NVARCHAR] (MAX)NULL,
[UNIT][NVARCHAR] (MAX)NULL,
[RESULTS][NVARCHAR] (MAX)NULL,
[REFRANGE][NVARCHAR] (MAX)NULL,
[RESULTSTATUS][NVARCHAR] (MAX)NULL,
[REG_SOURCE][int] NULL,
[ORG_CODE][int] NOT NULL,
[UPLOAD_TIME] [DATETIME] NULL
) ON[PRIMARY] TEXTIMAGE_ON[PRIMARY]";
}
if (type == 2)
{
sql = @$"
CREATE TABLE [dbo].[EXEC_REPORT_{indexs}_{id}](
[REPORT_ID] [int] IDENTITY(1,1) NOT NULL,
[MASTER_INDEX] [int] NULL,
[REPORT_CODE] [NVarchar](50) NULL,
[REG_ID] [Bigint] NULL,
[REG_CODE] [NVarchar](50) NULL,
[ORDER_ID] [Bigint] NULL,
[ORDER_CODE] [NVarchar](50) NULL,
[PATIENT_MEDICALREC] [NVarchar](MAX) NULL,
[EXAMINE_NAME] [NVarchar](max) NULL,
[EXAMINE_SHOW] [NVarchar](max) NULL,
[EXAMINE_RESULT] [NVarchar](max) NULL,
[EMP_CODE] [NVarchar](20) NULL,
[EMP_NAME] [Varbinary](MAX) NULL,
[REPORT_TIME] [DateTime] NULL,
[REG_SOURCE] [int] NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [DateTime] NULL,
CONSTRAint [PK_EXEC_REPORT_{indexs}_{id}] PRIMARY KEY CLUSTERED
(
[REPORT_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]";
}
connection.Execute(sql);
return id;
}
/// <summary>
/// 化验切割
/// </summary>
/// <param name="index"></param>
/// <param name="id"></param>
/// <param name="item_name"></param>
public void ASSAYREPORT(long index, int id, string item_name = "")
{
DbConnection connection = new SqlConnection(_configConnectionString.Replace("SV_QueryPlatform", "SV_QueryPlatform_"));
//创建切割数据表
var sql = @$"SELECT * into dbo.ASSAY_REPORT_TEMP_{index}_{id} FROM [dbo].ASSAY_REPORT_{index}_{id}";
//第一层切割
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,'[','')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,']','')PRlong('将]替换 ')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,' ','`') prlong('将空格替换`')
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,'`H','') prlong('将 `H 去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`*','') prlong('将 `* 去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`↑','')prlong('将 `↑去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`高','')prlong('将 `高 去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`↓','')prlong('将 `↓去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'`低','')prlong('将 `低 去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'>','') prlong('将 > 去除')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'<','') prlong('将 < 去除')
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=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`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&2`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&3`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&4`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&5`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&6`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&7`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&8`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&9`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&10`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&11`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&12`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&13`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&14`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&15`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&16`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&17`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&18`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&19`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&20`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&21`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&22`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&23`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&24`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&25`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&26`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&27`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&28`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&29`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&30`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&31`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&32`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&33`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&34`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&35`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&36`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&37`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&38`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&39`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&40`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&41`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&42`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&43`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&44`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&45`','&')
UPDATE dbo.ASSAY_REPORT_TEMP_{index}_{id} SET RESULTS=REPLACE(RESULTS,'&46`','&')
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,'&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,'【互】','') prlong('将 【互】去除')
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,'``','`')
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,'``','`')
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,'``','`')
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,'&`','&')";
//函数分列,换行
var sql3 = $@"SELECT ORG_CODE,REPORT_ID,a.REG_CODE,
[dbo].[fGetStrBySplit](RESULTS,0,'`')ITEM_ENAME ,
[dbo].[fGetStrBySplit](RESULTS,1,'`') RESULTS,
[dbo].[fGetStrBySplit](RESULTS,2,'`') UNIT,
[dbo].[fGetStrBySplit](RESULTS,3,'`') REFRANGE into [dbo].[ASSAY1_{index}_{id}] FROM (
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,1,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,2,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,3,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,4,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,5,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,6,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,7,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,8,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,9,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,10,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
)a WHERE [dbo].[fGetStrBySplit](RESULTS,1,'`') NOT LIKE '%名称%'
AND [dbo].[fGetStrBySplit](RESULTS,1,'`') <>'' AND [dbo].[fGetStrBySplit](RESULTS,1,'`') IS NOT NULL
SELECT ORG_CODE,REPORT_ID,a.REG_CODE,
[dbo].[fGetStrBySplit](RESULTS,0,'`')ITEM_ENAME ,
[dbo].[fGetStrBySplit](RESULTS,1,'`') RESULTS,
[dbo].[fGetStrBySplit](RESULTS,2,'`') UNIT,
[dbo].[fGetStrBySplit](RESULTS,3,'`') REFRANGE into [dbo].[ASSAY2_{index}_{id}] FROM (
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,11,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,12,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,13,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,14,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,15,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,16,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,17,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,18,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,19,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,20,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
)a WHERE [dbo].[fGetStrBySplit](RESULTS,1,'`') NOT LIKE '%名称%'
AND [dbo].[fGetStrBySplit](RESULTS,1,'`') <>'' AND [dbo].[fGetStrBySplit](RESULTS,1,'`') IS NOT NULL
SELECT ORG_CODE,REPORT_ID,a.REG_CODE,
[dbo].[fGetStrBySplit](RESULTS,0,'`')ITEM_ENAME ,
[dbo].[fGetStrBySplit](RESULTS,1,'`') RESULTS,
[dbo].[fGetStrBySplit](RESULTS,2,'`') UNIT,
[dbo].[fGetStrBySplit](RESULTS,3,'`') REFRANGE into [dbo].[ASSAY3_{index}_{id}] FROM (
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,21,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,22,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,23,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,24,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,25,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,26,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,27,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,28,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,29,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,30,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
)a WHERE [dbo].[fGetStrBySplit](RESULTS,1,'`') NOT LIKE '%名称%'
AND [dbo].[fGetStrBySplit](RESULTS,1,'`') <>'' AND [dbo].[fGetStrBySplit](RESULTS,1,'`') IS NOT NULL
SELECT ORG_CODE,REPORT_ID,a.REG_CODE,
[dbo].[fGetStrBySplit](RESULTS,0,'`')ITEM_ENAME ,
[dbo].[fGetStrBySplit](RESULTS,1,'`') RESULTS,
[dbo].[fGetStrBySplit](RESULTS,2,'`') UNIT,
[dbo].[fGetStrBySplit](RESULTS,3,'`') REFRANGE into [dbo].[ASSAY4_{index}_{id}] FROM (
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,31,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,32,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,33,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,34,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,35,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,36,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,37,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,38,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,39,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,40,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
)a WHERE [dbo].[fGetStrBySplit](RESULTS,1,'`') NOT LIKE '%名称%'
AND [dbo].[fGetStrBySplit](RESULTS,1,'`') <>'' AND [dbo].[fGetStrBySplit](RESULTS,1,'`') IS NOT NULL
SELECT ORG_CODE,REPORT_ID,a.REG_CODE,
[dbo].[fGetStrBySplit](RESULTS,0,'`')ITEM_ENAME ,
[dbo].[fGetStrBySplit](RESULTS,1,'`') RESULTS,
[dbo].[fGetStrBySplit](RESULTS,2,'`') UNIT,
[dbo].[fGetStrBySplit](RESULTS,3,'`') REFRANGE into [dbo].[ASSAY5_{index}_{id}] FROM (
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,41,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,42,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,43,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,44,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,45,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,46,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,47,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,48,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
SELECT ORG_CODE,REPORT_ID,REG_CODE, [dbo].[fGetStrBySplit](RESULTS,49,'&')RESULTS FROM dbo.ASSAY_REPORT_TEMP_{index}_{id}
UNION
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 '%名称%'
AND [dbo].[fGetStrBySplit](RESULTS,1,'`') <>'' AND [dbo].[fGetStrBySplit](RESULTS,1,'`') IS NOT NULL
prlong('临时数据生成中')
SELECT * into [dbo].[ASSAY_{index}_{id}] FROM (
SELECT*FROM [dbo].[ASSAY1_{index}_{id}]
UNION ALL
SELECT*FROM [dbo].[ASSAY2_{index}_{id}]
UNION ALL
SELECT*FROM [dbo].[ASSAY3_{index}_{id}]
UNION ALL
SELECT*FROM [dbo].[ASSAY4_{index}_{id}]
UNION ALL
SELECT*FROM [dbo].[ASSAY5_{index}_{id}])a
WHERE UNIT not LIKE '单位'
AND a.UNIT NOT LIKE '%审核%'
AND ITEM_ENAME NOT LIKE '%备注%'
AND a.ITEM_ENAME NOT LIKE '%标本%'
AND ITEM_ENAME not LIKE '单位'
AND a.ITEM_ENAME NOT LIKE '%审核%'
AND UNIT NOT LIKE '%备注%'
AND a.UNIT NOT LIKE '%标本%';
prlong('临时数据生成完成');";
connection.Execute(sql, commandTimeout: 60 * 60 * 5);
connection.Execute(sql2, commandTimeout: 60 * 60 * 5);
connection.Execute(sql3, commandTimeout: 60 * 60 * 5);
var sql4 = @$"SELECT DISTINCT
STUFF((SELECT ',' + 'b.' + name FROM SysColumns Where id = Object_Id('dbo.ASSAY_REPORT_TEMP_{index}_{id}') FOR XML PATH('')), 1, 1, '') as tablename
FROM SysColumns a Where id = Object_Id('dbo.ASSAY_REPORT_TEMP_{index}_{id}'); ";
string zd = connection.Query<string>(sql4).ToList().FirstOrDefault();
zd = zd.Replace("b.ITEM_ENAME", "a.ITEM_ENAME").Replace("b.RESULTS", "a.RESULTS").Replace("b.UNIT", "a.UNIT").Replace("b.REFRANGE", "a.REFRANGE").Replace("a.RESULTSTATUS", "b.RESULTSTATUS");
var sql5 = @$" insert into [dbo].[ASSAY_REPORT_FORMAT_{index}_{id}]
({zd.Replace("a.", "").Replace("b.", "").Replace("REPORT_ID,", "")} )
select {zd.Replace("b.REPORT_ID,", "")} from [dbo].[ASSAY_{index}_{id}] A
join dbo.ASSAY_REPORT_TEMP_{index}_{id} B on A.REPORT_ID=B.REPORT_ID";
connection.Execute(sql5, commandTimeout: 60 * 60 * 5);
connection.Execute(@$" drop table ASSAY_REPORT_TEMP_{index}_{id}
drop table ASSAY1_{index}_{id}
drop table ASSAY2_{index}_{id}
drop table ASSAY3_{index}_{id}
drop table ASSAY4_{index}_{id}
drop table ASSAY5_{index}_{id}
drop table ASSAY_{index}_{id}
drop table [dbo].[ASSAY_REPORT_{index}_{id}]
", commandTimeout: 60 * 60 * 5);
}
public IEnumerable<dynamic> MEDIC_SEARCH_RECORD_ASSAY(int id)
{
DbConnection connection = new SqlConnection(_configConnectionString.Replace("SV_QueryPlatform", "SV_QueryPlatform_"));
var sql = $@"SELECT [ID]
,[PROJECT_NAME]项目名称
,[COMMODITY_NAME]查询条件
,case [COMPLETE_MARK] when 21 then '执行中' when 22 then '执行结束' when 23 then '执行失败' end 状态
,[search_time]开始时间
,case [TYPE] when 1 then '化验' when 2 then'检查' end [检查/化验]
,[END_TIME] 结束时间
FROM [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD_ASSAY] where [Indexs]={id}";
return connection.Query(sql, commandTimeout: 60 * 60 * 5).ToList(); ;
}
public void 定时执行()
{
DbConnection configConnection = new SqlConnection(_configConnectionString.Replace("SV_QueryPlatform", "SV_QueryPlatform_"));
configConnection.Execute($"EXEC [SV_QueryPlatform_].[dbo].[MonthBeginningStatementConsolidation]", commandTimeout: 60 * 60 * 5);
}
}
}
using Dapper;
using DocumentFormat.OpenXml;
using FluentEmail.Core;//
using FluentEmail.Smtp;//
using Microsoft.AspNetCore.Http;
using Microsoft.Data.SqlClient;
using Newtonsoft.Json;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using QueryPlatform.Api.Infrastructure.Modules;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;
using System.Linq;
using System.Net;//
using System.Net.Mail;//
using System.Text;
namespace QueryPlatform.Api.Infrastructure.Queries
{
public class HomeQueries
{
private readonly string _configConnectionString;
public HomeQueries(string configConnectionString)
{
_configConnectionString = configConnectionString;
}
private DbConnection Connection()
{
return new SqlConnection(_configConnectionString);
}
#region 存储函数添加查询
public void FuncaConfiguration(COMMONLYUSED commonly)
{
var funcaadd = @$"INSERT into [SV_QueryPlatform_Demand].[dbo].[CommonlyUsed](Name,value,remarks) VALUES('{commonly.Name}','{commonly.value.Replace("'", "''")}','{commonly.remarks}')";
Connection().Execute(funcaadd);
}
/// <summary>
/// 存储函数展示
/// </summary>
/// <returns></returns>
public IEnumerable<dynamic> FuncaQuery()
{
var query = @$"SELECT [Name],[value] ,[remarks] FROM [SV_QueryPlatform_Demand].[dbo].[CommonlyUsed]";
return Connection().Query(query).ToList();
}
public IEnumerable<dynamic> lingchuanglujingjiancha(string name)
{
if (string.IsNullOrEmpty(name))
{
name = "肺脓肿";
}
var where = @$"where clinical_route_name = '{name}'";
var query = @$"SELECT
clinical_route_name,
CASE WHEN LAG(医嘱名称) OVER (ORDER BY cast(排序 as int),医嘱名称) = 医嘱名称 THEN NULL ELSE 住院 END AS 住院,
CASE WHEN LAG(医嘱名称) OVER (ORDER BY cast(排序 as int),医嘱名称) = 医嘱名称 THEN NULL ELSE 住院标准 END AS 住院标准,
CASE WHEN LAG(医嘱名称) OVER (ORDER BY cast(排序 as int),医嘱名称) = 医嘱名称 THEN NULL ELSE 医嘱类型 END AS 医嘱类型,
CASE WHEN LAG(医嘱名称) OVER (ORDER BY cast(排序 as int),医嘱名称) = 医嘱名称 THEN NULL ELSE 是否必开 END AS 是否必开 ,
CASE WHEN LAG(医嘱名称) OVER (ORDER BY cast(排序 as int),医嘱名称) = 医嘱名称 THEN NULL ELSE 医嘱名称 END AS 医嘱名称,
项目,
备注,
项目id
FROM
( SELECT 排序 排序 ,clinical_route_name clinical_route_name ,住院 住院,住院标准, 医嘱类型,是否必开,医嘱名称,项目,备注,项目id ,
ROW_NUMBER() OVER (ORDER BY cast(排序 as int) ) AS row_num
FROM [DB_丹寨县人民医院].[dbo].[View_临床核对]{where}) a
ORDER BY clinical_route_name,cast(排序 as int);";
return Connection().Query(query).ToList();
}
#endregion
#region 需求记录展示、添加、导出csv、上传sql脚本
public string Executes(DateTime StartTime, DateTime EndTime, string WebRootPath)
{
var sql = $@" SELECT [START_TIME] 项目时间,Demand_User 需求来源, [Demand_Name]需求名称,[Demand_Describe]需求描述 FROM [SV_QueryPlatform_Demand].[dbo].[MEDIC_DEMAND]where 1=1 {((StartTime.ToString() != "0001/1/1 0:00:00") ? "and [search_time]>='" + StartTime + "'" : "")}
{((EndTime.ToString() != "0001/1/1 0:00:00") ? "and [search_time]<='" + EndTime + "'" : "")} order by START_TIME";
var queryData = Connection().Query(sql);
var data1 = queryData.Select(t => t as IDictionary<string, object>).ToList();
try
{
var strRows = new StringBuilder();//数据拼写,这里是测试数据不多,但是真是情况基本是大量数据。所以要用StringBuilder
if (data1.Any())
{
// Header
strRows.Append(string.Join(",", data1[0].Select(t => t.Key)));
strRows.Append(@$"
");//换行
foreach (var item in data1)
{
var vals = item.Values.Select(t =>
{
var value = t?.ToString();
return string.IsNullOrWhiteSpace(value) ? "" : value;
});
strRows.Append(string.Join(",", vals));
strRows.Append(@$"
");//换行
}
}
string sExportFileName = "需求记录导出" + DateTime.Now.AddDays(-1).ToString("yyyyMMdd") + ".csv"; //文件名
string path = Path.Combine(WebRootPath + @"\export", sExportFileName);
string 下载地址 = @"http://192.168.18.181:8055/api/export/export/" + sExportFileName;
//检查是否有这个文件,没有创建文件,最后一定要Close,不然文件占用无法写入
if (File.Exists(path))
{
System.IO.File.Delete(path); //已有该文件进行删除
}
File.Create(path).Close();//创建文件
//写入文件
using (System.IO.StreamWriter file = new System.IO.StreamWriter(path, true))
{
file.WriteLine(strRows);
file.Dispose();
}
return 下载地址;
}
catch (Exception ex)
{
return ex.ToString();
}
}
public (IEnumerable<dynamic>, IEnumerable<dynamic>) DemandQuery(long paseIndex, string Demand_Name)
{
string where = " ";
if (!string.IsNullOrEmpty(Demand_Name))
{
where = "and [Demand_Name] like '%" + Demand_Name + "%'";
}
string where2 = " ";
if (!string.IsNullOrEmpty(Demand_Name))
{
where2 = " where [Demand_Name] like '%" + Demand_Name + "%'";
}
IEnumerable<dynamic> sj = Connection().Query($@"
SELECT ID, [Demand_Name], [Demand_Describe], [INDEXS],[Demand_User], [START_TIME]
FROM [SV_QueryPlatform_Demand].[dbo].[MEDIC_DEMAND] {where2} order by id desc offset ({paseIndex} - 1)*(10) rows fetch next 10 rows only").ToList();
IEnumerable<dynamic> zon = Connection().Query($@"SELECT CAST(COUNT(*)AS MONEY)totalCount ,{paseIndex} paseIndex FROM(
SELECT ID FROM [SV_QueryPlatform_Demand].[dbo].[MEDIC_DEMAND] {where2})a").ToList();
return (sj, zon);
}
public void Demand(SYS_DEMAND sYS_Demand)
{
var sql = @$"INSERT into [SV_QueryPlatform_Demand].[dbo].[MEDIC_DEMAND]([START_TIME],[INDEXS],[Demand_Describe],[Demand_Name],[Demand_User] ) VALUES(getdate(),{sYS_Demand.INDEXS},'{sYS_Demand.Demand_Describe}','{sYS_Demand.Demand_Name}','{sYS_Demand.Demand_User}')";
Connection().Execute(sql, commandTimeout: 60 * 60 * 5);
}
public string PostFile(IFormFile file, string WebRootPath)
{
StreamReader reader = new StreamReader(file.OpenReadStream());
string content = reader.ReadToEnd();
string name = file.FileName;
var date = DateTime.Now.ToLongDateString().ToString(); // 2008年9月4日
var time = DateTime.Now.ToLongTimeString().ToString(); // 20:16:16
var dateTime = date + time;
string filename = "";
string 下载地址 = "";
if (name.Substring(name.Length - 3, 3) == "txt" || name.Substring(name.Length - 3, 3) == "sql")
{
if (name.Substring(name.Length - 3, 3) == "sql")
{
name = name.Replace("sql", "txt");
}
filename = Path.Combine(WebRootPath + @"\export", name.Replace(".", dateTime.Replace(":", "") + "."));
下载地址 = @"http://192.168.18.181:8055/api/export/export/" + name.Replace(".", dateTime.Replace(":", "") + ".");
}
else
{
throw new DomainException("只支持txt || sql文件!!!");
}
if (System.IO.File.Exists(filename))
{
System.IO.File.Delete(filename);
}
using (FileStream fs = System.IO.File.Create(filename))
{
// 复制文件
file.CopyTo(fs);
// 清空缓冲区数据
fs.Flush();
}
return 下载地址;
}
public void Demandfu(SYS_DEMANDSUBLIS sYS_DemandSublist, string WebRootPath)
{
string xzfile = PostFile(sYS_DemandSublist.file, WebRootPath);
var sql = @$"INSERT into [SV_QueryPlatform_Demand].[dbo].[MEDIC_DEMAND_Sublist]([START_TIME],[Fid],[sql_text] ,UserName,remark) VALUES(getdate(),'{sYS_DemandSublist.id}','{xzfile}','{sYS_DemandSublist.UserName}','{sYS_DemandSublist.remark}')";
Connection().Execute(sql, commandTimeout: 60 * 60 * 5);
}
public IEnumerable<dynamic> DemandQueryfu(int id)
{
var query = @$"SELECT [ID],[START_TIME] ,[sql_text],[UserName],[remark] FROM [SV_QueryPlatform_Demand].[dbo].[MEDIC_DEMAND_Sublist] where fid={id}";
return Connection().Query(query).ToList();
}
#endregion
#region 服务器
/// <summary>
/// 添加服务器
/// </summary>
/// <param name="servers"></param>
public void ServersConfiguration(服务器 servers)
{
var sql = @$"INSERT into [SV_QueryPlatform].[dbo].[服务器]([服务器ip],[数据库账号],[数据库密码])VALUES('{servers.服务器ip}','{servers.数据库账号}','{servers.数据库密码}')";
Connection().Execute(sql, commandTimeout: 60 * 60 * 5);
}
/// <summary>
/// 展示服务器
/// </summary>
/// <param name="servers"></param>
public IEnumerable<dynamic> ServersShow()
{
return Connection().Query(@$"SELECT * FROM [SV_QueryPlatform].[dbo].[服务器]");
}
#endregion
#region 查询南海核对数据
public IEnumerable<dynamic> YiYuanHeDui(long hos_id, string year)
{
var where = @$" and year={year} and HospitalId={hos_id}";
var sql = @$"SELECT 1 a, a 大类别,x 年份,y 小类别,cast(value as nvarchar)值
FROM OPENQUERY([MYSQL49],
'select ''人均就诊次数''a, year x,CONCAT(Source ,''-'',''平均就诊次数'') y,round(sum(persontime)/sum(personnum),2) value
from hos_original_personnum
where 1 = 1 {where}
group by x,Source')
union
SELECT 2, a,x,y,cast(value as nvarchar)
FROM OPENQUERY([MYSQL49], '
SELECT ''业务总收入''a,year x, CONCAT(Source, '' - '', ''业务收入'') y,cast(SUM(FEE) as SIGNED) value
FROM Hos_original_feetype where 1 = 1 {where}
GROUP BY year,Source ')
union
SELECT 3, a,y,x,cast(value as nvarchar)
FROM OPENQUERY([MYSQL49], '
select ''业务总收入''a, year y, CONCAT(Source, '' - '', ''医保收入'')x, round(sum(fee)) value
from hos_original_paytypefee t where paytype1 = ''医保'' {where}
group by y,Source ')
union
SELECT 4, 业务收入结构,y,x,cast(value as nvarchar)
FROM OPENQUERY([MYSQL49], '
select t1.*from(
select ''业务收入结构'', year y, concat(Classification, '''', ''占比'') x, concat(round(cast(sum(fee) as SIGNED) / (select sum(VALUE) from(
select Classification x, year y, cast(sum(fee) as SIGNED) value from Hos_original_feetype
where classification not in ('''', ''\0'') {where}
group by year, Classification
) t1 left join(select name, sort from sys_sort where type = ''feetype'') t2
on t1.x = t2.name) * 100, 2),'''',''%'') value
from Hos_original_feetype
where classification not in ('''',''\0'') {where}
group by year,Classification
) t1 left join(select name, sort from sys_sort where type = ''feetype'') t2
on t1.x = t2.name')
union
SELECT 5, 工作量,y,x,cast(value as nvarchar)
FROM OPENQUERY([MYSQL49], '
select ''工作量'', year y, CONCAT(Source, '''', ''量'')x,cast(sum(persontime) as SIGNED) value
from Hos_original_persontime where 1 = 1 {where} group by year,Source
')
union
SELECT 6,工作量,y,x,cast(value as nvarchar)
FROM OPENQUERY([MYSQL49], '
select ''工作量'', year y, CONCAT(Source, '''', ''医保业务量'')x, sum(PersonTime) value from hos_original_paytypeperson t where paytype1 = ''医保'' {where}
group by y ,Source')
union
SELECT 7, x,y,平均住院日,cast(value as nvarchar)
FROM OPENQUERY([MYSQL49], '
SELECT ''平均住院日''x,year y, ''平均住院日'', format(sum(daycount) / sum(persontime), 2) value
FROM hos_original_hosstay where 1 = 1 {where}
GROUP BY year ')
union
SELECT 8, x,y,医保平均住院日,cast(value as nvarchar)
FROM OPENQUERY([MYSQL49], '
select ''平均住院日''x,year y, ''医保平均住院日'',round(sum(daycount) / sum(persontime), 2) value
from hos_original_paytypeperson where paytype1 = ''医保'' and source = ''住院'' {where} group by y ')
union
SELECT 9, y,x,收住院率,cast(value as nvarchar)
FROM OPENQUERY([MYSQL49], '
select ''收住院率''y,t1.x x, ''收住院率'',round(t1.value * 100.0 / t2.value, 2) value from(
select year x, cast(sum(persontime) as signed) value from hos_original_persontime
where source = ''住院'' and year<>'''' {where} group by year ) t1 left join(
select year x, cast(sum(persontime) as signed) value from hos_original_persontime
where source = ''门诊'' and year <> '''' {where} group by year) t2 on t1.x = t2.x')
union
SELECT 10, x,y,医保收住院率, cast(value as nvarchar) FROM OPENQUERY([MYSQL49], '
select ''收住院率'' x, year y, ''医保收住院率'',round(sum(case source when ''住院'' then persontime end) * 100 / sum(case source when ''门诊'' then persontime end), 2) value
from hos_original_paytypeperson where paytype1 = ''医保'' {where} group by x,y ')
union
SELECT 11, 次均费用,y,x,cast(value as nvarchar) FROM OPENQUERY([MYSQL49], '
select ''次均费用'',t1.y,concat(t1.Source, t1.x, ''次均费用'')x, round(t1.value / t2.value, 2) value
from(select paytype1 x, year y, Source, sum(fee) value from hos_original_paytypefee
where 1 = 1 {where} group by x, y, Source) t1
inner join(select paytype1 x, year y, Source, sum(persontime) value from hos_original_paytypeperson
where 1 = 1 {where} group by x, y, Source) t2
on t1.x = t2.x and t1.y = t2.y and t1.Source = t2.Source where t1.x = ''医保''')
union
SELECT 12, 次均费用,x,y,cast(value as nvarchar)
FROM OPENQUERY([MYSQL49], '
select ''次均费用'' ,a.year x, concat(a.Source, '''', ''次均费用'') y, ROUND(a.fee / b.persontime) value from(
select Source, year, sum(fee) fee from Hos_original_feetype where 1 = 1 {where}
group by year,Source ) a right join(
select Source, year, sum(persontime) persontime from Hos_original_persontime where 1 = 1 {where} group by year, Source
) b on a.year = b.year and a.Source = b.Source')";
return Connection().Query(sql);
;
}
#endregion
#region 爬虫保存josn
public IEnumerable<dynamic> Ybyp(string josn, long ym)
{
var sql = @$"insert into [SV_QueryPlatform_Demand].[dbo].[医保字典json]([医保字典json],[页])
select replace(replace('{josn.Replace("'", "")}',' ',''),'
',''),{ym} ";
return Connection().Query(sql);
}
#endregion
#region 操作人查询
public IEnumerable<dynamic> ZxrQuery(SYS_USER sYS_USER)
{
DbConnection connection = new SqlConnection(_configConnectionString);
return connection.Query<dynamic>($@"SELECT UserName FROM [SV_QueryPlatform_Demand].[dbo].[Mailboxs] where type={(sYS_USER.States == true ? "2" : "3")}").ToList();
}
#endregion
#region 数据探索sql生成存储过程
public List<DES> DESIsAssay()
{
DbConnection connection = new SqlConnection(_configConnectionString);
return connection.Query<DES>($@"SELECT [id],IsAssay
FROM [SV_QueryPlatform_Demand].[dbo].[DateExplorationSql] where IsAssay=1").ToList();
}
public IEnumerable<dynamic> DateExplorationSql()
{
DbConnection connection = new SqlConnection(_configConnectionString);
return connection.Query<dynamic>($@"SELECT [id]
,[SV_QueryPlatform_].[dbo].[fGetStrBySplit]([RuleName],0,'|') Name1
,[SV_QueryPlatform_].[dbo].[fGetStrBySplit]([RuleName],1,'|') Name2
,[SV_QueryPlatform_].[dbo].[fGetStrBySplit]([RuleName],2,'|') Name3
,[SV_QueryPlatform_].[dbo].[fGetStrBySplit]([RuleName],3,'|') Name4
,[SV_QueryPlatform_].[dbo].[fGetStrBySplit]([RuleName],4,'|') Name5
,[SV_QueryPlatform_].[dbo].[fGetStrBySplit]([RuleName],5,'|') Name6
,[SV_QueryPlatform_].[dbo].[fGetStrBySplit]([RuleName],6,'|') Name7
,[SV_QueryPlatform_].[dbo].[fGetStrBySplit]([RuleName],7,'|') Name8
,[SV_QueryPlatform_].[dbo].[fGetStrBySplit]([RuleName],8,'|') Name9
,[SV_QueryPlatform_].[dbo].[fGetStrBySplit]([RuleName],9,'|') Name10
FROM [SV_QueryPlatform_Demand].[dbo].[DateExplorationSql]").ToList();
}
public long DateExplorationSql1(List<DateExploration> dateExplorations)
{
string where = "";
foreach (var item in dateExplorations.Select(s => s.Id))
{
where = "," + item;
}
where = where.Substring(1);
var sql = @$"SELECT * FROM [SV_QueryPlatform_Demand].[dbo].[DateExplorationSql] where id in ({where}) and RuleName like '%首诊%' ";
DbConnection connection = new SqlConnection(_configConnectionString);
return connection.Query<dynamic>(sql).Count();
}
public string DateExploration(int id, string name, string TableName, long indexs)
{
DbConnection connection = new SqlConnection(_configConnectionString);
var sql = connection.Query<string>($@"DECLARE @return_value long,@sql nvarchar(max) SELECT @sql = N'output' EXEC @return_value = [SV_QueryPlatform_].[dbo].[DemandExploration] @id = {id},@condition = N'{name}',@TableName = N'{TableName}',@indexs = {indexs},@sql = @sql OUTPUT SELECT @sql sql").FirstOrDefault();
return sql;
}
#endregion
#region 添加绩效拿回医院数据登记
public (IEnumerable<dynamic>, IEnumerable<dynamic>) ExtractShou(long paseIndex)
{
DbConnection connection = new SqlConnection(_configConnectionString);
IEnumerable<dynamic> data = connection.Query($@"
select HOS_ID,ExecOpenLink,ExecDatabase,HOS_NAME,CREATION_TIME,UPDATE_TIME,START_TIME,END_TIME,I_UPDATE_TIME,REMARK,Executor from (
SELECT a.ID,HOS_ID,b.ExecOpenLink,b.ExecDatabase,HOS_NAME,CREATION_TIME,UPDATE_TIME,START_TIME,END_TIME,I_UPDATE_TIME,REMARK,Executor
FROM [SV_QueryPlatform_Demand].[dbo].[DataExtract] a
join [192.168.18.156].[DB_SV_Data_Config].[dbo].[SYS_Hospital] b on a.HOS_ID=b.id)a order by case when a.I_UPDATE_TIME<=getdate() then 1000000 else id end
desc offset ({paseIndex}- 1)*(10) rows fetch next 10 rows only").ToList();
IEnumerable<dynamic> zong = connection.Query($@"SELECT CAST(COUNT(*)AS MONEY)totalCount ,{paseIndex} paseIndex FROM(
SELECT ID FROM [SV_QueryPlatform_Demand].[dbo].[DataExtract])a").ToList();
return (data, zong);
}
public void Update(DATAEXTRACT dataExtract)
{
DbConnection connection = new SqlConnection(_configConnectionString);
var sql = @$"update [SV_QueryPlatform_Demand].[dbo].[DataExtract] set HOS_ID='{dataExtract.HOS_ID}',UPDATE_TIME=getdate(),START_TIME='{dataExtract.START_TIME}',END_TIME='{dataExtract.END_TIME}',I_UPDATE_TIME='{dataExtract.END_TIME.AddMonths(3)}',REMARK='{dataExtract.REMARK}' where hos_id={dataExtract.HOS_ID}";
connection.Execute(sql, commandTimeout: 60 * 60 * 5);
}
public void Add(SYS_EXTRACT sYS_Extract)
{
DbConnection connection = new SqlConnection(_configConnectionString);
List<DATAEXTRACT> ques = connection.Query<DATAEXTRACT>(@$"select HOS_ID from [SV_QueryPlatform_Demand].[dbo].[DataExtract]").ToList();
foreach (var item in ques)
{
if (item.HOS_ID == sYS_Extract.HOS_ID)
{
throw new DomainException("医院已存在,无需重复添加!");
}
}
var sql = @$"INSERT into [SV_QueryPlatform_Demand].[dbo].[DataExtract](HOS_ID,HOS_NAME,CREATION_TIME,UPDATE_TIME,START_TIME,END_TIME,I_UPDATE_TIME,REMARK,Executor )VALUES('{sYS_Extract.HOS_ID}','{sYS_Extract.HOS_NAME}',getdate(),getdate(),'{sYS_Extract.START_TIME}','{sYS_Extract.END_TIME}','{sYS_Extract.END_TIME.AddMonths(3)}','{sYS_Extract.REMARK}','{sYS_Extract.Executor}')";
connection.Execute(sql, commandTimeout: 60 * 60 * 5);
var sql2 = @$"update [SV_QueryPlatform_Demand].[dbo].[DataExtract] set ExecDatabase=(SELECT b.ExecDatabase FROM [SV_QueryPlatform_Demand].[dbo].[DataExtract] a
join [192.168.18.156].[DB_SV_Data_Config].[dbo].[SYS_Hospital] b on a.HOS_ID=b.id where a.hos_id={sYS_Extract.HOS_ID}),ExecOpenLink=((SELECT b.ExecOpenLink FROM [SV_QueryPlatform_Demand].[dbo].[DataExtract] a
join [192.168.18.156].[DB_SV_Data_Config].[dbo].[SYS_Hospital] b on a.HOS_ID=b.id where a.hos_id={sYS_Extract.HOS_ID})) where [HOS_ID]={sYS_Extract.HOS_ID}";
connection.Execute(sql2, commandTimeout: 60 * 60 * 5);
}
#endregion
#region 发送邮箱
public void SendMail(string title, string content, string zxr = "")
{
DbConnection connection = new SqlConnection(_configConnectionString);
var sql = @$"SELECT [mailbox],[password],[type],[UserName],jurisdiction,[SV_QueryPlatform_Demand].dbo.fn_GetPy(UserName) UserNames FROM [SV_QueryPlatform_Demand].[dbo].[Mailboxs]";
var mailboxs = connection.Query<Mailboxs>(sql, commandTimeout: 60 * 60 * 5);
var OutgoingEmail = mailboxs.Where(w => w.type == 1).FirstOrDefault();
var ReceivingMailboxs = mailboxs;
if (string.IsNullOrEmpty(zxr))
{
ReceivingMailboxs = mailboxs.Where(w => w.type == 2 & w.jurisdiction == "管理员").ToList();
}
else
{
sql = @$"SELECT [SV_QueryPlatform_Demand].dbo.fn_GetPy('{zxr}') UserNames ";
var zxrs = connection.Query<string>(sql).FirstOrDefault();
ReceivingMailboxs = mailboxs.Where(w => w.type == 2 & w.UserNames == zxrs).ToList();
}
SmtpClient smtp = new SmtpClient
{
Host = "smtp.qq.com",
UseDefaultCredentials = true,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
Credentials = new NetworkCredential(OutgoingEmail.mailbox, OutgoingEmail.password)
};
Email.DefaultSender = new SmtpSender(smtp);
try
{
foreach (var item in ReceivingMailboxs)
{
if (item != null)
{
var email = Email
.From(OutgoingEmail.mailbox)//发送人
.To(item.mailbox)//收件人 .CC("admin@126.com")//抄送人
.Subject(title)//邮件标题
.Body(content);//邮件内容
email.Send();//发送
}
}
}
catch (Exception e)
{
throw;
}
}
#endregion
#region 传入人群表 调用存储过程生成excl导出数据
public void DateExploration(string ExportTableName)
{
DbConnection connection = new SqlConnection(_configConnectionString);
var sql = connection.Execute($@"EXEC SV_QueryPlatform_.[dbo].[DataExport] N'{ExportTableName}' ", commandTimeout: 10000000);
}
#endregion
#region 导出excel表格数据
public string Excelex(string ExportTableName, string WebRootPath)
{
DbConnection connection = new SqlConnection(_configConnectionString);
var memory = new MemoryStream();
var date = DateTime.Now;
var sql = "";
string 下载地址 = "";
try
{
DateExploration(ExportTableName);
}
catch (Exception e)
{
throw new DomainException($@"请核对表名!如果无误请确保有拼库名!错误:" + e);
}
try
{
string newFile = Path.Combine(WebRootPath + @"\export", "病人模板导出" + date.Year + date.Month + date.Day + date.Hour + date.Minute + date.Second + ".xlsx");
下载地址 = @"http://192.168.18.181:8055/api/export/export/" + "病人模板导出" + date.Year + date.Month + date.Day + date.Hour + date.Minute + date.Second + ".xlsx";
if (System.IO.File.Exists(newFile))
{
System.IO.File.Delete(newFile);
}
using (var fs = new FileStream(newFile, FileMode.Create, FileAccess.ReadWrite))
{
//HSSFWorkbook workbook = new HSSFWorkbook();.xls(选用xls的话,最后返回下载的后缀名改为xls)
XSSFWorkbook workbook = new XSSFWorkbook();//.xlsx,(推荐xlsx,2007版本以上都是xlsx的)
#region 病人表
var sheet = workbook.CreateSheet("病人表");//创建工作表
var header = sheet.CreateRow(0);//工作行
var brb = new Dictionary<string, Func<PUB_PATIENT, object>>
{
{ "0"+" 病人编码" , t => t.病人编码},
{ "1"+" 医院病人编码" , t => t.医院病人编码},
{ "2"+" 性别" , t => t.性别},
{ "3"+" 出生日期" , t => t.出生日期},
{ "4"+" 标准地域" , t => t.标准地域},
{ "5"+" 民族" , t => t.民族},
{ "6"+" 国籍" , t => t.国籍},
{ "7"+" 创建机构" , t => t.创建机构},
{ "8"+" 病人主索引" , t => t.病人主索引}
};
foreach (var item in brb)
{
int key = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var name = item.Key.Replace(key + " ", "");
header.CreateCell(key).SetCellValue(name);
}
var rowIndex = 1;
sql = $"SELECT * FROM [数据导出].[dbo].[PUB_PATIENT]";
var PUB_PATIENT = connection.Query<PUB_PATIENT>(sql).OrderBy(s => s.病人主索引).ToList();
for (int i = 0; i < PUB_PATIENT.Count; i++)
{
var datarow = sheet.CreateRow(rowIndex);
foreach (var item in brb)
{
var cell = datarow.CreateCell(int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" "))));
cell.SetCellValue(string.IsNullOrEmpty(item.Value.Invoke(PUB_PATIENT[i])?.ToString()) ? "" : item.Value.Invoke(PUB_PATIENT[i])?.ToString());
}
rowIndex++;
}
#endregion
#region 门诊登记
var sheet1 = workbook.CreateSheet("门诊登记");//创建工作表
var header1 = sheet1.CreateRow(0);//工作行
var brb1 = new Dictionary<string, Func<OUT_REG_INFO, object>>
{
{ "0"+" 挂号序号" , t => t.挂号序号},
{ "1"+" 医院挂号序号" , t => t.医院挂号序号},
{ "2"+" 病人编码" , t => t.病人编码},
{ "3"+" 医院病人编码" , t => t.医院病人编码},
{ "4"+" 挂号时间" , t => t.挂号时间},
{ "5"+" 医院挂号科室" , t => t.医院挂号科室},
{ "6"+" 医院科室名称" , t => t.医院科室名称},
{ "7"+" 医保类型" , t => t.医保类型},
{ "8"+" 急诊_门诊" , t => t.急诊_门诊},
{ "9"+" 标准一级诊断" , t => t.标准一级诊断},
{ "10"+" 标准科室" , t => t.标准科室},
{ "11"+" 创建机构" , t => t.创建机构},
{ "12"+" 上传时间" , t => t.上传时间},
{ "13"+" 是否医保" , t => t.是否医保},
{ "14"+" 总费用" , t => t.总费用},
{ "15"+" 自付费用" , t => t.自付费用}
};
foreach (var item in brb1)
{
int key = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var name = item.Key.Replace(key + " ", "");
header1.CreateCell(key).SetCellValue(name);
}
var rowIndex1 = 1;
sql = $"SELECT * FROM [数据导出].[dbo].[OUT_REG_INFO]";
var OUT_REG_INFO = connection.Query<OUT_REG_INFO>(sql).OrderBy(s => s.挂号序号).ToList();
for (int i = 0; i < OUT_REG_INFO.Count; i++)
{
var datarow = sheet1.CreateRow(rowIndex1);
foreach (var item in brb1)
{
var cell = datarow.CreateCell(int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" "))));
cell.SetCellValue(string.IsNullOrEmpty(item.Value.Invoke(OUT_REG_INFO[i])?.ToString()) ? "" : item.Value.Invoke(OUT_REG_INFO[i])?.ToString());
}
rowIndex1++;
}
#endregion
#region 门诊诊断
var sheet2 = workbook.CreateSheet("门诊诊断");//创建工作表
var header2 = sheet2.CreateRow(0);//工作行
var brb2 = new Dictionary<string, Func<OUT_DIAG, object>>
{
{ "0"+" 诊断序号" , t => t.诊断序号},
{ "1"+" 医院诊断序号" , t => t.医院诊断序号},
{ "2"+" 挂号序号" , t => t.挂号序号},
{ "3"+" 医院挂号序号" , t => t.医院挂号序号},
{ "4"+" 诊断编号" , t => t.诊断编号},
{ "5"+" 诊断编码" , t => t.诊断编码},
{ "6"+" 疾病名称" , t => t.疾病名称},
{ "7"+" 诊断日期" , t => t.诊断日期},
{ "8"+" 备注" , t => t.备注},
{ "9"+" 创建机构" , t => t.创建机构}
};
foreach (var item in brb2)
{
int key = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var name = item.Key.Replace(key + " ", "");
header2.CreateCell(key).SetCellValue(name);
}
var rowIndex2 = 1;
sql = $"SELECT * FROM [数据导出].[dbo].[OUT_DIAG]";
var OUT_DIAG = connection.Query<OUT_DIAG>(sql).OrderBy(s => s.诊断序号).ToList();
for (int i = 0; i < OUT_DIAG.Count; i++)
{
var datarow = sheet2.CreateRow(rowIndex2);
foreach (var item in brb2)
{
var cell = datarow.CreateCell(int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" "))));
cell.SetCellValue(string.IsNullOrEmpty(item.Value.Invoke(OUT_DIAG[i])?.ToString()) ? "" : item.Value.Invoke(OUT_DIAG[i])?.ToString());
}
rowIndex2++;
}
#endregion
#region 门诊处方
var sheet3 = workbook.CreateSheet("门诊处方");//创建工作表
var header3 = sheet3.CreateRow(0);//工作行
var brb3 = new Dictionary<string, Func<OUT_PRES, object>>
{
{ "0"+" 处方编号" , t => t.处方编号},
{ "1"+" 医院处方编号" , t => t.医院处方编号},
{ "2"+" 挂号序号" , t => t.挂号序号},
{ "3"+" 医院挂号序号" , t => t.医院挂号序号},
{ "4"+" 组号" , t => t.组号},
{ "5"+" 处方序号" , t => t.处方序号},
{ "6"+" 处方时间" , t => t.处方时间},
{ "7"+" 处方类型" , t => t.处方类型},
{ "8"+" 药品代码" , t => t.药品代码},
{ "9"+" 药品分类" , t => t.药品分类},
{ "10"+" 药品通用名称" , t => t.药品通用名称},
{ "11"+" 药品名称" , t => t.药品名称},
{ "12"+" 药品剂型" , t => t.药品剂型},
{ "13"+" 药品规格" , t => t.药品规格},
{ "14"+" 药品产地" , t => t.药品产地},
{ "15"+" 每次用量" , t => t.每次用量},
{ "16"+" 用量单位" , t => t.用量单位},
{ "17"+" 用法编码" , t => t.用法编码},
{ "18"+" 给药方式" , t => t.给药方式},
{ "19"+" 配药天数" , t => t.配药天数},
{ "20"+" 配药单位" , t => t.配药单位},
{ "21"+" 皮试结果" , t => t.皮试结果},
{ "22"+" 用药备注" , t => t.用药备注},
{ "23"+" 医保分类" , t => t.医保分类},
{ "24"+" 创建机构" , t => t.创建机构}
};
foreach (var item in brb3)
{
int key = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var name = item.Key.Replace(key + " ", "");
header3.CreateCell(key).SetCellValue(name);
}
var rowIndex3 = 1;
sql = $"SELECT * FROM [数据导出].[dbo].[OUT_PRES]";
var OUT_PRES = connection.Query<OUT_PRES>(sql).OrderBy(s => s.处方编号).ToList();
for (int i = 0; i < OUT_PRES.Count; i++)
{
var datarow = sheet3.CreateRow(rowIndex3);
foreach (var item in brb3)
{
var cell = datarow.CreateCell(int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" "))));
cell.SetCellValue(string.IsNullOrEmpty(item.Value.Invoke(OUT_PRES[i])?.ToString()) ? "" : item.Value.Invoke(OUT_PRES[i])?.ToString());
}
rowIndex3++;
}
#endregion
#region 门诊费用
var sheet4 = workbook.CreateSheet("门诊费用");//创建工作表
var header4 = sheet4.CreateRow(0);//工作行
var brb4 = new Dictionary<string, Func<OUT_FEE, object>>
{
{ "0"+" 收费号" , t => t.收费号},
{ "1"+" 上传收费号" , t => t.上传收费号},
{ "2"+" 挂号序号" , t => t.挂号序号},
{ "3"+" 医院挂号序号" , t => t.医院挂号序号},
{ "4"+" 项目种类" , t => t.项目种类},
{ "5"+" 上传费用代码" , t => t.上传费用代码},
{ "6"+" 费用名称" , t => t.费用名称},
{ "7"+" 单价" , t => t.单价},
{ "8"+" 费用类别" , t => t.费用类别},
{ "9"+" 数量" , t => t.数量},
{ "10"+" 单位" , t => t.单位},
{ "11"+" 金额" , t => t.金额},
{ "12"+" 科室编码" , t => t.科室编码},
{ "13"+" 科室名称" , t => t.科室名称},
{ "14"+" 收费日期" , t => t.收费日期},
{ "15"+" 创建机构" , t => t.创建机构},
{ "16"+" 标准分类名称" , t => t.标准分类名称},
{ "17"+" 药品产地" , t => t.药品产地},
{ "18"+" 执行科室编码" , t => t.执行科室编码},
{ "19"+" 执行科室名称" , t => t.执行科室名称}
};
foreach (var item in brb4)
{
int key = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var name = item.Key.Replace(key + " ", "");
header4.CreateCell(key).SetCellValue(name);
}
var rowIndex4 = 1;
sql = $"SELECT * FROM [数据导出].[dbo].[OUT_FEE]";
var OUT_FEE = connection.Query<OUT_FEE>(sql).OrderBy(s => s.收费号).ToList();
for (int i = 0; i < OUT_FEE.Count; i++)
{
var datarow = sheet4.CreateRow(rowIndex4);
foreach (var item in brb4)
{
var cell = datarow.CreateCell(int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" "))));
cell.SetCellValue(string.IsNullOrEmpty(item.Value.Invoke(OUT_FEE[i])?.ToString()) ? "" : item.Value.Invoke(OUT_FEE[i])?.ToString());
}
rowIndex4++;
}
#endregion
#region 住院登记
var sheet5 = workbook.CreateSheet("住院登记");//创建工作表
var header5 = sheet5.CreateRow(0);//工作行
var brb5 = new Dictionary<string, Func<INPAT_REG_INFO, object>>
{
{ "0"+" 住院序号" , t => t.住院序号},
{ "1"+" 医院住院序号" , t => t.医院住院序号},
{ "2"+" 病人编码" , t => t.病人编码},
{ "3"+" 医院病人编号" , t => t.医院病人编号},
{ "4"+" 上传入院科室" , t => t.上传入院科室},
{ "5"+" 入院科室名称" , t => t.入院科室名称},
{ "6"+" 病区名称" , t => t.病区名称},
{ "7"+" 入院时间" , t => t.入院时间},
{ "8"+" 出院时间" , t => t.出院时间},
{ "9"+" 医保类型" , t => t.医保类型},
{ "10"+" 身高" , t => t.身高},
{ "11"+" 体重" , t => t.体重},
{ "12"+" 入院情况" , t => t.入院情况},
{ "13"+" 出院情况" , t => t.出院情况},
{ "14"+" 标准一级诊断" , t => t.标准一级诊断},
{ "15"+" 标准科室" , t => t.标准科室},
{ "16"+" 创建机构" , t => t.创建机构},
{ "17"+" 是否医保" , t => t.是否医保},
{ "18"+" 腰围" , t => t.腰围},
{ "19"+" 总费用" , t => t.总费用},
{ "20"+" 自付费用" , t => t.自付费用},
{ "21"+" 出院科室编码" , t => t.出院科室编码},
{ "22"+" 出院科室名称" , t => t.出院科室名称},
{ "23"+" 住院病人的来源" , t => t. 住院病人的来源}
};
foreach (var item in brb5)
{
int key = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var name = item.Key.Replace(key + " ", "");
header5.CreateCell(key).SetCellValue(name);
}
var rowIndex5 = 1;
sql = $"SELECT * FROM [数据导出].[dbo].[INPAT_REG_INFO]";
var INPAT_REG_INFO = connection.Query<INPAT_REG_INFO>(sql).OrderBy(s => s.住院序号).ToList();
for (int i = 0; i < INPAT_REG_INFO.Count; i++)
{
var datarow = sheet5.CreateRow(rowIndex5);
foreach (var item in brb5)
{
var cell = datarow.CreateCell(int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" "))));
cell.SetCellValue(string.IsNullOrEmpty(item.Value.Invoke(INPAT_REG_INFO[i])?.ToString()) ? "" : item.Value.Invoke(INPAT_REG_INFO[i])?.ToString());
}
rowIndex5++;
}
#endregion
#region 住院诊断
var sheet6 = workbook.CreateSheet("住院诊断");//创建工作表
var header6 = sheet6.CreateRow(0);//工作行
var brb6 = new Dictionary<string, Func<INPAT_DIAG, object>>
{
{ "0"+" 诊断序号" , t => t.诊断序号},
{ "1"+" 医院住院序号" , t => t.医院住院序号},
{ "2"+" 住院序号" , t => t.住院序号},
{ "3"+" 医院住院序号" , t => t.医院住院序号},
{ "4"+" 诊断编号" , t => t.诊断编号},
{ "5"+" 编码" , t => t.编码},
{ "6"+" 疾病名称" , t => t.疾病名称},
{ "7"+" 备注" , t => t.备注},
{ "8"+" 诊断类型" , t => t.诊断类型},
{ "9"+" 诊断时间" , t => t.诊断时间},
{ "10"+" 治愈状态" , t => t.治愈状态},
{ "11"+" 创建机构" , t => t.创建机构}
};
foreach (var item in brb6)
{
int key = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var name = item.Key.Replace(key + " ", "");
header6.CreateCell(key).SetCellValue(name);
}
var rowIndex6 = 1;
sql = $"SELECT * FROM [数据导出].[dbo].[INPAT_DIAG]";
var INPAT_DIAG = connection.Query<INPAT_DIAG>(sql).OrderBy(s => s.诊断序号).ToList();
for (int i = 0; i < INPAT_DIAG.Count; i++)
{
var datarow = sheet6.CreateRow(rowIndex6);
foreach (var item in brb6)
{
var cell = datarow.CreateCell(int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" "))));
cell.SetCellValue(string.IsNullOrEmpty(item.Value.Invoke(INPAT_DIAG[i])?.ToString()) ? "" : item.Value.Invoke(INPAT_DIAG[i])?.ToString());
}
rowIndex6++;
}
#endregion
#region 住院医嘱
var sheet7 = workbook.CreateSheet("住院医嘱");//创建工作表
var header7 = sheet7.CreateRow(0);//工作行
var brb7 = new Dictionary<string, Func<INPAT_ORDER, object>>
{
{ "0"+" 医嘱序号" , t => t.医嘱序号},
{ "1"+" 上传医嘱序号" , t => t.上传医嘱序号},
{ "2"+" 住院序号" , t => t.住院序号},
{ "3"+" 医院住院序号" , t => t.医院住院序号},
{ "4"+" 医嘱类型" , t => t.医嘱类型},
{ "5"+" 项目种类" , t => t.项目种类},
{ "6"+" 费用代码" , t => t.费用代码},
{ "7"+" 费用名称" , t => t.费用名称},
{ "8"+" 皮试结果" , t => t.皮试结果},
{ "9"+" 药品规格" , t => t.药品规格},
{ "10"+" 每次剂量" , t => t.每次剂量},
{ "11"+" 剂量单位" , t => t.剂量单位},
{ "12"+" 用量个数" , t => t.用量个数},
{ "13"+" 用量单位" , t => t.用量单位},
{ "14"+" 药品用法" , t => t.药品用法},
{ "15"+" 给药方式" , t => t.给药方式},
{ "16"+" 配药数量" , t => t.配药数量},
{ "17"+" 单价" , t => t.单价},
{ "18"+" 医嘱天数" , t => t.医嘱天数},
{ "19"+" 开始服药日期" , t => t.开始服药日期},
{ "20"+" 结束服药日期" , t => t.结束服药日期},
{ "21"+" 用药天数" , t => t.用药天数},
{ "22"+" 备注" , t => t.备注},
{ "23"+" 创建机构" , t => t.创建机构},
};
foreach (var item in brb7)
{
int key = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var name = item.Key.Replace(key + " ", "");
header7.CreateCell(key).SetCellValue(name);
}
var rowIndex7 = 1;
sql = $"SELECT * FROM [数据导出].[dbo].[INPAT_ORDER]";
var INPAT_ORDER = connection.Query<INPAT_ORDER>(sql).OrderBy(s => s.医嘱序号).ToList();
for (int i = 0; i < INPAT_ORDER.Count; i++)
{
var datarow = sheet7.CreateRow(rowIndex7);
foreach (var item in brb7)
{
var cell = datarow.CreateCell(int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" "))));
cell.SetCellValue(string.IsNullOrEmpty(item.Value.Invoke(INPAT_ORDER[i])?.ToString()) ? "" : item.Value.Invoke(INPAT_ORDER[i])?.ToString());
}
rowIndex7++;
}
#endregion
#region 住院费用
var sheet8 = workbook.CreateSheet("住院费用");//创建工作表
var header8 = sheet8.CreateRow(0);//工作行
var brb8 = new Dictionary<string, Func<INPAT_FEE, object>>
{
{ "0"+" 收费号" , t => t.收费号},
{ "1"+" 医院收费序号" , t => t.医院收费序号},
{ "2"+" 费用类别" , t => t.费用类别},
{ "3"+" 住院序号" , t => t.住院序号},
{ "4"+" 医院住院序号" , t => t.医院住院序号},
{ "5"+" 项目种类" , t => t.项目种类},
{ "6"+" 医院费用代码" , t => t.医院费用代码},
{ "7"+" 费用名称" , t => t.费用名称},
{ "8"+" 单价" , t => t.单价},
{ "9"+" 数量" , t => t.数量},
{ "10"+" 药量单位" , t => t.药量单位},
{ "11"+" 金额" , t => t.金额},
{ "12"+" 收费日期" , t => t.收费日期},
{ "13"+" 科室编码" , t => t.科室编码},
{ "14"+" 科室名称" , t => t.科室名称},
{ "15"+" 创建机构" , t => t.创建机构},
{ "16"+" 标准分类名称" , t => t.标准分类名称},
{ "17"+" 药品产地" , t => t.药品产地},
{ "18"+" 执行科室编码" , t => t.执行科室编码},
{ "19"+" 执行科室名称" , t => t.执行科室名称}
};
foreach (var item in brb8)
{
int key = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var name = item.Key.Replace(key + " ", "");
header8.CreateCell(key).SetCellValue(name);
}
var rowIndex8 = 1;
sql = $"SELECT * FROM [数据导出].[dbo].[INPAT_FEE]";
var INPAT_FEE = connection.Query<INPAT_FEE>(sql).OrderBy(s => s.收费号).ToList();
for (int i = 0; i < INPAT_FEE.Count; i++)
{
var datarow = sheet8.CreateRow(rowIndex8);
foreach (var item in brb8)
{
var cell = datarow.CreateCell(int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" "))));
cell.SetCellValue(string.IsNullOrEmpty(item.Value.Invoke(INPAT_FEE[i])?.ToString()) ? "" : item.Value.Invoke(INPAT_FEE[i])?.ToString());
}
rowIndex8++;
}
#endregion
#region 手术信息
var sheet9 = workbook.CreateSheet("手术信息");//创建工作表
var header9 = sheet9.CreateRow(0);//工作行
var brb9 = new Dictionary<string, Func<OPS_INFO, object>>
{
{ "0"+" 手术编号" , t => t.手术编号},
{ "1"+" 医院手术编号" , t => t.医院手术编号},
{ "2"+" 住院序号" , t => t.住院序号},
{ "3"+" 医院住院序号" , t => t.医院住院序号},
{ "4"+" 医嘱序号" , t => t.医嘱序号},
{ "5"+" 医院医嘱序号" , t => t.医院医嘱序号},
{ "6"+" 医院费用编码" , t => t.医院费用编码},
{ "7"+" 手术名称" , t => t.手术名称},
{ "8"+" 术前诊断" , t => t.术前诊断},
{ "9"+" 手术结果" , t => t.手术结果},
{ "10"+" 手术等级" , t => t.手术等级},
{ "11"+" 手术创口等级" , t => t.手术创口等级},
{ "12"+" 手术开始时间" , t => t.手术开始时间},
{ "13"+" 手术结束时间" , t => t.手术结束时间},
{ "14"+" 科室编码" , t => t.科室编码},
{ "15"+" 科室名称" , t => t.科室名称},
{ "16"+" 愈合程度" , t => t.愈合程度},
{ "17"+" 麻醉方式" , t => t.麻醉方式},
{ "18"+" 择期手术" , t => t.择期手术},
{ "19"+" 创建机构" , t => t.创建机构},
{ "20"+" 手术操作编码" , t => t.手术操作编码},
{ "21"+" 标准手术名称" , t => t.标准手术名称},
{ "22"+" 标准手术操作编码" , t => t.标准手术操作编码}
};
foreach (var item in brb9)
{
int key = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var name = item.Key.Replace(key + " ", "");
header9.CreateCell(key).SetCellValue(name);
}
var rowIndex9 = 1;
sql = $"SELECT * FROM [数据导出].[dbo].[OPS_INFO]";
var OPS_INFO = connection.Query<OPS_INFO>(sql).OrderBy(s => s.手术编号).ToList();
for (int i = 0; i < OPS_INFO.Count; i++)
{
var datarow = sheet9.CreateRow(rowIndex9);
foreach (var item in brb9)
{
var cell = datarow.CreateCell(int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" "))));
cell.SetCellValue(string.IsNullOrEmpty(item.Value.Invoke(OPS_INFO[i])?.ToString()) ? "" : item.Value.Invoke(OPS_INFO[i])?.ToString());
}
rowIndex9++;
}
#endregion
#region 检查信息
var sheet10 = workbook.CreateSheet("检查信息");//创建工作表
var header10 = sheet10.CreateRow(0);//工作行
var brb10 = new Dictionary<string, Func<EXEC_REPORT, object>>
{
{ "0"+" 报告单编号" , t => t.报告单编号},
{ "1"+" 医院报告编号" , t => t.医院报告编号},
{ "2"+" 病人序号" , t => t.病人序号},
{ "3"+" 医院病人序号" , t => t.医院病人序号},
{ "4"+" 医嘱序号" , t => t.医嘱序号},
{ "5"+" 医院医嘱序号" , t => t.医院医嘱序号},
{ "6"+" 简要病史" , t => t.简要病史},
{ "7"+" 项目名称" , t => t.项目名称},
{ "8"+" 诊断表现" , t => t.诊断表现},
{ "9"+" 诊断结论" , t => t.诊断结论},
{ "10"+" 报告时间" , t => t.报告时间},
{ "11"+" 患者来源" , t => t.患者来源},
{ "12"+" 创建机构" , t => t.创建机构}
};
foreach (var item in brb10)
{
int key = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var name = item.Key.Replace(key + " ", "");
header10.CreateCell(key).SetCellValue(name);
}
var rowIndex10 = 1;
sql = $"SELECT * FROM [数据导出].[dbo].[EXEC_REPORT]";
var EXEC_REPORT = connection.Query<EXEC_REPORT>(sql).OrderBy(s => s.报告单编号).ToList();
for (int i = 0; i < EXEC_REPORT.Count; i++)
{
var datarow = sheet10.CreateRow(rowIndex10);
foreach (var item in brb10)
{
int id = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var cell = datarow.CreateCell(id);
cell.SetCellValue(id == 11 ? (string.IsNullOrEmpty(item.Value.Invoke(EXEC_REPORT[i])?.ToString()) ? "" : item.Value.Invoke(EXEC_REPORT[i])?.ToString()) == "1" ? "门诊" : "住院" : string.IsNullOrEmpty(item.Value.Invoke(EXEC_REPORT[i])?.ToString()) ? "" : item.Value.Invoke(EXEC_REPORT[i])?.ToString());
}
rowIndex10++;
}
#endregion
#region 化验信息
var sheet11 = workbook.CreateSheet("化验信息");//创建工作表
var header11 = sheet11.CreateRow(0);//工作行
var brb11 = new Dictionary<string, Func<ASSAY_REPORT, object>>
{
{ "0"+" 化验报告编码" , t => t.化验报告编码},
{ "1"+" 医院报告编码" , t => t.医院报告编码},
{ "2"+" 病人序号" , t => t.病人序号},
{ "3"+" 医院病人序号" , t => t.医院病人序号},
{ "4"+" 报告时间" , t => t.报告时间},
{ "5"+" 标本类型" , t => t.标本类型},
{ "6"+" 化验项目代码" , t => t.化验项目代码},
{ "7"+" 项目名称" , t => t.项目名称},
{ "8"+" 项目e文名" , t => t.项目e文名},
{ "9"+" 结构单位" , t => t.结构单位},
{ "10"+" 结果" , t => t.结果单位},
{ "11"+" 参考范围" , t => t.参考范围},
{ "12"+" 结果状态" , t => t.结果状态},
{ "13"+" 患者来源" , t => t.患者来源},
{ "14"+" 创建机构" , t => t.创建机构}
};
foreach (var item in brb11)
{
int key = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var name = item.Key.Replace(key + " ", "");
header11.CreateCell(key).SetCellValue(name);
}
var rowIndex11 = 1;
sql = $"SELECT * FROM [数据导出].[dbo].[ASSAY_REPORT]";
var ASSAY_REPORT = connection.Query<ASSAY_REPORT>(sql).OrderBy(s => s.化验报告编码).ToList();
for (int i = 0; i < ASSAY_REPORT.Count; i++)
{
var datarow = sheet11.CreateRow(rowIndex11);
foreach (var item in brb11)
{
int id = int.Parse(item.Key.Substring(0, item.Key.LastIndexOf(" ")));
var cell = datarow.CreateCell(id);
cell.SetCellValue(id == 13 ? (string.IsNullOrEmpty(item.Value.Invoke(ASSAY_REPORT[i])?.ToString()) ? "" : item.Value.Invoke(ASSAY_REPORT[i])?.ToString()) == "1" ? "门诊" : "住院" : string.IsNullOrEmpty(item.Value.Invoke(ASSAY_REPORT[i])?.ToString()) ? "" : item.Value.Invoke(ASSAY_REPORT[i])?.ToString());
}
rowIndex11++;
}
#endregion
workbook.Write(fs);
}
using (var stream = new FileStream(newFile, FileMode.Open))
{
stream.CopyTo(memory);
}
memory.Position = 0;
}
catch (Exception e)
{
throw e;
}
return 下载地址;
}
#endregion
#region 导入excel多个表格数据
/// <summary>
/// 将excel中多sheet表的数据导入到DataTable中
/// </summary>
/// <param name="file">文件名称</param>
/// <param name="WebRootPath">路径</param>
/// <param name="sheetnumber">excel工作薄sheet的位置</param>
/// <param name="isFirstRowColumn">第一行是否是DataTable的列名</param>
/// <returns>返回的DataTable</returns>
public string ExcelToDataTables(IFormFile file)
{
DbConnection connection = new SqlConnection(_configConnectionString);
var jieguo = "成功";
var sql = "";
var num = 0;
try
{
sql = @$"truncate table [数据导出].[dbo].[ASSAY_REPORT]
truncate table [数据导出].[dbo].[EXEC_REPORT]
truncate table [数据导出].[dbo].[INPAT_DIAG]
truncate table [数据导出].[dbo].[INPAT_FEE]
truncate table [数据导出].[dbo].[INPAT_ORDER]
truncate table [数据导出].[dbo].[INPAT_REG_INFO]
truncate table [数据导出].[dbo].[OPS_INFO]
truncate table [数据导出].[dbo].[OUT_DIAG]
truncate table [数据导出].[dbo].[OUT_FEE]
truncate table [数据导出].[dbo].[OUT_PRES]
truncate table [数据导出].[dbo].[OUT_REG_INFO]
truncate table [数据导出].[dbo].[PUB_PATIENT]";
connection.Execute(sql);
for (int i = 0; i <= 11; i++)
{
var a = "\"}";
num = i;
var date = ExcelToDataTable(file, i, true);
if (date != null)
{
if (i == 0)//病人表
{
var dates = JsonConvert.DeserializeObject<List<PUB_PATIENT>>(date);
foreach (var item in dates)
{
sql = @$"insert into [数据导出].[dbo].[PUB_PATIENT]
([医院病人编码],[性别],[出生日期],[标准地域],[民族],[国籍],[创建机构] ,[病人主索引])
select '{item.医院病人编码}','{item.性别}','{item.出生日期}','{item.标准地域}','{item.民族}','{item.国籍}','{item.创建机构}', '{item.病人主索引}'";
connection.Execute(sql);
}
}
if (i == 1)//门诊登记
{
var dates = JsonConvert.DeserializeObject<List<OUT_REG_INFO>>(date);
foreach (var item in dates)
{
sql = @$"insert into [数据导出].[dbo].[OUT_REG_INFO]
([医院挂号序号],[病人编码],[医院病人编号] ,[挂号时间],[医院挂号科室],[医院科室名称],[医保类型]
,[急诊_门诊],[标准一级诊断],[标准科室],[创建机构],[上传时间],[是否医保],[总费用],[自付费用])
select '{item.医院挂号序号}','{item.病人编码}','{item.医院病人编码}','{item.挂号时间}','{item.医院挂号科室}','{item.医院科室名称}','{item.医保类型}',
'{item.急诊_门诊}','{item.标准一级诊断}','{item.标准科室}','{item.创建机构}','{item.上传时间}','{item.是否医保}','{item.总费用}','{item.自付费用}'";
connection.Execute(sql);
}
}
//if (i == 2)//门诊诊断
//{
// var dates = JsonConvert.DeserializeObject<List<OUT_DIAG>>(date);
// foreach (var item in dates)
// {
// sql = @$"insert into [数据导出].[dbo].[OUT_DIAG]
// ([医院诊断序号],[挂号序号],[医院挂号序号],[诊断编号],[诊断编码],[疾病名称],[诊断日期],[备注],[创建机构])
// select '{item["医院诊断序号"]}','{item["挂号序号"]}','{item["医院挂号序号"]}',
// '{item["诊断编号"]}','{item["诊断编码"]}','{item["疾病名称"]}',
// '{item["诊断日期"]}', '{item["备注"]}', '{item["创建机构"]}'";
// connection.Execute(sql);
// }
//}
//if (i == 3)//门诊处方
//{
// foreach (DataRow item in date.Rows)
// {
// sql = @$"insert into [数据导出].[dbo].[OUT_PRES]
// ([医院处方编号],[挂号序号],[医院挂号序号],[组号],[处方序号],[处方时间],[处方类型],[药品代码],[药品分类],[药品通用名称],[药品名称],[药品剂型],[药品规格],[药品产地],[每次用量],[用量单位],[用法编码],[给药方式],[配药天数],[配药数量],[配药单位],[皮试结果],[医保分类],[创建机构])
// select '{item["医院处方编号"]}','{item["挂号序号"]}','{item["医院挂号序号"]}',
// '{item["组号"]}','{item["处方序号"]}','{item["处方时间"]}',
// '{item["处方类型"]}','{item["药品代码"]}','{item["药品分类"]}',
// '{item["药品通用名称"]}','{item["药品名称"]}','{item["药品剂型"]}',
// '{item["药品规格"]}','{item["药品产地"]}','{item["每次用量"]}',
// '{item["用量单位"]}','{item["用法编码"]}','{item["给药方式"]}',
// '{item["配药天数"]}','{item["配药数量"]}','{item["配药单位"]}',
// '{item["皮试结果"]}','{item["医保分类"]}','{item["创建机构"]}'";
// connection.Execute(sql);
// }
//}
//if (i == 4) //门诊费用
//{
// foreach (DataRow item in date.Rows)
// {
// sql = @$"insert into [数据导出].[dbo].[OUT_FEE]
// ([上传收费号],[挂号序号],[医院挂号序号],[项目种类],[上传费用代码],[费用名称],[单价],[费用类别],[数量],
// [单位],[金额],[科室编码],[科室名称],[收费日期],[创建机构],[标准分类名称],[药品产地],[执行科室编码],[执行科室名称])
// select '{item["上传收费号"]}','{item["挂号序号"]}','{item["医院挂号序号"]}','{item["项目种类"]}','{item["上传费用代码"]}','{item["费用名称"]}',
// '{item["单价"]}','{item["费用类别"]}','{item["数量"]}','{item["单位"]}','{item["金额"]}','{item["科室编码"]}','{item["科室名称"]}',
// '{item["收费日期"]}','{item["创建机构"]}','{item["标准分类名称"]}','{item["药品产地"]}','{item["执行科室编码"]}','{item["执行科室名称"]}'";
// connection.Execute(sql);
// }
//}
//if (i == 5) //住院登记
//{
// foreach (DataRow item in date.Rows)
// {
// sql = @$"insert into [数据导出].[dbo].[INPAT_REG_INFO]
// ([医院住院序号] ,[病人编码],[医院病人编码],[上传入院科室],[入院科室名称],[病区名称],[入院时间],[出院时间]
// ,[医保类型],[身高],[体重],[入院情况],[出院情况],[标准一级诊断],[标准科室],[创建机构],[是否医保],[腰围]
// ,[总费用],[自付费用],[出院科室编码],[出院科室名称],[住院病人的来源])
// select '{item["医院住院序号"]}','{item["病人编码"]}','{item["医院病人编码"]}','{item["上传入院科室"]}','{item["入院科室名称"]}','{item["病区名称"]}',
// '{item["入院时间"]}','{item["出院时间"]}','{item["医保类型"]}','{item["身高"]}','{item["体重"]}','{item["入院情况"]}','{item["出院情况"]}',
// '{item["标准一级诊断"]}','{item["标准科室"]}','{item["创建机构"]}','{item["是否医保"]}','{item["腰围"]}','{item["总费用"]}',
// '{item["自付费用"]}','{item["出院科室编码"]}','{item["出院科室名称"]}','{item["住院病人的来源"]}'";
// connection.Execute(sql);
// }
//}
//if (i == 6) //住院诊断
//{
// foreach (DataRow item in date.Rows)
// {
// sql = @$"insert into [数据导出].[dbo].[INPAT_REG_INFO]
// ([医院住院序号] ,[病人编码],[医院病人编码],[上传入院科室],[入院科室名称],[病区名称],[入院时间],[出院时间]
// ,[医保类型],[身高],[体重],[入院情况],[出院情况],[标准一级诊断],[标准科室],[创建机构],[是否医保],[腰围]
// ,[总费用],[自付费用],[出院科室编码],[出院科室名称],[住院病人的来源])
// select '{item["医院住院序号"]}','{item["病人编码"]}','{item["医院病人编码"]}','{item["上传入院科室"]}','{item["入院科室名称"]}','{item["病区名称"]}',
// '{item["入院时间"]}','{item["出院时间"]}','{item["医保类型"]}','{item["身高"]}','{item["体重"]}','{item["入院情况"]}','{item["出院情况"]}',
// '{item["标准一级诊断"]}','{item["标准科室"]}','{item["创建机构"]}','{item["是否医保"]}','{item["腰围"]}','{item["总费用"]}',
// '{item["自付费用"]}','{item["出院科室编码"]}','{item["出院科室名称"]}','{item["住院病人的来源"]}'";
// connection.Execute(sql);
// }
//}
if (i == 7) //住院医嘱
{
}
if (i == 8) //住院费用
{
}
if (i == 9) //手术信息
{
}
if (i == 10) //检查信息
{
}
if (i == 11) //化验信息
{
}
}
}
}
catch (Exception e)
{
jieguo = @$"失败 错误{num}:" + e.ToString();
}
return jieguo;
}
/// <summary>
/// Datatable转换为Json
/// </summary>
/// <param name="dt">Datatable对象</param>
/// <returns>Json字符串</returns>
public static string ToJson(DataTable dt)
{
StringBuilder jsonString = new StringBuilder();
jsonString.Append("[");
DataRowCollection drc = dt.Rows;
for (int i = 0; i < drc.Count; i++)
{
jsonString.Append("{");
for (int j = 0; j < dt.Columns.Count; j++)
{
string strKey = dt.Columns[j].ColumnName;
string strValue = "\"" + drc[i][j].ToString() + "\"";
Type type = dt.Columns[j].DataType;
jsonString.Append("\"" + strKey + "\":");
strValue = String.Format(strValue, type);
if (j < dt.Columns.Count - 1)
{
jsonString.Append(strValue + ",");
}
else
{
jsonString.Append(strValue);
}
}
jsonString.Append("},");
}
jsonString.Remove(jsonString.Length - 1, 1);
jsonString.Append("]");
return jsonString.ToString();
}
public string ExcelToDataTable(IFormFile file, int sheetnumber, bool isFirstRowColumn, int startRow = 0)
{
IWorkbook workbook = null;
DbConnection connection = new SqlConnection(_configConnectionString);
ISheet sheet = null;
DataTable data = new DataTable();
StreamReader reader = new StreamReader(file.OpenReadStream());//打开读取文件流
string content = reader.ReadToEnd();//读取文件流末尾字符
string name = file.FileName;
string filename = "";
filename = Path.Combine("E:/代码/queryPlatform/api/QueryPlatform.Api/bin/Debug/netcoreapp3.1/wwwroot/export", name);
try
{
try
{
FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
if (filename.IndexOf(".xlsx") > 0) // 2007版本
workbook = new XSSFWorkbook(fs);
else if (filename.IndexOf(".xls") > 0) // 2003版本
workbook = new HSSFWorkbook(fs);
}
catch (Exception e)
{
throw new Exception("未找到该文件!请确保为导出时的名称!");
}
sheet = workbook.GetSheetAt(sheetnumber);
if (sheet != null)
{
IRow firstRow = sheet.GetRow(startRow);
int cellCount = firstRow.LastCellNum; //一行最后一个cell的编号 即总的列数
if (isFirstRowColumn)
{
for (int i = firstRow.FirstCellNum; i < cellCount; ++i)
{
ICell cell = firstRow.GetCell(i);
if (cell != null)
{
string cellValue = cell.ToString();
if (cellValue != null)
{
DataColumn column = new DataColumn(cellValue);
data.Columns.Add(column);
}
}
}
if (startRow == 0)
{
startRow = sheet.FirstRowNum + 1;
}
else
{
startRow += 1;
}
}
else
{
if (startRow == 0)
{
startRow = sheet.FirstRowNum;
}
}
//最后一列的标号
int rowCount = sheet.LastRowNum;
for (int i = startRow; i <= rowCount; ++i)
{
IRow row = sheet.GetRow(i);
// if (row == null || row.FirstCellNum < 0 || (string.IsNullOrWhiteSpace(row.GetCell(0).Value().ToStringWDV()) && string.IsNullOrWhiteSpace(row.GetCell(1).Value().ToStringWDV()) && string.IsNullOrWhiteSpace(row.GetCell(2).Value().ToStringWDV()))) break; //没有数据的行默认是null       
DataRow dataRow = data.NewRow();
for (int j = row.FirstCellNum; j < cellCount; ++j)
{
if (row.GetCell(j) != null) ; //同理,没有数据的单元格都默认是null
dataRow[j] = row.GetCell(j);
}
data.Rows.Add(dataRow);
}
}
////插入数据库
//var sql = @$"";
//var que = data.Query<string>(sql).FirstOrDefault();
return ToJson(data);
}
catch (Exception ex)
{
throw new Exception("Exception: " + ex.Message);
}
}
#endregion
public List<string> ceshi()
{
DbConnection connection = new SqlConnection(_configConnectionString);
var sql = @$"SELECT [zyh] ,[jws] FROM [呼吸科20221225].[dbo].[疾病清洗aaaa] ";
var errs = new List<string>();
var mailboxs = connection.Query<aaaa>(sql, commandTimeout: 60 * 60 * 5);
if (mailboxs.Any())
{
foreach (var item in mailboxs)
{
try
{
var obj = JsonConvert.DeserializeObject<abc>(item.jws);
sql = @$" insert into [呼吸科20221225].[dbo].[疾病JOSN解析后](zyh, 疾病史, 传染病史, 手术史外伤史, 过敏史, 重要药物应用史, 预防接种史, 输血史)
select '{item.zyh.Replace("'", "")}', '{obj.疾病史.Replace("'", "")}', '{obj.传染病史.Replace("'", "")}',
'{obj.手术史外伤史.Replace("'", "")}', '{obj.过敏史.Replace("'", "")}', '{obj.重要药物应用史.Replace("'", "")}', '{obj.预防接种史.Replace("'", "")}', '{obj.输血史}';";
connection.Execute(sql);
}
catch
{
errs.Add(item.zyh);
}
}
}
return errs;
}
}
}
\ No newline at end of file
using Dapper;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
using Microsoft.Data.SqlClient;
using PuppeteerSharp;
using QueryPlatform.Api.Infrastructure.Modules;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Document = DocumentFormat.OpenXml.Wordprocessing.Document;
using Vb = Microsoft.VisualBasic;
namespace QueryPlatform.Api.Infrastructure.Queries
{
public class ResourceQueries
{
private readonly string _Connection156;
private readonly string _configConnectionString;
public ResourceQueries(string Connection156, string configConnectionString)
{
_Connection156 = Connection156;
_configConnectionString = configConnectionString;
}
/// <summary>
/// 查询所有项目
/// </summary>
public (IEnumerable<dynamic>, IEnumerable<dynamic>) ItemQuery(string name, long paseIndex)
{
paseIndex = paseIndex == 0 ? 1 : paseIndex;
DbConnection connection = new SqlConnection(_configConnectionString);
var where = "";
var sql = "";
if (!string.IsNullOrEmpty(name))
{
where = @$" and PROJECT_NAME like '%{name}%'";
}
sql = $@"SELECT ID,[PROJECT_NAME],concat(case when [END_TIME]is null then '(已耗时:'else'(耗时:' end, concat(case when [END_TIME]is null then datediff(second,[search_time],getdate())
else datediff(second,[search_time],[END_TIME] )end / 3600, '时' , case when [END_TIME]is null then datediff(second,[search_time],getdate())
else datediff(second,[search_time],[END_TIME] )end % 3600 / 60, '分' , case when [END_TIME]is null then datediff(second,[search_time],getdate())
else datediff(second,[search_time],[END_TIME] )end % 3600 % 60, '秒'),')')[time], case when type='疾病' and ICD !='' and DISEASE_NAME !='' then concat('icd:',ICD,'
疾病:',DISEASE_NAME)
when type='疾病' and ICD !='' and DISEASE_NAME ='' then concat('icd:',ICD)
when type='疾病' and ICD ='' and DISEASE_NAME !='' then concat('疾病:',DISEASE_NAME)
when GENERIC_NAME!=''then concat(type,':',GENERIC_NAME)
end querycriteria, type,GENERIC_NAME, DISEASE_NAME, ICD, COMPLETE_MARK, search_time
FROM [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] where 1=1 {where}
order by search_time desc offset ({paseIndex} - 1)*(10) rows fetch next 10 rows only";
IEnumerable<dynamic> sj = connection.Query(sql).ToList();
sql = $@" SELECT CAST(COUNT(*)AS MONEY)totalCount ,{paseIndex} paseIndex FROM [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] where 1=1 {where}";
IEnumerable<dynamic> zon = connection.Query(sql).ToList();
return (sj, zon);
}
/// <summary>
/// 停止正在查询项目
/// </summary>
public bool CancelProject(int id)
{
DbConnection connection = new SqlConnection(_configConnectionString);
//确定该项目在执行中
IEnumerable<dynamic> COMPLETE_MARK = connection.Query("select COMPLETE_MARK FROM [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] where COMPLETE_MARK =22 and id=" + id);
if (COMPLETE_MARK.Count() > 0)
throw new DomainException("该项目已经执行完毕,不能取消!!!");
else
LOG("停止中", "", id, "查询平台", "");
return connection.Execute(@$"drop table [SV_QueryPlatform_].[dbo].[MEDIC_AREA_{id}] ;
drop table [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{id}] ;
update [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] set COMPLETE_MARK = 31 where COMPLETE_MARK != 22 and id= " + id) > 0 ? true : false;
}
public IEnumerable<dynamic> ShowMEDIC_AREA(int id)
{
DbConnection connection = new SqlConnection(_configConnectionString);
var sql = $@"select case when concat(year(end_time),'_',month(end_time))!=concat(year(getdate()),'_',month(getdate()))
then concat(year(end_time),'',month(end_time)) else id end ID From [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] where id ={id}";
int ids = connection.Query<int>(sql, commandTimeout: 60 * 60 * 5).FirstOrDefault();
IEnumerable<dynamic> sj = connection.Query($@"
SELECT DISTINCT REPLACE([MEDIC_AREA],' ','')[MEDIC_AREA] FROM [SV_QueryPlatform_].[dbo].[MEDIC_AREA_{ids}] WHERE INDEXS={id} AND ITEM_NAME IS NOT NULL AND ITEM_NAME<>''").ToList();
return (sj);
}
public IEnumerable<dynamic> ShowITEM_NAME(int id)
{
DbConnection connection = new SqlConnection(_configConnectionString);
var sql = $@"select case when concat(year(end_time),'_',month(end_time))!=concat(year(getdate()),'_',month(getdate()))
then concat(year(end_time),'',month(end_time)) else id end ID From [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] where id ={id}";
int ids = connection.Query<int>(sql, commandTimeout: 60 * 60 * 5).FirstOrDefault();
IEnumerable<dynamic> sj = connection.Query($@"
SELECT DISTINCT REPLACE([ITEM_NAME],' ','')[ITEM_NAME] FROM [SV_QueryPlatform_].[dbo].[MEDIC_AREA_{ids}] WHERE INDEXS={id} AND ITEM_NAME IS NOT NULL AND ITEM_NAME<>'' ").ToList();
return sj;
}
public class nffb
{
public string n { get; set; }
public string RS { get; set; }
}
public class sexfb
{
public string sex { get; set; }
public string rs { get; set; }
}
public class nldfb
{
public string 年龄段 { get; set; }
public string rs { get; set; }
}
public class qyfb
{
public string classification { get; set; }
public string hospital { get; set; }
public string hospitalsSUM { get; set; }
public string patientSUM { get; set; }
}
public class ksrc
{
public string dept_name { get; set; }
public string rc { get; set; }
}
public class MEDIC_PERSON_INFORMATION
{
public string HOS_ID { get; set; } // 医院 ID
public string MASTER_INDEX { get; set; } // 主索引
public DateTime BIRTHDAY { get; set; } // 出生日期
public string SEX { get; set; } // 性别
public string PERSON_CODE { get; set; } // 个人编号
public string PERSON_ID { get; set; } // 个人 ID
public string REG_CODE { get; set; } // 登记编码
public string REG_ID { get; set; } // 登记 ID
public string REG_SOURCE { get; set; } // 登记来源
public DateTime REG_TIME { get; set; } // 登记时间
public string AREA_ID { get; set; } // 区域 ID
public string INDEXS { get; set; } // 索引
public string TYPE { get; set; } // 类型
public string DEPT_NAME { get; set; } // 科室名称
public string MEDIC_AREA { get; set; } // 医疗区域
}
string fwq = $@"E:/wwww/testdatasearch/api/wwwroot/export/人群分布报告/";
string bd = $@"E:\代码\queryPlatform2.0\api\queryPlaform.Api\wwwroot\export\人群分布报告/";
public async Task<(IEnumerable<dynamic>, IEnumerable<dynamic>, string, string, IEnumerable<dynamic>, IEnumerable<dynamic>, string, IEnumerable<dynamic>)> ProjectReport1
(int id, string MEDIC_AREA, string ITEM_NAME, string GENERIC_NAME, string PROJECT_NAME, string icd, string DISEASE_NAME, string diz, int xz)
{
var where = "";
if (!string.IsNullOrEmpty(MEDIC_AREA) && !string.IsNullOrEmpty(ITEM_NAME))
{
MEDIC_AREA = MEDIC_AREA.Replace(",", ",");
where = "b.MEDIC_AREA LIKE '%" + MEDIC_AREA.Replace(",", "%' or b.MEDIC_AREA like '%") + "%'";
ITEM_NAME = ITEM_NAME.Replace(",", ",");
where += "or b.ITEM_NAME LIKE '%" + ITEM_NAME.Replace(",", "%' or b.ITEM_NAME like '%") + "%'";
}
else
{
if (!string.IsNullOrEmpty(MEDIC_AREA))
{
MEDIC_AREA = MEDIC_AREA.Replace(",", ",");
where = "b.MEDIC_AREA LIKE '%" + MEDIC_AREA.Replace(",", "%' or b.MEDIC_AREA like '%") + "%'";
}
else if (!string.IsNullOrEmpty(ITEM_NAME))
{
ITEM_NAME = ITEM_NAME.Replace(",", ",");
where = " b.ITEM_NAME LIKE '%" + ITEM_NAME.Replace(",", "%' or b.ITEM_NAME like '%") + "%'";
}
else
{
where = " 1=1 ";
}
}
long unixTimeSeconds = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
DbConnection connection = new SqlConnection(_configConnectionString);
var sql = $@"select case when concat(year(end_time),'_',month(end_time))!=concat(year(getdate()),'_',month(getdate()))
then concat(year(end_time),'',month(end_time)) else id end ID From [SV_QueryPlatform_].[dbo].[MEDIC_SEARCH_RECORD] where id ={id}";
int ids = connection.Query<int>(sql, commandTimeout: 60 * 60 * 5).FirstOrDefault();
var AddQuery = $@"
SELECT a.HOS_ID,MASTER_INDEX,BIRTHDAY,SEX,PERSON_CODE,PERSON_ID,REG_CODE,REG_ID,REG_SOURCE,REG_TIME,AREA_ID,a.INDEXS,a.TYPE,DEPT_NAME,a.MEDIC_AREA into dbo.MEDIC_PERSON_INFORMATION_存储过程表{unixTimeSeconds}
FROM (select *from [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{ids}] where TYPE = 1 AND INDEXS IN({id})) a
left join [SV_QueryPlatform_].[dbo].[MEDIC_AREA_{ids}] b on a.AREA_ID = b.ID AND a.INDEXS=b.INDEXS
where({where})
";
connection.Execute(AddQuery, commandTimeout: 60 * 60 * 5);
var ShowQuery1 = $@" select *From (
SELECT cast(N as nvarchar(10))+'年'n,isnull(COUNT(*),0)RS FROM (
SELECT DISTINCT YEAR([REG_TIME])N, HOS_ID,MASTER_INDEX
FROM dbo.MEDIC_PERSON_INFORMATION_存储过程表{unixTimeSeconds} WHERE TYPE=1 AND INDEXS IN ({id}) AND YEAR(REG_TIME)>=2014 and YEAR(REG_TIME)<=year(getdate())
) S GROUP BY N
UNION ALL
SELECT '2013年之前'N,COUNT(*)RS FROM (
SELECT DISTINCT HOS_ID,MASTER_INDEX
FROM dbo.MEDIC_PERSON_INFORMATION_存储过程表{unixTimeSeconds} WHERE TYPE=1 AND INDEXS IN ({id})
AND YEAR(REG_TIME)<=2013 ) S )a order by left(n,4)";
var ShowQuery2 = $@"SELECT '医院区域'classification, PROVINCE hospital,COUNT(DISTINCT case when CODE is not null then code else HOS_ID end)hospitalsSUM,COUNT(*)patientSUM FROM (
SELECT DISTINCT HOS_ID,MASTER_INDEX,replace([Province],' ','')PROVINCE,CODE
FROM (SELECT DISTINCT HOS_ID,MASTER_INDEX
FROM dbo.MEDIC_PERSON_INFORMATION_存储过程表{unixTimeSeconds} WHERE TYPE=1 AND INDEXS IN ({id})) A
JOIN [192.168.18.156].[DB_SV_DATA_CONFIG].[DBO].[SYS_HOSPITAL] B ON A.HOS_ID=B.ID
) N GROUP BY PROVINCE
UNION ALL
SELECT '医院级别'JB,HOSLEVEL,COUNT(DISTINCT case when CODE is not null then code else HOS_ID end ),cast(COUNT(*) AS int)RS FROM (
SELECT DISTINCT HOS_ID,MASTER_INDEX,PROVINCE,CODE,
CASE WHEN HOSLEVEL LIKE '%三%' THEN '三级' WHEN HOSLEVEL LIKE '%二%' THEN '二级'
ELSE '一级' END HOSLEVEL,
HOSTYPE FROM (SELECT DISTINCT HOS_ID,MASTER_INDEX
FROM dbo.MEDIC_PERSON_INFORMATION_存储过程表{unixTimeSeconds} WHERE TYPE=1 AND INDEXS IN ({id})) A
JOIN [192.168.18.156].[DB_SV_DATA_CONFIG].[DBO].[SYS_HOSPITAL] B ON A.HOS_ID=B.ID
) N GROUP BY HOSLEVEL
UNION ALL
SELECT '医院类别'LB,HOSTYPE,COUNT(DISTINCT case when CODE is not null then code else HOS_ID end),cast(COUNT(*) AS int) FROM (
SELECT DISTINCT HOS_ID,MASTER_INDEX,CODE,
HOSTYPE FROM (SELECT DISTINCT HOS_ID,MASTER_INDEX
FROM dbo.MEDIC_PERSON_INFORMATION_存储过程表{unixTimeSeconds} WHERE TYPE=1 AND INDEXS IN({id}) ) A
JOIN [192.168.18.156].[DB_SV_DATA_CONFIG].[DBO].[SYS_HOSPITAL] B ON A.HOS_ID=B.ID
) N GROUP BY HOSTYPE
UNION ALL
SELECT '总览'ZL,'医院数',COUNT(DISTINCT case when CODE is not null then code else HOS_ID end),cast(COUNT(*) AS int) FROM (
SELECT DISTINCT HOS_ID,MASTER_INDEX,CODE,
HOSTYPE FROM (SELECT DISTINCT HOS_ID,MASTER_INDEX
FROM dbo.MEDIC_PERSON_INFORMATION_存储过程表{unixTimeSeconds} WHERE TYPE=1 AND INDEXS IN({id}) ) A
JOIN [192.168.18.156].[DB_SV_DATA_CONFIG].[DBO].[SYS_HOSPITAL] B ON A.HOS_ID=B.ID ) N ";
var ShowQuery3 = $@" select sex , count(concat(hos_id,'_',MASTER_INDEX)) rs from(
SELECT hos_id,MASTER_INDEX ,MAX(SEX)sex FROM (
SELECT hos_id,MASTER_INDEX,case when SEX like '%男%' then '男' when SEX like '%女%' then '女' else '未知' end 'SEX'
FROM dbo.[MEDIC_PERSON_INFORMATION_存储过程表{unixTimeSeconds}] where type=1 and INDEXS in({id})
)A group by hos_id,MASTER_INDEX
)a group by sex order by sex";
var ShowQuery4 = $@" select 年龄段,count(concat(hos_id,'_',MASTER_INDEX)) rs from(
select
case when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=10 then '10岁以内'
WHEN DATEDIFF(day,BIRTHDAY,REG_TIME)/365 IS NULL THEN '未知'
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=11and DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=20 then '11-20'
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=21and DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=30 then '21-30'
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=31and DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=40 then '31-40'
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=41and DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=50 then '41-50'
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=51and DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=60 then '51-60'
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=61and DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=70 then '61-70'
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=71 then '71岁以上' end '年龄段',
case when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=10 then 1
WHEN DATEDIFF(day,BIRTHDAY,REG_TIME)/365 IS NULL THEN 9
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=11and DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=20 then 2
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=21and DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=30 then 3
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=31and DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=40 then 4
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=41and DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=50 then 5
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=51and DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=60 then 6
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=61and DATEDIFF(day,BIRTHDAY,REG_TIME)/365 <=70 then 7
when DATEDIFF(day,BIRTHDAY,REG_TIME)/365 >=71 then 8 end 'px',
hos_id, MASTER_INDEX
from (
SELECT hos_id,MASTER_INDEX,min(REG_TIME)REG_TIME,min(BIRTHDAY)BIRTHDAY
FROM dbo.MEDIC_PERSON_INFORMATION_存储过程表{unixTimeSeconds} where type=1 and INDEXS in({id})
group by hos_id,MASTER_INDEX
) a
)a group by 年龄段,px order by px";
var ShowQuery5 = $@" SELECT isnull(DEPT_NAME,'未知')DEPT_NAME ,count(distinct CONCAT(hos_id,'_',MASTER_INDEX,'_',REG_SOURCE,'_',REG_CODE))rc
FROM dbo.MEDIC_PERSON_INFORMATION_存储过程表{unixTimeSeconds} where type=1 and INDEXS in({id})
group by isnull(DEPT_NAME,'未知')
order by count(distinct CONCAT(hos_id,'_',MASTER_INDEX,'_',REG_SOURCE,'_',REG_CODE))desc";
List<nffb> yearfb = connection.Query<nffb>(ShowQuery1, commandTimeout: 60 * 60 * 5).ToList();
List<qyfb> dqfb = connection.Query<qyfb>(ShowQuery2, commandTimeout: 60 * 60 * 5).ToList();
List<sexfb> ShowQuery3s = connection.Query<sexfb>(ShowQuery3, commandTimeout: 60 * 60 * 5).ToList();
List<nldfb> ShowQuery4s = connection.Query<nldfb>(ShowQuery4, commandTimeout: 60 * 60 * 5).ToList();
List<ksrc> ShowQuery5s = connection.Query<ksrc>(ShowQuery5, commandTimeout: 60 * 60 * 5).ToList();
connection.Execute($"drop table dbo.MEDIC_PERSON_INFORMATION_存储过程表{unixTimeSeconds}", commandTimeout: 60 * 60 * 5);
var condition = "";
if (!string.IsNullOrEmpty(icd)) condition = condition + @"
ICD:[" + icd + ']';
if (!string.IsNullOrEmpty(DISEASE_NAME)) condition = condition + @"
疾病名称:[" + DISEASE_NAME + ']';
if (!string.IsNullOrEmpty(ITEM_NAME))
{
condition = condition + @"
药品名称:[" + ITEM_NAME + ']';
}
else if (!string.IsNullOrEmpty(GENERIC_NAME))
{
condition = condition + @"
药品名称:[" + GENERIC_NAME + ']';
}
if (!string.IsNullOrEmpty(MEDIC_AREA)) condition = condition + @"
产地:[" + MEDIC_AREA + ']';
string filePath = $"{diz}/export/模板.html"; //$"E:/C盘文件/桌面/非小细胞癌药品分布.html"; //$"{diz}/export/模板.html"// 指定文件路径
var htmlContent = "";
string mb = @"<tr>
<td width='55' ><p align='right'><font size='2' style='font-size: 10pt'><span lang='zh-CN'><b><font face='宋体'>{nf}</font></b></span></font></p></td>
<td width='74'><p align='right'><font size='2' style='font-size: 10pt'><span lang='en-US'><font size='3' style='font-size: 12pt'>{rs}</font></span></font></p></td>
</tr> ";
string yearfbhtmlfh = "";
string sexfbhtmlfh = "";
string nldfbhtmlfh = "";
string flhtmlfh = "";
string kshtmlfh = "";
string yys = dqfb.Where(w => w.classification == "总览").FirstOrDefault().hospitalsSUM;
string zrs = double.Parse(dqfb.Where(w => w.classification == "总览").FirstOrDefault().patientSUM).ToString("N0");
foreach (var item in yearfb)
{
yearfbhtmlfh = yearfbhtmlfh + mb.Replace("{nf}", item.n).Replace("{rs}", double.Parse(item.RS).ToString("N0"));
}
foreach (var item in ShowQuery3s)
{
sexfbhtmlfh = sexfbhtmlfh + mb.Replace("{nf}", item.sex).Replace("{rs}", double.Parse(item.rs).ToString("N0"));
}
foreach (var item in ShowQuery4s)
{
nldfbhtmlfh = nldfbhtmlfh + mb.Replace("{nf}", item.年龄段).Replace("{rs}", double.Parse(item.rs).ToString("N0"));
}
// 读取文件内容
using (StreamReader reader = new StreamReader(filePath))
{
htmlContent = reader.ReadToEnd();
}
mb = @"
<tr>
<td rowspan='{hbdyg}' width='28%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font color='#000000'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'>{fl}</span></font></font></font></p>
</td>
<td width='17%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right' ><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{hos}</font></span></font></font></p>
</td>
<td width='17%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{hoss}</font></span></font></font></p>
</td>
<td width='37%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{hzs}</font></span></font></font></p>
</td>
</tr>
";
var mb2 = @"
<tr>
<td width='17%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{hos}</font></span></font></font></p>
</td>
<td width='17%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{hoss}</font></span></font></font></p>
</td>
<td>
<p align='right'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{hzs}</font></span></font></font></p>
</td>
</tr>
";
var ksmb = @" <tr>
<td width='63%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{dept_name}</font></span></font></font></p>
</td>
<td width='36%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 7pt'><span lang='zh-CN'><font face='宋体'>{rc}</font></span></font></font></p>
</td>
</tr>
";
// 现在你可以使用htmlContent变量中的HTML代码
foreach (var item in dqfb.Select(s => s.classification).Distinct())
{
long num = 0;
var sl = dqfb.Where(w => w.classification == item).ToList();
foreach (var item1 in sl)
{
num = num + 1;
if (num == 1)
{
flhtmlfh = flhtmlfh + mb.Replace("{hbdyg}", sl.Count().ToString()).Replace("{fl}", item1.classification).Replace("{hos}", item1.hospital).Replace("{hoss}", item1.hospitalsSUM).Replace("{hzs}", double.Parse(item1.patientSUM).ToString("N0"));
}
else
{
flhtmlfh = flhtmlfh + mb2.Replace("{hbdyg}", sl.Count().ToString()).Replace("{fl}", item1.classification).Replace("{hos}", item1.hospital).Replace("{hoss}", item1.hospitalsSUM).Replace("{hzs}", double.Parse(item1.patientSUM).ToString("N0"));
}
}
}
foreach (var item in ShowQuery5s)
{
kshtmlfh = kshtmlfh + ksmb.Replace("{dept_name}", item.dept_name).Replace("{rc}", double.Parse(item.rc).ToString("N0"));
}
htmlContent = htmlContent.Replace("{tablesj}", flhtmlfh).Replace("{xmname}", PROJECT_NAME).Replace("{cxgjz}", condition).Replace("{nffb}", yearfbhtmlfh).Replace("{nldfb}", nldfbhtmlfh).Replace("{sexfb}", sexfbhtmlfh).Replace("{zhzs}", zrs).Replace("{zyys}", yys).Replace("{kstable}", kshtmlfh);
if (xz == 1)
{
string aa = await ConvertToPdf(htmlContent, PROJECT_NAME);
return (yearfb, dqfb, condition, PROJECT_NAME, ShowQuery3s, ShowQuery4s, aa, ShowQuery5s);
}
return (yearfb, dqfb, condition, PROJECT_NAME, ShowQuery3s, ShowQuery4s, null, ShowQuery5s);
}
/// <summary>
/// /
/// </summary>
/// <returns></returns>
///
public string HtmlToWord(string html, string xmname)
{
// 创建一个 Word 文档
string filePath = $@"{fwq}{xmname}人群分布{DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(1000, 9999).ToString()}.";
using (WordprocessingDocument doc = WordprocessingDocument.Create(filePath + "docx", WordprocessingDocumentType.Document))
{
// 添加一个空的 MainDocumentPart
MainDocumentPart mainPart = doc.AddMainDocumentPart();
// 创建一个新的文档
mainPart.Document = new Document();
Body body = mainPart.Document.AppendChild(new Body());
// 读取 HTML 文件内容
// string html = File.ReadAllText(htmlFilePath);
// 处理 CSS 样式
Regex regex = new Regex("<style[^>]*>(.*?)</style>", RegexOptions.Singleline);
Match match = regex.Match(html);
if (match.Success)
{
string css = match.Groups[1].Value;
StyleDefinitionsPart stylePart = mainPart.AddNewPart<StyleDefinitionsPart>();
using (StreamWriter writer = new StreamWriter(stylePart.GetStream()))
{
writer.Write(css);
}
}
// 将 HTML 转换为 OpenXml 内容
AlternativeFormatImportPart altPart = mainPart.AddAlternativeFormatImportPart(AlternativeFormatImportPartType.Xhtml);
using (Stream stream = altPart.GetStream())
using (StreamWriter writer = new StreamWriter(stream))
{
writer.Write(html);
}
// 插入转换后的内容到 Word 文档中
AltChunk altChunk = new AltChunk();
altChunk.Id = mainPart.GetIdOfPart(altPart);
body.AppendChild(altChunk);
// 保存 Word 文档
mainPart.Document.Save();
string outfilepath = @$"https://lsk.suvalue.com/api/export/export/人群分布报告/{filePath.Replace($@"{fwq}", "")}";
return outfilepath + "pdf";
}
}
[Obsolete]
public string ConvertHtmlToPdf(string html, string xmname)
{
string filePath = $@"{fwq}{xmname}人群分布{DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(1000, 9999).ToString()}.";
// 创建一个 PDF 对象
var pdf = new IronPdf.HtmlToPdf();
// 加载 HTML 文件
//var html = File.ReadAllText(htmlFilePath);
// 设置渲染选项
pdf.PrintOptions.CssMediaType = IronPdf.PdfPrintOptions.PdfCssMediaType.Print;
pdf.PrintOptions.PaperSize = IronPdf.PdfPrintOptions.PdfPaperSize.A4;
pdf.PrintOptions.MarginTop = 10;
pdf.PrintOptions.MarginBottom = 10;
pdf.PrintOptions.MarginLeft = 10;
pdf.PrintOptions.MarginRight = 10;
// 将 HTML 渲染为 PDF
var pdfDoc = pdf.RenderHtmlAsPdf(html);
// 保存 PDF 文件
pdfDoc.SaveAs(filePath + "pdf");
string outfilepath = @$"https://lsk.suvalue.com/api/export/export/人群分布报告/{filePath.Replace($@"{fwq}", "")}";
return outfilepath + "pdf";
}
public async System.Threading.Tasks.Task<string> ConvertToPdf(string html, string xmname)
{
string filePath = $@"{fwq}{xmname}人群分布{DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(1000, 9999).ToString()}.";
File.WriteAllText(filePath + "html", html);
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultChromiumRevision);
var launchOptions = new LaunchOptions { Headless = true };
using (var browser = await Puppeteer.LaunchAsync(launchOptions))
using (var page = await browser.NewPageAsync())
{
try
{
Console.WriteLine("aaa PDF");
await page.GoToAsync(filePath + "html");
Console.WriteLine("Before saving PDF");
await page.PdfAsync(filePath + "pdf");
Console.WriteLine("After saving PDF");
}
catch (Exception e)
{
throw;
}
}
string outfilepath = @$"https://lsk.suvalue.com/api/export/export/人群分布报告/{filePath.Replace($@"{fwq}", "")}";
return outfilepath + "pdf";
}
/// <summary>
/// 创建流水表
/// </summary>
public bool EstablishFlowDatabaseTable(string PROJECT_NAME, string sql, int id, string remarks)
{
long id2 = long.Parse($"{id.ToString()}{DateTime.Now.Year.ToString().Substring(DateTime.Now.Year.ToString().Length - 2)}{DateTime.Now.Month}{DateTime.Now.Day}{DateTime.Now.Hour}{DateTime.Now.Minute}{DateTime.Now.Second}");
DbConnection connection = new SqlConnection(_configConnectionString);
long isfilter = 1;
if (connection.Query($@"select * from [SV_QueryPlatform].[dbo].[FlowReservoirStatus] where tableName = '{PROJECT_NAME}' and indexs={id}").Count() > 0)
{
throw new DomainException(PROJECT_NAME + "流水库表已存在!");
}
else
{
if (string.IsNullOrEmpty(sql))
{
isfilter = 0;
DrugqueryQueries _drugqueryQueries = new DrugqueryQueries(_Connection156, _configConnectionString);
int ids = _drugqueryQueries.indexsId(id);
sql = $"SELECT distinct MASTER_INDEX,hos_id FROM [SV_QueryPlatform_].[dbo].[MEDIC_PERSON_INFORMATION_{ids}] WHERE indexs = {id} and TYPE = 1";
}
sql = Vb.Strings.Replace(sql, "from", @$" into [SV_QueryPlatform].[dbo].[{PROJECT_NAME.Replace(" ", "")}] from", 1, -1, Vb.CompareMethod.Text);
if (connection.Execute($@"INSERT INTO[SV_QueryPlatform].[dbo].[FlowReservoirStatus]([tableName] ,[createDate] ,[state],indexs,isfilter,[sql],remarks)
select'{PROJECT_NAME}', getdate(), 0,'{id2}' ,{isfilter},'{sql}','{remarks}'") > 0 ? true : false)
{
return connection.Execute(sql) > 0 ? true : false;
}
else
{
throw new DomainException("创建 [SV_QueryPlatform].[dbo].[" + PROJECT_NAME + "]流水库表失败");
}
}
}
/// <summary>
/// 查询日志
/// </summary>
public IEnumerable<dynamic> ShowLog(long indexs, string tableName)
{
using (DbConnection connection = new SqlConnection(_configConnectionString))
{
var logs = connection.Query<SYS_LOG>($@"select * FROM [SV_QueryPlatform].[dbo].[SYS_LOG] where indexs={indexs}").ToList();
//医院数
var hoscount = connection.Query<PUBPATIENT>($@"select case when HOS_ID>=112 and HOS_ID<=138 then 112 else HOS_ID end HOS_ID ,MASTER_INDEX from[dbo].[{tableName}]").ToList().Select(h => h.HOS_ID).Distinct().Count();
logs = logs.Where(w => w.INDEXS == indexs & w.type != "执行中" & !w.LOG.Contains("创建")).ToList();
//已执行的医院数
var run = (from r in logs
group r by r.LOG into log
select new
{
排序 = log.Key.Contains("PUB_PATIENT") ? 1 : (log.Key.Contains("REG") ? 2 : (log.Key.Contains("OUT") ? 3 : (log.Key.Contains("INPAT") ? 4 : (log.Key.Contains("OPS") ? 5 : 6)))),
操作内容 = log.Key.Replace(" ", ""),
已执行医院数 = log.Select(s => s.HOS_CODE).Distinct().Count(),
失败医院数 = log.Where(w => !w.type.Contains("成功")).Select(s => s.HOS_CODE).Distinct().Count(),
耗时间 = ((TimeSpan)(log.Select(sq => sq.CreateDate).Max() - log.Select(sq => sq.CreateDate).Min())).TotalMinutes,
执行进度 = Math.Round(Convert.ToDecimal(log.Select(s => s.HOS_CODE).Distinct().Count() / Convert.ToDecimal(hoscount)) * 100, 2),
预计结束时间 = ((log.Select(s => s.HOS_CODE).Distinct().Count() / hoscount) == 1 ? 0 : ((TimeSpan)(log.Select(sq => sq.CreateDate).Max() - log.Select(sq => sq.CreateDate).Min())).TotalMinutes / (log.Select(s => s.HOS_CODE).Distinct().Count() == 1 ? 2 : log.Select(s => s.HOS_CODE).Distinct().Count())) * (hoscount - log.Select(s => s.HOS_CODE).Distinct().Count())
}).ToList().OrderBy(o => o.排序);
return run.Select(o => new
{
o.操作内容,
o.已执行医院数,
o.失败医院数,
耗时间 = "已耗时:" + Math.Round(o.耗时间) + "分钟",
执行进度 = o.执行进度.ToString() + "%",
预计结束时间 = o.预计结束时间 == 0 ? "已结束" : DateTime.Now.AddMinutes(o.预计结束时间).ToString()
});
// return connection.Query($@" SELECT case when log like '%OUT_PRES%' then 'OUT_PRES'when log like '%OUT_FEE%' then 'OUT_FEE'when log like '%INPAT_FEE%' then 'INPAT_FEE'when log like '%INPAT_ORDER%' then 'INPAT_ORDER'ELSE LOG END 操作内容,
// DATEDIFF( Minute,MIN(CreateDate),MAX(CreateDate))[耗时间(分)],count( hos_code) 已执行医院数 ,count(distinct hos_code) 已执行医院数1,
// concat(count(hos_code)/cast((select count(distinct hos_id) from [dbo].[{tableName}] )as money)*100,'','%') 执行进度,
// case when ( count(hos_code)/cast((select count(distinct hos_id) from [dbo].[{tableName}] )as money) )=1 then 0 else ((DATEDIFF( Minute,MIN(CreateDate),MAX(CreateDate))/cast((case when count(hos_code)=1 then 2 else count(hos_code) end -1 )as money))* ((cast((select count(distinct hos_id) from [dbo].[{tableName}] )as money))-count(hos_code))) end [预计结束时间(分)],
// sum(case when type not like '%成功%' then 1 else 0 end )失败医院数
// FROM [SV_QueryPlatform].[dbo].[SYS_LOG] where indexs={indexs} and type <>'执行中' and log not like '%创建%'
//group by case when log like '%OUT_PRES%' then 'OUT_PRES'when log like '%OUT_FEE%' then 'OUT_FEE'when log like '%INPAT_FEE%' then 'INPAT_FEE'when log like '%INPAT_ORDER%' then 'INPAT_ORDER'ELSE LOG END
//order by count(hos_code) desc,DATEDIFF( Minute,MIN(CreateDate),MAX(CreateDate))").ToList();
}
}
/// <summary>
/// 查询流水表
/// </summary>
public (IEnumerable<dynamic>, IEnumerable<dynamic>) QueryFlowDatabase(long paseIndex)
{
using (DbConnection connection = new SqlConnection(_configConnectionString))
{
return (connection.Query($@"SELECT * FROM [SV_QueryPlatform].[dbo].[FlowReservoirStatus] order by id desc offset ({paseIndex} - 1)*(10) rows fetch next 10 rows only").ToList(), connection.Query($@"SELECT COUNT(*),CAST(COUNT(*)AS MONEY)totalCount ,{paseIndex} paseIndex FROM [SV_QueryPlatform].[dbo].[FlowReservoirStatus] ").ToList());
}
}
/// <summary>
/// 日志
/// </summary>
public void LOG(string LOG, string hos_code, long indexs, string type, string sql)
{
using (DbConnection connection = new SqlConnection(_configConnectionString))
{
sql = sql.Replace("'", "''");
connection.Execute($@"INSERT INTO[SV_QueryPlatform].[dbo].[SYS_LOG]([INDEXS] ,hos_code,[createDate] ,[LOG],type,[错误sql])
select'{indexs}','{hos_code}', getdate(),'{LOG}','{type}','{sql}'");
}
}
/// <summary>
/// sql查询
/// </summary>
public string[] ShowSql(string TableName, long sqlint)
{
var sql = "";
using (DbConnection connection = new SqlConnection(_configConnectionString))
{
var lie = "";
if (sqlint == 1)
lie = "sql";
else
lie = "sql2";
sql = $@" SELECT {sql} sql FROM [SV_QueryPlatform].[dbo].[Execute_SQL] WHERE type=1 AND TableName ='{TableName}' ";
string[] A = connection.Query<string>(sql).ToArray();
return A;
}
}
/// <summary>
/// 创建流水库
/// </summary>
public bool CreateAFlow_Library(string DatabaseName, long indexs)
{
DatabaseName = DatabaseName.Replace(" ", "");
//建立流水库脚本
using (DbConnection connection = new SqlConnection(_configConnectionString))
{
var sql = $@"CREATE DATABASE [DB_{DatabaseName}] CONTAINMENT = NONE ON PRIMARY ( NAME = N'DB_{DatabaseName}', FILENAME = N'e:\database\DB_{DatabaseName}.mdf' , SIZE = 1454080KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) LOG ON ( NAME = N'DB_{DatabaseName}_log', FILENAME = N'e:\database\DB_{DatabaseName}_log.ldf' , SIZE = 388544KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)ALTER DATABASE [DB_{DatabaseName}] SET COMPATIBILITY_LEVEL = 120
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
EXEC [DB_{DatabaseName}].[dbo].[sp_fulltext_database] @action = 'enable'
ALTER DATABASE [DB_{DatabaseName}] SET ANSI_NULL_DEFAULT OFF
ALTER DATABASE [DB_{DatabaseName}] SET ANSI_NULLS OFF
ALTER DATABASE [DB_{DatabaseName}] SET ANSI_PADDING OFF
ALTER DATABASE [DB_{DatabaseName}] SET ANSI_WARNINGS OFF
ALTER DATABASE [DB_{DatabaseName}] SET ARITHABORT OFF
ALTER DATABASE [DB_{DatabaseName}] SET AUTO_CLOSE OFF
ALTER DATABASE [DB_{DatabaseName}] SET AUTO_SHRINK OFF
ALTER DATABASE [DB_{DatabaseName}] SET AUTO_UPDATE_STATISTICS ON
ALTER DATABASE [DB_{DatabaseName}] SET CURSOR_CLOSE_ON_COMMIT OFF
ALTER DATABASE [DB_{DatabaseName}] SET CURSOR_DEFAULT GLOBAL
ALTER DATABASE [DB_{DatabaseName}] SET CONCAT_NULL_YIELDS_NULL OFF
ALTER DATABASE [DB_{DatabaseName}] SET NUMERIC_ROUNDABORT OFF
ALTER DATABASE [DB_{DatabaseName}] SET QUOTED_IDENTIFIER OFF
ALTER DATABASE [DB_{DatabaseName}] SET RECURSIVE_TRIGGERS OFF
ALTER DATABASE [DB_{DatabaseName}] SET DISABLE_BROKER
ALTER DATABASE [DB_{DatabaseName}] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
ALTER DATABASE [DB_{DatabaseName}] SET DATE_CORRELATION_OPTIMIZATION OFF
ALTER DATABASE [DB_{DatabaseName}] SET TRUSTWORTHY OFF
ALTER DATABASE [DB_{DatabaseName}] SET ALLOW_SNAPSHOT_ISOLATION OFF
ALTER DATABASE [DB_{DatabaseName}] SET PARAMETERIZATION SIMPLE
ALTER DATABASE [DB_{DatabaseName}] SET READ_COMMITTED_SNAPSHOT OFF
ALTER DATABASE [DB_{DatabaseName}] SET HONOR_BROKER_PRIORITY OFF
ALTER DATABASE [DB_{DatabaseName}] SET RECOVERY FULL
ALTER DATABASE [DB_{DatabaseName}] SET MULTI_USER
ALTER DATABASE [DB_{DatabaseName}] SET PAGE_VERIFY CHECKSUM
ALTER DATABASE [DB_{DatabaseName}] SET DB_CHAINING OFF
ALTER DATABASE [DB_{DatabaseName}] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
ALTER DATABASE [DB_{DatabaseName}] SET TARGET_RECOVERY_TIME = 0 SECONDS
ALTER DATABASE [DB_{DatabaseName}] SET DELAYED_DURABILITY = DISABLED
ALTER DATABASE [DB_{DatabaseName}] SET READ_WRITE ";
connection.Execute(sql);
if (connection.Query("select name from dbo.sysdatabases where name='DB_" + DatabaseName + "'").Count() > 0 ? true : false)
{
try
{
LOG($@"创建DB_{DatabaseName} 流水库成功!", "", indexs, "", "");
sql = $@" CREATE TABLE [DB_{DatabaseName}].[dbo].[ASSAY_REPORT](
[REPORT_ID] [bigint] IDENTITY(1,1) NOT NULL,
[REPORT_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[REPORT_TIME] [datetime] NULL,
[SPECIMEN_TYPE] [nvarchar](max) NULL,
[ASSAY_ITEM_CODE] [nvarchar](max) NULL,
[ASSAY_ITEM_NAME] [nvarchar](max) NULL,
[ITEM_ENAME] [nvarchar](max) NULL,
[UNIT] [nvarchar](max) NULL,
[RESULTS] [nvarchar](max) NULL,
[REFRANGE] [nvarchar](max) NULL,
[RESULTSTATUS] [nvarchar](max) NULL,
[REG_SOURCE] [int] NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
CONSTRAINT [PK_ASSAY_REPORT] PRIMARY KEY CLUSTERED
(
[REPORT_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[EXEC_REPORT](
[REPORT_ID] [bigint]IDENTITY(1,1) NOT NULL,
[REPORT_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[ORDER_ID] [bigint] NULL,
[ORDER_CODE] [nvarchar](max) NULL,
[PATIENT_MEDICALREC] [nvarchar](max) NULL,
[EXAMINE_NAME] [nvarchar](max) NULL,
[EXAMINE_SHOW] [nvarchar](max) NULL,
[EXAMINE_RESULT] [nvarchar](max) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[REPORT_TIME] [datetime] NULL,
[REG_SOURCE] [int] NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
CONSTRAINT [PK_EXEC_REPORT] PRIMARY KEY CLUSTERED
(
[REPORT_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[INPAT_DIAG](
[DIAG_ID] [bigint]IDENTITY(1,1) NOT NULL,
[DIAG_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[ICD] [nvarchar](max) NULL,
[DISEASE_NAME] [nvarchar](max) NULL,
[REMARKS] [nvarchar](max) NULL,
[TYPE] [nvarchar](max) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[DIAG_TIME] [datetime] NULL,
[CURE_STATUS] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
CONSTRAINT [PK_INPAT_DIAG] PRIMARY KEY CLUSTERED
(
[DIAG_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[INPAT_FEE](
[CHARGE_ID] [bigint] IDENTITY(1,1) NOT NULL,
[CHARGE_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[CATERY] [nvarchar](max) NULL,
[ITEM_TYPE] [nvarchar](max) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[ITEM_NAME] [nvarchar](max) NULL,
[UNITPRICE] [money] NULL,
[QUANTITY] [money] NULL,
[CATEGORY] [nvarchar](max) NULL,
[UNIT] [nvarchar](max) NULL,
[FEE] [money] NULL,
[CHARGE_TIME] [datetime] NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[DEPT_CODE] [nvarchar](max) NULL,
[DEPT_NAME] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[I_TYPE_NAME] [nvarchar](max) NULL,
[MEDIC_AREA] [nvarchar](max) NULL,
EXEC_DEPT_CODE NVARCHAR(max)null,
EXEC_DEPT_NAME NVARCHAR(max)null,
EXEC_EMP_CODE NVARCHAR(max)null,
EXEC_EMP_NAME varbinary(max) NULL
CONSTRAINT [PK_INPAT_FEE] PRIMARY KEY CLUSTERED
(
[CHARGE_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[INPAT_ORDER](
[ORDER_ID] [bigint] IDENTITY(1,1) NOT NULL,
[ORDER_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[MEDICAL_ORDER_TYPE] [nvarchar](max) NULL,
[ITEM_TYPE] [nvarchar](max) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[ITEM_NAME] [nvarchar](max) NULL,
[SKINTEST] [nvarchar](max) NULL,
[MEDI_SPEC] [nvarchar](max) NULL,
[EACH_DOSE] [nvarchar](max) NULL,
[MEDI_DOSE_UNIT] [nvarchar](max) NULL,
[MEDIC_USE_QUANTITY] [nvarchar](max) NULL,
[MEDI_USE_UNIT] [nvarchar](max) NULL,
[MEDIC_USE_PLAN] [nvarchar](max) NULL,
[MEDIC_USE_MODE] [nvarchar](max) NULL,
[MEDIC_QUANTITY] [nvarchar](max) NULL,
[UNITPRICE] [money] NULL,
[MEDICAL_ORDER_DAYS] [nvarchar](max) NULL,
[INTAKE_START_TIME] [datetime] NULL,
[INTAKE_END_TIME] [datetime] NULL,
[INTAKE_DATES] [int] NULL,
[REMARKS] [nvarchar](max) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[MEDIC_AREA] [nvarchar](max) NULL,
CONSTRAINT [PK_INPAT_ORDER] PRIMARY KEY CLUSTERED
(
[ORDER_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[INPAT_REG_INFO](
[REG_ID] [bigint] IDENTITY(1,1) NOT NULL,
[REG_CODE] [nvarchar](100) NULL,
[PERSON_ID] [bigint] NULL,
[PERSON_CODE] [nvarchar](100) NULL,
[IN_DEPT_CODE] [nvarchar](max) NULL,
[IN_DEPT_NAME] [nvarchar](max) NULL,
[WARD_NAME] [nvarchar](max) NULL,
[EMP_CODE_INCHARGE] [nvarchar](max) NULL,
[EMP_NAME_INCHARGE] [varbinary](max) NULL,
[EMP_CODE_RESIDENT] [nvarchar](max) NULL,
[EMP_NAME_RESIDENT] [varbinary](max) NULL,
[INHOS_TIME] [datetime] NULL,
[OUTHOS_TIME] [datetime] NULL,
[CARD_TYPE] [nvarchar](max) NULL,
[CARD_ID] [nvarchar](max) NULL,
[HEIGHT] [nvarchar](max) NULL,
[WEIGHT] [nvarchar](max) NULL,
[INHOS_STATUS] [nvarchar](max) NULL,
[OUTHOS_STATUS] [nvarchar](max) NULL,
[F_DIAG] [nvarchar](max) NULL,
[I_DEPT_NAME] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[I_CARD_TYPE] [nvarchar](max) NULL,
[WAISTLINE] [nvarchar](max) NULL,
[TOTAL_FEE] [money] NULL,
[PAY_FEE] [money] NULL,
OUT_DEPT_CODE NVARCHAR(max) null,
OUT_DEPT_NAME NVARCHAR(max)null,
SOURCE NVARCHAR(max)null
CONSTRAINT [PK_INPAT_REG_INFO] PRIMARY KEY CLUSTERED
(
[REG_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[OPS_INFO](
[OPS_ID] [bigint] IDENTITY(1,1) NOT NULL,
[OPS_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[ORDER_ID] [bigint] NULL,
[ORDER_CODE] [nvarchar](max) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[ITEM_NAME] [nvarchar](max) NULL,
[PODX] [nvarchar](max) NULL,
[RESULTS] [nvarchar](max) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[OPS_LEVEL] [nvarchar](max) NULL,
[WOUND_LEVEL] [nvarchar](max) NULL,
[START_TIME] [datetime] NULL,
[END_TIME] [datetime] NULL,
[F_HELPER] [varbinary](max) NULL,
[S_HELPER] [varbinary](max) NULL,
[F_ANAESTHESIA] [varbinary](max) NULL,
[S_ANAESTHESIA] [varbinary](max) NULL,
[DEPT_CODE] [nvarchar](max) NULL,
[DEPT_NAME] [nvarchar](max) NULL,
[CURE_STATUS] [nvarchar](max) NULL,
[ANESTHESIA_METHOD] [nvarchar](max) NULL,
[ELECTIVE_SURGERY] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[ICD_9_CM] [nvarchar](max) NULL,
[I_ITEM_NAME] [nvarchar](max) NULL,
[I_ICD_9_CM] [nvarchar](max) NULL,
CONSTRAINT [PK_OPS_INFO] PRIMARY KEY CLUSTERED
(
[OPS_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[OUT_DIAG](
[DIAG_ID] [bigint] IDENTITY(1,1) NOT NULL,
[DIAG_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[ICD] [nvarchar](max) NULL,
[DISEASE_NAME] [nvarchar](max) NULL,
[DIAG_TIME] [datetime] NULL,
[REMARKS] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
CONSTRAINT [PK_OUT_DIAG] PRIMARY KEY CLUSTERED
(
[DIAG_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[OUT_FEE](
[CHARGE_ID] [bigint]IDENTITY(1,1) NOT NULL,
[CHARGE_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[CATERY] [nvarchar](max) NULL,
[ITEM_TYPE] [nvarchar](max) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[ITEM_NAME] [nvarchar](max) NULL,
[UNITPRICE] [money] NULL,
[CATEGORY] [nvarchar](max) NULL,
[QUANTITY] [money] NULL,
[UNIT] [nvarchar](max) NULL,
[FEE] [money] NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[DEPT_CODE] [nvarchar](max) NULL,
[DEPT_NAME] [nvarchar](max) NULL,
[CHARGE_TIME] [datetime] NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[I_TYPE_NAME] [nvarchar](max) NULL,
[MEDIC_AREA] [nvarchar](max) NULL,
EXEC_DEPT_CODE NVARCHAR(max)null,
EXEC_DEPT_NAME NVARCHAR(max)null,
EXEC_EMP_CODE NVARCHAR(max)null,
EXEC_EMP_NAME varbinary(max) NULL
CONSTRAINT [PK_OUT_FEE] PRIMARY KEY CLUSTERED
(
[CHARGE_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[OUT_PRES](
[PRES_ID] [bigint] IDENTITY(1,1) NOT NULL,
[PRES_CODE] [nvarchar](max) NULL,
[REG_ID] [bigint] NULL,
[REG_CODE] [nvarchar](100) NULL,
[GROUPNO] [nvarchar](max) NULL,
[NO] [nvarchar](max) NULL,
[PRES_TIME] [datetime] NULL,
[PRES_TYPE] [nvarchar](max) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[ITEM_CODE] [nvarchar](max) NULL,
[MEDIC_CLASS] [nvarchar](max) NULL,
[MEDIC_GENERAL_NAME] [nvarchar](max) NULL,
[MEDIC_NAME] [nvarchar](max) NULL,
[MEDIC_TYPE] [nvarchar](max) NULL,
[MEDIC_SPEC] [nvarchar](max) NULL,
[MEDIC_AREA] [nvarchar](max) NULL,
[MEDIC_USE_QUANTITY] [nvarchar](max) NULL,
[MEDIC_USE_UNIT] [nvarchar](max) NULL,
[MEDIC_USE_CODE] [nvarchar](max) NULL,
[MEDIC_USE_MODE] [nvarchar](max) NULL,
[MEDIC_DAYS] [nvarchar](max) NULL,
[MEDIC_QUANTITY] [nvarchar](max) NULL,
[MEDIC_UNIT] [nvarchar](max) NULL,
[SKINTEST] [nvarchar](max) NULL,
[MEDIC_REMARK] [nvarchar](max) NULL,
[MEDIC_INSUREANCE_TYPE] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
CONSTRAINT [PK_OUT_PRES] PRIMARY KEY CLUSTERED
(
[PRES_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[OUT_REG_INFO](
[REG_ID] [bigint] IDENTITY(1,1) NOT NULL,
[REG_CODE] [nvarchar](100) NULL,
[PERSON_ID] [bigint] NULL,
[PERSON_CODE] [nvarchar](100) NULL,
[REG_TIME] [datetime] NULL,
[REG_EMP_CODE] [nvarchar](max) NULL,
[REG_EMP_NAME] [varbinary](max) NULL,
[DEPT_CODE] [nvarchar](max) NULL,
[DEPT_NAME] [nvarchar](max) NULL,
[EMP_CODE] [nvarchar](max) NULL,
[EMP_NAME] [varbinary](max) NULL,
[CARD_TYPE] [nvarchar](max) NULL,
[CARD_ID] [nvarchar](max) NULL,
[REG_TYPE] [nvarchar](max) NULL,
[F_DIAG] [nvarchar](max) NULL,
[I_DEPT_NAME] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[I_CARD_TYPE] [nvarchar](max) NULL,
[TOTAL_FEE] [money] NULL,
[PAY_FEE] [money] NULL,
CONSTRAINT [PK_OUT_REG_INFO] PRIMARY KEY CLUSTERED
(
[REG_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING OFF
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [DB_{DatabaseName}].[dbo].[PUB_PATIENT](
[PERSON_ID] [bigint]IDENTITY(1,1) NOT NULL,
[PERSON_CODE] [nvarchar](100) NULL,
[SEX] [nvarchar](max) NULL,
[BIRTHDAY] [datetime] NULL,
[MARRIED] [nvarchar](max) NULL,
[PROVINCE] [nvarchar](max) NULL,
[CITY] [nvarchar](max) NULL,
[COUNTY] [nvarchar](max) NULL,
[OCCUPATION] [nvarchar](max) NULL,
[BLOOD] [nvarchar](max) NULL,
[ID_CARD] [varbinary](max) NULL,
[NATION] [nvarchar](max) NULL,
[NATIONALITY] [nvarchar](max) NULL,
[ORG_CODE] [int] NOT NULL,
[UPLOAD_TIME] [datetime] NULL,
[EDUCATIONAL_LEVEL] [nvarchar](max) NULL,
[MASTER_INDEX] nvarchar(MAX)NULL,
CONSTRAINT [PK_PUB_PATIENT] PRIMARY KEY CLUSTERED
(
[PERSON_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
SET ANSI_PADDING ON ";
connection.Execute(sql);
LOG($@"创建DB_{DatabaseName} 流水库表结构成功!", "", indexs, "", "");
sql = $@" CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[ASSAY_REPORT]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[ASSAY_REPORT]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[EXEC_REPORT]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[EXEC_REPORT]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[INPAT_FEE]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[INPAT_FEE]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[INPAT_ORDER]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[INPAT_ORDER]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[INPAT_REG_INFO]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_PERSON_ID] ON[DB_{DatabaseName}].[dbo].[INPAT_REG_INFO]
(
[PERSON_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_PERSON_CODE] ON[DB_{DatabaseName}].[dbo].[INPAT_REG_INFO]
(
[PERSON_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[OPS_INFO]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[OPS_INFO]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[OUT_DIAG]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[OUT_DIAG]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[INPAT_DIAG]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[INPAT_DIAG]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[OUT_FEE]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[OUT_FEE]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[OUT_PRES]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_REG_ID] ON[DB_{DatabaseName}].[dbo].[OUT_PRES]
(
[REG_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
CREATE NONCLUSTERED INDEX[IX_PERSON_ID] ON[DB_{DatabaseName}].[dbo].[OUT_REG_INFO]
(
[PERSON_ID] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_REG_CODE] ON[DB_{DatabaseName}].[dbo].[OUT_REG_INFO]
(
[REG_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_PERSON_CODE] ON[DB_{DatabaseName}].[dbo].[OUT_REG_INFO]
(
[PERSON_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
SET ANSI_PADDING ON
CREATE NONCLUSTERED INDEX[IX_PERSON_CODE] ON[DB_{DatabaseName}].[dbo].[PUB_PATIENT]
(
[PERSON_CODE] ASC
)WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY]
ALTER DATABASE[DB_{DatabaseName}] SET READ_WRITE";
connection.Execute(sql);
LOG($@"创建DB_{DatabaseName} 流水库索引成功!", "", indexs, "", "");
return connection.Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =1 ,DatabaseName='DB_{DatabaseName}' WHERE indexs={indexs}") > 0 ? true : false;
}
catch (Exception)
{
LOG($@"创建DB_{DatabaseName} 流水库操作时出错!", "", indexs, "", "");
throw new DomainException($@"创建DB_{DatabaseName} 流水库操作时出错!");
}
}
return false;
}
}
//public void CheckTimeout()
//{
// using (DbConnection connection = new SqlConnection(_configConnectionString)) // DefaultConnection
// {
// string[] id = connection.Query<string>("select ID from [SV_QueryPlatform].[dbo].[FlowReservoirStatus] where[state] = 2 and DATEDIFF(HOUR, DataPullTime, getdate()) >3").ToArray();
// foreach (var item in id)
// {
// connection.Execute($@" update [dbo].[FlowReservoirStatus] set state= 4 where id={item}");
// }
// }
//}
public DbConnection Connection(long ip, string y = "", string t = "")
{
if (ip == 156)
{
return new SqlConnection((y == "") ? _Connection156 : _Connection156.Replace(y, t));
}
if (ip == 181)
{
return new SqlConnection((y == "") ? _configConnectionString : _configConnectionString.Replace(y, t));
}
return new SqlConnection();
}
public DbConnection Connection(long ip, string configConnectionString)
{
if (ip == 0)
{
return new SqlConnection(configConnectionString);
}
return new SqlConnection();
}
/// <summary>
/// 拉取病人表
/// </summary>
public void PullData(long indexs, string DatabaseName, string tableName, string biao, string ip)
{
var sql = "";
var where = @$"and ExecOpenLink in ('{ip}')";
sql = @$" select A.*from(
SELECT DISTINCT case when a.id>=112 and a.id<=138 then '112' else ID end 'id',
case when a.id>=112 and a.id<=138 then '192.168.18.152' else ExecOpenLink end 'ExecOpenLink',
case when a.id>=112 and a.id<=138 then 'HOS_631337112' else ExecDatabase end 'ExecDatabase'
FROM [DB_SV_Data_Config].[dbo].[SYS_Hospital] A
JOIN [192.168.18.181].[SV_QueryPlatform].[dbo].[{tableName}] B ON A.ID = B.HOS_ID
)A
LEFT JOIN ( SELECT * FROM [192.168.18.181].[SV_QueryPlatform].[dbo].[SYS_LOG] WHERE INDEXS = {indexs}
AND LOG = '{biao}' and type ='执行中'
) C ON A.ID = CAST(LEFT(RIGHT(C.hos_code, 4),3) AS int)
WHERE hos_code IS NULL {where};
";
List<SYS_Hospital> hospitals = Connection(156).Query<SYS_Hospital>(sql).ToList();
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);
pairs.TryAdd($"@{nameof(DatabaseName)}", DatabaseName);
pairs.TryAdd($"@{nameof(tableName)}", tableName);
pairs.TryAdd($"@{nameof(biao)}", biao);
var ITEM = "[@ExecOpenLink].[@ExecDatabase]";
//拉取病人表
Connection(181).Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =2 ,DataPullTime=getdate() WHERE indexs={indexs} and tableName='{tableName.Replace(" ", "")}'");
try
{
long rs = 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");
}
foreach (var item1 in pairs)
{
ITEM = ITEM.Replace(item1.Key, item1.Value.ToString());
sql = sql.Replace(item1.Key, item1.Value.ToString());
}
服务器 fwq = Connection(181).Query<服务器>($"SELECT [服务器ip],[数据库账号],[数据库密码] FROM [SV_QueryPlatform].[dbo].[服务器] where[服务器ip] ='{hos.ExecOpenLink}'").FirstOrDefault();
var msConnectionString = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;", hos.ExecOpenLink, hos.ExecDatabase, fwq.数据库账号, fwq.数据库密码);
LOG($"{biao}", ITEM, indexs, "执行中", "");
long num = Connection(0, msConnectionString).Execute(sql, commandTimeout: 60 * 60 * 60 * 5);
LOG($"{biao}", ITEM, indexs, "成功", sql);
}
catch (Exception e)
{
LOG($"{biao}", ITEM, indexs, "错误", $"报错sql:{sql}错误日志:{e}");
PullData(indexs, DatabaseName, tableName, biao, ip);//跳过错误执行未执行的医院
}
Connection(181).Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET DataPullTime=getdate() WHERE indexs={indexs} and tableName='{tableName}'");
}
}
public void pullstate(long indexs, string tableName)
{
Connection(181).Execute(@$"
delete [SV_QueryPlatform].[dbo].[SYS_LOG] from [SV_QueryPlatform].[dbo].[SYS_LOG] a
join
(
SELECT
a.INDEXS,a.hos_code, a.log, a.type
FROM (select *from [SV_QueryPlatform].[dbo].[SYS_LOG] where indexs ={indexs} and type='执行中')a
left join (select *from [SV_QueryPlatform].[dbo].[SYS_LOG] where indexs ={indexs} and type='成功 ') b on a.hos_code=b.hos_code and a.log=b.LOG
where b.type is null
) b on a.hos_code=b.hos_code and a.LOG=b.log and a.INDEXS=b.indexs
where a.indexs ={indexs} and a.type='执行中';
UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =10 ,DataPullTime=getdate() WHERE indexs={indexs} and tableName='{tableName.Replace(" ", "")}'");
}
private void 执行加日志(long indexs, string biao, string sql, string ITEM)
{
Connection(181).Execute(sql, commandTimeout: 60 * 60 * 60 * 5);
LOG($"{biao}", ITEM, indexs, "成功", sql);
}
/// <summary>
/// 多线程拉取病人表
/// </summary>
/// <param name="indexs"></param>
/// <param name="DatabaseName"></param>
/// <param name="tableName"></param>
/// <returns></returns>
public void PullData(long indexs, string DatabaseName, string tableName)
{
//写一个 人群表查询人数
long rs = QueryPatient(tableName);
// long xfwqrs = xingfqrs(tableName);
DatabaseName = DatabaseName.Replace(" ", "");
tableName = tableName.Replace(" ", "");
var data = new List<List<string>>
{
new List<string>{"PUB_PATIENT"},
new List<string>{"OUT_REG_INFO","INPAT_REG_INFO"},
new List<string>{"OUT_DIAG","OUT_PRES","INPAT_ORDER","INPAT_DIAG","OUT_FEE","INPAT_FEE","ASSAY_REPORT","EXEC_REPORT","OPS_INFO"},
};
if (rs > 100000)
{
data = new List<List<string>>
{
new List<string>{"PUB_PATIENT"},
new List<string>{"OUT_REG_INFO","INPAT_REG_INFO"},
new List<string>{"OUT_DIAG","INPAT_DIAG","EXEC_REPORT","OPS_INFO","ASSAY_REPORT"},
new List<string>{"OUT_PRES","INPAT_ORDER","OUT_FEE","INPAT_FEE"},
};
}
var fwqdata = 标准库fwq().Select(s => s.服务器ip);
var tasks = new List<System.Threading.Tasks.Task>();
foreach (var item in data)
{
foreach (var biao in item)
{
foreach (var ip in fwqdata)
{
tasks.Add(System.Threading.Tasks.Task.Factory.StartNew(() => PullData(indexs, DatabaseName, tableName, biao, ip)));
}
}
System.Threading.Tasks.Task.WaitAll(tasks.ToArray());
}
//修复执行错误方法
try
{
PullData修复超时错误(indexs);
}
catch (Exception e)
{
LOG($"修复超时错误", "修复超时错误", indexs, "修复失败", $"报错:{e}");
}
finally
{
Connection(181).Execute(@$"UPDATE @DBName.dbo.PUB_PATIENT
SET MASTER_INDEX = CONCAT(MASTER_INDEX, '_', ORG_CODE), PERSON_CODE = CONCAT(PERSON_CODE, '_', ORG_CODE)
FROM @DBName.dbo.PUB_PATIENT;
UPDATE @DBName.dbo.OUT_REG_INFO
SET PERSON_CODE = CONCAT(PERSON_CODE, '_', ORG_CODE),REG_CODE = CONCAT(REG_CODE, '_', ORG_CODE);
UPDATE @DBName.dbo.OUT_REG_INFO
SET PERSON_ID = B.PERSON_ID
FROM @DBName.dbo.PUB_PATIENT B
WHERE @DBName.dbo.OUT_REG_INFO.PERSON_CODE = B.PERSON_CODE AND @DBName.dbo.OUT_REG_INFO.ORG_CODE = B.ORG_CODE;
UPDATE @DBName.dbo.OUT_DIAG
SET REG_CODE = CONCAT(REG_CODE, '_', ORG_CODE);
UPDATE @DBName.dbo.OUT_DIAG
SET REG_ID = B.REG_ID
FROM @DBName.dbo.OUT_REG_INFO B
WHERE @DBName.dbo.OUT_DIAG.REG_CODE = B.REG_CODE AND @DBName.dbo.OUT_DIAG.ORG_CODE = B.ORG_CODE;
UPDATE @DBName.dbo.OUT_PRES
SET REG_CODE = CONCAT(REG_CODE, '_', ORG_CODE);
UPDATE @DBName.dbo.OUT_PRES
SET REG_ID = B.REG_ID
FROM @DBName.dbo.OUT_REG_INFO B
WHERE @DBName.dbo.OUT_PRES.REG_CODE = B.REG_CODE AND @DBName.dbo.OUT_PRES.ORG_CODE = B.ORG_CODE;
UPDATE @DBName.dbo.OUT_FEE
SET REG_CODE = CONCAT(REG_CODE, '_', ORG_CODE);
UPDATE @DBName.dbo.OUT_FEE
SET REG_ID = B.REG_ID
FROM @DBName.dbo.OUT_REG_INFO B
WHERE @DBName.dbo.OUT_FEE.REG_CODE = B.REG_CODE AND @DBName.dbo.OUT_FEE.ORG_CODE = B.ORG_CODE;
UPDATE @DBName.dbo.INPAT_REG_INFO
SET PERSON_CODE = CONCAT(PERSON_CODE, '_', ORG_CODE),REG_CODE = CONCAT(REG_CODE, '_', ORG_CODE);
UPDATE @DBName.dbo.INPAT_REG_INFO
SET PERSON_ID = B.PERSON_ID
FROM @DBName.dbo.PUB_PATIENT B
WHERE @DBName.dbo.INPAT_REG_INFO.PERSON_CODE = B.PERSON_CODE AND @DBName.dbo.INPAT_REG_INFO.ORG_CODE = B.ORG_CODE;
UPDATE @DBName.dbo.INPAT_DIAG
SET REG_CODE = CONCAT(REG_CODE, '_', ORG_CODE);
UPDATE @DBName.dbo.INPAT_DIAG
SET REG_ID = B.REG_ID
FROM @DBName.dbo.INPAT_REG_INFO B
WHERE @DBName.dbo.INPAT_DIAG.REG_CODE = B.REG_CODE AND @DBName.dbo.INPAT_DIAG.ORG_CODE = B.ORG_CODE;
UPDATE @DBName.dbo.INPAT_ORDER
SET REG_CODE = CONCAT(REG_CODE, '_', ORG_CODE);
UPDATE @DBName.dbo.INPAT_ORDER
SET REG_ID = B.REG_ID
FROM @DBName.dbo.INPAT_REG_INFO B
WHERE @DBName.dbo.INPAT_ORDER.REG_CODE = B.REG_CODE AND @DBName.dbo.INPAT_ORDER.ORG_CODE = B.ORG_CODE;
UPDATE @DBName.dbo.INPAT_FEE
SET REG_CODE = CONCAT(REG_CODE, '_', ORG_CODE);
UPDATE @DBName.dbo.INPAT_FEE
SET REG_ID = B.REG_ID
FROM @DBName.dbo.INPAT_REG_INFO B
WHERE @DBName.dbo.INPAT_FEE.REG_CODE = B.REG_CODE AND @DBName.dbo.INPAT_FEE.ORG_CODE = B.ORG_CODE;
UPDATE @DBName.dbo.OPS_INFO
SET REG_CODE = CONCAT(REG_CODE, '_', ORG_CODE);
UPDATE @DBName.dbo.OPS_INFO
SET REG_ID = B.REG_ID
FROM @DBName.dbo.INPAT_REG_INFO B
WHERE @DBName.dbo.OPS_INFO.REG_CODE = B.REG_CODE AND @DBName.dbo.OPS_INFO.ORG_CODE = B.ORG_CODE;
UPDATE @DBName.dbo.EXEC_REPORT
SET REG_CODE = CONCAT(REG_CODE, '_', ORG_CODE);
UPDATE @DBName.dbo.EXEC_REPORT
SET REG_ID = B.REG_ID
FROM @DBName.dbo.OUT_REG_INFO B
WHERE @DBName.dbo.EXEC_REPORT.REG_CODE = B.REG_CODE AND @DBName.dbo.EXEC_REPORT.ORG_CODE = B.ORG_CODE AND REG_SOURCE = 1;
UPDATE @DBName.dbo.EXEC_REPORT
SET REG_ID = B.REG_ID
FROM @DBName.dbo.INPAT_REG_INFO B
WHERE @DBName.dbo.EXEC_REPORT.REG_CODE = B.REG_CODE AND @DBName.dbo.EXEC_REPORT.ORG_CODE = B.ORG_CODE AND REG_SOURCE = 2;
UPDATE @DBName.dbo.ASSAY_REPORT
SET REG_CODE = CONCAT(REG_CODE, '_', ORG_CODE);
UPDATE @DBName.dbo.ASSAY_REPORT
SET REG_ID = B.REG_ID
FROM @DBName.dbo.OUT_REG_INFO B
WHERE @DBName.dbo.ASSAY_REPORT.REG_CODE = B.REG_CODE AND @DBName.dbo.ASSAY_REPORT.ORG_CODE = B.ORG_CODE AND REG_SOURCE = 1;
UPDATE @DBName.dbo.ASSAY_REPORT
SET REG_ID = B.REG_ID
FROM @DBName.dbo.INPAT_REG_INFO B
WHERE @DBName.dbo.ASSAY_REPORT.REG_CODE = B.REG_CODE AND @DBName.dbo.ASSAY_REPORT.ORG_CODE = B.ORG_CODE AND REG_SOURCE = 2; ".Replace("@DBName", DatabaseName));//拉取完成
}
Connection(181).Execute($"UPDATE [SV_QueryPlatform].[dbo].[FlowReservoirStatus] SET state =5 WHERE indexs={indexs} and tableName='{tableName.Replace(" ", "")}'");//拉取完成
}
public void PullData修复超时错误(long indexs)
{
DbConnection connection = new SqlConnection(_configConnectionString);
//读取错误日志
var sql = @$"select [ID], [INDEXS],SUBSTRING(hos_code,1,CHARINDEX('H',hos_code)-1)IP, REPLACE(hos_code,SUBSTRING(hos_code,1,CHARINDEX('H',hos_code)-1),'')HOS ,
[LOG], [CreateDate], [type], [错误sql] from (select [ID], [INDEXS], REPLACE(REPLACE(REPLACE( [hos_code] ,'].[',''),'[',''),']','') hos_code,[LOG],
[CreateDate], [type], REPLACE(left([错误sql],CHARINDEX('错误日志',[错误sql])-1),'报错sql:','')[错误sql] FROM [SV_QueryPlatform].[dbo].[SYS_LOG]
where indexs={indexs} and type='错误')a";
var log = connection.Query<SYS_LOG>(sql).ToList();
var 错误log = log.Where(s => s.type == "错误");
//foreach 错误sql
foreach (var item in 错误log.OrderBy(o => o.LOG))
{//错误日志修复
System.Threading.Tasks.Task.Factory.StartNew(() => PullData修复超时错误(item.IP, item.HOS, item.id, item.错误sql));
}
}
public void PullData修复超时错误(string ip, string hos, int id, string sql)
{
long num = Connection(181).Execute(sql, commandTimeout: 60 * 60 * 60 * 5);
if (num > 0) { Connection(181).Execute(@$"update [SV_QueryPlatform].[dbo].[SYS_LOG] set type='成功,返回行数:{num}' where id ={id}", commandTimeout: 60 * 60 * 60 * 5); }
}
public long QueryPatient(string tableName)
{
DbConnection connection = new SqlConnection(_configConnectionString);
var rs = connection.Query<PUBPATIENT>($@"SELECT distinct HOS_ID,MASTER_INDEX FROM [SV_QueryPlatform].[dbo].[{tableName}]").Count();
return rs;
}
public List<服务器> 标准库fwq()
{
DbConnection connection = new SqlConnection(_configConnectionString);
return connection.Query<服务器>($@"SELECT * FROM [SV_QueryPlatform].[dbo].[服务器] where type='标准库'").ToList();
}
}
}
using Dapper; using Dapper;
using Dapper.Contrib.Extensions; using Dapper.Contrib.Extensions;
using Health.Api.Infrastructure.Modules;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
using QueryPlatform.Api.Infrastructure.Modules;
using StackExchange.Profiling; using StackExchange.Profiling;
using StackExchange.Profiling.Data; using StackExchange.Profiling.Data;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.Common; using System.Data.Common;
namespace Health.Api.Infrastructure.Queries namespace QueryPlatform.Api.Infrastructure.Queries
{ {
public class UserQueries public class UserQueries
{ {
private readonly string _connectionString; private readonly string _connectionString;
public UserQueries(string connectionString) public UserQueries(string connectionString)
{ {
_connectionString = connectionString; _connectionString = connectionString;
} }
public SYS_USER GetUserByAccount(string account, int id) public SYS_USER GetUserByAccount(string account, int id)
{ {
using (DbConnection connection = new ProfiledDbConnection(new SqlConnection(_connectionString), MiniProfiler.Current)) using (DbConnection connection = new ProfiledDbConnection(new SqlConnection(_connectionString), MiniProfiler.Current))
...@@ -25,7 +23,6 @@ public SYS_USER GetUserByAccount(string account, int id) ...@@ -25,7 +23,6 @@ public SYS_USER GetUserByAccount(string account, int id)
return connection.QueryFirstOrDefault<SYS_USER>("SELECT * FROM SYS_USER WHERE LOGIN=@account AND IsDelete=0 and id <>" + id, new { account }); return connection.QueryFirstOrDefault<SYS_USER>("SELECT * FROM SYS_USER WHERE LOGIN=@account AND IsDelete=0 and id <>" + id, new { account });
} }
} }
public IEnumerable<SYS_USER> GetUsers(string realname) public IEnumerable<SYS_USER> GetUsers(string realname)
{ {
using (DbConnection connection = new ProfiledDbConnection(new SqlConnection(_connectionString), MiniProfiler.Current)) using (DbConnection connection = new ProfiledDbConnection(new SqlConnection(_connectionString), MiniProfiler.Current))
...@@ -33,9 +30,6 @@ public IEnumerable<SYS_USER> GetUsers(string realname) ...@@ -33,9 +30,6 @@ public IEnumerable<SYS_USER> GetUsers(string realname)
return connection.Query<SYS_USER>("SELECT * FROM SYS_USER WHERE isdelete=0 and realname like '%" + realname + "%'"); return connection.Query<SYS_USER>("SELECT * FROM SYS_USER WHERE isdelete=0 and realname like '%" + realname + "%'");
} }
} }
public SYS_USER GetUserById(int userId) public SYS_USER GetUserById(int userId)
{ {
using (DbConnection connection = new ProfiledDbConnection(new SqlConnection(_connectionString), MiniProfiler.Current)) using (DbConnection connection = new ProfiledDbConnection(new SqlConnection(_connectionString), MiniProfiler.Current))
......
using Dapper.Contrib.Extensions; using Dapper.Contrib.Extensions;
using Health.Api.Infrastructure.Modules;
using Health.Api.Infrastructure.Request;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
using QueryPlatform.Api.Infrastructure.Modules;
using QueryPlatform.Api.Infrastructure.Request;
using StackExchange.Profiling; using StackExchange.Profiling;
using StackExchange.Profiling.Data; using StackExchange.Profiling.Data;
using System; using System;
using System.Data.Common; using System.Data.Common;
namespace Health.Api.Infrastructure.Queries namespace QueryPlatform.Api.Infrastructure.Queries
{ {
public class UserStorage public class UserStorage
{ {
...@@ -32,7 +32,7 @@ public SYS_USER Add(UserRequest request) ...@@ -32,7 +32,7 @@ public SYS_USER Add(UserRequest request)
IsDelete = false, IsDelete = false,
}; };
user.ID = connection.Insert(user); user.id = (int)connection.Insert(user);
return user; return user;
} }
...@@ -41,9 +41,6 @@ public SYS_USER Add(UserRequest request) ...@@ -41,9 +41,6 @@ public SYS_USER Add(UserRequest request)
/// <summary> /// <summary>
/// 修改密码 /// 修改密码
/// </summary> /// </summary>
/// <param name="userId"></param>
/// <param name="oldPassword"></param>
/// <param name="newPassword"></param>
/// <returns></returns> /// <returns></returns>
public SYS_USER Update(UserRequest request) public SYS_USER Update(UserRequest request)
{ {
...@@ -72,7 +69,7 @@ public SYS_USER Update(UserRequest request) ...@@ -72,7 +69,7 @@ public SYS_USER Update(UserRequest request)
/// <param name="delete"></param> /// <param name="delete"></param>
/// <param name="reset"></param> /// <param name="reset"></param>
/// <returns></returns> /// <returns></returns>
public SYS_USER Update(int userId, bool? delete = null, bool? reset = null, bool? disable = null) public SYS_USER Update(long userId, bool? delete = null, bool? reset = null, bool? disable = null)
{ {
using (DbConnection connection = new ProfiledDbConnection(new SqlConnection(_connectionString), MiniProfiler.Current)) using (DbConnection connection = new ProfiledDbConnection(new SqlConnection(_connectionString), MiniProfiler.Current))
{ {
......
using Health.Api.Infrastructure.Hubs; using Microsoft.AspNetCore.SignalR;
using Health.Infra;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using QueryPlatform.Api.Infrastructure.Hubs;
using QueryPlatform.Infra;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Health.Api.Infrastructure.Queues namespace QueryPlatform.Api.Infrastructure.Queues
{ {
public class HubNotificationQueue public class HubNotificationQueue
......
namespace Health.Api.Infrastructure.Request namespace QueryPlatform.Api.Infrastructure.Request
{ {
public class LoginRequest public class LoginRequest
{ {
......
namespace Health.Api.Infrastructure.Request namespace QueryPlatform.Api.Infrastructure.Request
{ {
public class PasswordRequest public class PasswordRequest
{ {
......
namespace Health.Api.Infrastructure.Request namespace QueryPlatform.Api.Infrastructure.Request
{ {
public class UserRequest public class UserRequest
{ {
......
using Health.Infra; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using QueryPlatform.Infra;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt; using System.IdentityModel.Tokens.Jwt;
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
using System.Security.Claims; using System.Security.Claims;
using System.Text; using System.Text;
namespace Health.Api.Infrastructure namespace QueryPlatform.Api.Infrastructure
{ {
public class JwtOption public class JwtOption
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
using System; using System;
using System.IO; using System.IO;
namespace Health.Api namespace QueryPlatform.Api
{ {
public class Program public class Program
{ {
......
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\net6.0\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\netcoreapp3.1\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>netcoreapp3.1</TargetFramework>
<ProjectGuid>7d7e81d8-76ac-4b16-9f93-b4689bbc423e</ProjectGuid>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\netcoreapp3.1\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
</PropertyGroup>
</Project>
\ No newline at end of file
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"ASPNETCORE_ENVIRONMENT": "Localhost" "ASPNETCORE_ENVIRONMENT": "Localhost"
} }
}, },
"Health.Api": { "QueryPlatform.Api": {
"commandName": "Project", "commandName": "Project",
"launchBrowser": true, "launchBrowser": true,
"launchUrl": "swagger", "launchUrl": "swagger",
......
...@@ -6,11 +6,18 @@ ...@@ -6,11 +6,18 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>..\Health.Api\wwwroot\Health.Api.xml</DocumentationFile> <DocumentationFile>..\queryPlaform.Api\wwwroot\QueryPlatform.Api.xml</DocumentationFile>
<NoWarn>1701;1702;1591</NoWarn> <NoWarn>1701;1702;1591</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="Infrastructure\Dtos\**" />
<Content Remove="Infrastructure\Dtos\**" />
<EmbeddedResource Remove="Infrastructure\Dtos\**" />
<None Remove="Infrastructure\Dtos\**" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Infrastructure\Models\INPAT_DIAG.cs" /> <Compile Remove="Infrastructure\Models\INPAT_DIAG.cs" />
<Compile Remove="Infrastructure\Models\INPAT_FEE.cs" /> <Compile Remove="Infrastructure\Models\INPAT_FEE.cs" />
<Compile Remove="Infrastructure\Models\INPAT_ORDER.cs" /> <Compile Remove="Infrastructure\Models\INPAT_ORDER.cs" />
...@@ -31,22 +38,43 @@ ...@@ -31,22 +38,43 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DinkToPdf" Version="1.0.8" />
<PackageReference Include="IronPdf" Version="2023.5.8" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.38" />
<PackageReference Include="CsvHelper" Version="15.0.8" /> <PackageReference Include="CsvHelper" Version="15.0.8" />
<PackageReference Include="Dapper" Version="2.0.35" /> <PackageReference Include="Dapper" Version="2.0.35" />
<PackageReference Include="Dapper.Contrib" Version="2.0.35" /> <PackageReference Include="Dapper.Contrib" Version="2.0.35" />
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
<PackageReference Include="DocXCore" Version="1.0.10" />
<PackageReference Include="EasyCaching.InMemory" Version="0.9.0" /> <PackageReference Include="EasyCaching.InMemory" Version="0.9.0" />
<PackageReference Include="EPPlus" Version="4.5.3.2" /> <PackageReference Include="EPPlus" Version="4.5.3.2" />
<PackageReference Include="FluentEmail.Smtp" Version="3.0.2" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.46" />
<PackageReference Include="IKVM" Version="8.4.5" />
<PackageReference Include="iTextSharp.LGPLv2.Core" Version="3.3.5" />
<PackageReference Include="MediatR" Version="8.1.0" /> <PackageReference Include="MediatR" Version="8.1.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="8.1.0" /> <PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="8.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.38" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.8" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.8" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.7" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.7" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.8" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.8" />
<PackageReference Include="Microsoft.Office.Interop.Word" Version="15.0.4797.1004" />
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.2.1" /> <PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.2.1" />
<PackageReference Include="Autofac" Version="5.2.0" /> <PackageReference Include="Autofac" Version="5.2.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="6.0.0" /> <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="FluentValidation" Version="9.2.0" /> <PackageReference Include="FluentValidation" Version="9.2.0" />
<PackageReference Include="FluentValidation.AspNetCore" Version="9.2.0" /> <PackageReference Include="FluentValidation.AspNetCore" Version="9.2.0" />
<PackageReference Include="Npgsql" Version="5.0.13" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.3" />
<PackageReference Include="NPoco" Version="5.7.0" />
<PackageReference Include="NPOI" Version="2.6.0" />
<PackageReference Include="PuppeteerSharp" Version="10.0.0" />
<PackageReference Include="Serilog" Version="2.9.0" /> <PackageReference Include="Serilog" Version="2.9.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" /> <PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" /> <PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
...@@ -54,18 +82,16 @@ ...@@ -54,18 +82,16 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.5.1" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="5.5.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="5.6.3" /> <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="5.6.3" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" /> <PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
<PackageReference Include="Wkhtmltopdf.NetCore" Version="3.0.2" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Health.Infra\QueryPlatform.Infra.csproj" /> <ProjectReference Include="..\queryPlaform.Infra\QueryPlatform.Infra.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Infrastructure\Dtos\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Update="wwwroot\Health.Api.xml"> <Content Update="wwwroot\QueryPlatform.Api.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
......
namespace Spire.Doc
{
internal class DocumentSettings
{
}
}
\ No newline at end of file
using Autofac; using Autofac;
using FluentValidation.AspNetCore; using FluentValidation.AspNetCore;
using Health.Api.Infrastructure;
using Health.Api.Infrastructure.AutofacModules;
using Health.Api.Infrastructure.Filters;
using Health.Api.Infrastructure.Hubs;
using Health.Infra;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Diagnostics.HealthChecks;
...@@ -20,6 +15,11 @@ ...@@ -20,6 +15,11 @@
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using Newtonsoft.Json; using Newtonsoft.Json;
using QueryPlatform.Api.Infrastructure;
using QueryPlatform.Api.Infrastructure.AutofacModules;
using QueryPlatform.Api.Infrastructure.Filters;
using QueryPlatform.Api.Infrastructure.Hubs;
using QueryPlatform.Infra;
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Health.Api namespace QueryPlatform.Api
{ {
public class Startup public class Startup
{ {
...@@ -72,6 +72,7 @@ public void ConfigureServices(IServiceCollection services) ...@@ -72,6 +72,7 @@ public void ConfigureServices(IServiceCollection services)
.AddCustomJwtAuthentication(Configuration); .AddCustomJwtAuthentication(Configuration);
services.Configure<JwtOption>(Configuration.GetSection("JwtAuthorization")); services.Configure<JwtOption>(Configuration.GetSection("JwtAuthorization"));
//services.AddTransient<Microsoft.Extensions.Hosting.IHostedService, Job>();
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
...@@ -89,8 +90,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) ...@@ -89,8 +90,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseSwagger(); app.UseSwagger();
app.UseSwaggerUI(c => app.UseSwaggerUI(c =>
{ {
var swaggerEndpoint = Configuration.GetValue("SwaggerEndpoint", ""); var swaggerEndpolong = Configuration.GetValue("SwaggerEndpolong", "");
c.SwaggerEndpoint($"{swaggerEndpoint}/swagger/v1/swagger.json", "v1"); c.SwaggerEndpoint($"{swaggerEndpolong}/swagger/v1/swagger.json", "v1");
c.IndexStream = () => GetType().GetTypeInfo().Assembly.GetManifestResourceStream("QueryPlatform.Api.index.html"); c.IndexStream = () => GetType().GetTypeInfo().Assembly.GetManifestResourceStream("QueryPlatform.Api.index.html");
}); });
app.UseMiniProfiler(); app.UseMiniProfiler();
...@@ -107,14 +108,14 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) ...@@ -107,14 +108,14 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization(); app.UseAuthorization();
app.UseEndpoints(endpoints => app.UseEndpoints(endpolongs =>
{ {
endpoints.MapHealthChecks("/QueryPlatform", new HealthCheckOptions endpolongs.MapHealthChecks("/QueryPlatform", new HealthCheckOptions
{ {
ResponseWriter = HealthCheck.WriteResponse ResponseWriter = QueryPlatformCheck.WriteResponse
}); });
endpoints.MapControllers(); endpolongs.MapControllers();
endpoints.MapHub<NotificationHub>("/api/hubs/notification"); endpolongs.MapHub<NotificationHub>("/api/hubs/notification");
}); });
} }
} }
...@@ -221,7 +222,7 @@ public static IServiceCollection AddCustomSwagger(this IServiceCollection servic ...@@ -221,7 +222,7 @@ public static IServiceCollection AddCustomSwagger(this IServiceCollection servic
{ {
options.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); options.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
options.SwaggerDoc("v1", new OpenApiInfo { Version = "v1.1.0", Title = "API DOCUMENT" }); options.SwaggerDoc("v1", new OpenApiInfo { Version = "v1.1.0", Title = "API DOCUMENT" });
string[] xmls = new string[] { "Health.Api.xml" }; string[] xmls = new string[] { "QueryPlatform.Api.xml" };
foreach (var xml in xmls) foreach (var xml in xmls)
{ {
var xmlPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", xml); var xmlPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", xml);
...@@ -246,6 +247,11 @@ public static IServiceCollection AddCustomDbContext(this IServiceCollection serv ...@@ -246,6 +247,11 @@ public static IServiceCollection AddCustomDbContext(this IServiceCollection serv
// options.UseSqlServer(connectionString); // options.UseSqlServer(connectionString);
//}); //});
//services.AddDbContext<SearchContext>(options =>
//{
// options.UseNpgsql( )
// .UseLowerCaseNamingConvention();
//});
return services; return services;
} }
} }
......
...@@ -20,7 +20,10 @@ ...@@ -20,7 +20,10 @@
"Connection154": "Server=192.168.18.154;Database=DB_SV_Data_Config;User ID=sa;Password=Suvalue2016;Trusted_Connection=False;", "Connection154": "Server=192.168.18.154;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;", "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;"
} }
} }
<?xml version="1.0"?>
<doc>
<assembly>
<name>QueryPlatform.Api</name>
</assembly>
<members>
<member name="M:QueryPlatform.Api.Controllers.AccountController.Login(QueryPlatform.Api.Infrastructure.Request.LoginRequest)">
<summary>
登录授权
</summary>
<remarks>
Sample request:
POST /Todo
{
"Account": "admin",
"Password": "1111"
}
</remarks>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.AccountController.Refresh">
<summary>
刷新登录JWT TOKEN
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.AnalysisController.HosListInquire(System.long32,System.String,System.Nullable{System.long32})">
<summary>
医院展示
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.AnalysisController.ParseInquire(QueryPlatform.Api.Infrastructure.Modules.Sys_cs)">
<summary>
数据解析
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.AnalysisController.JxLx">
<summary>
下拉框
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.DemamdQuery(System.long32,System.String)">
<summary>
查询所有项目记录
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.DemamdQuery_(System.long32)">
<summary>
查询子表的记录
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.DemandAdd(SYS_Demand)">
<summary>
添加需求记录
</summary>
<param name="sYS_Demand"></param>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.DemandAddfu(SYS_DemandSublist)">
<summary>
添加子表数据
</summary>
<param name="sYS_DemandSublist"></param>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.ServersAdd(QueryPlatform.Api.Infrastructure.Modules.服务器)">
<summary>
添加服务器
</summary>
<param name="servers"></param>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.ServersShow">
<summary>
展示服务器
</summary>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.Funcadd(CommonlyUsed)">
<summary>
存储函数
</summary>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.Funca">
<summary>
存储函数展示
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.Executes(System.DateTime,System.DateTime)">
<summary>
查询记录导出
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.YiYuanShow">
<summary>
南海核对数据下拉框
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.YiYuanHeDui(System.long32,System.String)">
<summary>
单家医院核对数据
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.ExtractQuery(System.long32)">
<summary>
数据抽取登记展示列表
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.AddExtract(QueryPlatform.Api.Infrastructure.Modules.SYS_Extract)">
<summary>
数据抽取登记新增数据
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.Update(QueryPlatform.Api.Infrastructure.Modules.DataExtract)">
<summary>
数据抽取登记修改
</summary>
<param name=""></param>
<param name="dataExtract"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.SendMail(System.String,System.String,System.String)">
<summary>
邮箱推送
</summary>
<param name="title">邮箱标题</param>
<param name="content">内容</param>
<param name="zxr">推送人</param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ItemQuery(System.String,System.long32)">
<summary>
查询当月项目
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.CancelProject(System.long32)">
<summary>
取消正在查询项目
</summary>m
<param name="id">id </param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ProjectReport(QueryPlatform.Api.Infrastructure.Modules.SYS_Cs)">
<summary>
查询项目报告
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.QueryFlowDatabase(System.long32)">
<summary>
查询流水库表
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ShowMEDIC_AREA(System.long32,System.long32)">
<summary>
查询药品产地
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ShowITEM_NAME(System.long32,System.long32)">
<summary>
查询名称产地
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.EstablishFlowDatabaseTable(QueryPlatform.Api.Infrastructure.Modules.SYS_EstablishFlowDatabaseTable)">
<summary>
建立流水库表
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.CreateAFlow_Library(System.String,System.long32)">
<summary>
建立流水库
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ShowLog(System.long32,System.String)">
<summary>
查询日志
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.PullData(System.long32,System.String,System.String,System.String)">
<summary>
拉取流水库数据
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ZxrQuery">
<summary>
操作人展示
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.DateExplorationSql">
<summary>
可生成sql
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.DateExploration(System.long32,System.Collections.Generic.List{QueryPlatform.Api.Infrastructure.Modules.DateExploration})">
<summary>
生成sql
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Info">
<summary>
用户信息
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Update(QueryPlatform.Api.Infrastructure.Request.UserRequest)">
<summary>
用户修改
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Get(System.String)">
<summary>
查询用户列表
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Post(QueryPlatform.Api.Infrastructure.Request.UserRequest)">
<summary>
新增用户
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Delete(System.long32)">
<summary>
删除
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Disable(System.long32,System.Boolean)">
<summary>
禁用
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Reset(System.long32)">
<summary>
重置密码
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryController.Drugquery(QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery,System.String)">
/// <summary>
查询病人疾病信息和药品信息 type1=疾病 type2药品
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryController.化验检查query(System.long32,System.String,System.String[],System.long32,System.String,System.long32)">
/// <summary>
化验检查检索
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryController.DemandExploration(System.long32)">
<summary>
需求探索
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.AnalysisQueries.JX_zx(System.String,System.long32,System.long32,QueryPlatform.Api.Infrastructure.Modules.SYS_Hospital)">
<summary>
解析执行sql
</summary>
<param name="sql"></param>
<param name="hos_id"></param>
<param name="id"></param>
<param name="hos"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.AnalysisQueries.JX_zx_long(System.String,System.long32,System.long32,QueryPlatform.Api.Infrastructure.Modules.SYS_Hospital)">
<summary>
解析执行sql返回数字
</summary>
<param name="sql"></param>
<param name="hos_id"></param>
<param name="id"></param>
<param name="hos"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.AnalysisQueries.JX_SCJXJL(System.long32,System.String)">
<summary>
生成一条解析记录
</summary>
<param name="hos_id"></param>
<param name="czr"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.AnalysisQueries.JX_GXID(System.long32,System.long32)">
<summary>
更新id org_code m_index
</summary>
<param name="id"></param>
<param name="hos_id"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryQueries.showHospitals">
<summary>
查询所有医院
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryQueries.Complete_MarkId(System.long32)">
<summary>
获取到最大的那条记录Complete_MarkId
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryQueries.Countnum(System.String,System.Data.Common.DbConnection)">
<summary>
传入sql 连接 返回long
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryQueries.ASSAYREPORT(System.long32,System.long32,System.String)">
<summary>
化验切割
</summary>
<param name="index"></param>
<param name="id"></param>
<param name="item_name"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.FuncaQuery">
<summary>
存储函数展示
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.ServersConfiguration(QueryPlatform.Api.Infrastructure.Modules.服务器)">
<summary>
添加服务器
</summary>
<param name="servers"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.ServersShow">
<summary>
展示服务器
</summary>
<param name="servers"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.ExcelToDataTables(Microsoft.AspNetCore.Http.IFormFile)">
<summary>
将excel中多sheet表的数据导入到DataTable中
</summary>
<param name="file">文件名称</param>
<param name="WebRootPath">路径</param>
<param name="sheetnumber">excel工作薄sheet的位置</param>
<param name="isFirstRowColumn">第一行是否是DataTable的列名</param>
<returns>返回的DataTable</returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.ToJson(System.Data.DataTable)">
<summary>
Datatable转换为Json
</summary>
<param name="dt">Datatable对象</param>
<returns>Json字符串</returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.ItemQuery(System.String,System.long32)">
<summary>
查询所有项目
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.CancelProject(System.long32)">
<summary>
停止正在查询项目
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.deleteShow">
<summary>
删除MEDIC_PERSON_INFORMATION_存储过程表的记录
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.addShow(System.long32,System.String,System.String)">
<summary>
添加本次查询的记录到 MEDIC_PERSON_INFORMATION_存储过程表
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.ProjectReport(System.long32,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary>
报告展示(疾病展示所有,药品可以填写)
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.Show(System.long32,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary>
展示结果
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.EstablishFlowDatabaseTable(System.String,System.String,System.long32,System.String)">
<summary>
创建流水表
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.ShowLog(System.long32,System.String)">
<summary>
查询日志
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.QueryFlowDatabase(System.long32)">
<summary>
查询流水表
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.LOG(System.String,System.String,System.long32,System.String,System.String)">
<summary>
日志
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.ShowSql(System.String,System.long32)">
<summary>
sql查询
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.CreateAFlow_Library(System.String,System.long32)">
<summary>
创建流水库
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.PullData(System.long32,System.String,System.String,System.String,System.String)">
<summary>
拉取病人表
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.PullData(System.long32,System.String,System.String)">
<summary>
多线程拉取病人表
</summary>
<param name="tableName"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.UserStorage.Update(QueryPlatform.Api.Infrastructure.Request.UserRequest)">
<summary>
修改密码
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.UserStorage.Update(System.long32,System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
<summary>
修改用户信息
</summary>
<param name="userId"></param>
<param name="delete"></param>
<param name="reset"></param>
<returns></returns>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Domain.SearchPathInfo.TempPath">
<summary>
临时文件目录
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Domain.SearchPathInfo.NetworkPath">
<summary>
网络路径
</summary>
</member>
<member name="F:QueryPlatform.Api.Infrastructure.Enums.DiseaseType.g1">
<summary>
高血压
</summary>
</member>
<member name="F:QueryPlatform.Api.Infrastructure.Enums.DiseaseType.g2">
<summary>
糖尿病
</summary>
</member>
<member name="F:QueryPlatform.Api.Infrastructure.Enums.DiseaseType.g3">
<summary>
高血脂
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.JsonHelper.Serialize(System.Object)">
<summary>
将指定的 JSON 数据反序列化成指定对象。
</summary>
<typeparam name="T">对象类型。</typeparam>
<param name="json">JSON 数据。</param>
<returns></returns>
</member>
<member name="T:QueryPlatform.Api.Infrastructure.Middlewares.DecodeResponseMiddleware">
<summary>
解码中间件
</summary>
</member>
<member name="T:QueryPlatform.Api.Infrastructure.Middlewares.DoubleRequestMiddleware">
<summary>
解码中间件
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.DataExtract.START_TIME">
<summary>
开始时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.DataExtract.END_TIME">
<summary>
结束时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.DataExtract.REMARK">
<summary>
备注信息
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Extract.HOS_ID">
<summary>
医院编号
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Extract.SERVER">
<summary>
服务器
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Extract.NAME">
<summary>
数据库名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Extract.HOS_NAME">
<summary>
医院名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Extract.START_TIME">
<summary>
开始时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Extract.END_TIME">
<summary>
结束时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Extract.REMARK">
<summary>
备注信息
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Extract.Executor">
<summary>
执行人
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.type1_2">
<summary>
1 命中查询 2全部查询
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.icd">
<summary>
ICD编码
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.diseaseName">
<summary>
疾病名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.drugName">
<summary>
药品名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.materialName">
<summary>
材料名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.peojectName">
<summary>
项目名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_USER.IsDelete">
<summary>
true 删除 false 正常
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Page.Index">
<summary>
页码
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Page.Size">
<summary>
页行数 默认30
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Request.LoginRequest.Account">
<summary>
账号
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Request.LoginRequest.Password">
<summary>
密码
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.JwtResult.AccessToken">
<summary>
Access Token
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.JwtResult.TokenType">
<summary>
token 类型
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.JwtResult.AuthTime">
<summary>
授权时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.JwtResult.ExpiresAt">
<summary>
过期时间
</summary>
</member>
<member name="P:QueryPlatform.Api.ApiResponse`1.Message">
<summary>
消息内容。
</summary>
</member>
<member name="P:QueryPlatform.Api.ApiResponse`1.Data">
<summary>
返回数据。
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.OK">
<summary>
执行成功
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.BadRequest">
<summary>
参数错误
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.Unauthorized">
<summary>
身份认证未授权
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.NotFound">
<summary>
资源无效
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.longernalServerError">
<summary>
内部错误
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.NotImplemented">
<summary>
不支持请求
</summary>
</member>
<member name="P:SYS_Demand.ID">
<summary>
ID
</summary>
</member>
<member name="P:SYS_Demand.INDEXS">
<summary>
indexs
</summary>
</member>
<member name="P:SYS_Demand.Demand_Describe">
<summary>
需求描述
</summary>
</member>
<member name="P:SYS_Demand.Demand_Name">
<summary>
需求名称
</summary>
</member>
<member name="P:SYS_Demand.Demand_User">
<summary>
需求者
</summary>
</member>
<member name="P:SYS_DemandSublist.ID">
<summary>
ID
</summary>
</member>
<member name="P:SYS_DemandSublist.UserName">
<summary>
上传人
</summary>
</member>
<member name="P:SYS_DemandSublist.remark">
<summary>
备注
</summary>
</member>
<member name="P:CommonlyUsed.Name">
<summary>
名称
</summary>
</member>
<member name="P:CommonlyUsed.value">
<summary>
函数内容
</summary>
</member>
<member name="P:CommonlyUsed.remarks">
<summary>
备注
</summary>
</member>
</members>
</doc>
<?xml version="1.0"?>
<doc>
<assembly>
<name>QueryPlatform.Api</name>
</assembly>
<members>
<member name="M:QueryPlatform.Api.Controllers.AccountController.Login(QueryPlatform.Api.Infrastructure.Request.LoginRequest)">
<summary>
登录授权
</summary>
<remarks>
Sample request:
POST /Todo
{
"Account": "admin",
"Password": "1111"
}
</remarks>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.AccountController.Refresh">
<summary>
刷新登录JWT TOKEN
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.AnalysisController.HosListInquire(System.long32,System.String,System.Nullable{System.long32})">
<summary>
医院展示
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.AnalysisController.ParseInquire(QueryPlatform.Api.Infrastructure.Modules.Sys_cs)">
<summary>
数据解析
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.AnalysisController.JxLx">
<summary>
下拉框
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.DemamdQuery(System.long32,System.String)">
<summary>
查询所有项目记录
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.DemamdQuery_(System.long32)">
<summary>
查询子表的记录
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.DemandAdd(QueryPlatform.Api.Infrastructure.Modules.SYS_DEMAND)">
<summary>
添加需求记录
</summary>
<param name="sYS_Demand"></param>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.DemandAddfu(QueryPlatform.Api.Infrastructure.Modules.SYS_DEMANDSUBLIS)">
<summary>
添加子表数据
</summary>
<param name="sYS_DemandSublist"></param>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.ServersAdd(QueryPlatform.Api.Infrastructure.Modules.服务器)">
<summary>
添加服务器
</summary>
<param name="servers"></param>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.ServersShow">
<summary>
展示服务器
</summary>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.Funcadd(QueryPlatform.Api.Infrastructure.Modules.COMMONLYUSED)">
<summary>
存储函数
</summary>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.Funca">
<summary>
存储函数展示
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.Executes(System.DateTime,System.DateTime)">
<summary>
查询记录导出
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.YiYuanShow">
<summary>
南海核对数据下拉框
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.YiYuanHeDui(System.long32,System.String)">
<summary>
单家医院核对数据
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.ExtractQuery(System.long32)">
<summary>
数据抽取登记展示列表
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.AddExtract(QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT)">
<summary>
数据抽取登记新增数据
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.Update(QueryPlatform.Api.Infrastructure.Modules.DATAEXTRACT)">
<summary>
数据抽取登记修改
</summary>
<param name=""></param>
<param name="dataExtract"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.SendMail(System.String,System.String,System.String)">
<summary>
邮箱推送
</summary>
<param name="title">邮箱标题</param>
<param name="content">内容</param>
<param name="zxr">推送人</param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ItemQuery(System.String,System.long32)">
<summary>
查询当月项目
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.CancelProject(System.long32)">
<summary>
取消正在查询项目
</summary>m
<param name="id">id </param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ProjectReport(QueryPlatform.Api.Infrastructure.Modules.SYS_Cs)">
<summary>
查询项目报告
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.QueryFlowDatabase(System.long32)">
<summary>
查询流水库表
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ShowMEDIC_AREA(System.long32,System.long32)">
<summary>
查询药品产地
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ShowITEM_NAME(System.long32,System.long32)">
<summary>
查询名称产地
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.EstablishFlowDatabaseTable(QueryPlatform.Api.Infrastructure.Modules.SYS_EstablishFlowDatabaseTable)">
<summary>
建立流水库表
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.CreateAFlow_Library(System.String,System.long32)">
<summary>
建立流水库
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ShowLog(System.long32,System.String)">
<summary>
查询日志
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.PullData(System.long32,System.String,System.String,System.String)">
<summary>
拉取流水库数据
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ZxrQuery">
<summary>
操作人展示
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.DateExplorationSql">
<summary>
可生成sql
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.DateExploration(System.long32,System.Collections.Generic.List{QueryPlatform.Api.Infrastructure.Modules.DateExploration})">
<summary>
生成sql
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Info">
<summary>
用户信息
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Update(QueryPlatform.Api.Infrastructure.Request.UserRequest)">
<summary>
用户修改
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Get(System.String)">
<summary>
查询用户列表
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Post(QueryPlatform.Api.Infrastructure.Request.UserRequest)">
<summary>
新增用户
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Delete(System.long32)">
<summary>
删除
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Disable(System.long32,System.Boolean)">
<summary>
禁用
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Reset(System.long32)">
<summary>
重置密码
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryController.Drugquery(QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery,System.String)">
/// <summary>
查询病人疾病信息和药品信息 type1=疾病 type2药品
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryController.化验检查query(System.long32,System.String,System.String[],System.long32,System.String,System.long32)">
/// <summary>
化验检查检索
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryController.DemandExploration(System.long32)">
<summary>
需求探索
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.AnalysisQueries.JX_zx(System.String,System.long32,System.long32,QueryPlatform.Api.Infrastructure.Modules.SYS_Hospital)">
<summary>
解析执行sql
</summary>
<param name="sql"></param>
<param name="hos_id"></param>
<param name="id"></param>
<param name="hos"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.AnalysisQueries.JX_zx_long(System.String,System.long32,System.long32,QueryPlatform.Api.Infrastructure.Modules.SYS_Hospital)">
<summary>
解析执行sql返回数字
</summary>
<param name="sql"></param>
<param name="hos_id"></param>
<param name="id"></param>
<param name="hos"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.AnalysisQueries.JX_SCJXJL(System.long32,System.String)">
<summary>
生成一条解析记录
</summary>
<param name="hos_id"></param>
<param name="czr"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.AnalysisQueries.JX_GXID(System.long32,System.long32)">
<summary>
更新id org_code m_index
</summary>
<param name="id"></param>
<param name="hos_id"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryQueries.showHospitals">
<summary>
查询所有医院
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryQueries.Complete_MarkId(System.long32)">
<summary>
获取到最大的那条记录Complete_MarkId
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryQueries.Countnum(System.String,System.Data.Common.DbConnection)">
<summary>
传入sql 连接 返回long
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryQueries.ASSAYREPORT(System.long32,System.long32,System.String)">
<summary>
化验切割
</summary>
<param name="index"></param>
<param name="id"></param>
<param name="item_name"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.FuncaQuery">
<summary>
存储函数展示
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.ServersConfiguration(QueryPlatform.Api.Infrastructure.Modules.服务器)">
<summary>
添加服务器
</summary>
<param name="servers"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.ServersShow">
<summary>
展示服务器
</summary>
<param name="servers"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.ExcelToDataTables(Microsoft.AspNetCore.Http.IFormFile)">
<summary>
将excel中多sheet表的数据导入到DataTable中
</summary>
<param name="file">文件名称</param>
<param name="WebRootPath">路径</param>
<param name="sheetnumber">excel工作薄sheet的位置</param>
<param name="isFirstRowColumn">第一行是否是DataTable的列名</param>
<returns>返回的DataTable</returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.ToJson(System.Data.DataTable)">
<summary>
Datatable转换为Json
</summary>
<param name="dt">Datatable对象</param>
<returns>Json字符串</returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.ItemQuery(System.String,System.long32)">
<summary>
查询所有项目
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.CancelProject(System.long32)">
<summary>
停止正在查询项目
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.deleteShow">
<summary>
删除MEDIC_PERSON_INFORMATION_存储过程表的记录
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.addShow(System.long32,System.String,System.String)">
<summary>
添加本次查询的记录到 MEDIC_PERSON_INFORMATION_存储过程表
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.ProjectReport(System.long32,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary>
报告展示(疾病展示所有,药品可以填写)
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.Show(System.long32,System.String,System.String,System.String,System.String,System.String,System.String)">
<summary>
展示结果
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.EstablishFlowDatabaseTable(System.String,System.String,System.long32,System.String)">
<summary>
创建流水表
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.ShowLog(System.long32,System.String)">
<summary>
查询日志
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.QueryFlowDatabase(System.long32)">
<summary>
查询流水表
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.LOG(System.String,System.String,System.long32,System.String,System.String)">
<summary>
日志
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.ShowSql(System.String,System.long32)">
<summary>
sql查询
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.CreateAFlow_Library(System.String,System.long32)">
<summary>
创建流水库
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.PullData(System.long32,System.String,System.String,System.String,System.String)">
<summary>
拉取病人表
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.PullData(System.long32,System.String,System.String)">
<summary>
多线程拉取病人表
</summary>
<param name="tableName"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.UserStorage.Update(QueryPlatform.Api.Infrastructure.Request.UserRequest)">
<summary>
修改密码
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.UserStorage.Update(System.long32,System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
<summary>
修改用户信息
</summary>
<param name="userId"></param>
<param name="delete"></param>
<param name="reset"></param>
<returns></returns>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Domain.SearchPathInfo.TempPath">
<summary>
临时文件目录
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Domain.SearchPathInfo.NetworkPath">
<summary>
网络路径
</summary>
</member>
<member name="F:QueryPlatform.Api.Infrastructure.Enums.DiseaseType.g1">
<summary>
高血压
</summary>
</member>
<member name="F:QueryPlatform.Api.Infrastructure.Enums.DiseaseType.g2">
<summary>
糖尿病
</summary>
</member>
<member name="F:QueryPlatform.Api.Infrastructure.Enums.DiseaseType.g3">
<summary>
高血脂
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.JsonHelper.Serialize(System.Object)">
<summary>
将指定的 JSON 数据反序列化成指定对象。
</summary>
<typeparam name="T">对象类型。</typeparam>
<param name="json">JSON 数据。</param>
<returns></returns>
</member>
<member name="T:QueryPlatform.Api.Infrastructure.Middlewares.DecodeResponseMiddleware">
<summary>
解码中间件
</summary>
</member>
<member name="T:QueryPlatform.Api.Infrastructure.Middlewares.DoubleRequestMiddleware">
<summary>
解码中间件
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMAND.ID">
<summary>
ID
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMAND.INDEXS">
<summary>
indexs
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMAND.Demand_Describe">
<summary>
需求描述
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMAND.Demand_Name">
<summary>
需求名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMAND.Demand_User">
<summary>
需求者
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMANDSUBLIS.ID">
<summary>
ID
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMANDSUBLIS.UserName">
<summary>
上传人
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMANDSUBLIS.remark">
<summary>
备注
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.COMMONLYUSED.Name">
<summary>
名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.COMMONLYUSED.value">
<summary>
函数内容
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.COMMONLYUSED.remarks">
<summary>
备注
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.DATAEXTRACT.START_TIME">
<summary>
开始时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.DATAEXTRACT.END_TIME">
<summary>
结束时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.DATAEXTRACT.REMARK">
<summary>
备注信息
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.HOS_ID">
<summary>
医院编号
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.SERVER">
<summary>
服务器
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.NAME">
<summary>
数据库名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.HOS_NAME">
<summary>
医院名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.START_TIME">
<summary>
开始时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.END_TIME">
<summary>
结束时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.REMARK">
<summary>
备注信息
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.Executor">
<summary>
执行人
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.type1_2">
<summary>
1 命中查询 2全部查询
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.icd">
<summary>
ICD编码
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.diseaseName">
<summary>
疾病名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.drugName">
<summary>
药品名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.materialName">
<summary>
材料名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.peojectName">
<summary>
项目名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_USER.IsDelete">
<summary>
true 删除 false 正常
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Page.Index">
<summary>
页码
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Page.Size">
<summary>
页行数 默认30
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Request.LoginRequest.Account">
<summary>
账号
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Request.LoginRequest.Password">
<summary>
密码
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.JwtResult.AccessToken">
<summary>
Access Token
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.JwtResult.TokenType">
<summary>
token 类型
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.JwtResult.AuthTime">
<summary>
授权时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.JwtResult.ExpiresAt">
<summary>
过期时间
</summary>
</member>
<member name="P:QueryPlatform.Api.ApiResponse`1.Message">
<summary>
消息内容。
</summary>
</member>
<member name="P:QueryPlatform.Api.ApiResponse`1.Data">
<summary>
返回数据。
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.OK">
<summary>
执行成功
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.BadRequest">
<summary>
参数错误
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.Unauthorized">
<summary>
身份认证未授权
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.NotFound">
<summary>
资源无效
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.longernalServerError">
<summary>
内部错误
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.NotImplemented">
<summary>
不支持请求
</summary>
</member>
</members>
</doc>
<?xml version="1.0"?>
<doc>
<assembly>
<name>QueryPlatform.Api</name>
</assembly>
<members>
<member name="M:QueryPlatform.Api.Controllers.AccountController.Login(QueryPlatform.Api.Infrastructure.Request.LoginRequest)">
<summary>
登录授权
</summary>
<remarks>
Sample request:
POST /Todo
{
"Account": "admin",
"Password": "1111"
}
</remarks>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.AccountController.Refresh">
<summary>
刷新登录JWT TOKEN
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.AnalysisController.HosListInquire(System.Int32,System.String,System.Nullable{System.Int32})">
<summary>
医院展示
</summary>
<returns></returns>
</member>
<member name="F:QueryPlatform.Api.Controllers.AnalysisController.semaphore">
<summary>
数据解析
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.AnalysisController.JxLx">
<summary>
下拉框
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.DemamdQuery(System.Int64,System.String)">
<summary>
查询所有项目记录
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.DemamdQuery_(System.Int32)">
<summary>
查询子表的记录
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.DemandAdd(QueryPlatform.Api.Infrastructure.Modules.SYS_DEMAND)">
<summary>
添加需求记录
</summary>
<param name="sYS_Demand"></param>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.DemandAddfu(QueryPlatform.Api.Infrastructure.Modules.SYS_DEMANDSUBLIS)">
<summary>
添加子表数据
</summary>
<param name="sYS_DemandSublist"></param>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.ServersAdd(QueryPlatform.Api.Infrastructure.Modules.服务器)">
<summary>
添加服务器
</summary>
<param name="servers"></param>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.ServersShow">
<summary>
展示服务器
</summary>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.Funcadd(QueryPlatform.Api.Infrastructure.Modules.COMMONLYUSED)">
<summary>
存储函数
</summary>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.Funca">
<summary>
存储函数展示
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.Executes(System.DateTime,System.DateTime)">
<summary>
查询记录导出
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.YiYuanShow">
<summary>
南海核对数据下拉框
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.YiYuanHeDui(System.Int64,System.String)">
<summary>
单家医院核对数据
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.ExtractQuery(System.Int64)">
<summary>
数据抽取登记展示列表
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.AddExtract(QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT)">
<summary>
数据抽取登记新增数据
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.Update(QueryPlatform.Api.Infrastructure.Modules.DATAEXTRACT)">
<summary>
数据抽取登记修改
</summary>
<param name=""></param>
<param name="dataExtract"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.HomeController.SendMail(System.String,System.String,System.String)">
<summary>
邮箱推送
</summary>
<param name="title">邮箱标题</param>
<param name="content">内容</param>
<param name="zxr">推送人</param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ItemQuery(System.String,System.Int64)">
<summary>
查询当月项目
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.CancelProject(System.Int32)">
<summary>
取消正在查询项目
</summary>m
<param name="id">id </param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ProjectReport(QueryPlatform.Api.Infrastructure.Modules.SYS_Cs)">
<summary>
查询项目报告
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.DownloadFileAsync(QueryPlatform.Api.Infrastructure.Modules.SYS_Cs)">
<summary>
下载项目报告
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.QueryFlowDatabase(System.Int64)">
<summary>
查询流水库表
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ShowMEDIC_AREA(System.Int32)">
<summary>
查询药品产地
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ShowITEM_NAME(System.Int32)">
<summary>
查询名称产地
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.EstablishFlowDatabaseTable(QueryPlatform.Api.Infrastructure.Modules.SYS_EstablishFlowDatabaseTable)">
<summary>
建立流水库表
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.CreateAFlow_Library(System.String,System.Int64)">
<summary>
建立流水库
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ShowLog(System.Int64,System.String)">
<summary>
查询日志
</summary>
<returns></returns>
</member>
<member name="F:QueryPlatform.Api.Controllers.ResourceController.semaphore">
<summary>
拉取流水库数据
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.ZxrQuery">
<summary>
操作人展示
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.DateExplorationSql">
<summary>
可生成sql
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.ResourceController.DateExploration(System.Int32,System.Collections.Generic.List{QueryPlatform.Api.Infrastructure.Modules.DateExploration})">
<summary>
生成sql
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Info">
<summary>
用户信息
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Update(QueryPlatform.Api.Infrastructure.Request.UserRequest)">
<summary>
用户修改
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Get(System.String)">
<summary>
查询用户列表
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Post(QueryPlatform.Api.Infrastructure.Request.UserRequest)">
<summary>
新增用户
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Delete(System.Int32)">
<summary>
删除
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Disable(System.Int32,System.Boolean)">
<summary>
禁用
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Controllers.UserController.Reset(System.Int32)">
<summary>
重置密码
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="F:QueryPlatform.Api.Infrastructure.Queries.DrugqueryController.semaphore">
/// <summary>
查询病人疾病信息和药品信息 type1=疾病 type2药品
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryController.化验检查query(System.Int32,System.String,System.String[],System.Int32,System.String,System.Int32)">
/// <summary>
化验检查检索
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryController.DemandExploration(System.Int32)">
<summary>
需求探索
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.AnalysisQueries.JX_zx(System.String,System.Int32,System.Int32,QueryPlatform.Api.Infrastructure.Modules.SYS_Hospital)">
<summary>
解析执行sql
</summary>
<param name="sql"></param>
<param name="hos_id"></param>
<param name="id"></param>
<param name="hos"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.AnalysisQueries.JX_zx_int(System.String,System.Int32,System.Int32,QueryPlatform.Api.Infrastructure.Modules.SYS_Hospital)">
<summary>
解析执行sql返回数字
</summary>
<param name="sql"></param>
<param name="hos_id"></param>
<param name="id"></param>
<param name="hos"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.AnalysisQueries.JX_SCJXJL(System.Int32,System.String)">
<summary>
生成一条解析记录
</summary>
<param name="hos_id"></param>
<param name="czr"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.AnalysisQueries.JX_MR(System.Int32,System.Int32)">
<summary>
默认
</summary>
<param name="id"></param>
<param name="hos_id"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.AnalysisQueries.JX_GXID(System.Int32,System.Int32)">
<summary>
更新id org_code m_index
</summary>
<param name="id"></param>
<param name="hos_id"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryQueries.showHospitals">
<summary>
查询所有医院
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryQueries.Complete_MarkId(System.Int64)">
<summary>
获取到最大的那条记录Complete_MarkId
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryQueries.Countnum(System.String,System.Data.Common.DbConnection)">
<summary>
传入sql 连接 返回long
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.DrugqueryQueries.ASSAYREPORT(System.Int64,System.Int32,System.String)">
<summary>
化验切割
</summary>
<param name="index"></param>
<param name="id"></param>
<param name="item_name"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.FuncaQuery">
<summary>
存储函数展示
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.ServersConfiguration(QueryPlatform.Api.Infrastructure.Modules.服务器)">
<summary>
添加服务器
</summary>
<param name="servers"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.ServersShow">
<summary>
展示服务器
</summary>
<param name="servers"></param>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.ExcelToDataTables(Microsoft.AspNetCore.Http.IFormFile)">
<summary>
将excel中多sheet表的数据导入到DataTable中
</summary>
<param name="file">文件名称</param>
<param name="WebRootPath">路径</param>
<param name="sheetnumber">excel工作薄sheet的位置</param>
<param name="isFirstRowColumn">第一行是否是DataTable的列名</param>
<returns>返回的DataTable</returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.HomeQueries.ToJson(System.Data.DataTable)">
<summary>
Datatable转换为Json
</summary>
<param name="dt">Datatable对象</param>
<returns>Json字符串</returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.ItemQuery(System.String,System.Int64)">
<summary>
查询所有项目
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.CancelProject(System.Int32)">
<summary>
停止正在查询项目
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.HtmlToWord(System.String,System.String)">
<summary>
/
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.EstablishFlowDatabaseTable(System.String,System.String,System.Int32,System.String)">
<summary>
创建流水表
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.ShowLog(System.Int64,System.String)">
<summary>
查询日志
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.QueryFlowDatabase(System.Int64)">
<summary>
查询流水表
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.LOG(System.String,System.String,System.Int64,System.String,System.String)">
<summary>
日志
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.ShowSql(System.String,System.Int64)">
<summary>
sql查询
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.CreateAFlow_Library(System.String,System.Int64)">
<summary>
创建流水库
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.PullData(System.Int64,System.String,System.String,System.String,System.String)">
<summary>
拉取病人表
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.PullData(System.Int64,System.String,System.String)">
<summary>
多线程拉取病人表
</summary>
<param name="indexs"></param>
<param name="DatabaseName"></param>
<param name="tableName"></param>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.UserStorage.Update(QueryPlatform.Api.Infrastructure.Request.UserRequest)">
<summary>
修改密码
</summary>
<returns></returns>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.Queries.UserStorage.Update(System.Int64,System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
<summary>
修改用户信息
</summary>
<param name="userId"></param>
<param name="delete"></param>
<param name="reset"></param>
<returns></returns>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Domain.SearchPathInfo.TempPath">
<summary>
临时文件目录
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Domain.SearchPathInfo.NetworkPath">
<summary>
网络路径
</summary>
</member>
<member name="F:QueryPlatform.Api.Infrastructure.Enums.DiseaseType.g1">
<summary>
高血压
</summary>
</member>
<member name="F:QueryPlatform.Api.Infrastructure.Enums.DiseaseType.g2">
<summary>
糖尿病
</summary>
</member>
<member name="F:QueryPlatform.Api.Infrastructure.Enums.DiseaseType.g3">
<summary>
高血脂
</summary>
</member>
<member name="M:QueryPlatform.Api.Infrastructure.JsonHelper.Serialize(System.Object)">
<summary>
将指定的 JSON 数据反序列化成指定对象。
</summary>
<typeparam name="T">对象类型。</typeparam>
<param name="json">JSON 数据。</param>
<returns></returns>
</member>
<member name="T:QueryPlatform.Api.Infrastructure.Middlewares.DecodeResponseMiddleware">
<summary>
解码中间件
</summary>
</member>
<member name="T:QueryPlatform.Api.Infrastructure.Middlewares.DoubleRequestMiddleware">
<summary>
解码中间件
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMAND.id">
<summary>
ID
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMAND.INDEXS">
<summary>
indexs
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMAND.Demand_Describe">
<summary>
需求描述
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMAND.Demand_Name">
<summary>
需求名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMAND.Demand_User">
<summary>
需求者
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMANDSUBLIS.id">
<summary>
ID
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMANDSUBLIS.UserName">
<summary>
上传人
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_DEMANDSUBLIS.remark">
<summary>
备注
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.COMMONLYUSED.Name">
<summary>
名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.COMMONLYUSED.value">
<summary>
函数内容
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.COMMONLYUSED.remarks">
<summary>
备注
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.DATAEXTRACT.START_TIME">
<summary>
开始时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.DATAEXTRACT.END_TIME">
<summary>
结束时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.DATAEXTRACT.REMARK">
<summary>
备注信息
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.HOS_ID">
<summary>
医院编号
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.SERVER">
<summary>
服务器
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.NAME">
<summary>
数据库名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.HOS_NAME">
<summary>
医院名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.START_TIME">
<summary>
开始时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.END_TIME">
<summary>
结束时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.REMARK">
<summary>
备注信息
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_EXTRACT.Executor">
<summary>
执行人
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.type1_2">
<summary>
1 命中查询 2全部查询
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.icd">
<summary>
ICD编码
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.diseaseName">
<summary>
疾病名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.drugName">
<summary>
药品名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.materialName">
<summary>
材料名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_Drugquery.peojectName">
<summary>
项目名称
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_USER.IsDelete">
<summary>
true 删除 false 正常
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Page.Index">
<summary>
页码
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Page.Size">
<summary>
页行数 默认30
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Request.LoginRequest.Account">
<summary>
账号
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.Request.LoginRequest.Password">
<summary>
密码
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.JwtResult.AccessToken">
<summary>
Access Token
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.JwtResult.TokenType">
<summary>
token 类型
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.JwtResult.AuthTime">
<summary>
授权时间
</summary>
</member>
<member name="P:QueryPlatform.Api.Infrastructure.JwtResult.ExpiresAt">
<summary>
过期时间
</summary>
</member>
<member name="P:QueryPlatform.Api.ApiResponse`1.Message">
<summary>
消息内容。
</summary>
</member>
<member name="P:QueryPlatform.Api.ApiResponse`1.Data">
<summary>
返回数据。
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.OK">
<summary>
执行成功
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.BadRequest">
<summary>
参数错误
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.Unauthorized">
<summary>
身份认证未授权
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.NotFound">
<summary>
资源无效
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.longernalServerError">
<summary>
内部错误
</summary>
</member>
<member name="F:QueryPlatform.Api.ResponseType.NotImplemented">
<summary>
不支持请求
</summary>
</member>
</members>
</doc>
<?xml version="1.0"?> <?xml version="1.0"?>
<doc> <doc>
<assembly> <assembly>
<name>Health.Api</name> <name>QueryPlatform.Api</name>
</assembly> </assembly>
<members> <members>
<member name="M:Health.Api.Controllers.AccountController.Login(Health.Api.Infrastructure.Request.LoginRequest)"> <member name="M:QueryPlatform.Api.Controllers.AccountController.Login(QueryPlatform.Api.Infrastructure.Request.LoginRequest)">
<summary> <summary>
登录授权 登录授权
</summary> </summary>
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
</remarks> </remarks>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.AccountController.Refresh"> <member name="M:QueryPlatform.Api.Controllers.AccountController.Refresh">
<summary> <summary>
刷新登录JWT TOKEN 刷新登录JWT TOKEN
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.OverviewController.Collect(System.String,System.String)"> <member name="M:QueryPlatform.Api.Controllers.OverviewController.Collect(System.String,System.String)">
<summary> <summary>
人次汇总 人次汇总
</summary> </summary>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param> <param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.OverviewController.Age(System.String,System.String)"> <member name="M:QueryPlatform.Api.Controllers.OverviewController.Age(System.String,System.String)">
<summary> <summary>
年龄分布 年龄分布
</summary> </summary>
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param> <param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.OverviewController.Gender(System.String,System.String)"> <member name="M:QueryPlatform.Api.Controllers.OverviewController.Gender(System.String,System.String)">
<summary> <summary>
性别分布 性别分布
</summary> </summary>
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param> <param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.OverviewController.InpatDiag(System.String,System.String)"> <member name="M:QueryPlatform.Api.Controllers.OverviewController.InpatDiag(System.String,System.String)">
<summary> <summary>
住院诊断分布 住院诊断分布
</summary> </summary>
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param> <param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.OverviewController.OutDiag(System.String,System.String)"> <member name="M:QueryPlatform.Api.Controllers.OverviewController.OutDiag(System.String,System.String)">
<summary> <summary>
门诊诊断分布 门诊诊断分布
</summary> </summary>
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param> <param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.OverviewController.InpatDrug(System.String,System.String)"> <member name="M:QueryPlatform.Api.Controllers.OverviewController.InpatDrug(System.String,System.String)">
<summary> <summary>
住院药品分布 住院药品分布
</summary> </summary>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param> <param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.OverviewController.OutDrug(System.String,System.String)"> <member name="M:QueryPlatform.Api.Controllers.OverviewController.OutDrug(System.String,System.String)">
<summary> <summary>
门诊药品分布 门诊药品分布
</summary> </summary>
...@@ -82,41 +82,41 @@ ...@@ -82,41 +82,41 @@
<param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param> <param name="endTime">结束时间 格式 "yyyyMM", "yyyy-MM" </param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.ResourceController.GetCondition(System.String)"> <member name="M:QueryPlatform.Api.Controllers.ResourceController.GetCondition(System.String)">
<summary> <summary>
筛选条件 筛选条件
</summary> </summary>
<param name="source">门诊 住院</param> <param name="source">门诊 住院</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.ResourceController.GetOperator"> <member name="M:QueryPlatform.Api.Controllers.ResourceController.GetOperator">
<summary> <summary>
Sql 查询操作符 Sql 查询操作符
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.ResourceController.GetATC(System.String)"> <member name="M:QueryPlatform.Api.Controllers.ResourceController.GetATC(System.String)">
<summary> <summary>
ATC树 ATC树
</summary> </summary>
<param name="source">门诊 住院</param> <param name="source">门诊 住院</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.ResourceController.GetICD(System.String)"> <member name="M:QueryPlatform.Api.Controllers.ResourceController.GetICD(System.String)">
<summary> <summary>
ICD树 ICD树
</summary> </summary>
<param name="source">门诊 住院</param> <param name="source">门诊 住院</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.SearchController.GetSearch(Health.Api.Infrastructure.Request.SearchQuery)"> <member name="M:QueryPlatform.Api.Controllers.SearchController.GetSearch(QueryPlatform.Api.Infrastructure.Request.SearchQuery)">
<summary> <summary>
检索记录 检索记录
</summary> </summary>
<param name="query">查询条件</param> <param name="query">查询条件</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.SearchController.Add(Health.Api.Infrastructure.Request.SearchRequest)"> <member name="M:QueryPlatform.Api.Controllers.SearchController.Add(QueryPlatform.Api.Infrastructure.Request.SearchRequest)">
<summary> <summary>
新增检索记录 新增检索记录
</summary> </summary>
...@@ -156,14 +156,14 @@ ...@@ -156,14 +156,14 @@
</remarks> </remarks>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.SearchController.Delete(System.Int32)"> <member name="M:QueryPlatform.Api.Controllers.SearchController.Delete(System.long32)">
<summary> <summary>
删除检索记录 删除检索记录
</summary> </summary>
<param name="searchId">SearchId</param> <param name="searchId">SearchId</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.SearchController.Export(Health.Api.Infrastructure.Request.ExportRequest)"> <member name="M:QueryPlatform.Api.Controllers.SearchController.Export(QueryPlatform.Api.Infrastructure.Request.ExportRequest)">
<summary> <summary>
导出文件 导出文件
</summary> </summary>
...@@ -179,341 +179,341 @@ ...@@ -179,341 +179,341 @@
</remarks> </remarks>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.UserController.Info"> <member name="M:QueryPlatform.Api.Controllers.UserController.Info">
<summary> <summary>
用户信息 用户信息
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.UserController.Password(Health.Api.Infrastructure.Request.PasswordRequest)"> <member name="M:QueryPlatform.Api.Controllers.UserController.Password(QueryPlatform.Api.Infrastructure.Request.PasswordRequest)">
<summary> <summary>
用户修改密码 用户修改密码
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.UserController.Get"> <member name="M:QueryPlatform.Api.Controllers.UserController.Get">
<summary> <summary>
查询用户列表 查询用户列表
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.UserController.Post(Health.Api.Infrastructure.Request.UserRequest)"> <member name="M:QueryPlatform.Api.Controllers.UserController.Post(QueryPlatform.Api.Infrastructure.Request.UserRequest)">
<summary> <summary>
新增用户 新增用户
</summary> </summary>
<param name="request"></param> <param name="request"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.UserController.Delete(System.Int32)"> <member name="M:QueryPlatform.Api.Controllers.UserController.Delete(System.long32)">
<summary> <summary>
删除用户 删除用户
</summary> </summary>
<param name="userId"></param> <param name="userId"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Controllers.UserController.Reset(System.Int32)"> <member name="M:QueryPlatform.Api.Controllers.UserController.Reset(System.long32)">
<summary> <summary>
重置密码 重置密码
</summary> </summary>
<param name="userId"></param> <param name="userId"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:Health.Api.Infrastructure.Builder.AtcInpatBuilder"> <member name="T:QueryPlatform.Api.Infrastructure.Builder.AtcInpatBuilder">
<summary> <summary>
ATC 住院建造器 ATC 住院建造器
</summary> </summary>
</member> </member>
<member name="T:Health.Api.Infrastructure.Builder.AtcOutBuilder"> <member name="T:QueryPlatform.Api.Infrastructure.Builder.AtcOutBuilder">
<summary> <summary>
ATC 门诊建造器 ATC 门诊建造器
</summary> </summary>
</member> </member>
<member name="T:Health.Api.Infrastructure.Builder.IcdInpatBuilder"> <member name="T:QueryPlatform.Api.Infrastructure.Builder.IcdInpatBuilder">
<summary> <summary>
ICD 住院建造器 ICD 住院建造器
</summary> </summary>
</member> </member>
<member name="T:Health.Api.Infrastructure.Builder.IcdOutBuilder"> <member name="T:QueryPlatform.Api.Infrastructure.Builder.IcdOutBuilder">
<summary> <summary>
ICD 门诊建造器 ICD 门诊建造器
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Builder.SqlScriptBuilder.TableStruct"> <member name="P:QueryPlatform.Api.Infrastructure.Builder.SqlScriptBuilder.TableStruct">
<summary> <summary>
表结构 表结构
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Builder.SqlScriptBuilder.Conditions"> <member name="P:QueryPlatform.Api.Infrastructure.Builder.SqlScriptBuilder.Conditions">
<summary> <summary>
过滤条件 过滤条件
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Builder.SqlScriptBuilder.Codes"> <member name="P:QueryPlatform.Api.Infrastructure.Builder.SqlScriptBuilder.Codes">
<summary> <summary>
查询ICD/ATC编码 查询ICD/ATC编码
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Builder.SqlScriptBuilder.Attach"> <member name="P:QueryPlatform.Api.Infrastructure.Builder.SqlScriptBuilder.Attach">
<summary> <summary>
附带查询其他数据 附带查询其他数据
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Builder.SqlScriptBuilder.PrimaryTable"> <member name="P:QueryPlatform.Api.Infrastructure.Builder.SqlScriptBuilder.PrimaryTable">
<summary> <summary>
ICD/ATC编码 过滤主表 ICD/ATC编码 过滤主表
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Builder.SqlScriptBuilder.TableNames"> <member name="P:QueryPlatform.Api.Infrastructure.Builder.SqlScriptBuilder.TableNames">
<summary> <summary>
导出表名称 导出表名称
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Builder.SqlScriptBuilder.AttachTableNames"> <member name="P:QueryPlatform.Api.Infrastructure.Builder.SqlScriptBuilder.AttachTableNames">
<summary> <summary>
导出其他数据表名称 导出其他数据表名称
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Builder.SqlScriptBuilder.AttachPrimaryTable"> <member name="P:QueryPlatform.Api.Infrastructure.Builder.SqlScriptBuilder.AttachPrimaryTable">
<summary> <summary>
导出其他数据关联表主表名称 导出其他数据关联表主表名称
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Builder.SqlScriptBuilder.BuildBeforeScript(System.String)"> <member name="M:QueryPlatform.Api.Infrastructure.Builder.SqlScriptBuilder.BuildBeforeScript(System.String)">
<summary> <summary>
准备临时数据 准备临时数据
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Infrastructure.Builder.SqlScriptBuilder.BuildScript(System.String,System.String)"> <member name="M:QueryPlatform.Api.Infrastructure.Builder.SqlScriptBuilder.BuildScript(System.String,System.String)">
<summary> <summary>
构建导出语句 构建导出语句
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Infrastructure.Builder.SqlScriptBuilder.BuildAttachScript(System.String,System.String)"> <member name="M:QueryPlatform.Api.Infrastructure.Builder.SqlScriptBuilder.BuildAttachScript(System.String,System.String)">
<summary> <summary>
构建导出语句 构建导出语句
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Infrastructure.Builder.SqlScriptBuilder.BuildAfterScript(System.String)"> <member name="M:QueryPlatform.Api.Infrastructure.Builder.SqlScriptBuilder.BuildAfterScript(System.String)">
<summary> <summary>
清理数据 清理数据
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:Health.Api.Infrastructure.Builder.SqlScriptDirector"> <member name="T:QueryPlatform.Api.Infrastructure.Builder.SqlScriptDirector">
<summary> <summary>
创建控制器:指挥者(Director) 创建控制器:指挥者(Director)
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Builder.SqlScriptDirector.Construct(System.Collections.Generic.IEnumerable{System.String},System.Boolean,System.Collections.Generic.List{Health.Api.Infrastructure.Request.Condition},System.Collections.Generic.IEnumerable{Health.Api.Infrastructure.Modules.SYS_TABLE})"> <member name="M:QueryPlatform.Api.Infrastructure.Builder.SqlScriptDirector.Construct(System.Collections.Generic.IEnumerable{System.String},System.Boolean,System.Collections.Generic.List{QueryPlatform.Api.Infrastructure.Request.Condition},System.Collections.Generic.IEnumerable{QueryPlatform.Api.Infrastructure.Modules.SYS_TABLE})">
<summary> <summary>
逐步构建复杂产品对象 逐步构建复杂产品对象
</summary> </summary>
</member> </member>
<member name="F:Health.Api.Infrastructure.Angle.ATC"> <member name="F:QueryPlatform.Api.Infrastructure.Angle.ATC">
<summary> 药品 </summary> <summary> 药品 </summary>
</member> </member>
<member name="F:Health.Api.Infrastructure.Angle.ICD"> <member name="F:QueryPlatform.Api.Infrastructure.Angle.ICD">
<summary> 疾病 </summary> <summary> 疾病 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Domain.SearchPathInfo.TempPath"> <member name="P:QueryPlatform.Api.Infrastructure.Domain.SearchPathInfo.TempPath">
<summary> <summary>
临时文件目录 临时文件目录
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Domain.SearchPathInfo.NetworkPath"> <member name="P:QueryPlatform.Api.Infrastructure.Domain.SearchPathInfo.NetworkPath">
<summary> <summary>
网络路径 网络路径
</summary> </summary>
</member> </member>
<member name="T:Health.Api.Infrastructure.Middlewares.DecodeResponseMiddleware"> <member name="T:QueryPlatform.Api.Infrastructure.Middlewares.DecodeResponseMiddleware">
<summary> <summary>
解码中间件 解码中间件
</summary> </summary>
</member> </member>
<member name="T:Health.Api.Infrastructure.Middlewares.DoubleRequestMiddleware"> <member name="T:QueryPlatform.Api.Infrastructure.Middlewares.DoubleRequestMiddleware">
<summary> <summary>
解码中间件 解码中间件
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.Health.TITLE"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.QueryPlatform.TITLE">
<summary> 检索描述 </summary> <summary> 检索描述 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.Health.ANGLE"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.QueryPlatform.ANGLE">
<summary> 检索角度 疾病 药品 </summary> <summary> 检索角度 疾病 药品 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.Health.CODE"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.QueryPlatform.CODE">
<summary> 检索角度编码 </summary> <summary> 检索角度编码 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.Health.ATTACH"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.QueryPlatform.ATTACH">
<summary> 是否附带其他数据 </summary> <summary> 是否附带其他数据 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.Health.SOURCETYPE"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.QueryPlatform.SOURCETYPE">
<summary> 检索类型 门诊 住院 </summary> <summary> 检索类型 门诊 住院 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.Health.CREATE_TIME"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.QueryPlatform.CREATE_TIME">
<summary> 创建时间 </summary> <summary> 创建时间 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_CONDITION.SEARCH_ID"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_CONDITION.SEARCH_ID">
<summary> 检索ID </summary> <summary> 检索ID </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_CONDITION.DESCRIPTION"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_CONDITION.DESCRIPTION">
<summary> 字段描述 </summary> <summary> 字段描述 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_CONDITION.TABLE_NAME"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_CONDITION.TABLE_NAME">
<summary> 表名 </summary> <summary> 表名 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_CONDITION.COLUMN_NAME"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_CONDITION.COLUMN_NAME">
<summary> 字段名 </summary> <summary> 字段名 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_CONDITION.OPERATOR"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_CONDITION.OPERATOR">
<summary> 操作符 </summary> <summary> 操作符 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_CONDITION.ARGUMENTS"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_CONDITION.ARGUMENTS">
<summary> 参数 </summary> <summary> 参数 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_CONDITION.RELATION"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_CONDITION.RELATION">
<summary> 字段关系 并且 或者 </summary> <summary> 字段关系 并且 或者 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_CONDITION.GROUP_ID"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_CONDITION.GROUP_ID">
<summary> 组别 </summary> <summary> 组别 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_CONDITION.GROUP_RELATION"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_CONDITION.GROUP_RELATION">
<summary> 组别关系 并且 或者 </summary> <summary> 组别关系 并且 或者 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_LOG.SEARCH_ID"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_LOG.SEARCH_ID">
<summary> 检索ID </summary> <summary> 检索ID </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_LOG.CREATE_TIME"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_LOG.CREATE_TIME">
<summary> 创建时间 </summary> <summary> 创建时间 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_LOG.FILEPATH"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_LOG.FILEPATH">
<summary> 文件路径 </summary> <summary> 文件路径 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_LOG.FILEFORMAT"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_LOG.FILEFORMAT">
<summary> 导出格式 xlsx csv </summary> <summary> 导出格式 xlsx csv </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SEARCH_LOG.REMARK"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SEARCH_LOG.REMARK">
<summary> 备注 </summary> <summary> 备注 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.SYS_USER.IsDelete"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.SYS_USER.IsDelete">
<summary> <summary>
true 删除 false 正常 true 删除 false 正常
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.VIEW_ATC_STATISTIC.CODE"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.VIEW_ATC_STATISTIC.CODE">
<summary> <summary>
ATC编码CODE ATC编码CODE
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.VIEW_ATC_STATISTIC.DESCRIPTION"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.VIEW_ATC_STATISTIC.DESCRIPTION">
<summary> <summary>
中文描述 中文描述
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.VIEW_ATC_STATISTIC.PERSONTIMES"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.VIEW_ATC_STATISTIC.PERSONTIMES">
<summary> <summary>
人次 人次
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.VIEW_ATC_STATISTIC.SOURCETYPE"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.VIEW_ATC_STATISTIC.SOURCETYPE">
<summary> <summary>
来源 门诊 住院 来源 门诊 住院
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.VIEW_ICD_STATISTIC.CODE"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.VIEW_ICD_STATISTIC.CODE">
<summary> <summary>
ATC编码CODE ATC编码CODE
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.VIEW_ICD_STATISTIC.DESCRIPTION"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.VIEW_ICD_STATISTIC.DESCRIPTION">
<summary> <summary>
中文描述 中文描述
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.VIEW_ICD_STATISTIC.PERSONTIMES"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.VIEW_ICD_STATISTIC.PERSONTIMES">
<summary> <summary>
人次 人次
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Modules.VIEW_ICD_STATISTIC.SOURCETYPE"> <member name="P:QueryPlatform.Api.Infrastructure.Modules.VIEW_ICD_STATISTIC.SOURCETYPE">
<summary> <summary>
来源 门诊 住院 来源 门诊 住院
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Page.Index"> <member name="P:QueryPlatform.Api.Infrastructure.Page.Index">
<summary> <summary>
页码 页码
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Page.Size"> <member name="P:QueryPlatform.Api.Infrastructure.Page.Size">
<summary> <summary>
页行数 默认30 页行数 默认30
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.OverviewQueries.GetPersonTimesCollect(System.DateTime,System.DateTime)"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.OverviewQueries.GetPersonTimesCollect(System.DateTime,System.DateTime)">
<summary> <summary>
人次汇总 人次汇总
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.OverviewQueries.GetPersonTimesForAge(System.DateTime,System.DateTime)"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.OverviewQueries.GetPersonTimesForAge(System.DateTime,System.DateTime)">
<summary> <summary>
年龄分布 年龄分布
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.OverviewQueries.GetPersonTimesForGender(System.DateTime,System.DateTime)"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.OverviewQueries.GetPersonTimesForGender(System.DateTime,System.DateTime)">
<summary> <summary>
性别分布 性别分布
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.OverviewQueries.GetPersonTimesForDiag(Health.Api.Infrastructure.Source,System.DateTime,System.DateTime)"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.OverviewQueries.GetPersonTimesForDiag(QueryPlatform.Api.Infrastructure.Source,System.DateTime,System.DateTime)">
<summary> <summary>
诊断分布 诊断分布
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.OverviewQueries.GetPersonTimesForDrug(Health.Api.Infrastructure.Source,System.DateTime,System.DateTime)"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.OverviewQueries.GetPersonTimesForDrug(QueryPlatform.Api.Infrastructure.Source,System.DateTime,System.DateTime)">
<summary> <summary>
药品分布 药品分布
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.GetCondition(System.Nullable{System.Boolean},System.Nullable{System.Boolean})"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.GetCondition(System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
<summary> <summary>
查询条件 查询条件
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.GetICD(System.String)"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.GetICD(System.String)">
<summary> <summary>
ICD树 ICD树
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.ResourceQueries.GetATC(System.String)"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.ResourceQueries.GetATC(System.String)">
<summary> <summary>
ATC树 ATC树
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.SearchQueries.GetSearch(System.Int32,System.Int32,System.String,System.Nullable{Health.Api.Infrastructure.Angle},System.Nullable{Health.Api.Infrastructure.Source})"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.SearchQueries.GetSearch(System.long32,System.long32,System.String,System.Nullable{QueryPlatform.Api.Infrastructure.Angle},System.Nullable{QueryPlatform.Api.Infrastructure.Source})">
<summary> <summary>
导出记录 导出记录
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.SearchQueries.GetSearchById(System.Int32)"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.SearchQueries.GetSearchById(System.long32)">
<summary> <summary>
导出记录 导出记录
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.SearchQueries.Query(System.String,System.Object)"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.SearchQueries.Query(System.String,System.Object)">
<summary> <summary>
导出记录 导出记录
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.SearchQueries.Execute(System.String,System.Object)"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.SearchQueries.Execute(System.String,System.Object)">
<summary> <summary>
导出记录 导出记录
</summary> </summary>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.UserStorage.Update(System.Int32,System.String,System.String)"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.UserStorage.Update(System.long32,System.String,System.String)">
<summary> <summary>
修改密码 修改密码
</summary> </summary>
...@@ -522,7 +522,7 @@ ...@@ -522,7 +522,7 @@
<param name="newPassword"></param> <param name="newPassword"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Health.Api.Infrastructure.Queries.UserStorage.Update(System.Int32,System.Nullable{System.Boolean},System.Nullable{System.Boolean})"> <member name="M:QueryPlatform.Api.Infrastructure.Queries.UserStorage.Update(System.long32,System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
<summary> <summary>
修改用户信息 修改用户信息
</summary> </summary>
...@@ -531,95 +531,95 @@ ...@@ -531,95 +531,95 @@
<param name="reset"></param> <param name="reset"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="P:Health.Api.Infrastructure.Queues.ExportMessage.FileFormat"> <member name="P:QueryPlatform.Api.Infrastructure.Queues.ExportMessage.FileFormat">
<summary> 文件格式 </summary> <summary> 文件格式 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.ExportRequest.SearchId"> <member name="P:QueryPlatform.Api.Infrastructure.Request.ExportRequest.SearchId">
<summary> 检索ID </summary> <summary> 检索ID </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.ExportRequest.FileFormat"> <member name="P:QueryPlatform.Api.Infrastructure.Request.ExportRequest.FileFormat">
<summary> 文件格式 </summary> <summary> 文件格式 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.LoginRequest.Account"> <member name="P:QueryPlatform.Api.Infrastructure.Request.LoginRequest.Account">
<summary> <summary>
账号 账号
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.LoginRequest.Password"> <member name="P:QueryPlatform.Api.Infrastructure.Request.LoginRequest.Password">
<summary> <summary>
密码 密码
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.SearchQuery.Title"> <member name="P:QueryPlatform.Api.Infrastructure.Request.SearchQuery.Title">
<summary> <summary>
描述 描述
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.SearchQuery.Angle"> <member name="P:QueryPlatform.Api.Infrastructure.Request.SearchQuery.Angle">
<summary> <summary>
检索角度 ATC ICD 检索角度 ATC ICD
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.SearchQuery.Source"> <member name="P:QueryPlatform.Api.Infrastructure.Request.SearchQuery.Source">
<summary> <summary>
来源 门诊 住院 来源 门诊 住院
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.SearchRequest.Title"> <member name="P:QueryPlatform.Api.Infrastructure.Request.SearchRequest.Title">
<summary> 检索描述 </summary> <summary> 检索描述 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.SearchRequest.Angle"> <member name="P:QueryPlatform.Api.Infrastructure.Request.SearchRequest.Angle">
<summary> 检索角度 疾病 药品 </summary> <summary> 检索角度 疾病 药品 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.SearchRequest.Code"> <member name="P:QueryPlatform.Api.Infrastructure.Request.SearchRequest.Code">
<summary> 检索角度编码 </summary> <summary> 检索角度编码 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.SearchRequest.SourceType"> <member name="P:QueryPlatform.Api.Infrastructure.Request.SearchRequest.SourceType">
<summary> 检索类型 门诊 住院 </summary> <summary> 检索类型 门诊 住院 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.SearchRequest.Conditions"> <member name="P:QueryPlatform.Api.Infrastructure.Request.SearchRequest.Conditions">
<summary> 特征筛选条件 </summary> <summary> 特征筛选条件 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.Condition.TableName"> <member name="P:QueryPlatform.Api.Infrastructure.Request.Condition.TableName">
<summary> 表名 </summary> <summary> 表名 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.Condition.ColumnName"> <member name="P:QueryPlatform.Api.Infrastructure.Request.Condition.ColumnName">
<summary> 字段名 </summary> <summary> 字段名 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.Condition.ColumnDescription"> <member name="P:QueryPlatform.Api.Infrastructure.Request.Condition.ColumnDescription">
<summary> 字段中文描述 </summary> <summary> 字段中文描述 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.Condition.Operator"> <member name="P:QueryPlatform.Api.Infrastructure.Request.Condition.Operator">
<summary> 操作符 </summary> <summary> 操作符 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.Condition.Arguments"> <member name="P:QueryPlatform.Api.Infrastructure.Request.Condition.Arguments">
<summary> 参数 </summary> <summary> 参数 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.Condition.Relation"> <member name="P:QueryPlatform.Api.Infrastructure.Request.Condition.Relation">
<summary> 字段关系 并且 或者 </summary> <summary> 字段关系 并且 或者 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.Condition.GroupId"> <member name="P:QueryPlatform.Api.Infrastructure.Request.Condition.GroupId">
<summary> 组别 </summary> <summary> 组别 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.Request.Condition.GroupRelation"> <member name="P:QueryPlatform.Api.Infrastructure.Request.Condition.GroupRelation">
<summary> 组别关系 并且 或者 </summary> <summary> 组别关系 并且 或者 </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.JwtResult.AccessToken"> <member name="P:QueryPlatform.Api.Infrastructure.JwtResult.AccessToken">
<summary> <summary>
Access Token Access Token
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.JwtResult.TokenType"> <member name="P:QueryPlatform.Api.Infrastructure.JwtResult.TokenType">
<summary> <summary>
token 类型 token 类型
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.JwtResult.AuthTime"> <member name="P:QueryPlatform.Api.Infrastructure.JwtResult.AuthTime">
<summary> <summary>
授权时间 授权时间
</summary> </summary>
</member> </member>
<member name="P:Health.Api.Infrastructure.JwtResult.ExpiresAt"> <member name="P:QueryPlatform.Api.Infrastructure.JwtResult.ExpiresAt">
<summary> <summary>
过期时间 过期时间
</summary> </summary>
......
...@@ -11,16 +11,13 @@ public enum Status ...@@ -11,16 +11,13 @@ public enum Status
public abstract class ApiResponse public abstract class ApiResponse
{ {
public ApiResponse() { } public ApiResponse() { }
public ApiResponse(Status status) public ApiResponse(Status status)
: this() : this()
{ {
Status = status; Status = status;
} }
public Status Status { get; set; } public Status Status { get; set; }
} }
public class UnauthorizedResponse : ApiResponse public class UnauthorizedResponse : ApiResponse
{ {
public UnauthorizedResponse() public UnauthorizedResponse()
...@@ -31,7 +28,6 @@ public UnauthorizedResponse() ...@@ -31,7 +28,6 @@ public UnauthorizedResponse()
public string Message { get; set; } public string Message { get; set; }
} }
public class ParameterErrorResponse : ApiResponse public class ParameterErrorResponse : ApiResponse
{ {
public ParameterErrorResponse() public ParameterErrorResponse()
...@@ -46,10 +42,9 @@ public ParameterErrorResponse() ...@@ -46,10 +42,9 @@ public ParameterErrorResponse()
public string Instance { get; set; } public string Instance { get; set; }
} }
public class longernalServerErrorResponse : ApiResponse
public class InternalServerErrorResponse : ApiResponse
{ {
public InternalServerErrorResponse() public longernalServerErrorResponse()
{ {
Status = Status.TokenInvalid; Status = Status.TokenInvalid;
Message = "Token无效"; Message = "Token无效";
...@@ -67,7 +62,6 @@ public class DomainErrorResponse : ApiResponse ...@@ -67,7 +62,6 @@ public class DomainErrorResponse : ApiResponse
public string Instance { get; set; } public string Instance { get; set; }
} }
public class OkResponse : ApiResponse public class OkResponse : ApiResponse
{ {
public OkResponse(object data) public OkResponse(object data)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
using System.ComponentModel; using System.ComponentModel;
using System.Reflection; using System.Reflection;
namespace Health.Infra namespace QueryPlatform.Infra
{ {
public class EnumItem public class EnumItem
{ {
......
...@@ -40,11 +40,11 @@ public static string[] SplitRemoveEmpty(this string text, params string[] separa ...@@ -40,11 +40,11 @@ public static string[] SplitRemoveEmpty(this string text, params string[] separa
} }
/// <summary> /// <summary>
/// 转换Int32数组 /// 转换long32数组
/// </summary> /// </summary>
/// <param name="array"></param> /// <param name="array"></param>
/// <returns></returns> /// <returns></returns>
public static int[] ToInt32Arrary(this string[] array) public static int[] Tolong32Arrary(this string[] array)
{ {
return Array.ConvertAll(array, t => Convert.ToInt32(t)); return Array.ConvertAll(array, t => Convert.ToInt32(t));
} }
......
namespace Health.Infra namespace QueryPlatform.Infra
{ {
public interface IJsonConverter public interface IJsonConverter
{ {
...@@ -14,6 +14,6 @@ public interface IJsonConverter ...@@ -14,6 +14,6 @@ public interface IJsonConverter
/// <typeparam name="T"></typeparam> /// <typeparam name="T"></typeparam>
/// <param name="json"></param> /// <param name="json"></param>
/// <returns></returns> /// <returns></returns>
T Deserialize<T>(string json); //static T Deserialize<T>(string json);
} }
} }
using System.Collections.Generic; using System.Collections.Generic;
using System.Security.Claims; using System.Security.Claims;
namespace Health.Infra namespace QueryPlatform.Infra
{ {
public interface IUserIdentity public interface IUserIdentity
{ {
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Serialization;
using System; using System;
using System.Globalization;
namespace Health.Infra namespace QueryPlatform.Infra
{ {
public class IsoDateTimeConverterContent : IsoDateTimeConverter public class IsoDateTimeConverterContent : IsoDateTimeConverter
{ {
...@@ -24,9 +25,39 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s ...@@ -24,9 +25,39 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
base.WriteJson(writer, value, serializer); base.WriteJson(writer, value, serializer);
} }
//public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
//{
// return base.ReadJson(reader, objectType, existingValue, serializer);
//}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{ {
return base.ReadJson(reader, objectType, existingValue, serializer); if (string.IsNullOrWhiteSpace(reader.Value?.ToString())) return null;
var formats = new string[]
{
"yyyyMMddHHmmss",
"yyyyMMddHHmmss",
"yyyy-MM-dd HH:mm:ss",
"yyyy-MM-dd H:mm:ss",
"yyyy年MM月dd日 HH时mm分ss秒" ,
"yyyyMdHHmmss",
"yyyy年M月d日 H时mm分ss秒",
"yyyy.M.d H:mm:ss",
"yyyy.MM.dd HH:mm:ss",
"yyyy-MM-dd",
"yyyyMMdd",
"yyyy/MM/dd",
"yyyy/M/d",
"yyyy-MM",
"yyyy/MM",
"yyyy/M",
};
DateTime.TryParseExact(reader.Value?.ToString(), formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime now1);
return now1;
//return base.ReadJson(reader, objectType, existingValue, serializer);
} }
} }
public class LowercaseContractResolver : DefaultContractResolver public class LowercaseContractResolver : DefaultContractResolver
......
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
namespace Health.Infra namespace QueryPlatform.Infra
{ {
public class Md5Util public class Md5Util
{ {
......
...@@ -17,7 +17,7 @@ public ReportData(string title) ...@@ -17,7 +17,7 @@ public ReportData(string title)
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Nullable<int> ChartType { get; set; } public Nullable<long> ChartType { get; set; }
/// <summary> /// <summary>
/// 报表标题 /// 报表标题
...@@ -72,7 +72,7 @@ public ReportData(string title) ...@@ -72,7 +72,7 @@ public ReportData(string title)
/// <summary> /// <summary>
/// 1表示需要进行小于百分2的类型进行合并 /// 1表示需要进行小于百分2的类型进行合并
/// </summary> /// </summary>
public Nullable<int> DataType { get; set; } public Nullable<long> DataType { get; set; }
/// <summary> /// <summary>
/// 图标value过滤执值 /// 图标value过滤执值
......
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 17
VisualStudioVersion = 16.0.30517.126 VisualStudioVersion = 17.1.32210.238
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryPlatform.Api", "Health.Api\QueryPlatform.Api.csproj", "{7D7E81D8-76AC-4B16-9F93-B4689BBC423E}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryPlatform.Api", "queryPlaform.Api\QueryPlatform.Api.csproj", "{371A1028-3269-4BAC-89DF-F11F00259306}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryPlatform.Infra", "Health.Infra\QueryPlatform.Infra.csproj", "{A4750395-66B7-4F21-B87B-6B67F5F598BF}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryPlatform.Infra", "queryPlaform.Infra\QueryPlatform.Infra.csproj", "{DEEDEA96-9A13-48D7-A9E6-E1A9E6F95656}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
...@@ -13,14 +13,14 @@ Global ...@@ -13,14 +13,14 @@ Global
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7D7E81D8-76AC-4B16-9F93-B4689BBC423E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {371A1028-3269-4BAC-89DF-F11F00259306}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D7E81D8-76AC-4B16-9F93-B4689BBC423E}.Debug|Any CPU.Build.0 = Debug|Any CPU {371A1028-3269-4BAC-89DF-F11F00259306}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D7E81D8-76AC-4B16-9F93-B4689BBC423E}.Release|Any CPU.ActiveCfg = Release|Any CPU {371A1028-3269-4BAC-89DF-F11F00259306}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D7E81D8-76AC-4B16-9F93-B4689BBC423E}.Release|Any CPU.Build.0 = Release|Any CPU {371A1028-3269-4BAC-89DF-F11F00259306}.Release|Any CPU.Build.0 = Release|Any CPU
{A4750395-66B7-4F21-B87B-6B67F5F598BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DEEDEA96-9A13-48D7-A9E6-E1A9E6F95656}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4750395-66B7-4F21-B87B-6B67F5F598BF}.Debug|Any CPU.Build.0 = Debug|Any CPU {DEEDEA96-9A13-48D7-A9E6-E1A9E6F95656}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4750395-66B7-4F21-B87B-6B67F5F598BF}.Release|Any CPU.ActiveCfg = Release|Any CPU {DEEDEA96-9A13-48D7-A9E6-E1A9E6F95656}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4750395-66B7-4F21-B87B-6B67F5F598BF}.Release|Any CPU.Build.0 = Release|Any CPU {DEEDEA96-9A13-48D7-A9E6-E1A9E6F95656}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
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