Browse Source

综述建议

bjmzak
DESKTOP-G961P6V\Zhh 2 years ago
parent
commit
5347a34c54
  1. 5
      src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionDto.cs
  2. 11
      src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterIdInputDto.cs
  3. 12
      src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterSumInputDto.cs
  4. 4
      src/Shentun.Peis.Application.Contracts/PatientRegisters/UpdatePatientRegisterSummarySuggestionDto.cs
  5. 19
      src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs
  6. 44
      src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
  7. 2
      src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs
  8. 19
      src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs
  9. 27
      src/Shentun.Peis.Application/SumSummaryHeaders/SumSummaryHeaderAppService.cs
  10. 3
      src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContentManager.cs
  11. 6
      src/Shentun.Peis.Domain/SumSummaryHeaders/SumSummaryHeaderManager.cs
  12. 60
      test/Shentun.Peis.Application.Tests/PatientRegisterAppServiceTest.cs
  13. 3
      test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs
  14. 5
      test/Shentun.Peis.Application.Tests/SumSummaryHeaderAppServiceTest.cs

5
src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionDto.cs

@ -11,6 +11,11 @@ namespace Shentun.Peis.Diagnosises
/// 医学解释
/// </summary>
public List<SuggestionDto> MedicalInterpretations { get; set; }
/// <summary>
/// 常见原因
/// </summary>
public List<SuggestionDto> CommonReasons { get; set; }
/// <summary>
/// 健康指导

11
src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterIdInputDto.cs

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.PatientRegisters
{
public class PatientRegisterIdInputDto
{
public Guid PatientRegisterId { get; set; }
}
}

12
src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterSumInputDto.cs

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.PatientRegisters
{
public class PatientRegisterSumInputDto
{
public Guid PatientRegisterId { get; set; }
public string IsGetExistData { get; set; }
}
}

4
src/Shentun.Peis.Application.Contracts/PatientRegisters/UpdatePatientRegisterSummarySuggestionDto.cs

@ -56,6 +56,10 @@ namespace Shentun.Peis.PatientRegisters
public List<Guid> DiagnosisIds { get; set; }
public List<UpdateSumSuggestionContentDto> Details { get; set; }
public List<UpdateSumSuggestionContentDto> MedicalInterpretations { get; set; }
public List<UpdateSumSuggestionContentDto> CommonReasons { get; set; }
public List<UpdateSumSuggestionContentDto> HealthGuidances { get; set; }
}
public class UpdateSumSuggestionContentDto

19
src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs

@ -140,7 +140,8 @@ namespace Shentun.Peis.Diagnosises
IsSummaryTemplate = s.FirstOrDefault().a.IsSummaryTemplate,
ItemTypeId = s.FirstOrDefault().a.ItemTypeId,
SuggestionName = s.FirstOrDefault().a.SuggestionName,
HealthGuidances = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.HealthGuidance).Select(ss => new SuggestionDto
MedicalInterpretations = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.MedicalInterpretation).Select(ss => new SuggestionDto
{
CreationTime = ss.ab.CreationTime,
CreatorId = ss.ab.CreatorId,
@ -154,7 +155,21 @@ namespace Shentun.Peis.Diagnosises
SuggestionContent = ss.ab.SuggestionContent
}).OrderBy(o => o.DisplayOrder).ToList(),
MedicalInterpretations = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.MedicalInterpretation).Select(ss => new SuggestionDto
CommonReasons = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.CommonReasons).Select(ss => new SuggestionDto
{
CreationTime = ss.ab.CreationTime,
CreatorId = ss.ab.CreatorId,
CreatorName = s.FirstOrDefault().ae != null ? s.FirstOrDefault().ae.UserName : "",
LastModifierName = s.FirstOrDefault().af != null ? s.FirstOrDefault().af.UserName : "",
DiagnosisId = ss.ab.DiagnosisId,
DisplayOrder = ss.ab.DisplayOrder,
Id = ss.ab.Id,
LastModificationTime = ss.ab.LastModificationTime,
LastModifierId = ss.ab.LastModifierId,
SuggestionContent = ss.ab.SuggestionContent
}).OrderBy(o => o.DisplayOrder).ToList(),
HealthGuidances = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.HealthGuidance).Select(ss => new SuggestionDto
{
CreationTime = ss.ab.CreationTime,
CreatorId = ss.ab.CreatorId,

44
src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs

@ -22,6 +22,7 @@ using Shentun.Peis.SumSuggestionContents;
using Shentun.Peis.SumSuggestionHeaders;
using Shentun.Peis.SumSummaryContents;
using Shentun.Peis.SumSummaryHeaders;
using Shentun.Peis.SumSummaryReports;
using Shentun.Utilities;
using System;
using System.Collections.Generic;
@ -289,7 +290,26 @@ namespace Shentun.Peis.PatientRegisters
return entdto;
}
/// <summary>
/// 获取是否总检过
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/patientregister/GetHaveSumData")]
public async Task<string> GetHaveSumData(PatientRegisterIdInputDto input)
{
var sumSummaryHeader = await _sumSummaryHeaderRepository.GetListAsync(o => o.PatientRegisterId == input.PatientRegisterId);
if(sumSummaryHeader.Any())
{
return "Y";
}
var sumSuggestionHeader = await _sumSuggestionHeaderRepository.GetListAsync(o => o.PatientRegisterId == input.PatientRegisterId);
if (sumSuggestionHeader.Any())
{
return "Y";
}
return "N";
}
/// <summary>
/// 获取列表 人员体检
/// </summary>
@ -1546,15 +1566,33 @@ namespace Shentun.Peis.PatientRegisters
#region 插入SumSuggestionContent
List<SumSuggestionContent> sumSuggestionContentList = new List<SumSuggestionContent>();
foreach (var item2 in item.Details)
foreach (var item2 in item.MedicalInterpretations)
{
SumSuggestionContent sumSuggestionContentEnt = _sumSuggestionContentManager.CreateAsync(sumSuggestionHeaderId: sumSuggestionHeaderEnt_New.Id,
suggestionContent: item2.SuggestionContent,
suggestionType: SuggestionTypeFlag.MedicalInterpretation,
displayOrder: item.MedicalInterpretations.IndexOf(item2) + 1);
sumSuggestionContentList.Add(sumSuggestionContentEnt);
}
foreach (var item2 in item.CommonReasons)
{
SumSuggestionContent sumSuggestionContentEnt = _sumSuggestionContentManager.CreateAsync(sumSuggestionHeaderId: sumSuggestionHeaderEnt_New.Id,
suggestionContent: item2.SuggestionContent,
displayOrder: item.Details.IndexOf(item2) + 1);
suggestionType: SuggestionTypeFlag.CommonReasons,
displayOrder: item.CommonReasons.IndexOf(item2) + 1);
sumSuggestionContentList.Add(sumSuggestionContentEnt);
}
foreach (var item2 in item.HealthGuidances)
{
SumSuggestionContent sumSuggestionContentEnt = _sumSuggestionContentManager.CreateAsync(sumSuggestionHeaderId: sumSuggestionHeaderEnt_New.Id,
suggestionContent: item2.SuggestionContent,
suggestionType: SuggestionTypeFlag.HealthGuidance,
displayOrder: item.HealthGuidances.IndexOf(item2) + 1);
sumSuggestionContentList.Add(sumSuggestionContentEnt);
}
await _sumSuggestionContentRepository.InsertManyAsync(sumSuggestionContentList);
#endregion
}

2
src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs

@ -121,7 +121,7 @@ namespace Shentun.Peis.RegisterChecks
var entlist = (await _registerCheckRepository.GetDbSetAsync())
.Include(x => x.RegisterCheckAsbitems)
.ThenInclude(x => x.Asbitem)
.ThenInclude(x => x.Asbitem).ThenInclude(x=>x.ItemType)
.Where(m => m.RegisterCheckAsbitems.Select(s => s.PatientRegisterId).Contains(PatientRegisterId)).ToList();
//排序
entlist = entlist.OrderBy(o=>o.RegisterCheckAsbitems.Max(o=>o.Asbitem.ItemType.DisplayOrder)).ToList()

