稽查优化修改
parent
071ad5acd5
commit
c00f7a6163
|
@ -52,7 +52,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
|
||||
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => taskIdList.Contains(t.Id), u => new VisitTask() { TaskState = TaskState.NotEffect });
|
||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(t => taskIdList.Contains(t.Id), u => new VisitTask() { TaskState = TaskState.NotEffect },true);
|
||||
|
||||
await _visitTaskRepository.SaveChangesAsync();
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
return ResponseOutput.NotOk("已签名的不允许设置为失效");
|
||||
}
|
||||
|
||||
await _taskMedicalReviewRepository.BatchUpdateNoTrackingAsync(t => command.MedicalReviewIdList.Contains(t.Id), c => new TaskMedicalReview() { IsInvalid = true });
|
||||
await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(t => command.MedicalReviewIdList.Contains(t.Id), c => new TaskMedicalReview() { IsInvalid = true },true);
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|||
|
||||
|
||||
await _visitTaskRepository
|
||||
.BatchUpdateNoTrackingAsync(updateWhere,
|
||||
.UpdatePartialFromQueryAsync(updateWhere,
|
||||
u => new VisitTask()
|
||||
{
|
||||
AllocateTime = DateTime.Now,
|
||||
|
@ -189,7 +189,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|||
|
||||
await _subjectUserRepository.DeleteFromQueryAsync(t => t.Id == command.Id);
|
||||
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState == ReadingTaskState.WaitReading && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false, u => new VisitTask()
|
||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.SubjectId == command.SubjectId && t.DoctorUserId == command.DoctorUserId && t.ArmEnum == command.ArmEnum && t.ReadingTaskState == ReadingTaskState.WaitReading && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false, u => new VisitTask()
|
||||
{
|
||||
AllocateTime = null,
|
||||
DoctorUserId = null,
|
||||
|
@ -2309,7 +2309,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|||
|
||||
//回退后,回退状态恢复
|
||||
sv.RequestBackState = RequestBackStateEnum.NotRequest;
|
||||
sv.IsCheckBack = true;
|
||||
sv.IsCheckBack = false;
|
||||
sv.CheckState = CheckStateEnum.None;
|
||||
sv.CheckChallengeState = CheckChanllengeTypeEnum.None;
|
||||
|
||||
|
|
|
@ -224,7 +224,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
JsonStr = x.JsonDetail,
|
||||
Identification = x.Identification,
|
||||
ObjectRelationParentId = x.ObjectRelationParentId,
|
||||
CreateTime=x.CreateTime
|
||||
ObjectRelationParentId2 = x.ObjectRelationParentId2,
|
||||
CreateTime = x.CreateTime,
|
||||
BatchId = x.BatchId,
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
|
@ -238,9 +241,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
//查询关联父层级数据
|
||||
if (item.Id == currentInspectionId)
|
||||
{
|
||||
//把父层级的数据的 CommonData 数据合并
|
||||
//把父层级的数据的 CommonData 数据合并(每一个层级把下面层级需要的数据放在CommonData 里面) 麻烦点是每个层级都需要记录一些信息,而且名称不能重复
|
||||
|
||||
var commonDataObjList = await GetRelationParentData(item.ObjectRelationParentId, item.CreateTime);
|
||||
var commonDataObjList = await GetRelationParentData(item.ObjectRelationParentId, item.ObjectRelationParentId2, item.CreateTime, item.BatchId);
|
||||
|
||||
var currentDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(jsonDict[nameof(InspectionJsonDetail.CommonData)].ToJsonStr());
|
||||
|
||||
|
@ -250,15 +253,31 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
foreach (var valuePair in otherDic)
|
||||
{
|
||||
if (currentDic.ContainsKey(valuePair.Key))
|
||||
//关联层级的数据
|
||||
if (valuePair.Key.Contains("_"))
|
||||
{
|
||||
currentDic[valuePair.Key] = valuePair.Value;
|
||||
var entityProperName = valuePair.Key.Split("_").ToList().Last();
|
||||
|
||||
if (!currentDic.ContainsKey(entityProperName))
|
||||
{
|
||||
currentDic.Add(entityProperName, valuePair.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!currentDic.ContainsKey(valuePair.Key))
|
||||
{
|
||||
currentDic.Add(valuePair.Key, valuePair.Value);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!currentDic.ContainsKey(valuePair.Key))
|
||||
{
|
||||
currentDic.Add(valuePair.Key, valuePair.Value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,7 +320,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
|
||||
private async Task<List<object>> GetRelationParentData(Guid? objectRelationParentId, DateTime createTime)
|
||||
private async Task<List<object>> GetRelationParentData(Guid? objectRelationParentId, Guid? objectRelationParentId2, DateTime createTime, Guid batchId)
|
||||
{
|
||||
|
||||
var objectLsit = new List<object>();
|
||||
|
@ -309,7 +328,50 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
if (objectRelationParentId != null)
|
||||
{
|
||||
var relationParentInspection = await _dataInspectionRepository.Where(t => t.GeneralId == objectRelationParentId && t.CreateTime <= createTime).OrderByDescending(x => x.CreateTime).Select(t => new { t.ObjectRelationParentId, t.CreateTime, t.JsonDetail }).FirstOrDefaultAsync();
|
||||
//父子层级的数据可能在同一个批次 进行更新 但是后插入的是父层级的数据 找父层级的稽查应该优先同一批次的
|
||||
var relationParentInspection = await _dataInspectionRepository.Where(t => t.GeneralId == objectRelationParentId && (t.CreateTime <= createTime || t.BatchId == batchId)).OrderByDescending(x => x.CreateTime).Select(t => new { t.ObjectRelationParentId, t.CreateTime, t.JsonDetail, t.BatchId, t.ObjectRelationParentId2, t.EntityName }).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
if (relationParentInspection != null)
|
||||
{
|
||||
Dictionary<string, object> jsonDic = JsonConvert.DeserializeObject<Dictionary<string, object>>(relationParentInspection.JsonDetail);
|
||||
|
||||
|
||||
var commonDataDicObj = jsonDic[nameof(InspectionJsonDetail.CommonData)];
|
||||
|
||||
objectLsit.Add(commonDataDicObj);
|
||||
|
||||
//避免对象信息记录 把 Data里面的信息也取过去 但是加上稽查对象的前缀
|
||||
var dataDicObj = jsonDic[nameof(InspectionJsonDetail.Data)];
|
||||
|
||||
if (dataDicObj != null)
|
||||
{
|
||||
var entityName = relationParentInspection.EntityName;
|
||||
|
||||
IDictionary<string, object> newNamepDic = new Dictionary<string, object>();
|
||||
|
||||
var tempDic = JsonConvert.DeserializeObject<Dictionary<string, object>>(dataDicObj.ToJsonStr());
|
||||
|
||||
foreach (var valuePair in tempDic)
|
||||
{
|
||||
newNamepDic.Add(entityName + "_" + valuePair.Key, valuePair.Value);
|
||||
}
|
||||
|
||||
|
||||
objectLsit.Add(newNamepDic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
await GetRelationParentData(relationParentInspection.ObjectRelationParentId, relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (objectRelationParentId2 != null)
|
||||
{
|
||||
//父子层级的数据可能在同一个批次 进行更新 但是后插入的是父层级的数据 找父层级的稽查应该优先同一批次的
|
||||
var relationParentInspection = await _dataInspectionRepository.Where(t => t.GeneralId == objectRelationParentId2 && (t.CreateTime <= createTime || t.BatchId == batchId)).OrderByDescending(x => x.CreateTime).Select(t => new { t.ObjectRelationParentId, t.CreateTime, t.JsonDetail, t.BatchId, t.ObjectRelationParentId2, t.EntityName }).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
if (relationParentInspection != null)
|
||||
|
@ -322,9 +384,43 @@ namespace IRaCIS.Core.Application.Service
|
|||
objectLsit.Add(commonDataDicObj);
|
||||
|
||||
|
||||
await GetRelationParentData(relationParentInspection.ObjectRelationParentId, relationParentInspection.CreateTime);
|
||||
//避免对象信息记录 把 Data里面的信息也取过去 但是加上稽查对象的前缀
|
||||
var dataDicObj = jsonDic[nameof(InspectionJsonDetail.Data)];
|
||||
|
||||
if (dataDicObj != null)
|
||||
{
|
||||
var entityName = relationParentInspection.EntityName;
|
||||
|
||||
IDictionary<string, object> newNamepDic = new Dictionary<string, object>();
|
||||
|
||||
var tempDic = JsonConvert.DeserializeObject<Dictionary<string, object>>(dataDicObj.ToJsonStr());
|
||||
|
||||
foreach (var valuePair in tempDic)
|
||||
{
|
||||
newNamepDic.Add(entityName + "_" + valuePair.Key, valuePair.Value);
|
||||
}
|
||||
|
||||
|
||||
objectLsit.Add(newNamepDic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
await GetRelationParentData(relationParentInspection.ObjectRelationParentId, relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId);
|
||||
}
|
||||
else
|
||||
{
|
||||
//用户的数据稽查没有 临时处理
|
||||
|
||||
var userObj = await _repository.Where<User>(t => t.Id == objectRelationParentId2).Select(t => new { UserFullName = t.FullName, t.UserName }).FirstOrDefaultAsync();
|
||||
|
||||
objectLsit.Add(userObj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return objectLsit;
|
||||
|
|
|
@ -98,6 +98,8 @@ namespace IRaCIS.Application.Services
|
|||
}).ToList();
|
||||
|
||||
entity.ReadingClinicalDataState = ReadingClinicalDataStatus.HaveUploaded;
|
||||
entity.IsBlind = null;
|
||||
entity.IsComplete = null;
|
||||
await _readingClinicalDataRepository.AddAsync(entity, true);
|
||||
var success = await _readingClinicalDataRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Ok(entity.Id);
|
||||
|
|
|
@ -307,7 +307,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
|
||||
var isSuccess = await _trialSiteUserRepository.UpdatePartialFromQueryAsync(id, u => new TrialSiteUser()
|
||||
{ IsDeleted = isDelete, DeletedTime = isDelete ? DateTime.Now : null },true);
|
||||
{ IsDeleted = isDelete, DeletedTime = isDelete ? DateTime.Now : null },true,true);
|
||||
|
||||
return ResponseOutput.Ok(isSuccess);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
public enum TrialType
|
||||
{
|
||||
|
||||
//非正式项目
|
||||
//正式项目
|
||||
OfficialTrial = 1,
|
||||
|
||||
NoneOfficial = 0,
|
||||
|
|
|
@ -143,6 +143,13 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// 稽查对象,关联的父对象Id
|
||||
/// </summary>
|
||||
public Guid? ObjectRelationParentId { get; set; }
|
||||
|
||||
public Guid? ObjectRelationParentId2 { get; set; }
|
||||
|
||||
|
||||
public string EntityName { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace IRaCIS.Core.Domain.Models
|
||||
{
|
||||
|
@ -11,11 +12,17 @@ namespace IRaCIS.Core.Domain.Models
|
|||
[Table("Subject")]
|
||||
public class Subject : Entity, IAuditAdd, IAuditUpdate, ISoftDelete
|
||||
{
|
||||
[JsonIgnore]
|
||||
public List<SubjectVisit> SubjectVisitList { get; set; } = new List<SubjectVisit>();
|
||||
|
||||
[JsonIgnore]
|
||||
public List<SubjectUser> SubjectDoctorList { get; set; } = new List<SubjectUser>();
|
||||
|
||||
[JsonIgnore]
|
||||
public List<VisitTask> SubjectVisitTaskList { get; set; } = new List<VisitTask>();
|
||||
[JsonIgnore]
|
||||
public List<ReadModule> ReadModuleList { get; set; }
|
||||
|
||||
public List<SubjectCanceDoctor> SubjectCanceDoctorList { get; set; }
|
||||
|
||||
|
||||
|
||||
[ForeignKey("FinalSubjectVisitId")]
|
||||
|
@ -85,7 +92,6 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public bool IsUrgent { get; set; }
|
||||
|
||||
|
||||
public List<ReadModule> ReadModuleList { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
public DateTime? DeletedTime { get; set; }
|
||||
|
||||
|
@ -93,7 +99,6 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
public bool IsReReadingOrBackInfluenceAnalysis { get; set; }
|
||||
|
||||
public List<SubjectCanceDoctor> SubjectCanceDoctorList { get; set; }
|
||||
|
||||
//是否分配了读片医生
|
||||
//public bool IsAssignDoctorUser{get;set;}
|
||||
|
|
|
@ -153,8 +153,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
ResearchProgramNo = x.ResearchProgramNo,
|
||||
}, new
|
||||
{
|
||||
ExperimentName = entity.ExperimentName,
|
||||
ResearchProgramNo = entity.ResearchProgramNo,
|
||||
|
||||
TrialDicList = string.Join(",", trialDics)
|
||||
}, item.OriginalValues);
|
||||
});
|
||||
}
|
||||
|
||||
// 访视计划
|
||||
|
@ -242,7 +245,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
{
|
||||
entity.Site = await _dbContext.Site.Where(x => x.Id == entity.SiteId).FirstOrDefaultAsync();
|
||||
}
|
||||
await InsertInspection<TrialSite>(entity, type,null, new
|
||||
await InsertInspection<TrialSite>(entity, type, null, new
|
||||
{
|
||||
TrialSiteCode = entity.TrialSiteCode,
|
||||
SiteName = entity.Site.SiteName,
|
||||
|
@ -359,7 +362,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
{
|
||||
var entity = item.Entity as TrialQCQuestion;
|
||||
var paretName = await _dbContext.TrialQCQuestionConfigure.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync();
|
||||
await InsertInspection<TrialQCQuestion>(entity, type,null, new
|
||||
await InsertInspection<TrialQCQuestion>(entity, type, null, new
|
||||
{
|
||||
QuestionName = entity.QuestionName,
|
||||
Type = entity.Type,
|
||||
|
@ -389,7 +392,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
{
|
||||
dicomStudy = await _dbContext.DicomStudys.AsNoTracking().FirstOrDefaultAsync(x => x.Id == entity.StudyId);
|
||||
}
|
||||
await InsertInspection<DicomSeries>(item.Entity as DicomSeries, type,null, new
|
||||
await InsertInspection<DicomSeries>(item.Entity as DicomSeries, type, null, new
|
||||
{
|
||||
StudyCode = dicomStudy?.StudyCode,
|
||||
Modalities = dicomStudy?.Modalities,
|
||||
|
@ -428,7 +431,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
filecount = filecount + count;
|
||||
}
|
||||
|
||||
await InsertInspection<NoneDicomStudy>(noneDicomStudy, type,null, new
|
||||
await InsertInspection<NoneDicomStudy>(noneDicomStudy, type, null, new
|
||||
{
|
||||
FileCount = filecount,
|
||||
});
|
||||
|
@ -437,29 +440,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
}
|
||||
|
||||
|
||||
// 访视
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectVisit)))
|
||||
{
|
||||
var entity = item.Entity as SubjectVisit;
|
||||
string reason = string.Empty;
|
||||
|
||||
if (_userInfo.RequestUrl.ToLower() == "qcoperation/setcheckpass")
|
||||
{
|
||||
reason = entity.ManualPassReason;
|
||||
}
|
||||
|
||||
|
||||
var subjectCode = entity.Subject?.Code;
|
||||
await InsertInspection<SubjectVisit>(item.Entity as SubjectVisit, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
SubjectCode = subjectCode,
|
||||
SubjectId = x.SubjectId,
|
||||
SubjectVisitId = x.Id,
|
||||
SubjectVisitName = x.VisitName,
|
||||
BlindName = x.BlindName,
|
||||
Reason = reason,
|
||||
});
|
||||
}
|
||||
|
||||
// 既往手术史
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(PreviousSurgery)))
|
||||
|
@ -581,7 +562,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
SubjectVisitId = subjectVisit.Id,
|
||||
GeneralId = subjectVisit.Id,
|
||||
//byzhouhang
|
||||
ObjectRelationParentId=subjectVisit.Id,
|
||||
ObjectRelationParentId = subjectVisit.Id,
|
||||
}, new
|
||||
{
|
||||
QcQuestionAnswerCommands = await Getdata(entitylist),
|
||||
|
@ -721,9 +702,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
GeneralId = x.Id,
|
||||
}, new
|
||||
{
|
||||
//父层级的数据 暂时没有记录稽查 所以这里必须查
|
||||
Name = doctor.FullName,
|
||||
ChineseName = doctor.ChineseName,
|
||||
Email = doctor.EMail,
|
||||
|
||||
|
||||
IsUploadedACKSOW = entity.AttachmentId != Guid.Empty
|
||||
});
|
||||
}
|
||||
|
@ -741,9 +725,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
GeneralId = enroll.Id,
|
||||
}, new
|
||||
{
|
||||
//父层级的数据 暂时没有记录稽查 所以这里必须查
|
||||
Name = enroll.Doctor.FullName,
|
||||
ChineseName = enroll.Doctor.ChineseName,
|
||||
Email = enroll.Doctor.EMail,
|
||||
|
||||
IsUploadedACKSOW = enroll.AttachmentId != Guid.Empty,
|
||||
ReadingCategoryList = list.Select(t => t.ReadingCategory).ToList()
|
||||
});
|
||||
}
|
||||
|
@ -761,10 +748,41 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
await InsertInspection<Subject>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
SubjectId = x.Id,
|
||||
SubjectCode = x.Code,
|
||||
//SubjectCode = x.Code,
|
||||
}, new
|
||||
{
|
||||
FinalSubjectVisitName = finalSubjectVisitName,
|
||||
SujectCode = entity.Code
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 访视
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectVisit)))
|
||||
{
|
||||
var entity = item.Entity as SubjectVisit;
|
||||
string reason = string.Empty;
|
||||
|
||||
if (_userInfo.RequestUrl.ToLower() == "qcoperation/setcheckpass")
|
||||
{
|
||||
reason = entity.ManualPassReason;
|
||||
}
|
||||
|
||||
var subjectCode = entity.Subject?.Code;
|
||||
|
||||
await InsertInspection<SubjectVisit>(item.Entity as SubjectVisit, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
ObjectRelationParentId = x.SubjectId,
|
||||
SubjectCode = subjectCode,
|
||||
SubjectId = x.SubjectId,
|
||||
SubjectVisitId = x.Id,
|
||||
//SubjectVisitName = x.VisitName,
|
||||
//BlindName = x.BlindName,
|
||||
Reason = reason,
|
||||
}, new
|
||||
{
|
||||
SubjectVisitName = entity.VisitName,
|
||||
BlindName = entity.BlindName,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -874,7 +892,122 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
#endregion
|
||||
|
||||
#region 阅片
|
||||
|
||||
//用户添加
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(User)))
|
||||
{
|
||||
var entity = item.Entity as User;
|
||||
|
||||
await InsertInspection<User>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
IsDistinctionInterface = false
|
||||
}, new
|
||||
{
|
||||
UserFullName = entity.FullName,
|
||||
entity.UserCode,
|
||||
entity.UserName
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//分配规则
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TaskAllocationRule)))
|
||||
{
|
||||
var entity = item.Entity as TaskAllocationRule;
|
||||
|
||||
await InsertInspection<TaskAllocationRule>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
IsDistinctionInterface = false,
|
||||
|
||||
ObjectRelationParentId = entity.EnrollId,
|
||||
|
||||
ObjectRelationParentId2 = entity.DoctorUserId
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// suject 医生绑定关系
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectUser)))
|
||||
{
|
||||
var entity = item.Entity as SubjectUser;
|
||||
|
||||
await InsertInspection<SubjectUser>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
IsDistinctionInterface = false,
|
||||
|
||||
ObjectRelationParentId = entity.SubjectId,
|
||||
|
||||
ObjectRelationParentId2 = entity.DoctorUserId
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//任务
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(VisitTask)))
|
||||
{
|
||||
var entity = item.Entity as VisitTask;
|
||||
|
||||
await InsertInspection<VisitTask>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
IsDistinctionInterface = type == AuditOpt.Update ? true : false,
|
||||
ObjectRelationParentId = entity.SourceSubjectVisitId != null ? entity.SourceSubjectVisitId : entity.SouceReadModuleId,
|
||||
|
||||
ObjectRelationParentId2 = entity.DoctorUserId
|
||||
|
||||
}); ;
|
||||
}
|
||||
|
||||
//申请重阅记录表
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(VisitTaskReReading)))
|
||||
{
|
||||
var entity = item.Entity as VisitTaskReReading;
|
||||
|
||||
await InsertInspection<VisitTaskReReading>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
|
||||
ObjectRelationParentId = entity.OriginalReReadingTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//医学审核
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TaskMedicalReview)))
|
||||
{
|
||||
var entity = item.Entity as TaskMedicalReview;
|
||||
|
||||
await InsertInspection<TaskMedicalReview>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
|
||||
ObjectRelationParentId = entity.VisitTaskId,
|
||||
|
||||
ObjectRelationParentId2 = entity.MedicalManagerUserId
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//一致性分析规则
|
||||
|
||||
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TaskConsistentRule)))
|
||||
{
|
||||
var entity = item.Entity as TaskConsistentRule;
|
||||
|
||||
await InsertInspection<TaskConsistentRule>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
|
||||
ObjectRelationParentId = entity.TrialId
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion
|
||||
|
@ -890,7 +1023,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
/// <param name="expression">表达式</param>
|
||||
/// <param name="otherItem">其他对象</param>
|
||||
/// <returns></returns>
|
||||
public async Task InsertInspection<T>(T entityObj, string type, Expression<Func<T, InspectionConvertDTO>> expression = null, object otherItem = null, object originaldata = null) where T : Entity
|
||||
public async Task InsertInspection<T>(T entityObj, string type, Expression<Func<T, InspectionConvertDTO>> expression = null, object otherItem = null) where T : Entity
|
||||
{
|
||||
|
||||
InspectionConvertDTO inspection = new InspectionConvertDTO();
|
||||
|
@ -905,7 +1038,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
}
|
||||
|
||||
//避免重复赋值 有些特殊的GeneralId
|
||||
var generalId = (inspection.GeneralId != null && inspection.GeneralId != Guid.Empty) ? inspection.GeneralId : entityObj.Id ;
|
||||
var generalId = (inspection.GeneralId != null && inspection.GeneralId != Guid.Empty) ? inspection.GeneralId : entityObj.Id;
|
||||
inspection.GeneralId = generalId;
|
||||
|
||||
inspection.Identification = await GetInspectionRecordIdentificationAsync(entityObj, type, inspection.IsDistinctionInterface);
|
||||
|
@ -932,7 +1065,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
//inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.TrialId == inspection.TrialId && x.SubjectVisitId == inspection.SubjectVisitId && x.SubjectId == inspection.SubjectId && x.SiteId == inspection.SiteId && x.GeneralId == inspection.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
|
||||
|
||||
|
||||
inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.GeneralId == inspection.GeneralId && x.ObjectRelationParentId== inspection.ObjectRelationParentId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
|
||||
inspection.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.GeneralId == inspection.GeneralId && x.ObjectRelationParentId == inspection.ObjectRelationParentId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
|
||||
}
|
||||
inspection.CreateUserId = _userInfo.Id;
|
||||
inspection.IP = _userInfo.IP;
|
||||
|
@ -944,20 +1077,29 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
inspection.IsSign = true;
|
||||
}
|
||||
|
||||
var entityName= entityObj.GetType().Name;
|
||||
|
||||
inspection.JsonDetail = new InspectionJsonDetail
|
||||
{
|
||||
//稽查实体,加上扩充的信息
|
||||
Data = AddJsonItem(entityObj, otherItem),
|
||||
//Data = AddJsonItem(entityObj, otherItem),
|
||||
|
||||
//通用信息 每条稽查必须记录的
|
||||
CommonData = generalData
|
||||
//CommonData = generalData
|
||||
|
||||
EntityName = entityName,
|
||||
|
||||
Data = entityObj,
|
||||
|
||||
CommonData = AddJsonItem(generalData, otherItem)
|
||||
|
||||
}.ToJsonStr();
|
||||
|
||||
inspection.BatchId = _userInfo.BatchId.Value;
|
||||
|
||||
await _dbContext.DataInspection.AddAsync(inspection );
|
||||
inspection.EntityName = entityName;
|
||||
|
||||
await _dbContext.DataInspection.AddAsync(inspection);
|
||||
|
||||
|
||||
//await AddInspectionRecordAsync( entityObj, inspection, otherItem);
|
||||
|
@ -1018,25 +1160,25 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
|
||||
#region 访视 阅片期那里关联了访视
|
||||
|
||||
if (generalData.SubjectVisitId != null)
|
||||
{
|
||||
//添加访视的时候,会带信息过来
|
||||
if (string.IsNullOrEmpty(generalData.SubjectVisitName))
|
||||
{
|
||||
var info = (await _dbContext.SubjectVisit.Where(x => x.Id == generalData.SubjectVisitId).Select(x =>
|
||||
new { x.VisitName, x.SubjectId, x.SiteId, SubjectCode = x.Subject.Code, TrialSiteCode = x.TrialSite.TrialSiteCode, x.TrialId, x.Trial.ExperimentName, x.Trial.ResearchProgramNo }).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
//if (generalData.SubjectVisitId != null)
|
||||
//{
|
||||
// //添加访视的时候,会带信息过来
|
||||
// if (string.IsNullOrEmpty(generalData.SubjectVisitName))
|
||||
// {
|
||||
// var info = (await _dbContext.SubjectVisit.Where(x => x.Id == generalData.SubjectVisitId).Select(x =>
|
||||
// new { x.VisitName, x.SubjectId, x.SiteId, SubjectCode = x.Subject.Code, TrialSiteCode = x.TrialSite.TrialSiteCode, x.TrialId, x.Trial.ExperimentName, x.Trial.ResearchProgramNo }).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
generalData.SubjectVisitName = info.VisitName;
|
||||
// generalData.SubjectVisitName = info.VisitName;
|
||||
|
||||
generalData.TrialId = info.TrialId;
|
||||
generalData.TrialName = info.ExperimentName;
|
||||
generalData.ResearchProgramNo = info.ResearchProgramNo;
|
||||
generalData.SiteId = info.SiteId;
|
||||
generalData.SubjectCode = info.SubjectCode;
|
||||
generalData.SubjectId = info.SubjectId;
|
||||
generalData.SiteCode = info.TrialSiteCode;
|
||||
}
|
||||
}
|
||||
// generalData.TrialId = info.TrialId;
|
||||
// generalData.TrialName = info.ExperimentName;
|
||||
// generalData.ResearchProgramNo = info.ResearchProgramNo;
|
||||
// generalData.SiteId = info.SiteId;
|
||||
// generalData.SubjectCode = info.SubjectCode;
|
||||
// generalData.SubjectId = info.SubjectId;
|
||||
// generalData.SiteCode = info.TrialSiteCode;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
#endregion
|
||||
|
@ -1178,9 +1320,128 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
{
|
||||
}
|
||||
break;
|
||||
|
||||
//确认重阅 区分用户类型
|
||||
case "visittask/confirmrereading":
|
||||
|
||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
|
||||
{
|
||||
type = type + "/" + 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
type = type + "/" + 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case nameof(VisitTask):
|
||||
|
||||
var visitTask = entityObj as VisitTask;
|
||||
|
||||
switch (_userInfo.RequestUrl)
|
||||
{
|
||||
//申请重阅
|
||||
case "VisitTask/applyReReading":
|
||||
type = type + "/" + (int)visitTask.ReReadingApplyState;
|
||||
break;
|
||||
//同意重阅
|
||||
case "VisitTask/ConfirmReReading":
|
||||
|
||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
|
||||
{
|
||||
type = type + "/" + 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
type = type + "/" + 2;
|
||||
}
|
||||
|
||||
|
||||
if (visitTask.ReReadingApplyState == ReReadingApplyState.Agree)
|
||||
{
|
||||
type = type + "/" + 1;
|
||||
|
||||
}
|
||||
else if (visitTask.ReReadingApplyState == ReReadingApplyState.Reject)
|
||||
{
|
||||
type = type + "/" + 2;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (type == AuditOpt.Add)
|
||||
{
|
||||
//生成一致性分析任务
|
||||
if (visitTask.IsSelfAnalysis == true)
|
||||
{
|
||||
type = type + "/" + "SelfAnalysis";
|
||||
}
|
||||
else if (visitTask.IsSelfAnalysis == false)
|
||||
{
|
||||
type = type + "/" + "GroupAnalysis";
|
||||
}
|
||||
else
|
||||
{
|
||||
type = type + "/" + "NotAnalysis";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case nameof(VisitTaskReReading):
|
||||
|
||||
var visitTaskReReading = entityObj as VisitTaskReReading;
|
||||
|
||||
switch (_userInfo.RequestUrl)
|
||||
{
|
||||
case "VisitTask/applyReReading":
|
||||
type = type + "/" + (int)visitTaskReReading.RequestReReadingType;
|
||||
break;
|
||||
|
||||
case "VisitTask/ConfirmReReading":
|
||||
|
||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
|
||||
{
|
||||
type = type + "/" + 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
type = type + "/" + 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case nameof(TaskConsistentRule):
|
||||
|
||||
var taskConsistentRule = entityObj as TaskConsistentRule;
|
||||
|
||||
//自身一致性分析
|
||||
if (taskConsistentRule.IsSelfAnalysis == true)
|
||||
{
|
||||
type = type + "/" + 1;
|
||||
|
||||
}
|
||||
//组件一致性分析
|
||||
else
|
||||
{
|
||||
type = type + "/" + 2;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -30,6 +30,14 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto
|
|||
|
||||
public Guid? ObjectRelationParentId { get; set; }
|
||||
|
||||
public Guid? ObjectRelationParentId2 { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 批次Id
|
||||
/// </summary>
|
||||
public Guid BatchId { get; set; }
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
|
||||
|
@ -92,9 +100,10 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto
|
|||
/// </summary>
|
||||
public class InspectionJsonDetail
|
||||
{
|
||||
public string EntityName { get; set; }
|
||||
public object Data { get; set; }
|
||||
|
||||
public InspectionGeneralData CommonData { get; set; }
|
||||
public object CommonData { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace IRaCIS.Core.Infrastructure.Extention
|
|||
public static string ToJsonStr(this object obj)
|
||||
{
|
||||
|
||||
return JsonConvert.SerializeObject(obj, new JsonSerializerSettings { DateFormatString = "yyyy-MM-dd HH:mm:ss", ReferenceLoopHandling = ReferenceLoopHandling.Ignore });
|
||||
return JsonConvert.SerializeObject(obj, new JsonSerializerSettings { DateFormatString = "yyyy-MM-dd HH:mm:ss", ReferenceLoopHandling = ReferenceLoopHandling.Ignore, NullValueHandling = NullValueHandling.Ignore });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue