diff --git a/IRaCIS.Core.Domain/Visit/Subject.cs b/IRaCIS.Core.Domain/Visit/Subject.cs index 38379ceeb..3dc2582c7 100644 --- a/IRaCIS.Core.Domain/Visit/Subject.cs +++ b/IRaCIS.Core.Domain/Visit/Subject.cs @@ -99,9 +99,6 @@ public class Subject : BaseFullDeleteAuditEntity public DateTime? BirthDate { get; set; } public DateTime? SignDate { get; set; } - public int StudyCount { get; set; } = 0; - public string Modalities { get; set; } = string.Empty; - public DateTime? FirstGiveMedicineTime { get; set; } public bool IsUrgent { get; set; } diff --git a/IRaCIS.Core.Test/CodeTemplates/EFCore/EntityType.t4 b/IRaCIS.Core.Test/CodeTemplates/EFCore/EntityType.t4 index dadd73b8f..5c2804d4f 100644 --- a/IRaCIS.Core.Test/CodeTemplates/EFCore/EntityType.t4 +++ b/IRaCIS.Core.Test/CodeTemplates/EFCore/EntityType.t4 @@ -26,15 +26,10 @@ var usings = new List { - "System", - "System.Collections.Generic" }; if (Options.UseDataAnnotations) { - usings.Add("System.ComponentModel.DataAnnotations"); - usings.Add("System.ComponentModel.DataAnnotations.Schema"); - usings.Add("Microsoft.EntityFrameworkCore"); usings.Add("IRaCIS.Core.Domain.Models"); } diff --git a/IRaCIS.Core.Test/GenerateContextModelFolder/Dictionary.cs b/IRaCIS.Core.Test/GenerateContextModelFolder/Dictionary.cs new file mode 100644 index 000000000..41fd5b3ff --- /dev/null +++ b/IRaCIS.Core.Test/GenerateContextModelFolder/Dictionary.cs @@ -0,0 +1,37 @@ +using System; +using IRaCIS.Core.Domain.Models; + +namespace IRaCIS.Core.Test.GenerateContextModelFolder; + +[Comment("后台 - 字典表(需要同步)")] +[Table("Dictionary")] +public partial class Dictionary: BaseFullAuditEntity +{ + [StringLength(400)] + public string ChildGroup { get; set; } = null!; + + public string Code { get; set; } = null!; + + public Guid? ConfigTypeId { get; set; } + + [Comment(" 字典类型- 枚举|bool|下拉框")] + public int DataTypeEnum { get; set; } + + [StringLength(512)] + public string Description { get; set; } = null!; + + [Comment(" 是否字典类型配置")] + public bool IsConfig { get; set; } + + public bool IsEnable { get; set; } + + public Guid? ParentId { get; set; } + + public int ShowOrder { get; set; } + + [StringLength(400)] + public string Value { get; set; } = null!; + + [StringLength(400)] + public string ValueCN { get; set; } = null!; +} diff --git a/IRaCIS.Core.Test/GenerateContextModelFolder/TempContext.cs b/IRaCIS.Core.Test/GenerateContextModelFolder/TempContext.cs new file mode 100644 index 000000000..e3443c1e1 --- /dev/null +++ b/IRaCIS.Core.Test/GenerateContextModelFolder/TempContext.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; + +namespace IRaCIS.Core.Test.GenerateContextModelFolder; + +public partial class TempContext : DbContext +{ + public TempContext() + { + } + + public TempContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet Dictionaries { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) +#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263. + => optionsBuilder.UseSqlServer("Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true"); + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.UseCollation("Chinese_PRC_CI_AS"); + + modelBuilder.Entity(entity => + { + entity.ToTable("Dictionary", tb => tb.HasComment("后台 - 字典表(需要同步)")); + + entity.Property(e => e.Id).ValueGeneratedNever(); + entity.Property(e => e.ChildGroup).HasDefaultValue(""); + entity.Property(e => e.Code).HasDefaultValue(""); + entity.Property(e => e.DataTypeEnum).HasComment("字典类型- 枚举|bool|下拉框"); + entity.Property(e => e.IsConfig).HasComment("是否字典类型配置"); + entity.Property(e => e.IsEnable).HasDefaultValue(true); + entity.Property(e => e.Value).HasDefaultValue(""); + entity.Property(e => e.ValueCN).HasDefaultValue(""); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/IRaCIS.Core.Test/GlobalUsings.cs b/IRaCIS.Core.Test/GlobalUsings.cs new file mode 100644 index 000000000..cf790c1af --- /dev/null +++ b/IRaCIS.Core.Test/GlobalUsings.cs @@ -0,0 +1,7 @@ +global using Microsoft.EntityFrameworkCore; +global using System; +global using System.Collections.Generic; +global using System.ComponentModel.DataAnnotations; +global using System.ComponentModel.DataAnnotations.Schema; + + diff --git a/IRaCIS.Core.Test/LiquidTemplateOutPut/DictionaryService.cs b/IRaCIS.Core.Test/LiquidTemplateOutPut/DictionaryService.cs new file mode 100644 index 000000000..8bf4ef952 --- /dev/null +++ b/IRaCIS.Core.Test/LiquidTemplateOutPut/DictionaryService.cs @@ -0,0 +1,60 @@ + +//-------------------------------------------------------------------- +// 此代码由liquid模板自动生成 byzhouhang 20240909 +// 生成时间 2024-09-20 01:22:34Z +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- +using IRaCIS.Core.Domain.Models; +using Microsoft.AspNetCore.Mvc; +using IRaCIS.Core.Application.Interfaces; +using IRaCIS.Core.Application.ViewModel; +using IRaCIS.Core.Infrastructure.Extention; +using System.Threading.Tasks; +using IRaCIS.Core.Infra.EFCore; +namespace IRaCIS.Core.Application.Service; + +[ ApiExplorerSettings(GroupName = "Test")] +public class DictionaryService(IRepository _dictionaryRepository): BaseService, IDictionaryService +{ + + + [HttpPost] + public async Task> GetDictionaryList(DictionaryQuery inQuery) + { + + var dictionaryQueryable =_dictionaryRepository + .ProjectTo(_mapper.ConfigurationProvider); + + var pageList= await dictionaryQueryable.ToPagedListAsync(inQuery); + + return pageList; + } + + + + public async Task AddOrUpdateDictionary(DictionaryAddOrEdit addOrEditDictionary) + { + // 在此处拷贝automapper 映射 + + CreateMap(); + CreateMap().ReverseMap(); + + + var entity = await _dictionaryRepository.InsertOrUpdateAsync(addOrEditDictionary, true); + + return ResponseOutput.Ok(entity.Id.ToString()); + + } + + + [HttpDelete("{dictionaryId:guid}")] + public async Task DeleteDictionary(Guid dictionaryId) + { + var success = await _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository.DeleteFromQueryAsync(t => t.Id == dictionaryId,true); + return ResponseOutput.Ok(); + } + +} + + + diff --git a/IRaCIS.Core.Test/LiquidTemplateOutPut/DictionaryViewModel.cs b/IRaCIS.Core.Test/LiquidTemplateOutPut/DictionaryViewModel.cs new file mode 100644 index 000000000..203974b43 --- /dev/null +++ b/IRaCIS.Core.Test/LiquidTemplateOutPut/DictionaryViewModel.cs @@ -0,0 +1,76 @@ + +//-------------------------------------------------------------------- +// 此代码由liquid模板自动生成 byzhouhang 20240909 +// 生成时间 2024-09-20 01:22:37Z +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- +using System; +using IRaCIS.Core.Domain.Share; +using System.Collections.Generic; +namespace IRaCIS.Core.Application.ViewModel; + +public class DictionaryView : DictionaryAddOrEdit +{ + + public DateTime CreateTime { get; set; } + + public DateTime UpdateTime { get; set; } + +} + + +public class DictionaryAddOrEdit +{ + public Guid? Id { get; set; } + + public string ChildGroup { get; set; } + + public string Code { get; set; } + + public Guid? ConfigTypeId { get; set; } + + public DicDataTypeEnum DataTypeEnum { get; set; } + + public string Description { get; set; } + + public bool IsConfig { get; set; } + + public bool IsEnable { get; set; } + + public Guid? ParentId { get; set; } + + public int ShowOrder { get; set; } + + public string Value { get; set; } + + public string ValueCN { get; set; } + } + +public class DictionaryQuery +{ + public string? ChildGroup { get; set; } + + public string? Code { get; set; } + + public Guid? ConfigTypeId { get; set; } + + public DicDataTypeEnum? DataTypeEnum { get; set; } + + public string? Description { get; set; } + + public bool? IsConfig { get; set; } + + public bool? IsEnable { get; set; } + + public Guid? ParentId { get; set; } + + public int? ShowOrder { get; set; } + + public string? Value { get; set; } + + public string? ValueCN { get; set; } + } + + + + diff --git a/IRaCIS.Core.Test/LiquidTemplateOutPut/IDictionaryService.cs b/IRaCIS.Core.Test/LiquidTemplateOutPut/IDictionaryService.cs new file mode 100644 index 000000000..d8b5e7ba7 --- /dev/null +++ b/IRaCIS.Core.Test/LiquidTemplateOutPut/IDictionaryService.cs @@ -0,0 +1,23 @@ + +//-------------------------------------------------------------------- +// 此代码由liquid模板自动生成 byzhouhang 20240909 +// 生成时间 2024-09-20 01:22:37Z +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- +using System; +using IRaCIS.Core.Infrastructure.Extention; +using System.Threading.Tasks; +using IRaCIS.Core.Application.ViewModel; +namespace IRaCIS.Core.Application.Interfaces; + +public interface IDictionaryService +{ + + Task> GetDictionaryList(DictionaryQuery inQuery); + + Task AddOrUpdateDictionary(DictionaryAddOrEdit addOrEditDictionary); + + Task DeleteDictionaryView(Guid dictionaryId); +} + +