Browse Source

第三方体检中心增加明细表

master
wxd 1 year ago
parent
commit
1a28963501
  1. 4
      src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/CreateThirdMedicalCenterDto.cs
  2. 19
      src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/SetThirdMedicalCenterContainCustomerOrgGroupInputDto.cs
  3. 6
      src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/ThirdMedicalCenterDto.cs
  4. 3
      src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/ThirdMedicalCenterListInputDto.cs
  5. 4
      src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/UpdateThirdMedicalCenterDto.cs
  6. 35
      src/Shentun.Peis.Application/ThirdMedicalCenters/ThirdMedicalCenterAppService.cs
  7. 47
      src/Shentun.Peis.Domain/ThirdMedicalCenterDetails/ThirdMedicalCenterDetail.cs
  8. 10
      src/Shentun.Peis.Domain/ThirdMedicalCenters/ThirdMedicalCenter.cs
  9. 12
      src/Shentun.Peis.Domain/ThirdMedicalCenters/ThirdMedicalCenterManager.cs
  10. 34
      src/Shentun.Peis.EntityFrameworkCore/DbMapping/ThirdMedicalCenterDetails/ThirdMedicalCenterDetailDbMapping.cs
  11. 2
      src/Shentun.Peis.EntityFrameworkCore/DbMapping/ThirdMedicalCenters/ThirdMedicalCenterDbMapping.cs
  12. 5
      src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
  13. 16180
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20241122022631_add_third_medical_center_detail.Designer.cs
  14. 45
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20241122022631_add_third_medical_center_detail.cs
  15. 33
      src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

4
src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/CreateThirdMedicalCenterDto.cs

@ -11,10 +11,6 @@ namespace Shentun.Peis.ThirdMedicalCenters
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// 单位分组ID
/// </summary>
public Guid CustomerOrgGroupId { get; set; }
}
}

19
src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/SetThirdMedicalCenterContainCustomerOrgGroupInputDto.cs

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.ThirdMedicalCenters
{
public class SetThirdMedicalCenterContainCustomerOrgGroupInputDto
{
/// <summary>
/// 第三方体检中心ID
/// </summary>
public Guid ThirdMedicalCenterId { get; set; }
/// <summary>
/// 单位分组id集合
/// </summary>
public List<Guid> CustomerOrgGroupIds { get; set; } = new List<Guid>();
}
}

6
src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/ThirdMedicalCenterDto.cs

@ -13,11 +13,7 @@ namespace Shentun.Peis.ThirdMedicalCenters
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// 单位分组ID
/// </summary>
public Guid CustomerOrgGroupId { get; set; }
public int DisplayOrder { get; set; }

3
src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/ThirdMedicalCenterListInputDto.cs

@ -6,8 +6,7 @@ namespace Shentun.Peis.ThirdMedicalCenters
{
public class ThirdMedicalCenterListInputDto
{
public Guid? CustomerOrgGroupId { get; set; }
/// <summary>
/// 关键字
/// </summary>

4
src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/UpdateThirdMedicalCenterDto.cs

@ -13,10 +13,6 @@ namespace Shentun.Peis.ThirdMedicalCenters
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// 单位分组ID
/// </summary>
public Guid CustomerOrgGroupId { get; set; }
}
}

35
src/Shentun.Peis.Application/ThirdMedicalCenters/ThirdMedicalCenterAppService.cs

