From 01ee530e3869afb798c085ada41874e49d16f7f4 Mon Sep 17 00:00:00 2001
From: hang <87227557@qq.com>
Date: Mon, 2 Sep 2024 23:35:42 +0800
Subject: [PATCH] =?UTF-8?q?npgsql=20=E9=80=82=E9=85=8D=E4=B8=B4=E6=97=B6?=
=?UTF-8?q?=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 125 +++++++++++++++++-
.../Inspection/FrontAuditConfigService.cs | 66 +++++++--
.../Common/Dto/AnswerDto.cs | 14 --
.../Common/Dto/AuditingDto.cs | 17 ---
.../Common/Dto/DateDto.cs | 12 +-
.../Common/Dto/ForeignKey.cs | 13 --
IRaCIS.Core.Infra.EFCore/Common/EFSqlQuery.cs | 82 ------------
7 files changed, 181 insertions(+), 148 deletions(-)
delete mode 100644 IRaCIS.Core.Infra.EFCore/Common/Dto/AnswerDto.cs
delete mode 100644 IRaCIS.Core.Infra.EFCore/Common/Dto/AuditingDto.cs
delete mode 100644 IRaCIS.Core.Infra.EFCore/Common/Dto/ForeignKey.cs
delete mode 100644 IRaCIS.Core.Infra.EFCore/Common/EFSqlQuery.cs
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 0e01fbff5..3eafb5142 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -39,6 +39,27 @@
主要为了 处理项目结束 锁库,不允许操作
+
+
+ 跳过阅片
+
+
+
+
+
+
+ 开始阅片时间
+
+
+
+
+
+
+ 开始休息时间
+
+
+
+
写文件导到磁盘
@@ -47,6 +68,12 @@
文件保存路径
+
+
+ github 链接:https://github.com/lanceliao/china-holiday-calender?tab=readme-ov-file
+ 接口请求参考文档:https://www.koudingke.cn/docs/zh-Hans/net-lib-docs/latest/RestSharp/Usage/Usage
+
+
oosFolderPath 不要 "/ "开头 应该: TempFolder/ChildFolder
@@ -1972,6 +1999,95 @@
+
+
+ 获取阅片的计算数据
+
+
+
+
+
+
+ 获取Sod的值
+
+
+
+
+ 获取iSod的值
+
+
+
+
+ 上一次访视Id
+
+
+
+
+ 首次转变的任务ID
+
+
+
+
+ 触发任务list
+
+
+
+
+ 删除病灶获取起始病灶序号(RECIST1Point1 固定是1)
+
+
+
+
+
+ 获取阅片报告
+
+
+
+
+
+
+ 测试计算
+
+
+
+
+
+
+
+ 计算任务
+
+
+
+
+
+
+ 获取报告验证的信息(这里每个标准可能不一样 返回用object)
+
+
+
+
+
+
+ 自动计算
+
+
+
+
+
+
+
+ 验证访视提交
+
+
+
+
+
+
+ 将上一次的访视病灶添加到这一次
+
+
+
+
获取阅片的计算数据
@@ -14786,7 +14902,7 @@
-
+
IR影像阅片
@@ -15378,18 +15494,13 @@
-
+
用ef 实现之前视图的功能
-
-
- 获取读片模块 //加了标准参数
-
-
获取单条详情信息
diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs
index cd6f903cf..ea40e39ee 100644
--- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs
@@ -17,6 +17,8 @@ using IRaCIS.Core.Domain.Share.Management;
using System.Text.Json.Nodes;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Infrastructure.Extention;
+using Microsoft.EntityFrameworkCore;
+using Npgsql;
namespace IRaCIS.Core.Application.Service
{
@@ -556,19 +558,67 @@ namespace IRaCIS.Core.Application.Service
{
para += para == string.Empty ? $"'{v.ToString()}'" : $",'{v.ToString()}'";
}
- sql = $"select {ForeignKeyText} Text from [{Table}] where {ForeignKeyValue} in (@para)";
+
+ if (_frontAuditConfigRepository._dbContext.Database.IsSqlServer())
+ {
+ sql = $"select {ForeignKeyText} Text from [{Table}] where {ForeignKeyValue} in (@para)";
+
+ }
+ else if (_frontAuditConfigRepository._dbContext.Database.IsNpgsql())
+ {
+ //sql = $"select {ForeignKeyText} Text from \"{Table}\" where {ForeignKeyValue} = ANY(STRING_TO_ARRAY(@para, ','))";
+ }
+ else
+ {
+ throw new Exception("不支持的数据库");
+ }
}
else
{
para = $"{JsonData["item"].ToString()}";
- sql = $"select {ForeignKeyText} Text from [{Table}] where {ForeignKeyValue} = @para";
- }
- SqlParameter[] paravalue = new SqlParameter[] {
- new SqlParameter("@para",para)
- };
+ ForeignKeyText = 1.ToString();
+
+ if (_frontAuditConfigRepository._dbContext.Database.IsSqlServer())
+ {
+ sql = $"select {ForeignKeyText} Text from [{Table}] where {ForeignKeyValue} = @para";
+
+
+ }
+ else if (_frontAuditConfigRepository._dbContext.Database.IsNpgsql())
+ {
+ //sql = $"select {ForeignKeyText} Text from \"{Table}\" where \"{ForeignKeyValue}\" = @para";
+ }
+ else
+ {
+ throw new Exception("不支持的数据库");
+ }
+
+
+ //https://learn.microsoft.com/zh-tw/ef/core/querying/sql-queries
+
+ }
+
+ if (_frontAuditConfigRepository._dbContext.Database.IsSqlServer())
+ {
+
+ jsonDataValueDic[item.Key] = string.Join(",", _frontAuditConfigRepository._dbContext.Database.SqlQueryRaw
+ (sql, new SqlParameter("@para", para)).ToList());
+
+ }
+ else if (_frontAuditConfigRepository._dbContext.Database.IsNpgsql())
+ {
+
+ //jsonDataValueDic[item.Key] = string.Join(",", _frontAuditConfigRepository._dbContext.Database.SqlQueryRaw
+ // (sql, new NpgsqlParameter("@para", Guid.Parse(para))).ToList());
+ }
+ else
+ {
+ throw new Exception("不支持的数据库");
+ }
+
+
+
- //https://learn.microsoft.com/zh-tw/ef/core/querying/sql-queries
- jsonDataValueDic[item.Key] = string.Join(",", _frontAuditConfigRepository._dbContext.Database.SqlQuery(sql, paravalue).Select(x => x.Text).ToList());
}
}
return JsonConvert.SerializeObject(jsonDataValueDic);
diff --git a/IRaCIS.Core.Infra.EFCore/Common/Dto/AnswerDto.cs b/IRaCIS.Core.Infra.EFCore/Common/Dto/AnswerDto.cs
deleted file mode 100644
index 0467f5cb3..000000000
--- a/IRaCIS.Core.Infra.EFCore/Common/Dto/AnswerDto.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace IRaCIS.Core.Infra.EFCore.Common.Dto
-{
- public class AnswerDto
- {
- public string QuestionName { get; set; }
-
- public string Answer { get; set; }
- }
-}
\ No newline at end of file
diff --git a/IRaCIS.Core.Infra.EFCore/Common/Dto/AuditingDto.cs b/IRaCIS.Core.Infra.EFCore/Common/Dto/AuditingDto.cs
deleted file mode 100644
index 4e43a0065..000000000
--- a/IRaCIS.Core.Infra.EFCore/Common/Dto/AuditingDto.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using IRaCIS.Core.Domain.Models;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace IRaCIS.Core.Infra.EFCore.Common.Dto
-{
- public class AuditingDto
- {
- public Type EntityType { get; set; }
-
- public Expression> Expression { get; set; }
- }
-}
diff --git a/IRaCIS.Core.Infra.EFCore/Common/Dto/DateDto.cs b/IRaCIS.Core.Infra.EFCore/Common/Dto/DateDto.cs
index fa9559eec..b102f4bf1 100644
--- a/IRaCIS.Core.Infra.EFCore/Common/Dto/DateDto.cs
+++ b/IRaCIS.Core.Infra.EFCore/Common/Dto/DateDto.cs
@@ -1,6 +1,8 @@
-using System;
+using IRaCIS.Core.Domain.Models;
+using System;
using System.Collections.Generic;
using System.Linq;
+using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
@@ -14,12 +16,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto
public string Identification { get; set; }
}
-
- public class TypeNameDto
+ public class ForeignKey
{
- public string TypeName { get; set; }
-
-
- public List Types { get; set; }
+ public string Text { get; set; }
}
}
diff --git a/IRaCIS.Core.Infra.EFCore/Common/Dto/ForeignKey.cs b/IRaCIS.Core.Infra.EFCore/Common/Dto/ForeignKey.cs
deleted file mode 100644
index 54fe5eb7b..000000000
--- a/IRaCIS.Core.Infra.EFCore/Common/Dto/ForeignKey.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace IRaCIS.Core.Infra.EFCore.Common.Dto
-{
- public class ForeignKey
- {
- public string Text { get; set; }
- }
-}
diff --git a/IRaCIS.Core.Infra.EFCore/Common/EFSqlQuery.cs b/IRaCIS.Core.Infra.EFCore/Common/EFSqlQuery.cs
deleted file mode 100644
index d566f122c..000000000
--- a/IRaCIS.Core.Infra.EFCore/Common/EFSqlQuery.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Data.Common;
-using Microsoft.Data.SqlClient;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace IRaCIS.Core.Infra.EFCore
-{
- public static class EFSqlQuery
- {
- public static IEnumerable SqlQuery(this DatabaseFacade facade, string sql, params object[] parameters) where T : class, new()
- {
- DataTable dt = SqlQuery(facade, sql, parameters);
- return dt.ToEnumerable();
- }
-
- public static IEnumerable ToEnumerable(this DataTable dt) where T : class, new()
- {
- PropertyInfo[] propertyInfos = typeof(T).GetProperties();
- T[] ts = new T[dt.Rows.Count];
- int i = 0;
- foreach (DataRow row in dt.Rows)
- {
- T t = new T();
- foreach (PropertyInfo p in propertyInfos)
- {
- if (dt.Columns.IndexOf(p.Name) != -1 && row[p.Name] != DBNull.Value)
- p.SetValue(t, row[p.Name], null);
- }
- ts[i] = t;
- i++;
- }
- return ts;
- }
-
- public static DataTable SqlQuery(this DatabaseFacade facade, string sql, params object[] parameters)
- {
- DbCommand cmd = CreateCommand(facade, sql, out DbConnection conn, parameters);
- DbDataReader reader = cmd.ExecuteReader();
- DataTable dt = new DataTable();
- dt.Load(reader);
- reader.Close();
- conn.Close();
- return dt;
- }
-
- private static DbCommand CreateCommand(DatabaseFacade facade, string sql, out DbConnection dbConn, params object[] parameters)
- {
- DbConnection conn = facade.GetDbConnection();
- dbConn = conn;
- conn.Open();
- DbCommand cmd = conn.CreateCommand();
- if (facade.IsRelational())
- {
- cmd.CommandText = sql;
- CombineParams(ref cmd, parameters);
- }
- return cmd;
- }
-
- private static void CombineParams(ref DbCommand command, params object[] parameters)
- {
- if (parameters != null)
- {
- foreach (SqlParameter parameter in parameters)
- {
- if (!parameter.ParameterName.Contains("@"))
- parameter.ParameterName = $"@{parameter.ParameterName}";
- command.Parameters.Add(parameter);
- }
-
-
- }
- }
- }
-}