Пример #1
0
        //某天所有任务的依从情况 整理加工 GL 2015-10-12
        public TaskComDetailByD GetImplementationByDate(DataConnection pclsCache, string PatientId, string PlanNo, int Date)
        {
            TaskComDetailByD TaskComDetailByD = new TaskComDetailByD();
            try
            {
                TaskComDetailByD.Date = Date.ToString().Substring(0, 4) + "-" + Date.ToString().Substring(4, 2) + "-" + Date.ToString().Substring(6, 2);
                TaskComDetailByD.WeekDay = new CommonFunction().CaculateWeekDay(TaskComDetailByD.Date);

                List<TasksComList> ComplianceList = new List<TasksComList>();
                ComplianceList = GetTasksComListByDate(pclsCache, PatientId, PlanNo, Date);

                #region 后期可能用于优化
                //先读任务表,读取体征,拿出新数据;再读药物表,超过三个则省略号
                //DataTable TaskList = new DataTable();
                //TaskList = PsTask.GetTaskList(pclsCache, PlanNo);

                ////读取体征,拿出当天最新数据
                //string condition = " Type = 'VitalSign'";
                //DataRow[] VitalSignRows = TaskList.Select(condition);

                //CacheSysList VitalSignList = new InterSystems.Data.CacheTypes.CacheSysList(System.Text.Encoding.Unicode, true, true);
                //for (int j=0; j < VitalSignRows.Length; j++)
                //{
                //    string code = VitalSignRows[j]["Type"].ToString();
                //    string[] sArray = code.Split(new char[] { '|' });;//拆分
                //    string type = sArray[0].ToString();
                //    VitalSignList = new InterSystems.Data.CacheTypes.CacheSysList(System.Text.Encoding.Unicode, true, true);
                //    VitalSignList = PsVitalSigns.GetSignByDay(pclsCache, PatientId, code, type, Date);
                //    if (VitalSignList != null)
                //    {

                //    }
                //}





                //体征
                /*
                string condition = " Type = 'VitalSign'";
                DataRow[] VitalSignRows = ComplianceList.Select(condition);

                List<TaskCom> TaskComList = new List<TaskCom>();
                TaskCom TaskCom = new TaskCom();
                for (int j = 0; j < VitalSignRows.Length; j++)
                {
                    VitalTaskCom = new VitalTaskCom();
                    VitalTaskCom.SignName = VitalSignRows[j]["TaskName"].ToString();
                    VitalTaskCom.Status = VitalSignRows[j]["Status"].ToString();
                    if (TaskCom.TaskStatus == "1")
                    {
                        string code = VitalSignRows[j]["TaskCode"].ToString();
                        string[] sArray = code.Split(new char[] { '|' }); ;//拆分
                        string type = sArray[0].ToString();
                        //CacheSysList VitalSignList = new InterSystems.Data.CacheTypes.CacheSysList(System.Text.Encoding.Unicode, true, true);
                        CacheSysList VitalSignList = new InterSystems.Data.CacheTypes.CacheSysList(System.Text.Encoding.Unicode, true, true);
                        VitalSignList = PsVitalSigns.GetSignByDay(pclsCache, PatientId, code, type, Date);
                        if (VitalSignList != null)
                        {
                            
                            VitalTaskCom.Time = PulList[1].ToString();
                            VitalTaskCom.Value = PulList[2].ToString();
                            VitalTaskCom.Unit = PulList[3].ToString();
                            
                        } 
                    }
                    VitalTaskComList.Add(VitalTaskCom);
                }
                TaskComDetailByD.VitalTaskComList = VitalTaskComList;

                
                 string vitalCondition = " Type = 'VitalSign'";
                    DataRow[] VitalSignRows = ComplianceList.Select(vitalCondition);

                    if ((VitalSignRows != null) && (VitalSignRows.Length >= 2))
                    {



                        if (VitalSignRows.Length == 2)  //只有血压
                        {

                        }
                        else //血压和脉率
                        {

                        }
                    }
                
                */
                #endregion

                //取出当天的体征测量 若有与测试任务拼接好了
                //先写死取的生理参数
                List<VitalTaskCom> VitalTaskComList = new List<VitalTaskCom>();
                VitalTaskCom VitalTaskCom = new VitalTaskCom();

                string Module = "";
                GPlanInfo planInfo = GetPlanInfo(pclsCache, PlanNo);
                if (planInfo != null)
                {
                    Module = planInfo.Module;
                }

                if (Module == "M1")
                {
                    #region  高血压模块  需要考虑没有脉率任务的情况

                    //血压任务肯定有
                    int BPTime = 0;
                    int mark = 0;
                    string SysValue = "";
                    string DiaValue = "";
                    string Unit = "";

                    //string conditionBP1 = " TaskCode = 'Bloodpressure|Bloodpressure_1'";
                    List<TasksComList> BP1Rows = new List<TasksComList>();
                    if (ComplianceList != null)
                    {
                        foreach (TasksComList item in ComplianceList)
                        {
                            if (item.TaskCode == "Bloodpressure|Bloodpressure_1")
                            {
                                BP1Rows.Add(item);
                            }
                        }
                    }
                    if ((BP1Rows != null) && (BP1Rows.Count == 1))
                    {
                        if (BP1Rows[0].Status == "1")
                        {
                            VitalInfo SysList = new VitalInfoMethod().GetSignByDay(pclsCache, PatientId, "Bloodpressure", "Bloodpressure_1", Date);
                            if (SysList != null)
                            {
                                mark = 1;
                                BPTime = Convert.ToInt32(SysList.RecordTime);  //时刻数据库是"1043"形式,需要转换  取两者最新的那个时间好了 即谁大取谁
                                SysValue = SysList.Value;
                                Unit = SysList.Unit;
                            }
                        }
                    }

                    // string conditionBP2 = " TaskCode = 'Bloodpressure|Bloodpressure_2'";
                    List<TasksComList> BP2Rows = new List<TasksComList>();
                    if (ComplianceList != null)
                    {
                        foreach (TasksComList item in ComplianceList)
                        {
                            if (item.TaskCode == "Bloodpressure|Bloodpressure_2")
                            {
                                BP2Rows.Add(item);
                            }
                        }
                    }
                    if ((BP2Rows != null) && (BP2Rows.Count == 1))
                    {
                        if (BP2Rows[0].Status == "1")
                        {
                            VitalInfo DiaList = new VitalInfoMethod().GetSignByDay(pclsCache, PatientId, "Bloodpressure", "Bloodpressure_2", Date);
                            if (DiaList != null)
                            {
                                mark = 1;
                                int BPTime1 = Convert.ToInt32(DiaList.RecordTime);
                                if (BPTime <= BPTime1)
                                {
                                    BPTime = BPTime1;
                                }
                                DiaValue = DiaList.Value;
                            }
                        }
                    }

                    VitalTaskCom = new VitalTaskCom();
                    VitalTaskCom.SignName = "血压";
                    if (mark == 1)
                    {
                        VitalTaskCom.Status = "1";
                        VitalTaskCom.Time = new CommonFunction().TransTime(BPTime.ToString());
                        VitalTaskCom.Value = SysValue + "/" + DiaValue;
                        VitalTaskCom.Unit = Unit;
                    }
                    else
                    {
                        VitalTaskCom.Status = "0";
                    }
                    VitalTaskComList.Add(VitalTaskCom);



                    //脉率任务可能没没有,需要确认
                    //string conditionPR = " TaskCode = 'Pulserate|Pulserate_1'";
                    List<TasksComList> PulserateRows = new List<TasksComList>();
                    if (ComplianceList != null)
                    {
                        foreach (TasksComList item in ComplianceList)
                        {
                            if (item.TaskCode == "Pulserate|Pulserate_1")
                            {
                                BP2Rows.Add(item);
                            }
                        }
                    }
                    if ((PulserateRows != null) && (PulserateRows.Count == 1))
                    {
                        VitalTaskCom = new VitalTaskCom();
                        VitalTaskCom.SignName = "脉率";

                        if (PulserateRows[0].Status == "1")
                        {
                            VitalInfo PulList = new VitalInfoMethod().GetSignByDay(pclsCache, PatientId, "Pulserate", "Pulserate_1", Date);
                            if (PulList != null)
                            {

                                VitalTaskCom.Status = "1";
                                VitalTaskCom.Time = new CommonFunction().TransTime(PulList.RecordTime);
                                VitalTaskCom.Value = PulList.Value;
                                VitalTaskCom.Unit = PulList.Unit;
                            }
                            else
                            {
                                VitalTaskCom.Status = "0";

                            }
                        }
                        else
                        {
                            VitalTaskCom.Status = "0";

                        }
                        VitalTaskComList.Add(VitalTaskCom);
                    }
                    #endregion
                }

                TaskComDetailByD.VitalTaskComList = VitalTaskComList;

                TaskComByType TaskComByType = new TaskComByType();
                List<TaskCom> TaskComList = new List<TaskCom>();
                TaskCom TaskCom = new TaskCom();

                //生活方式 
                //string condition = " Type = 'LifeStyle'";
                List<TasksComList> LifeStyleRows = new List<TasksComList>();
                if (ComplianceList != null)
                {
                    foreach (TasksComList item in ComplianceList)
                    {
                        if (item.Type == "LifeStyle")
                        {
                            LifeStyleRows.Add(item);
                        }
                    }
                }
                if ((LifeStyleRows != null) && (LifeStyleRows.Count > 0))
                {
                    TaskComByType = new TaskComByType();
                    TaskComByType.TaskType = "生活方式";
                    TaskComList = new List<TaskCom>();
                    TaskCom = new TaskCom();

                    foreach (TasksComList item in LifeStyleRows)
                    {
                        TaskCom = new TaskCom();
                        TaskCom.TaskName = item.TaskName;
                        TaskCom.TaskStatus = item.Status;
                        TaskComList.Add(TaskCom);
                    }
                    TaskComByType.TaskComList = TaskComList;
                    TaskComDetailByD.TaskComByTypeList.Add(TaskComByType);
                }

                //用药情况
                //condition = " Type = 'Drug'";
                List<TasksComList> DrugRows = new List<TasksComList>();
                if (ComplianceList != null)
                {
                    foreach (TasksComList item in ComplianceList)
                    {
                        if (item.Type == "Drug")
                        {
                            DrugRows.Add(item);
                        }
                    }
                }
                if ((DrugRows != null) && (DrugRows.Count > 0))
                {
                    TaskComByType = new TaskComByType();
                    TaskComByType.TaskType = "用药情况";
                    TaskComList = new List<TaskCom>();
                    TaskCom = new TaskCom();
                    foreach (TasksComList item in DrugRows)
                    {
                        TaskCom = new TaskCom();
                        TaskCom.TaskName = item.TaskName;
                        TaskCom.TaskStatus = item.Status;
                        TaskComList.Add(TaskCom);
                    }
                    TaskComByType.TaskComList = TaskComList;
                    TaskComDetailByD.TaskComByTypeList.Add(TaskComByType);
                }
                return TaskComDetailByD;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "PsCompliance.GetImplementationByDate", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return null;
            }
        }
