package chenglong.activitytest.pengintohospital.entity;
import org.json.JSONException;
import org.json.JSONObject;
/**
*
* 科室
* Created by LICHENGLONG on 2017-10-02.
*/
public class BasSection {
public Integer id;//科室id
public String sectionName;//科室名称
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getSectionName() {
return sectionName;
}
public void setSectionName(String sectionName) {
this.sectionName = sectionName;
}
public BasSection(Integer id, String sectionName){
this.id = id;
this.sectionName = sectionName;
}
public static BasSection sectionData(JSONObject json){
try {
return new BasSection(
json.getInt("id"),
json.getString("sectionName");
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
}
List<BasSection> listBasSection = new ArrayList<>();
/**
* 获取JSON科室数据
*/
public void findSectionData(){
AsyncHttpClient client = new AsyncHttpClient();
//你的JSON数据链接地址
client.get(AbAppConfig.DATA_URL + "appGVConsultation/findSectionData", null, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
try {
JSONObject object = new JSONObject(new String(responseBody));//获取json数据
JSONArray jsonArray = object.getJSONArray("obj");//获取数据集名称为obj的数据
Log.d("jsonArray数据输出:", String.valueOf(jsonArray));
for (int i = 0; i < jsonArray.length();i++) {
BasSection novels = BasSection.sectionData(jsonArray.getJSONObject(i));//把数据存在novels集合中
if (novels != null){
listBasSection.add(novels);
}
}
} catch (JSONException e) {
Toast.makeText(GV_Consultation.this, "数据请求失败,请稍后重试", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
//请求失败的回调处理
Toast.makeText(GV_Consultation.this, "请链接网络,稍后重试", Toast.LENGTH_SHORT).show();
}
});
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有