StableVersion4.3/HL_FristAidPlatform_Bussiness/Service/T_Service_Apoplexy_Transfer...

66 lines
2.1 KiB
C#

using HL_FristAidPlatform_DataBase;
using HL_FristAidPlatform_Help;
using HL_FristAidPlatform_IDataBase;
using HL_FristAidPlatform_Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HL_FristAidPlatform_Bussiness
{
public class T_Service_Apoplexy_TransferBLL
{
private IT_Service_Apoplexy_Transfer IService = new T_Service_Apoplexy_TransferDB();
public T_Service_Apoplexy_Transfer Add(T_Service_Apoplexy_Transfer model)
{
return IService.Add(model);
}
/// <summary>
/// 新增或修改
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public MessageModel<bool> AddORUpdate(T_Service_Apoplexy_Transfer model)
{
//先查询有没有该患者数据
T_Service_Apoplexy_Transfer anxywb = new T_Service_Apoplexy_Transfer();
anxywb = IService.GetByPatientGuid(model.PatientGuid);
if (anxywb != null) //有执行修改操作
{
model.GUID = anxywb.GUID;
if (IService.Update(model) > 0)
{
return new MessageModel<bool> { Success = true, Msg = "修改成功" };
}
else
{
return new MessageModel<bool> { Success = false, Msg = "修改失败" };
}
}
else
{ //没有执行新增操作
model.GUID = Guid.NewGuid().ToString();
if (Add(model) == null)
{
return new MessageModel<bool> { Success = true, Msg = "新增成功" };
}
else
{
return new MessageModel<bool> { Success = true, Msg = "新增成功" };
}
}
}
public T_Service_Apoplexy_Transfer GetByPatientGuid(string PatientGuid)
{
return IService.GetByPatientGuid(PatientGuid);
}
}
}