diff --git a/src/Shentun.Peis.Application.Contracts/Diagnosises/SimpleDiagnosisWithSuggestionsDto.cs b/src/Shentun.Peis.Application.Contracts/Diagnosises/SimpleDiagnosisWithSuggestionsDto.cs new file mode 100644 index 0000000..5368fab --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/Diagnosises/SimpleDiagnosisWithSuggestionsDto.cs @@ -0,0 +1,75 @@ +using Shentun.Peis.SuggestionDtos; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.Diagnosises +{ + public class SimpleDiagnosisWithSuggestionsDto + { + /// + /// 诊断ID + /// + public Guid Id { get; set; } + + /// + /// 项目类别 + /// + public Guid ItemTypeId { get; set; } + + /// + /// 名称 + /// + public string DisplayName { get; set; } + + /// + /// 是疾病 + /// + public char IsIll { get; set; } + /// + /// 是总检模板 + /// + public char IsSummaryTemplate { get; set; } + /// + /// 适用性别 + /// + public char ForSexId { get; set; } + /// + /// 诊断级别 + /// + public short DiagnosisLevelId { get; set; } + + public string SimpleCode { get; set; } + + public int DisplayOrder { get; set; } + + /// + /// 医学解释 + /// + public List MedicalInterpretations { get; set; } + /// + /// 常见原因 + /// + + public List CommonReasons { get; set; } + + /// + /// 健康指导 + /// + public List HealthGuidances { get; set; } + + } + + + + public class SimpleDiagnosisWithSuggestionsSuggestionDto + { + /// + /// 建议内容 + /// + public string SuggestionContent { get; set; } + + } + + +} diff --git a/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs b/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs index ed0c5f0..eee3307 100644 --- a/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs +++ b/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs @@ -42,15 +42,15 @@ namespace Shentun.Peis.DataMigrations /// /// 基础数据处理 /// - [Authorize] - [RemoteService(false)] + //[Authorize] + //[RemoteService(false)] public class BaseDataHandleAppService : ApplicationService { private readonly SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig() { // ConnectionString = "Data Source=.;Initial Catalog=mypeis;User ID=sa;Password=123;Encrypt=false;", - ConnectionString = "server=.;uid=sa;pwd=123;database=mypeis;Encrypt=false;", + ConnectionString = "server=.;uid=sa;pwd=123;database=mypeis0501;Encrypt=false;", DbType = SqlSugar.DbType.SqlServer, IsAutoCloseConnection = true }); diff --git a/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs b/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs index b28b259..2457733 100644 --- a/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs +++ b/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs @@ -140,7 +140,7 @@ namespace Shentun.Peis.Diagnosises IsSummaryTemplate = s.FirstOrDefault().a.IsSummaryTemplate, ItemTypeId = s.FirstOrDefault().a.ItemTypeId, SuggestionName = s.FirstOrDefault().a.SuggestionName, - + MedicalInterpretations = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.MedicalInterpretation).Select(ss => new SuggestionDto { CreationTime = ss.ab.CreationTime, @@ -193,6 +193,77 @@ namespace Shentun.Peis.Diagnosises + /// + /// 获取诊断列表,加诊断建议 + /// + /// + [HttpPost("api/app/Diagnosis/GetSimpleDiagnosisWithSuggestions")] + public async Task> GetSimpleDiagnosisWithSuggestionsAsync() + { + var query = from a in await Repository.GetQueryableAsync() + join b in await _suggestionRepository.GetQueryableAsync() on a.Id equals b.DiagnosisId into bb + from ab in bb.DefaultIfEmpty() + select new + { + a = new + { + a.Id, + a.DisplayName, + a.SimpleCode, + a.DiagnosisLevelId, + a.ForSexId, + a.IsIll, + a.ItemTypeId, + a.IsSummaryTemplate, + a.DisplayOrder + }, + ab = new + { + ab.SuggestionType, + ab.DisplayOrder, + ab.DiagnosisId, + ab.SuggestionContent + }, + }; + + var entlist = query.GroupBy(g => g.a.Id).Select(s => new SimpleDiagnosisWithSuggestionsDto + { + DisplayName = s.FirstOrDefault().a.DisplayName, + SimpleCode = s.FirstOrDefault().a.SimpleCode, + DiagnosisLevelId = s.FirstOrDefault().a.DiagnosisLevelId, + ForSexId = s.FirstOrDefault().a.ForSexId, + IsIll = s.FirstOrDefault().a.IsIll, + Id = s.FirstOrDefault().a.Id, + ItemTypeId = s.FirstOrDefault().a.ItemTypeId, + IsSummaryTemplate = s.FirstOrDefault().a.IsSummaryTemplate, + DisplayOrder = s.FirstOrDefault().a.DisplayOrder, + MedicalInterpretations = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.MedicalInterpretation) + .OrderBy(o => o.ab.DisplayOrder) + .Select(ss => new SimpleDiagnosisWithSuggestionsSuggestionDto + { + SuggestionContent = ss.ab.SuggestionContent + }).ToList(), + CommonReasons = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.CommonReasons) + .OrderBy(o => o.ab.DisplayOrder) + .Select(ss => new SimpleDiagnosisWithSuggestionsSuggestionDto + { + SuggestionContent = ss.ab.SuggestionContent + + }).ToList(), + HealthGuidances = s.Where(m => m.ab != null && m.ab.SuggestionType == SuggestionTypeFlag.HealthGuidance) + .OrderBy(o => o.ab.DisplayOrder) + .Select(ss => new SimpleDiagnosisWithSuggestionsSuggestionDto + { + SuggestionContent = ss.ab.SuggestionContent + }).ToList(), + + }).OrderBy(o => o.ItemTypeId).ThenBy(o => o.DisplayOrder).ToList(); + + return entlist; + + } + + ///// ///// 获取列表 根据项目类别获取 ///// diff --git a/src/Shentun.Peis.Application/Suggestions/SuggestionAppService.cs b/src/Shentun.Peis.Application/Suggestions/SuggestionAppService.cs index 56597a3..f550eab 100644 --- a/src/Shentun.Peis.Application/Suggestions/SuggestionAppService.cs +++ b/src/Shentun.Peis.Application/Suggestions/SuggestionAppService.cs @@ -67,6 +67,8 @@ namespace Shentun.Peis.Suggestions } + + } }