public DataSet GetNewFiveData(string user_id, string user_times)
        {
            string  sql = "select q_id,qr_result,input_time,user_times from tmo_questionnaire_result where user_id='" + user_id + "' and user_times<='" + user_times + "'  and q_id in ('0C1553EA1A274B56A211CCFC5F4A429E','ADF9331BADAB48BF9147611A9BBD1C79','C41F469521E849D8B6314833C6FA92B0','225368D504EB431CA2E597FAD50D2949','6A67F0E229964527AB541B5DD318E2C3','6E3658E76CE141CEB0264BA1ADEF9664','C1443DA657174BC696008614A6659A99','D2198A7F78CF4DEFA821C4F41893E415','D9115BD44B1344B88A45EF121EADCBA5','EBE1C353B35842189EF8F4041BE95CB6','CE8C9F888AD2447487EAA996BBA5A6BF','930C3F590420467497A2F744A385C0C9','47651815A248484FB2B569E6B6AD782E') order by input_time";
            DataSet ds  = MySQLHelper.Query(sql);

            if (ds != null && ds.Tables.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    string qrres = dr["qr_result"] == null ? "" : dr["qr_result"].ToString();
                    if (dr["q_id"].ToString() == "C41F469521E849D8B6314833C6FA92B0")
                    {
                        float[] fv = TmoShare.GetValueFromJson <float[]>(qrres, false);
                        if (fv != null && fv.Length > 0)
                        {
                            dr["qr_result"] = fv[0].ToString() + "/" + fv[1].ToString();
                        }
                        else
                        {
                            dr["qr_result"] = "";
                        }
                    }
                    else
                    {
                        dr["qr_result"] = TmoShare.GetValueFromJson <float>(qrres, false);
                    }
                }
            }
            return(ds);
        }
        public DataSet GetImetData(string user_id, string user_times)
        {
            string uptime = "0";

            if (user_times != "1")
            {
                uptime = (int.Parse(user_times) - 1).ToString();
            }
            string  sql = "select q_id,qr_result,input_time,user_times from tmo_questionnaire_result where user_id='" + user_id + "' and user_times<='" + user_times + "'  and user_times>='" + uptime + "'  and q_id in ('C1553EA1A274B56A211CCFC5F4A429E','ADF9331BADAB48BF9147611A9BBD1C79','C41F469521E849D8B6314833C6FA92B0','EBE1C353B35842189EF8F4041BE95CB6','CE8C9F888AD2447487EAA996BBA5A6BF','930C3F590420467497A2F744A385C0C9') order by input_time";
            DataSet ds  = MySQLHelper.Query(sql);

            if (ds != null && ds.Tables.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    string qrres = dr["qr_result"] == null ? "" : dr["qr_result"].ToString();
                    if (dr["q_id"].ToString() == "C41F469521E849D8B6314833C6FA92B0")
                    {
                        float[] fv = TmoShare.GetValueFromJson <float[]>(qrres);;
                        dr["qr_result"] = fv[0].ToString() + "/" + fv[1].ToString();
                    }
                    else
                    {
                        dr["qr_result"] = TmoShare.GetValueFromJson <float>(qrres);
                    }
                }
            }
            return(ds);
        }
Пример #3
0
        void SetDataFromJsonString()
        {
            Dictionary <string, object> listdata = new Dictionary <string, object>();

            if (!string.IsNullOrWhiteSpace(_jsonData))
            {
                listdata = TmoShare.GetValueFromJson <Dictionary <string, object> >(_jsonData);
            }

            if (listdata.ContainsKey("aclb_id"))
            {
                int.TryParse(listdata["aclb_id"].ToString(), out _aclb_id);
            }

            List <Control> list = TmoComm.GetChildrenControl(xtraTabControlMain, true);

            list.ForEach(x =>
            {
                if (x is RadioGroup)
                {
                    RadioGroup rg  = (RadioGroup)x;
                    rg.MouseClick += rg_MouseClick; //右键清楚选择
                }

                if (x.Tag != null)
                {
                    string key = x.Tag.ToString();
                    if (listdata.ContainsKey(key))
                    {
                        object value = listdata[key];
                        if (x is BaseEdit)
                        {
                            BaseEdit be = (BaseEdit)x;
                            //if (x is DateEdit)
                            //{
                            //    if (be.EditValue != null)
                            //        value = be.EditValue;
                            //    else
                            //        value = default(DateTime);
                            //}
                            //else
                            {
                                be.EditValue = value;
                            }
                        }
                        else if (x is CheckedListBoxControl)
                        {
                            CheckedListBoxControl chkControl = (CheckedListBoxControl)x;
                            SetCheckedListBoxChecked(chkControl, value.ToString());
                        }
                    }
                }
            });
        }
Пример #4
0
        protected override void OnFirstLoad()
        {
            string watingstr = _isfirst ? "文件存储中" : "文档加载中";

            this.ShowWaitingPanel(() =>
            {
                //_user = Tmo_CommonClient.Instance.GetUserinfo("130103199010228346");
                Dictionary <string, object> dicdata = TmoShare.GetValueFromJson <Dictionary <string, object> >(_content);
                _xReport = new XReportFirstPage(_user, dicdata);
                _xReport.CreateDocument();

                XReportActionPlan xrap = new XReportActionPlan(dicdata);
                xrap.CreateDocument();
                Page lastPage = _xReport.Pages.Last;
                _xReport.Pages.Remove(lastPage);
                _xReport.Pages.AddRange(xrap.Pages);
                _xReport.Pages.Add(lastPage);

                if (_isfirst)
                {
                    MemoryStream ms = new MemoryStream();
                    _xReport.PrintingSystem.ExportToPdf(ms);
                    SaveSucess = TmoServiceClient.InvokeServerMethodT <bool>(funCode.SaveActionPlan, _user.user_id, _user.user_times, _content, ms.ToArray());
                    _isfirst   = false;
                    if (SaveSucess)
                    {
                        DXMessageBox.Show("健康行动计划创建成功!", true);
                    }
                    else
                    {
                        DXMessageBox.ShowError("保存失败,请稍后再次尝试!");
                        return(null);
                    }
                }
                return(_xReport);
            },
                                  o =>
            {
                if (o == null)
                {
                    CloseForm(true); return;
                }

                documentViewer1.PrintingSystem  = _xReport.PrintingSystem;
                documentViewer1.ShowPageMargins = false;
                //documentViewer1.PrintingSystem.ExecCommand( PrintingSystemCommand.Customize);
                documentViewer1.PrintingSystem.ExecCommand(PrintingSystemCommand.DocumentMap, new object[] { true });
            }, watingstr);
        }
Пример #5
0
        private void InvokeDataReceived(int head, byte[] buffer, string strdata = null)
        {
            if (head == 200)    //用户登录
            {
                strdata = ParserString(buffer);

                _loginReurnDoc = TmoShare.GetValueFromJson <DocInfo>(strdata);
                _loginResetEvent.Set();
            }
            else
            {
                if (DataReceived != null)
                {
                    DataReceived(null, head, buffer, strdata);
                }
            }
        }
Пример #6
0
        public CheckBoxGroup(string checkboxJsonStr, string valueJsonStr)
        {
            InitializeComponent();

            if (string.IsNullOrWhiteSpace(checkboxJsonStr))
            {
                return;
            }
            List <T> value = null;

            if (!string.IsNullOrWhiteSpace(valueJsonStr))
            {
                value = TmoShare.GetValueFromJson <List <T> >(valueJsonStr);
            }
            Dictionary <string, T> dic = JsonConvert.DeserializeObject <Dictionary <string, T> >(checkboxJsonStr);

            foreach (var item in dic)
            {
                CheckBox checkBox = new CheckBox();
                checkBox.AutoSize = true;
                checkBox.Text     = item.Key;
                checkBox.Tag      = item.Value;
                if (value != null && value.Contains(item.Value))
                {
                    checkBox.Checked = true;
                }
                else
                {
                    checkBox.Checked = false;
                }
                checkBox.CheckedChanged += (sender, args) =>
                {
                    if (SelectedChanged != null)
                    {
                        SelectedChanged(sender, args);
                    }
                };
                flowLayoutPanel1.Controls.Add(checkBox);
            }
        }
Пример #7
0
        public void RefData(string userId, string user_times, string quesIDs)
        {
            string uptimes = "0";

            if (user_times != "1")
            {
                uptimes = (int.Parse(user_times) - 1).ToString();
            }
            string    strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.getScreenData, new object[] { userId, user_times, quesIDs });
            DataTable dt     = TmoShare.getDataTableFromXML(strmlx);
            string    upxml  = TmoServiceClient.InvokeServerMethodT <string>(funCode.getScreenData, new object[] { userId, uptimes, quesIDs });
            DataTable updtdd = TmoShare.getDataTableFromXML(upxml);

            if (TmoShare.DataTableIsNotEmpty(dt))
            {
                foreach (DataRow row in dt.Rows)
                {
                    string p_id = row["q_id"].ToString();
                    if (p_id == "D9115BD44B1344B88A45EF121EADCBA5")
                    {
                    }

                    #region 指标结果

                    if (p_id == "EBE1C353B35842189EF8F4041BE95CB6")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0)
                        {
                            continue;
                        }
                        tizhong.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                    if (p_id == "D9115BD44B1344B88A45EF121EADCBA5")
                    {
                        float val = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (val == 0)
                        {
                            continue;
                        }
                        if (val > 24)
                        {
                            fpd.Text = "肥胖";
                        }
                        bmiValue.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                    if (p_id == "CE8C9F888AD2447487EAA996BBA5A6BF")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0)
                        {
                            continue;
                        }
                        yaowei.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                    if (p_id == "ADF9331BADAB48BF9147611A9BBD1C79")
                    {
                        float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (vald > 5.6 || vald < 3.9)
                        {
                            kong.ForeColor = Color.Red;
                        }
                        kong.Text = vald.ToString();
                    }

                    if (p_id == "0C1553EA1A274B56A211CCFC5F4A429E")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0)
                        {
                            continue;
                        }
                        float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (vald > 7.8 || vald < 4.4)
                        {
                            can.ForeColor = Color.Red;
                        }
                        can.Text = vald.ToString();
                    }

                    if (p_id == "C41F469521E849D8B6314833C6FA92B0")
                    {
                        string[] valds = TmoShare.GetValueFromJson <string[]>(row["qr_result"].ToString());
                        if (valds != null && valds.Length > 0)
                        {
                            if (!string.IsNullOrEmpty(valds[0]) && !string.IsNullOrEmpty(valds[1]))
                            {
                                float v1 = float.Parse(valds[0]);
                                float v2 = float.Parse(valds[1]);
                                if (v1 > 140 || v1 < 90 || v2 < 60 || v2 > 90)
                                {
                                    xueya.ForeColor = Color.Red;
                                }
                                xueya.Text = v1 + "/" + v2;
                            }
                        }
                    }
                    if (p_id == "6E3658E76CE141CEB0264BA1ADEF9664")
                    {
                        float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald > 5.2 || vald < 3)
                        {
                            zongdangu.ForeColor = Color.Red;
                        }
                        zongdangu.Text = vald.ToString();
                    }
                    if (p_id == "225368D504EB431CA2E597FAD50D2949")
                    {
                        float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald > 1.7 || vald < 0)
                        {
                            ganyou.ForeColor = Color.Red;
                        }
                        ganyou.Text = vald.ToString();
                    }

                    if (p_id == "6A67F0E229964527AB541B5DD318E2C3")
                    {
                        float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald > 3.12 || vald < 0)
                        {
                            dimi.ForeColor = Color.Red;
                        }
                        dimi.Text = vald.ToString();
                    }
                    if (p_id == "D2198A7F78CF4DEFA821C4F41893E415")
                    {
                        float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald > 0.2 || vald < 0.7)
                        {
                            xrTableCell72.ForeColor = Color.Red;
                        }
                        xrTableCell72.Text = vald.ToString();
                    }//805E2FAC0F3B442DBBBFAFB4BF61F427
                    if (p_id == "805E2FAC0F3B442DBBBFAFB4BF61F427")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString(), false) == 0)
                        {
                            continue;
                        }
                        niaodan.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                    if (p_id == "4CD308E584744A36BC499CECCADAEB18")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString(), false) == 0)
                        {
                            continue;
                        }
                        niaobai.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                    if (p_id == "6501E7A0165648A6BD9409430028ADEB")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString(), false) == 0)
                        {
                            continue;
                        }
                        tongxing.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                    if (p_id == "C1443DA657174BC696008614A6659A99")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString(), false) == 0)
                        {
                            continue;
                        }
                        xuehong.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                    #endregion
                    #region 个人疾病史
                    if (p_id == "02390D277242464192B05F08D03D298B")
                    {
                        bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString());
                        if (val)
                        {
                            xrTableCell138.Text      = "有";//高血压
                            xrTableCell138.ForeColor = Color.Red;
                            gxy.Text = "已患";
                        }
                    }
                    if (p_id == "0F58D8725EB5467E91231F0742FF4271")
                    {
                        bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString());
                        if (val)
                        {
                            shenjing.Text = "已患";//糖尿病神经病变
                        }
                    }
                    if (p_id == "9407E0C29A914D9795B203968A8050EB")
                    {
                        bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString());
                        if (val)
                        {
                            tnb.Text                 = "已患";//糖尿时间
                            xrTableCell126.Text      = "有";
                            xrTableCell126.ForeColor = Color.Red;
                        }
                    }
                    if (p_id == "16D3E509B9C0400F97F7D88EB91C8247")
                    {
                        DateTime val        = TmoShare.GetValueFromJson <DateTime>(row["qr_result"].ToString());
                        var      dtimeValue = val.ToString("yyyy-MM-dd");
                        if (dtimeValue != "0001-01-01" && dtimeValue != "9999-12-31")
                        {
                            tnb.Text                 = "已患";//糖尿时间
                            xrTableCell126.Text      = "有";
                            xrTableCell126.ForeColor = Color.Red;
                        }
                    }
                    if (p_id == "1E39A6F3231E47C7994FCD380F5A6FC6")
                    {
                        bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString());
                        if (val)
                        {
                            zb.Text = "已患";//糖尿病足病
                        }
                    }
                    if (p_id == "3289721340EE4EA4BC3EB82366703B75")
                    {
                        bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString());
                        if (val)
                        {
                            xrTableCell136.Text      = "有";
                            xrTableCell136.ForeColor = Color.Red;
                            xz.Text = "已患";//血脂异常
                        }
                    }
                    if (p_id == "4E89929897B3449384BAB2DC1B886BE1")
                    {
                        bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString());
                        if (val)
                        {
                            yb.Text = "已患";//和病眼病
                        }
                    }
                    if (p_id == "C9541C75D3EE43D9A94124605E4FE70B")
                    {
                        bool val = TmoShare.GetValueFromJson <bool>(row["qr_result"].ToString());
                        if (val)
                        {
                            shenbing.Text = "已患";//肾病
                        }
                    }
                    if (p_id == "A44EF95BEF084F919FB78FC614E2C58E")
                    {
                        int[] vals = TmoShare.GetValueFromJson <int[]>(row["qr_result"].ToString());
                        if (vals != null && vals.Length > 0)
                        {
                            if (iscontext(vals, 226))
                            {
                                xrTableCell132.Text      = "有";
                                xrTableCell132.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 227))
                            {
                                xrTableCell134.Text      = "有";
                                xrTableCell134.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 228))
                            {
                                xrTableCell144.Text      = "有";
                                xrTableCell144.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 229))
                            {
                                xrTableCell30.Text      = "有";
                                xrTableCell30.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 225))
                            {
                                xrTableCell146.Text      = "有";
                                xrTableCell146.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 214))
                            {
                                xrTableCell148.Text      = "有";
                                xrTableCell148.ForeColor = Color.Red;
                            }
                        }
                    }
                    if (p_id == "08EAA9700B0440C2BB8957D3722F9E87")//父亲
                    {
                        int[] vals = TmoShare.GetValueFromJson <int[]>(row["qr_result"].ToString());
                        if (vals != null && vals.Length > 0)
                        {
                            if (iscontext(vals, 212))
                            {
                                fugao.Text      = "有";
                                fugao.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 208))
                            {
                                futang.Text      = "有";
                                futang.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 207))
                            {
                                fuxuezhi.Text      = "有";
                                fuxuezhi.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 225))
                            {
                                fujia.Text      = "有";
                                fujia.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 214))
                            {
                                guanxin.Text      = "有";
                                guanxin.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 226))
                            {
                                naoguanxin.Text      = "有";
                                naoguanxin.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 227))
                            {
                                fuzhongliu.Text      = "有";
                                fuzhongliu.ForeColor = Color.Red;
                            }
                        }
                    }
                    if (p_id == "65D243DFF6654CD3BC65900E8467DDA9")//母亲
                    {
                        int[] vals = TmoShare.GetValueFromJson <int[]>(row["qr_result"].ToString());
                        if (vals != null && vals.Length > 0)
                        {
                            if (iscontext(vals, 212))
                            {
                                mugao.Text      = "有";
                                mugao.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 208))
                            {
                                mutang.Text      = "有";
                                mutang.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 207))
                            {
                                muxuezhi.Text      = "有";
                                muxuezhi.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 225))
                            {
                                mujia.Text      = "有";
                                mujia.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 214))
                            {
                                muguanxin.Text      = "有";
                                muguanxin.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 226))
                            {
                                muxinnao.Text      = "有";
                                muxinnao.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 227))
                            {
                                muzhongliu.Text      = "有";
                                muzhongliu.ForeColor = Color.Red;
                            }
                        }
                    }
                    if (p_id == "F88D1C04B0F64D6B8D59CDB821AEBB4B")//兄弟姐妹
                    {
                        int[] vals = TmoShare.GetValueFromJson <int[]>(row["qr_result"].ToString());
                        if (vals != null && vals.Length > 0)
                        {
                            if (iscontext(vals, 212))
                            {
                                xmgao.Text      = "有";
                                xmgao.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 208))
                            {
                                xmtang.Text      = "有";
                                xmtang.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 207))
                            {
                                xmxuezhi.Text      = "有";
                                xmxuezhi.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 225))
                            {
                                xmjia.Text      = "有";
                                xmjia.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 214))
                            {
                                xmgaunxin.Text      = "有";
                                xmgaunxin.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 226))
                            {
                                xmxinao.Text      = "有";
                                xmxinao.ForeColor = Color.Red;
                            }
                            if (iscontext(vals, 227))
                            {
                                xmzhongliu.Text      = "有";
                                xmzhongliu.ForeColor = Color.Red;
                            }
                        }
                    }
                    #endregion
                }
            }



            if (TmoShare.DataTableIsNotEmpty(updtdd))
            {
                #region 判断上次指标结果
                foreach (DataRow row in updtdd.Rows)
                {
                    string p_id = row["q_id"].ToString();



                    if (p_id == "EBE1C353B35842189EF8F4041BE95CB6")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0)
                        {
                            continue;
                        }
                        tizhongUp.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                    if (p_id == "D9115BD44B1344B88A45EF121EADCBA5")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0)
                        {
                            continue;
                        }
                        bmiValueUp.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                    if (p_id == "CE8C9F888AD2447487EAA996BBA5A6BF")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0)
                        {
                            continue;
                        }
                        yaoweiUp.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                    if (p_id == "ADF9331BADAB48BF9147611A9BBD1C79")
                    {
                        float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald > 5.6 || vald < 3.9)
                        {
                            kongup.ForeColor = Color.Red;
                        }
                        kongup.Text = vald.ToString();
                    }
                    if (p_id == "0C1553EA1A274B56A211CCFC5F4A429E")
                    {
                        float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald > 7.8 || vald < 4.4)
                        {
                            canUP.ForeColor = Color.Red;
                        }
                        canUP.Text = vald.ToString();
                    }

                    if (p_id == "C41F469521E849D8B6314833C6FA92B0")
                    {
                        string[] valds = TmoShare.GetValueFromJson <string[]>(row["qr_result"].ToString());

                        if (valds != null && valds.Length > 0)
                        {
                            if (!string.IsNullOrEmpty(valds[0]) && !string.IsNullOrEmpty(valds[1]))
                            {
                                float v1 = float.Parse(valds[0]);
                                float v2 = float.Parse(valds[1]);
                                if (v1 > 140 || v1 < 90 || v2 < 60 || v2 > 90)
                                {
                                    xueyaUp.ForeColor = Color.Red;
                                }
                                xueyaUp.Text = v1 + "/" + v2;
                            }
                        }
                    }
                    if (p_id == "6E3658E76CE141CEB0264BA1ADEF9664")
                    {
                        float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald > 5.2 || vald < 3)
                        {
                            zongdanguUp.ForeColor = Color.Red;
                        }
                        zongdanguUp.Text = vald.ToString();
                    }
                    if (p_id == "225368D504EB431CA2E597FAD50D2949")
                    {
                        float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald > 1.7 || vald < 0)
                        {
                            ganyouUP.ForeColor = Color.Red;
                        }
                        ganyouUP.Text = vald.ToString();
                    }

                    if (p_id == "6A67F0E229964527AB541B5DD318E2C3")
                    {
                        float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald > 3.12 || vald < 0)
                        {
                            dimiUP.ForeColor = Color.Red;
                        }
                        dimiUP.Text = vald.ToString();
                    }
                    if (p_id == "D2198A7F78CF4DEFA821C4F41893E415")
                    {
                        float vald = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald == 0)
                        {
                            continue;
                        }
                        if (vald > 0.2 || vald < 0.7)
                        {
                            gaomiUp.ForeColor = Color.Red;
                        }
                        gaomiUp.Text = vald.ToString();
                    }
                    if (p_id == "805E2FAC0F3B442DBBBFAFB4BF61F427")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0)
                        {
                            continue;
                        }
                        nianodanUP.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                    if (p_id == "4CD308E584744A36BC499CECCADAEB18")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0)
                        {
                            continue;
                        }
                        niaobaiUP.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                    if (p_id == "6501E7A0165648A6BD9409430028ADEB")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0)
                        {
                            continue;
                        }
                        tongxingUP.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                    if (p_id == "C1443DA657174BC696008614A6659A99")
                    {
                        if (TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()) == 0)
                        {
                            continue;
                        }
                        xuehongUP.Text = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString()).ToString();
                    }
                }
                #endregion
            }
        }