Пример #2
0
        public int SetM3RiskInput(DataConnection pclsCache, string PatientId, M3RiskInput M3RiskInput, int RecordDate, int RecordTime, string piUserId, string piTerminalName, string piTerminalIP, int piDeviceType)
        {
            int ret  = 0;
            int fret = 1;

            try
            {
                #region//插入PsVitalSigns表
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Height", M3RiskInput.Height.ToString(), "cm", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Weight", M3RiskInput.Weight.ToString(), "kg", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M3", "QG0013", M3RiskInput.SBP.ToString(), "mmHg", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                #endregion

                #region//插入PsBasicInfoDetail表
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QJ0025", 1, M3RiskInput.EF.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QF0011", 1, M3RiskInput.Smoke.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QB0045", 1, M3RiskInput.Diabetes.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QH0001", 1, M3RiskInput.Creatinine.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QJ0008", 1, M3RiskInput.NYHA.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QB0046", 1, M3RiskInput.Lung.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QB0047", 1, M3RiskInput.HF18.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QE0008", 1, M3RiskInput.Beta.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QE0009", 1, M3RiskInput.AA.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                #endregion

                return(fret);
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "RiskInfoMethod.SetM3RiskInput", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return(0);
            }
            finally
            {
                pclsCache.DisConnect();
            }
        }
Пример #3
0
        //public List<VitalInfo> GetAllSignsByPeriod( string UserId, int StartDate, int EndDate)
        //{
        //    return new VitalInfoMethod().GetAllSignsByPeriod(pclsCache, UserId, StartDate, EndDate);
        //}
        // 获取某日期之前,一定条数血压(收缩压/舒张压)和脉率的数据详细时刻列表,用于phone,支持继续加载  GL 2015-10-12
        public SignDetailByP GetSignsDetailByPeriod(DataConnection pclsCache, string PatientId, string Module, int StartDate, int Num)
        {
            SignDetailByP result = new SignDetailByP();

            try
            {
                int CacheStartDate = 0;
                int CacheEndDate = 0;

                //按有数据的天数平移
                VitalInfo dateList = new VitalInfoMethod().GetVitalSignDates(pclsCache, PatientId, StartDate, Num);
                if (dateList != null)
                {
                    if ((dateList.StartDate != null) && (dateList.EndDate != null))
                    {
                        CacheStartDate = Convert.ToInt32(dateList.StartDate);
                        CacheEndDate = Convert.ToInt32(dateList.EndDate);
                        result.NextStartDate = CacheStartDate;
                    }
                    else if ((dateList.StartDate == null) && (dateList.EndDate != null))
                    {
                        CacheEndDate = Convert.ToInt32(dateList.EndDate);
                        result.NextStartDate = -1; //取完的标志

                    }
                    else if ((dateList.StartDate == null) && (dateList.EndDate == null))
                    {
                        result.NextStartDate = -1;
                    }
                }

                //收缩压
                List<VitalInfo> sysInfo = new List<VitalInfo>();
                sysInfo = new VitalInfoMethod().GetTypedSignDetailByPeriod(pclsCache, PatientId, "Bloodpressure", "Bloodpressure_1", CacheStartDate, CacheEndDate);

                //舒张压
                List<VitalInfo> diaInfo = new List<VitalInfo>();
                diaInfo = new VitalInfoMethod().GetTypedSignDetailByPeriod(pclsCache, PatientId, "Bloodpressure", "Bloodpressure_2", CacheStartDate, CacheEndDate);

                //脉率
                List<VitalInfo> pulInfo = new List<VitalInfo>();
                pulInfo = new VitalInfoMethod().GetTypedSignDetailByPeriod(pclsCache, PatientId, "Pulserate", "Pulserate_1", CacheStartDate, CacheEndDate);

                //三张表整合,按时间排序 避免条数可能不一致造成的问题
                //sysInfo.Merge(diaInfo);
                //sysInfo.Merge(pulInfo);
                if (diaInfo.Count > 0)
                {
                    foreach (VitalInfo item in diaInfo)
                    {
                        sysInfo.Add(item);
                    }
                }
                if (pulInfo.Count > 0)
                {
                    foreach (VitalInfo item in pulInfo)
                    {
                        sysInfo.Add(item);
                    }
                }

                //按RecordDate、RecordTime、SignType排序  再合并成收集需要的形式)
                //将List<>转化为datatable进行排序
                DataTable list = new DataTable();
                list.Columns.Add(new DataColumn("SignType", typeof(string)));
                list.Columns.Add(new DataColumn("RecordDate", typeof(string)));
                list.Columns.Add(new DataColumn("RecordTime", typeof(string)));
                list.Columns.Add(new DataColumn("Value", typeof(string)));
                list.Columns.Add(new DataColumn("Unit", typeof(string)));

                foreach (VitalInfo item in sysInfo)
                {
                    list.Rows.Add(item.SignType, item.RecordDate, item.RecordTime, item.Value, item.Unit);
                }

                DataView dv = list.DefaultView;
                dv.Sort = "RecordDate desc, RecordTime asc,SignType asc";
                DataTable dt_Sort = dv.ToTable();

                //1 收缩压, 2 舒张压, 3 脉率
                //整理成日期、时刻、数值的形式
                //整理成列表形式 2011/01/03 星期三
                //08:00 137 95 66
                //09:00 134 78 66
                if (dt_Sort != null)
                {
                    if (dt_Sort.Rows.Count > 0)
                    {
                        SignDetail SignDetail = new SignDetail();
                        SignDetail.DetailTime = dt_Sort.Rows[0]["RecordTime"].ToString();
                        if (dt_Sort.Rows[0]["SignType"].ToString() == "1")
                        {
                            SignDetail.SBPValue = dt_Sort.Rows[0]["Value"].ToString();
                        }
                        else if (dt_Sort.Rows[0]["SignType"].ToString() == "2")
                        {
                            SignDetail.DBPValue = dt_Sort.Rows[0]["Value"].ToString();
                        }
                        else
                        {
                            SignDetail.PulseValue = dt_Sort.Rows[0]["Value"].ToString();
                        }

                        SignDetailByD SignDetailByD = new SignDetailByD();
                        SignDetailByD.Date = dt_Sort.Rows[0]["RecordDate"].ToString();
                        SignDetailByD.WeekDay = new CommonFunction().CaculateWeekDay(dt_Sort.Rows[0]["RecordDate"].ToString());

                        if (dt_Sort.Rows.Count == 1)
                        {
                            SignDetailByD.SignDetailList.Add(SignDetail);
                            result.SignDetailByDs.Add(SignDetailByD);
                        }
                        else
                        {
                            string temp_date = dt_Sort.Rows[0]["RecordDate"].ToString();
                            string temp_hour = dt_Sort.Rows[0]["RecordTime"].ToString();

                            for (int rowsCount = 1; rowsCount < dt_Sort.Rows.Count; rowsCount++)
                            {
                                if (rowsCount != dt_Sort.Rows.Count - 1)
                                {
                                    #region 不是最后一条

                                    if (temp_date == dt_Sort.Rows[rowsCount]["RecordDate"].ToString())
                                    {
                                        #region 同一天
                                        if (temp_hour == dt_Sort.Rows[rowsCount]["RecordTime"].ToString())
                                        {
                                            if (dt_Sort.Rows[rowsCount]["SignType"].ToString() == "1")
                                            {
                                                SignDetail.SBPValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                            }
                                            else if (dt_Sort.Rows[rowsCount]["SignType"].ToString() == "2")
                                            {
                                                SignDetail.DBPValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                            }
                                            else
                                            {
                                                SignDetail.PulseValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                            }
                                        }
                                        else
                                        {
                                            SignDetailByD.SignDetailList.Add(SignDetail);

                                            SignDetail = new SignDetail();
                                            SignDetail.DetailTime = dt_Sort.Rows[rowsCount]["RecordTime"].ToString();
                                            if (dt_Sort.Rows[rowsCount]["SignType"].ToString() == "1")
                                            {
                                                SignDetail.SBPValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                            }
                                            else if (dt_Sort.Rows[rowsCount]["SignType"].ToString() == "2")
                                            {
                                                SignDetail.DBPValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                            }
                                            else
                                            {
                                                SignDetail.PulseValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                            }

                                            temp_hour = dt_Sort.Rows[rowsCount]["RecordTime"].ToString();
                                        }
                                        #endregion
                                    }
                                    else
                                    {
                                        #region 不同天
                                        SignDetailByD.SignDetailList.Add(SignDetail);
                                        result.SignDetailByDs.Add(SignDetailByD);

                                        SignDetailByD = new SignDetailByD();
                                        SignDetail = new SignDetail();
                                        SignDetail.DetailTime = dt_Sort.Rows[rowsCount]["RecordTime"].ToString();
                                        if (dt_Sort.Rows[rowsCount]["SignType"].ToString() == "1")
                                        {
                                            SignDetail.SBPValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                        }
                                        else if (dt_Sort.Rows[rowsCount]["SignType"].ToString() == "2")
                                        {
                                            SignDetail.DBPValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                        }
                                        else
                                        {
                                            SignDetail.PulseValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                        }
                                        SignDetailByD.Date = dt_Sort.Rows[rowsCount]["RecordDate"].ToString();
                                        SignDetailByD.WeekDay = new CommonFunction().CaculateWeekDay(dt_Sort.Rows[rowsCount]["RecordDate"].ToString());

                                        temp_date = dt_Sort.Rows[rowsCount]["RecordDate"].ToString();
                                        temp_hour = dt_Sort.Rows[rowsCount]["RecordTime"].ToString();

                                        #endregion
                                    }
                                    #endregion
                                }
                                else
                                {
                                    #region 最后一条

                                    if (temp_date == dt_Sort.Rows[rowsCount]["RecordDate"].ToString())
                                    {
                                        #region 同一天
                                        if (temp_hour == dt_Sort.Rows[rowsCount]["RecordTime"].ToString())
                                        {
                                            if (dt_Sort.Rows[rowsCount]["SignType"].ToString() == "1")
                                            {
                                                SignDetail.SBPValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                            }
                                            else if (dt_Sort.Rows[rowsCount]["SignType"].ToString() == "2")
                                            {
                                                SignDetail.DBPValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                            }
                                            else
                                            {
                                                SignDetail.PulseValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                            }
                                            SignDetailByD.SignDetailList.Add(SignDetail);
                                            result.SignDetailByDs.Add(SignDetailByD);
                                        }
                                        else
                                        {
                                            SignDetailByD.SignDetailList.Add(SignDetail);

                                            SignDetail = new SignDetail();
                                            SignDetail.DetailTime = dt_Sort.Rows[rowsCount]["RecordTime"].ToString();
                                            if (dt_Sort.Rows[rowsCount]["SignType"].ToString() == "1")
                                            {
                                                SignDetail.SBPValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                            }
                                            else if (dt_Sort.Rows[rowsCount]["SignType"].ToString() == "2")
                                            {
                                                SignDetail.DBPValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                            }
                                            else
                                            {
                                                SignDetail.PulseValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                            }

                                            temp_hour = dt_Sort.Rows[rowsCount]["RecordTime"].ToString();
                                            SignDetailByD.SignDetailList.Add(SignDetail);
                                            result.SignDetailByDs.Add(SignDetailByD);
                                        }
                                        #endregion
                                    }
                                    else
                                    {
                                        #region 不同天
                                        SignDetailByD.SignDetailList.Add(SignDetail);
                                        result.SignDetailByDs.Add(SignDetailByD);

                                        SignDetailByD = new SignDetailByD();
                                        SignDetail = new SignDetail();
                                        SignDetail.DetailTime = dt_Sort.Rows[rowsCount]["RecordTime"].ToString();
                                        if (dt_Sort.Rows[rowsCount]["SignType"].ToString() == "1")
                                        {
                                            SignDetail.SBPValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                        }
                                        else if (dt_Sort.Rows[rowsCount]["SignType"].ToString() == "2")
                                        {
                                            SignDetail.DBPValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                        }
                                        else
                                        {
                                            SignDetail.PulseValue = dt_Sort.Rows[rowsCount]["Value"].ToString();
                                        }
                                        SignDetailByD.Date = dt_Sort.Rows[rowsCount]["RecordDate"].ToString();
                                        SignDetailByD.WeekDay = new CommonFunction().CaculateWeekDay(dt_Sort.Rows[rowsCount]["RecordDate"].ToString());

                                        temp_date = dt_Sort.Rows[rowsCount]["RecordDate"].ToString();
                                        SignDetailByD.SignDetailList.Add(SignDetail);
                                        result.SignDetailByDs.Add(SignDetailByD);

                                        #endregion
                                    }

                                    #endregion
                                }

                            }
                        }
                    }
                }
                return result;
                //string a = JSONHelper.ObjectToJson(result);
                //Context.Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF });
                //Context.Response.Write(a);
                ////Context.Response.End();
                //HttpContext.Current.ApplicationInstance.CompleteRequest();

            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "GetSignsDetailByPeriod", "WebService调用异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                //return null;
                throw (ex);
            }
        }
