18 changed files with 30936 additions and 296 deletions
-
2src/Shentun.Peis.Application.Contracts/MyUser/IdentityUserWithExtensionDto.cs
-
44src/Shentun.Peis.Application.Contracts/OcCheckTypeDetails/CreateOcCheckTypeDetailManyInputDto.cs
-
36src/Shentun.Peis.Application.Contracts/OcCheckTypeDetails/OcCheckTypeDetailDto.cs
-
21src/Shentun.Peis.Application.Contracts/OcCheckTypeDetails/OcCheckTypeIdAndPoisonIdInputDto.cs
-
25src/Shentun.Peis.Application.Contracts/RegisterCheckPictures/ImportRegisterCheckPictureInputDto.cs
-
5src/Shentun.Peis.Application/MyUser/MyUserAppService.cs
-
142src/Shentun.Peis.Application/OcCheckTypeDetails/OcCheckTypeDetailAppService.cs
-
29src/Shentun.Peis.Application/RegisterCheckPictures/RegisterCheckPictureAppService.cs
-
4src/Shentun.Peis.DbMigrator/appsettings.json
-
63src/Shentun.Peis.Domain/OcCheckTypeDetails/OcCheckTypeDetail.cs
-
66src/Shentun.Peis.Domain/OcCheckTypeDetails/OcCheckTypeDetailManager.cs
-
33src/Shentun.Peis.EntityFrameworkCore/DbMapping/OcCheckTypeDetails/OcCheckTypeDetailDbMapping.cs
-
6src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
-
15034src/Shentun.Peis.EntityFrameworkCore/Migrations/20240702095856_检查类别对应项目.Designer.cs
-
35src/Shentun.Peis.EntityFrameworkCore/Migrations/20240702095856_检查类别对应项目.cs
-
15040src/Shentun.Peis.EntityFrameworkCore/Migrations/20240702100812_检查类别对应项目2.Designer.cs
-
26src/Shentun.Peis.EntityFrameworkCore/Migrations/20240702100812_检查类别对应项目2.cs
-
41src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs
@ -0,0 +1,44 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.OcCheckTypeDetails |
|||
{ |
|||
public class CreateOcCheckTypeDetailManyInputDto |
|||
{ |
|||
/// <summary>
|
|||
/// 检查类别ID
|
|||
/// </summary>
|
|||
public Guid OcCheckTypeId { get; set; } |
|||
/// <summary>
|
|||
/// 毒害因素ID
|
|||
/// </summary>
|
|||
public Guid PoisonId { get; set; } |
|||
|
|||
public List<CreateOcCheckTypeDetailManyInputDetailDto> Details { get; set; } = new List<CreateOcCheckTypeDetailManyInputDetailDto>(); |
|||
} |
|||
|
|||
|
|||
|
|||
public class CreateOcCheckTypeDetailManyInputDetailDto |
|||
{ |
|||
/// <summary>
|
|||
/// 组合项目ID
|
|||
/// </summary>
|
|||
public Guid AsbitemId { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 价格
|
|||
/// </summary>
|
|||
public decimal Price { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
public short Amount { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
using Shentun.Peis.Asbitems; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.OcCheckTypeDetails |
|||
{ |
|||
public class OcCheckTypeDetailDto: AsbitemDto |
|||
{ |
|||
/// <summary>
|
|||
/// 套餐中价格
|
|||
/// </summary>
|
|||
public decimal OcCheckTypeDetailPrice { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
public short OcCheckTypeDetailAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 套餐中金额
|
|||
/// </summary>
|
|||
public decimal OcCheckTypeDetailMoney { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 项目金额
|
|||
/// </summary>
|
|||
public decimal AsbitemMoney { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 折扣
|
|||
/// </summary>
|
|||
public decimal Discount { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.OcCheckTypeDetails |
|||
{ |
|||
public class OcCheckTypeIdAndPoisonIdInputDto |
|||
{ |
|||
/// <summary>
|
|||
/// 检查类别ID
|
|||
/// </summary>
|
|||
public Guid OcCheckTypeId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 毒害因素ID
|
|||
/// </summary>
|
|||
public List<Guid> PoisonIds { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.RegisterCheckPictures |
|||
{ |
|||
public class ImportRegisterCheckPictureInputDto |
|||
{ |
|||
/// <summary>
|
|||
/// 检查条码号
|
|||
/// </summary>
|
|||
public string CheckRequestNo { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 图片原始名称
|
|||
/// </summary>
|
|||
public string PictureName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 图片base64字符串
|
|||
/// </summary>
|
|||
public string PictureBase64 { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,142 @@ |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using NPOI.Util; |
|||
using Shentun.Peis.AsbitemDetails; |
|||
using Shentun.Peis.Items; |
|||
using Shentun.Peis.MedicalPackageDetails; |
|||
using Shentun.Peis.Models; |
|||
using SqlSugar; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Domain.Repositories; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace Shentun.Peis.OcCheckTypeDetails |
|||
{ |
|||
/// <summary>
|
|||
/// 职业病检查类别对应的项目
|
|||
/// </summary>
|
|||
[ApiExplorerSettings(GroupName = "Work")] |
|||
[Authorize] |
|||
public class OcCheckTypeDetailAppService : ApplicationService |
|||
{ |
|||
private readonly IRepository<OcCheckTypeDetail> _ocCheckTypeDetailRepository; |
|||
private readonly IRepository<Asbitem, Guid> _asbitemRepository; |
|||
private readonly OcCheckTypeDetailManager _manager; |
|||
private readonly CacheService _cacheService; |
|||
|
|||
public OcCheckTypeDetailAppService( |
|||
IRepository<OcCheckTypeDetail> ocCheckTypeDetailRepository, |
|||
OcCheckTypeDetailManager manager, |
|||
CacheService cacheService, |
|||
IRepository<Asbitem, Guid> asbitemRepository) |
|||
{ |
|||
_ocCheckTypeDetailRepository = ocCheckTypeDetailRepository; |
|||
_manager = manager; |
|||
_cacheService = cacheService; |
|||
_asbitemRepository = asbitemRepository; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 批量创建 先删除
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/OcCheckTypeDetail/CreateOcCheckTypeDetailMany")] |
|||
public async Task CreateOcCheckTypeDetailManyAsync(CreateOcCheckTypeDetailManyInputDto input) |
|||
{ |
|||
await _manager.CheckAndDeleteAsync(input.OcCheckTypeId, input.PoisonId); |
|||
|
|||
if (input.Details.Any()) |
|||
{ |
|||
List<OcCheckTypeDetail> ocCheckTypeDetails = new List<OcCheckTypeDetail>(); |
|||
foreach (var details in input.Details) |
|||
{ |
|||
var entity = new OcCheckTypeDetail |
|||
{ |
|||
AsbitemId = details.AsbitemId, |
|||
Price = details.Price, |
|||
Amount = details.Amount, |
|||
OcCheckTypeId = input.OcCheckTypeId, |
|||
PoisonId = input.PoisonId |
|||
}; |
|||
ocCheckTypeDetails.Add(_manager.CreateAsync(entity)); |
|||
} |
|||
|
|||
if (ocCheckTypeDetails.Count > 0) |
|||
{ |
|||
await _ocCheckTypeDetailRepository.InsertManyAsync(ocCheckTypeDetails); |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 获取职业病检查类别、毒害因素对应的组合项目列表
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/OcCheckTypeDetail/GetOcCheckTypeDetailByOcCheckTypeIdAndPoisonId")] |
|||
public async Task<List<OcCheckTypeDetailDto>> GetOcCheckTypeDetailByOcCheckTypeIdAndPoisonIdAsync(OcCheckTypeIdAndPoisonIdInputDto input) |
|||
{ |
|||
|
|||
if (!input.PoisonIds.Any()) |
|||
throw new UserFriendlyException("毒害因素不能为空"); |
|||
|
|||
var query = from ocCheckTypeDetail in await _ocCheckTypeDetailRepository.GetQueryableAsync() |
|||
join asbitem in await _asbitemRepository.GetQueryableAsync() on ocCheckTypeDetail.AsbitemId equals asbitem.Id |
|||
where ocCheckTypeDetail.OcCheckTypeId == input.OcCheckTypeId && input.PoisonIds.Contains(ocCheckTypeDetail.PoisonId) |
|||
select new |
|||
{ |
|||
ocCheckTypeDetail, |
|||
asbitem |
|||
}; |
|||
|
|||
var entdto = query.ToList().GroupBy(g=>g.asbitem).Select(s => new OcCheckTypeDetailDto |
|||
{ |
|||
ClinicalMeaning = s.Key.ClinicalMeaning, |
|||
CreationTime = s.Key.CreationTime, |
|||
CreatorId = s.Key.CreatorId, |
|||
DefaultResult = s.Key.DefaultResult, |
|||
DeviceTypeId = s.Key.DeviceTypeId, |
|||
DiagnosisFunction = s.Key.DiagnosisFunction, |
|||
DisplayName = s.Key.DisplayName, |
|||
DisplayOrder = s.Key.DisplayOrder, |
|||
ForSexId = s.Key.ForSexId, |
|||
Id = s.Key.Id, |
|||
IsActive = s.Key.IsActive, |
|||
IsBeforeEat = s.Key.IsBeforeEat, |
|||
IsCheck = s.Key.IsCheck, |
|||
IsContinueProcess = s.Key.IsContinueProcess, |
|||
IsDiagnosisFunction = s.Key.IsDiagnosisFunction, |
|||
IsItemResultMerger = s.Key.IsItemResultMerger, |
|||
IsPictureRotate = s.Key.IsPictureRotate, |
|||
ItemTypeId = s.Key.ItemTypeId, |
|||
LastModificationTime = s.Key.LastModificationTime, |
|||
LastModifierId = s.Key.LastModifierId, |
|||
Price = s.Key.Price, |
|||
QueueTime = s.Key.QueueTime, |
|||
ShortName = s.Key.ShortName, |
|||
SimpleCode = s.Key.SimpleCode, |
|||
AsbitemMoney = s.FirstOrDefault().ocCheckTypeDetail.Amount * s.Key.Price, |
|||
Discount = s.Key.Price == 0 ? 100 : Math.Round(s.FirstOrDefault().ocCheckTypeDetail.Price * 100 / s.Key.Price, 2), |
|||
OcCheckTypeDetailAmount = s.FirstOrDefault().ocCheckTypeDetail.Amount, |
|||
OcCheckTypeDetailMoney = s.FirstOrDefault().ocCheckTypeDetail.Amount * s.FirstOrDefault().ocCheckTypeDetail.Price, |
|||
OcCheckTypeDetailPrice = s.FirstOrDefault().ocCheckTypeDetail.Price |
|||
}).ToList(); |
|||
|
|||
return entdto; |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,63 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
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.OcCheckTypeDetails |
|||
{ |
|||
/// <summary>
|
|||
/// 职业病检查类别 毒害因素 对应的项目
|
|||
/// </summary>
|
|||
[Table("oc_check_type_detail")] |
|||
public class OcCheckTypeDetail : Entity, IHasConcurrencyStamp |
|||
{ |
|||
/// <summary>
|
|||
/// 检查类别ID
|
|||
/// </summary>
|
|||
[Key] |
|||
[Column("oc_check_type_id")] |
|||
public Guid OcCheckTypeId { get; set; } |
|||
/// <summary>
|
|||
/// 毒害因素ID
|
|||
/// </summary>
|
|||
[Key] |
|||
[Column("poison_id")] |
|||
public Guid PoisonId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 组合项目编号
|
|||
/// </summary>
|
|||
[Key] |
|||
[Column("asbitem_id")] |
|||
public Guid AsbitemId { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 价格
|
|||
/// </summary>
|
|||
[Column("price")] |
|||
[Precision(10, 2)] |
|||
public decimal Price { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
[Column("amount")] |
|||
public short Amount { get; set; } |
|||
|
|||
[Column("concurrency_stamp")] |
|||
public string ConcurrencyStamp { get; set; } |
|||
|
|||
public override object[] GetKeys() |
|||
{ |
|||
return new object[] { OcCheckTypeId, PoisonId, AsbitemId }; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
using Shentun.Peis.Models; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
using Volo.Abp.Domain.Services; |
|||
|
|||
namespace Shentun.Peis.OcCheckTypeDetails |
|||
{ |
|||
public class OcCheckTypeDetailManager : DomainService |
|||
{ |
|||
|
|||
private readonly IRepository<OcCheckTypeDetail> _repository; |
|||
|
|||
public OcCheckTypeDetailManager( |
|||
IRepository<OcCheckTypeDetail> repository |
|||
) |
|||
{ |
|||
_repository = repository; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 创建
|
|||
/// </summary>
|
|||
/// <param name="entity"></param>
|
|||
/// <returns></returns>
|
|||
public OcCheckTypeDetail CreateAsync(OcCheckTypeDetail entity) |
|||
{ |
|||
DataHelper.CheckGuidIsDefaultValue(entity.AsbitemId, "组合项目编号"); |
|||
DataHelper.CheckGuidIsDefaultValue(entity.OcCheckTypeId, "检查类别Id"); |
|||
DataHelper.CheckGuidIsDefaultValue(entity.PoisonId, "毒害因素Id"); |
|||
if (entity.Price < 0) |
|||
{ |
|||
throw new ArgumentException($"价格参数为:{entity.Price},是无效值,只能大于等于0"); |
|||
} |
|||
|
|||
if (entity.Amount <= 0) |
|||
{ |
|||
throw new ArgumentException($"数量参数为:{entity.Amount},是无效值,只能大于0"); |
|||
} |
|||
|
|||
return entity; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 删除职业病检查类别对应的项目明细
|
|||
/// </summary>
|
|||
/// <param name="OcCheckTypeId"></param>
|
|||
/// <param name="PoisonId"></param>
|
|||
/// <returns></returns>
|
|||
public async Task CheckAndDeleteAsync(Guid OcCheckTypeId, Guid PoisonId) |
|||
{ |
|||
var ocCheckTypeDetailList = await _repository.GetListAsync(m => m.OcCheckTypeId == OcCheckTypeId && m.PoisonId == PoisonId); |
|||
if (ocCheckTypeDetailList.Any()) |
|||
{ |
|||
await _repository.DeleteManyAsync(ocCheckTypeDetailList); |
|||
|
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
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.OcCheckTypeDetails; |
|||
using Shentun.Peis.EntityFrameworkCore; |
|||
|
|||
namespace Shentun.Peis.DbMapping |
|||
{ |
|||
|
|||
internal class OcCheckTypeDetailDbMapping : IEntityTypeConfiguration<OcCheckTypeDetail> |
|||
{ |
|||
public void Configure(EntityTypeBuilder<OcCheckTypeDetail> entity) |
|||
{ |
|||
entity.HasKey(e => new { e.OcCheckTypeId, e.PoisonId, e.AsbitemId }) |
|||
.HasName("pk_oc_check_type_detail"); |
|||
|
|||
entity.HasComment("职业病检查类别、毒害因素对应的组合项目"); |
|||
entity.Property(t => t.AsbitemId).HasComment("组合项目编号").IsRequired().IsFixedLength(); |
|||
|
|||
entity.Property(e => e.OcCheckTypeId).HasComment("检查类别").IsFixedLength().IsRequired(); |
|||
|
|||
//entity.Property(e => e.CreationTime).HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");
|
|||
|
|||
|
|||
entity.ConfigureByConvention(); |
|||
} |
|||
} |
|||
} |
|||
15034
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240702095856_检查类别对应项目.Designer.cs
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,35 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace Shentun.Peis.Migrations |
|||
{ |
|||
public partial class 检查类别对应项目 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "oc_check_type_detail", |
|||
columns: table => new |
|||
{ |
|||
oc_check_type_id = table.Column<Guid>(type: "uuid", fixedLength: true, nullable: false, comment: "检查类别"), |
|||
poison_id = table.Column<Guid>(type: "uuid", nullable: false), |
|||
asbitem_id = table.Column<Guid>(type: "uuid", fixedLength: true, nullable: false, comment: "组合项目编号"), |
|||
price = table.Column<decimal>(type: "numeric(10,2)", precision: 10, scale: 2, nullable: false), |
|||
amount = table.Column<short>(type: "smallint", nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("pk_oc_check_type_detail", x => new { x.oc_check_type_id, x.poison_id, x.asbitem_id }); |
|||
}, |
|||
comment: "职业病检查类别、毒害因素对应的组合项目"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "oc_check_type_detail"); |
|||
} |
|||
} |
|||
} |
|||
15040
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240702100812_检查类别对应项目2.Designer.cs
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,26 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace Shentun.Peis.Migrations |
|||
{ |
|||
public partial class 检查类别对应项目2 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<string>( |
|||
name: "concurrency_stamp", |
|||
table: "oc_check_type_detail", |
|||
type: "character varying(40)", |
|||
maxLength: 40, |
|||
nullable: true); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "concurrency_stamp", |
|||
table: "oc_check_type_detail"); |
|||
} |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue