diff --git a/src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionDto.cs b/src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionDto.cs index e444e3d..aaa9627 100644 --- a/src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionDto.cs +++ b/src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionDto.cs @@ -7,7 +7,15 @@ namespace Shentun.Peis.Diagnosises { public class DiagnosisInSuggestionDto:DiagnosisDto { - public List Suggestions { get; set; } + /// + /// 医学解释 + /// + public List MedicalInterpretations { get; set; } + + /// + /// 健康指导 + /// + public List HealthGuidances { get; set; } } diff --git a/src/Shentun.Peis.Application.Contracts/Suggestions/CreateSuggestionManyDto.cs b/src/Shentun.Peis.Application.Contracts/Suggestions/CreateSuggestionManyDto.cs index 0bc17d2..19db928 100644 --- a/src/Shentun.Peis.Application.Contracts/Suggestions/CreateSuggestionManyDto.cs +++ b/src/Shentun.Peis.Application.Contracts/Suggestions/CreateSuggestionManyDto.cs @@ -14,16 +14,16 @@ namespace Shentun.Peis.Suggestions [Required(ErrorMessage = "诊断ID不能为空")] public Guid DiagnosisId { get; set; } + /// + /// 建议类型(0-代表医学解释,1-代表健康指导) + /// + public char SuggestionType { get; set; } + public List Details { get; set; } = new List(); } public class CreateSuggestionMany_Detail { - /// - /// 诊断ID - /// - public Guid DiagnosisId { get; set; } - /// /// 建议内容 /// diff --git a/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs b/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs index bb5326b..ed10c39 100644 --- a/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs +++ b/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Shentun.Peis.Diagnosises; +using Shentun.Peis.Enums; using Shentun.Peis.GuidTypes; using Shentun.Peis.HelperDto; using Shentun.Peis.Items; @@ -139,7 +140,7 @@ namespace Shentun.Peis.Diagnosises IsSummaryTemplate = s.FirstOrDefault().a.IsSummaryTemplate, ItemTypeId = s.FirstOrDefault().a.ItemTypeId, SuggestionName = s.FirstOrDefault().a.SuggestionName, - Suggestions = s.Where(m => m.ab != null).Select(ss => new SuggestionDto + HealthGuidances = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.HealthGuidance).Select(ss => new SuggestionDto { CreationTime = ss.ab.CreationTime, CreatorId = ss.ab.CreatorId, @@ -153,8 +154,22 @@ 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 + { + 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.ItemTypeId).ThenBy(o => o.DisplayOrder).ToList(); + }).OrderBy(o => o.DisplayOrder).ToList(), + + }).OrderBy(o => o.ItemTypeId).ThenBy(o => o.DisplayOrder).ToList(); return entlist; @@ -239,7 +254,7 @@ namespace Shentun.Peis.Diagnosises var createEntity = ObjectMapper.Map(input); var entity = await _manager.CreateAsync(createEntity); entity = await Repository.InsertAsync(entity, true); - var entdto =await GetAsync(entity.Id); + var entdto = await GetAsync(entity.Id); return entdto; } /// @@ -268,7 +283,7 @@ namespace Shentun.Peis.Diagnosises { return base.DeleteAsync(id); } - + /// /// 修改排序 置顶,置底 diff --git a/src/Shentun.Peis.Application/Suggestions/SuggestionAppService.cs b/src/Shentun.Peis.Application/Suggestions/SuggestionAppService.cs index ed814fb..2e1ec7d 100644 --- a/src/Shentun.Peis.Application/Suggestions/SuggestionAppService.cs +++ b/src/Shentun.Peis.Application/Suggestions/SuggestionAppService.cs @@ -41,7 +41,7 @@ namespace Shentun.Peis.Suggestions public async Task CreateSuggestionManyAsync(CreateSuggestionManyDto input) { //先按诊断ID删除所有建议 - await _manager.CheckAndDeleteInDiagnosisIdAsync(input.DiagnosisId); + await _manager.CheckAndDeleteInDiagnosisIdAsync(input.DiagnosisId, input.SuggestionType); if (input.Details.Any()) { @@ -52,7 +52,8 @@ namespace Shentun.Peis.Suggestions { DiagnosisId = input.DiagnosisId, DisplayOrder = input.Details.IndexOf(item) + 1, - SuggestionContent = item.SuggestionContent + SuggestionContent = item.SuggestionContent, + SuggestionType = input.SuggestionType }; suggestions.Add(_manager.CreateAsync(entity)); diff --git a/src/Shentun.Peis.Domain.Shared/Enums/SuggestionTypeFlag.cs b/src/Shentun.Peis.Domain.Shared/Enums/SuggestionTypeFlag.cs new file mode 100644 index 0000000..d4c1d03 --- /dev/null +++ b/src/Shentun.Peis.Domain.Shared/Enums/SuggestionTypeFlag.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; + +namespace Shentun.Peis.Enums +{ + public static class SuggestionTypeFlag + { + /// + /// 医学解释 + /// + [Description("医学解释")] + public const char MedicalInterpretation = '0'; + + + /// + /// 健康指导 + /// + [Description("健康指导")] + public const char HealthGuidance = '1'; + } +} diff --git a/src/Shentun.Peis.Domain/Suggestions/SuggestionManager.cs b/src/Shentun.Peis.Domain/Suggestions/SuggestionManager.cs index 072d512..1e6f2a2 100644 --- a/src/Shentun.Peis.Domain/Suggestions/SuggestionManager.cs +++ b/src/Shentun.Peis.Domain/Suggestions/SuggestionManager.cs @@ -36,16 +36,15 @@ namespace Shentun.Peis.Suggestions return entity; } - /// /// 按诊断删除建议 /// - /// 诊断ID + /// 诊断ID + /// /// - /// - public async Task CheckAndDeleteInDiagnosisIdAsync(Guid DiagnosisId) + public async Task CheckAndDeleteInDiagnosisIdAsync(Guid diagnosisId, char suggestionType = '0') { - var suggestionList = await _repository.GetListAsync(m => m.DiagnosisId == DiagnosisId); + var suggestionList = await _repository.GetListAsync(m => m.DiagnosisId == diagnosisId && m.SuggestionType == suggestionType); if (suggestionList.Any()) {