/// <summary> /// 获取科室下所有医生预约信息 /// </summary> /// <returns></returns> public abstract bool GetDepartmenRegisterInfo(ref DepartmentRegisterInfo depRegisterInfo);
public override bool GetDepartmenRegisterInfo(ref DepartmentRegisterInfo depRegisterInfo) { try { depRegisterInfo.Clear(); m_httpItem.URL = DEPT_INFO_URL + m_hosBack.data.hos[m_indexHos].hosCode + "/" + m_depBack.data.dept[m_indexDep].deptName; m_httpItem.ResultType = ResultType.String; m_httpItem.Method = "POST"; m_httpItem.ContentType = "text/html"; m_httpItem.Postdata = string.Empty; m_htmlDocument.LoadHtml(m_httpHelper.GetHtml(m_httpItem).Html); HtmlNode htmlNode = m_htmlDocument.DocumentNode; htmlNode = htmlNode.SelectSingleNode(REGISTER_INFO_XPATH); if (htmlNode == null) { m_lastError = "科室信息获取失败:可能网路连接失败,或者不存在该科室信息"; return(false); } HtmlNodeCollection htmlNodeCollection = htmlNode.SelectNodes("tr"); if (htmlNodeCollection.Count == 2) { m_lastError = "该科室暂无排班"; return(false); } StringBuilder stringBuilder = new StringBuilder(); foreach (HtmlNode current in htmlNodeCollection) { string attributeValue = current.GetAttributeValue("class", ""); if (attributeValue == string.Empty) { HtmlNodeCollection htmlNodeCollection2 = current.SelectNodes("td"); if (htmlNodeCollection2.Count == 17) { int num = 0; foreach (HtmlNode current2 in ((IEnumerable <HtmlNode>)htmlNodeCollection2)) { if (current2.SelectSingleNode("form") != null) { HtmlNode htmlNode2 = current2.SelectSingleNode("input[@type='submit']"); if (htmlNode2 != null && num > 0) { //正常预约信息 m_doctorRegInfo.RegistionTypes[num - 1] = RegistionType.Normal; m_doctorRegInfo.RemainNums[num - 1] = htmlNode2.GetAttributeValue("value", "").Replace(" ", "\r\n"); m_doctorRegInfo.ToolTipTexts[num - 1] = htmlNode2.GetAttributeValue("title", ""); HtmlNodeCollection htmlNodeCollection3 = current2.SelectNodes("input"); if (htmlNodeCollection3.Count == 14) { stringBuilder.Length = 0; stringBuilder.Append("http://www.zj12580.cn/order/num?"); for (int i = 0; i < 13; i++) { stringBuilder.Append(htmlNodeCollection3[i].GetAttributeValue("name", "")); stringBuilder.Append("="); stringBuilder.Append(htmlNodeCollection3[i].GetAttributeValue("value", "")); if (i < 12) { stringBuilder.Append("&"); } } } this.m_doctorRegInfo.OrderUrls[num - 1] = stringBuilder.ToString(); } else { htmlNode2 = current2.SelectSingleNode("span"); if (htmlNode2 != null) { string text = htmlNode2.InnerHtml.Trim(); if (text == "已满") { m_doctorRegInfo.RegistionTypes[num - 1] = RegistionType.Full; m_doctorRegInfo.RemainNums[num - 1] = text; m_doctorRegInfo.ToolTipTexts[num - 1] = text; } else if (text == "停诊") { m_doctorRegInfo.RegistionTypes[num - 1] = RegistionType.StopAdmission; m_doctorRegInfo.RemainNums[num - 1] = text; m_doctorRegInfo.ToolTipTexts[num - 1] = text; } else if (text == "预约") { m_doctorRegInfo.RemainNums[num - 1] = text; if (num >= 15) { m_doctorRegInfo.RegistionTypes[num - 1] = RegistionType.NoAllocation; m_doctorRegInfo.ToolTipTexts[num - 1] = "暂未放号"; } else { m_doctorRegInfo.RegistionTypes[num - 1] = RegistionType.Timeout; m_doctorRegInfo.ToolTipTexts[num - 1] = "已过预约"; } } else { m_doctorRegInfo.RegistionTypes[num - 1] = RegistionType.Empty; m_doctorRegInfo.RemainNums[num - 1] = text; m_doctorRegInfo.ToolTipTexts[num - 1] = text; } m_doctorRegInfo.OrderUrls[num - 1] = null; } } } else if (num == 0) { if (current2.SelectSingleNode("p/a") == null) { m_doctorRegInfo.Name = current2.InnerHtml.Trim(); } else { m_doctorRegInfo.Name = current2.SelectSingleNode("p/a").InnerHtml + "\n" + current2.SelectNodes("p")[1].InnerHtml; } } else { m_doctorRegInfo.ToolTipTexts[num - 1] = null; m_doctorRegInfo.OrderUrls[num - 1] = null; m_doctorRegInfo.RemainNums[num - 1] = null; m_doctorRegInfo.RegistionTypes[num - 1] = RegistionType.Other; } num++; } } //深度复制预约信息 depRegisterInfo.AddDoctorRegInfo(m_doctorRegInfo); } else if (attributeValue == "tr_t") { HtmlNodeCollection htmlNodeCollection4 = current.SelectNodes("td"); if (htmlNodeCollection4.Count >= 9) { for (int j = 1; j < 9; j++) { depRegisterInfo.RegisterDates[j - 1] = htmlNodeCollection4[j].InnerHtml.Replace("<br>", "\n"); } } } } } catch (Exception err) { m_lastError = "科室信息获取失败:" + err.Message; Logger.WriteError("科室信息获取失败", err); return(false); } return(true); }