Пример #8
0
        public bool SaveActionPlan(string userid, int user_times, string content, byte[] pdfbytes)
        {
            if (string.IsNullOrWhiteSpace(userid) || string.IsNullOrWhiteSpace(content))
            {
                return(false);
            }

            Dictionary <string, object> dicContent = TmoShare.GetValueFromJson <Dictionary <string, object> >(content);
            DateTime apstartdate = DateTime.MinValue;
            DateTime apenddate   = DateTime.MinValue;

            if (dicContent.ContainsKey("0_3"))
            {
                apstartdate = (DateTime)dicContent["0_3"];
            }
            if (dicContent.ContainsKey("0_4"))
            {
                apenddate = (DateTime)dicContent["0_4"];
            }

            Dictionary <string, string> dicData = new Dictionary <string, string>();

            dicData.Add("userid", userid);
            dicData.Add("usertimes", user_times.ToString());

            bool update = MySQLHelper.Exists("tmo_actionplan", dicData);

            if (apstartdate != DateTime.MinValue)
            {
                dicData.Add("apstartdate", apstartdate.ToFormatDateStr());
            }
            if (apenddate != DateTime.MinValue)
            {
                dicData.Add("apenddate", apenddate.ToFormatDateStr());
            }
            if (dicContent.ContainsKey("aclb_id"))
            {
                dicData.Add("aplib", dicContent["aclb_id"].ToString());
            }

            string apid = string.Empty;

            if (!update)
            {
                apid = TmoShare.GetGuidString();
                dicData.Add("apid", apid);
            }
            else
            {
                apid =
                    MySQLHelper.GetSingle("select apid from tmo_actionplan where userid='" + userid + "' and usertimes=" +
                                          user_times).ToString();
            }

            dicData.Add("content", content);

            if (pdfbytes != null)
            {
                string acpath  = ConfigHelper.GetConfigString("acPath");
                string pdfpath = Path.Combine(Environment.CurrentDirectory, userid + "_" + user_times + ".pdf");
                if (!string.IsNullOrWhiteSpace(acpath))
                {
                    pdfpath = Path.Combine(acpath, userid + "_" + user_times + ".pdf");
                }
                try
                {
                    if (File.Exists(pdfpath))
                    {
                        File.Delete(pdfpath);
                    }
                    File.WriteAllBytes(pdfpath, pdfbytes);
                }
                catch
                {
                    if (!Debugger.IsAttached)
                    {
                        return(false);
                    }
                }

                dicData.Add("pdfpath", pdfpath.Replace('\\', '|'));
            }

            bool suc = false;

            if (update)
            {
                suc = MySQLHelper.UpdateData("tmo_actionplan", "apid", apid, dicData);
            }
            else
            {
                suc = MySQLHelper.AddData("tmo_actionplan", dicData);
            }

            if (suc && pdfbytes != null)
            {
                string updateSql = "update tmo_userstatus set questionnare_status=4,actionplan_time='{2}' where user_id='{0}' and usertimes='{1}'";
                suc = MySQLHelper.ExecuteSql(string.Format(updateSql, userid, user_times, DateTime.Now)) > 0;
            }
            return(suc);
        }
Пример #9
0
        void ReceiveCallback(IAsyncResult ar)
        {
            StateObject state    = ar.AsyncState as StateObject;
            bool        disposed = false; //是否停止数据接收
            int         length   = 0;     //接收到的数据长度

            try
            {
                //接收 对应 客户端发来的消息
                length = state.Socket.EndReceive(ar);
                byte[] receiveBytes = new byte[length];
                Array.Copy(state.Buffer, 0, receiveBytes, 0, length);

                dataTime = DateTime.Now; //更新收到数据时间

                int    head    = -1;     //消息头码
                string strData = null;   //String类型消息
                if (length >= 4)
                {
                    //消息头码
                    head = BitConverter.ToInt32(new[] { receiveBytes[0], receiveBytes[1], receiveBytes[2], receiveBytes[3] }, 0);

                    if (head == 8888) //握手头码
                    {
                        trustedClient = true;
                        SendHandShake();
                        if (ShowAllData && DisplayMsg != null)
                        {
                            DisplayMsg(this, "收到握手包,客户端确认", DateTime.Now);
                        }
                    }
                    else if (head == 7777) //心跳信息
                    {
                        if (trustedClient)
                        {
                            connTime = DateTime.Now;
                            SendHeartBeat();
                        }
                        strData = ParserString(receiveBytes);
                        string[] infos = strData.Split(';');
                        ClientVer = infos[0];
                        DocInfo   = TmoShare.GetValueFromJson <DocInfo>(infos[1]);

                        if (ShowAllData && DisplayMsg != null)
                        {
                            DisplayMsg(this, "收到心跳包:" + strData, DateTime.Now);
                        }
                    }
                    else if (head == 9999) //请求断开连接
                    {
                        CloseConnection("客户端退出");
                    }
                    else if (head == 0 && trustedClient) //发送来的是消息
                    {
                        strData = ParserString(receiveBytes);
                        if (DisplayMsg != null)
                        {
                            DisplayMsg(this, "收到文字消息:" + strData, DateTime.Now);
                        }
                    }
                    else
                    {
                        if (ShowAllData && DisplayMsg != null)
                        {
                            DisplayMsg(this, "收到其他消息:长度" + receiveBytes.Length, DateTime.Now);
                        }
                    }
                }
                if (DataReceived != null)
                {
                    try
                    {
                        DataReceived(this, head, receiveBytes, strData);
                    }
                    catch { }
                }
            }
            catch (Exception ex)
            {
                if (ex is ObjectDisposedException)
                {
                    disposed = true;
                    return; //停止接收数据
                }
                LogHelper.WriteError(ex, "TCP");
                if (ex is SocketException)
                {
                    CloseConnection("客户端掉线 err:" + ex.Message, false);
                    return;
                }
                if (DisplayMsg != null)
                {
                    DisplayMsg(this, "客户端消息处理失败", DateTime.Now);
                }
            }
            finally
            {
                try
                {
                    if (!disposed && length != 0)
                    {
                        //继续接收消息
                        state.Socket.BeginReceive(state.Buffer, 0, state.Buffer.Length, SocketFlags.None, ReceiveCallback, state);
                    }
                    if (length == 0)
                    {
                        CloseConnection("客户端关闭连接", false);
                    }
                }
                catch
                {
                    CloseConnection("接收消息异常");
                }
            }
        }
Пример #10
0
        public DataSet GetMedicalResult(string user_id, string user_times)
        {
            //930C3F590420467497A2F744A385C0C9 身高
            //EBE1C353B35842189EF8F4041BE95CB6 体重
            //CE8C9F888AD2447487EAA996BBA5A6BF 腰围
            //C41F469521E849D8B6314833C6FA92B0 血压
            //225368D504EB431CA2E597FAD50D2949 甘油三酯
            //6A67F0E229964527AB541B5DD318E2C3 低密度
            //D2198A7F78CF4DEFA821C4F41893E415 高密度
            //6E3658E76CE141CEB0264BA1ADEF9664 总胆固醇
            //ADF9331BADAB48BF9147611A9BBD1C79 空腹血糖
            string  sql   = "select qr_result,q_id,input_time from tmo_questionnaire_result where user_id='" + user_id + "' and user_times=" + user_times + " and q_id in('930C3F590420467497A2F744A385C0C9','EBE1C353B35842189EF8F4041BE95CB6','CE8C9F888AD2447487EAA996BBA5A6BF','C41F469521E849D8B6314833C6FA92B0','225368D504EB431CA2E597FAD50D2949','6A67F0E229964527AB541B5DD318E2C3','D2198A7F78CF4DEFA821C4F41893E415','6E3658E76CE141CEB0264BA1ADEF9664','ADF9331BADAB48BF9147611A9BBD1C79')";
            DataSet dsNew = new DataSet();

            dsNew.DataSetName = "bb";
            DataTable dtNew = new DataTable();

            dtNew.Columns.Add("height", typeof(string));
            dtNew.Columns.Add("weight", typeof(string));
            dtNew.Columns.Add("waistline", typeof(string));
            dtNew.Columns.Add("sbp", typeof(string));
            dtNew.Columns.Add("dbp", typeof(string));
            dtNew.Columns.Add("hdl", typeof(string));
            dtNew.Columns.Add("ldl", typeof(string));
            dtNew.Columns.Add("chol", typeof(string));
            dtNew.Columns.Add("tg", typeof(string));
            dtNew.Columns.Add("fbg", typeof(string));
            DataSet ds   = MySQLHelper.Query(sql);
            DataRow drow = dtNew.NewRow();

            if (ds != null && ds.Tables.Count > 0)
            {
                DataTable dt = ds.Tables[0];
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        string qrres = dr["qr_result"] == null ? "" : dr["qr_result"].ToString();
                        if (dr["q_id"].ToString() == "C41F469521E849D8B6314833C6FA92B0")
                        {
                            float[] fv = TmoShare.GetValueFromJson <float[]>(qrres);
                            if (fv != null && fv.Length > 0)
                            {
                                drow["dbp"] = fv[0].ToString();
                                drow["sbp"] = fv[1].ToString();
                            }
                            else
                            {
                                drow["dbp"] = "";
                                drow["sbp"] = "";
                            }
                        }
                        else if (dr["q_id"].ToString() == "930C3F590420467497A2F744A385C0C9")
                        {
                            drow["height"] = TmoShare.GetValueFromJson <float>(qrres).ToString();
                        }
                        else if (dr["q_id"].ToString() == "EBE1C353B35842189EF8F4041BE95CB6")
                        {
                            drow["weight"] = TmoShare.GetValueFromJson <float>(qrres).ToString();
                        }
                        else if (dr["q_id"].ToString() == "CE8C9F888AD2447487EAA996BBA5A6BF")
                        {
                            drow["waistline"] = TmoShare.GetValueFromJson <float>(qrres).ToString();
                        }
                        else if (dr["q_id"].ToString() == "225368D504EB431CA2E597FAD50D2949")
                        {
                            drow["tg"] = TmoShare.GetValueFromJson <float>(qrres).ToString();
                        }
                        else if (dr["q_id"].ToString() == "6A67F0E229964527AB541B5DD318E2C3")
                        {
                            drow["ldl"] = TmoShare.GetValueFromJson <float>(qrres).ToString();
                        }
                        else if (dr["q_id"].ToString() == "D2198A7F78CF4DEFA821C4F41893E415")
                        {
                            drow["hdl"] = TmoShare.GetValueFromJson <float>(qrres).ToString();
                        }
                        else if (dr["q_id"].ToString() == "6E3658E76CE141CEB0264BA1ADEF9664")
                        {
                            drow["chol"] = TmoShare.GetValueFromJson <float>(qrres).ToString();
                        }
                        else if (dr["q_id"].ToString() == "ADF9331BADAB48BF9147611A9BBD1C79")
                        {
                            drow["fbg"] = TmoShare.GetValueFromJson <float>(qrres).ToString();
                        }
                    }
                    dtNew.Rows.Add(drow);
                    dsNew.Tables.Add(dtNew);
                    return(dsNew);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Пример #11
0
        public DataSet GetWebMedicalItems(string itemname, string user_id)
        {
            string q_id = itemname;

            if (itemname == "C41F469521E849D8B6314833C6FA92B0d" || itemname == "C41F469521E849D8B6314833C6FA92B0s")
            {
                q_id = "C41F469521E849D8B6314833C6FA92B0";
            }
            string  sql   = "SELECT  qr_result, input_time from tmo_questionnaire_result where user_id='" + user_id + "' and q_id='" + q_id + "' ORDER BY user_times asc LIMIT 0,10";
            DataSet dsNew = new DataSet();

            dsNew.DataSetName = "cc";
            DataTable dtNew = new DataTable();

            dtNew.Columns.Add("value", typeof(string));
            dtNew.Columns.Add("input_time", typeof(string));
            DataSet ds = MySQLHelper.Query(sql);

            if (ds != null && ds.Tables.Count > 0)
            {
                DataTable dt = ds.Tables[0];
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        DataRow drow  = dtNew.NewRow();
                        string  qrres = dr["qr_result"] == null ? "" : dr["qr_result"].ToString();
                        drow["input_time"] = dr["input_time"];
                        if (itemname == "C41F469521E849D8B6314833C6FA92B0d")
                        {
                            float[] fv = TmoShare.GetValueFromJson <float[]>(qrres);
                            if (fv != null && fv.Length > 0)
                            {
                                drow["value"] = fv[0].ToString();
                            }
                            else
                            {
                                drow["value"] = "0";
                            }
                        }
                        else if (itemname == "C41F469521E849D8B6314833C6FA92B0s")
                        {
                            float[] fv = TmoShare.GetValueFromJson <float[]>(qrres);
                            if (fv != null && fv.Length > 0)
                            {
                                drow["value"] = fv[1].ToString();
                            }
                            else
                            {
                                drow["value"] = "0";
                            }
                        }
                        else
                        {
                            drow["value"] = TmoShare.GetValueFromJson <float>(qrres).ToString();
                        }
                        dtNew.Rows.Add(drow);
                    }
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
            dsNew.Tables.Add(dtNew);

            return(dsNew);
        }
Пример #12
0
        public UCQuestion(tmo_questionnaire question)
        {
            InitializeComponent();
            BackColor = Color.Transparent;                //背景透明

            Question = question;                          //题目赋值
            //题目类型 1-判断题 2-选择题 3-多项选择题 4-填空题 5-问答题
            if (question.q_type == 2)                     //选择题
            {
                if (question.q_value_type.Equals("bool")) //bool类型
                {
                    _type = typeof(bool?);
                    var tmp = new UcRadioGroup <bool?>(question.q_value, question.QuestionnaireResult.qr_result);
                    tmp.SelectedChanged += (sender, args) => OnValueChanged();
                    _valueControls.Add(tmp);
                }
                else if (question.q_value_type.Equals("datetime")) //date类型
                {
                    _type = typeof(DateTime);
                    var tmp = new UcRadioGroup <DateTime>(question.q_value, question.QuestionnaireResult.qr_result);
                    tmp.SelectedChanged += (sender, args) => OnValueChanged();
                    _valueControls.Add(tmp);
                }
                else if (question.q_value_type.Equals("float")) //float类型
                {
                    _type = typeof(float);
                    var tmp = new UcRadioGroup <float>(question.q_value, question.QuestionnaireResult.qr_result);
                    tmp.SelectedChanged += (sender, args) => OnValueChanged();
                    _valueControls.Add(tmp);
                }
                else if (question.q_value_type.Equals("string")) //string类型
                {
                    _type = typeof(string);
                    var tmp = new UcRadioGroup <string>(question.q_value, question.QuestionnaireResult.qr_result);
                    tmp.SelectedChanged += (sender, args) => OnValueChanged();
                    _valueControls.Add(tmp);
                }
            }

            if (question.q_type == 3)                      //多选题
            {
                if (question.q_value_type.Equals("int[]")) //int类型
                {
                    _type = typeof(int[]);
                    var tmp = new CheckBoxGroup <int>(question.q_value, question.QuestionnaireResult.qr_result);
                    tmp.SelectedChanged += (sender, args) => OnValueChanged();
                    _valueControls.Add(tmp);
                }
            }

            if (question.q_type == 4)                      //填空题
            {
                if (question.q_value_type.Equals("float")) //float类型
                {
                    _type = typeof(float);
                }

                flowLayoutPanel1.FlowDirection = FlowDirection.LeftToRight;
                string[] values = TmoShare.GetValueFromJson <string[]>(Question.QuestionnaireResult.qr_result, false);
                if (values == null)
                {
                    values = new[] { TmoShare.GetValueFromJson <string>(question.QuestionnaireResult.qr_result) }
                }
                ;
                int    vindex = 0;
                string tmp    = question.q_name;
                int    index  = -1;
                do
                {
                    index = tmp.IndexOf('{');
                    string thisstr = index == -1 ? tmp : tmp.Substring(0, index);
                    if (_valueControls.Count == 0)
                    {
                        lblQuestion.Text = string.Format("{0:00}. {1}", question.q_no, thisstr);
                    }
                    else
                    {
                        Label lbl = new Label();
                        lbl.Margin   = new Padding(0, top, 0, 0);
                        lbl.Text     = thisstr;
                        lbl.Font     = lblQuestion.Font;
                        lbl.AutoSize = true;
                        flowLayoutPanel1.Controls.Add(lbl);
                    }

                    if (index != -1)
                    {
                        string laststr   = tmp.Remove(0, index + 1);
                        string lengthstr = new string(laststr.TakeWhile(x => TmoShare.IsNumeric(x)).ToArray());
                        laststr = laststr.Remove(0, lengthstr.Length + 1);

                        string value = null;
                        if (vindex < values.Length)
                        {
                            value = values[vindex];
                            vindex++;
                        }

                        TextBox txtBox = new TextBox();
                        txtBox.Width        = Convert.ToInt32(lengthstr);
                        txtBox.Text         = value;
                        txtBox.Margin       = new Padding(0);
                        txtBox.TextChanged += (sender, args) => OnValueChanged();
                        flowLayoutPanel1.Controls.Add(txtBox);
                        _valueControls.Add(txtBox);

                        tmp = laststr;
                    }
                } while (index != -1);
            }
            else
            {
                lblQuestion.Text = string.Format("{0}. {1}", question.q_no.ToString("00"), question.q_name);
                flowLayoutPanel1.Controls.AddRange(_valueControls.ToArray());
            }

            SetupLocation();
        }

        /// <summary>
        /// 设置控件位置
        /// </summary>
        void SetupLocation()
        {
            Width        = width; //设置整体宽度
            picIcon.Left = left;
            picIcon.Top  = top + 2;
            //flowLayoutPanel1.Left = left + picIcon.Width + 3;
            flowLayoutPanel1.Width = flowLayoutPanel2.Width = width - left - picIcon.Width - 3;
            lblQuestion.Margin     = lblTip.Margin = new Padding(0, top, 0, 0);

            //Size size = new Size(flowLayoutPanel1.Width, int.MaxValue);
            //lblQuestion.Size = TextRenderer.MeasureText(lblQuestion.Text, lblQuestion.Font, size);
            if (_valueControls.Any())
            {
                if (flowLayoutPanel1.FlowDirection == FlowDirection.LeftToRight)
                {
                    _valueControls.ForEach(x => x.Margin = new Padding(0, top, 0, 0));
                    Height = top + lblQuestion.Height + top;
                }
                else
                {
                    _valueControls.ForEach(x => x.Margin = new Padding(25, 3, 0, 0));
                    Height = top + lblQuestion.Height + 3 + _valueControls.First().Height + top;
                }
            }
            else
            {
                Height = top + lblQuestion.Height + top;
            }

            //flowLayoutPanel1.Height = Height;
        }
Пример #13
0
        public UcRadioGroup(string radioOptionsJsonStr, string valueJsonStr)
        {
            InitializeComponent();
            AutoSize = true;
            Dictionary <string, T> dic = null;
            object value = null;
            Dictionary <string, T> dicValue = null;

            if (!string.IsNullOrWhiteSpace(radioOptionsJsonStr))
            {
                dic = JsonConvert.DeserializeObject <Dictionary <string, T> >(radioOptionsJsonStr);
            }
            if (!string.IsNullOrWhiteSpace(valueJsonStr))
            {
                value = TmoShare.GetValueFromJson <T>(valueJsonStr);
            }

            if (dic != null)
            {
                foreach (var item in dic)
                {
                    RadioButton rb = new RadioButton();
                    rb.AutoSize = true;
                    rb.Text     = item.Key;
                    rb.Tag      = item.Value;
                    if (item.Value.Equals(value))   //有值得话默认选中
                    {
                        rb.Checked = true;
                    }
                    rb.CheckedChanged += (x, y) =>
                    {
                        if (SelectedChanged != null)
                        {
                            SelectedChanged(this, y);
                        }
                    };
                    flowLayoutPanel1.Controls.Add(rb);

                    if (typeof(T) == typeof(DateTime))                     //日期模式
                    {
                        if (item.Value.Equals(new DateTime(9999, 12, 31))) //选择日期
                        {
                            DateTimePicker timePicker = new DateTimePicker();
                            timePicker.CustomFormat  = "yyyy年MM月dd日";
                            timePicker.Format        = DateTimePickerFormat.Custom;
                            timePicker.Width         = 129;
                            timePicker.Margin        = new Padding(0, 2, 20, 0);
                            timePicker.ValueChanged += (x, y) => { rb.Tag = timePicker.Value; };
                            if (value != null && (DateTime)value != default(DateTime))
                            {
                                rb.Tag           = value;
                                rb.Checked       = true;
                                timePicker.Value = (DateTime)rb.Tag;
                            }
                            else
                            {
                                rb.Tag = timePicker.Value;
                            }
                            flowLayoutPanel1.Controls.Add(timePicker);
                        }
                    }
                }
            }
        }
Пример #14
0
        public void RefData(string userId, string user_times, string querId)
        {
            List <string> md5res    = new List <string>();
            string        zhibiaos  = "";
            float         ganyouUps = -100f;
            float         ganyous   = -100f;

            float zongUps = -100f;
            float zongs   = -100f;

            float diUps = -100f;
            float dis   = -100f;

            float gaoUps = -100f;
            float gaos   = -100f;

            float     tiUps     = -100f;
            float     tis       = -100f;
            float     gaozhiUps = -100f;
            float     gaozhis   = -100f;
            double    zongfen   = 0;
            string    yinsu     = "";
            string    resultxml = TmoLinkServer.TmoServiceClient.InvokeServerMethodT <string>(funCode.getFeiPang, new object[] { userId, user_times, querId });
            DataTable DsReslut  = TmoShare.getDataTableFromXML(resultxml);
            int       timeup    = 0;

            if (user_times == "1" || user_times == "0")
            {
            }
            else
            {
                timeup = Convert.ToInt32(user_times) - 1;
            }
            string    upxml    = TmoLinkServer.TmoServiceClient.InvokeServerMethodT <string>(funCode.getFeiPang, new object[] { userId, timeup, querId });
            DataTable upResult = TmoShare.getDataTableFromXML(upxml);

            #region  次和本次
            if (DsReslut != null)
            {
                foreach (DataRow row in DsReslut.Rows)
                {
                    if (!string.IsNullOrEmpty(row["q_resik"].ToString()))
                    {
                        string val = TmoCommon.MD5Helper.Md5Encrypt(row["q_resik"].ToString());
                        if (md5res.Contains(val))
                        {
                        }
                        else
                        {
                            yinsu = yinsu + row["q_resik"] + ",";
                            md5res.Add(val);
                        }
                    }
                    string q_id   = row["q_id"].ToString();
                    string fenshu = row["qr_score"].ToString();
                    zongfen = zongfen + Convert.ToDouble(row["qr_score"]);
                    if (q_id == "FC2D9933EAA14E8A89EC8E8AC61602D5")
                    {
                        if (fenshu == "20")
                        {
                            zhibiaos = zhibiaos + "甘油三酯、";
                        }
                        ganyous = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (ganyous == 0)
                        {
                            continue;
                        }
                        if (ganyous < 1.70)
                        {
                            ganyouguan.Text = "减少"; ganyoudong.Text = "减少"; gaunyougao.Text = "减少"; tanyoutang.Text = "减少";
                        }
                        else
                        {
                            ganyouguan.Text = "增加"; ganyoudong.Text = "增加"; gaunyougao.Text = "增加"; tanyoutang.Text = "增加";
                        }
                        ganyou.Text = ganyous.ToString();
                    }
                    if (q_id == "7543252298164AAF8BCD50A8FCECF80F")
                    {
                        if (fenshu == "20")
                        {
                            zhibiaos = zhibiaos + "总胆固醇、";
                        }
                        zongs = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (zongs == 0)
                        {
                            continue;
                        }
                        if (zongs < 5.17)
                        {
                            zongdangan.Text = "减少"; zongdandong.Text = "减少"; zongdangao.Text = "减少"; zongdantang.Text = "减少";
                        }
                        else
                        {
                            zongdangan.Text = "增加"; zongdandong.Text = "增加"; zongdangao.Text = "增加"; zongdantang.Text = "增加";
                        }
                        zong.Text = zongs.ToString();
                    }
                    if (q_id == "9F576888D01A4BCABDF3B61CEDE6948B")
                    {
                        if (fenshu == "20")
                        {
                            zhibiaos = zhibiaos + "低密度脂蛋白、";
                        }
                        dis = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (dis == 0)
                        {
                            continue;
                        }
                        if (dis < 3.37)
                        {
                            dimiguan.Text = "减少"; dimidong.Text = "减少"; dimigao.Text = "减少"; dimitang.Text = "减少";
                        }
                        else
                        {
                            dimiguan.Text = "增加"; dimidong.Text = "增加"; dimigao.Text = "增加"; dimitang.Text = "增加";
                        }
                        xrTableCell40.Text = dis.ToString();
                    }
                    if (q_id == "5E1D0A34001D4C02AB4FC7786139B208")
                    {
                        if (fenshu == "20")
                        {
                            zhibiaos = zhibiaos + "高密度脂蛋白、";
                        }
                        gaos = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (gaos == 0)
                        {
                            continue;
                        }
                        if (gaos >= 1.04)
                        {
                            gaomiguan.Text = "减少"; gaomidong.Text = "减少"; gaomigao.Text = "减少"; gaomitang.Text = "减少";
                        }
                        else
                        {
                            gaomiguan.Text = "增加"; gaomidong.Text = "增加"; gaomigao.Text = "增加"; gaomitang.Text = "增加";
                        }
                        gao.Text = gaos.ToString();
                    }
                    if (q_id == "751624508AA94D05864287B3CB6B723B")
                    {
                        tis       = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        zhid.Text = tis.ToString();
                    }
                    if (q_id == "7462E7B63F974594BADCAD5031FC05D2")
                    {
                        gaozhis = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (gaozhis == 0)
                        {
                            continue;
                        }
                        if (gaozhis == 2)
                        {
                            gaozhi.Text = "是";
                        }
                        else
                        {
                            gaozhi.Text = "否";
                        }
                    }
                }
            }
            if (upResult != null)
            {
                foreach (DataRow row in upResult.Rows)
                {
                    string q_id = row["q_id"].ToString();
                    if (q_id == "FC2D9933EAA14E8A89EC8E8AC61602D5")
                    {
                        ganyouUps = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (ganyouUps == 0)
                        {
                            continue;
                        }
                        ganyouup.Text = ganyouUps.ToString();
                    }
                    if (q_id == "7543252298164AAF8BCD50A8FCECF80F")
                    {
                        zongUps = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (zongUps == 0)
                        {
                            continue;
                        }
                        zongup.Text = zongUps.ToString();
                    }
                    if (q_id == "9F576888D01A4BCABDF3B61CEDE6948B")
                    {
                        diUps = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (diUps == 0)
                        {
                            continue;
                        }
                        diup.Text = diUps.ToString();
                    }
                    if (q_id == "5E1D0A34001D4C02AB4FC7786139B208")
                    {
                        gaoUps = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (gaoUps == 0)
                        {
                            continue;
                        }
                        gaoup.Text = gaoUps.ToString();
                    }
                    if (q_id == "751624508AA94D05864287B3CB6B723B")
                    {
                        tiUps = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (tiUps == 0)
                        {
                            continue;
                        }
                        zhiup.Text = tiUps.ToString();
                    }
                    if (q_id == "7462E7B63F974594BADCAD5031FC05D2")
                    {
                        gaozhiUps = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                        if (gaozhiUps == 0)
                        {
                            continue;
                        }
                        gaozhiup.Text = gaozhiUps.ToString();
                    }
                }
            }
            #endregion
            #region 指标变化
            if (ganyouUps != -100f && ganyous != 100f)
            {
                if (ganyous > ganyouUps)
                {
                    ganbian.Text = "升高";
                }
                else if (ganyous < ganyouUps)
                {
                    ganbian.Text = "下降";
                }
                else
                {
                    ganbian.Text = "没变";
                }
            }
            if (zongUps != -100f && zongs != 100f)
            {
                if (zongs > zongUps)
                {
                    zongbian.Text = "升高";
                }
                else if (zongs < zongUps)
                {
                    zongbian.Text = "下降";
                }
                else
                {
                    zongbian.Text = "没变";
                }
            }
            if (diUps != -100f && dis != 100f)
            {
                if (dis > diUps)
                {
                    dibian.Text = "升高";
                }
                else if (dis < diUps)
                {
                    dibian.Text = "下降";
                }
                else
                {
                    dibian.Text = "没变";
                }
            }
            if (gaoUps != -100f && gaos != 100f)
            {
                if (gaos > gaoUps)
                {
                    gaobian.Text = "升高";
                }
                else if (gaos < gaoUps)
                {
                    gaobian.Text = "下降";
                }
                else
                {
                    gaobian.Text = "没变";
                }
            }
            if (gaozhiUps != -100f && gaozhis != 100f)
            {
                if (gaozhis > gaozhiUps)
                {
                    gaozhibian.Text = "升高";
                }
                else if (gaozhis < gaozhiUps)
                {
                    gaozhibian.Text = "下降";
                }
                else
                {
                    gaozhibian.Text = "没变";
                }
            }
            if (tiUps != -100f && tis != 100f)
            {
                if (tis > tiUps)
                {
                    tibian.Text = "升高";
                }
                else if (tis < tiUps)
                {
                    tibian.Text = "下降";
                }
                else
                {
                    tibian.Text = "没变";
                }
            }
            #endregion

            #region 风险判断
            if (zongfen <= 4)
            {
                picFat1.Visible         = true;
                xuezhiReslut1.Text      = "低危险人群";
                ResultVale              = "低危险人群";
                this.xuezhiReslut1.Text = "低危险人群";
                xuezhiReslut1.ForeColor = Color.Black;
                xuezhiResult.ForeColor  = Color.Black;
            }
            if (zongfen >= 5 && zongfen <= 18)
            {
                picFat2.Visible         = true;
                this.xuezhiResult.Text  = "高危人群";
                ResultVale              = "高危人群";
                xuezhiResult.ForeColor  = Color.Red;
                this.xuezhiReslut1.Text = "高危人群";
                xuezhiReslut1.ForeColor = Color.Red;
            }
            if (zongfen >= 18)
            {
                picFat3.Visible         = true;
                this.xuezhiResult.Text  = "血脂异常";
                xuezhiResult.ForeColor  = Color.Red;
                this.xuezhiReslut1.Text = "血脂异常";
                xuezhiReslut1.ForeColor = Color.Red;
                ResultVale = "血脂异常";
            }
            #endregion
            string firs = "血脂检查共4项,即总胆固醇、甘油三酯、低密度脂蛋白和高密度脂蛋白。血脂异常就是指血中总胆固醇、甘油三酯、低密度脂蛋白胆固醇超过正常及(或)高密度脂蛋白胆固醇低下。血脂异常作为脂代谢障碍的表现,属于代谢性疾病,它对健康的损害主要在心血管系统,易导致冠心病及其他动脉粥样硬化性疾病。";
            if (!string.IsNullOrEmpty(zhibiaos))
            {
                firs = firs + "\n\n您已达到血脂异常的诊断标准,您目前的血脂四项中存在异常的指标包括" + zhibiaos + ",您可以通过减轻体重、增加体力活动水平等治疗性生活方式改善措施来有效调节血脂,预防心脑血管病的发生。";
            }
            zhidaojianyi.Text = firs;
            JianYi            = firs;
            JieLun            = "《中国成人血脂异常防治指南》对血脂异常的定义:血清甘油三酯≥1.70mmol/L,总胆固醇≥5.17mmol/L,高密度脂蛋白胆固醇<1.04mmol/L,低密度脂蛋白胆固醇≥3.37mmol/L,4项中具备1项及以上者即为血脂异常。根据您提供的有关信息及临床.检查结果,您血脂情况为" + xuezhiReslut1.Text;
            yinsutxt.Text     = yinsu.TrimEnd(',').TrimEnd(',');
        }
Пример #15
0
        private void InitValidate()
        {
            if (QuestionList.Any())
            {
                #region 验证条件
                var validates = QuestionList.Where(x => x.Question.q_is_validate && !string.IsNullOrWhiteSpace(x.Question.q_validate)); //找到有验证条件的
                foreach (UCQuestion validate in validates)
                {
                    tmo_questionnaire           que = validate.Question;
                    Dictionary <string, string> dic = TmoShare.GetValueFromJson <Dictionary <string, string> >(que.q_validate);
                    if (dic == null || !dic.Any())
                    {
                        continue;
                    }

                    foreach (KeyValuePair <string, string> keyValuePair in dic)
                    {
                        string type         = keyValuePair.Key;
                        string conditionStr = keyValuePair.Value;
                        if (type == "calc") //自动计算
                        {
                            List <string> qidList = new List <string>();
                            var           macth   = Regex.Match(conditionStr, @"\{.+?\}");
                            while (macth.Success)
                            {
                                string qid = macth.Value;
                                if (!qidList.Contains(qid))
                                {
                                    qidList.Add(qid);
                                }
                                macth = macth.NextMatch();
                            }

                            List <UCQuestion> tquelist = new List <UCQuestion>();
                            qidList.ForEach(x =>
                            {
                                string qid = x.TrimStart('{').TrimEnd('}');
                                try
                                {
                                    var tucque = QuestionList.First(y => y.Question.q_id == qid);
                                    tquelist.Add(tucque);
                                }
                                catch { }
                            });


                            tquelist.ForEach(x =>
                            {
                                x.Leave += ((sender, args) =>
                                {
                                    string str = conditionStr;
                                    foreach (UCQuestion y in tquelist)
                                    {
                                        if (!y.ValidateValue())
                                        {
                                            return;                     //值类型验证失败 停止计算
                                        }
                                        string tovale = y.GetValue().ToString();
                                        if (string.IsNullOrWhiteSpace(tovale))
                                        {
                                            return;
                                        }
                                        string replacekey = "{" + y.Question.q_id + "}";
                                        str = str.Replace(replacekey, tovale);
                                    }
                                    object obj = TmoShare.CalcString(str);
                                    validate.SetValue(obj);
                                });
                            });
                        }
                        else if (type.StartsWith("enable") || type.StartsWith("disable"))  //禁用选项
                        {
                            string tqid = conditionStr;
                            try
                            {
                                var tucque = QuestionList.First(y => y.Question.q_id == tqid);
                                tucque.ValueChanged += (sender) =>
                                {
                                    object value = tucque.GetValue();
                                    if (value is DateTime)
                                    {
                                        DateTime dt = (DateTime)value;
                                        if (dt != DateTime.MinValue && dt != new DateTime(9999, 12, 31))
                                        {
                                            validate.Enabled = true;
                                        }
                                        else
                                        {
                                            validate.Enabled = false;
                                            validate.SetValue(null);
                                        }
                                    }
                                    if (value is bool)
                                    {
                                        if (type == "disable" || type == "enable")
                                        {
                                            bool enable = (bool)value;
                                            if (type == "disable")
                                            {
                                                enable = !enable;
                                            }
                                            if (!enable)
                                            {
                                                validate.SetValue(null);
                                            }
                                            validate.Enabled = enable;
                                        }
                                    }
                                    if (value is float)
                                    {
                                        if (type.Contains("|"))
                                        {
                                            float f     = (float)value;
                                            var   list  = StringPlus.GetStrArray(StringPlus.GetStrArray(type, "-")[1], "|");
                                            var   flist = new List <float>();
                                            list.ForEach(x => flist.Add(Convert.ToSingle(x)));
                                            bool enable = flist.Contains(f);
                                            if (type.StartsWith("disable"))
                                            {
                                                enable = !enable;
                                            }
                                            if (!enable)
                                            {
                                                validate.SetValue(null);
                                            }
                                            validate.Enabled = enable;
                                        }
                                    }
                                };
                                tucque.OnValueChanged();
                            }
                            catch { }
                        }
                        else if (type == "required") //必填验证
                        {
                            validate.IsRequired = true;
                        }
                    }
                }
                #endregion

                #region 男女验证
                var genders = QuestionList.Where(x => x.Question.q_gender != 0); //找到有性别限制的题目
                foreach (UCQuestion gender in genders)
                {
                    if (_user.gender != gender.Question.q_gender)
                    {
                        gender.Enabled = false;
                    }
                }
                #endregion
            }
        }
Пример #16
0
        void ReceiveCallback(IAsyncResult ar)
        {
            StateObject state    = ar.AsyncState as StateObject;
            bool        disposed = false; //是否停止数据接收

            try
            {
                //服务器发来的消息
                int    length       = state.Socket.EndReceive(ar);
                byte[] receiveBytes = new byte[length];
                Array.Copy(state.Buffer, 0, receiveBytes, 0, length);

                int    head    = -1;   //消息头码
                string strData = null; //String类型消息
                if (length >= 4)
                {
                    //消息头码
                    head = BitConverter.ToInt32(new[] { receiveBytes[0], receiveBytes[1], receiveBytes[2], receiveBytes[3] }, 0);

                    if (head == 8888) //握手头码
                    {
                        trustedServer = true;
                    }
                    else if (head == 7777) //心跳包头码
                    {
                        strData = ParserString(receiveBytes);
                        DateTime serverTime = TmoShare.GetValueFromJson <DateTime>(strData);
                        double   dualSec    = Math.Abs((serverTime - DateTime.Now).TotalSeconds);
                        if (dualSec > 10)
                        {
                            DateTimeHelper.SetSystemTime(serverTime.AddSeconds(1));
                        }
                    }
                    else if (head == 9999) //请求断开连接
                    {
                        serviceClosing = false;
                        serviceClosed  = true;
                        ClostSocket();
                    }
                    else if (head == 0 && trustedServer) //发送来的是消息
                    {
                        strData = ParserString(receiveBytes);
                    }
                }
                InvokeDataReceived(head, receiveBytes, strData);
            }
            catch (Exception ex)
            {
                if (ex is ObjectDisposedException)
                {
                    disposed = true;
                    return; //停止接收数据
                }
                if (ex is SocketException)
                {
                    ClostSocket();
                    return;
                }
            }
            finally
            {
                try
                {
                    if (!disposed)
                    {
                        //继续接收消息
                        state.Socket.BeginReceive(state.Buffer, 0, state.Buffer.Length, SocketFlags.None, ReceiveCallback, state);
                    }
                }
                catch
                {
                    ClostSocket();
                }
            }
        }
Пример #17
0
        public void RefData(string userId, string user_times, string queryId)
        {
            List <string> md5res    = new List <string>();
            string        resultxml = TmoLinkServer.TmoServiceClient.InvokeServerMethodT <string>(funCode.getFeiPang, new object[] { userId, user_times, queryId });
            DataTable     DsReslut  = TmoShare.getDataTableFromXML(resultxml);
            double        zongfen   = 0;
            string        jianyi    = "";
            string        yinsu     = "";
            string        jielun    = "";
            int           i         = 0;
            int           j         = 0;
            int           g         = 0;
            float         bimva     = 0f;
            float         yao       = 0f;

            foreach (DataRow row in DsReslut.Rows)
            {
                string q_id = row["q_id"].ToString();

                if (q_id == "7B524F8B31AA4952B27E3119B69FBEB7")
                {
                    bimva                 = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                    zhishuValue.Text      = bimva.ToString();
                    zhishuValue.ForeColor = Color.Red;
                    string qrscore = row["qr_score"].ToString();
                    switch (qrscore)
                    {
                    case "0":
                        feifr.Text      = "正常";
                        ResultVale      = "正常";
                        feifr.ForeColor = Color.Black;
                        xp2.Visible     = true;
                        xp3.Visible     = false;
                        xp1.Visible     = false;
                        xp4.Visible     = false;
                        break;

                    case "1":
                        feifr.Text      = "体重过低";
                        ResultVale      = "体重过低";
                        feifr.ForeColor = Color.Red;
                        xp1.Visible     = true;
                        xp3.Visible     = false;
                        xp2.Visible     = false;
                        xp4.Visible     = false;
                        break;

                    case "2":
                        feifr.Text      = "超重";
                        ResultVale      = "超重";
                        feifr.ForeColor = Color.Red;
                        xp3.Visible     = true;
                        xp1.Visible     = false;
                        xp2.Visible     = false;
                        xp4.Visible     = false;
                        break;

                    case "4":
                        feifr.Text      = "肥胖";
                        ResultVale      = "肥胖";
                        feifr.ForeColor = Color.Red;
                        xp4.Visible     = true;
                        xp1.Visible     = false;
                        xp2.Visible     = false;
                        xp3.Visible     = false;
                        break;

                    default:
                        break;
                    }
                }
                if (q_id == "27BBE810676845939AFBE59A5B900822")
                {
                    yao                   = TmoShare.GetValueFromJson <float>(row["qr_result"].ToString());
                    yaoValue.Text         = yao + "厘米";
                    yaoValue.ForeColor    = Color.Red;
                    yaoweiValue.Text      = yao + "厘米";
                    yaoweiValue.ForeColor = Color.Red;
                    string qrscore = row["qr_score"].ToString();
                    switch (qrscore)
                    {
                    case "0":
                        yaofr.Text      = "正常";
                        yaoweiDe.Text   = "正常";
                        feifr.ForeColor = Color.Black;
                        wp1.Visible     = true;
                        wp2.Visible     = false;
                        break;

                    case "4":
                        yaofr.Text      = "腰围超大";
                        yaoweiDe.Text   = "中心型肥胖";
                        feifr.ForeColor = Color.Red;
                        wp2.Visible     = true;
                        wp1.Visible     = false;
                        break;

                    default:
                        break;
                    }
                }
                zongfen = zongfen + Convert.ToDouble(row["qr_score"]);
                if (!string.IsNullOrEmpty(row["q_reault"].ToString()))
                {
                    i++;
                    jianyi = jianyi + i + "、" + row["q_reault"].ToString().Trim() + " \n\n";
                }
                if (!string.IsNullOrEmpty(row["q_resik"].ToString()))
                {
                    string val = TmoCommon.MD5Helper.Md5Encrypt(row["q_resik"].ToString());
                    if (md5res.Contains(val))
                    {
                    }
                    else
                    {
                        yinsu = yinsu + row["q_resik"] + ",";
                        md5res.Add(val);
                    }
                }
                if (!string.IsNullOrEmpty(row["q_advice"].ToString()))
                {
                    j++; jielun = jielun + j + "、" + row["q_advice"].ToString().Trim() + "\n\n";
                }
            }



            this.feipangDre.Text = jianyi;
            JianYi          = jianyi;
            JieLun          = jielun;
            this.yinsu.Text = yinsu.TrimEnd(',').Replace("\n", "").Replace("\t", "");
        }
Пример #18
0
        public void getData(string userId, string user_times, string quesTypeId, int age)
        {
            List <string> md5res  = new List <string>();
            List <string> shenHuo = new List <string>();

            shenHuo.Add("超重/肥胖或腹型肥胖*");
            shenHuo.Add("高盐、低钾饮食*");
            shenHuo.Add("吸烟");
            shenHuo.Add("长期过量饮酒");
            string    ssHeng     = "无";
            string    resultxml  = TmoLinkServer.TmoServiceClient.InvokeServerMethodT <string>(funCode.getTest, new object[] { userId, user_times, quesTypeId });
            DataTable DsReslut   = TmoShare.getDataTableFromXML(resultxml);
            string    resultxml1 = TmoLinkServer.TmoServiceClient.InvokeServerMethodT <string>(funCode.getScreenData, new object[] { userId, user_times, "'02390D277242464192B05F08D03D298B','751624508AA94D05864287B3CB6B723B'" });

            DataTable DsReslut1 = TmoShare.getDataTableFromXML(resultxml1);
            double    zongfen   = 0;
            string    jianyi    = "";
            string    yinsu     = "";
            string    jielun    = "根据您所填写的问卷调查内容,我们对您的疾病风险进行了评估,您现在处于高血压的";

            foreach (DataRow row in DsReslut.Rows)
            {
                zongfen = zongfen + Convert.ToDouble(row["qr_score"]);
            }
            if (DsReslut1 != null && DsReslut1.Rows.Count > 0)
            {
                //DataRow drrow = DsReslut1.Rows[0];
                foreach (DataRow drrow in DsReslut1.Rows)
                {
                    if (drrow["q_id"].ToString() == "02390D277242464192B05F08D03D298B")
                    {
                        bool val = TmoShare.GetValueFromJson <bool>(drrow["qr_result"].ToString());
                        if (val)
                        {
                            ResultVale = "已患"; xuya.Text = "有"; this.lblfen.Text = "已患高血压"; idsss.Add(0); idsss.Add(0); idsss.Add(0); idsss.Add(4); lblfen.ForeColor = Color.Red;
                        }
                        else
                        {
                            if (zongfen <= 5)
                            {
                                ResultVale = "低风险"; this.lblfen.Text = "低风险"; idsss.Add(1); idsss.Add(0); idsss.Add(0); idsss.Add(0); lblfen.ForeColor = Color.Black;
                            }
                            if (zongfen >= 6 && zongfen <= 9)
                            {
                                ResultVale = "中风险"; this.lblfen.Text = "中风险"; idsss.Add(0); idsss.Add(2); idsss.Add(0); idsss.Add(0); lblfen.ForeColor = Color.Red;
                            }
                            if (zongfen >= 10 && zongfen <= 24)
                            {
                                ResultVale = "高风险"; this.lblfen.Text = "高风险"; xuya.Text = "有"; idsss.Add(0); idsss.Add(0); idsss.Add(3); idsss.Add(0); lblfen.ForeColor = Color.Red;
                            }
                            if (zongfen >= 25)
                            {
                                ResultVale = "已患高血压"; xuya.Text = "有"; this.lblfen.Text = "已患高血压"; idsss.Add(0); idsss.Add(0); idsss.Add(0); idsss.Add(4); lblfen.ForeColor = Color.Red;
                            }
                        }
                    }
                    if (drrow["q_id"].ToString() == "751624508AA94D05864287B3CB6B723B")
                    {
                        float tis = TmoShare.GetValueFromJson <float>(drrow["qr_result"].ToString());
                        if (tis <= 18.5 || tis >= 24)
                        {
                            BMItxt.Text = "有";
                        }
                    }
                }
            }
            else
            {
                if (zongfen <= 5)
                {
                    ResultVale = "低风险"; this.lblfen.Text = "低风险"; idsss.Add(1); idsss.Add(0); idsss.Add(0); idsss.Add(0); lblfen.ForeColor = Color.Black;
                }
                if (zongfen >= 6 && zongfen <= 9)
                {
                    ResultVale = "中风险"; this.lblfen.Text = "中风险"; idsss.Add(0); idsss.Add(2); idsss.Add(0); idsss.Add(0); lblfen.ForeColor = Color.Red;
                }
                if (zongfen >= 10 && zongfen <= 24)
                {
                    ResultVale = "高风险"; this.lblfen.Text = "高风险"; xuya.Text = "有"; idsss.Add(0); idsss.Add(0); idsss.Add(3); idsss.Add(0); lblfen.ForeColor = Color.Red;
                }
                if (zongfen >= 25)
                {
                    ResultVale = "已患高血压"; xuya.Text = "有"; this.lblfen.Text = "已患高血压"; idsss.Add(0); idsss.Add(0); idsss.Add(0); idsss.Add(4); lblfen.ForeColor = Color.Red;
                }
            }
            jielun = jielun + this.lblfen.Text + "阶段;\n\n";
            int i = 0;
            int j = 0;
            int g = 0;

            foreach (DataRow row in DsReslut.Rows)
            {
                if (!string.IsNullOrEmpty(row["q_reault"].ToString()))
                {
                    i++;
                    jianyi = jianyi + i + "、" + row["q_reault"].ToString().Trim() + "\n\n";
                }
                if (!string.IsNullOrEmpty(row["q_resik"].ToString()))
                {
                    string mingtxt = row["q_resik"].ToString();
                    if (shenHuo.Contains(mingtxt))
                    {
                        ssHeng = "有";
                    }
                    if (mingtxt == "家族史*" || mingtxt == "家族史")
                    {
                        xtjzs.Text = "有";
                    }
                    if (mingtxt == "年龄*" || mingtxt == "年龄")
                    {
                        xtnianling.Text = "有";
                    }
                    if (mingtxt == "血压")
                    {
                        xuya.Text = "有";
                    }
                    if (mingtxt == "血脂")
                    {
                        xuezhitxt.Text = "有";
                    }
                    if (mingtxt == "超重/肥胖或腹型肥胖*")
                    {
                        BMItxt.Text = "有";
                    }
                    string val = TmoCommon.MD5Helper.Md5Encrypt(row["q_resik"].ToString());
                    if (md5res.Contains(val))
                    {
                    }
                    else
                    {
                        g++;
                        yinsu.TrimEnd(',').TrimEnd(',');
                        if (row["q_resik"].ToString() == "家族史")
                        {
                            break;
                        }
                        if (row["q_resik"].ToString() == "年龄")
                        {
                            break;
                        }
                        if (row["q_resik"].ToString() == "年龄*")
                        {
                            break;
                        }
                        yinsu = yinsu + row["q_resik"] + ",";
                        md5res.Add(val);
                    }
                }
                if (!string.IsNullOrEmpty(row["q_advice"].ToString()))
                {
                    j++; jielun = jielun + j + "、" + row["q_advice"].ToString().Trim() + "\n\n";
                }
            }
            if (XUEZhi == "血脂异常")
            {
                xuezhitxt.Text = "有";
            }
            if (age > 45)
            {
                xtnianling.Text = "有";
            }
            this.xtsheng.Text   = ssHeng;
            this.lbljianyi.Text = jianyi;
            JianYi           = jianyi;
            JieLun           = jielun;
            this.lblddd.Text = yinsu.TrimEnd(',');
            lbldes.Text      = jielun;
        }