Exemplo n.º 1
0
        private void yysjhou(string urls, string hpid, string keid)
        {
            //获取可以预约医生的链接
            string urlt    = yysjList[0];
            string yyys    = HtmlHelp.sendGet(urlt, urls);
            int    startHp = yyys.LastIndexOf("<a href=") + 11;

            hpName = yyys.Substring(startHp);
            hpName = hpName.Substring(0, hpName.IndexOf("/"));
            Utils  utilsys = new Utils(yyys);
            Ysinfo ys      = utilsys.toYS(sx);//获取可以预约医生的链接

            if (ys == null)
            {
                label3.Text   += "没有可以预约的医生" + Environment.NewLine;
                textBox6.Text += "没有可以预约的医生" + Environment.NewLine;
            }
            else
            {
                label3.Text   += "预订挂号信息:" + Environment.NewLine + "职称:" + ys.zhicheng + Environment.NewLine + "专长:" + ys.zhuanchang + Environment.NewLine;
                textBox6.Text += "预订挂号信息:" + Environment.NewLine + "职称:" + ys.zhicheng + Environment.NewLine + "专长:" + ys.zhuanchang + Environment.NewLine;
            }

            string url      = @"http://www.bjguahao.gov.cn/comm" + ys.Url;
            string htmls    = HtmlHelp.sendGet(url, urlt);
            int    start    = htmls.IndexOf("/shortmsg/dx_code.php?");
            string newhtml  = htmls.Substring(start);
            int    newstart = newhtml.IndexOf(",");
            string text     = newhtml.Substring(0, newstart);

            text = text.Replace("\"", "");
            text = text.Replace("+hpid+", hpid);

            string ksid  = getparam(htmls, "code_ksid");
            string datid = getparam(htmls, "code_datid");


            int infoPostion = htmls.LastIndexOf("html>") + 5;

            infohtml = htmls.Substring(infoPostion);


            text = text.Replace("+ksid+", keid);
            text = text.Replace("+datid+", datid);
            text = text.Replace("+jiuz+", "");
            text = text.Replace("+ybkh+", "");
            text = text.Replace("+baoxiao", "0");
            text = text.Replace("+", "");
            text = @"http://www.bjguahao.gov.cn/comm" + text;
            //label3.Text += text;


            //发送短信验证码
            ghq = "hpid=" + hpid + "&ksid" + ksid + "&datid=" + datid;
            string ghreferer = @"http://www.bjguahao.gov.cn/comm/xiehe/guahao.php?" + ghq;

            gh = ghq + "&jiuz=&ybkh=" + sfz + "&baoxiao=1&tpost=3d4e81798b906881a05e122fbc5351c3";


            string valuesstr = HtmlHelp.sendGets(text, ghreferer);

            if (valuesstr.Length >= 1)
            {
                label3.Text += valuesstr + Environment.NewLine;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 查询有没有可以预约的医生
        /// </summary>
        /// <returns></returns>
        public Ysinfo toYS(string sc)
        {
            int count = this.html.IndexOf("<td class='tdtitle'>操作</td>");

            if (count < 0)
            {
                return(null);
            }
            int lcount = this.html.LastIndexOf("</table>");

            html = html.Substring(0, lcount);
            html = html.Substring(count + 31);


            string pat1 = @"<td>(?<text>.*?)</td>";
            Ysinfo ys   = null;
            int    yc   = 1;

            foreach (Match item in Regex.Matches(html, pat1))
            {
                string jg = item.Groups["text"].Value;

                if (yc == 6)
                {
                    ys = new Ysinfo();
                }
                if (yc == 6)
                {
                    ys.zhicheng = jg;
                }
                if (yc == 8)
                {
                    ys.zhuanchang = jg;
                }
                if (yc == 11)
                {
                    if (jg != "约满")
                    {
                        ys.Url = jg;
                        ysList.Add(ys);

                        string zw = ys.zhicheng;
                        switch (zw)
                        {
                        case "专家": zjList.Add(ys); break;

                        case "正教授": zjsList.Add(ys); break;

                        case "副教授": fjsList.Add(ys); break;

                        case "主任医师": zrysList.Add(ys); break;

                        case "主治医师": zzysList.Add(ys); break;

                        case "医师": yssList.Add(ys); break;

                        default: qtList.Add(ys); break;
                        }
                    }
                    yc = 0;
                }

                yc += 1;
            }
            Ysinfo info = null;

            if (ysList.Count < 1)
            {
                return(null);
            }
            if (ysList.Count == 1)
            {
                return(ysList[0]);
            }

            //如果有有筛选条件,则先按照筛选条件筛选专家、正教授、副教授
            if (sc.Length > 0)
            {
                info = sx(zjList, sc);//筛选专家
                if (info == null)
                {
                    info = sx(zjsList, sc);//筛选正教授
                }

                if (info == null)
                {
                    info = sx(fjsList, sc);//筛选副教授
                }
            }



            //if (info == null)
            //{
            //    info = sx(zzysList,sc);//筛选主治医师
            //}

            //if (info == null)
            //{
            //    info = sx(zrysList,sc);//筛选主任医师
            //}

            //if (info == null)
            //{
            //    info = sx(yssList,sc);//筛选医师
            //}



            //如果没有筛选条件或者没有筛选到符合的医生
            if (info == null)
            {
                info = fh(zjList);

                if (info == null)
                {
                    info = fh(zjsList);
                }

                if (info == null)
                {
                    info = fh(zjsList);
                }

                if (info == null)
                {
                    info = fh(fjsList);
                }

                if (info == null)
                {
                    info = fh(zzysList);
                }

                if (info == null)
                {
                    info = fh(zrysList);
                }

                if (info == null)
                {
                    info = fh(yssList);
                }

                if (info == null)
                {
                    info = fh(qtList);
                }
                if (info == null)
                {
                    if (ysList.Count > 0)
                    {
                        return(ysList[0]);
                    }
                }
            }



            return(info);

            //string[] strlist = html.Split(new string[] { "<tr>" }, StringSplitOptions.RemoveEmptyEntries);
            //for (int i = 0; i < strlist.Length; i++) {

            //}
        }