using Shentun.Peis.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Services; namespace Shentun.Peis.Suggestions { public class SuggestionManager : DomainService { private readonly IRepository _repository; public SuggestionManager( IRepository repository ) { _repository = repository; } /// /// 创建 /// /// /// public Suggestion CreateAsync(Suggestion entity) { DataHelper.CheckGuidIsDefaultValue(entity.DiagnosisId, "诊断ID"); DataHelper.CheckStringIsNull(entity.SuggestionContent, "建议内容"); return entity; } /// /// 按诊断删除建议 /// /// 诊断ID /// /// public async Task CheckAndDeleteInDiagnosisIdAsync(Guid diagnosisId, char suggestionType = '0') { var suggestionList = await _repository.GetListAsync(m => m.DiagnosisId == diagnosisId && m.SuggestionType == suggestionType); if (suggestionList.Any()) { //删除删除建议 await _repository.DeleteManyAsync(suggestionList); } } /// ///删除 /// /// /// /// public async Task CheckAndDeleteAsync(Guid id) { await _repository.DeleteAsync(id); } } }