|
|
|
@ -1,6 +1,7 @@ |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Shentun.Peis.LisRequests; |
|
|
|
using Shentun.Peis.Models; |
|
|
|
using Shentun.Peis.PatientRegisters; |
|
|
|
using Shentun.Peis.SumSuggestionContents; |
|
|
|
@ -14,11 +15,11 @@ using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Text; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using TencentCloud.Wedata.V20210820.Models; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Application.Services; |
|
|
|
using Volo.Abp.Domain.Repositories; |
|
|
|
using Volo.Abp.Identity; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
|
|
|
|
namespace Shentun.Peis.PrintReports |
|
|
|
{ |
|
|
|
@ -31,6 +32,12 @@ namespace Shentun.Peis.PrintReports |
|
|
|
{ |
|
|
|
private readonly IRepository<CustomerOrg, Guid> _customerOrgRepository; |
|
|
|
private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository; |
|
|
|
private readonly IRepository<RegisterCheckAsbitem, Guid> _registerCheckAsbitemRepository; |
|
|
|
private readonly IRepository<Asbitem, Guid> _asbitemRepository; |
|
|
|
private readonly IRepository<LisRequest, Guid> _lisRequestRepository; |
|
|
|
private readonly IRepository<SampleGroup, Guid> _sampleGroupRepository; |
|
|
|
private readonly IRepository<SampleContainer, Guid> _sampleContainerRepository; |
|
|
|
private readonly IRepository<SampleType, Guid> _sampleTypeRepository; |
|
|
|
private readonly IRepository<Sex> _sexRegisterRepository; |
|
|
|
private readonly IRepository<ResultStatus> _resultStatusRepository; |
|
|
|
private readonly IRepository<SumSummaryHeader, Guid> _sumSummaryHeaderRepository; |
|
|
|
@ -43,10 +50,18 @@ namespace Shentun.Peis.PrintReports |
|
|
|
private readonly ICheckRequestNoReportRepository _checkRequestNoReportRepository; |
|
|
|
private readonly IChargeReportRepository _chargeReportRepository; |
|
|
|
private readonly SysParmValueManager _sysParmValueManager; |
|
|
|
|
|
|
|
private readonly CacheService _cacheService; |
|
|
|
private readonly LisRequestManager _lisRequestManager; |
|
|
|
private readonly IUnitOfWorkManager _unitOfWorkManager; |
|
|
|
public PrintReportAppService( |
|
|
|
IRepository<CustomerOrg, Guid> customerOrgRepository, |
|
|
|
IRepository<PatientRegister, Guid> patientRegisterRepository, |
|
|
|
IRepository<RegisterCheckAsbitem, Guid> registerCheckAsbitemRepository, |
|
|
|
IRepository<Asbitem, Guid> asbitemRepository, |
|
|
|
IRepository<LisRequest, Guid> lisRequestRepository, |
|
|
|
IRepository<SampleGroup, Guid> sampleGroupRepository, |
|
|
|
IRepository<SampleContainer, Guid> sampleContainerRepository, |
|
|
|
IRepository<SampleType, Guid> sampleTypeRepository, |
|
|
|
IRepository<Sex> sexRegisterRepository, |
|
|
|
IRepository<ResultStatus> resultStatusRepository, |
|
|
|
IRepository<SumSummaryHeader, Guid> sumSummaryHeaderRepository, |
|
|
|
@ -58,7 +73,10 @@ namespace Shentun.Peis.PrintReports |
|
|
|
ILisRequestReportRepository lisRequestReportRepository, |
|
|
|
ICheckRequestNoReportRepository checkRequestNoReportRepository, |
|
|
|
IChargeReportRepository chargeReportRepository, |
|
|
|
SysParmValueManager sysParmValueManager |
|
|
|
SysParmValueManager sysParmValueManager, |
|
|
|
CacheService cacheService, |
|
|
|
LisRequestManager lisRequestManager, |
|
|
|
IUnitOfWorkManager unitOfWorkManager |
|
|
|
) |
|
|
|
{ |
|
|
|
this._customerOrgRepository = customerOrgRepository; |
|
|
|
@ -75,6 +93,15 @@ namespace Shentun.Peis.PrintReports |
|
|
|
this._checkRequestNoReportRepository = checkRequestNoReportRepository; |
|
|
|
this._chargeReportRepository = chargeReportRepository; |
|
|
|
this._sysParmValueManager = sysParmValueManager; |
|
|
|
_registerCheckAsbitemRepository = registerCheckAsbitemRepository; |
|
|
|
_asbitemRepository = asbitemRepository; |
|
|
|
_lisRequestRepository = lisRequestRepository; |
|
|
|
_sampleGroupRepository = sampleGroupRepository; |
|
|
|
_sampleContainerRepository = sampleContainerRepository; |
|
|
|
_sampleTypeRepository = sampleTypeRepository; |
|
|
|
_cacheService = cacheService; |
|
|
|
_lisRequestManager = lisRequestManager; |
|
|
|
_unitOfWorkManager = unitOfWorkManager; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -108,10 +135,76 @@ namespace Shentun.Peis.PrintReports |
|
|
|
/// </summary>
|
|
|
|
/// <param name="PatientRegisterId"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("api/app/printreport/getlisrequestreport")] |
|
|
|
[HttpPost("api/app/printreport/GetLisRequestReport")] |
|
|
|
public async Task<List<LisRequestReportDto>> GetLisRequestReportAsync(Guid PatientRegisterId) |
|
|
|
{ |
|
|
|
return await _lisRequestReportRepository.GetLisRequestReportAsync(PatientRegisterId); |
|
|
|
//生成LIS条码
|
|
|
|
await _lisRequestManager.SetLisRequestAsync(PatientRegisterId); |
|
|
|
await _unitOfWorkManager.Current.SaveChangesAsync(); |
|
|
|
//检索条码数据
|
|
|
|
var customerOrgList = await _customerOrgRepository.GetListAsync(); |
|
|
|
|
|
|
|
var query = (from a in await _patientRegisterRepository.GetQueryableAsync() |
|
|
|
join x in await _sexRegisterRepository.GetQueryableAsync() on a.SexId equals x.Id into xx |
|
|
|
from ax in xx.DefaultIfEmpty() |
|
|
|
join b in await _registerCheckAsbitemRepository.GetQueryableAsync() on a.Id equals b.PatientRegisterId into bb |
|
|
|
from ab in bb.DefaultIfEmpty() |
|
|
|
join f in await _asbitemRepository.GetQueryableAsync() on ab.AsbitemId equals f.Id into ff |
|
|
|
from af in ff.DefaultIfEmpty() |
|
|
|
join c in await _lisRequestRepository.GetQueryableAsync() on ab.LisRequestId equals c.Id into cc |
|
|
|
from ac in cc.DefaultIfEmpty() |
|
|
|
join d in await _sampleContainerRepository.GetQueryableAsync() on ac.SampleContainerId equals d.Id into dd |
|
|
|
from ad in dd.DefaultIfEmpty() |
|
|
|
join e in await _sampleTypeRepository.GetQueryableAsync() on ac.SampleTypeId equals e.Id into ee |
|
|
|
from ae in ee.DefaultIfEmpty() |
|
|
|
where (a.Id == PatientRegisterId && ab.LisRequestId != null) |
|
|
|
select new LisRequestReportDto |
|
|
|
{ |
|
|
|
Age = a.Age, |
|
|
|
AsbitemName = string.IsNullOrEmpty(af.ShortName) ? af.DisplayName : af.ShortName, |
|
|
|
LisRequestNo = ac.LisRequestNo, |
|
|
|
PatientName = a.PatientName, |
|
|
|
PatientRegisterNo = a.PatientRegisterNo, |
|
|
|
SampleContainerName = ad.DisplayName, |
|
|
|
ContainerColor = ad.ContainerColor, |
|
|
|
SampleContainerRemark = ad.ContainerRemark, |
|
|
|
SampleTypeName = ae.DisplayName, |
|
|
|
SexName = ax.DisplayName, |
|
|
|
CustomerOrgName = _cacheService.GetTopCustomerOrgAsync(a.CustomerOrgId).Result.DisplayName, |
|
|
|
DepartmentName = _cacheService.GetCustomerOrgNameAsync(a.CustomerOrgId).Result |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
var entlist = query.GroupBy(g => new |
|
|
|
{ |
|
|
|
g.LisRequestNo, |
|
|
|
g.Age, |
|
|
|
g.PatientName, |
|
|
|
g.PatientRegisterNo, |
|
|
|
g.SampleContainerName, |
|
|
|
g.ContainerColor, |
|
|
|
g.SampleContainerRemark, |
|
|
|
g.SampleTypeName, |
|
|
|
g.SexName, |
|
|
|
g.CustomerOrgName, |
|
|
|
g.DepartmentName |
|
|
|
}) |
|
|
|
.Select(s => new LisRequestReportDto |
|
|
|
{ |
|
|
|
SexName = s.Key.SexName, |
|
|
|
SampleTypeName = s.Key.SampleTypeName, |
|
|
|
SampleContainerRemark = s.Key.SampleContainerRemark, |
|
|
|
SampleContainerName = s.Key.SampleContainerName, |
|
|
|
ContainerColor = s.Key.ContainerColor, |
|
|
|
PatientRegisterNo = s.Key.PatientRegisterNo, |
|
|
|
PatientName = s.Key.PatientName, |
|
|
|
Age = s.Key.Age, |
|
|
|
LisRequestNo = s.Key.LisRequestNo, |
|
|
|
CustomerOrgName = s.Key.CustomerOrgName, |
|
|
|
DepartmentName = s.Key.DepartmentName, |
|
|
|
AsbitemName = string.Join(",", s.Select(d => d.AsbitemName)) |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
return entlist; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|