修改接口参数

This commit is contained in:
2022-05-07 11:58:38 +08:00
parent cc1d80d40b
commit 2730987acf
6 changed files with 40 additions and 44 deletions
@@ -37,6 +37,18 @@ namespace IRaCIS.Core.Application.Contracts.DTO
}
public class UpdateModalityCommand
{
public Guid Id { get; set; }
public Guid SubjectVisitId { get; set; }
public int Type { get; set; }
public string Modality { get; set; } = String.Empty;
public string BodyPart { get; set; } = String.Empty;
}
public class QCQuestionAnswerCommand
{
@@ -34,7 +34,7 @@ namespace IRaCIS.Core.Application.Image.QA
Task<IResponseOutput> SetReuploadFinished(CRCReuploadFinishedCommand cRCReuploadFinishedCommand);
Task<IResponseOutput> SetSeriesState(Guid subjectVisitId, Guid studyId, Guid seriesId, int state);
Task<IResponseOutput> SetVisitUrgent(Guid trialId, Guid subjectVisitId, bool setOrCancel);
Task<IResponseOutput> UpdateModality(Guid id, Guid subjectVisitId, int type, [FromQuery] string modality, [FromQuery] string bodyPart);
Task<IResponseOutput> UpdateModality(UpdateModalityCommand updateModalityCommand);
Task<IResponseOutput> UpdateSubjectAndSVInfo(UploadSubjectAndVisitCommand command);
Task<IResponseOutput> UploadVisitCheckExcel(IFormFile file, Guid trialId);
Task<IResponseOutput> VerifyCanQCPassedOrFailed(Guid subjectVisitId);
@@ -784,46 +784,40 @@ namespace IRaCIS.Core.Application.Image.QA
/// <summary>
///type 1 :study 2: series 3:非dicom QC修改检查部位和 拍片类型
/// </summary>
/// <param name="id"></param>
/// <param name="subjectVisitId"></param>
/// <param name="type"></param>
/// <param name="modality"></param>
/// <param name="bodyPart"></param>
/// <returns></returns>
[HttpPut("{trialId:guid}/{subjectVisitId:guid}/{id:guid}/{type:int}")]
[HttpPost("{trialId:guid}")]
[TypeFilter(typeof(TrialResourceFilter))]
public async Task<IResponseOutput> UpdateModality(Guid id, Guid subjectVisitId, int type, string modality, string bodyPart)
public async Task<IResponseOutput> UpdateModality(UpdateModalityCommand updateModalityCommand)
{
await VerifyIsCanQCAsync(null, subjectVisitId);
await VerifyIsCanQCAsync(null, updateModalityCommand.SubjectVisitId);
var DicomSeriesdata = await _repository.GetQueryable<DicomSeries>().Where(x => x.StudyId == id).ToListAsync();
var study = await _repository.FirstOrDefaultAsync<DicomStudy>(t => t.Id == id);
DateTime time = DateTime.Now.AddMilliseconds(500);
if (type == 1)
if (updateModalityCommand.Type == 1)
{
if (study == null) return Null404NotFound(study);
var studyId = updateModalityCommand.Id;
var study = (await _repository.FirstOrDefaultAsync<DicomStudy>(t => t.Id == studyId)).IfNullThrowException();
study.BodyPartForEdit = bodyPart;
study.Modalities = modality;
await _repository.BatchUpdateAsync<DicomSeries>(t => t.StudyId == id, r => new DicomSeries() { BodyPartForEdit = bodyPart, Modality = modality });
study.BodyPartForEdit = updateModalityCommand.BodyPart;
study.Modalities = updateModalityCommand.Modality;
await _repository.BatchUpdateAsync<DicomSeries>(t => t.StudyId == studyId, r => new DicomSeries() { BodyPartForEdit = updateModalityCommand.BodyPart, Modality = updateModalityCommand.Modality });
}
else if (type == 2)
else if (updateModalityCommand.Type == 2)
{
var series = await _repository.FirstOrDefaultAsync<DicomSeries>(t => t.Id == id);
if (series == null) return Null404NotFound(series);
series.BodyPartForEdit = bodyPart;
var seriesId = updateModalityCommand.Id;
var series = (await _repository.FirstOrDefaultAsync<DicomSeries>(t => t.Id == seriesId)).IfNullThrowException();
series.BodyPartForEdit = updateModalityCommand.BodyPart;
}
else if (type == 3)
else if (updateModalityCommand.Type == 3)
{
}
// 移动不进去
//await _trialRepository.AddListInspectionRecordAsync(datas);
await _repository.SaveChangesAsync();
return ResponseOutput.Ok();
}