You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.9 KiB
71 lines
1.9 KiB
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<Suggestion, Guid> _repository;
|
|
|
|
public SuggestionManager(
|
|
IRepository<Suggestion, Guid> repository
|
|
)
|
|
{
|
|
_repository = repository;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 创建
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
/// <returns></returns>
|
|
public Suggestion CreateAsync(Suggestion entity)
|
|
{
|
|
DataHelper.CheckGuidIsDefaultValue(entity.DiagnosisId, "诊断ID");
|
|
DataHelper.CheckStringIsNull(entity.SuggestionContent, "建议内容");
|
|
|
|
return entity;
|
|
}
|
|
/// <summary>
|
|
/// 按诊断删除建议
|
|
/// </summary>
|
|
/// <param name="diagnosisId">诊断ID</param>
|
|
/// <param name="suggestionType"></param>
|
|
/// <returns></returns>
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
///删除
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
public async Task CheckAndDeleteAsync(Guid id)
|
|
{
|
|
await _repository.DeleteAsync(id);
|
|
|
|
}
|
|
}
|
|
}
|