示例#1
0
        /// <summary>
        /// 获取基本信息
        /// </summary>
        /// <param name="person"></param>
        /// <param name="tryCount"></param>
        /// <param name="callback"></param>
        private string GetGrdaInfo(PersonModel person, string pNumberMaster)
        {
            WebHelper web = new WebHelper();

            string       postData     = "dah=" + person.pid + "&tz=2";
            string       returnString = web.PostHttp(baseUrl + "/healthArchives/updateArchives.action", postData, "application/x-www-form-urlencoded", SysCookieContainer);
            HtmlDocument doc          = HtmlHelper.GetHtmlDocument(returnString);

            DataSet dsT = GetDataTableTmp();

            DataTable baseInfo = dsT.Tables["ARCHIVE_BASEINFO"].Clone();
            DataRow   dr       = baseInfo.NewRow();

            var node = doc.DocumentNode.SelectSingleNode("//input[@id='dSfzh']");

            string idnumber = node == null || !node.Attributes.Contains("value") ? "" : node.Attributes["value"].Value;

            if (string.IsNullOrEmpty(idnumber))
            {
                return("");
            }

            dr["IDCardNo"] = idnumber;
            dr["RecordID"] = person.pid;
            //与户主关系
            node = doc.DocumentNode.SelectSingleNode("//select[@id='dYhzgx']/option[@selected]");

            string strH = node == null || !node.Attributes.Contains("value") ? "" : node.Attributes["value"].Value;

            dr["HouseRelation"] = GetHouseRelation(strH);

            dr["FamilyIDCardNo"] = string.IsNullOrEmpty(pNumberMaster) ? idnumber : pNumberMaster;

            baseInfo.Rows.Add(dr);

            DataSet saveDS = new DataSet();

            saveDS.Tables.Add(baseInfo);

            CommonBusiness.CommonDAOBusiness dao = new CommonBusiness.CommonDAOBusiness();
            dao.SaveDataSet(saveDS, idnumber);
            saveDS.Tables.Clear();

            return(string.IsNullOrEmpty(pNumberMaster) ? idnumber : pNumberMaster);
        }
示例#2
0
        /// <summary>
        /// 根据信息,获取家庭档案
        /// </summary>
        /// <param name="listPerson"></param>
        /// <param name="callback"></param>
        private void GetJtPeopleInfo(string jtKey, int tryCount, Action <string> callback)
        {
            try
            {
                WebHelper     web     = new WebHelper();
                StringBuilder postStr = new StringBuilder();

                postStr.Append("djtdabh=").Append(jtKey);

                //http://112.6.122.71:9165/sdcsm/home/homeshow.action?djtdabh=3714240201900434
                //查询请求执行
                string       returnString = web.GetHttp(baseUrl + "home/homeshow.action", postStr.ToString(), SysCookieContainer);
                HtmlDocument doc          = HtmlHelper.GetHtmlDocument(returnString);

                if (doc == null)
                {
                    return;
                }

                var nodetrs = doc.DocumentNode.SelectNodes("//div[@id='jtcyxg']//table[@id='table1']//tr[position()>3]");

                List <PersonModel> lstpm = new List <PersonModel>();

                PersonModel pmMaster = new PersonModel();

                if (nodetrs != null)
                {
                    var node0  = nodetrs[0].SelectSingleNode("td[1]/input[1]");
                    var nodeR0 = nodetrs[0].SelectSingleNode("td[2]/select/option[@selected]");

                    pmMaster.pid = node0 == null || !node0.Attributes.Contains("value") ? "" : node0.Attributes["value"].Value;
                    string pMNumber = "";

                    if (!string.IsNullOrEmpty(pmMaster.pid))
                    {
                        pMNumber = GetGrdaInfo(pmMaster, "");
                    }

                    if (string.IsNullOrEmpty(pMNumber))
                    {
                        return;
                    }

                    //家庭信息

                    DataSet dsT = GetDataTableTmp();

                    DataTable baseInfo = dsT.Tables["ARCHIVE_FAMILY_INFO"].Clone();
                    DataRow   dr       = baseInfo.NewRow();

                    dr["RecordID"]       = jtKey;
                    dr["FamilyRecordID"] = pMNumber;
                    dr["IDCardNo"]       = pMNumber;

                    var nodeJT = doc.DocumentNode.SelectSingleNode("//select[@id='dcslx']/option[@selected]");
                    dr["ToiletType"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value;
                    dr["ToiletType"] = dr["ToiletType"].ToString() == "99" ? "4" : dr["ToiletType"];

                    nodeJT          = doc.DocumentNode.SelectSingleNode("//select[@id='dzflx']/option[@selected]");
                    dr["HouseType"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value;

                    nodeJT = doc.DocumentNode.SelectSingleNode("//select[@id='dsfdb']/option[@selected]");

                    string strPoor = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value;
                    dr["IsPoorfy"] = strPoor == "2" ? "0" : strPoor;

                    nodeJT          = doc.DocumentNode.SelectSingleNode("//input[@id='djzmj']");
                    dr["HouseArea"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value;

                    nodeJT          = doc.DocumentNode.SelectSingleNode("//input[@id='drjsr']");
                    dr["IncomeAvg"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value;

                    nodeJT         = doc.DocumentNode.SelectSingleNode("//input[@id='dcyanl']");
                    dr["Monthoil"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value;

                    nodeJT          = doc.DocumentNode.SelectSingleNode("//input[@id='dcyl']");
                    dr["MonthSalt"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value;

                    nodeJT            = doc.DocumentNode.SelectSingleNode("//input[@id='happentime']");
                    dr["CreatedDate"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value;

                    baseInfo.Rows.Add(dr);

                    DataSet saveDS = new DataSet();
                    saveDS.Tables.Add(baseInfo);

                    CommonBusiness.CommonDAOBusiness dao = new CommonBusiness.CommonDAOBusiness();
                    dao.SaveDataSet(saveDS, pMNumber);
                    saveDS.Tables.Clear();

                    // 排除户主,从1开始
                    //for (int i = 1; i < nodetrs.Count; i++)
                    //{
                    //    var jtP = nodetrs[i];
                    //    var node = jtP.SelectSingleNode("td[1]/input[1]");
                    //    var nodeR = jtP.SelectSingleNode("td[2]/select/option[@selected]");

                    //    PersonModel pm = new PersonModel();

                    //    pm.pid = node == null || !node.Attributes.Contains("value") ? "" : node.Attributes["value"].Value;

                    //    if (!string.IsNullOrEmpty(pm.pid))
                    //    {
                    //        GetGrdaInfo(pm, pMNumber);
                    //    }
                    //}
                }
            }
            catch (Exception ex)
            {
                CommonExtensions.WriteLog(ex.Message);
                CommonExtensions.WriteLog(ex.StackTrace);

                if (tryCount < MaxtryCount)
                {
                    callback("EX-家庭档案:家庭档案号[" + jtKey + "]:下载信息失败。重新尝试获取第" + tryCount + "次...");

                    System.Threading.Thread.Sleep(SleepMilliseconds);

                    tryCount++;
                    GetJtPeopleInfo(jtKey, tryCount, callback);
                }
                else
                {
                    callback("EX-家庭档案:家庭档案号[" + jtKey + "]:下载信息失败。请确保网路畅通。");
                }
            }
        }