diff --git a/IRaCIS.Core.API/Controllers/InspectionController.cs b/IRaCIS.Core.API/Controllers/InspectionController.cs index 2dd7bcfb2..7f6ed7557 100644 --- a/IRaCIS.Core.API/Controllers/InspectionController.cs +++ b/IRaCIS.Core.API/Controllers/InspectionController.cs @@ -286,7 +286,7 @@ namespace IRaCIS.Core.API.Controllers [UnitOfWork] public async Task QCPassedOrFailed(DataInspectionDto opt) { - var fun = await _qCOperationService.QCPassedOrFailed(opt.OptCommand.trialId, opt.OptCommand.subjectVisitId, opt.OptCommand.signId, opt.OptCommand.auditState); + var fun = await _qCOperationService.QCPassedOrFailed(opt.OptCommand.trialId, opt.OptCommand.subjectVisitId, opt.OptCommand.auditState); return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun); } @@ -385,7 +385,7 @@ namespace IRaCIS.Core.API.Controllers { return ResponseOutput.NotOk(fun.ErrorMessage); } - + opt.AuditInfo.NeedSava = false; return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo,null, fun); } diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index ebeaf2310..a1c1174fd 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -485,6 +485,11 @@ 是否为特殊类型 + + + 日期类型 + + SystemAnonymizationView 列表视图模型 @@ -1508,7 +1513,7 @@ - + 设置QC 通过或者不通过 7:QC failed 8:QC passed diff --git a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs index 77d6e9206..5c724f2d6 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs @@ -192,6 +192,13 @@ namespace IRaCIS.Core.Application.ViewModel public bool? IsSpecialType { get; set; } + /// + /// 日期类型 + /// + + public string DateType { get; set; } + + } diff --git a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs index ab2e2bd9a..e7e942a92 100644 --- a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs @@ -78,6 +78,7 @@ namespace IRaCIS.Core.Application.Service ModuleTypeId = additem?.ModuleTypeId, ObjectTypeId = additem?.ObjectTypeId, OptTypeId = additem?.OptTypeId, + DateType = lst.Select(x => x.DateType).FirstOrDefault(), Id =Guid.NewGuid(), }).ToList(); @@ -188,6 +189,7 @@ namespace IRaCIS.Core.Application.Service ChildDataLabel=data.ChildDataLabel, ChildDataValue=data.ChildDataValue, IsSpecialType=data.IsSpecialType, + DateType=data.DataType, }; query = query diff --git a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs index 5bd79eb20..83cb383ad 100644 --- a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs +++ b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs @@ -112,6 +112,8 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO public DateTime? CreateTime { get; set; } + public bool NeedSava { get; set; } = true; + } @@ -187,7 +189,7 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO { public Guid trialId { get; set; } public Guid subjectVisitId { get; set; } - public Guid signId { get; set; } + public AuditStateEnum auditState { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index 967765938..d95c3d7d1 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -216,7 +216,11 @@ namespace IRaCIS.Core.Application.Service.Inspection } // 判断是否需要前面 - await AddInspectionRecordAsync(AuditInfo, signId); + if (AuditInfo.NeedSava) + { + await AddInspectionRecordAsync(AuditInfo, signId); + } + return bResult; } @@ -282,7 +286,7 @@ namespace IRaCIS.Core.Application.Service.Inspection /// 添加对象 /// 签名Id /// - public async Task AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId=null) + public async Task AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId = null) { if (addDto == new DataInspectionAddDTO()) { @@ -292,15 +296,19 @@ namespace IRaCIS.Core.Application.Service.Inspection var add = _mapper.Map(addDto); await SetInspectionNameValue(add); Guid? parentId = null; - parentId = (await _repository.GetQueryable().Where( x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId&&x.ChildrenType==add.ChildrenType && x.ObjectType==add.ObjectType&&x.VisitStageId==add.VisitStageId&&x.GeneralId==add.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; + parentId = (await _repository.GetQueryable().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId && x.ChildrenType == add.ChildrenType && x.ObjectType == add.ObjectType && x.VisitStageId == add.VisitStageId && x.GeneralId == add.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; add.ParentId = parentId; add.CreateTime = DateTime.Now; add.CreateUserId = _userInfo.Id; add.SignId = signId; add.IP = _userInfo.IP; - + + + add =await _dataInspectionRepository.SetDataInspectionDateType(add); + + await _repository.AddAsync(add); - + var success = await _repository.SaveChangesAsync(); return ResponseOutput.Ok(success); diff --git a/IRaCIS.Core.Application/Service/QC/Interface/IQCOperationService.cs b/IRaCIS.Core.Application/Service/QC/Interface/IQCOperationService.cs index b4e3100be..2a58e6459 100644 --- a/IRaCIS.Core.Application/Service/QC/Interface/IQCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/Interface/IQCOperationService.cs @@ -12,7 +12,7 @@ namespace IRaCIS.Core.Application.Image.QA { Task CheckBack(Guid subjectVisitId); Task SetNeedReupload(Guid trialId, Guid qcChallengeId); - Task QCPassedOrFailed(Guid trialId, Guid subjectVisitId, Guid signId, [FromRoute] AuditStateEnum auditState); + Task QCPassedOrFailed(Guid trialId, Guid subjectVisitId, [FromRoute] AuditStateEnum auditState); Task SetCheckPass(Guid subjectVisitId); diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index f6a3d22ce..0044b53bc 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -1382,7 +1382,7 @@ namespace IRaCIS.Core.Application.Image.QA [HttpPost("{trialId:guid}/{subjectVisitId:guid}/{signId:guid}/{auditState:int}")] [TypeFilter(typeof(TrialResourceFilter))] - public async Task QCPassedOrFailed(Guid trialId, Guid subjectVisitId, Guid signId, [FromRoute] AuditStateEnum auditState) + public async Task QCPassedOrFailed(Guid trialId, Guid subjectVisitId, [FromRoute] AuditStateEnum auditState) { if (!await _repository.AnyAsync(t => t.TrialId == trialId && t.UserId == _userInfo.Id)) @@ -1546,9 +1546,9 @@ namespace IRaCIS.Core.Application.Image.QA await _repository.SaveChangesAsync(); - var success = await _repository.BatchUpdateAsync(t => t.Id == signId, u => new TrialSign() { IsCompleted = true }); + //var success = await _repository.BatchUpdateAsync(t => t.Id == signId, u => new TrialSign() { IsCompleted = true }); - return ResponseOutput.Result(success); + return ResponseOutput.Result(true); } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/InspectionViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/InspectionViewModel.cs index 4381db2ea..b5fae16a9 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/InspectionViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/InspectionViewModel.cs @@ -27,3 +27,5 @@ public class SignDTO } + + diff --git a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs index 0a663bc7e..a016024d9 100644 --- a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs +++ b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs @@ -174,6 +174,13 @@ namespace IRaCIS.Core.Domain.Models public bool? IsSpecialType { get; set; } + /// + /// 日期类型 + /// + + public string DateType { get; set; } + + } } diff --git a/IRaCIS.Core.Infra.EFCore/Dto/DateDto.cs b/IRaCIS.Core.Infra.EFCore/Dto/DateDto.cs new file mode 100644 index 000000000..f207ea4f0 --- /dev/null +++ b/IRaCIS.Core.Infra.EFCore/Dto/DateDto.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IRaCIS.Core.Infra.EFCore.Dto +{ + public class DateDto + { + public string Code { get; set; } + + public string DateType { get; set; } + } + +} diff --git a/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs b/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs index 9a5823496..39f1b8979 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/IRepository.cs @@ -31,6 +31,14 @@ namespace IRaCIS.Core.Infra.EFCore /// /// Task AddListInspectionRecordAsync(List datas); + + + /// + /// 格式化日期和时间 + /// + /// + /// + Task SetDataInspectionDateType(DataInspection Data); } diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs index 0b6d997fa..df075e6bb 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs @@ -17,6 +17,7 @@ using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Infrastructure.Extention; using Microsoft.Data.SqlClient; using Newtonsoft.Json; +using IRaCIS.Core.Infra.EFCore.Dto; namespace IRaCIS.Core.Infra.EFCore { @@ -183,6 +184,7 @@ namespace IRaCIS.Core.Infra.EFCore add.CreateTime = DateTime.Now; } add.JsonDetail = JsonConvert.SerializeObject(JsonData); + await SetDataInspectionDateType(add); } await _dbContext.DataInspection.AddRangeAsync(datas); @@ -207,6 +209,55 @@ namespace IRaCIS.Core.Infra.EFCore } } + /// + /// 格式化日期和时间 + /// + /// + /// + public async Task SetDataInspectionDateType(DataInspection Data) + { + var list = await (from parent in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.Identification == Data.Identification) + join child in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.DateType != null && x.DateType != string.Empty) on parent.Id equals child.ParentId + select new DateDto() + { + Code= child.Code, + DateType= child.DateType, + }).ToListAsync(); + + var JsonData = JsonConvert.DeserializeObject>(Data.JsonDetail); + + foreach (var item in JsonData.Keys) + { + var datefirst = list.FirstOrDefault(x => x.Code.ToLower() == item.ToLower()); + if (datefirst != null&& !IsNullOrEmpty(JsonData[item])) + { + try + { + if (datefirst.DateType == "Date") + { + JsonData[item] = DateTime.Parse(JsonData[item].ToString()).ToString("yyyy-MM-dd"); + } + + if (datefirst.DateType == "DateTime") + { + JsonData[item] = DateTime.Parse(JsonData[item].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); + } + + } + catch (Exception) + { + + continue; + } + } + + + + } + Data.JsonDetail = JsonConvert.SerializeObject(JsonData); + + return Data; + } ///