Browse Source

单位分组

bjmzak
wxd 2 years ago
parent
commit
4d9bc6332d
  1. 6
      src/Shentun.Peis.Application.Contracts/CustomerOrgGroups/CreateCustomerOrgGroupDto.cs
  2. 6
      src/Shentun.Peis.Application.Contracts/CustomerOrgGroups/CustomerOrgGroupDto.cs
  3. 6
      src/Shentun.Peis.Application.Contracts/CustomerOrgGroups/UpdateCustomerOrgGroupDto.cs
  4. 11
      src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs
  5. 1
      src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs
  6. 82
      src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs
  7. 13
      src/Shentun.Peis.Domain/CustomerOrgGroups/CustomerOrgGroupManager.cs
  8. 14977
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240607080650_init20240607001.Designer.cs
  9. 29
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240607080650_init20240607001.cs
  10. 8
      src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

6
src/Shentun.Peis.Application.Contracts/CustomerOrgGroups/CreateCustomerOrgGroupDto.cs

@ -58,6 +58,10 @@ namespace Shentun.Peis.CustomerOrgGroups
/// </summary>
public string? Remark { get; set; }
/// <summary>
/// 可增加单位支付金额
/// </summary>
public decimal CanAddMoney { get; set; }
}
}

6
src/Shentun.Peis.Application.Contracts/CustomerOrgGroups/CustomerOrgGroupDto.cs

@ -70,5 +70,11 @@ namespace Shentun.Peis.CustomerOrgGroups
/// 体检次数ID
/// </summary>
public Guid CustomerOrgRegisterId { get; set; }
/// <summary>
/// 可增加单位支付金额
/// </summary>
public decimal CanAddMoney { get; set; }
}
}

6
src/Shentun.Peis.Application.Contracts/CustomerOrgGroups/UpdateCustomerOrgGroupDto.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace Shentun.Peis.CustomerOrgGroups
@ -57,5 +58,10 @@ namespace Shentun.Peis.CustomerOrgGroups
/// 备注
/// </summary>
public string? Remark { get; set; }
/// <summary>
/// 可增加单位支付金额
/// </summary>
public decimal CanAddMoney { get; set; }
}
}

11
src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs

@ -74,7 +74,7 @@ namespace Shentun.Peis.CustomerOrgGroups
}
/// <summary>
/// 获取列表 团检分组
@ -144,7 +144,8 @@ namespace Shentun.Peis.CustomerOrgGroups
CustomerOrgId = s.CustomerOrgRegister.CustomerOrgId,
CustomerOrgName = s.CustomerOrgRegister.CustomerOrg.DisplayName,
MedicalTimes = s.CustomerOrgRegister.MedicalTimes,
CustomerOrgRegisterId = s.CustomerOrgRegisterId
CustomerOrgRegisterId = s.CustomerOrgRegisterId,
CanAddMoney = s.CanAddMoney
}).OrderBy(m => m.DisplayOrder).ToList();
@ -232,7 +233,7 @@ namespace Shentun.Peis.CustomerOrgGroups
entity = await Repository.InsertAsync(entity);
//插入明细
if (input.Details.Any())
{
@ -240,7 +241,7 @@ namespace Shentun.Peis.CustomerOrgGroups
var list = new List<CustomerOrgGroupDetail>();
foreach (var item in createEntityList)
{
item.CustomerOrgGroupId = entity.Id;
item.CustomerOrgGroupId = entity.Id;
var customerOrgGroupDetail = _customerOrgGroupDetailManager.CreateAsync(item);
list.Add(customerOrgGroupDetail);
}
@ -250,7 +251,7 @@ namespace Shentun.Peis.CustomerOrgGroups
await _customerOrgGroupDetailRepository.InsertManyAsync(list);
}
var dto = ObjectMapper.Map<CustomerOrgGroup, CustomerOrgGroupDto>(entity);
return dto;

1
src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs

@ -5245,6 +5245,7 @@ namespace Shentun.Peis.DataMigrations
/// 同步单位编号
/// </summary>
/// <returns></returns>
[RemoteService(false)]
public async Task UpdateCustomerOrgData()
{
var customerOrgs = await _customerOrgRepository.GetListAsync();

82
src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs

@ -34,8 +34,8 @@ using Volo.Abp.Uow;
namespace Shentun.Peis.TransToWebPeis
{
[ApiExplorerSettings(GroupName = "Work")]
[Authorize]
//[ApiExplorerSettings(GroupName = "Work")]
//[Authorize]
public class TransToWebPeisAppService : ApplicationService
{
private readonly IRepository<DeviceType, Guid> _deviceTypeRepository;
@ -54,6 +54,15 @@ namespace Shentun.Peis.TransToWebPeis
private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository;
private readonly IRepository<RegisterCheck, Guid> _registerCheckRepository;
private readonly IRepository<PatientRegisterExter> _patientRegisterExterRepository;
private readonly UnitOfWorkManager _unitOfWorkManager;
private readonly SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = "server=.;uid=sa;pwd=123;database=mypeis0513;Encrypt=false;",
DbType = SqlSugar.DbType.SqlServer,
IsAutoCloseConnection = true
});
public TransToWebPeisAppService(
IRepository<ItemType, Guid> itemTypeRepository,
@ -70,7 +79,8 @@ namespace Shentun.Peis.TransToWebPeis
IRepository<CustomerOrgGroupDetail> customerOrgGroupDetailRepository,
IRepository<PatientRegister, Guid> patientRegisterRepository,
IRepository<RegisterCheck, Guid> registerCheckRepository,
IRepository<PatientRegisterExter> patientRegisterExterRepository)
IRepository<PatientRegisterExter> patientRegisterExterRepository,
UnitOfWorkManager unitOfWorkManager)
{
_itemTypeRepository = itemTypeRepository;
_logger = logger;
@ -87,6 +97,7 @@ namespace Shentun.Peis.TransToWebPeis
_patientRegisterRepository = patientRegisterRepository;
_registerCheckRepository = registerCheckRepository;
_patientRegisterExterRepository = patientRegisterExterRepository;
_unitOfWorkManager = unitOfWorkManager;
}
/// <summary>
/// 上传基础资料
@ -201,7 +212,7 @@ namespace Shentun.Peis.TransToWebPeis
/// <summary>
/// 根据人员登记ID上传人员体检信息
/// 根据人员登记ID上传人员体检信息 1
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@ -700,9 +711,9 @@ namespace Shentun.Peis.TransToWebPeis
foreach (var customerOrgGroup in customerOrgGroups)
{
await WebDb.Ado.ExecuteCommandAsync("INSERT INTO public.customer_org_group(customer_org_group_id, customer_org_group_name, price, for_sex_id, marital_status_id, age_lower_limit, age_upper_limit," +
"job_post, job_title, remark, display_order, customer_org_register_id, concurrency_stamp, creation_time, creator_id,last_modification_time, last_modifier_id) " +
"job_post, job_title, remark, display_order, customer_org_register_id, concurrency_stamp, creation_time, creator_id,last_modification_time, last_modifier_id,can_add_money) " +
"VALUES (@customer_org_group_id,@customer_org_group_name,@price,@for_sex_id,@marital_status_id,@age_lower_limit,@age_upper_limit," +
"@job_post,@job_title,@remark,@display_order,@customer_org_register_id,@concurrency_stamp,@creation_time,@creator_id,@last_modification_time,@last_modifier_id);",
"@job_post,@job_title,@remark,@display_order,@customer_org_register_id,@concurrency_stamp,@creation_time,@creator_id,@last_modification_time,@last_modifier_id,@can_add_money);",
new List<SugarParameter>() {
new SugarParameter("customer_org_group_id",customerOrgGroup.Id),
new SugarParameter("customer_org_group_name",customerOrgGroup.DisplayName),
@ -720,7 +731,8 @@ namespace Shentun.Peis.TransToWebPeis
new SugarParameter("creation_time",customerOrgGroup.CreationTime),
new SugarParameter("creator_id",customerOrgGroup.CreatorId),
new SugarParameter("last_modification_time",customerOrgGroup.LastModificationTime),
new SugarParameter("last_modifier_id",customerOrgGroup.LastModifierId)
new SugarParameter("last_modifier_id",customerOrgGroup.LastModifierId),
new SugarParameter("can_add_money",customerOrgGroup.CanAddMoney),
});
}
@ -765,7 +777,7 @@ namespace Shentun.Peis.TransToWebPeis
#region 人员导入
/// <summary>
/// 人员导入
/// 人员导入 22
/// </summary>
/// <param name="WebDb"></param>
/// <param name="PatientRegisterId"></param>
@ -842,7 +854,7 @@ namespace Shentun.Peis.TransToWebPeis
" sex_hormone_term_id, interpose_measure, medical_conclusion_id, complete_flag, is_medical_start, medical_start_date, summary_date, is_audit, audit_date, is_vip, third_info,remark,medical_center_id," +
"customer_org_register_id, concurrency_stamp, creation_time, creator_id, last_modification_time, last_modifier_id, audit_doctor_id,summary_doctor_id, his_patient_id,third_register_id) VALUES " +
"(@patient_register_id,@patient_register_no,@patient_id,@medical_times,@customer_org_id,@customer_org_group_id::uuid,@medical_package_id::uuid," +
"@patient_name,@sex_id,CAST(@birth_date as timestamp),@age,@job_card_no,@medical_card_no,@marital_status_id,@medical_type_id::uuid,@personnel_type_id::uuid,@job_post,@job_title,@photo," +
"@patient_name,@sex_id,CAST(@birth_date as timestamp),@age::smallint,@job_card_no,@medical_card_no,@marital_status_id,@medical_type_id::uuid,@personnel_type_id::uuid,@job_post,@job_title,@photo," +
"@sex_hormone_term_id::uuid,@interpose_measure,@medical_conclusion_id::uuid,@complete_flag,@is_medical_start,@medical_start_date,CAST(@summary_date as timestamp),@is_audit,CAST(@audit_date as timestamp),@is_vip,@third_info,@remark,@medical_center_id," +
"@customer_org_register_id,@concurrency_stamp,@creation_time,@creator_id,@last_modification_time,@last_modifier_id,@audit_doctor_id::uuid,@summary_doctor_id::uuid,@his_patient_id,@third_register_id);",
new List<SugarParameter>() {
@ -1245,5 +1257,57 @@ namespace Shentun.Peis.TransToWebPeis
}
#endregion
int sumCount = 0;
int handCount = 0;
/// <summary>
/// 导入体检数据到web 全部导入 2024-06-06
/// </summary>
/// <returns></returns>
public async Task ExportPatientRegisterWithDetailData()
{
var connectString = @"Host=62.156.10.86;Port=5432;Database=WebPeis0520;User ID=postgres;Password=st123;";
SqlSugarClient WebDb = new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = connectString,
DbType = SqlSugar.DbType.PostgreSQL,
IsAutoCloseConnection = true
});
string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='patient_register_web' ");
var patientRegisterIds = (await _patientRegisterRepository.GetQueryableAsync())
.Where(m => string.Compare(m.Id.ToString(), string.IsNullOrEmpty(nextKeyValue) ? "" : nextKeyValue) > 0).OrderBy(o => o.Id).Select(s => s.Id).Take(1000).ToList();
foreach (var patientRegisterId in patientRegisterIds)
{
sumCount++;
using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
{
var IsPatient = (await WebDb.Ado.GetDataTableAsync($"select patient_register_id from patient_register where patient_register_id='{patientRegisterId}'")).Rows.Count;
if (IsPatient == 0)
{
await TransPatientRegisterWithDetailAsync(WebDb, patientRegisterId);
handCount++;
}
nextKeyValue = patientRegisterId.ToString();
}
await Db.Ado.ExecuteCommandAsync($"update tb_export_key set keyvalue='{patientRegisterId}',addtime=getdate(),handlecount+=1 where tablename='patient_register_web' ");
}
_logger.LogInformation($"当前查询数据:{sumCount},新增数据:{handCount}");
await ExportPatientRegisterWithDetailData();
}
}
}

13
src/Shentun.Peis.Domain/CustomerOrgGroups/CustomerOrgGroupManager.cs

@ -59,7 +59,7 @@ namespace Shentun.Peis.CustomerOrgGroups
if (customerOrgId != null && customerOrgId != Guid.Empty)
{
//检查单位状态
await CheckCustomerOrgStatus(customerOrgId.Value);
await CheckCustomerOrgStatus(customerOrgId.Value);
}
Guid NewCustomerorgRegisterId = Guid.Empty;
if (IsMaxMedicalTimes == 'Y')
@ -80,7 +80,7 @@ namespace Shentun.Peis.CustomerOrgGroups
NewCustomerorgRegisterId = CustomerOrgRegisterId.Value;
}
if((await _repository.GetQueryableAsync()).Where(o=>o.CustomerOrgRegisterId == NewCustomerorgRegisterId &&
if ((await _repository.GetQueryableAsync()).Where(o => o.CustomerOrgRegisterId == NewCustomerorgRegisterId &&
o.DisplayName == entity.DisplayName).Count() > 0)
{
throw new UserFriendlyException($"不允许有同名的分组名称");
@ -98,7 +98,8 @@ namespace Shentun.Peis.CustomerOrgGroups
Remark = entity.Remark,
DisplayOrder = await EntityHelper.CreateMaxDisplayOrder<CustomerOrgGroup>(_repository),
ForSexId = entity.ForSexId,
Price = entity.Price
Price = entity.Price,
CanAddMoney = entity.CanAddMoney
};
}
/// <summary>
@ -130,12 +131,12 @@ namespace Shentun.Peis.CustomerOrgGroups
targetEntity.Remark = sourceEntity.Remark;
targetEntity.ForSexId = sourceEntity.ForSexId;
targetEntity.Price = sourceEntity.Price;
targetEntity.CanAddMoney = sourceEntity.CanAddMoney;
}
/// <summary>
/// 修改排序 置顶,置底
@ -247,7 +248,7 @@ namespace Shentun.Peis.CustomerOrgGroups
DataHelper.CheckStringIsNull(entity.DisplayName, "名称");
DataHelper.CheckForSex(entity.ForSexId);
DataHelper.CheckForMaritalStatus(entity.MaritalStatusId);
if(entity.AgeLowerLimit < 0)
if (entity.AgeLowerLimit < 0)
{
throw new UserFriendlyException("年龄下限不能小于0");
}

14977
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240607080650_init20240607001.Designer.cs
File diff suppressed because it is too large
View File

29
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240607080650_init20240607001.cs

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.Peis.Migrations
{
public partial class init20240607001 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<decimal>(
name: "can_add_money",
table: "customer_org_group",
type: "numeric(10,2)",
precision: 10,
scale: 2,
nullable: false,
defaultValueSql: "0",
comment: "可增加单位支付金额");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "can_add_money",
table: "customer_org_group");
}
}
}

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

@ -2986,6 +2986,14 @@ namespace Shentun.Peis.Migrations
.HasDefaultValueSql("200")
.HasComment("适用年龄上限");
b.Property<decimal>("CanAddMoney")
.ValueGeneratedOnAdd()
.HasPrecision(10, 2)
.HasColumnType("numeric(10,2)")
.HasColumnName("can_add_money")
.HasDefaultValueSql("0")
.HasComment("可增加单位支付金额");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)

Loading…
Cancel
Save