diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 204f089af..52d4d3f49 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -2484,6 +2484,67 @@ + + + 临床数据问题 + + + + + 获取项目临床问题 + + + + + + + 新增或者修改项目临床问题 + + + + + + + 删除项目临床数据问题 + + + + + + + 获取项目问题分组 + + + + + + + 获取系统临床问题 + + + + + + + 新增或者修改系统临床问题 + + + + + + + 删除系统临床数据问题 + + + + + + + 获取系统问题分组 + + + + 名称 @@ -2694,6 +2755,116 @@ 是否启用 + + + 临床问题基本信息 + + + + + 问题名称 + + + + + 问题英文名称 + + + + + 临床问题类型(分组,单选。) + + + + + 问题标识 + + + + + 最大长度 + + + + + 临床数据选项类型(无,自定义) + + + + + 分组Id + + + + + 自定义选项 + + + + + 字典Code + + + + + 排序 + + + + + 是否必填 + + + + + 查询临床数据基类 + + + + + 问题名称 + + + + + 获取项目临床数据 + + + + + 获取项目分组 + + + + + 项目临床数据问题 + + + + + 项目临床数据Id + + + + + 获取系统临床数据 + + + + + 系统临床数据问题 + + + + + 系统临床数据Id + + + + + 获取系统分组 + + 项目中心Code diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalQuestionService.cs new file mode 100644 index 000000000..61e7d00cd --- /dev/null +++ b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalQuestionService.cs @@ -0,0 +1,158 @@ +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2023-06-15 15:06:06 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- + +using Microsoft.AspNetCore.Mvc; +using IRaCIS.Core.Application.Interfaces; +using IRaCIS.Core.Application.ViewModel; +using IRaCIS.Core.Application.Service.Reading.Dto; +using IRaCIS.Core.Infra.EFCore.Common; + +namespace IRaCIS.Core.Application.Service +{ + /// + /// 临床数据问题 + /// + [ ApiExplorerSettings(GroupName = "Reading")] + public class ClinicalQuestionService: BaseService + { + + private readonly IRepository _trialClinicalQuestionRepository; + + private readonly IRepository _systemClinicalQuestionRepository; + + public ClinicalQuestionService(IRepository trialClinicalQuestionRepository, + IRepository systemClinicalQuestionRepository + ) + { + _trialClinicalQuestionRepository = trialClinicalQuestionRepository; + _systemClinicalQuestionRepository = systemClinicalQuestionRepository; + } + + + #region 项目问题 + + /// + /// 获取项目临床问题 + /// + /// + /// + [HttpPost] + public async Task> GetTrialClinicalQuestionList(TrialClinicalQuestionQuery inQuery) + { + + var trialClinicalQuestionQueryable =_trialClinicalQuestionRepository + .WhereIf(!inQuery.QuestionName.IsNullOrEmpty(),x=>x.QuestionName.Contains(inQuery.QuestionName)||x.QuestionEnName.Contains(inQuery.QuestionName)) + .ProjectTo(_mapper.ConfigurationProvider); + var pageList = await trialClinicalQuestionQueryable + .ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TrialClinicalQuestion.ShowOrder) : inQuery.SortField, + inQuery.Asc); + return pageList; + } + + + /// + /// 新增或者修改项目临床问题 + /// + /// + /// + [HttpPost] + public async Task AddOrUpdateTrialClinicalQuestion(TrialClinicalQuestionDto inDto) + { + var entity = await _trialClinicalQuestionRepository.InsertOrUpdateAsync(inDto, true); + return ResponseOutput.Ok(entity.Id.ToString()); + + } + + /// + /// 删除项目临床数据问题 + /// + /// + /// + [HttpPost("{id:guid}")] + public async Task DeleteTrialClinicalQuestion(Guid id) + { + var success = await _trialClinicalQuestionRepository.DeleteFromQueryAsync(t => t.Id == id, true); + return ResponseOutput.Ok(); + } + + /// + /// 获取项目问题分组 + /// + /// + /// + [HttpPost] + public async Task> GetTrialClinicalGroupQuestionList(GetTrialGroupDto inDto) + { + return await this._trialClinicalQuestionRepository.Where(x=>x.TrialClinicalId== inDto.TrialClinicalId) + .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + } + + #endregion + + + #region 系统问题 + + /// + /// 获取系统临床问题 + /// + /// + /// + [HttpPost] + public async Task> GetSystemClinicalQuestionList(SystemClinicalQuestionQuery inQuery) + { + + var systemClinicalQuestionQueryable = _systemClinicalQuestionRepository + .WhereIf(!inQuery.QuestionName.IsNullOrEmpty(), x => x.QuestionName.Contains(inQuery.QuestionName) || x.QuestionEnName.Contains(inQuery.QuestionName)) + .ProjectTo(_mapper.ConfigurationProvider); + var pageList = await systemClinicalQuestionQueryable + .ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(SystemClinicalQuestion.ShowOrder) : inQuery.SortField, + inQuery.Asc); + return pageList; + } + + + /// + /// 新增或者修改系统临床问题 + /// + /// + /// + [HttpPost] + public async Task AddOrUpdateSystemClinicalQuestion(SystemClinicalQuestionDto inDto) + { + var entity = await _systemClinicalQuestionRepository.InsertOrUpdateAsync(inDto, true); + return ResponseOutput.Ok(entity.Id.ToString()); + + } + + + /// + /// 删除系统临床数据问题 + /// + /// + /// + [HttpPost("{id:guid}")] + public async Task DeleteSystemClinicalQuestion(Guid id) + { + var success = await _systemClinicalQuestionRepository.DeleteFromQueryAsync(t => t.Id == id, true); + return ResponseOutput.Ok(); + } + + + /// + /// 获取系统问题分组 + /// + /// + /// + [HttpPost] + public async Task> GetSystemClinicalGroupQuestionList(GetSystemGroupDto inDto) + { + return await this._systemClinicalQuestionRepository.Where(x => x.SystemClinicalId == inDto.SystemClinicalId) + .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + } + #endregion + + } +} diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalQuestionDto.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalQuestionDto.cs new file mode 100644 index 000000000..bb1b9348f --- /dev/null +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalQuestionDto.cs @@ -0,0 +1,143 @@ +using IRaCIS.Core.Domain.Share; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IRaCIS.Core.Application.Service.Reading.Dto +{ + /// + /// 临床问题基本信息 + /// + public class ClinicalQuestionBase + { + + public Guid? Id { get; set; } + + /// + /// 问题名称 + /// + public string QuestionName { get; set; } = string.Empty; + + /// + /// 问题英文名称 + /// + public string QuestionEnName { get; set; } = string.Empty; + + /// + /// 临床问题类型(分组,单选。) + /// + public ClinicalQuestionType ClinicalQuestionTypeEnum { get; set; } + + /// + /// 问题标识 + /// + public ClinicalQuestionMark? ClinicalQuestionMarkEnum { get; set; } + + /// + /// 最大长度 + /// + public int? MaxAnswerLength { get; set; } + + /// + /// 临床数据选项类型(无,自定义) + /// + public ClinicalOptionType ClinicalOptionTypeEnum { get; set; } + + /// + /// 分组Id + /// + public Guid? GroupId { get; set; } + + /// + /// 自定义选项 + /// + public string TypeValue { get; set; } = string.Empty; + + /// + /// 字典Code + /// + public string DictionaryCode { get; set; } = string.Empty; + + /// + /// 排序 + /// + public int ShowOrder { get; set; } = 0; + + /// + /// 是否必填 + /// + public bool IsRequired { get; set; } = false; + } + + /// + /// 查询临床数据基类 + /// + public class ClinicalQuestionQueryBase : PageInput + { + /// + /// 问题名称 + /// + public string QuestionName { get; set; } = string.Empty; + } + + /// + /// 获取项目临床数据 + /// + public class TrialClinicalQuestionQuery : ClinicalQuestionQueryBase + { + public Guid TrialClinicalId { get; set; } + } + + /// + /// 获取项目分组 + /// + public class GetTrialGroupDto + { + public Guid TrialClinicalId { get; set; } + } + + + + /// + /// 项目临床数据问题 + /// + public class TrialClinicalQuestionDto: ClinicalQuestionBase + { + /// + /// 项目临床数据Id + /// + public Guid TrialClinicalId { get; set; } + } + + + /// + /// 获取系统临床数据 + /// + public class SystemClinicalQuestionQuery : ClinicalQuestionQueryBase + { + public Guid SystemClinicalId { get; set; } + } + + + + /// + /// 系统临床数据问题 + /// + public class SystemClinicalQuestionDto : ClinicalQuestionBase + { + /// + /// 系统临床数据Id + /// + public Guid SystemClinicalId { get; set; } + } + + /// + /// 获取系统分组 + /// + public class GetSystemGroupDto + { + public Guid SystemClinicalId { get; set; } + } +} diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index 6596968c2..394b24dc2 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -17,6 +17,11 @@ namespace IRaCIS.Core.Application.Service //是否英文环境 var isEn_Us=false; + #region 临床问题 + CreateMap(); + CreateMap(); + #endregion + CreateMap(); CreateMap(); diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs index 6a8aae2fe..78e3a6234 100644 --- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs +++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs @@ -16,6 +16,83 @@ namespace IRaCIS.Core.Domain.Share public static readonly string Group = "group"; } + /// + /// 临床数据问题类型 + /// + public enum ClinicalQuestionType + { + + /// + /// 分组 + /// + Group = 1, + + /// + /// 表格 + /// + Table = 2, + + /// + /// 单行文本框 + /// + Input = 3, + + /// + /// 多行文本框 + /// + TextArea = 4, + + /// + /// 单选题 + /// + Select = 5, + + /// + /// 多选题 + /// + Multiple = 6, + + /// + /// 时间 + /// + Time = 7 + } + + /// + /// 临床问题标识 + /// + public enum ClinicalQuestionMark + { + + /// + /// 检查日期 + /// + CheckDate = 1 + } + + /// + /// 临床数据选项类型 + /// + public enum ClinicalOptionType + { + + /// + /// 无 + /// + None = 1, + + /// + /// 自定义 + /// + Custom = 2, + + /// + /// 字典 + /// + Dictionary = 3 + } + + /// /// 影像质量评估 /// diff --git a/IRaCIS.Core.Domain/Reading/ClinicalQuestion/SystemClinicalQuestion.cs b/IRaCIS.Core.Domain/Reading/ClinicalQuestion/SystemClinicalQuestion.cs new file mode 100644 index 000000000..b22866c60 --- /dev/null +++ b/IRaCIS.Core.Domain/Reading/ClinicalQuestion/SystemClinicalQuestion.cs @@ -0,0 +1,93 @@ + +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2023-06-16 13:37:24 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +using System; +using IRaCIS.Core.Domain.Share; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using IRaCIS.Core.Domain.Models; + +namespace IRaCIS.Core.Domain.Models +{ + /// + ///系统临床数据问题 + /// + [Table("SystemClinicalQuestion")] + public class SystemClinicalQuestion : Entity, IAuditAdd + { + /// + /// 项目临床数据Id + /// + public Guid SystemClinicalId { get; set; } + + /// + /// 问题名称 + /// + public string QuestionName { get; set; } = string.Empty; + + /// + /// 问题英文名称 + /// + public string QuestionEnName { get; set; } = string.Empty; + + /// + /// 临床问题类型(分组,单选。) + /// + public ClinicalQuestionType ClinicalQuestionTypeEnum { get; set; } + + /// + /// 问题标识 + /// + public ClinicalQuestionMark? ClinicalQuestionMarkEnum { get; set; } + + /// + /// 最大长度 + /// + public int? MaxAnswerLength { get; set; } + + /// + /// 临床数据选项类型(无,自定义) + /// + public ClinicalOptionType ClinicalOptionTypeEnum { get; set; } + + /// + /// 分组Id + /// + public Guid? GroupId { get; set; } + + /// + /// 自定义选项 + /// + public string TypeValue { get; set; } = string.Empty; + + /// + /// 字典Code + /// + public string DictionaryCode { get; set; } = string.Empty; + + /// + /// 排序 + /// + public int ShowOrder { get; set; } = 0; + + /// + /// 是否必填 + /// + public bool IsRequired { get; set; } = false; + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 创建人 + /// + public Guid CreateUserId { get; set; } + + } + + +} diff --git a/IRaCIS.Core.Domain/Reading/ClinicalQuestion/TrialClinicalQuestion.cs b/IRaCIS.Core.Domain/Reading/ClinicalQuestion/TrialClinicalQuestion.cs new file mode 100644 index 000000000..c8ba501ce --- /dev/null +++ b/IRaCIS.Core.Domain/Reading/ClinicalQuestion/TrialClinicalQuestion.cs @@ -0,0 +1,93 @@ + +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2023-06-16 13:37:24 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +using System; +using IRaCIS.Core.Domain.Share; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using IRaCIS.Core.Domain.Models; + +namespace IRaCIS.Core.Domain.Models +{ + /// + ///项目临床数据问题 + /// + [Table("TrialClinicalQuestion")] + public class TrialClinicalQuestion : Entity, IAuditAdd + { + /// + /// 项目临床数据Id + /// + public Guid TrialClinicalId { get; set; } + + /// + /// 问题名称 + /// + public string QuestionName { get; set; } = string.Empty; + + /// + /// 问题英文名称 + /// + public string QuestionEnName { get; set; } = string.Empty; + + /// + /// 临床问题类型(分组,单选。) + /// + public ClinicalQuestionType ClinicalQuestionTypeEnum { get; set; } + + /// + /// 问题标识 + /// + public ClinicalQuestionMark? ClinicalQuestionMarkEnum { get; set; } + + /// + /// 最大长度 + /// + public int? MaxAnswerLength { get; set; } + + /// + /// 临床数据选项类型(无,自定义) + /// + public ClinicalOptionType ClinicalOptionTypeEnum { get; set; } + + /// + /// 分组Id + /// + public Guid? GroupId { get; set; } + + /// + /// 自定义选项 + /// + public string TypeValue { get; set; } = string.Empty; + + /// + /// 字典Code + /// + public string DictionaryCode { get; set; } = string.Empty; + + /// + /// 排序 + /// + public int ShowOrder { get; set; } = 0; + + /// + /// 是否必填 + /// + public bool IsRequired { get; set; } = false; + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 创建人 + /// + public Guid CreateUserId { get; set; } + + } + + +} diff --git a/IRaCIS.Core.Domain/SQLFile/20230613.sql b/IRaCIS.Core.Domain/SQLFile/20230613.sql index 0eafb3ce4..4b0b7ef51 100644 --- a/IRaCIS.Core.Domain/SQLFile/20230613.sql +++ b/IRaCIS.Core.Domain/SQLFile/20230613.sql @@ -5,4 +5,42 @@ SET TrialId = VisitTask.TrialId FROM VisitTaskReReading INNER JOIN VisitTask ON VisitTaskReReading.OriginalReReadingTaskId = VisitTask.Id; -delete VisitTaskReReading where TrialId is NULL \ No newline at end of file +delete VisitTaskReReading where TrialId is NULL + +-- 查询 + + SELECT + TableName = d.name, --表名称 + + ColumnNumber = a.colorder, --列序号 + ColumnName = a.name, --列名称 + IsNotCanNull = case when a.isnullable=1 then 0 else 1 end, --允许空 + Columntype = b.name, --类型 + ColumnLength = COLUMNPROPERTY(a.id,a.name,'PRECISION') --长度 + + + FROM + syscolumns a + left join + systypes b + on + a.xusertype=b.xusertype + inner join + sysobjects d + on + a.id=d.id and d.xtype in ('U') and d.name<>'dtproperties' + left join + syscomments e + on + a.cdefault=e.id + left join + sys.extended_properties g + on + a.id=G.major_id and a.colid=g.minor_id + left join + sys.extended_properties f + on + d.id=f.major_id and f.minor_id=0 + where (b.name='nvarchar' or b.name='varchar') and COLUMNPROPERTY(a.id,a.name,'PRECISION') <100 and COLUMNPROPERTY(a.id,a.name,'PRECISION') !=-1 + order by + a.id,a.colorder \ No newline at end of file diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index b9fa19854..1d89987cd 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -403,6 +403,12 @@ namespace IRaCIS.Core.Infra.EFCore public virtual DbSet SubjectVisit { get; set; } #endregion + #region ClinicalQuestion + public virtual DbSet TrialClinicalQuestion { get; set; } + + public virtual DbSet SystemClinicalQuestion { get; set; } + #endregion + diff --git a/IRaCIS.Core.Test/DbHelper.ttinclude b/IRaCIS.Core.Test/DbHelper.ttinclude index 7bc4c52eb..8242235de 100644 --- a/IRaCIS.Core.Test/DbHelper.ttinclude +++ b/IRaCIS.Core.Test/DbHelper.ttinclude @@ -4,7 +4,7 @@ public static readonly string ConnectionString = "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_New_Tet;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"; public static readonly string DbDatabase = "IRaCIS_New_Tet"; //ַ,ƴ - public static readonly string TableName = "Internationalization"; + public static readonly string TableName = "TrialClinicalQuestion"; //ļ service Ƿҳ } #>