193 lines
8.2 KiB
C#
193 lines
8.2 KiB
C#
using HL_FristAidPlatform_Help;
|
|
using HL_FristAidPlatform_Help.Model;
|
|
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_FollowUpBaseDB : BaseDB, IT_Service_Apoplexy_FollowUpBase
|
|
{
|
|
public SqlSugarClient db = GetClient();
|
|
|
|
/// <summary>
|
|
/// 新增患者随访计划
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public bool Add(T_Service_Apoplexy_FollowUpBase model)
|
|
{
|
|
model.GUID = Guid.NewGuid().ToString();
|
|
return db.Insertable(model).ExecuteCommand() == 1 ? true : false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取患者随访计划总数
|
|
/// </summary>
|
|
/// <param name="PatientGuid"></param>
|
|
/// <returns></returns>
|
|
public int GetPatientFollwUpCount(string PatientGuid)
|
|
{
|
|
return db.Queryable<T_Service_Apoplexy_FollowUpBase>().Where(it => it.PatientGuid == PatientGuid&& it.DeleteFlag == 0).Count();
|
|
}
|
|
|
|
public T_Service_Apoplexy_FollowUpBase GetByGuid(string FGuid)
|
|
{
|
|
return db.Queryable<T_Service_Apoplexy_FollowUpBase>().Where(it => it.GUID == FGuid).First();
|
|
}
|
|
|
|
public T_Service_Apoplexy_FAHBaseProportion GetByGuidForApp(string Guid)
|
|
{
|
|
T_Service_Apoplexy_FAHBaseProportion model=db.Queryable<T_Service_Apoplexy_FollowUpBase, T_Service_Apoplexy_FollowUpInfo>
|
|
((a, b) => new JoinQueryInfos(JoinType.Left, a.GUID == b.FGUID))
|
|
.Where((a, b) => a.GUID == Guid)
|
|
.Select((a, b) => new T_Service_Apoplexy_FAHBaseProportion
|
|
{
|
|
GUID = a.GUID,
|
|
PatientGuid = a.PatientGuid,
|
|
NextTime = a.NextTime,
|
|
HospitalGuid = a.HospitalGuid,
|
|
CreationDate = a.CreationDate,
|
|
Proportion = b.Proportion
|
|
}).First();
|
|
|
|
if (string.IsNullOrEmpty(model.Proportion))
|
|
{
|
|
model.Proportion = "0";
|
|
}
|
|
|
|
return model;
|
|
|
|
|
|
}
|
|
|
|
|
|
public T_Service_Apoplexy_FollowUpBAD GetByPGuidAndTime(string patientGuid, DateTime nextTime)
|
|
{
|
|
T_Service_Apoplexy_FollowUpBAD m1 = new T_Service_Apoplexy_FollowUpBAD();
|
|
//return db.Queryable<T_Service_Apoplexy_FollowUpBase, T_Service_Apoplexy_FollowUpInfo>((a, b) => new JoinQueryInfos(
|
|
// JoinType.Left, a.GUID == b.FGUID)).Where((a, b) => a.PatientGuid == patientGuid && a.NextTime == nextTime)
|
|
// .Select((a, b) => new T_Service_Apoplexy_FollowUpBAD
|
|
// {
|
|
// GUID = a.GUID,
|
|
// PatientGuid = a.PatientGuid,
|
|
// NextTime = a.NextTime,
|
|
// HospitalGuid = a.HospitalGuid,
|
|
// DeleteFlag = a.DeleteFlag,
|
|
// FMode = b.FMode,
|
|
// IsF = b.IsF,
|
|
// FNoFReason = b.FNoFReason,
|
|
// FNoFReasonOther = b.FNoFReasonOther,
|
|
// FIsDie = b.FIsDie,
|
|
// FDieReason = b.FDieReason,
|
|
// FDieTime = b.FDieTime,
|
|
// FNurse = b.FNurse,
|
|
// FWork = b.FWork,
|
|
// FNewDisease = b.FNewDisease,
|
|
// FAType = b.FAType,
|
|
// FATypeDate = b.FATypeDate,
|
|
// FTIADate = b.FTIADate,
|
|
// FMyocardialInfarctionDate = b.FMyocardialInfarctionDate,
|
|
// FAnginaDate = b.FAnginaDate,
|
|
// FHeartFailureDate = b.FHeartFailureDate,
|
|
// FEmbolismDate = b.FEmbolismDate,
|
|
// FVascularDiseaseDate = b.FVascularDiseaseDate,
|
|
// FMainDiagnosis = b.FMainDiagnosis,
|
|
// FNewDiseaseRisk = b.FNewDiseaseRisk,
|
|
// FSmokingSituation = b.FSmokingSituation,
|
|
// FDrinkingSituation = b.FDrinkingSituation,
|
|
// FMovement = b.FMovement,
|
|
// FPressureRate = b.FPressureRate,
|
|
// FSystolicPressure = b.FSystolicPressure,
|
|
// FDiastolicPressure = b.FDiastolicPressure,
|
|
// FSugarRate = b.FSugarRate,
|
|
// FEmptyStomachSuger = b.FEmptyStomachSuger,
|
|
// FAfterMealSuger = b.FAfterMealSuger,
|
|
// IsFAntithrombotic = b.IsFAntithrombotic,
|
|
// FDrugName = b.FDrugName,
|
|
// FASPLUsage = b.FASPLUsage,
|
|
// FLBGLUsage = b.FLBGLUsage,
|
|
// FAZGLUsage = b.FAZGLUsage,
|
|
// FSBDMUsage = b.FSBDMUsage,
|
|
// FSLPDUsage = b.FSLPDUsage,
|
|
// FXLTCUsage = b.FXLTCUsage,
|
|
// FHFLUsage = b.FHFLUsage,
|
|
// FDBJQUsage = b.FDBJQUsage,
|
|
// FLFSBUsage = b.FLFSBUsage,
|
|
// FAPSBUsage = b.FAPSBUsage,
|
|
// FOtherDrugs = b.FOtherDrugs,
|
|
// FIsPressure = b.FIsPressure,
|
|
// FPressureGroup = b.FPressureGroup,
|
|
// FPressureType = b.FPressureType,
|
|
// FIsSugar = b.FIsSugar,
|
|
// FSugarType = b.FSugarType,
|
|
// FIsLipid = b.FIsLipid,
|
|
// FLipidType = b.FLipidType
|
|
// }).First();
|
|
return m1;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 患者随访计划列表
|
|
/// </summary>
|
|
/// <param name="PatientGuid"></param>
|
|
/// <returns></returns>
|
|
public List<T_Service_Apoplexy_FAHBaseProportion> GetFollowUpList(string patientGuid)
|
|
{
|
|
//return db.Queryable<T_Service_Apoplexy_FollowUpBase>().Where(it => it.PatientGuid == patientGuid && it.DeleteFlag == 0).OrderBy(it => it.NextTime).ToList();
|
|
List<T_Service_Apoplexy_FAHBaseProportion> list = db.Queryable<T_Service_Apoplexy_FollowUpBase, T_Service_Apoplexy_FollowUpInfo>
|
|
((a, b) => new JoinQueryInfos(JoinType.Left, a.GUID == b.FGUID))
|
|
.Where((a, b) => a.PatientGuid == patientGuid&&a.DeleteFlag==0)
|
|
.OrderBy((a,b)=>a.NextTime)
|
|
.Select((a, b) => new T_Service_Apoplexy_FAHBaseProportion
|
|
{
|
|
ID=a.ID,
|
|
GUID = a.GUID,
|
|
PatientGuid = a.PatientGuid,
|
|
NextTime = a.NextTime,
|
|
HospitalGuid = a.HospitalGuid,
|
|
CreationDate = a.CreationDate,
|
|
Proportion = b.Proportion
|
|
}).ToList();
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
if (string.IsNullOrEmpty(list[i].Proportion))
|
|
{
|
|
list[i].Proportion = "0";
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 修改患者随访计划
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int Update(T_Service_Apoplexy_FollowUpBase model)
|
|
{
|
|
return db.Updateable(model).UpdateColumns(it => new { it.NextTime, it.DeleteFlag }).ExecuteCommand();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int Delete(T_Service_Apoplexy_FollowUpBase model)
|
|
{
|
|
//return db.Updateable(model).UpdateColumns(it => new { it.NextTime, it.DeleteFlag }).ExecuteCommand();
|
|
return db.Updateable<T_Service_Apoplexy_FollowUpBase>().SetColumns(it => it.DeleteFlag == 1).Where(it => it.GUID == model.GUID).ExecuteCommand();
|
|
|
|
}
|
|
|
|
}
|
|
}
|