修改一版
							parent
							
								
									7afe552061
								
							
						
					
					
						commit
						d21b8c024c
					
				| 
						 | 
				
			
			@ -231,7 +231,7 @@ namespace IRaCIS.Api.Controllers
 | 
			
		|||
                Dictionary<string, object> keyValuePairs = new Dictionary<string, object>();
 | 
			
		||||
                keyValuePairs.Add("StyudCode", studycode);
 | 
			
		||||
                data.JsonDetail = _inspectionService.AddJsonItem(data.JsonDetail, keyValuePairs);
 | 
			
		||||
                await _inspectionService.AddInspectionRecordAsync(data);
 | 
			
		||||
                //await _inspectionService.AddInspectionRecordAsync(data);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception e)
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -137,7 +137,8 @@ namespace IRaCIS.Core.Application.Services
 | 
			
		|||
                return ResponseOutput.NotOk("This visit is OutPlanPreviousVisitId and couldn't be deleted.");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            await _subjectVisitRepository.SoftDeleteFromQueryAsync(s => s.Id == id);
 | 
			
		||||
            await _subjectVisitRepository.DeleteFromQueryAsync(s => s.Id == id,true);
 | 
			
		||||
            
 | 
			
		||||
            return ResponseOutput.Ok();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -277,7 +277,7 @@ namespace IRaCIS.Application.Services
 | 
			
		|||
                        SubjectId = y.Id,
 | 
			
		||||
                        Id = guid,
 | 
			
		||||
                        VisitName = x.VisitName,
 | 
			
		||||
 | 
			
		||||
                        TrialId= trialId,
 | 
			
		||||
                        BlindName = x.BlindName,
 | 
			
		||||
                        IsBaseLine = x.IsBaseLine,
 | 
			
		||||
                        IsUrgent = false,
 | 
			
		||||
| 
						 | 
				
			
			@ -292,7 +292,7 @@ namespace IRaCIS.Application.Services
 | 
			
		|||
            await _repository.AddRangeAsync(subjectVisits);
 | 
			
		||||
 | 
			
		||||
            //访视计划 整体状态变更为 确认
 | 
			
		||||
            await _visitStageRepository.BatchUpdateNoTrackingAsync(u => u.TrialId == trialId, t => new VisitStage() { IsConfirmed = true, IsHaveFirstConfirmed = true });
 | 
			
		||||
            await _visitStageRepository.UpdatePartialFromQueryAsync(u => u.TrialId == trialId&&u.IsConfirmed==false, t => new VisitStage() { IsConfirmed = true, IsHaveFirstConfirmed = true });
 | 
			
		||||
 | 
			
		||||
            await _visitStageRepository.SaveChangesAsync();
 | 
			
		||||
            return ResponseOutput.Ok();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -89,7 +89,7 @@ namespace IRaCIS.Core.Application.Triggers
 | 
			
		|||
                //// 这里是触发器的位置
 | 
			
		||||
                //await  _subjectVisitRepository.AddListInspectionRecordAsync(datas);
 | 
			
		||||
 | 
			
		||||
                await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectVisitId && t.SubmitState == SubmitStateEnum.ToSubmit,
 | 
			
		||||
                await _subjectVisitRepository.UpdatePartialFromQueryAsync(t => t.Id == subjectVisitId && t.SubmitState == SubmitStateEnum.ToSubmit,
 | 
			
		||||
                    u => new SubjectVisit() { VisitExecuted = 0, SVENDTC = null, SVSTDTC = null, SubmitState = SubmitStateEnum.None });
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,15 +47,24 @@ namespace IRaCIS.Core.Infra.EFCore.Common
 | 
			
		|||
        /// 传入实体对象
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public async Task IncomingEntitys(List<EntityEntry> entitys)
 | 
			
		||||
        {
 | 
			
		||||
        {          
 | 
			
		||||
            // 新增
 | 
			
		||||
            await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Added).ToList(), "Add");
 | 
			
		||||
 | 
			
		||||
            // 修改
 | 
			
		||||
            await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Modified).ToList(), "Update");
 | 
			
		||||
            await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Modified&&(!typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType())
 | 
			
		||||
            || !(bool)x.Entity.GetType().GetProperty("IsDeleted").GetValue(x.Entity))
 | 
			
		||||
            ).ToList(), "Update");
 | 
			
		||||
 | 
			
		||||
            // 删除
 | 
			
		||||
            await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Deleted).ToList(), "Deleted");
 | 
			
		||||
            await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Deleted
 | 
			
		||||
            ||((typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType())&& (bool)x.Entity.GetType().GetProperty("IsDeleted").GetValue(x.Entity)))
 | 
			
		||||
            ).ToList(), "Deleted");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            //var value = data.GetType().GetProperty(item).GetValue(data);
 | 
			
		||||
            //entitys.Where(x=>x.Entity.is)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
