function onNodeClick(data) {
//只能选择体检分组
if (data.GroupType == 1) {
$("#<%=hidOrgId.ClientID%>").val(data.Id);
$("#<%=hidOrgName.ClientID%>").val(data.Text);
$("#<%=txtGroup.ClientID%>").val(data.Text);
$("#divCheckUpTree").dialog("close");
$("#<%=ddlDrs.ClientID %>").html("");
var url = "AjaxHelper.ashx?validatorType=GetDoctorByOrgId&orgID=" + data.Id;
$.getJSON(url, function (json) {
//debugger
if (json != null) {
$.each(json, function (i) {
$("#<%=ddlDrs.ClientID %>").append($("<option></option>").val(json[i].DrID).html(json[i].DrName))
});
}
});
$("#<%=ddlDrs.ClientID %>").append($("<option selected='true'></option>").val("-1").html("请选择"))
// $("<option></option>").val("").html("").appendTo("#<%=ddlDrs.ClientID %>");
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Xys.Remp.Enterprise.Services.Interface;
using Xys.Remp.Enterprise.Entity;
using Xys.Remp.Core;
using Xys.Remp.Security;
using System.Web.SessionState;
using Xys.Remp.Enterprise.Common;
using RempWeb = Xys.Remp.Web;
using System.Text;
using Xys.Remp.Serialize.Json;
namespace Xys.Stroke.Web.Archives
{
public class AjaxHelper : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
string validatorType = RempWeb.ComUtils.GetQueryStringToString("validatorType");
if (validatorType != string.Empty)
{
if (validatorType == "GetDoctorByOrgId")
{
int? orgID = RempWeb.ComUtils.GetQueryStringToInt("orgID");
if (orgID.HasValue)
{
OrganizationInfo orgInfo = ServiceFactory.GetService<IOpenOrganizationService>().GetFirstParentOrgByGroupId((int)orgID);
if (orgInfo != null)
{
List<DoctorInfo> doctorList = ServiceFactory.GetService<IOpenDoctorService>().GetDoctorListAndUnderByOrgId((int)orgInfo.OrgID, true);
if (doctorList.Count > 0)
{
//StringBuilder sb = new StringBuilder();
//sb.Append("[");
//foreach (DoctorInfo doctor in doctorList)
//{
// sb.Append("{\"ID\":\"" + doctor.ID + "\",\"Name\":\"" + doctor.DrName + "\"},");
//}
//sb.Remove(sb.Length - 1, 1);
//sb.Append("]");
ResponseValidatorValue(context,doctorList.JsonSerialize());
}
else
{
ResponseValidatorValue(context, "");
}
}
}
}
//else if (validatorType == "")
//{
//}
}
}
public void ResponseValidatorValue(HttpContext context, string validatorValue)
{
context.Response.Expires = 0;
context.Response.Buffer = true;
context.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
context.Response.AddHeader("pragma", "no-cache");
context.Response.CacheControl = "no-cache";
context.Response.ClearContent();
context.Response.ContentType = ("text/plain");
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.Write(validatorValue);
context.Response.Flush();
context.Response.End();
}
public bool IsReusable
{
get
{
return false;
}
}
}
}