修改Dicom影像上传信息
parent
34a5532ee2
commit
e395e105cb
|
@ -188,6 +188,8 @@ namespace IRaCIS.Api.Controllers
|
|||
section = await reader.ReadNextSectionAsync();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (archivedStudyIds.Count > 0) // 上传成功,处理逻辑
|
||||
{
|
||||
|
||||
|
@ -228,6 +230,13 @@ namespace IRaCIS.Api.Controllers
|
|||
keyValuePairs.Add("StyudCode", studycode);
|
||||
data.JsonDetail = _inspectionService.AddJsonItem(data.JsonDetail, keyValuePairs);
|
||||
await _inspectionService.AddInspectionRecordAsync(data);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
section = await reader.ReadNextSectionAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -152,23 +152,7 @@ namespace IRaCIS.Application.Services
|
|||
_ = _dicomStudyMonitorRepository.AddAsync(monitor).Result;
|
||||
_ = _studyRepository.SaveChangesAsync().Result;
|
||||
|
||||
// 这里上传dicom影像之后修改之后修改访视的状态
|
||||
_inspectionService.AddInspectionRecordAsync(new DataInspectionAddDTO()
|
||||
{
|
||||
SiteId = subjectVisit.SiteId,
|
||||
SubjectId = subjectVisit.SubjectId,
|
||||
IsSign = false,
|
||||
VisitStageId = subjectVisit.VisitStageId,
|
||||
SubjectVisitName = subjectVisit.VisitName,
|
||||
BlindName = subjectVisit.BlindName,
|
||||
SubjectVisitId = subjectVisit.Id,
|
||||
Identification = "Edit|Visit|Status|Visit-Image Upload",
|
||||
JsonDetail= JsonConvert.SerializeObject(new {
|
||||
SubmitState= subjectVisit.SubmitState,
|
||||
|
||||
})
|
||||
|
||||
}).Wait();
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.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<T> SqlQuery<T>(this DatabaseFacade facade, string sql, params object[] parameters) where T : class, new()
|
||||
{
|
||||
DataTable dt = SqlQuery(facade, sql, parameters);
|
||||
return dt.ToEnumerable<T>();
|
||||
}
|
||||
|
||||
public static IEnumerable<T> ToEnumerable<T>(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.IsSqlServer())
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -545,6 +545,70 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
#region 稽查
|
||||
|
||||
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param name="Identification"></param>
|
||||
///// <param name="json"></param>
|
||||
///// <returns></returns>
|
||||
//public async Task<string> SetDictionaryValue(string Identification, string json)
|
||||
//{
|
||||
|
||||
|
||||
//}
|
||||
|
||||
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param name="Table"></param>
|
||||
///// <param name="ForeignKeyValue"></param>
|
||||
///// <param name="ForeignKeyText"></param>
|
||||
///// <param name="value"></param>
|
||||
///// <returns></returns>
|
||||
//public async Task<string> 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<IDictionary<string, object>>(item);
|
||||
// if (JsonData["item"].GetType() == typeof(JArray))
|
||||
// {
|
||||
// foreach (var v in JsonData["item"] as JArray)
|
||||
// {
|
||||
// para += para == string.Empty ? $"'{v}'" : $",'{v}'";
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
// 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);
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取枚举
|
||||
|
|
Loading…
Reference in New Issue