public ArrayList<SpecificCategories> getSpecificCategory(Object res) {
    ArrayList<SpecificCategories> specificCategories = null;
    JSONObject object;
    try {
      object = new JSONObject(res.toString());
      JSONArray array = object.getJSONArray("specificCategories");
      if (array != null && !array.equals("[]")) {
        specificCategories = new ArrayList<SpecificCategories>();
        for (int i = 0; i < array.length(); i++) {
          SpecificCategories specificCategory = new SpecificCategories();
          JSONObject object2 = array.optJSONObject(i);

          specificCategory.setSpecificCategories_id(
              object2.optInt("specificCategories_id")); // 详细分类ID
          specificCategory.setAllCategories_id(object2.optInt("allCategories_id")); // 全部分类ID
          specificCategory.setSpecificCategories_name(
              object2.optString("specificCategories_name")); // 详细分类地址
          specificCategories.add(specificCategory);
        }
      }

    } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return specificCategories;
  }
  public Patient findRegisterInfo(String patientId) {

    Patient patient = new Patient();

    try {
      String url = propertyUrl + "findRegisterInfo.do";
      HttpPost request = new HttpPost(url);

      List<NameValuePair> params = new ArrayList<NameValuePair>();

      params.add(new BasicNameValuePair("patientId", patientId));

      request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));

      HttpResponse response = UserValidationImpl.httpClient.execute(request);
      if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {

        String str = EntityUtils.toString(response.getEntity());

        JSONObject rer = new JSONObject(str);

        JSONObject re = rer.getJSONObject("reObject");

        boolean success = re.getBoolean("success");

        if (!success) {
          return null;
        }

        JSONArray ja = re.getJSONArray("data");

        if (ja == null) {
          return null;
        }
        if (ja.equals(null)) {
          return null;
        }
        if (ja.isNull(0)) {
          return null;
        }

        JSONObject jobj = ja.getJSONObject(0);

        patient.setPatientId(patientId);
        patient.setPatientName(jobj.getString("patientName"));
        patient.setAge(jobj.getString("age"));
        patient.setSex(jobj.getString("sex"));
        patient.setSeatNo("001");
        patient.setDiseaseName(jobj.getString("diseaseName"));
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return patient;
  }
 private List<String> getBeforeAfterMessages(JSONArray newJson, JSONArray oldJson)
     throws JSONException {
   List<String> result = new ArrayList<String>();
   int i = 0;
   while (i < newJson.length()) {
     if (oldJson.length() < i) {
       result.add("a new value: " + newJson.get(i));
     } else if (this.isJSONObject(newJson, i)) {
       result.addAll(
           this.getBeforeAfterMessages(newJson.getJSONObject(i), oldJson.getJSONObject(i)));
     } else if (this.isJSONArray(newJson, i)) {
       result.addAll(
           this.getBeforeAfterMessages(newJson.getJSONArray(i), oldJson.getJSONArray(i)));
     } else if (!newJson.equals(oldJson)) {
       result.add(this.getMessage(newJson, oldJson, i));
     }
     i++;
   }
   return result;
 }