|
|
|
@ -6,6 +6,7 @@ using Shentun.Peis.CustomerOrgGroupDetails; |
|
|
|
using Shentun.Peis.CustomerOrgGroups; |
|
|
|
using Shentun.Peis.HelperDto; |
|
|
|
using Shentun.Peis.Models; |
|
|
|
using Shentun.Peis.PatientRegisters; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
@ -16,6 +17,7 @@ using Volo.Abp.Application.Dtos; |
|
|
|
using Volo.Abp.Application.Services; |
|
|
|
using Volo.Abp.Domain.Repositories; |
|
|
|
using Volo.Abp.Identity; |
|
|
|
using Xceed.Document.NET; |
|
|
|
|
|
|
|
namespace Shentun.Peis.CustomerOrgGroups |
|
|
|
{ |
|
|
|
@ -93,7 +95,7 @@ namespace Shentun.Peis.CustomerOrgGroups |
|
|
|
[HttpGet("api/app/customerorggroup/getlistinfilter")] |
|
|
|
public async Task<List<CustomerOrgGroupOrCustomerOrgDto>> GetListInFilterAsync(GetListDto input) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
var oldlist = (await Repository.GetQueryableAsync()). |
|
|
|
Include(x => x.CustomerOrgRegister). |
|
|
|
Include(x => x.CustomerOrgRegister.CustomerOrg).AsEnumerable(); |
|
|
|
@ -110,7 +112,7 @@ namespace Shentun.Peis.CustomerOrgGroups |
|
|
|
if (input.MedicalTimes != null) |
|
|
|
oldlist = oldlist.Where(m => m.CustomerOrgRegister.MedicalTimes == input.MedicalTimes); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entdto = oldlist.OrderBy(o => o.CustomerOrgRegister.CustomerOrg.DisplayOrder) |
|
|
|
.ThenBy(o => o.CustomerOrgRegister.MedicalTimes) |
|
|
|
.ThenBy(o => o.DisplayOrder) |
|
|
|
@ -140,7 +142,7 @@ namespace Shentun.Peis.CustomerOrgGroups |
|
|
|
}).OrderBy(m => m.DisplayOrder).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
return entdto; |
|
|
|
return entdto; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -359,5 +361,81 @@ namespace Shentun.Peis.CustomerOrgGroups |
|
|
|
} |
|
|
|
return new List<CustomerOrgGroupDto>(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 复制上次分组
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("api/app/CustomerOrgGroup/CopyLastGrouping")] |
|
|
|
public async Task CopyLastGroupingAsync(CustomerOrgRegisterIdInputDto input) |
|
|
|
{ |
|
|
|
if (input == null) |
|
|
|
throw new UserFriendlyException("请求参数有误"); |
|
|
|
var customerOrgRegisterEnt = await _customerOrgRegisterRepository.GetAsync(input.CustomerOrgRegisterId); |
|
|
|
if (customerOrgRegisterEnt == null) |
|
|
|
throw new UserFriendlyException("单位体检次数不存在"); |
|
|
|
if (customerOrgRegisterEnt.IsComplete == 'Y') |
|
|
|
throw new UserFriendlyException("该单位体检次数已完成,无法复制"); |
|
|
|
|
|
|
|
var prevCustomerOrgRegister = (await _customerOrgRegisterRepository.GetQueryableAsync()) |
|
|
|
.Where(m => m.CustomerOrgId == customerOrgRegisterEnt.CustomerOrgId && m.MedicalTimes < customerOrgRegisterEnt.MedicalTimes) |
|
|
|
.OrderByDescending(o => o.MedicalTimes).FirstOrDefault(); |
|
|
|
|
|
|
|
if (prevCustomerOrgRegister != null) |
|
|
|
{ |
|
|
|
#region 创建分组、明细
|
|
|
|
//上一次体检次数的分组
|
|
|
|
var prevCustomerOrgGroupList = (await Repository.GetQueryableAsync()).Where(m => m.CustomerOrgRegisterId == prevCustomerOrgRegister.Id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var group in prevCustomerOrgGroupList) |
|
|
|
{ |
|
|
|
Guid customerOrgGroupId = GuidGenerator.Create(); |
|
|
|
var newCustomerOrgGroup = new CustomerOrgGroup(customerOrgGroupId) |
|
|
|
{ |
|
|
|
AgeLowerLimit = group.AgeLowerLimit, |
|
|
|
AgeUpperLimit = group.AgeUpperLimit, |
|
|
|
CustomerOrgRegisterId = customerOrgRegisterEnt.Id, |
|
|
|
DisplayName = group.DisplayName, |
|
|
|
DisplayOrder = group.DisplayOrder, |
|
|
|
ForSexId = group.ForSexId, |
|
|
|
JobPost = group.JobPost, |
|
|
|
JobTitle = group.JobTitle, |
|
|
|
MaritalStatusId = group.MaritalStatusId, |
|
|
|
Price = group.Price, |
|
|
|
Remark = group.Remark |
|
|
|
}; |
|
|
|
|
|
|
|
await Repository.InsertAsync(newCustomerOrgGroup, true); |
|
|
|
|
|
|
|
#region 创建分组明细
|
|
|
|
|
|
|
|
var prevCustomerOrgGroupDetailList = (await _customerOrgGroupDetailRepository.GetQueryableAsync()).Where(m => m.CustomerOrgGroupId == group.Id); |
|
|
|
foreach (var customerOrgGroupDetail in prevCustomerOrgGroupDetailList) |
|
|
|
{ |
|
|
|
var newcustomerOrgGroupDetail = new CustomerOrgGroupDetail |
|
|
|
{ |
|
|
|
Amount = customerOrgGroupDetail.Amount, |
|
|
|
AsbitemId = customerOrgGroupDetail.AsbitemId, |
|
|
|
CustomerOrgGroupId = customerOrgGroupId, |
|
|
|
Price = customerOrgGroupDetail.Price |
|
|
|
}; |
|
|
|
|
|
|
|
await _customerOrgGroupDetailRepository.InsertAsync(newcustomerOrgGroupDetail); |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("上一次单位体检次数不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |