public HttpResponseMessage GetComplaintedDoctor(int year, int month, string percent) { // 被投诉是指某个医生的Rank小于等于两颗星星 // 在evaluation表找到每一个doc_id下的数据总数 找到doc_id对应的rank小于等于2的数量 // 如果这个比例大于percent // 记录下这个医生的doc_id // 返回一个doc_id的列表 HttpResponseMessage response = new HttpResponseMessage(); JArray strArray = new JArray(); ArrayList list = null; try { list = ManagementHelper.GetComplaintedDoctor(year, month, double.Parse(percent)); } catch (Exception e) { response.Content = new StringContent(e.Message); response.StatusCode = HttpStatusCode.BadRequest; return(response); } if (list == null) { response.Content = new StringContent("查询过程出现异常"); response.StatusCode = HttpStatusCode.NotFound; } else { if (list.Count == 0) { strArray.Add("0"); response.Content = new StringContent(JsonObjectConverter.ObjectToJson(strArray)); } else { strArray.Add("1"); for (int i = 1; i < list.Count; i++) { EmployeeInfo emp = (EmployeeInfo)list[i]; JObject obj = new JObject(); obj.Add("department", emp.department); obj.Add("clinic", emp.clinic); obj.Add("id", emp.employee_id); obj.Add("name", emp.name); obj.Add("compliant_rate", emp.compliant_rate.ToString()); strArray.Add(obj); } } response.Content = new StringContent(JsonObjectConverter.ObjectToJson(strArray)); response.StatusCode = HttpStatusCode.OK; } return(response); }