104 lines
3.7 KiB
C#
104 lines
3.7 KiB
C#
using HL_FristAidPlatform_DataBase;
|
|
using HL_FristAidPlatform_DataBase.Service;
|
|
using HL_FristAidPlatform_Help;
|
|
using HL_FristAidPlatform_Help.Model;
|
|
using HL_FristAidPlatform_IDataBase.Service;
|
|
using HL_FristAidPlatform_Models.Sercice;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace HL_FristAidPlatform_Bussiness.Service
|
|
{
|
|
public class T_Service_Apoplexy_FollowUpAndHealthInfoBLL
|
|
{
|
|
private IT_Service_Apoplexy_FollowUpAndHealthInfo IService = new T_Service_Apoplexy_FollowUpAndHealthInfoDB();
|
|
|
|
//新增操作
|
|
public T_Service_Apoplexy_FollowUpAndHealthInfo Add(T_Service_Apoplexy_FollowUpAndHealthInfo model)
|
|
{
|
|
return IService.Add(model);
|
|
}
|
|
|
|
//仅修改赋值字段
|
|
public MessageModel<bool> UpdateNotNullColumns(T_Service_Apoplexy_FollowUpAndHealthInfo model)
|
|
{
|
|
|
|
//先查询有没有该患者数据
|
|
T_Service_Apoplexy_FollowUpAndHealthInfo fahbase = new T_Service_Apoplexy_FollowUpAndHealthInfo();
|
|
fahbase = IService.GetByPatientGuid(model.PatientGuid);
|
|
if (fahbase != null) //有执行修改操作
|
|
{
|
|
model.PatientGuid = fahbase.PatientGuid;
|
|
if (IService.UpdateNotNullColumns(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 MessageModel<bool> AddORUpdate(T_Service_Apoplexy_FollowUpAndHealthInfo model)
|
|
{
|
|
//先查询有没有该患者数据
|
|
T_Service_Apoplexy_FollowUpAndHealthInfo fah = new T_Service_Apoplexy_FollowUpAndHealthInfo();
|
|
fah = IService.GetByPatientGuid(model.PatientGuid);
|
|
if (fah != null) //有执行修改操作
|
|
{
|
|
model.GUID = fah.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 = "新增成功" };
|
|
}
|
|
}
|
|
}
|
|
|
|
//根据患者Guid查询
|
|
public T_Service_Apoplexy_FollowUpAndHealthInfo GetByPatientGuid(string PatientGuid)
|
|
{
|
|
return IService.GetByPatientGuid(PatientGuid);
|
|
}
|
|
|
|
//根据患者Guid查询
|
|
public TableModel<T_Service_Apoplexy_FollowUpAndHealthInfo> GetByPatientGuid1(string PatientGuid)
|
|
{
|
|
return IService.GetByPatientGuid1(PatientGuid);
|
|
}
|
|
}
|
|
}
|