76 lines
3.3 KiB
C#
76 lines
3.3 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_Bussiness.Service
|
|
{
|
|
public class T_Service_ApoplexyScreenPhysicalFitnessDB : BaseDB, IT_Service_ApoplexyScreenPhysicalFitness
|
|
{
|
|
public SqlSugarClient db = GetClient();
|
|
|
|
/// <summary>
|
|
/// 保存体格检查
|
|
/// </summary>
|
|
/// <param name="physicalFitness"></param>
|
|
/// <returns></returns>
|
|
public bool SaveScreenPhysicalFitness(T_Service_ApoplexyScreenPhysicalFitness physicalFitness)
|
|
{
|
|
try
|
|
{
|
|
db.Ado.BeginTran();
|
|
|
|
var oneClass = db.Queryable<T_Service_ApoplexyScreenPhysicalFitness>().Where(i => i.PatientGUID == physicalFitness.PatientGUID && i.Flag == physicalFitness.Flag && 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 == physicalFitness.PatientGUID).First();
|
|
screenInfo.RescreeningStatus = screenInfo.RescreeningStatus + 1;
|
|
db.Updateable(screenInfo).UpdateColumns(it => new { it.RescreeningStatus }).ExecuteCommand();
|
|
}
|
|
physicalFitness.GUID = oneClass.GUID;
|
|
db.Updateable(physicalFitness).IgnoreColumns(i => new { i.ID, i.CreateID, i.CreateTime }).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|
|
|
}
|
|
else
|
|
{
|
|
physicalFitness.GUID = Guid.NewGuid().ToString();
|
|
physicalFitness.CreateTime = DateTime.Now;
|
|
db.Insertable(physicalFitness).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand() ;
|
|
|
|
T_Service_ApoplexyScreenInfo screenInfo = new T_Service_ApoplexyScreenInfo();
|
|
screenInfo = db.Queryable<T_Service_ApoplexyScreenInfo>().Where(i => i.GUID == physicalFitness.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("卒中高危筛查保存体格检查(SaveScreenPhysicalFitness)", ex.ToString());
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取体格检查
|
|
/// </summary>
|
|
/// <param name="guid"></param>
|
|
/// <returns></returns>
|
|
public T_Service_ApoplexyScreenPhysicalFitness GetScreenPhysicalFitness(string patientGuid, string flag)
|
|
{
|
|
return db.Queryable<T_Service_ApoplexyScreenPhysicalFitness>().Where(i => i.PatientGUID == patientGuid && i.Flag == flag && i.DeleteFlag == 0).First();
|
|
}
|
|
}
|
|
}
|