@ -33,13 +33,15 @@ namespace Shentun.Peis.ThirdMedicalCenters
private readonly IRepository<ThirdMedicalCenterBookingDate, Guid> _thirdMedicalCenterBookingDateRepository;
private readonly IRepository<CustomerOrgGroup, Guid> _customerOrgGroupRepository;
private readonly IRepository<ThirdInterface, Guid> _thirdInterfaceRepository;
private readonly IRepository<ThirdMedicalCenterDetail> _thirdMedicalCenterDetailRepository;
public ThirdMedicalCenterAppService(
IRepository<ThirdMedicalCenter, Guid> thirdMedicalCenterRepository,
CacheService cacheService,
ThirdMedicalCenterManager thirdMedicalCenterManager,
IRepository<ThirdMedicalCenterBookingDate, Guid> thirdMedicalCenterBookingDateRepository,
IRepository<CustomerOrgGroup, Guid> customerOrgGroupRepository,
IRepository<ThirdInterface, Guid> thirdInterfaceRepository)
IRepository<ThirdInterface, Guid> thirdInterfaceRepository,
IRepository<ThirdMedicalCenterDetail> thirdMedicalCenterDetailRepository)
{
_thirdMedicalCenterRepository = thirdMedicalCenterRepository;
_cacheService = cacheService;
@ -47,6 +49,7 @@ namespace Shentun.Peis.ThirdMedicalCenters
_thirdMedicalCenterBookingDateRepository = thirdMedicalCenterBookingDateRepository;
_customerOrgGroupRepository = customerOrgGroupRepository;
_thirdInterfaceRepository = thirdInterfaceRepository;
_thirdMedicalCenterDetailRepository = thirdMedicalCenterDetailRepository;
}
/// <summary>
@ -74,8 +77,6 @@ namespace Shentun.Peis.ThirdMedicalCenters
var query = await _thirdMedicalCenterRepository.GetQueryableAsync();
if (input.CustomerOrgGroupId != null)
query = query.Where(m => m.CustomerOrgGroupId == input.CustomerOrgGroupId);
if (!string.IsNullOrWhiteSpace(input.KeyWord))
@ -89,7 +90,6 @@ namespace Shentun.Peis.ThirdMedicalCenters
DisplayName = s.DisplayName,
DisplayOrder = s.DisplayOrder,
Id = s.Id,
CustomerOrgGroupId = s.CustomerOrgGroupId,
LastModificationTime = s.LastModificationTime,
LastModifierId = s.LastModifierId,
CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).Result,
@ -128,7 +128,7 @@ namespace Shentun.Peis.ThirdMedicalCenters
{
var entity = await _thirdMedicalCenterRepository.GetAsync(input.ThirdMedicalCenterId);
var sourceEntity = ObjectMapper.Map<UpdateThirdMedicalCenterDto, ThirdMedicalCenter>(input);
await _thirdMedicalCenterManager.UpdateAsync(sourceEntity, entity);
_thirdMedicalCenterManager.UpdateAsync(sourceEntity, entity);
entity = await _thirdMedicalCenterRepository.UpdateAsync(entity);
var dto = ObjectMapper.Map<ThirdMedicalCenter, ThirdMedicalCenterDto>(entity);
dto.CreatorName = await _cacheService.GetSurnameAsync(dto.CreatorId);
@ -263,5 +263,30 @@ namespace Shentun.Peis.ThirdMedicalCenters
}
/// <summary>
/// 设置第三方体检中心包含的单位分组
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/ThirdMedicalCenter/SetThirdMedicalCenterContainCustomerOrgGroup")]
public async Task SetThirdMedicalCenterContainCustomerOrgGroupAsync(SetThirdMedicalCenterContainCustomerOrgGroupInputDto input)
{
await _thirdMedicalCenterDetailRepository.DeleteAsync(d => d.ThirdMedicalCenterId == input.ThirdMedicalCenterId);
if (input.CustomerOrgGroupIds.Any())
{
List<ThirdMedicalCenterDetail> thirdMedicalCenterDetails = new List<ThirdMedicalCenterDetail>();
foreach (var customerOrgGroupId in input.CustomerOrgGroupIds)
{
thirdMedicalCenterDetails.Add(new ThirdMedicalCenterDetail
{
CustomerOrgGroupId = customerOrgGroupId,
ThirdMedicalCenterId = input.ThirdMedicalCenterId
});
}
await _thirdMedicalCenterDetailRepository.InsertManyAsync(thirdMedicalCenterDetails);
}
}
}
}

47
src/Shentun.Peis.Domain/ThirdMedicalCenterDetails/ThirdMedicalCenterDetail.cs