| 
						 | 
				
			
			@ -84,6 +93,15 @@ namespace IRaCIS.Core.Infra.EFCore.Common
 | 
			
		|||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 访视计划
 | 
			
		||||
            foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(VisitStage)))
 | 
			
		||||
            {
 | 
			
		||||
                await InsertInspection<VisitStage>(item, type, x => new DataInspection()
 | 
			
		||||
                {
 | 
			
		||||
                    VisitStageId = x.Id,
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // TrialDocument
 | 
			
		||||
            foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocument)))
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -117,15 +135,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
 | 
			
		|||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 访视计划
 | 
			
		||||
            foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(VisitStage)))
 | 
			
		||||
            {
 | 
			
		||||
                await InsertInspection<VisitStage>(item, type, x => new DataInspection()
 | 
			
		||||
                {
 | 
			
		||||
                    VisitStageId = x.Id,
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            // 既往手术史
 | 
			
		||||
            foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(PreviousSurgery)))
 | 
			
		||||
| 
						 | 
				
			
			@ -161,9 +170,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common
 | 
			
		|||
                await InsertInspection<DicomStudy>(item, type, x => new DataInspection()
 | 
			
		||||
                {
 | 
			
		||||
                    GeneralId = x.Id,
 | 
			
		||||
                  
 | 
			
		||||
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            // 序列
 | 
			
		||||
            foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(DicomSeries)))
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -172,12 +184,34 @@ namespace IRaCIS.Core.Infra.EFCore.Common
 | 
			
		|||
                await InsertInspection<DicomSeries>(item, type, x => new DataInspection()
 | 
			
		||||
                {
 | 
			
		||||
                    GeneralId = x.Id,
 | 
			
		||||
                },new {
 | 
			
		||||
                }, new
 | 
			
		||||
                {
 | 
			
		||||
                    StudyCode = entity.DicomStudy.StudyCode,
 | 
			
		||||
                    Modalities = entity.DicomStudy.Modalities,
 | 
			
		||||
                   
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 非Dicom
 | 
			
		||||
            foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(NoneDicomStudy)))
 | 
			
		||||
            {
 | 
			
		||||
                await InsertInspection<NoneDicomStudy>(item, type, x => new DataInspection()
 | 
			
		||||
                {
 | 
			
		||||
                    GeneralId = x.Id,
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 非Dicom文件
 | 
			
		||||
            foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(NoneDicomStudyFile)))
 | 
			
		||||
            {
 | 
			
		||||
                await InsertInspection<NoneDicomStudyFile>(item, type, x => new DataInspection()
 | 
			
		||||
                {
 | 
			
		||||
                    GeneralId = x.Id,
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
         
 | 
			
		||||
 | 
			
		||||
            //质疑
 | 
			
		||||
            foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCChallenge)))
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -594,7 +594,6 @@ namespace IRaCIS.Core.Infra.EFCore
 | 
			
		|||
                item.Json = await SetEnum(dto.TrialId, item.Identification, item.Json);
 | 
			
		||||
                item.Json = await SetDataInspectionDateType(item.Identification, item.Json);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return dto.Items.Select(x => x.Json).ToList();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -610,7 +609,7 @@ namespace IRaCIS.Core.Infra.EFCore
 | 
			
		|||
        public async Task<string> SetDataInspectionDateType(string identification, string json)
 | 
			
		||||
        {
 | 
			
		||||
            var list = await (from parent in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.Identification == identification)
 | 
			
		||||
                              join child in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.EnumType == "Date") on parent.Id equals child.ParentId
 | 
			
		||||
                              join child in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.EnumType == "Date" && x.IsEnable.HasValue && x.IsEnable.Value) on parent.Id equals child.ParentId
 | 
			
		||||
                              select new DateDto()
 | 
			
		||||
                              {
 | 
			
		||||
                                  Code = child.Code,
 | 
			
		||||
| 
						 | 
				
			
			@ -665,7 +664,7 @@ namespace IRaCIS.Core.Infra.EFCore
 | 
			
		|||
        public async Task<string> GetInspectionEnumValue(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
 | 
			
		||||
                              join p in _dbContext.FrontAuditConfig.Where(x => x.EnumType == "Foreign" && x.IsEnable.HasValue && x.IsEnable.Value) on u.Id equals p.ParentId
 | 
			
		||||
                              select new
 | 
			
		||||
                              {
 | 
			
		||||
                                  Key = p.Code,
 | 
			
		||||
| 
						 | 
				
			
			@ -721,7 +720,7 @@ namespace IRaCIS.Core.Infra.EFCore
 | 
			
		|||
        public async Task<string> SetEnum(Guid trilaid, 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.Code != "AuditState" && x.EnumType == "Dictionary") on u.Id equals p.ParentId
 | 
			
		||||
                              join p in _dbContext.FrontAuditConfig.Where(x => x.Code != "AuditState" && x.EnumType == "Dictionary"&&x.IsEnable.HasValue&& x.IsEnable.Value) on u.Id equals p.ParentId
 | 
			
		||||
                              select new
 | 
			
		||||
                              {
 | 
			
		||||
                                  Key = p.Code,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue