Browse Source

条码分组、诊断

bjmzak
wxd 2 years ago
parent
commit
8794ada9e5
  1. 14
      src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs
  2. 19
      src/Shentun.Peis.Application/SampleGroupDetails/SampleGroupDetailAppService.cs
  3. 13
      src/Shentun.Peis.Application/SampleGroups/SampleGroupAppService.cs
  4. 57
      src/Shentun.Peis.Domain/Diagnosises/DiagnosisManager.cs
  5. 3
      src/Shentun.Peis.Domain/SampleGroupDetails/SampleGroupDetail.cs
  6. 15
      src/Shentun.Peis.Domain/SampleGroupDetails/SampleGroupDetailManager.cs
  7. 25
      src/Shentun.Peis.Domain/SampleGroups/SampleGroupManager.cs
  8. 1
      src/Shentun.Peis.EntityFrameworkCore/DbMapping/SampleGroups/SampleGroupDbMapping.cs
  9. 13431
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240325061044_init20240325001.Designer.cs
  10. 39
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240325061044_init20240325001.cs
  11. 4
      src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

14
src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs

@ -268,19 +268,7 @@ namespace Shentun.Peis.Diagnosises
{
return base.DeleteAsync(id);
}
/// <summary>
/// 修改排序 相邻之间
/// </summary>
/// <param name="id">需要修改的ID</param>
/// <param name="targetid">目标ID</param>
[HttpPut("api/app/diagnosis/updatesort")]
public async Task UpdateSortAsync(Guid id, Guid targetid)
{
await _manager.UpdateSortAsync(id, targetid);
}
/// <summary>
/// 修改排序 置顶,置底

19
src/Shentun.Peis.Application/SampleGroupDetails/SampleGroupDetailAppService.cs

@ -71,8 +71,22 @@ namespace Shentun.Peis.SampleGroupDetails
await _manager.CheckAndDeleteAsync(input.SampleGroupId);
if (input.Details.Any())
{
var createEntity = ObjectMapper.Map<List<CreateSampleGroupDetail_Detail>, List<SampleGroupDetail>>(input.Details);
await _repository.InsertManyAsync(createEntity);
List<SampleGroupDetail> sampleGroupDetails = new List<SampleGroupDetail>();
foreach (var details in input.Details)
{
var entity = new SampleGroupDetail
{
SampleGroupId = input.SampleGroupId,
AsbitemId = details.AsbitemId
};
sampleGroupDetails.Add(_manager.CreateAsbitemAsync(entity));
}
if (sampleGroupDetails.Count > 0)
{
await _repository.InsertManyAsync(sampleGroupDetails);
}
}
}
@ -83,6 +97,7 @@ namespace Shentun.Peis.SampleGroupDetails
/// <param name="SampleGroupId"></param>
/// <param name="AsbitemId"></param>
/// <returns></returns>
[RemoteService(false)]
public async Task DeleteAsync(Guid SampleGroupId, Guid AsbitemId)
{
// await _repository.DeleteAsync(d => d.AsbitemId == AsbitemId && d.SampleGroupId == SampleGroupId);

13
src/Shentun.Peis.Application/SampleGroups/SampleGroupAppService.cs

@ -14,6 +14,7 @@ using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp;
namespace Shentun.Peis.SampleGroups
{
@ -62,6 +63,7 @@ namespace Shentun.Peis.SampleGroups
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[RemoteService(false)]
public override async Task<PagedResultDto<SampleGroupDto>> GetListAsync(PagedAndSortedResultRequestDto input)
{
return await base.GetListAsync(input);
@ -155,16 +157,7 @@ namespace Shentun.Peis.SampleGroups
return base.DeleteAsync(id);
}
/// <summary>
/// 修改排序 相邻之间
/// </summary>
/// <param name="id">需要修改的ID</param>
/// <param name="targetid">目标ID</param>
[HttpPut("api/app/samplegroup/updatesort")]
public async Task UpdateSortAsync(Guid id, Guid targetid)
{
await _manager.UpdateSortAsync(id, targetid);
}
/// <summary>
/// 修改排序 置顶,置底

57
src/Shentun.Peis.Domain/Diagnosises/DiagnosisManager.cs

@ -54,7 +54,6 @@ namespace Shentun.Peis.Diagnosises
)
{
Verify(entity);
DataHelper.CheckStringIsNull(entity.DisplayName, "名称");
await EntityHelper.CheckSameName<Diagnosis, Guid>(_repository, entity.DisplayName);
return new Diagnosis
{
@ -82,7 +81,7 @@ namespace Shentun.Peis.Diagnosises
Diagnosis targetEntity
)
{
DataHelper.CheckStringIsNull(sourceEntity.DisplayName, "名称");
DataHelper.CheckEntityIsNull(targetEntity);
Verify(sourceEntity);
if (sourceEntity.DisplayName != targetEntity.DisplayName)
{
@ -91,22 +90,33 @@ namespace Shentun.Peis.Diagnosises
targetEntity.DisplayName = sourceEntity.DisplayName;
targetEntity.SimpleCode = LanguageConverter.GetPYSimpleCode(targetEntity.DisplayName);
}
targetEntity.DiagnosisLevelId = sourceEntity.DiagnosisLevelId;
targetEntity.ForSexId = sourceEntity.ForSexId;
targetEntity.IsIll = sourceEntity.IsIll;
targetEntity.IsSummaryTemplate = sourceEntity.IsSummaryTemplate;
targetEntity.ItemTypeId = sourceEntity.ItemTypeId;
targetEntity.SuggestionName = sourceEntity.SuggestionName;
}
private void Verify(Diagnosis entity)
{
DataHelper.CheckEntityIsNull(entity);
DataHelper.CheckStringIsNull(entity.DisplayName, "名称");
DataHelper.CheckGuidIsDefaultValue(entity.ItemTypeId, "项目类别");
DataHelper.CheckStringIsNull(entity.SuggestionName, "建议名称");
DataHelper.CheckCharIsYOrN(entity.IsIll, "是否疾病");
DataHelper.CheckCharIsYOrN(entity.IsSummaryTemplate, "是否总检模板");
if (entity.ForSexId != ForSexFlag.Male && entity.ForSexId != ForSexFlag.Female && entity.ForSexId != ForSexFlag.All)
{
throw new ArgumentOutOfRangeException("适用性别参数不正确");
}
if (entity.DiagnosisLevelId < 0 || entity.DiagnosisLevelId > 10)
{
throw new ArgumentOutOfRangeException("诊断级别参数不正确");
}
}
/// <summary>
/// 删除的时候应该检测SumDiagnosis里面有没有引用,如果引用了不允许删除,
@ -143,15 +153,7 @@ namespace Shentun.Peis.Diagnosises
/// <summary>
/// 修改排序 相邻之间
/// </summary>
/// <param name="id">需要修改的ID</param>
/// <param name="targetid">目标ID</param>
public async Task UpdateSortAsync(Guid id, Guid targetid)
{
await EntityHelper.UpdateSort(_repository, id, targetid);
}
/// <summary>
/// 修改排序 置顶,置底
@ -176,23 +178,6 @@ namespace Shentun.Peis.Diagnosises
}
private void Verify(Diagnosis entity)
{
DataHelper.CheckEntityIsNull(entity);
DataHelper.CheckStringIsNull(entity.DisplayName, "名称");
DataHelper.CheckGuidIsDefaultValue(entity.ItemTypeId, "项目类别");
DataHelper.CheckCharIsYOrN(entity.IsIll, "是否疾病");
DataHelper.CheckCharIsYOrN(entity.IsSummaryTemplate, "是否总检模板");
if (entity.ForSexId != ForSexFlag.Male && entity.ForSexId != ForSexFlag.Female && entity.ForSexId != ForSexFlag.All)
{
throw new ArgumentOutOfRangeException("适用性别参数不正确");
}
if (entity.DiagnosisLevelId < 0 || entity.DiagnosisLevelId > 10)
{
throw new ArgumentOutOfRangeException("诊断级别参数不正确");
}
}
}
}

3
src/Shentun.Peis.Domain/SampleGroupDetails/SampleGroupDetail.cs

@ -14,6 +14,9 @@ namespace Shentun.Peis.Models
[Table("sample_group_detail")]
public class SampleGroupDetail : Entity, IHasConcurrencyStamp
{
/// <summary>
/// 条码分组ID
/// </summary>
[Key]
[Column("sample_group_id")]
//[StringLength(4)]

15
src/Shentun.Peis.Domain/SampleGroupDetails/SampleGroupDetailManager.cs

@ -22,6 +22,21 @@ namespace Shentun.Peis.SampleGroupDetails
}
/// <summary>
/// 创建
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public SampleGroupDetail CreateAsbitemAsync(SampleGroupDetail entity)
{
DataHelper.CheckGuidIsDefaultValue(entity.AsbitemId, "组合项目编号");
DataHelper.CheckGuidIsDefaultValue(entity.SampleGroupId, "条码分组ID");
return entity;
}
/// <summary>
/// 删除条码分组明细 批量删
/// </summary>

25
src/Shentun.Peis.Domain/SampleGroups/SampleGroupManager.cs

@ -1,4 +1,5 @@
using Shentun.Peis.HelperDto;
using Shentun.Peis.Enums;
using Shentun.Peis.HelperDto;
using Shentun.Peis.Models;
using Shentun.Utilities;
using System;
@ -32,7 +33,7 @@ namespace Shentun.Peis.SampleGroups
SampleGroup entity
)
{
DataHelper.CheckStringIsNull(entity.DisplayName, "名称");
Verify(entity);
await EntityHelper.CheckSameName<SampleGroup, Guid>(_repository, entity.DisplayName);
return new SampleGroup
{
@ -54,7 +55,8 @@ namespace Shentun.Peis.SampleGroups
SampleGroup targetEntity
)
{
DataHelper.CheckStringIsNull(sourceEntity.DisplayName, "名称");
DataHelper.CheckEntityIsNull(targetEntity);
Verify(sourceEntity);
if (sourceEntity.DisplayName != targetEntity.DisplayName)
{
@ -62,7 +64,6 @@ namespace Shentun.Peis.SampleGroups
targetEntity.DisplayName = sourceEntity.DisplayName;
targetEntity.SimpleCode = LanguageConverter.GetPYSimpleCode(targetEntity.DisplayName);
}
targetEntity.SampleContainerId = sourceEntity.SampleContainerId;
targetEntity.SampleTypeId = sourceEntity.SampleTypeId;
@ -71,15 +72,19 @@ namespace Shentun.Peis.SampleGroups
/// <summary>
/// 修改排序 相邻之间
/// 验证新增、修改字段
/// </summary>
/// <param name="id">需要修改的ID</param>
/// <param name="targetid">目标ID</param>
public async Task UpdateSortAsync(Guid id, Guid targetid)
/// <param name="entity"></param>
/// <exception cref="ArgumentException"></exception>
private void Verify(SampleGroup entity)
{
await EntityHelper.UpdateSort(_repository, id, targetid);
DataHelper.CheckEntityIsNull(entity);
DataHelper.CheckStringIsNull(entity.DisplayName, "名称");
DataHelper.CheckGuidIsDefaultValue(entity.SampleTypeId, "标本类型ID");
DataHelper.CheckGuidIsDefaultValue(entity.SampleContainerId, "标本容器ID");
}
/// <summary>
/// 修改排序 置顶,置底
/// </summary>
@ -107,7 +112,5 @@ namespace Shentun.Peis.SampleGroups
}
}
}

1
src/Shentun.Peis.EntityFrameworkCore/DbMapping/SampleGroups/SampleGroupDbMapping.cs

@ -17,6 +17,7 @@ namespace Shentun.Peis.DbMapping
{
entity.HasComment("标本分组设置");
entity.Property(t => t.DisplayName).HasComment("名称").IsRequired();
entity.Property(t => t.SampleTypeId).HasComment("标本类型ID").IsRequired().IsFixedLength();
entity.Property(t => t.SampleContainerId).HasComment("标本容器ID").IsRequired().IsFixedLength();

13431
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240325061044_init20240325001.Designer.cs
File diff suppressed because it is too large
View File

39
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240325061044_init20240325001.cs

@ -0,0 +1,39 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.Peis.Migrations
{
public partial class init20240325001 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "display_name",
table: "sample_group",
type: "character varying(20)",
maxLength: 20,
nullable: false,
defaultValue: "",
comment: "名称",
oldClrType: typeof(string),
oldType: "character varying(20)",
oldMaxLength: 20,
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "display_name",
table: "sample_group",
type: "character varying(20)",
maxLength: 20,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(20)",
oldMaxLength: 20,
oldComment: "名称");
}
}
}

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

@ -8277,9 +8277,11 @@ namespace Shentun.Peis.Migrations
.HasColumnName("creator_id");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)")
.HasColumnName("display_name");
.HasColumnName("display_name")
.HasComment("名称");
b.Property<int>("DisplayOrder")
.HasColumnType("integer")

Loading…
Cancel
Save