@ -0,0 +1,47 @@
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
namespace Shentun.Peis.Models
{
/// <summary>
/// 分院对应的分组
/// </summary>
[Table("third_medical_center_detail")]
public class ThirdMedicalCenterDetail : Entity, IHasConcurrencyStamp
{
/// <summary>
/// 分院id 第三方体检中心id
/// </summary>
[Key]
[Column("third_medical_center_id")]
public Guid ThirdMedicalCenterId { get; set; }
/// <summary>
/// 单位分组ID
/// </summary>
[Column("customer_org_group_id")]
[Key]
public Guid CustomerOrgGroupId { get; set; }
[Column("concurrency_stamp")]
public string ConcurrencyStamp { get; set; }
public override object[] GetKeys()
{
return new object[] { ThirdMedicalCenterId, CustomerOrgGroupId };
}
}
}

10
src/Shentun.Peis.Domain/ThirdMedicalCenters/ThirdMedicalCenter.cs

@ -27,12 +27,12 @@ namespace Shentun.Peis.Models
[StringLength(100)]
public string DisplayName { get; set; } = null!;
/// <summary>
/// 单位分组ID
/// </summary>
[Column("customer_org_group_id")]
///// <summary>
///// 单位分组ID
///// </summary>
//[Column("customer_org_group_id")]
public Guid CustomerOrgGroupId { get; set; }
//public Guid CustomerOrgGroupId { get; set; }

12
src/Shentun.Peis.Domain/ThirdMedicalCenters/ThirdMedicalCenterManager.cs

@ -34,11 +34,11 @@ namespace Shentun.Peis.ThirdMedicalCenters
)
{
Verify(entity);
await EntityHelper.CheckSameName(_thirdMedicalCenterRepository, entity.DisplayName);
// await EntityHelper.CheckSameName(_thirdMedicalCenterRepository, entity.DisplayName);
return new ThirdMedicalCenter
{
DisplayName = entity.DisplayName,
CustomerOrgGroupId = entity.CustomerOrgGroupId,
DisplayOrder = await EntityHelper.CreateMaxDisplayOrder(_thirdMedicalCenterRepository)
};
}
@ -49,7 +49,7 @@ namespace Shentun.Peis.ThirdMedicalCenters
/// <param name="sourceEntity"></param>
/// <param name="targetEntity"></param>
/// <returns></returns>
public async Task UpdateAsync(
public void UpdateAsync(
ThirdMedicalCenter sourceEntity,
ThirdMedicalCenter targetEntity
)
@ -59,11 +59,11 @@ namespace Shentun.Peis.ThirdMedicalCenters
if (sourceEntity.DisplayName != targetEntity.DisplayName)
{
await EntityHelper.CheckSameName(_thirdMedicalCenterRepository, sourceEntity.DisplayName, targetEntity);
//await EntityHelper.CheckSameName(_thirdMedicalCenterRepository, sourceEntity.DisplayName, targetEntity);
targetEntity.DisplayName = sourceEntity.DisplayName;
}
targetEntity.CustomerOrgGroupId = sourceEntity.CustomerOrgGroupId;
}
@ -122,7 +122,7 @@ namespace Shentun.Peis.ThirdMedicalCenters
DataHelper.CheckEntityIsNull(entity);
DataHelper.CheckStringIsNull(entity.DisplayName, "名称");
DataHelper.CheckGuidIsDefaultValue(entity.CustomerOrgGroupId, "单位分组ID");
//DataHelper.CheckGuidIsDefaultValue(entity.CustomerOrgGroupId, "单位分组ID");

34
src/Shentun.Peis.EntityFrameworkCore/DbMapping/ThirdMedicalCenterDetails/ThirdMedicalCenterDetailDbMapping.cs

@ -0,0 +1,34 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Shentun.Peis.EntityFrameworkCore;
namespace Shentun.Peis.DbMapping
{
internal class ThirdMedicalCenterDetailDbMapping : IEntityTypeConfiguration<ThirdMedicalCenterDetail>
{
public void Configure(EntityTypeBuilder<ThirdMedicalCenterDetail> entity)
{
entity.HasKey(e => new { e.ThirdMedicalCenterId, e.CustomerOrgGroupId })
.HasName("pk_third_medical_center_detail");
entity.HasComment("分院对应的分组");
entity.Property(t => t.ThirdMedicalCenterId).HasComment("分院ID").IsRequired().IsFixedLength(); ;
entity.Property(e => e.CustomerOrgGroupId).HasComment("单位分组ID").IsFixedLength().IsRequired();
entity.ConfigureByConvention();
}
}
}

2
src/Shentun.Peis.EntityFrameworkCore/DbMapping/ThirdMedicalCenters/ThirdMedicalCenterDbMapping.cs

@ -17,7 +17,7 @@ namespace Shentun.Peis.DbMapping
{
entity.HasComment("第三方预约人员记录");
entity.Property(t => t.DisplayName).HasComment("体检中心名称").IsRequired();
entity.Property(t => t.CustomerOrgGroupId).HasComment("单位分组ID");
//entity.Property(t => t.CustomerOrgGroupId).HasComment("单位分组ID");
entity.Property(e => e.Id).IsFixedLength().IsRequired();

5
src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs

@ -381,6 +381,8 @@ public class PeisDbContext :
public DbSet<DoctorSignIn> DoctorSignIns { get; set; } = null!;
public DbSet<ThirdMedicalCenterDetail> ThirdMedicalCenterDetails { get; set; } = null!;
public PeisDbContext(DbContextOptions<PeisDbContext> options)
: base(options)
{
@ -632,7 +634,8 @@ public class PeisDbContext :
.ApplyConfiguration(new ThirdMedicalCenterBookingDateDbMapping())
.ApplyConfiguration(new ThirdMedicalCenterDbMapping())
.ApplyConfiguration(new DicomFileDetailDbMapping())
.ApplyConfiguration(new DoctorSignInDbMapping());
.ApplyConfiguration(new DoctorSignInDbMapping())
.ApplyConfiguration(new ThirdMedicalCenterDetailDbMapping());
#endregion

16180
src/Shentun.Peis.EntityFrameworkCore/Migrations/20241122022631_add_third_medical_center_detail.Designer.cs
File diff suppressed because it is too large
View File

45
src/Shentun.Peis.EntityFrameworkCore/Migrations/20241122022631_add_third_medical_center_detail.cs

@ -0,0 +1,45 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.Peis.Migrations
{
public partial class add_third_medical_center_detail : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "customer_org_group_id",
table: "third_medical_center");
migrationBuilder.CreateTable(
name: "third_medical_center_detail",
columns: table => new
{
third_medical_center_id = table.Column<Guid>(type: "uuid", fixedLength: true, nullable: false, comment: "分院ID"),
customer_org_group_id = table.Column<Guid>(type: "uuid", fixedLength: true, nullable: false, comment: "单位分组ID"),
concurrency_stamp = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_third_medical_center_detail", x => new { x.third_medical_center_id, x.customer_org_group_id });
},
comment: "分院对应的分组");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "third_medical_center_detail");
migrationBuilder.AddColumn<Guid>(
name: "customer_org_group_id",
table: "third_medical_center",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
comment: "单位分组ID");
}
}
}

33
src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

@ -12154,11 +12154,6 @@ namespace Shentun.Peis.Migrations
.HasColumnType("uuid")
.HasColumnName("creator_id");
b.Property<Guid>("CustomerOrgGroupId")
.HasColumnType("uuid")
.HasColumnName("customer_org_group_id")
.HasComment("单位分组ID");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(100)
@ -12236,6 +12231,34 @@ namespace Shentun.Peis.Migrations
b.HasComment("第三方体检中心预约日期");
});
modelBuilder.Entity("Shentun.Peis.Models.ThirdMedicalCenterDetail", b =>
{
b.Property<Guid>("ThirdMedicalCenterId")
.HasColumnType("uuid")
.HasColumnName("third_medical_center_id")
.IsFixedLength()
.HasComment("分院ID");
b.Property<Guid>("CustomerOrgGroupId")
.HasColumnType("uuid")
.HasColumnName("customer_org_group_id")
.IsFixedLength()
.HasComment("单位分组ID");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("character varying(40)")
.HasColumnName("concurrency_stamp");
b.HasKey("ThirdMedicalCenterId", "CustomerOrgGroupId")
.HasName("pk_third_medical_center_detail");
b.ToTable("third_medical_center_detail");
b.HasComment("分院对应的分组");
});
modelBuilder.Entity("Shentun.Peis.Models.TitleType", b =>
{
b.Property<Guid>("Id")

Loading…
Cancel
Save