19
src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.Enums;
using Shentun.Peis.Models;
using Shentun.Peis.PatientRegisters;
using Shentun.Peis.SumSuggestionContents;
using Shentun.Peis.SumSummaryContents;
using Shentun.Peis.SumSummaryHeaders;
@ -54,15 +55,19 @@ namespace Shentun.Peis.SumSuggestionHeaders
/// <summary>
/// 获取人员总检诊台建议 (如还未录入,获取医生诊台录入的建议)
/// </summary>
/// <param name="patientRegisterId">人员登记ID</param>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("api/app/sumsuggestionheader/getsumsuggestionlist")]
public async Task<List<SumSuggestionDto>> GetSumSuggestionListAsync(Guid patientRegisterId)
[HttpPost("api/app/sumsuggestionheader/getsumsuggestionlist")]
public async Task<List<SumSuggestionDto>> GetSumSuggestionListAsync(PatientRegisterSumInputDto input)
{
if (input is null)
{
throw new UserFriendlyException("input参数不能为空");
}
List<SumSuggestionDto> msg = new List<SumSuggestionDto>();
var patientRegister = await _patientRegisterRepository.GetAsync(patientRegisterId);
var patientRegister = await _patientRegisterRepository.GetAsync(input.PatientRegisterId);
var query = from sumSuggestionHeader in await _sumSuggestionHeaderRepository.GetQueryableAsync()
join sumDiagnosis in await _sumDiagnosisRepository.GetQueryableAsync()
on new { sumSuggestionHeader.PatientRegisterId, sumSuggestionHeader.Id } equals new { sumDiagnosis.PatientRegisterId, Id = sumDiagnosis.SumSuggestionHeaderId } into bb
@ -70,7 +75,7 @@ namespace Shentun.Peis.SumSuggestionHeaders
join sumSuggestionContent in await _sumSuggestionContentRepository.GetQueryableAsync()
on sumSuggestionHeader.Id equals sumSuggestionContent.SumSuggestionHeaderId into cc
from sumSuggestionContentHaveEmpty in cc.DefaultIfEmpty()
where (sumSuggestionHeader.PatientRegisterId == patientRegisterId)
where (sumSuggestionHeader.PatientRegisterId == input.PatientRegisterId)
orderby sumSuggestionHeader.DisplayOrder ascending, sumSuggestionContentHaveEmpty.DisplayOrder ascending
select new
{
@ -80,7 +85,7 @@ namespace Shentun.Peis.SumSuggestionHeaders
};
if (patientRegister.CompleteFlag == PatientRegisterCompleteFlag.GeneralInspected)
if (patientRegister.CompleteFlag == PatientRegisterCompleteFlag.GeneralInspected || input.IsGetExistData == "Y")
{
msg = query.GroupBy(g => g.sumSuggestionHeader.Id).Select(s => new SumSuggestionDto
{
@ -116,7 +121,7 @@ namespace Shentun.Peis.SumSuggestionHeaders
else
{
//没有值的情况
var checklist = await _sumSummaryHeaderManager.GetSumSummarysByDoctorCheck(patientRegisterId);
var checklist = await _sumSummaryHeaderManager.GetSumSummarysByDoctorCheck(input.PatientRegisterId);
//获取所有综述
var registerCheckSummaries = new List<string>();
foreach (var registerCheck in checklist)

27
src/Shentun.Peis.Application/SumSummaryHeaders/SumSummaryHeaderAppService.cs

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.Enums;
using Shentun.Peis.Models;
using Shentun.Peis.PatientRegisters;
using Shentun.Peis.SumSummaryContents;
using Shentun.Peis.SysParmValues;
using System;
@ -54,19 +55,22 @@ namespace Shentun.Peis.SumSummaryHeaders
/// <summary>
/// 获取人员总检诊台小结 (如还未录入,获取医生诊台录入的小结)
/// </summary>
/// <param name="patientRegisterId">人员登记ID</param>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("api/app/sumsummaryheader/getsumsummarylist")]
public async Task<List<SumSummaryHeaderOrContentDto>> GetSumSummaryListAsync(Guid patientRegisterId)
[HttpPost("api/app/sumsummaryheader/getsumsummarylist")]
public async Task<List<SumSummaryHeaderOrContentDto>> GetSumSummaryListAsync(PatientRegisterSumInputDto input)
{
if(input is null)
{
throw new UserFriendlyException("input参数不能为空");
}
List<SumSummaryHeaderOrContentDto> msg = new List<SumSummaryHeaderOrContentDto>();
var patientRegister = await _patientRegisterRepository.GetAsync(patientRegisterId);
var patientRegister = await _patientRegisterRepository.GetAsync(input.PatientRegisterId);
var entlist = (await _sumSummaryHeaderRepository.GetDbSetAsync())
.Include(x => x.SumSummaryContents)
.Where(m => m.PatientRegisterId == patientRegisterId).OrderBy(o => o.DisplayOrder).ToList();
.Where(m => m.PatientRegisterId == input.PatientRegisterId).OrderBy(o => o.DisplayOrder).ToList();
if (patientRegister.CompleteFlag == PatientRegisterCompleteFlag.GeneralInspected)
if (patientRegister.CompleteFlag == PatientRegisterCompleteFlag.GeneralInspected || input.IsGetExistData == "Y")
{
//已总检取综述中的值
msg = entlist.Select(s => new SumSummaryHeaderOrContentDto
@ -87,7 +91,7 @@ namespace Shentun.Peis.SumSummaryHeaders
else
{
//未总检
var checklist = await _sumSummaryHeaderManager.GetSumSummarysByDoctorCheck(patientRegisterId);
var checklist = await _sumSummaryHeaderManager.GetSumSummarysByDoctorCheck(input.PatientRegisterId);
if (checklist.Any() && checklist.Count(c => c.RegisterCheckSummaries.Count > 0) > 0)
{
@ -96,7 +100,7 @@ namespace Shentun.Peis.SumSummaryHeaders
Id = s.Id,
SummaryTitle = string.Join(",", s.RegisterCheckAsbitems.Select(rs => rs.Asbitem.DisplayName).ToList()),
SummaryFlag = null,
PatientRegisterId = s.RegisterCheckAsbitems.FirstOrDefault().PatientRegisterId,
PatientRegisterId = input.PatientRegisterId,
DisplayOrder = 0,
Details = s.RegisterCheckSummaries.OrderBy(o => o.DisplayOrder).Select(sa => new SumSummaryContentDto
{
@ -105,6 +109,11 @@ namespace Shentun.Peis.SumSummaryHeaders
SumSummaryHeaderId = sa.RegisterCheckId
}).OrderBy(o => o.DisplayOrder).ToList()
}).OrderBy(o => o.DisplayOrder).ToList();
if(msg.Count == 1 && string.IsNullOrWhiteSpace(msg[0].SummaryTitle) && msg[0].Details.Count() == 1)
{
//默认综述
msg[0].SummaryTitle = msg[0].Details[0].SummaryContent;
}
}
}
return msg;

3
src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContentManager.cs

@ -11,12 +11,13 @@ namespace Shentun.Peis.SumSuggestionContents
public class SumSuggestionContentManager : DomainService
{
public SumSuggestionContent CreateAsync(Guid sumSuggestionHeaderId,
string suggestionContent, int displayOrder)
string suggestionContent,char suggestionType, int displayOrder)
{
var entity = new SumSuggestionContent(GuidGenerator.Create())
{
SumSuggestionHeaderId = sumSuggestionHeaderId,
SuggestionContent = suggestionContent,
SuggestionType = suggestionType,
DisplayOrder = displayOrder
};

6
src/Shentun.Peis.Domain/SumSummaryHeaders/SumSummaryHeaderManager.cs

@ -40,9 +40,9 @@ namespace Shentun.Peis.SumSummaryHeaders
GetSysParmValueInMedicalCenterId(patientRegister.MedicalCenterId,
"summary_check_summay_contain_normal_result");
//默认综述
var summaryCheckDefaultSummayContent = await _sysParmValueManager.
var summaryCheckDefaultSummayHeader = await _sysParmValueManager.
GetSysParmValueInMedicalCenterId(patientRegister.MedicalCenterId,
"summary_check_default_summay_content");
"summary_check_default_summay_header");
var checklist = (await _registerCheckRepository.GetDbSetAsync())
.Include(x => x.RegisterCheckAsbitems)
.ThenInclude(x => x.Asbitem).ThenInclude(x=>x.ItemType)
@ -79,7 +79,7 @@ namespace Shentun.Peis.SumSummaryHeaders
{
new RegisterCheckSummary()
{
Summary = summaryCheckDefaultSummayContent,
Summary = summaryCheckDefaultSummayHeader,
}
}
});

60
test/Shentun.Peis.Application.Tests/PatientRegisterAppServiceTest.cs

@ -557,18 +557,40 @@ namespace Shentun.Peis
new Guid("3a0ecab2-ee3a-4b32-997b-5979a672cf62")
},
SuggestionTitle = "ssss",
Details= new List<UpdateSumSuggestionContentDto>()
MedicalInterpretations= new List<UpdateSumSuggestionContentDto>()
{
new UpdateSumSuggestionContentDto()
{
SuggestionContent = "ffff"
SuggestionContent = "mmm"
},
new UpdateSumSuggestionContentDto()
{
SuggestionContent = "gggg"
SuggestionContent = "mmm"
}
}
},
CommonReasons = new List<UpdateSumSuggestionContentDto>()
{
new UpdateSumSuggestionContentDto()
{
SuggestionContent = "ccc"
},
new UpdateSumSuggestionContentDto()
{
SuggestionContent = "ccc"
}
},
HealthGuidances = new List<UpdateSumSuggestionContentDto>()
{
new UpdateSumSuggestionContentDto()
{
SuggestionContent = "hhh"
},
new UpdateSumSuggestionContentDto()
{
SuggestionContent = "hhh"
}
},
},
new UpdateSumSuggestionDto()
{
@ -578,7 +600,29 @@ namespace Shentun.Peis
new Guid("3a0ed8e0-6e1a-4b6a-55ec-a2e87ccdf6a9")
},
SuggestionTitle = "ttt",
Details= new List<UpdateSumSuggestionContentDto>()
MedicalInterpretations= new List<UpdateSumSuggestionContentDto>()
{
new UpdateSumSuggestionContentDto()
{
SuggestionContent = "mmm"
},
new UpdateSumSuggestionContentDto()
{
SuggestionContent = "mmm"
}
},
CommonReasons = new List<UpdateSumSuggestionContentDto>()
{
new UpdateSumSuggestionContentDto()
{
SuggestionContent = "ccc"
},
new UpdateSumSuggestionContentDto()
{
SuggestionContent = "ccc"
}
},
HealthGuidances = new List<UpdateSumSuggestionContentDto>()
{
new UpdateSumSuggestionContentDto()
{
@ -586,9 +630,9 @@ namespace Shentun.Peis
},
new UpdateSumSuggestionContentDto()
{
SuggestionContent = "kkk"
SuggestionContent = "hhh"
}
}
},
}
}