Пример #4
0
        public int SetM1RiskInput(DataConnection pclsCache, string PatientId, M1RiskInput M1RiskInput, int RecordDate, int RecordTime, string piUserId, string piTerminalName, string piTerminalIP, int piDeviceType)
        {
            int ret  = 0;
            int fret = 1;

            try
            {
                #region//插入PsVitalSigns表
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Height", M1RiskInput.Height.ToString(), "cm", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Weight", M1RiskInput.Weight.ToString(), "kg", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0018", M1RiskInput.AbdominalGirth.ToString(), "mm", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0007", M1RiskInput.Heartrate.ToString(), "次/分", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0013", M1RiskInput.SBP.ToString(), "mmHg", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0012", M1RiskInput.DBP.ToString(), "mmHg", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                #endregion

                #region//插入PsBasicInfoDetail表
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QC0001", 1, M1RiskInput.Parent.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QF0011", 1, M1RiskInput.Smoke.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0007", 1, M1RiskInput.Stroke.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QJ0024", 1, M1RiskInput.Lvh.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QB0045", 1, M1RiskInput.Diabetes.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QD0002", 1, M1RiskInput.Treat.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0004", 1, M1RiskInput.Heartattack.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0005", 1, M1RiskInput.Af.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0002", 1, M1RiskInput.Chd.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0006", 1, M1RiskInput.Valve.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QH0002", 1, M1RiskInput.Tcho.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QH0001", 1, M1RiskInput.Creatinine.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QH0003", 1, M1RiskInput.Hdlc.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                #endregion

                return(fret);
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "RiskInfoMethod.SetM1RiskInput", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return(0);
            }
            finally
            {
                pclsCache.DisConnect();
            }
        }
Пример #5
0
        public int SetM3RiskInput(DataConnection pclsCache, string PatientId, M3RiskInput M3RiskInput, int RecordDate, int RecordTime, string piUserId, string piTerminalName, string piTerminalIP, int piDeviceType)
        {
            int ret = 0;
            int fret = 1;
            try
            {
                #region//插入PsVitalSigns表
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Height", M3RiskInput.Height.ToString(), "cm", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Weight", M3RiskInput.Weight.ToString(), "kg", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M3", "QG0013", M3RiskInput.SBP.ToString(), "mmHg", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                #endregion

                #region//插入PsBasicInfoDetail表
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QJ0025", 1, M3RiskInput.EF.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QF0011", 1, M3RiskInput.Smoke.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QB0045", 1, M3RiskInput.Diabetes.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QH0001", 1, M3RiskInput.Creatinine.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QJ0008", 1, M3RiskInput.NYHA.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QB0046", 1, M3RiskInput.Lung.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QB0047", 1, M3RiskInput.HF18.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QE0008", 1, M3RiskInput.Beta.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M3", "QE0009", 1, M3RiskInput.AA.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                #endregion

                return fret;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "RiskInfoMethod.SetM3RiskInput", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return 0;
            }
            finally
            {
                pclsCache.DisConnect();
            }
        }
