Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
31a444508b
|
@ -0,0 +1,97 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Org.BouncyCastle.Crypto;
|
||||||
|
using Org.BouncyCastle.Crypto.Encodings;
|
||||||
|
using Org.BouncyCastle.Crypto.Engines;
|
||||||
|
using Org.BouncyCastle.Crypto.Generators;
|
||||||
|
using Org.BouncyCastle.OpenSsl;
|
||||||
|
using Org.BouncyCastle.Security;
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Application.Helper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// https://www.cnblogs.com/NBDWDYS2214143926/p/13329231.html
|
||||||
|
/// </summary>
|
||||||
|
public class RSAHelper
|
||||||
|
{
|
||||||
|
|
||||||
|
public static AsymmetricCipherKeyPair GenerateRSAKeyPair(int keySize)
|
||||||
|
{
|
||||||
|
var keyGenerationParameters = new KeyGenerationParameters(new SecureRandom(), keySize);
|
||||||
|
var keyPairGenerator = new RsaKeyPairGenerator();
|
||||||
|
keyPairGenerator.Init(keyGenerationParameters);
|
||||||
|
return keyPairGenerator.GenerateKeyPair();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ExportPublicKey(AsymmetricKeyParameter publicKey)
|
||||||
|
{
|
||||||
|
using (StringWriter sw = new StringWriter())
|
||||||
|
{
|
||||||
|
PemWriter pw = new PemWriter(sw);
|
||||||
|
pw.WriteObject(publicKey);
|
||||||
|
pw.Writer.Flush();
|
||||||
|
return sw.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ExportPrivateKey(AsymmetricKeyParameter privateKey)
|
||||||
|
{
|
||||||
|
using (StringWriter sw = new StringWriter())
|
||||||
|
{
|
||||||
|
PemWriter pw = new PemWriter(sw);
|
||||||
|
pw.WriteObject(privateKey);
|
||||||
|
pw.Writer.Flush();
|
||||||
|
return sw.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// RSA解密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="privateKey">私钥</param>
|
||||||
|
/// <param name="decryptstring">待解密的字符串(Base64)</param>
|
||||||
|
/// <returns>解密后的字符串</returns>
|
||||||
|
public static string Decrypt(string privateKey, string decryptstring)
|
||||||
|
{
|
||||||
|
using (TextReader reader = new StringReader(privateKey))
|
||||||
|
{
|
||||||
|
dynamic key = new PemReader(reader).ReadObject();
|
||||||
|
var rsaDecrypt = new Pkcs1Encoding(new RsaEngine());
|
||||||
|
if (key is AsymmetricKeyParameter)
|
||||||
|
{
|
||||||
|
key = (AsymmetricKeyParameter)key;
|
||||||
|
}
|
||||||
|
else if (key is AsymmetricCipherKeyPair)
|
||||||
|
{
|
||||||
|
key = ((AsymmetricCipherKeyPair)key).Private;
|
||||||
|
}
|
||||||
|
rsaDecrypt.Init(false, key); //这里加密是true;解密是false
|
||||||
|
|
||||||
|
byte[] entData = Convert.FromBase64String(decryptstring);
|
||||||
|
entData = rsaDecrypt.ProcessBlock(entData, 0, entData.Length);
|
||||||
|
return Encoding.UTF8.GetString(entData);
|
||||||
|
}
|
||||||
|
}/// <summary>
|
||||||
|
|
||||||
|
/// 加密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="publicKey">公钥</param>
|
||||||
|
/// <param name="encryptstring">待加密的字符串</param>
|
||||||
|
/// <returns>加密后的Base64</returns>
|
||||||
|
public static string Encrypt(string publicKey, string encryptstring)
|
||||||
|
{
|
||||||
|
using (TextReader reader = new StringReader(publicKey))
|
||||||
|
{
|
||||||
|
AsymmetricKeyParameter key = new PemReader(reader).ReadObject() as AsymmetricKeyParameter;
|
||||||
|
Pkcs1Encoding pkcs1 = new Pkcs1Encoding(new RsaEngine());
|
||||||
|
pkcs1.Init(true, key);//加密是true;解密是false;
|
||||||
|
byte[] entData = Encoding.UTF8.GetBytes(encryptstring);
|
||||||
|
entData = pkcs1.ProcessBlock(entData, 0, entData.Length);
|
||||||
|
return Convert.ToBase64String(entData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1425,7 +1425,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
var taskState = exsitPDF ? TaskState.NotEffect : TaskState.Effect;
|
var taskState = exsitPDF ? TaskState.NotEffect : TaskState.Effect;
|
||||||
|
|
||||||
var clinicalDataList = _readingClinicalDataRepository.Where(t => t.SubjectId == subjectId&&t.ClinicalDataTrialSet.ClinicalUploadType == ClinicalUploadType.PDF).Include(t => t.ReadingClinicalDataPDFList).Include(t=>t.ClinicalDataTrialSet).ToList();
|
var clinicalDataList = _readingClinicalDataRepository.Where(t => t.SubjectId == subjectId && t.ClinicalDataTrialSet.ClinicalUploadType == ClinicalUploadType.PDF).Include(t => t.ReadingClinicalDataPDFList).Include(t => t.ClinicalDataTrialSet).ToList();
|
||||||
|
|
||||||
foreach (var clinicalData in clinicalDataList)
|
foreach (var clinicalData in clinicalDataList)
|
||||||
{
|
{
|
||||||
|
@ -1433,11 +1433,12 @@ namespace IRaCIS.Core.Application.Service
|
||||||
var id = NewId.NextSequentialGuid();
|
var id = NewId.NextSequentialGuid();
|
||||||
consistnentClinicalData.Id = id;
|
consistnentClinicalData.Id = id;
|
||||||
|
|
||||||
if(consistnentClinicalData.ClinicalDataTrialSet.ClinicalUploadType == ClinicalUploadType.PDF)
|
if (consistnentClinicalData.ClinicalDataTrialSet.ClinicalUploadType == ClinicalUploadType.PDF)
|
||||||
{
|
{
|
||||||
consistnentClinicalData.IsSign = false;
|
consistnentClinicalData.IsSign = false;
|
||||||
consistnentClinicalData.IsBlind = false;
|
consistnentClinicalData.IsBlind = false;
|
||||||
consistnentClinicalData.ReadingClinicalDataState = ReadingClinicalDataStatus.HaveUploaded;
|
consistnentClinicalData.ReadingClinicalDataState = ReadingClinicalDataStatus.HaveUploaded;
|
||||||
|
consistnentClinicalData.ClinicalDataTrialSet = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var consistanClinicalDataPdfList = _mapper.Map<List<ReadingConsistentClinicalDataPDF>>(clinicalData.ReadingClinicalDataPDFList);
|
var consistanClinicalDataPdfList = _mapper.Map<List<ReadingConsistentClinicalDataPDF>>(clinicalData.ReadingClinicalDataPDFList);
|
||||||
|
|
|
@ -19,7 +19,6 @@ using DocumentFormat.OpenXml.Office2010.Word;
|
||||||
using System.Linq.Dynamic.Core;
|
using System.Linq.Dynamic.Core;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using DocumentFormat.OpenXml.Bibliography;
|
using DocumentFormat.OpenXml.Bibliography;
|
||||||
using Org.BouncyCastle.Crypto;
|
|
||||||
using IRaCIS.Core.Domain.Share.Reading;
|
using IRaCIS.Core.Domain.Share.Reading;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using System.Reactive.Subjects;
|
using System.Reactive.Subjects;
|
||||||
|
|
|
@ -8,7 +8,6 @@ using IRaCIS.Application.Interfaces;
|
||||||
using IRaCIS.Application.Contracts;
|
using IRaCIS.Application.Contracts;
|
||||||
using IRaCIS.Core.Application.ViewModel;
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
using static Org.BouncyCastle.Math.EC.ECCurve;
|
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Image.QA
|
namespace IRaCIS.Core.Application.Image.QA
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using IRaCIS.Core.Infrastructure.Extention;
|
using IRaCIS.Core.Infrastructure.Extention;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Org.BouncyCastle.Bcpg.OpenPgp;
|
|
||||||
|
|
||||||
namespace IRaCIS.Application.Contracts
|
namespace IRaCIS.Application.Contracts
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
using Aliyun.OSS;
|
using Aliyun.OSS;
|
||||||
using BeetleX;
|
|
||||||
using BeetleX.BNR;
|
|
||||||
using Castle.DynamicProxy.Generators.Emitters.SimpleAST;
|
|
||||||
using IP2Region.Net.XDB;
|
using IP2Region.Net.XDB;
|
||||||
using IRaCIS.Application.Contracts;
|
using IRaCIS.Application.Contracts;
|
||||||
using IRaCIS.Core.Application.Contracts;
|
using IRaCIS.Core.Application.Contracts;
|
||||||
|
@ -21,14 +18,10 @@ using Microsoft.Extensions.Options;
|
||||||
using MiniExcelLibs;
|
using MiniExcelLibs;
|
||||||
using Minio;
|
using Minio;
|
||||||
using Minio.DataModel.Args;
|
using Minio.DataModel.Args;
|
||||||
using NPOI.HPSF;
|
|
||||||
using NPOI.POIFS.Crypt;
|
|
||||||
using SharpCompress.Common;
|
using SharpCompress.Common;
|
||||||
using Spire.Doc;
|
using Spire.Doc;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Reflection.Metadata;
|
using System.Reflection.Metadata;
|
||||||
using System.Security.AccessControl;
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
@ -177,83 +170,30 @@ namespace IRaCIS.Application.Services
|
||||||
[UnitOfWork]
|
[UnitOfWork]
|
||||||
public async Task<string> Get()
|
public async Task<string> Get()
|
||||||
{
|
{
|
||||||
|
// Generate RSA keys
|
||||||
|
var keyPair = RSAHelper.GenerateRSAKeyPair(2048);
|
||||||
|
|
||||||
//Expression<Func<VisitTask, bool>> visitTaskLambda = x => x.TrialId == Guid.Empty && x.SubjectId == Guid.Empty && x.TrialReadingCriterionId == Guid.Empty;
|
// Export the public and private keys to PEM format
|
||||||
|
string publicKey = RSAHelper.ExportPublicKey(keyPair.Public);
|
||||||
|
string privateKey = RSAHelper.ExportPrivateKey(keyPair.Private);
|
||||||
|
|
||||||
//var visitTaskIdQueryable = _visitTaskRepositoryy.Where(visitTaskLambda).Where(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum)).Select(t => t.Id);
|
Console.WriteLine("Public Key:");
|
||||||
|
Console.WriteLine(publicKey);
|
||||||
|
Console.WriteLine("\nPrivate Key:");
|
||||||
|
Console.WriteLine(privateKey);
|
||||||
|
|
||||||
//await _visitTaskRepositoryy.BatchUpdateNoTrackingAsync(t => visitTaskIdQueryable.Contains(t.Id), u => new VisitTask()
|
// Data to encrypt
|
||||||
//{
|
string dataToEncrypt = "Hello, RSA!";
|
||||||
// IsFrontTaskNeedSignButNotSign = true
|
Console.WriteLine("\nOriginal Data: " + dataToEncrypt);
|
||||||
//});
|
|
||||||
|
|
||||||
|
// Encrypt the data
|
||||||
|
var encryptedData = RSAHelper.Encrypt( publicKey, dataToEncrypt);
|
||||||
|
Console.WriteLine("\nEncrypted Data: " + encryptedData);
|
||||||
|
|
||||||
//var a = ((Decimal)1.00).ToString().TrimEnd(new char[] { '.', '0' });
|
// Decrypt the data
|
||||||
//var b = ((Decimal)1.01).ToString().TrimEnd(new char[] { '.', '0' });
|
string decryptedData = RSAHelper.Decrypt( privateKey, encryptedData);
|
||||||
//var c = ((Decimal)100).ToString().TrimEnd(new char[] { '.', '0' });
|
Console.WriteLine("\nDecrypted Data: " + decryptedData);
|
||||||
//var subject1 = Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391693");
|
|
||||||
//var subject2 = Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391694");
|
|
||||||
|
|
||||||
// var subjectList = new List<Guid>() { Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391693") ,
|
|
||||||
// Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391694") ,
|
|
||||||
// Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391695")
|
|
||||||
// };
|
|
||||||
|
|
||||||
//string[] citys = new string[] { "广州", "深圳", "上海", "北京" };
|
|
||||||
//foreach (var item in subjectList)
|
|
||||||
//{
|
|
||||||
// Console.WriteLine(await BNRFactory.Default.Create($"[CN:{item}][N:[CN:{item}]/0000000]"));
|
|
||||||
//}
|
|
||||||
//foreach (var item in subjectList)
|
|
||||||
//{
|
|
||||||
// Console.WriteLine(await BNRFactory.Default.Create($"[N:[CN:{item}]/0000000]"));
|
|
||||||
//}
|
|
||||||
|
|
||||||
//foreach (var item in subjectList)
|
|
||||||
//{
|
|
||||||
// Console.WriteLine(await BNRFactory.Default.Create($"[CN:{item}][redis:city/0000000]"));
|
|
||||||
//}
|
|
||||||
|
|
||||||
//var needAddVisitList = await _repository.Where<VisitTask>(t => t.TrialId == Guid.Empty).DistinctBy(t => t.VisitTaskNum).ToListAsync();
|
|
||||||
|
|
||||||
|
|
||||||
//await _repository.BatchUpdateAsync<VisitTask>(t => t.Id == Guid.Empty, u => new VisitTask()
|
|
||||||
//{
|
|
||||||
// SuggesteFinishedTime = u.IsUrgent ? DateTime.Now.AddDays(2) : DateTime.Now.AddDays(7),
|
|
||||||
|
|
||||||
// Code = u.Code + 1
|
|
||||||
//});
|
|
||||||
|
|
||||||
//var query = from item1 in _repository.Where<ReadingQuestionTrial>()
|
|
||||||
// join item2 in _repository.Where<ReadingQuestionTrial>() on item1.ValueType equals item2.ValueType
|
|
||||||
// select new
|
|
||||||
// {
|
|
||||||
// item1.ValueType,
|
|
||||||
// dd = item2.ValueType
|
|
||||||
// };
|
|
||||||
|
|
||||||
//var list2 = query.ToList();
|
|
||||||
|
|
||||||
//await Task.CompletedTask;
|
|
||||||
|
|
||||||
//var list = await _repository.Where<ClinicalDataTrialSet>(t => t.TrialId == Guid.Parse("40400000-3e2c-0016-239b-08da581f0e74")).ToListAsync();
|
|
||||||
|
|
||||||
////await _repository.BatchDeleteAsync<ClinicalDataTrialSet>(t => t.TrialId == Guid.Parse("40400000-3e2c-0016-239b-08da581f0e74"));
|
|
||||||
|
|
||||||
//await _repository.AddRangeAsync(list, true);
|
|
||||||
|
|
||||||
//await _repository.SaveChangesAsync();
|
|
||||||
|
|
||||||
//await _repository.BatchUpdateAsync<DataInspection>(t => t.TrialId == Guid.Parse("40400000-3e2c-0016-239b-08da581f0e74") && t.EntityName== "ClinicalDataTrialSet", t => new DataInspection() { CreateTime= DateTime.Now.AddMonths(-2) } );
|
|
||||||
|
|
||||||
//await _visitTaskRepositoryy.UpdatePartialFromQueryAsync( Guid.Parse("78360000-3E2C-0016-9B53-08DA6A002040"), c => new VisitTask() { UpdateTime = DateTime.Now });
|
|
||||||
|
|
||||||
//await _visitTaskRepositoryy.UpdatePartialFromQueryAsync( Guid.Parse("78360000-3E2C-0016-9B53-08DA6A002040"), c => new VisitTask() { UpdateTime = DateTime.Now.AddMinutes(1) });
|
|
||||||
|
|
||||||
//var a = _userInfo.IsTestUser;
|
|
||||||
|
|
||||||
//var list1 = await _repository.Where<Dictionary>().Select(t => t.TranslateValue(t.Value, t.ValueCN, true)).ToListAsync();
|
|
||||||
//var list2 = await _repository.Where<Dictionary>().Select(t => t.TranslateValue(t.Value, t.ValueCN, false)).ToListAsync();
|
|
||||||
|
|
||||||
return "测试自动发布--再次提交";
|
return "测试自动发布--再次提交";
|
||||||
}
|
}
|
||||||
|
@ -273,15 +213,15 @@ namespace IRaCIS.Application.Services
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<object> GetEnvironmentName([FromServices] IWebHostEnvironment env)
|
public async Task<object> GetEnvironmentName([FromServices] IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
var a = IdentifierHelper.CreateGuid("123456");
|
//var a = IdentifierHelper.CreateGuid("123456");
|
||||||
|
|
||||||
var k = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes("123456"));
|
//var k = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes("123456"));
|
||||||
|
|
||||||
var c = MD5Helper.Md5("123456");
|
//var c = MD5Helper.Md5("123456");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return new { env.EnvironmentName, EMailConfig = _systemEmailConfig.CurrentValue, BasicConfig = _basicConfig.CurrentValue };
|
//return new { env.EnvironmentName, EMailConfig = _systemEmailConfig.CurrentValue, BasicConfig = _basicConfig.CurrentValue };
|
||||||
|
|
||||||
|
|
||||||
// Load a document.
|
// Load a document.
|
||||||
|
|
|
@ -89,7 +89,9 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
public List<ReadingClinicalData> ReadingClinicalDataList { get; set; }
|
public List<ReadingClinicalData> ReadingClinicalDataList { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
|
||||||
|
public List<ReadingConsistentClinicalData> ReadingConsistentClinicalDataList { get; set; }
|
||||||
|
|
||||||
//软删除
|
//软删除
|
||||||
public bool IsDeleted { get; set; }
|
public bool IsDeleted { get; set; }
|
||||||
|
|
|
@ -19,6 +19,13 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
||||||
.HasForeignKey(s => new { s.StudyId })
|
.HasForeignKey(s => new { s.StudyId })
|
||||||
.HasPrincipalKey(c => new { c.Id });
|
.HasPrincipalKey(c => new { c.Id });
|
||||||
|
|
||||||
|
|
||||||
|
builder
|
||||||
|
.HasMany(s => s.ReadingConsistentClinicalDataList)
|
||||||
|
.WithOne(c => c.DicomStudy)
|
||||||
|
.HasForeignKey(s => new { s.StudyId })
|
||||||
|
.HasPrincipalKey(c => new { c.Id });
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue