78 lines
3.1 KiB
C#
78 lines
3.1 KiB
C#
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_ApoplexyProposalDB : BaseDB, IT_Service_ApoplexyProposal
|
|
{
|
|
public SqlSugarClient db = GetClient();
|
|
|
|
/// <summary>
|
|
/// 保存指导治疗及建议
|
|
/// </summary>
|
|
/// <param name="pastHistory"></param>
|
|
/// <returns></returns>
|
|
public bool SaveScreenProposal(T_Service_ApoplexyProposal proposal)
|
|
{
|
|
try
|
|
{
|
|
db.Ado.BeginTran();
|
|
var oneClass = db.Queryable<T_Service_ApoplexyProposal>().Where(i => i.PatientGUID == proposal.PatientGUID && i.DeleteFlag == 0).First();
|
|
if (oneClass != null)
|
|
{
|
|
if (oneClass.FillinStatus == "0")
|
|
{
|
|
T_Service_ApoplexyScreenInfo screenInfo = new T_Service_ApoplexyScreenInfo();
|
|
screenInfo = db.Queryable<T_Service_ApoplexyScreenInfo>().Where(i => i.GUID == proposal.PatientGUID).First();
|
|
screenInfo.RescreeningStatus = screenInfo.RescreeningStatus + 1;
|
|
db.Updateable(screenInfo).UpdateColumns(it => new { it.RescreeningStatus }).ExecuteCommand();
|
|
}
|
|
proposal.GUID = oneClass.GUID;
|
|
db.Updateable(proposal).IgnoreColumns(i => new { i.ID, i.CreateID, i.CreateTime }).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
proposal.GUID = Guid.NewGuid().ToString();
|
|
proposal.CreateTime = DateTime.Now;
|
|
db.Insertable(proposal).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand();
|
|
|
|
T_Service_ApoplexyScreenInfo screenInfo = new T_Service_ApoplexyScreenInfo();
|
|
screenInfo = db.Queryable<T_Service_ApoplexyScreenInfo>().Where(i => i.GUID == proposal.PatientGUID).First();
|
|
screenInfo.RescreeningStatus = screenInfo.RescreeningStatus + 1;
|
|
db.Updateable(screenInfo).UpdateColumns(it => new { it.RescreeningStatus }).ExecuteCommand();
|
|
}
|
|
db.Ado.CommitTran();
|
|
return true;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Ado.RollbackTran();
|
|
Help.WriteErrorLog("卒中高危筛查保存指导治疗及建议(SaveScreenProposal)", ex.ToString());
|
|
return false;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取指导治疗及建议
|
|
/// </summary>
|
|
/// <param name="guid"></param>
|
|
/// <returns></returns>
|
|
public T_Service_ApoplexyProposal GetScreenProposal(string patientGuid)
|
|
{
|
|
return db.Queryable<T_Service_ApoplexyProposal>().Where(i => i.PatientGUID == patientGuid && i.DeleteFlag == 0).First();
|
|
}
|
|
}
|
|
}
|