diff --git a/IRaCIS.Core.API/Controllers/InspectionController.cs b/IRaCIS.Core.API/Controllers/InspectionController.cs
index 174c4b5c2..b7e4df48a 100644
--- a/IRaCIS.Core.API/Controllers/InspectionController.cs
+++ b/IRaCIS.Core.API/Controllers/InspectionController.cs
@@ -82,6 +82,13 @@ namespace IRaCIS.Core.API.Controllers
this._dataInspectionRepository = dataInspectionRepository;
}
+
+ //[HttpPost, Route("Inspection/Test")]
+ //public async Task Test(string Table, string ForeignKeyValue, string ForeignKeyText, string value)
+ //{
+ // string a= await _dataInspectionRepository.GetDictionaryValue(Table, ForeignKeyValue, ForeignKeyText, value);
+ //}
+
#region 文件管理
///
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index fc0317acc..7c17f99d6 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -44,6 +44,13 @@
FrontAuditConfigService
+
+
+ 翻译稽查数据
+
+
+
+
获取子数据
@@ -203,6 +210,11 @@
用户 签名某个文档 Dto
+
+
+ 父标识
+
+
项目iD
@@ -305,12 +317,6 @@
字典
-
-
- 处理枚举
-
-
-
设置项目以及名称
diff --git a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs
index bc5c1dc1a..a08468436 100644
--- a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs
@@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using Castle.Core.Internal;
+using IRaCIS.Core.Infra.EFCore.Dto;
namespace IRaCIS.Core.Application.Service
{
@@ -26,6 +27,17 @@ namespace IRaCIS.Core.Application.Service
_frontAuditConfigRepository = frontAuditConfigRepository;
}
+ ///
+ /// 翻译稽查数据
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task> SetDictionaryValue(SetDictionaryValueDto dto)
+ {
+ return await _frontAuditConfigRepository.SetDictionaryValue(dto);
+ }
+
///
/// 获取子数据
///
diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs
index 342654556..af83f6698 100644
--- a/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs
+++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DicomArchiveService.cs
@@ -430,8 +430,8 @@ namespace IRaCIS.Core.Application.Services
SiteId = dicomStudy.SiteId,
TrialId = dicomStudy.TrialId,
SubjectId = dicomStudy.SubjectId,
- IsDeleted=false,
- IsReading=false,
+ IsDeleted=true,
+ IsReading= true,
SubjectVisitId = dicomStudy.SubjectVisitId,
InstanceCount = 0
diff --git a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs
index e25097410..86d754822 100644
--- a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs
+++ b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs
@@ -363,6 +363,11 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
public decimal? VisitNum { get; set; }
+ ///
+ /// 父标识
+ ///
+ public string ParentIdentification { get; set; }
+
}
diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs
index 59f9aa672..309117805 100644
--- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs
+++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs
@@ -3,6 +3,7 @@ using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Service.Inspection.DTO;
using IRaCIS.Core.Application.Service.Inspection.Interface;
using IRaCIS.Core.Domain.Share;
+using IRaCIS.Core.Infra.EFCore.Dto;
using IRaCIS.Core.Infrastructure;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
@@ -29,6 +30,9 @@ namespace IRaCIS.Core.Application.Service.Inspection
this._dataInspectionRepository = dataInspectionRepository;
this._frontAuditConfigRepository = frontAuditConfigRepository;
}
+
+
+
public async Task> GetInspectionData(GetDataInspectionDto dto)
{
//_repository.GetQueryable.GetQueryable < DataInspection >
@@ -84,7 +88,8 @@ namespace IRaCIS.Core.Application.Service.Inspection
} into frontAuditConfigtemp
from leftfrontAuditConfig in frontAuditConfigtemp.DefaultIfEmpty()
-
+
+
join moduleTypec in _repository.GetQueryable() on new { ModuleType = leftfrontAuditConfig.ModuleTypeId } equals new { ModuleType = moduleTypec.Id.ToString() } into moduleTypectemp
from leftmoduleTypec in moduleTypectemp.DefaultIfEmpty()
@@ -134,7 +139,8 @@ namespace IRaCIS.Core.Application.Service.Inspection
ModuleTypeName= leftmoduleTypec.ValueCN,
SignText= lefttrialSign.SignText,
Identification= leftfrontAuditConfig.Identification,
- OptType= leftOptType.Value,
+ ParentIdentification = leftparent.Identification,
+ OptType = leftOptType.Value,
VisitNum=leftsubjectVisit.VisitNum,
IsFrontAdd=data.IsFrontAdd
@@ -292,7 +298,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
{
return ResponseOutput.Ok();
}
- await SetEnum(addDto);
+ //await SetEnum(addDto);
var add = _mapper.Map(addDto);
await SetInspectionNameValue(add);
Guid? parentId = null;
@@ -395,114 +401,113 @@ namespace IRaCIS.Core.Application.Service.Inspection
}
- ///
- /// 处理枚举
- ///
- ///
+ /////
+ ///// 处理枚举
+ /////
+ /////
+ //public async Task SetEnum(DataInspectionAddDTO Data)
+ //{
+ // //Data.JsonDetail= await _dataInspectionRepository.SetEnum(Data.TrialId.Value, Data.Identification, Data.JsonDetail);
+ // #region 枚举
+ // //try
+ // //{
+ // // var JsonData = JsonConvert.DeserializeObject>(Data.JsonDetail);
+ // // foreach (var item in Data.EnumList)
+ // // {
+ // // if (!JsonData.ContainsKey(item.Key))
+ // // {
+ // // continue;
+ // // }
+ // // var value = JsonData[item.Key];
+ // // if (value.GetType() == typeof(JArray))
+ // // {
+ // // JArray arrays = (JArray)value;
+ // // if (item.Type.ToLower() == "id".ToLower())
+ // // {
+ // // List guids = new List();
+ // // arrays.ForEach(x =>
+ // // {
+ // // guids.Add(Guid.Parse(x.ToString()));
+ // // });
+ // // JsonData[item.Key] = string.Join(',', await _repository.GetQueryable().Where(x => guids.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync());
+ // // }
+ // // else if (item.Type.ToLower() == "ChildGroup".ToLower())
+ // // {
+ // // List guids = new List();
+ // // arrays.ForEach(x =>
+ // // {
+ // // guids.Add(x.ToString());
+ // // });
+ // // JsonData[item.Key] = string.Join(',', await
+ // // _repository.GetQueryable().Where(x => x.Code == item.Code).GroupJoin(
+ // // _repository.GetQueryable().Where(x => guids.Contains(x.ChildGroup)), a => a.Id, b => b.ParentId, (a, b) => new
+ // // {
+ // // parent = b
+ // // }).SelectMany(a => a.parent, (m, n) => new
+ // // {
+ // // value = n.ValueCN
+ // // }).Select(x => x.value).ToListAsync()
+ // // );
+ // // }
+ // // else
+ // // {
+ // // List guids =new List();
+ // // arrays.ForEach(x =>
+ // // {
+ // // guids.Add(x.ToString());
+ // // });
+ // // JsonData[item.Key] = string.Join(',', await
+ // // _repository.GetQueryable().Where(x => x.Code == item.Code).GroupJoin(
+ // // _repository.GetQueryable().Where(x=>guids.Contains(x.Code)), a => a.Id, b => b.ParentId, (a, b) => new
+ // // {
+ // // parent = b
+ // // }).SelectMany(a => a.parent, (m, n) => new
+ // // {
+ // // value = n.ValueCN
+ // // }).Select(x => x.value).ToListAsync()
+ // // );
+ // // }
+ // // }
+ // // else
+ // // {
+ // // if (item.Type.ToLower() == "id".ToLower())
+ // // {
+ // // Guid guid = Guid.Parse(value.ToString());
+ // // JsonData[item.Key] = await _repository.GetQueryable().Where(x => guid == x.Id).Select(x => x.ValueCN).FirstOrDefaultAsync();
+ // // }
+ // // else if (item.Type.ToLower() == "ChildGroup".ToLower())
+ // // {
+ // // JsonData[item.Key] = await _repository.GetQueryable().Where(x => x.Code == item.Code).Join(_repository.GetQueryable().Where(x => x.ChildGroup == value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new
+ // // {
+ // // value = b.ValueCN
+ // // }).Select(x => x.value).FirstOrDefaultAsync();
+ // // }
+ // // else
+ // // {
+ // // JsonData[item.Key] = await _repository.GetQueryable().Where(x=>x.Code==item.Code).Join(_repository.GetQueryable().Where(x=>x.Code== value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new
+ // // {
+ // // value=b.ValueCN
+ // // }).Select(x=>x.value).FirstOrDefaultAsync();
- public async Task SetEnum(DataInspectionAddDTO Data)
- {
- Data.JsonDetail= await _dataInspectionRepository.SetEnum(Data.TrialId.Value, Data.Identification, Data.JsonDetail);
- #region 枚举
- //try
- //{
- // var JsonData = JsonConvert.DeserializeObject>(Data.JsonDetail);
- // foreach (var item in Data.EnumList)
- // {
- // if (!JsonData.ContainsKey(item.Key))
- // {
- // continue;
- // }
- // var value = JsonData[item.Key];
- // if (value.GetType() == typeof(JArray))
- // {
- // JArray arrays = (JArray)value;
- // if (item.Type.ToLower() == "id".ToLower())
- // {
- // List guids = new List();
- // arrays.ForEach(x =>
- // {
- // guids.Add(Guid.Parse(x.ToString()));
- // });
- // JsonData[item.Key] = string.Join(',', await _repository.GetQueryable().Where(x => guids.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync());
- // }
- // else if (item.Type.ToLower() == "ChildGroup".ToLower())
- // {
- // List guids = new List();
- // arrays.ForEach(x =>
- // {
- // guids.Add(x.ToString());
- // });
- // JsonData[item.Key] = string.Join(',', await
- // _repository.GetQueryable().Where(x => x.Code == item.Code).GroupJoin(
- // _repository.GetQueryable().Where(x => guids.Contains(x.ChildGroup)), a => a.Id, b => b.ParentId, (a, b) => new
- // {
- // parent = b
- // }).SelectMany(a => a.parent, (m, n) => new
- // {
- // value = n.ValueCN
- // }).Select(x => x.value).ToListAsync()
- // );
- // }
- // else
- // {
- // List guids =new List();
- // arrays.ForEach(x =>
- // {
- // guids.Add(x.ToString());
- // });
- // JsonData[item.Key] = string.Join(',', await
- // _repository.GetQueryable().Where(x => x.Code == item.Code).GroupJoin(
- // _repository.GetQueryable().Where(x=>guids.Contains(x.Code)), a => a.Id, b => b.ParentId, (a, b) => new
- // {
- // parent = b
- // }).SelectMany(a => a.parent, (m, n) => new
- // {
- // value = n.ValueCN
- // }).Select(x => x.value).ToListAsync()
- // );
- // }
- // }
- // else
- // {
- // if (item.Type.ToLower() == "id".ToLower())
- // {
- // Guid guid = Guid.Parse(value.ToString());
- // JsonData[item.Key] = await _repository.GetQueryable().Where(x => guid == x.Id).Select(x => x.ValueCN).FirstOrDefaultAsync();
- // }
- // else if (item.Type.ToLower() == "ChildGroup".ToLower())
- // {
- // JsonData[item.Key] = await _repository.GetQueryable().Where(x => x.Code == item.Code).Join(_repository.GetQueryable().Where(x => x.ChildGroup == value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new
- // {
- // value = b.ValueCN
- // }).Select(x => x.value).FirstOrDefaultAsync();
- // }
- // else
- // {
- // JsonData[item.Key] = await _repository.GetQueryable().Where(x=>x.Code==item.Code).Join(_repository.GetQueryable().Where(x=>x.Code== value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new
- // {
- // value=b.ValueCN
- // }).Select(x=>x.value).FirstOrDefaultAsync();
-
- // }
- // }
- // }
+ // // }
+ // // }
+ // // }
- // Data.JsonDetail = JsonConvert.SerializeObject(JsonData);
+ // // Data.JsonDetail = JsonConvert.SerializeObject(JsonData);
- //}
- //catch (Exception)
- //{
+ // //}
+ // //catch (Exception)
+ // //{
- // throw new BusinessValidationFailedException("Json 对象枚举异常");
- //}
+ // // throw new BusinessValidationFailedException("Json 对象枚举异常");
+ // //}
- #endregion
- }
+ // #endregion
+ //}
///
diff --git a/IRaCIS.Core.Infra.EFCore/Common/EFSqlQuery.cs b/IRaCIS.Core.Infra.EFCore/Common/EFSqlQuery.cs
index 58b9c353d..38c84a998 100644
--- a/IRaCIS.Core.Infra.EFCore/Common/EFSqlQuery.cs
+++ b/IRaCIS.Core.Infra.EFCore/Common/EFSqlQuery.cs
@@ -4,7 +4,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -74,6 +74,8 @@ namespace IRaCIS.Core.Infra.EFCore
parameter.ParameterName = $"@{parameter.ParameterName}";
command.Parameters.Add(parameter);
}
+
+
}
}
}
diff --git a/IRaCIS.Core.Infra.EFCore/Dto/ForeignKey.cs b/IRaCIS.Core.Infra.EFCore/Dto/ForeignKey.cs
new file mode 100644
index 000000000..0897bed45
--- /dev/null
+++ b/IRaCIS.Core.Infra.EFCore/Dto/ForeignKey.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace IRaCIS.Core.Infra.EFCore.Dto
+{
+ public class ForeignKey
+ {
+ public string Text { get; set; }
+ }
+}
diff --git a/IRaCIS.Core.Infra.EFCore/Dto/SetDictionaryValueDto.cs b/IRaCIS.Core.Infra.EFCore/Dto/SetDictionaryValueDto.cs
new file mode 100644
index 000000000..b24bf8393
--- /dev/null
+++ b/IRaCIS.Core.Infra.EFCore/Dto/SetDictionaryValueDto.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace IRaCIS.Core.Infra.EFCore.Dto
+{
+ public class SetDictionaryValueDto
+ {
+ public Guid Trial { get; set; }
+
+ public List Items { get; set; }
+
+ }
+
+ public class SetDictionaryDto
+ {
+ public string Identification { get; set; }
+
+ public string Json { get; set; }
+ }
+
+
+
+
+
+
+}
diff --git a/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs b/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs
index f860395ed..63d4bb1dc 100644
--- a/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs
+++ b/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs
@@ -13,6 +13,7 @@ using System.Linq.Expressions;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using IRaCIS.Core.Domain.Share;
+using IRaCIS.Core.Infra.EFCore.Dto;
namespace IRaCIS.Core.Infra.EFCore
{
@@ -48,6 +49,25 @@ namespace IRaCIS.Core.Infra.EFCore
///
Task SetEnum(Guid trial, string Identification, string json);
+
+
+ ///
+ /// 获取外键表数据
+ ///
+ /// 表名称
+ /// 外键value
+ /// 要查询的外键值
+ /// 传入的纸
+ ///
+ Task GetDictionaryValue(string Identification, string json);
+
+
+ ///
+ /// 翻译稽查数据
+ ///
+ /// 传入Dto
+ ///
+ Task> SetDictionaryValue(SetDictionaryValueDto dto);
}
diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
index 2cbf67235..365f41734 100644
--- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
+++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
@@ -564,69 +564,78 @@ namespace IRaCIS.Core.Infra.EFCore
#region 稽查
- /////
- /////
- /////
- /////
- /////
- /////
- //public async Task SetDictionaryValue(string Identification, string json)
- //{
-
+ ///
+ /// 翻译稽查数据
+ ///
+ /// 传入Dto
+ ///
+ public async Task> SetDictionaryValue(SetDictionaryValueDto dto)
+ {
+
+ foreach (var item in dto.Items)
+ {
+ item.Json = await GetDictionaryValue(item.Identification,item.Json);
+ item.Json = await SetEnum(dto.Trial, item.Identification, item.Json);
+ }
- //}
+ return dto.Items.Select(x=>x.Json).ToList();
+ }
- /////
- /////
- /////
- /////
- /////
- /////
- /////
- /////
- //public async Task GetDictionaryValue(string Table,string ForeignKeyValue,string ForeignKeyText,string value)
- //{
- // string para = string.Empty;
- // string sql = string.Empty;
- // string item = JsonConvert.SerializeObject(new {
- // item = value
- // });
- // var JsonData = JsonConvert.DeserializeObject>(item);
- // if (JsonData["item"].GetType() == typeof(JArray))
- // {
- // foreach (var v in JsonData["item"] as JArray)
- // {
- // para += para == string.Empty ? $"'{v}'" : $",'{v}'";
- // }
+ ///
+ /// 获取外键表数据
+ ///
+ /// 表名称
+ /// 外键value
+ /// 要查询的外键值
+ /// 传入的纸
+ ///
+ public async Task GetDictionaryValue(string Identification, string json)
+ {
+ var list = await (from u in _dbContext.FrontAuditConfig.Where(x => x.Identification == Identification)
+ join p in _dbContext.FrontAuditConfig.Where(x => x.EnumType == "Foreign") on u.Id equals p.ParentId
+ select new
+ {
+ Key = p.Code,
+ ForeignKeyValue = p.ForeignKeyValue,
+ ForeignKeyText = p.ForeignKeyText,
+ ForeignKeyTable = p.ForeignKeyTable
+ }).ToListAsync();
+ var JsonDataValue = JsonConvert.DeserializeObject>(json);
+ foreach (var item in list)
+ {
+ if (!JsonDataValue.ContainsKey(item.Key))
+ {
+ continue;
+ }
+ string Table = item.ForeignKeyTable;
+ string ForeignKeyValue = item.ForeignKeyValue; string ForeignKeyText = item.ForeignKeyText;
+ string value = JsonDataValue[item.Key].ToString();
+ string para = string.Empty;
+ string sql = string.Empty;
+ var JsonData = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(new { item = value }));
+ if (JsonData["item"].GetType() == typeof(JArray))
+ {
+ foreach (var v in JsonData["item"] as JArray)
+ {
+ para += para == string.Empty ? $"'{v.ToString()}'" : $",'{v.ToString()}'";
+ }
+ sql = $"select {ForeignKeyText} Text from {Table} where {ForeignKeyValue} in (@para)";
+ }
+ else
+ {
+ para = $"{JsonData["item"].ToString()}";
+ sql = $"select {ForeignKeyText} Text from {Table} where {ForeignKeyValue} = @para";
+ }
+ SqlParameter[] paravalue = new SqlParameter[] {
+ new SqlParameter("@para",para)
+ };
+ JsonDataValue[item.Key] = string.Join(",", _dbContext.Database.SqlQuery(sql, paravalue).Select(x => x.Text).ToList());
+ }
+ return JsonConvert.SerializeObject(JsonDataValue);
- // }
- // else
- // {
-
- // }
-
-
-
- // //Type type = typeof(TFrom);
-
- // ////以下是不要ID这个字段的 比如自增列ID 就不能像上名那样写
- // //var properties = type.GetProperties().Where(t => t.Name != "Id");
-
-
- // //string strSqlName = string.Join(",", properties.Select(p => $"[{p.Name}]").ToArray());
-
- // //string strSqlValue = string.Join(",", properties.Select(P => $"@{P.Name}").ToArray());
-
- // //string strSql = $"insert into {nameof(Dictionary)} ( " + strSqlName + " ) values (" + strSqlValue + ")";
-
- // ////para Sql是参数
- // //SqlParameter[] para = properties.Select(p => new SqlParameter($"@{p.Name}", p.GetValue(from, null))).ToArray();
-
- // _dbContext.Database.SqlQuery<>
- // //_dbContext.Database.ExecuteSqlRaw(strSql, para);
- //}
+ }
///
@@ -658,11 +667,12 @@ namespace IRaCIS.Core.Infra.EFCore
Type = "Code",
});
- try
+ var JsonData = JsonConvert.DeserializeObject>(json);
+ foreach (var item in list)
{
- var JsonData = JsonConvert.DeserializeObject>(json);
- foreach (var item in list)
+ try
{
+
if (!JsonData.ContainsKey(item.Key))
{
continue;
@@ -741,17 +751,18 @@ namespace IRaCIS.Core.Infra.EFCore
}
}
}
+ catch (Exception)
+ {
-
-
- return JsonConvert.SerializeObject(JsonData);
-
+ //throw new BusinessValidationFailedException("Json 对象枚举异常");
+ }
}
- catch (Exception)
- {
- throw new BusinessValidationFailedException("Json 对象枚举异常");
- }
+
+
+ return JsonConvert.SerializeObject(JsonData);
+
+
}
@@ -895,7 +906,7 @@ namespace IRaCIS.Core.Infra.EFCore
{
add.CreateTime = DateTime.Now;
}
- add.JsonDetail = await SetEnum(add.TrialId, add.Identification, add.JsonDetail);
+ //add.JsonDetail = await SetEnum(add.TrialId, add.Identification, add.JsonDetail);
await SetDataInspectionDateType(add);
}