103 lines
5.8 KiB
C#
103 lines
5.8 KiB
C#
|
using HL_FristAidPlatform_Help;
|
|||
|
using HL_FristAidPlatform_IDataBase;
|
|||
|
using HL_FristAidPlatform_IDataBase.Service;
|
|||
|
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_ThrombolysisStrokeRateDB : BaseDB, IT_Service_Apoplexy_ThrombolysisStrokeRate
|
|||
|
{
|
|||
|
public SqlSugarClient db = GetClient();
|
|||
|
public ThrombolysisStrokeRateModel GetThrombolysisStrokeRateModel(string hospitalGuid, string startTime, string endTime)
|
|||
|
{
|
|||
|
ThrombolysisStrokeRateModel model = new ThrombolysisStrokeRateModel();
|
|||
|
int sumCount = 0;//总人数
|
|||
|
int sumCount1 = 0;//溶栓人数
|
|||
|
DateTime start = Convert.ToDateTime(startTime);
|
|||
|
DateTime end = Convert.ToDateTime(endTime);
|
|||
|
//发病4.5小时内患者总数
|
|||
|
var list = db.Queryable<T_Service_Patient, T_Service_Apoplexy_PatientOutcome, T_Service_Apoplexy_Prehospital>
|
|||
|
((a, c, d) => new JoinQueryInfos(JoinType.Inner, a.GUID == c.PatientGuid, JoinType.Inner, a.GUID == d.PatientGuid))
|
|||
|
.Where((a, c, d) => a.HospitalGuid == hospitalGuid && a.DeleteFlag == 0 && c.Diagnosis == 1 &&!SqlFunc.IsNullOrEmpty(d.NGSJZDaoYuanTime) && !SqlFunc.IsNullOrEmpty(d.NGSJZFaBingTime) && (SqlFunc.SqlServer_DateDiff("mm", SqlFunc.ToDate(d.NGSJZDaoYuanTime), SqlFunc.ToDate(d.NGSJZFaBingTime))) <= 270)
|
|||
|
.WhereIF(!SqlFunc.IsNullOrEmpty(startTime), (a) => a.CreationDate >= SqlFunc.ToDate(start))
|
|||
|
.WhereIF(!SqlFunc.IsNullOrEmpty(endTime), (a) => a.CreationDate <= SqlFunc.ToDate(end).AddMonths(1))
|
|||
|
.Select((a,c,d)=> new ApoplexyRateListModel
|
|||
|
{
|
|||
|
GUID = a.GUID,
|
|||
|
acZLType = a.acZLType,
|
|||
|
NGSJZDaoYuanTime = d.NGSJZDaoYuanTime,
|
|||
|
NGSJZFaBingTime = d.NGSJZFaBingTime
|
|||
|
}).ToList();
|
|||
|
if (list != null && list.Count > 0)
|
|||
|
{
|
|||
|
sumCount = list.Count();
|
|||
|
sumCount1 = list.Where(a => (!string.IsNullOrEmpty(a.acZLType) && a.acZLType.Contains("01"))).Count();
|
|||
|
}
|
|||
|
if (sumCount > 0)
|
|||
|
{
|
|||
|
float a1 = (float)sumCount1 / sumCount * 100;
|
|||
|
string s1 = a1.ToString("F2");//保留两位小数
|
|||
|
model.ThrombolysisRate = s1;
|
|||
|
}
|
|||
|
model.Count = sumCount;
|
|||
|
model.ThrombolysisNumber = sumCount1;
|
|||
|
model.NotThrombolysisNumber = sumCount - sumCount1;
|
|||
|
return model;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 时间窗内(发病4.5小时内)缺血性卒中溶栓率
|
|||
|
/// </summary>
|
|||
|
/// <param name="hospitalGuid"></param>
|
|||
|
/// <param name="startTime"></param>
|
|||
|
/// <param name="endTime"></param>
|
|||
|
/// <param name="type"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public TableModel<ApoplexyRateListModel> GetThrombolysisStrokeRateModelList(string hospitalGuid, string startTime, string endTime, int type, int pageIndex, int pageSize)
|
|||
|
{
|
|||
|
int totalNumber = 0;
|
|||
|
TableModel<ApoplexyRateListModel> t = new TableModel<ApoplexyRateListModel>();
|
|||
|
List<ApoplexyRateListModel> list = new List<ApoplexyRateListModel>();
|
|||
|
DateTime start = Convert.ToDateTime(startTime);
|
|||
|
DateTime end = Convert.ToDateTime(endTime);
|
|||
|
|
|||
|
//发病4.5小时内进行溶栓的患者列表
|
|||
|
var list1 = db.Queryable<T_Service_Patient, T_Service_Apoplexy_PatientOutcome, T_Service_Apoplexy_Prehospital>
|
|||
|
((a, c, d) => new JoinQueryInfos(JoinType.Inner, a.GUID == c.PatientGuid, JoinType.Inner, a.GUID == d.PatientGuid))
|
|||
|
.Where((a, c, d) => a.HospitalGuid == hospitalGuid && a.DeleteFlag == 0 && c.Diagnosis == 1 && !SqlFunc.IsNullOrEmpty(d.NGSJZDaoYuanTime) && !SqlFunc.IsNullOrEmpty(d.NGSJZFaBingTime) && (SqlFunc.SqlServer_DateDiff("mm", SqlFunc.ToDate(d.NGSJZDaoYuanTime), SqlFunc.ToDate(d.NGSJZFaBingTime))) <= 270)
|
|||
|
.WhereIF(!SqlFunc.IsNullOrEmpty(startTime), (a) => a.CreationDate >= SqlFunc.ToDate(start))
|
|||
|
.WhereIF(!SqlFunc.IsNullOrEmpty(endTime), (a) => a.CreationDate <= SqlFunc.ToDate(end).AddMonths(1))
|
|||
|
.WhereIF(type == 1, (a, c, d) => (!string.IsNullOrEmpty(a.acZLType) && a.acZLType.Contains("01")))
|
|||
|
.WhereIF(type == 0, (a, c, d) => (!string.IsNullOrEmpty(a.acZLType) && !a.acZLType.Contains("01")))
|
|||
|
.Select((a, c, d) => new ApoplexyRateListModel
|
|||
|
{
|
|||
|
GUID = a.GUID,
|
|||
|
Name = a.Name,
|
|||
|
Gender = a.Gender,
|
|||
|
Age = a.Age,
|
|||
|
Nation = a.Nation,
|
|||
|
MobilePhone = a.MobilePhone,
|
|||
|
IdentityCard = a.IdentityCard,
|
|||
|
Birthday = a.Birthday,
|
|||
|
OutpatientNumber = a.OutpatientNumber,
|
|||
|
AdmissionNumber = a.AdmissionNumber,
|
|||
|
Diagnose = c.Diagnosis + "",
|
|||
|
acZLType = a.acZLType,
|
|||
|
NGSJZDaoYuanTime = d.NGSJZDaoYuanTime,
|
|||
|
NGSJZFaBingTime = d.NGSJZFaBingTime
|
|||
|
}).ToPageList(pageIndex, pageSize, ref totalNumber);
|
|||
|
t.Code = 0;
|
|||
|
t.PageCount = list1.Count;
|
|||
|
t.TotalNumber = totalNumber;
|
|||
|
t.Data = list1;
|
|||
|
t.Msg = "成功";
|
|||
|
return t;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|