From 7912835efdf26e121f07e702c2965e57fe8cdc76 Mon Sep 17 00:00:00 2001 From: "DESKTOP-G961P6V\\Zhh" <839860190@qq.com> Date: Sat, 20 Apr 2024 19:27:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=BB=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LisRequests/AppendLisRequestDto.cs | 4 +- .../LisRequests/LisRequestAppService.cs | 14 +-- .../PrintReports/PrintReportAppService.cs | 103 ++++++++++++++++- .../SumSuggestionHeaderAppService.cs | 4 +- .../LisRequests/LisRequestManager.cs | 106 +++++------------- .../PrintReports/LisRequestReportDto.cs | 1 + .../EntityFrameworkCore/PeisDbContext.cs | 2 +- .../PatientRegisterChargeRepository.cs | 2 +- .../CheckRequestNoReportRepository.cs | 2 +- .../LisRequestReportRepository.cs | 72 +----------- .../SumSummaryReportRepository.cs | 2 +- .../SumSuggestionHeaderAppServiceTest.cs | 20 +++- 12 files changed, 161 insertions(+), 171 deletions(-) diff --git a/src/Shentun.Peis.Application.Contracts/LisRequests/AppendLisRequestDto.cs b/src/Shentun.Peis.Application.Contracts/LisRequests/AppendLisRequestDto.cs index a59e584..f7e3e2a 100644 --- a/src/Shentun.Peis.Application.Contracts/LisRequests/AppendLisRequestDto.cs +++ b/src/Shentun.Peis.Application.Contracts/LisRequests/AppendLisRequestDto.cs @@ -13,8 +13,8 @@ namespace Shentun.Peis.LisRequests public Guid LisRequestId { get; set; } /// - /// RegisterAsbitem表ID集合 + /// RegisterCheckAsbitem表ID集合 /// - public List RegisterAsbitemIds { get; set; } + public List RegisterCheckAsbitemIds { get; set; } } } diff --git a/src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs b/src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs index a4b131c..8eeab7d 100644 --- a/src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs +++ b/src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs @@ -50,7 +50,7 @@ namespace Shentun.Peis.LisRequests /// /// 人员登记ID /// - [HttpPost("api/app/lisrequest/setlisrequest")] + [HttpPost("api/app/LisRequest/SetLisRequest")] public async Task> SetLisRequestAsync(Guid PatientRegisterId) { var entlist = await _lisRequestManager.SetLisRequestAsync(PatientRegisterId); @@ -84,14 +84,14 @@ namespace Shentun.Peis.LisRequests /// /// /// - [HttpPost("api/app/lisrequest/appendlisrequestmany")] + [HttpPost("api/app/LisRequest/AppendLisRequestMany")] public async Task AppendLisRequestManyAsync(List input) { if (input.Any()) { foreach (var item in input) { - await _lisRequestManager.AppendLisRequestAsync(item.LisRequestId, item.RegisterAsbitemIds); + await _lisRequestManager.AppendLisRequestAsync(item.LisRequestId, item.RegisterCheckAsbitemIds); } } @@ -107,12 +107,12 @@ namespace Shentun.Peis.LisRequests /// /// RegisterAsbitem表Id/param> /// - [HttpPost("api/app/lisrequest/addlisrequest")] + [HttpPost("api/app/LisRequest/AddLisRequest")] public async Task AddLisRequestAsync(List RegisterAsbitemIds) { if (RegisterAsbitemIds.Any()) { - await _lisRequestManager.AddLisRequestAsync(RegisterAsbitemIds); + var lisRequests = await _lisRequestManager.AddLisRequestAsync(RegisterAsbitemIds); } else { @@ -126,7 +126,7 @@ namespace Shentun.Peis.LisRequests /// /// /// - [HttpPost("api/app/lisrequest/getregisterasbitemlisrequest")] + [HttpPost("api/app/LisRequest/GetRegisterAsbitemLisRequest")] public async Task> GetRegisterAsbitemLisRequestAsync(Guid PatientRegisterId) { return await _lisRequestReportRepository.GetRegisterAsbitemLisRequestAsync(PatientRegisterId); @@ -139,7 +139,7 @@ namespace Shentun.Peis.LisRequests /// /// /// - [HttpPost("api/app/lisrequest/updatelisrequestisprint")] + [HttpPost("api/app/LisRequest/UpdateLisRequestIsPrint")] public async Task UpdateLisRequestIsPrintAsync(UpdateLisRequestIsPrintDto input) { if (input.OperateType == 1) diff --git a/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs b/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs index 9acfe17..26c04a5 100644 --- a/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs +++ b/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs @@ -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 _customerOrgRepository; private readonly IRepository _patientRegisterRepository; + private readonly IRepository _registerCheckAsbitemRepository; + private readonly IRepository _asbitemRepository; + private readonly IRepository _lisRequestRepository; + private readonly IRepository _sampleGroupRepository; + private readonly IRepository _sampleContainerRepository; + private readonly IRepository _sampleTypeRepository; private readonly IRepository _sexRegisterRepository; private readonly IRepository _resultStatusRepository; private readonly IRepository _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 customerOrgRepository, IRepository patientRegisterRepository, + IRepository registerCheckAsbitemRepository, + IRepository asbitemRepository, + IRepository lisRequestRepository, + IRepository sampleGroupRepository, + IRepository sampleContainerRepository, + IRepository sampleTypeRepository, IRepository sexRegisterRepository, IRepository resultStatusRepository, IRepository 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 /// /// /// - [HttpPost("api/app/printreport/getlisrequestreport")] + [HttpPost("api/app/printreport/GetLisRequestReport")] public async Task> 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; } diff --git a/src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs b/src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs index 3f6f827..34f5672 100644 --- a/src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs +++ b/src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs @@ -61,7 +61,7 @@ namespace Shentun.Peis.SumSuggestionHeaders /// /// /// - [HttpPost("api/app/sumsuggestionheader/getsumsuggestionlist")] + [HttpPost("api/app/sumsuggestionheader/GetSumSuggestionList")] public async Task> GetSumSuggestionListAsync(PatientRegisterSumInputDto input) { if (input is null) @@ -97,7 +97,7 @@ namespace Shentun.Peis.SumSuggestionHeaders SuggestionFlag = s.FirstOrDefault().sumSuggestionHeader.SuggestionFlag, DisplayOrder = s.FirstOrDefault().sumSuggestionHeader.DisplayOrder, DiagnosisIds = s.Where(o => o.sumDiagnosisHaveEmpty != null). - Select(x => x.sumDiagnosisHaveEmpty.DiagnosisId).ToList(), + Select(x => x.sumDiagnosisHaveEmpty.DiagnosisId).Distinct().ToList(), MedicalInterpretations = s.Where(m => m.sumSuggestionContentHaveEmpty != null && m.sumSuggestionContentHaveEmpty.SuggestionType == SuggestionTypeFlag.MedicalInterpretation). Select(sa => new SumSuggestionContentData diff --git a/src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs b/src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs index ed76fb3..be731b0 100644 --- a/src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs +++ b/src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs @@ -16,7 +16,7 @@ namespace Shentun.Peis.LisRequests { public class LisRequestManager : DomainService { - private readonly IRepository _registerAsbitemeRepository; + private readonly IRepository _registerCheckAsbitemeRepository; private readonly IRepository _sampleGroupRepository; private readonly IRepository _sampleGroupDetailRepository; private readonly IRepository _sysParmValueRepository; @@ -24,7 +24,7 @@ namespace Shentun.Peis.LisRequests private readonly IRepository _lisRequestRepository; private readonly SysParmValueManager _sysParmValueManager; public LisRequestManager( - IRepository registerAsbitemeRepository, + IRepository registerCheckAsbitemeRepository, IRepository sampleGroupRepository, IRepository sampleGroupDetailRepository, IRepository sysParmValueRepository, @@ -33,7 +33,7 @@ namespace Shentun.Peis.LisRequests SysParmValueManager sysParmValueManager ) { - this._registerAsbitemeRepository = registerAsbitemeRepository; + this._registerCheckAsbitemeRepository = registerCheckAsbitemeRepository; this._sampleGroupRepository = sampleGroupRepository; this._sampleGroupDetailRepository = sampleGroupDetailRepository; this._sysParmValueRepository = sysParmValueRepository; @@ -52,68 +52,16 @@ namespace Shentun.Peis.LisRequests { List lisRequests = new List(); - - //根据人员登记ID 查找登记的组合项目 - var registerAsbitemeList = (await _registerAsbitemeRepository.GetDbSetAsync()) + var registerCheckAsbitemList = (await _registerCheckAsbitemeRepository.GetDbSetAsync()) .Include(x => x.Asbitem) .Include(x => x.PatientRegister) .Where(m => m.PatientRegisterId == PatientRegisterId && m.LisRequestId == null) .ToList(); - - //根据登记的组合ID 查找组合项目对应的条码分组 - var sampleGroupDetailList = await _sampleGroupDetailRepository.GetListAsync(m => registerAsbitemeList.Select(s => s.AsbitemId).Contains(m.AsbitemId)); - if (!sampleGroupDetailList.Any()) - { - return lisRequests; - } - - //查找条码分组信息 根据条码分组ID - var sampleGroupList = (await _sampleGroupRepository.GetDbSetAsync()) - .Include(x => x.SampleContainer) - .Include(x => x.SampleType) - .Where(m => sampleGroupDetailList.Select(s => s.SampleGroupId).Contains(m.Id)); - - foreach (var sampleGroup in sampleGroupList) - { - //根据条码分组生成,一个条码分组生成一个检验单 - #region 生成检验申请单 - - var lisRequestEnt = new LisRequest(GuidGenerator.Create()) - { - IsPrint = 'N', - IsSignIn = 'N', - LisRequestNo = await CreateLisRequestNo(registerAsbitemeList.FirstOrDefault().PatientRegister.MedicalCenterId), - SampleContainerId = sampleGroup.SampleContainerId, - SampleTypeId = sampleGroup.SampleTypeId - }; - - //生成检验申请单的新实体 - var lisRequestEnt_New = await _lisRequestRepository.InsertAsync(lisRequestEnt, true); - - lisRequests.Add(lisRequestEnt_New); - - #region 修改RegisterAsbitem表 LisRequestId - - //当前条码分组ID绑定的组合项目 - var AsbitemIds = sampleGroupDetailList.Where(m => m.SampleGroupId == sampleGroup.Id).Select(s => s.AsbitemId); - - //获取需要更新的RegisterAsbitem数据 - var registerAsbitemeList_Update = await _registerAsbitemeRepository.GetListAsync(f => - f.PatientRegisterId == PatientRegisterId && AsbitemIds.Contains(f.AsbitemId) && f.LisRequestId == null); - if (registerAsbitemeList_Update.Any()) - { - //更新LisRequestId - registerAsbitemeList_Update.ForEach(m => m.LisRequestId = lisRequestEnt_New.Id); - await _registerAsbitemeRepository.UpdateManyAsync(registerAsbitemeList_Update); - } - - #endregion - - #endregion - } - + var registerCheckAsbitems = registerCheckAsbitemList.Select(o=>o.AsbitemId).ToList(); + lisRequests = await AddLisRequestAsync(registerCheckAsbitems); + return lisRequests; } @@ -122,17 +70,17 @@ namespace Shentun.Peis.LisRequests /// 追加项目到检验单 如lisrequest内有项目完成体检或者弃检 不允许追加 /// /// - /// + /// /// - public async Task AppendLisRequestAsync(Guid LisRequestId, List RegisterAsbitemIds) + public async Task AppendLisRequestAsync(Guid LisRequestId, List RegisterCheckAsbitemIds) { //根据RegisterAsbitemId - var registerAsbitemInIdList = (await _registerAsbitemeRepository.GetDbSetAsync()) + var registerAsbitemInIdList = (await _registerCheckAsbitemeRepository.GetDbSetAsync()) .Include(x => x.RegisterCheck) - .Where(m => RegisterAsbitemIds.Contains(m.Id)).ToList(); + .Where(m => RegisterCheckAsbitemIds.Contains(m.Id)).ToList(); //根据LisRequestId - var registerAsbitemInLisRequestIdList = (await _registerAsbitemeRepository.GetDbSetAsync()) + var registerAsbitemInLisRequestIdList = (await _registerCheckAsbitemeRepository.GetDbSetAsync()) .Include(x => x.RegisterCheck) .Where(m => m.LisRequestId == LisRequestId).ToList(); @@ -146,7 +94,7 @@ namespace Shentun.Peis.LisRequests { registerAsbitemInIdList.ForEach(f => f.LisRequestId = LisRequestId); - await _registerAsbitemeRepository.UpdateManyAsync(registerAsbitemInIdList); + await _registerCheckAsbitemeRepository.UpdateManyAsync(registerAsbitemInIdList); } else { @@ -160,22 +108,18 @@ namespace Shentun.Peis.LisRequests /// 追加项目到检验单 生成新的条码号 /// /// - /// + /// /// - public async Task AddLisRequestAsync(List RegisterAsbitemIds) + public async Task> AddLisRequestAsync(List registerCheckAsbitemIds) { - //List msg = new List(); - - + List lisRequests = new List(); //根据RegisterAsbitem表ID 查找登记的组合项目 - var registerAsbitemeList = (await _registerAsbitemeRepository.GetDbSetAsync()) + var registerAsbitemeList = (await _registerCheckAsbitemeRepository.GetDbSetAsync()) .Include(x => x.Asbitem) .Include(x => x.PatientRegister) - .Where(m => RegisterAsbitemIds.Contains(m.Id)) + .Where(m => registerCheckAsbitemIds.Contains(m.Id)) .ToList(); - - if (registerAsbitemeList.Any()) { @@ -199,26 +143,28 @@ namespace Shentun.Peis.LisRequests IsPrint = 'N', IsSignIn = 'N', LisRequestNo = await CreateLisRequestNo(registerAsbitemeList.FirstOrDefault().PatientRegister.MedicalCenterId), - //SampleGroupId = sampleGroup.Id + SampleContainerId = sampleGroup.SampleContainerId, + SampleTypeId = sampleGroup.SampleTypeId }; //生成检验申请单的新实体 var lisRequestEnt_New = await _lisRequestRepository.InsertAsync(lisRequestEnt, true); - // msg.Add(lisRequestEnt_New); + lisRequests.Add(lisRequestEnt_New); #region 修改RegisterAsbitem表 LisRequestId //当前条码分组ID绑定的组合项目 var AsbitemIds = sampleGroupDetailList.Where(m => m.SampleGroupId == sampleGroup.Id).Select(s => s.AsbitemId); - //获取需要更新的RegisterAsbitem数据 - var registerAsbitemeList_Update = await _registerAsbitemeRepository.GetListAsync(f => RegisterAsbitemIds.Contains(f.Id) && AsbitemIds.Contains(f.AsbitemId)); + //获取需要更新的RegisterCheckAsbitem数据 + var registerAsbitemeList_Update = await _registerCheckAsbitemeRepository.GetListAsync( + f => registerCheckAsbitemIds.Contains(f.Id) && AsbitemIds.Contains(f.AsbitemId)); if (registerAsbitemeList_Update.Any()) { //更新LisRequestId registerAsbitemeList_Update.ForEach(m => m.LisRequestId = lisRequestEnt_New.Id); - await _registerAsbitemeRepository.UpdateManyAsync(registerAsbitemeList_Update); + await _registerCheckAsbitemeRepository.UpdateManyAsync(registerAsbitemeList_Update); } #endregion @@ -228,7 +174,7 @@ namespace Shentun.Peis.LisRequests } } - //return msg; + return lisRequests; } diff --git a/src/Shentun.Peis.Domain/PrintReports/LisRequestReportDto.cs b/src/Shentun.Peis.Domain/PrintReports/LisRequestReportDto.cs index 96d4b62..3e1991b 100644 --- a/src/Shentun.Peis.Domain/PrintReports/LisRequestReportDto.cs +++ b/src/Shentun.Peis.Domain/PrintReports/LisRequestReportDto.cs @@ -36,6 +36,7 @@ namespace Shentun.Peis.PrintReports /// 标本容器名称 /// public string SampleContainerName { get; set; } + public int ContainerColor { get; set; } /// /// 标本容器备注 diff --git a/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs b/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs index a5e6544..880a127 100644 --- a/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs +++ b/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs @@ -228,7 +228,7 @@ public class PeisDbContext : public DbSet PrimarykeyBuilders { get; set; } = null!; public DbSet QueueRegisters { get; set; } = null!; public DbSet ReferenceRanges { get; set; } = null!; - public DbSet RegisterAsbitems { get; set; } = null!; + public DbSet RegisterCheckAsbitems { get; set; } = null!; public DbSet RegisterChecks { get; set; } = null!; public DbSet RegisterCheckCriticalValues { get; set; } = null!; public DbSet RegisterCheckItems { get; set; } = null!; diff --git a/src/Shentun.Peis.EntityFrameworkCore/PatientRegisters/PatientRegisterChargeRepository.cs b/src/Shentun.Peis.EntityFrameworkCore/PatientRegisters/PatientRegisterChargeRepository.cs index dbc7c42..25b32ea 100644 --- a/src/Shentun.Peis.EntityFrameworkCore/PatientRegisters/PatientRegisterChargeRepository.cs +++ b/src/Shentun.Peis.EntityFrameworkCore/PatientRegisters/PatientRegisterChargeRepository.cs @@ -177,7 +177,7 @@ namespace Shentun.Peis.PatientRegisters List customerOrgs = dbContext.CustomerOrgs.ToList(); - var query = (from a in dbContext.PatientRegisters.Where(m => dbContext.RegisterAsbitems.Where(rsb => rsb.IsCharge == 'N' && rsb.PayTypeFlag == PayTypeFlag.PersonPay).Select(s => s.PatientRegisterId).Contains(m.Id)) + var query = (from a in dbContext.PatientRegisters.Where(m => dbContext.RegisterCheckAsbitems.Where(rsb => rsb.IsCharge == 'N' && rsb.PayTypeFlag == PayTypeFlag.PersonPay).Select(s => s.PatientRegisterId).Contains(m.Id)) join b in dbContext.Patients on a.PatientId equals b.Id into bb from ab in bb.DefaultIfEmpty() join c in dbContext.Sexes on a.SexId equals c.Id into cc diff --git a/src/Shentun.Peis.EntityFrameworkCore/PrintReports/CheckRequestNoReportRepository.cs b/src/Shentun.Peis.EntityFrameworkCore/PrintReports/CheckRequestNoReportRepository.cs index 5316c9d..d469ff2 100644 --- a/src/Shentun.Peis.EntityFrameworkCore/PrintReports/CheckRequestNoReportRepository.cs +++ b/src/Shentun.Peis.EntityFrameworkCore/PrintReports/CheckRequestNoReportRepository.cs @@ -38,7 +38,7 @@ namespace Shentun.Peis.PrintReports var query = (from a in dbContext.PatientRegisters join b in dbContext.Sexes on a.SexId equals b.Id into bb from ab in bb.DefaultIfEmpty() - join c in dbContext.RegisterAsbitems on a.Id equals c.PatientRegisterId into cc + join c in dbContext.RegisterCheckAsbitems on a.Id equals c.PatientRegisterId into cc from ac in cc.DefaultIfEmpty() join d in dbContext.Asbitems on ac.AsbitemId equals d.Id into dd from ad in dd.DefaultIfEmpty() diff --git a/src/Shentun.Peis.EntityFrameworkCore/PrintReports/LisRequestReportRepository.cs b/src/Shentun.Peis.EntityFrameworkCore/PrintReports/LisRequestReportRepository.cs index 433041a..6243a4a 100644 --- a/src/Shentun.Peis.EntityFrameworkCore/PrintReports/LisRequestReportRepository.cs +++ b/src/Shentun.Peis.EntityFrameworkCore/PrintReports/LisRequestReportRepository.cs @@ -34,74 +34,8 @@ namespace Shentun.Peis.PrintReports public async Task> GetLisRequestReportAsync(Guid PatientRegisterId) { throw new Exception("禁止使用"); - /* - var dbContext = await GetDbContextAsync(); - - var customerOrgList = await _customerOrgRepository.GetListAsync(); - - var query = (from a in dbContext.PatientRegisters - join x in dbContext.Sexes on a.SexId equals x.Id into xx - from ax in xx.DefaultIfEmpty() - join b in dbContext.RegisterAsbitems on a.Id equals b.PatientRegisterId into bb - from ab in bb.DefaultIfEmpty() - join f in dbContext.Asbitems on ab.AsbitemId equals f.Id into ff - from af in ff.DefaultIfEmpty() - join c in dbContext.LisRequests on ab.LisRequestId equals c.Id into cc - from ac in cc.DefaultIfEmpty() - join g in dbContext.SampleGroups on ac.SampleGroupId equals g.Id into gg - from ag in gg.DefaultIfEmpty() - join d in dbContext.SampleContainers on ag.SampleContainerId equals d.Id into dd - from ad in dd.DefaultIfEmpty() - join e in dbContext.SampleTypes on ag.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.ContainerColorName, - SampleContainerRemark = ad.ContainerRemark, - SampleTypeName = ae.DisplayName, - SexName = ax.DisplayName, - CustomerOrgName = EntityHelper.GetCustomerOrgParentNameNoSql(customerOrgList, a.CustomerOrgId), - DepartmentName = EntityHelper.GetCustomerOrgNameNoSql(customerOrgList, a.CustomerOrgId) - }).ToList(); - - var entlist = query.GroupBy(g => new - { - g.LisRequestNo, - g.Age, - g.PatientName, - g.PatientRegisterNo, - g.SampleContainerName, - 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, - 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; - */ + + } /// @@ -115,7 +49,7 @@ namespace Shentun.Peis.PrintReports var dbContext = await GetDbContextAsync(); var query = (from a in dbContext.PatientRegisters - join b in dbContext.RegisterAsbitems on a.Id equals b.PatientRegisterId into bb + join b in dbContext.RegisterCheckAsbitems on a.Id equals b.PatientRegisterId into bb from ab in bb.DefaultIfEmpty() join d in dbContext.RegisterChecks on ab.RegisterCheckId equals d.Id into dd from ad in dd.DefaultIfEmpty() diff --git a/src/Shentun.Peis.EntityFrameworkCore/SumSummaryReports/SumSummaryReportRepository.cs b/src/Shentun.Peis.EntityFrameworkCore/SumSummaryReports/SumSummaryReportRepository.cs index 1e5b39c..900c9eb 100644 --- a/src/Shentun.Peis.EntityFrameworkCore/SumSummaryReports/SumSummaryReportRepository.cs +++ b/src/Shentun.Peis.EntityFrameworkCore/SumSummaryReports/SumSummaryReportRepository.cs @@ -42,7 +42,7 @@ namespace Shentun.Peis.SumSummaryReports join b in dbContext.Items.DefaultIfEmpty() on a.ItemId equals b.Id join c in dbContext.Units.DefaultIfEmpty() on b.UnitId equals c.Id join e in dbContext.RegisterChecks.DefaultIfEmpty() on a.RegisterCheckId equals e.Id - join f in dbContext.RegisterAsbitems.DefaultIfEmpty() on e.Id equals f.RegisterCheckId + join f in dbContext.RegisterCheckAsbitems.DefaultIfEmpty() on e.Id equals f.RegisterCheckId join g in dbContext.PatientRegisters.DefaultIfEmpty() on f.PatientRegisterId equals g.Id where (g.PatientId == PatientId && f.AsbitemId == AsbitemId) select new HorizontalComparisonListEntity diff --git a/test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs b/test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs index 9ef68aa..caf8b74 100644 --- a/test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs +++ b/test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs @@ -34,10 +34,26 @@ namespace Shentun.Peis { var result = await _appService.GetSumSuggestionListAsync(new PatientRegisters.PatientRegisterSumInputDto() - { PatientRegisterId = new Guid("3a1051a8-933c-0f59-514f-837b6cf274d9") }); + { PatientRegisterId = new Guid("3a11ee70-02cb-c5e6-a087-79ecdd0356b6") }); foreach (var item in result) { - _output.WriteLine(item.SuggestionTitle); + _output.WriteLine("标题:" + item.SuggestionTitle); + foreach(var item2 in item.DiagnosisIds) + { + _output.WriteLine("诊断:" + item2.ToString() ); + } + foreach (var item2 in item.MedicalInterpretations) + { + _output.WriteLine("医学解释:" + item2.SuggestionContent); + } + foreach (var item2 in item.CommonReasons) + { + _output.WriteLine("常见原因:" + item2.SuggestionContent); + } + foreach (var item2 in item.HealthGuidances) + { + _output.WriteLine("健康指导:" + item2.SuggestionContent); + } } } }