StableVersion4.3/HL_FristAidPlatform_DataBase/Service/T_Service_Apoplexy_Surgical...

56 lines
1.8 KiB
C#
Raw Permalink Normal View History

2024-03-11 09:47:34 +08:00
using HL_FristAidPlatform_Help;
using HL_FristAidPlatform_IDataBase;
using HL_FristAidPlatform_Models;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HL_FristAidPlatform_DataBase
{
public class T_Service_Apoplexy_SurgicalProcedureDB : BaseDB, IT_Service_Apoplexy_SurgicalProcedure
{
public SqlSugarClient db = GetClient();
/// <summary>
/// 保存手术信息
/// </summary>
/// <param name="procedure"></param>
/// <returns></returns>
public bool SaveSurgicalProcedure(T_Service_Apoplexy_SurgicalProcedure procedure)
{
try
{
db.Ado.BeginTran();
var oneClass = db.Queryable<T_Service_Apoplexy_SurgicalProcedure>().Where(i => i.PatientGUID == procedure.PatientGUID).ToList();
if (oneClass != null && oneClass.Count > 0)
{
db.Deleteable<T_Service_Apoplexy_SurgicalProcedure>().In(it => it.PatientGUID, procedure.PatientGUID).ExecuteCommand();
}
procedure.GUID = Guid.NewGuid().ToString();
db.Insertable(procedure).ExecuteCommand();
db.Ado.CommitTran();
return true;
}
catch (Exception)
{
db.Ado.RollbackTran();
return false;
}
}
/// <summary>
/// 获取对象
/// </summary>
/// <param name="patientGuid"></param>
/// <returns></returns>
public T_Service_Apoplexy_SurgicalProcedure GetByPatientGUID(string patientGuid)
{
return db.Queryable<T_Service_Apoplexy_SurgicalProcedure>().Where(i => i.PatientGUID == patientGuid).First();
}
}
}