diff --git a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs index 39a6611..d4128d6 100644 --- a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs +++ b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs @@ -2791,7 +2791,17 @@ namespace Shentun.Peis.PatientRegisters } - patientRegisterList.ForEach(f => f.CompleteFlag = input.CompleteFlag.Value); + patientRegisterList.ForEach(f => + { + if(f.CompleteFlag == PatientRegisterCompleteFlag.PreRegistration + && input.CompleteFlag == PatientRegisterCompleteFlag.Registration) + { + f.MedicalStartDate = DateTime.Now; + f.IsMedicalStart = 'Y'; + } + f.CompleteFlag = input.CompleteFlag.Value; + } + ); if (!string.IsNullOrEmpty(input.MedicalStartDate)) @@ -2799,12 +2809,7 @@ namespace Shentun.Peis.PatientRegisters patientRegisterList.ForEach(f => f.MedicalStartDate = PageHelper.ConvertDatetimeV(input.MedicalStartDate)); } - patientRegisterList.ForEach(f => - { - f.IsMedicalStart = 'Y'; - f.MedicalStartDate = DateTime.Now; - } - ); + await _repository.UpdateManyAsync(patientRegisterList); diff --git a/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs b/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs index a0705c5..52b9aae 100644 --- a/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs +++ b/src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs @@ -722,7 +722,9 @@ namespace Shentun.Peis.PrintReports // Summary = o.registerCheckSummaryHaveEmpty.Summary, // DisplayOrder = o.registerCheckSummaryHaveEmpty.DisplayOrder //}).OrderBy(o => o.DisplayOrder).Distinct().ToList(); - medicalReportRegisterCheckDto.Summarys = registerCheckRows.GroupBy(g => g.registerCheckSummaryHaveEmpty.Id).Select(o => new MedicalReportCheckAsbitemSummaryDto() + medicalReportRegisterCheckDto.Summarys = registerCheckRows.Where(o=>o.registerCheckSummaryHaveEmpty!=null) + .GroupBy(g => g.registerCheckSummaryHaveEmpty.Id) + .Select(o => new MedicalReportCheckAsbitemSummaryDto() { Summary = o.FirstOrDefault().registerCheckSummaryHaveEmpty.Summary, DisplayOrder = o.FirstOrDefault().registerCheckSummaryHaveEmpty.DisplayOrder diff --git a/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs b/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs index 1413fd2..c37a4d7 100644 --- a/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs +++ b/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs @@ -117,8 +117,13 @@ public class PeisHttpApiHostModule : AbpModule ConfigureCors(context, configuration); ConfigureSwaggerServices(context, configuration); - ConfigureJsonOptions(); //全局配置api返回值中的日期默认格式 + //ConfigureJsonOptions(); //全局配置api返回值中的日期默认格式 + context.Services.AddControllers().AddJsonOptions(configure => + { + configure.JsonSerializerOptions.Converters.Add(new DateTimeJsonConverter()); + configure.JsonSerializerOptions.PropertyNameCaseInsensitive = true; + }); //密码策略配置 context.Services.Configure(opt => { diff --git a/src/Shentun.Utilities/DateTimeJsonConverter.cs b/src/Shentun.Utilities/DateTimeJsonConverter.cs index 0246048..a33a4ab 100644 --- a/src/Shentun.Utilities/DateTimeJsonConverter.cs +++ b/src/Shentun.Utilities/DateTimeJsonConverter.cs @@ -13,7 +13,13 @@ namespace Shentun.Utilities public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - return DateTime.Parse(reader.GetString()); + if (reader.TokenType == JsonTokenType.String) + { + if (DateTime.TryParse(reader.GetString(), out DateTime date)) + return date; + } + return reader.GetDateTime(); + } diff --git a/test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs b/test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs index e7ba3da..fbde665 100644 --- a/test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs +++ b/test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs @@ -35,20 +35,20 @@ namespace Shentun.Peis { var getDiagnosisResultRequestDto = new GetDiagnosisResultRequestDto() { - RegisterCheckId = new Guid("3a123c55-07ad-f46e-8f6a-4c3b8c8a78de"), + RegisterCheckId = new Guid("3a1272f5-689f-f6ea-3ab7-65e75e94b058"), Items = new List { new GetDiagnosisResultRequest_Item() { - ItemId = new Guid("3a1203c2-6bcd-5490-19af-4663293fddd8"), - Result = "未见异常" + ItemId = new Guid("3a126b34-dd13-c067-7b10-56cbd5fefedb"), + Result = "50.1" }, - new GetDiagnosisResultRequest_Item() - { - ItemId = new Guid("3a1203c2-6c55-b07a-79cd-bec4e231390b"), - Result = "未见异常" - } + // new GetDiagnosisResultRequest_Item() + //{ + // ItemId = new Guid("3a1203c2-6c55-b07a-79cd-bec4e231390b"), + // Result = "未见异常" + //} } }; var result = await _appService.GetDoctorCheckDiagnosisResultAsync(getDiagnosisResultRequestDto); diff --git a/test/Shentun.Peis.Application.Tests/PrintReportAppServiceTest.cs b/test/Shentun.Peis.Application.Tests/PrintReportAppServiceTest.cs index 696894c..15055d3 100644 --- a/test/Shentun.Peis.Application.Tests/PrintReportAppServiceTest.cs +++ b/test/Shentun.Peis.Application.Tests/PrintReportAppServiceTest.cs @@ -52,7 +52,7 @@ namespace Shentun.Peis { var medicalReportDto = await _appService.GetMedicalReportAsync(new PatientRegisterIdInputDto() { - PatientRegisterId = new Guid("3a11ee70-02cb-c5e6-a087-79ecdd0356b6") + PatientRegisterId = new Guid("3a126ce3-a20e-73ef-2671-815fa576b55f") }); _output.WriteLine(medicalReportDto.PatientName); foreach (var medicalReportType in medicalReportDto.MedicalReportTypes)