diff --git a/src/Shentun.Peis.Application.Contracts/LisRequests/GetLisRequestListDto.cs b/src/Shentun.Peis.Application.Contracts/LisRequests/GetLisRequestListDto.cs index afa2d17..bd585fa 100644 --- a/src/Shentun.Peis.Application.Contracts/LisRequests/GetLisRequestListDto.cs +++ b/src/Shentun.Peis.Application.Contracts/LisRequests/GetLisRequestListDto.cs @@ -41,12 +41,12 @@ namespace Shentun.Peis.LisRequests /// /// 开始日期 /// - public string? StartDate { get; set; } + public DateTime? StartDate { get; set; } /// /// 结束日期 /// - public string? EndDate { get; set; } + public DateTime? EndDate { get; set; } /// /// 手机号(支持手机跟座机) diff --git a/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs b/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs index d2200e6..3116b8f 100644 --- a/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs +++ b/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs @@ -542,15 +542,15 @@ namespace Shentun.Peis.DiagnosisFunctions /// private async Task LoadSysParm(Guid medicalCenterId) { - _isAddAbnormalResult = await _sysParmValueManager.GetSysParmValue( + _isAddAbnormalResult = await _sysParmValueManager.GetSysParmValueAsync( medicalCenterId, "doctor_check_lis_summary_mode_add_abnormal_result"); - _isAddReferenceRange = await _sysParmValueManager.GetSysParmValue( + _isAddReferenceRange = await _sysParmValueManager.GetSysParmValueAsync( medicalCenterId, "doctor_check_lis_summary_mode_add_reference_range"); - _isAutoAddSuffix = await _sysParmValueManager.GetSysParmValue( + _isAutoAddSuffix = await _sysParmValueManager.GetSysParmValueAsync( medicalCenterId, "doctor_check_lis_summary_mode_auto_add_suffix"); - _lowerSuffix = await _sysParmValueManager.GetSysParmValue( + _lowerSuffix = await _sysParmValueManager.GetSysParmValueAsync( medicalCenterId, "doctor_check_lis_summary_mode_lower_suffix"); - _highSuffix = await _sysParmValueManager.GetSysParmValue( + _highSuffix = await _sysParmValueManager.GetSysParmValueAsync( medicalCenterId, "doctor_check_lis_summary_mode_high_suffix"); } /// diff --git a/src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs b/src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs index 8f3dc3a..ad89c02 100644 --- a/src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs +++ b/src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs @@ -84,9 +84,9 @@ namespace Shentun.Peis.LisRequests if (input.SexId != null && input.SexId != ForSexFlag.All) patientRegisterQuery = patientRegisterQuery.Where(m => m.SexId == input.SexId); - if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate)) - patientRegisterQuery = patientRegisterQuery.Where(m => m.CreationTime >= Convert.ToDateTime(input.StartDate) && - m.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)); + if (input.StartDate!=null && input.EndDate != null) + patientRegisterQuery = patientRegisterQuery.Where(m => m.CreationTime >= input.StartDate && + m.CreationTime < ((DateTime)input.EndDate).AddDays(1)); if (input.CustomerOrgId != null) @@ -117,6 +117,7 @@ namespace Shentun.Peis.LisRequests var lisRequests = await _lisRequestManager.SetLisRequestAsync(patientRegister.Id); } //返回检索到的数据 + var result = new PagedResultDto(); return result; } diff --git a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs index 2a53d43..cfa9502 100644 --- a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs +++ b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs @@ -1474,7 +1474,7 @@ namespace Shentun.Peis.PatientRegisters { throw new UserFriendlyException("已审核,请先取消审核"); } - var isSummaryCheckOnlySelfCanCancel = await _sysParmValueManager.GetSysParmValue(entity.MedicalCenterId, "summary_check_only_self_can_cancel"); + var isSummaryCheckOnlySelfCanCancel = await _sysParmValueManager.GetSysParmValueAsync(entity.MedicalCenterId, "summary_check_only_self_can_cancel"); if (isSummaryCheckOnlySelfCanCancel == "Y") { if (entity.SummaryDoctorId != CurrentUser.Id) diff --git a/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs b/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs index 26c04a5..3fa08f7 100644 --- a/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs +++ b/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs @@ -34,7 +34,7 @@ namespace Shentun.Peis.PrintReports private readonly IRepository _patientRegisterRepository; private readonly IRepository _registerCheckAsbitemRepository; private readonly IRepository _asbitemRepository; - private readonly IRepository _lisRequestRepository; + private readonly IRepository _lisRequestRepository; private readonly IRepository _sampleGroupRepository; private readonly IRepository _sampleContainerRepository; private readonly IRepository _sampleTypeRepository; @@ -139,42 +139,53 @@ namespace Shentun.Peis.PrintReports public async Task> GetLisRequestReportAsync(Guid PatientRegisterId) { //生成LIS条码 - await _lisRequestManager.SetLisRequestAsync(PatientRegisterId); + 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 + var query = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync() + join sex in await _sexRegisterRepository.GetQueryableAsync() on patientRegister.SexId equals sex.Id into xx + from sexHaveEmpty in xx.DefaultIfEmpty() + join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() on patientRegister.Id equals registerCheckAsbitem.PatientRegisterId into bb + from registerCheckAsbitemHaveEmpty in bb.DefaultIfEmpty() + join asbitem in await _asbitemRepository.GetQueryableAsync() on registerCheckAsbitemHaveEmpty.AsbitemId equals asbitem.Id into ff + from asbitemHaveEmpty in ff.DefaultIfEmpty() + join lisRequest in await _lisRequestRepository.GetQueryableAsync() on registerCheckAsbitemHaveEmpty.LisRequestId equals lisRequest.Id into cc + from lisRequestHaveEmpty in cc.DefaultIfEmpty() + join sampleContainer in await _sampleContainerRepository.GetQueryableAsync() on lisRequestHaveEmpty.SampleContainerId equals sampleContainer.Id into dd + from sampleContainerHaveEmpty in dd.DefaultIfEmpty() + join sampleType in await _sampleTypeRepository.GetQueryableAsync() on lisRequestHaveEmpty.SampleTypeId equals sampleType.Id into ee + from sampleTypeHaveEmpty in ee.DefaultIfEmpty() + where (patientRegister.Id == PatientRegisterId && registerCheckAsbitemHaveEmpty.LisRequestId != null) + select new { - 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 + patientRegister, + sexHaveEmpty, + registerCheckAsbitemHaveEmpty, + asbitemHaveEmpty, + lisRequestHaveEmpty, + sampleContainerHaveEmpty, + sampleTypeHaveEmpty + } + ).ToList(); + var lisRequestReportDtoList = query.Select(o => new LisRequestReportDto + { + Age = o.patientRegister.Age, + AsbitemName = string.IsNullOrEmpty(o.asbitemHaveEmpty.ShortName) ? o.asbitemHaveEmpty.DisplayName : o.asbitemHaveEmpty.ShortName, + LisRequestNo = o.lisRequestHaveEmpty.LisRequestNo, + PatientName = o.patientRegister.PatientName, + PatientRegisterNo = o.patientRegister.PatientRegisterNo, + SampleContainerName = o.sampleContainerHaveEmpty.DisplayName, + ContainerColor = o.sampleContainerHaveEmpty.ContainerColor, + SampleContainerRemark = o.sampleContainerHaveEmpty.ContainerRemark, + SampleTypeName = o.sampleTypeHaveEmpty.DisplayName, + SexName = o.sexHaveEmpty.DisplayName, + CustomerOrgName = _cacheService.GetTopCustomerOrgAsync(o.patientRegister.CustomerOrgId).Result.DisplayName, + DepartmentName = _cacheService.GetCustomerOrgNameAsync(o.patientRegister.CustomerOrgId).Result + }).ToList(); + + var entlist = lisRequestReportDtoList.GroupBy(g => new { g.LisRequestNo, g.Age, @@ -233,9 +244,9 @@ namespace Shentun.Peis.PrintReports { #region 系统参数配置 - var MedicalCenterAddress = await _sysParmValueManager.GetSysParmValue(patientRegisterEnt.MedicalCenterId, "medical_center_address"); - var MedicalCenterFax = await _sysParmValueManager.GetSysParmValue(patientRegisterEnt.MedicalCenterId, "medical_center_fax"); - var MedicalCenterTelphone = await _sysParmValueManager.GetSysParmValue(patientRegisterEnt.MedicalCenterId, "medical_center_telphone"); + var MedicalCenterAddress = await _sysParmValueManager.GetSysParmValueAsync(patientRegisterEnt.MedicalCenterId, "medical_center_address"); + var MedicalCenterFax = await _sysParmValueManager.GetSysParmValueAsync(patientRegisterEnt.MedicalCenterId, "medical_center_fax"); + var MedicalCenterTelphone = await _sysParmValueManager.GetSysParmValueAsync(patientRegisterEnt.MedicalCenterId, "medical_center_telphone"); #endregion msg = new PeisReportDto diff --git a/src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs b/src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs index 34f5672..aef79f1 100644 --- a/src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs +++ b/src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs @@ -189,7 +189,7 @@ namespace Shentun.Peis.SumSuggestionHeaders } var summaryCheckDefaultSuggestionHeader = await _sysParmValueManager. - GetSysParmValue(patientRegister.MedicalCenterId, + GetSysParmValueAsync(patientRegister.MedicalCenterId, "summary_check_default_suggestion_header"); if (!msg.Any()) { diff --git a/src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs b/src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs index c5fda3f..01718a3 100644 --- a/src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs +++ b/src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs @@ -59,7 +59,7 @@ namespace Shentun.Peis.LisRequests .Where(m => m.PatientRegisterId == PatientRegisterId && m.LisRequestId == null) .ToList(); - var registerCheckAsbitems = registerCheckAsbitemList.Select(o=>o.AsbitemId).ToList(); + var registerCheckAsbitems = registerCheckAsbitemList.Select(o=>o.Id).ToList(); lisRequests = await AddLisRequestAsync(registerCheckAsbitems); return lisRequests; @@ -131,7 +131,7 @@ namespace Shentun.Peis.LisRequests var sampleGroupList = (await _sampleGroupRepository.GetDbSetAsync()) .Include(x => x.SampleContainer) .Include(x => x.SampleType) - .Where(m => sampleGroupDetailList.Select(s => s.SampleGroupId).Contains(m.Id)); + .Where(m => sampleGroupDetailList.Select(s => s.SampleGroupId).Contains(m.Id)).ToList(); foreach (var sampleGroup in sampleGroupList) { @@ -200,9 +200,9 @@ namespace Shentun.Peis.LisRequests string lis_request_no_rule_coding = "0"; // 模式(0 日期+尾号 1.顺序递增) string lis_request_no_rule_tail_len = "4"; //尾号长度 string lis_request_no_rule_prefix = "T"; //前缀 - lis_request_no_rule_coding = await _sysParmValueManager.GetSysParmValue(medicalCenterId, "lis_request_no_rule_coding"); - lis_request_no_rule_tail_len = await _sysParmValueManager.GetSysParmValue(medicalCenterId, "lis_request_no_rule_tail_len"); - lis_request_no_rule_prefix = await _sysParmValueManager.GetSysParmValue(medicalCenterId, "lis_request_no_rule_prefix"); + lis_request_no_rule_coding = await _sysParmValueManager.GetSysParmValueAsync(medicalCenterId, "lis_request_no_rule_coding"); + lis_request_no_rule_tail_len = await _sysParmValueManager.GetSysParmValueAsync(medicalCenterId, "lis_request_no_rule_tail_len"); + lis_request_no_rule_prefix = await _sysParmValueManager.GetSysParmValueAsync(medicalCenterId, "lis_request_no_rule_prefix"); if(string.IsNullOrWhiteSpace(lis_request_no_rule_coding)) { throw new UserFriendlyException("LIS编码方式不能为空"); diff --git a/src/Shentun.Peis.Domain/SumSummaryHeaders/SumSummaryHeaderManager.cs b/src/Shentun.Peis.Domain/SumSummaryHeaders/SumSummaryHeaderManager.cs index 3d1b8aa..3ece5d3 100644 --- a/src/Shentun.Peis.Domain/SumSummaryHeaders/SumSummaryHeaderManager.cs +++ b/src/Shentun.Peis.Domain/SumSummaryHeaders/SumSummaryHeaderManager.cs @@ -37,11 +37,11 @@ namespace Shentun.Peis.SumSummaryHeaders var patientRegister = await _patientRegisterRepository.GetAsync(PatientRegisterId); //总检综述包含正常结果 var isSummaryCheckSummayContainNormalResult = await _sysParmValueManager. - GetSysParmValue(patientRegister.MedicalCenterId, + GetSysParmValueAsync(patientRegister.MedicalCenterId, "summary_check_summay_contain_normal_result"); //默认综述 var summaryCheckDefaultSummayHeader = await _sysParmValueManager. - GetSysParmValue(patientRegister.MedicalCenterId, + GetSysParmValueAsync(patientRegister.MedicalCenterId, "summary_check_default_summay_header"); var checklist = (await _registerCheckRepository.GetDbSetAsync()) .Include(x => x.RegisterCheckAsbitems) diff --git a/src/Shentun.Peis.Domain/SysParmValues/SysParmValueManager.cs b/src/Shentun.Peis.Domain/SysParmValues/SysParmValueManager.cs index c47e7fc..638106f 100644 --- a/src/Shentun.Peis.Domain/SysParmValues/SysParmValueManager.cs +++ b/src/Shentun.Peis.Domain/SysParmValues/SysParmValueManager.cs @@ -71,7 +71,7 @@ namespace Shentun.Peis.SysParmValues /// 体检中心ID /// 系统参数ID /// - public async Task GetSysParmValue(Guid medicalCenterId, string SysParmId) + public async Task GetSysParmValueAsync(Guid medicalCenterId, string SysParmId) { string msg = ""; diff --git a/src/Shentun.Peis.EntityFrameworkCore/PrintReports/PatientRegisterGuideReportRepository.cs b/src/Shentun.Peis.EntityFrameworkCore/PrintReports/PatientRegisterGuideReportRepository.cs index 6bda37c..5fa1538 100644 --- a/src/Shentun.Peis.EntityFrameworkCore/PrintReports/PatientRegisterGuideReportRepository.cs +++ b/src/Shentun.Peis.EntityFrameworkCore/PrintReports/PatientRegisterGuideReportRepository.cs @@ -61,9 +61,9 @@ namespace Shentun.Peis.PrintReports #region 系统参数配置 - var MedicalCenterAddress = await _sysParmValueManager.GetSysParmValue(OrOrganizationUnitId, "medical_center_address"); - var MedicalCenterFax = await _sysParmValueManager.GetSysParmValue(OrOrganizationUnitId, "medical_center_fax"); - var MedicalCenterTelphone = await _sysParmValueManager.GetSysParmValue(OrOrganizationUnitId, "medical_center_telphone"); + var MedicalCenterAddress = await _sysParmValueManager.GetSysParmValueAsync(OrOrganizationUnitId, "medical_center_address"); + var MedicalCenterFax = await _sysParmValueManager.GetSysParmValueAsync(OrOrganizationUnitId, "medical_center_fax"); + var MedicalCenterTelphone = await _sysParmValueManager.GetSysParmValueAsync(OrOrganizationUnitId, "medical_center_telphone"); #endregion @@ -126,9 +126,9 @@ namespace Shentun.Peis.PrintReports #region 系统参数配置 - var MedicalCenterAddress = await _sysParmValueManager.GetSysParmValue(OrOrganizationUnitId, "medical_center_address"); - var MedicalCenterFax = await _sysParmValueManager.GetSysParmValue(OrOrganizationUnitId, "medical_center_fax"); - var MedicalCenterTelphone = await _sysParmValueManager.GetSysParmValue(OrOrganizationUnitId, "medical_center_telphone"); + var MedicalCenterAddress = await _sysParmValueManager.GetSysParmValueAsync(OrOrganizationUnitId, "medical_center_address"); + var MedicalCenterFax = await _sysParmValueManager.GetSysParmValueAsync(OrOrganizationUnitId, "medical_center_fax"); + var MedicalCenterTelphone = await _sysParmValueManager.GetSysParmValueAsync(OrOrganizationUnitId, "medical_center_telphone"); #endregion var dbContext = await GetDbContextAsync(); diff --git a/test/Shentun.Peis.Application.Tests/PrintReportAppServiceTest.cs b/test/Shentun.Peis.Application.Tests/PrintReportAppServiceTest.cs new file mode 100644 index 0000000..563d245 --- /dev/null +++ b/test/Shentun.Peis.Application.Tests/PrintReportAppServiceTest.cs @@ -0,0 +1,47 @@ +using Shentun.Peis.CustomerOrgs; +using Shentun.Peis.Models; +using Shentun.Peis.PatientRegisters; +using Shentun.Peis.PrintReports; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Uow; +using Xunit; +using Xunit.Abstractions; + +namespace Shentun.Peis +{ + public class PrintReportAppServiceTest : PeisApplicationTestBase + { + private readonly IRepository _repository; + private readonly PrintReportAppService _appService; + private readonly ITestOutputHelper _output; + private readonly IUnitOfWorkManager _unitOfWorkManager; + public PrintReportAppServiceTest(ITestOutputHelper testOutputHelper) + { + _output = testOutputHelper; + _unitOfWorkManager = GetRequiredService(); + _repository = GetRequiredService>(); + _appService = GetRequiredService(); + } + + [Fact] + public async Task GetLisRequestReportAsync() + { + using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true)) + { + var items = await _appService.GetLisRequestReportAsync(new Guid("3a11ee70-02cb-c5e6-a087-79ecdd0356b6")); + _output.WriteLine(items.Count().ToString()); + foreach (var item in items) + { + _output.WriteLine(item.PatientName + "," + item.CustomerOrgName + "," + + item.DepartmentName + item.AsbitemName); + } + await unitOfWork.CompleteAsync(); + } + } + } +} diff --git a/test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs b/test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs index caf8b74..de9b0f6 100644 --- a/test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs +++ b/test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs @@ -34,7 +34,9 @@ namespace Shentun.Peis { var result = await _appService.GetSumSuggestionListAsync(new PatientRegisters.PatientRegisterSumInputDto() - { PatientRegisterId = new Guid("3a11ee70-02cb-c5e6-a087-79ecdd0356b6") }); + { PatientRegisterId = new Guid("3a11ee70-02cb-c5e6-a087-79ecdd0356b6"), + IsGetExistData = "N"} + ); foreach (var item in result) { _output.WriteLine("标题:" + item.SuggestionTitle);