Пример #6
0
        public int SetM1RiskInput(DataConnection pclsCache, string PatientId, M1RiskInput M1RiskInput, int RecordDate, int RecordTime, string piUserId, string piTerminalName, string piTerminalIP, int piDeviceType)
        {
            int ret = 0;
            int fret = 1;
            try
            {
                #region//插入PsVitalSigns表
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Height", M1RiskInput.Height.ToString(), "cm", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "BodySigns", "Weight", M1RiskInput.Weight.ToString(), "kg", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0018", M1RiskInput.AbdominalGirth.ToString(), "mm", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0007", M1RiskInput.Heartrate.ToString(), "次/分", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0013", M1RiskInput.SBP.ToString(), "mmHg", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new VitalInfoMethod().SetData(pclsCache, PatientId, RecordDate, RecordTime, "M1", "QG0012", M1RiskInput.DBP.ToString(), "mmHg", piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                #endregion

                #region//插入PsBasicInfoDetail表
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QC0001", 1, M1RiskInput.Parent.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QF0011", 1, M1RiskInput.Smoke.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0007", 1, M1RiskInput.Stroke.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QJ0024", 1, M1RiskInput.Lvh.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QB0045", 1, M1RiskInput.Diabetes.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QD0002", 1, M1RiskInput.Treat.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0004", 1, M1RiskInput.Heartattack.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0005", 1, M1RiskInput.Af.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0002", 1, M1RiskInput.Chd.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QA0006", 1, M1RiskInput.Valve.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QH0002", 1, M1RiskInput.Tcho.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QH0001", 1, M1RiskInput.Creatinine.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                ret = new UsersMethod().BasicInfoDetailSetData(pclsCache, PatientId, "M1", "QH0003", 1, M1RiskInput.Hdlc.ToString(), "", 1, piUserId, piTerminalName, piTerminalIP, piDeviceType);
                if (ret == 0)
                {
                    fret = 0;
                }
                #endregion

                return fret;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "RiskInfoMethod.SetM1RiskInput", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return 0;
            }
            finally
            {
                pclsCache.DisConnect();
            }
        }
Пример #7
0
        //获取健康专员负责的所有患者(最新结束但未达标的)计划列表 GL 2015-10-13
        public List<OverDuePlanDetail> GetOverDuePlanList(DataConnection pclsCache, string DoctorId, string ModuleType)
        {
            List<OverDuePlanDetail> PlanList = new List<OverDuePlanDetail>();
            try
            {
                int nowDate = new CommonFunction().GetServerDate();

                List<PatientPlan> DT_Patients = new PlanInfoMethod().GetOverDuePlanByDoctorId(pclsCache, DoctorId, ModuleType);
                if (DT_Patients == null)
                {
                    return null;
                }
                foreach (PatientPlan item in DT_Patients)
                {
                    string patientId = item.PatientId;
                    string planNo = item.PlanNo;
                    string startDate = item.StartDate;
                    string endDate = item.EndDate;
                    string totalDays = item.TotalDays;
                    string remainingDays = item.RemainingDays;

                    double process = 0.0;
                    //VitalSign
                    List<string> vitalsigns = new List<string>();

                    if (planNo != "")
                    {
                        //double complianceRate = PsCompliance.GetComplianceByDay(pclsCache, patientId, nowDate, planNo);

                        string itemType = "Bloodpressure";
                        string itemCode = "Bloodpressure_1";
                        int recordDate = Convert.ToInt32(endDate);
                        VitalInfo list = new VitalInfoMethod().GetLatestVitalSignsByDate(pclsCache, patientId, itemType, itemCode, recordDate);
                        if (list != null)
                        {
                            vitalsigns.Add(list.Value);
                        }

                        TargetByCode targetlist = new PlanInfoMethod().GetTarget(pclsCache, planNo, itemType, itemCode);
                        if (targetlist != null)
                        {
                            vitalsigns.Add(targetlist.Value);  //value
                        }
                        //非法数据判断 zam 2015-5-18
                        //OverDue Check
                        if (list != null && targetlist != null)
                        {
                            double m, n;
                            bool misNumeric = double.TryParse(list.Value, out m);
                            bool nisNumeric = double.TryParse(targetlist.Value, out n);
                            if (misNumeric && nisNumeric)
                            {
                                //if (Convert.ToInt32(list[2]) <= Convert.ToInt32(targetlist[3])) //已达标
                                if (m <= n)
                                {
                                    continue;
                                }
                            }
                        }
                    }
                    //PhotoAddress
                    string photoAddress = "";
                    PatDetailInfo patientInfolist = new ModuleInfoMethod().PsBasicInfoDetailGetPatientDetailInfo(pclsCache, patientId);
                    if (patientInfolist != null)
                    {
                        photoAddress = patientInfolist.PhotoAddress;
                    }

                    string patientName = "";
                    patientName = new UsersMethod().GetNameByUserId(pclsCache, patientId);

                    OverDuePlanDetail PlanItem = new OverDuePlanDetail();
                    PlanItem.PatientId = patientId;
                    PlanItem.PatientName = patientName;
                    PlanItem.PhotoAddress = photoAddress;
                    PlanItem.PlanNo = planNo;
                    PlanItem.StartDate = startDate;
                    PlanItem.Process = process;
                    PlanItem.RemainingDays = remainingDays;
                    PlanItem.VitalSign = vitalsigns;

                    PlanList.Add(PlanItem);
                }
                return PlanList;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "GetOverDuePlanList", "PlanInfoRepository error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return null;
                throw (ex);
            }
        }
Пример #8
0
 /// <summary>
 /// 获取风险评估所需输入 LY 2015-10-13
 /// </summary>
 /// <param name="UserId"></param>
 /// <returns></returns>
 public RiskInput GetRiskInput(DataConnection pclsCache, string UserId)
 {
     //当用户缺少某项参数时,设置一个默认值
     int Age = 1;//年龄默认1岁(避免出现0岁)
     int Gender = 0;//性别男
     int Height = 0;//身高176cm
     int Weight = 0;//体重69千克
     int AbdominalGirth = 0; //腹围
     int Heartrate = 0;//心率
     int Parent = 0;//父母中至少有一方有高血压
     int Smoke = 0;//不抽烟
     int Stroke = 0;//没有中风
     int Lvh = 0; ;//有左心室肥大
     int Diabetes = 0;//有伴随糖尿病
     int Treat = 0;//高血压是否在治疗(接受过)没有
     int Heartattack = 0;//有过心脏事件(心血管疾病)
     int Af = 0;//没有过房颤
     int Chd = 0;//有冠心病(心肌梗塞)
     int Valve = 0;//没有心脏瓣膜病
     double Tcho = 0;//总胆固醇浓度5.2mmol/L
     double Creatinine = 0;//肌酐浓度140μmoI/L
     double Hdlc = 0;//高密度脂蛋白胆固醇1.21g/ml
     int SBP = 0;//当前收缩压
     int DBP = 0;//当前舒张压
     //用于取得真实值
     int piParent = 0;//父母中至少有一方有高血压
     int piSmoke = 0;//不抽烟
     int piStroke = 0;//没有中风
     int piLvh = 0; ;//有左心室肥大
     int piDiabetes = 0;//有伴随糖尿病
     int piTreat = 0;//高血压是否在治疗(接受过)没有
     int piHeartattack = 0;//有过心脏事件(心血管疾病)
     int piAf = 0;//没有过房颤
     int piChd = 0;//有冠心病(心肌梗塞)
     int piValve = 0;//没有心脏瓣膜病
     BasicInfo BaseList = new UsersMethod().GetBasicInfo(pclsCache, UserId);
     if (BaseList != null)
     {
         if (BaseList.Birthday != "" && BaseList.Birthday != "0" && BaseList.Birthday != null)
         {
             Age = new UsersMethod().GetAgeByBirthDay(pclsCache, Convert.ToInt32(BaseList.Birthday));//年龄
         }
         if (BaseList.Gender != "" && BaseList.Gender != "0" && BaseList.Gender != null)
         {
             Gender = Convert.ToInt32(BaseList.Gender);//性别
         }
     }
     if (Gender <= 2)
     {
         Gender = Gender - 1;
     }
     else
     {
         Gender = 0;
     }
     if (Gender == 1)//为计算方便,性别值对调
     {
         Gender = 0;
     }
     else
     {
         Gender = 1;
     }
     //获取体重,身高和BMI
     string Weight1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_02", 1);
     if (Weight1 != "" && Weight1 != "0" && Weight1 != null)
     {
         Weight = Convert.ToInt32(Weight1);
     }
     string Height1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_01", 1);
     if (Height1 != "" && Height1 != "0" && Height1 != null)
     {
         Height = Convert.ToInt32(Height1);
     }
     string BMIStr = ((double)Weight / ((double)Height * (double)Height) * 10000).ToString("f2");
     double BMI = double.Parse(BMIStr);
     //获取腹围
     string AbdominalGirth1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_13", 1);
     if (AbdominalGirth1 != "" && AbdominalGirth1 != "0" && AbdominalGirth1 != null)
     {
         AbdominalGirth = Convert.ToInt32(AbdominalGirth1);
     }
     //获取心率
     string Heart = new VitalInfoMethod().GetLatestPatientVitalSigns(pclsCache, UserId, "HeartRate", "HeartRate_1");
     if (Heart != "" && Heart != "0" && Heart != null)
     {
         Heartrate = Convert.ToInt32(Heart);
     }
     //获取遗传信息,即父母有无高血压,1是2否3未知
     string Parent1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1002_01", 1);
     if (Parent1 != "" && Parent1 != "0" && Parent1 != null)
     {
         Parent = Convert.ToInt32(Parent1);
         piParent = Parent;
     }
     if (Parent > 1)
     {
         Parent = 0;
     }
     //获取是否抽烟1是2否3未知
     string Smoke1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1005_04", 1);
     if (Smoke1 != "" && Smoke1 != "0" && Smoke1 != null)
     {
         Smoke = Convert.ToInt32(Smoke1);
         piSmoke = Smoke;
     }
     if (Smoke > 1)
     {
         Smoke = 0;
     }
     //获取是否中风
     string Stroke1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1001_07", 1);
     if (Stroke1 != "" && Stroke1 != "0" && Stroke1 != null)
     {
         Stroke = Convert.ToInt32(Stroke1);
         piStroke = Stroke;
     }
     if (Stroke > 1)
     {
         Stroke = 0;
     }
     //获取是否左心室肥大
     string Lvh1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1001_09", 1);
     if (Lvh1 != "" && Lvh1 != "0" && Lvh1 != null)
     {
         Lvh = Convert.ToInt32(Lvh1);
         piLvh = Lvh;
     }
     if (Lvh > 1)
     {
         Lvh = 0;
     }
     //获取是否糖尿病
     string Diabetes1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1002_02", 1);
     if (Diabetes1 != "" && Diabetes1 != "0" && Diabetes1 != null)
     {
         Diabetes = Convert.ToInt32(Diabetes1);
         piDiabetes = Diabetes;
     }
     if (Diabetes > 1)
     {
         Diabetes = 0;
     }
     //高血压是否在治疗(是否接受高血压治疗)
     string Treat1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1003_02", 1);
     if (Treat1 != "" && Treat1 != "0" && Treat1 != null)
     {
         Treat = Convert.ToInt32(Treat1);
         piTreat = Treat;
     }
     if (Treat > 1)
     {
         Treat = 0;
     }
     //是否有心脏事件(心血管疾病,心脏骤停)
     string Heartattack1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1001_04", 1);
     if (Heartattack1 != "" && Heartattack1 != "0" && Heartattack1 != null)
     {
         Heartattack = Convert.ToInt32(Heartattack1);
         piHeartattack = Heartattack;
     }
     if (Heartattack > 1)
     {
         Heartattack = 0;
     }
     //是否有房颤
     string Af1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1001_05", 1);
     if (Af1 != "" && Af1 != "0" && Af1 != null)
     {
         Af = Convert.ToInt32(Af1);
         piAf = Af;
     }
     if (Af > 1)
     {
         Af = 0;
     }
     //是否有冠心病(心肌梗塞)
     string Chd1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1001_02", 1);
     if (Chd1 != "" && Chd1 != "0" && Chd1 != null)
     {
         Chd = Convert.ToInt32(Chd1);
         piChd = Chd;
     }
     if (Chd > 1)
     {
         Chd = 0;
     }
     //是否有心脏瓣膜病
     string Valve1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1001_06", 1);
     if (Valve1 != "" && Valve1 != "0" && Valve1 != null)
     {
         Valve = Convert.ToInt32(Valve1);
         piValve = Valve;
     }
     if (Valve > 1)
     {
         Valve = 0;
     }
     //总胆固醇浓度
     string Tcho1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_09", 1);
     if (Tcho1 != "" && Tcho1 != "0" && Tcho1 != null)
     {
         Tcho = Convert.ToDouble(Tcho1);
     }
     //肌酐浓度
     string Creatinine1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_08", 1);
     if (Creatinine1 != "" && Creatinine1 != "0" && Creatinine1 != null)
     {
         Creatinine = Convert.ToDouble(Creatinine1);
     }
     //高密度脂蛋白胆固醇
     string Hdlc1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_10", 1);
     if (Hdlc1 != "" && Hdlc1 != "0" && Hdlc1 != null)
     {
         Hdlc = Convert.ToDouble(Hdlc1);
     }
     //收缩压和舒张压
     string SBP1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_05", 1);
     if (SBP1 != "" && SBP1 != "0" && SBP1 != null)
     {
         SBP = Convert.ToInt32(SBP1);
     }
     string DBP1 = new ModuleInfoMethod().PsBasicInfoDetailGetValue(pclsCache, UserId, "M1", "M1006_06", 1);
     if (DBP1 != "" && DBP1 != "0" && DBP1 != null)
     {
         DBP = Convert.ToInt32(DBP1);
     }
     //高血压风险,除血压外的风险已经计算好放在Hyperother中,界面上取了血压之后,加上血压的风险即可。
     double Hyperother = -0.15641 * Age - 0.20293 * Gender - 0.19073 * Smoke - 0.16612 * Parent - 0.03388 * BMI;
     //HarvardRiskInfactor这个变量存的是Harvard风险评估计算公式中的风险因数,界面上需要做的是加上收缩压的风险因数,然后代入公式计算。
     int HarvardRiskInfactor = 0;
     if (Gender == 1)
     {
         if (Age <= 39)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 19;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 0;
             }
         }
         else if (Age <= 44 && Age >= 40)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 7;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 4;
             }
         }
         else if (Age <= 49 && Age >= 45)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 7;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 7;
             }
         }
         else if (Age <= 54 && Age >= 50)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 11;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 6;
             }
         }
         else if (Age <= 59 && Age >= 55)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 14;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 6;
             }
         }
         else if (Age <= 64 && Age >= 60)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 18;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 5;
             }
         }
         else if (Age <= 69 && Age >= 65)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 22;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 4;
             }
         }
         else
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 25;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 4;
             }
         }
         //年龄和抽烟的风险值加成
         if (Tcho < 5)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 0;
         }
         else if (Tcho >= 5.0 && Tcho <= 5.9)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 2;
         }
         else if (Tcho >= 6.0 && Tcho <= 6.9)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 4;
         }
         else if (Tcho >= 7.0 && Tcho <= 7.9)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 5;
         }
         else if (Tcho >= 8.0 && Tcho <= 8.9)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 7;
         }
         else
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 9;
         }
         //总胆固醇浓度风险值加成
         if (Height < 145)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 6;
         }
         else if (Height >= 145 && Height <= 154)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 4;
         }
         else if (Height >= 155 && Height <= 164)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 3;
         }
         else if (Height >= 165 && Height <= 174)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 2;
         }
         else
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 0;
         }
         //身高风险值加成
         if (Creatinine < 50)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 0;
         }
         else if (Creatinine >= 50 && Creatinine <= 69)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 1;
         }
         else if (Creatinine >= 70 && Creatinine <= 89)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 2;
         }
         else if (Creatinine >= 90 && Creatinine <= 109)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 3;
         }
         else
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 4;
         }
         //肌酐浓度风险值加成
         if (Chd == 1)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 8;
         }
         //心肌梗塞(冠心病)风险值加成
         if (Stroke == 1)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 8;
         }
         //中风风险值加成
         if (Lvh == 1)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 3;
         }
         //左室高血压(左心室肥大)风险值加成
         if (Diabetes == 1)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 2;
         }
         //糖尿病风险值加成
     }
     //以上是男性风险值
     else
     {
         if (Age <= 39)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 13;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 0;
             }
         }
         else if (Age <= 44 && Age >= 40)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 12;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 5;
             }
         }
         else if (Age <= 49 && Age >= 45)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 11;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 9;
             }
         }
         else if (Age <= 54 && Age >= 50)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 10;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 14;
             }
         }
         else if (Age <= 59 && Age >= 55)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 10;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 18;
             }
         }
         else if (Age <= 64 && Age >= 60)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 9;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 23;
             }
         }
         else if (Age <= 69 && Age >= 65)
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 9;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 27;
             }
         }
         else
         {
             if (Smoke == 1)
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 8;
             }
             else
             {
                 HarvardRiskInfactor = HarvardRiskInfactor + 32;
             }
         }
         //年龄和抽烟的风险值加成
         if (Tcho < 5)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 0;
         }
         else if (Tcho >= 5.0 && Tcho <= 5.9)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 0;
         }
         else if (Tcho >= 6.0 && Tcho <= 6.9)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 1;
         }
         else if (Tcho >= 7.0 && Tcho <= 7.9)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 1;
         }
         else if (Tcho >= 8.0 && Tcho <= 8.9)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 2;
         }
         else
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 2;
         }
         //总胆固醇浓度风险值加成
         if (Height < 145)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 6;
         }
         else if (Height >= 145 && Height <= 154)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 4;
         }
         else if (Height >= 155 && Height <= 164)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 3;
         }
         else if (Height >= 165 && Height <= 174)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 2;
         }
         else
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 0;
         }
         //身高风险值加成
         if (Creatinine < 50)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 0;
         }
         else if (Creatinine >= 50 && Creatinine <= 69)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 1;
         }
         else if (Creatinine >= 70 && Creatinine <= 89)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 2;
         }
         else if (Creatinine >= 90 && Creatinine <= 109)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 3;
         }
         else
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 4;
         }
         //肌酐浓度风险值加成
         if (Chd == 1)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 8;
         }
         //心肌梗塞(冠心病)风险值加成
         if (Stroke == 1)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 8;
         }
         //中风风险值加成
         if (Lvh == 1)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 3;
         }
         //左室高血压(左心室肥大)风险值加成
         if (Diabetes == 1)
         {
             HarvardRiskInfactor = HarvardRiskInfactor + 9;
         }
         //糖尿病风险值加成
     }
     //以上是女性风险值
     //FraminghamRiskInfactor这个变量存的是Framingham风险评估计算公式中的风险因数,界面上需要做的是加上收缩压的风险因数,然后代入公式计算。
     //这个Framingham模型也是需要收缩压值的,分为接受过治疗的血压和未接受过治疗的血压,模型分为男女进行计算,因为不同性别公式不同
     double FraminghamRiskInfactor = 0.0;
     if (Gender == 1) //男性
     {
         FraminghamRiskInfactor = FraminghamRiskInfactor + Math.Log(Age) * 3.06117;//性别
         FraminghamRiskInfactor = FraminghamRiskInfactor + Math.Log(Tcho) * 1.12370;//总胆固醇
         FraminghamRiskInfactor = FraminghamRiskInfactor + Math.Log(Hdlc) * (-0.93263);//高密度脂蛋白胆固醇
         if (Smoke == 1)
         {
             FraminghamRiskInfactor = FraminghamRiskInfactor + 0.65451;//抽烟
         }
         if (Diabetes == 1)
         {
             FraminghamRiskInfactor = FraminghamRiskInfactor + 0.57367;//抽烟
         }
     }
     else //女性
     {
         FraminghamRiskInfactor = FraminghamRiskInfactor + Math.Log(Age) * 2.3288;//性别
         FraminghamRiskInfactor = FraminghamRiskInfactor + Math.Log(Tcho) * 1.20904;//总胆固醇
         FraminghamRiskInfactor = FraminghamRiskInfactor + Math.Log(Hdlc) * (-0.70833);//高密度脂蛋白胆固醇
         if (Smoke == 1)
         {
             FraminghamRiskInfactor = FraminghamRiskInfactor + 0.52873;//抽烟
         }
         if (Diabetes == 1)
         {
             FraminghamRiskInfactor = FraminghamRiskInfactor + 0.69154;//抽烟
         }
     }
     //StrokeRiskInfactor这个变量存的是中风风险评估计算公式中的风险因数,界面上需要做的是加上收缩压的风险因数,然后计算。
     int StrokeRiskInfactor = 0;
     if (Gender == 1) //男性
     {
         if (Age <= 56)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 0;
         }
         else if (Age >= 57 && Age <= 59)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 1;
         }
         else if (Age >= 60 && Age <= 62)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 2;
         }
         else if (Age >= 63 && Age <= 65)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 3;
         }
         else if (Age >= 66 && Age <= 68)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 4;
         }
         else if (Age >= 69 && Age <= 72)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 5;
         }
         else if (Age >= 73 && Age <= 75)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 6;
         }
         else if (Age >= 76 && Age <= 78)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 7;
         }
         else if (Age >= 79 && Age <= 81)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 8;
         }
         else if (Age >= 82 && Age <= 84)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 9;
         }
         else
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 10;
         }
         if (Diabetes == 1)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 2;
         }
         //糖尿病风险值加成
         if (Smoke == 1)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 3;
         }
         //吸烟风险值加成
         if (Heartattack == 1)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 4;
         }
         //心血管疾病史(心脏事件)风险值加成
         if (Af == 1)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 4;
         }
         //房颤风险值加成
         if (Lvh == 1)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 5;
         }
     }
     else //女性
     {
         if (Age <= 56)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 0;
         }
         else if (Age >= 57 && Age <= 59)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 1;
         }
         else if (Age >= 60 && Age <= 62)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 2;
         }
         else if (Age >= 63 && Age <= 64)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 3;
         }
         else if (Age >= 65 && Age <= 67)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 4;
         }
         else if (Age >= 68 && Age <= 70)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 5;
         }
         else if (Age >= 71 && Age <= 73)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 6;
         }
         else if (Age >= 74 && Age <= 76)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 7;
         }
         else if (Age >= 77 && Age <= 78)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 8;
         }
         else if (Age >= 79 && Age <= 81)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 9;
         }
         else
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 10;
         }
         if (Diabetes == 1)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 3;
         }
         //糖尿病风险值加成
         if (Smoke == 1)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 3;
         }
         //吸烟风险值加成
         if (Heartattack == 1)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 2;
         }
         //心血管疾病史(心脏事件)风险值加成
         if (Af == 1)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 6;
         }
         //房颤风险值加成
         if (Lvh == 1)
         {
             StrokeRiskInfactor = StrokeRiskInfactor + 4;
         }
     }
     //HeartFailureRiskInfactor这个变量存的是心衰风险评估计算公式中的风险因数,界面上需要做的是加上收缩压的风险因数,然后计算。
     int HeartFailureRiskInfactor = 0;
     if (Gender == 1) //男性
     {
         if (Age <= 49)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 0;
         }
         else if (Age >= 50 && Age <= 54)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 1;
         }
         else if (Age >= 55 && Age <= 59)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 2;
         }
         else if (Age >= 60 && Age <= 64)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 3;
         }
         else if (Age >= 65 && Age <= 69)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 4;
         }
         else if (Age >= 70 && Age <= 74)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 5;
         }
         else if (Age >= 75 && Age <= 79)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 6;
         }
         else if (Age >= 80 && Age <= 84)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 7;
         }
         else if (Age >= 85 && Age <= 89)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 8;
         }
         else
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 9;
         }
         if (Heartrate <= 54)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 0;
         }
         else if (Heartrate >= 55 && Heartrate <= 64)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 1;
         }
         else if (Heartrate >= 65 && Heartrate <= 79)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 2;
         }
         else if (Heartrate >= 80 && Heartrate <= 89)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 3;
         }
         else if (Heartrate >= 90 && Heartrate <= 104)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 4;
         }
         else
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 5;
         }
         //心率风险值加成
         if (Lvh == 1)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 4;
         }
         //左心室肥大(左室高血压)风险值加成
         if (Chd == 1)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 8;
         }
         //冠心病风险值加成
         if (Valve == 1)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 5;
         }
         //瓣膜疾病风险值加成
         if (Smoke == 1)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 1;
         }
         //糖尿病风险值加成
     }
     else //女性
     {
         if (Age <= 49)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 0;
         }
         else if (Age >= 50 && Age <= 54)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 1;
         }
         else if (Age >= 55 && Age <= 59)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 2;
         }
         else if (Age >= 60 && Age <= 64)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 3;
         }
         else if (Age >= 65 && Age <= 69)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 4;
         }
         else if (Age >= 70 && Age <= 74)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 5;
         }
         else if (Age >= 75 && Age <= 79)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 6;
         }
         else if (Age >= 80 && Age <= 84)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 7;
         }
         else if (Age >= 85 && Age <= 89)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 8;
         }
         else
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 9;
         }
         //年龄的风险加权值
         if (Heartrate < 60)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 0;
         }
         else if (Heartrate >= 60 && Heartrate <= 79)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 1;
         }
         else if (Heartrate >= 80 && Heartrate <= 104)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 2;
         }
         else
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 3;
         }
         //心率风险值加成
         if (Lvh == 1)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 5;
         }
         //左心室肥大(左室高血压)风险值加成
         if (Chd == 1)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 6;
         }
         //冠心病风险值加成
         if (Valve == 1)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 6;
             if (Smoke == 1)
             {
                 HeartFailureRiskInfactor = HeartFailureRiskInfactor + 2;
             }
         }
         else
         {
             if (Smoke == 1)
             {
                 HeartFailureRiskInfactor = HeartFailureRiskInfactor + 6;
             }
         }
         //瓣膜疾病和糖尿病风险值加成
         if (BMI < 21)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 0;
         }
         else if (BMI >= 21 && BMI <= 25)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 1;
         }
         else if (BMI > 25 && BMI <= 29)
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 2;
         }
         else
         {
             HeartFailureRiskInfactor = HeartFailureRiskInfactor + 3;
         }
     }
     //BMI风险值加成
     RiskInput Input = new RiskInput();
     Input.Age = Age;
     Input.Gender = Gender;
     Input.Height = Height;
     Input.Weight = Weight;
     Input.AbdominalGirth = AbdominalGirth;
     Input.BMI = BMI;
     Input.Heartrate = Heartrate;
     Input.Parent = Parent;
     Input.Smoke = Smoke;
     Input.Stroke = Stroke;
     Input.Lvh = Lvh;
     Input.Diabetes = Diabetes;
     Input.Treat = Treat;
     Input.Heartattack = Heartattack;
     Input.Af = Af;
     Input.Chd = Chd;
     Input.Valve = Valve;
     Input.Tcho = Tcho;
     Input.Creatinine = Creatinine;
     Input.Hdlc = Hdlc;
     Input.Hyperother = Hyperother;
     Input.HarvardRiskInfactor = HarvardRiskInfactor;
     Input.FraminghamRiskInfactor = FraminghamRiskInfactor;
     Input.StrokeRiskInfactor = StrokeRiskInfactor;
     Input.HeartFailureRiskInfactor = HeartFailureRiskInfactor;
     Input.SBP = SBP;
     Input.DBP = DBP;
     Input.piParent = piParent;
     Input.piSmoke = piSmoke;
     Input.piStroke = piStroke;
     Input.piLvh = piLvh;
     Input.piDiabetes = piDiabetes;
     Input.piTreat = piTreat;
     Input.piHeartattack = piHeartattack;
     Input.piAf = piAf;
     Input.piChd = piChd;
     Input.piValve = piValve;
     return Input;
 }