3
test/Shentun.Peis.Application.Tests/SumSuggestionHeaderAppServiceTest.cs

@ -33,7 +33,8 @@ namespace Shentun.Peis
using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
{
var result = await _appService.GetSumSuggestionListAsync(new Guid("3a11ee70-02cb-c5e6-a087-79ecdd0356b6"));
var result = await _appService.GetSumSuggestionListAsync(new PatientRegisters.PatientRegisterSumInputDto()
{ PatientRegisterId = new Guid("3a1051a8-933c-0f59-514f-837b6cf274d9") });
foreach (var item in result)
{
_output.WriteLine(item.SuggestionTitle);

5
test/Shentun.Peis.Application.Tests/SumSummaryHeaderAppServiceTest.cs

@ -33,7 +33,10 @@ namespace Shentun.Peis
using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
{
var result = await _appService.GetSumSummaryListAsync(new Guid("3a11ee70-02cb-c5e6-a087-79ecdd0356b6"));
var result = await _appService.GetSumSummaryListAsync(new PatientRegisters.PatientRegisterSumInputDto()
{
PatientRegisterId = new Guid("3a1051a8-933c-0f59-514f-837b6cf274d9")
});
foreach (var item in result)
{
_output.WriteLine(item.SummaryTitle);

Loading…
Cancel
Save