|
|
|
@ -80,7 +80,6 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
|
|
|
|
|
//获取response后,将这个json数据解析
|
|
|
|
|
ReturnData response = (ReturnData) bundle.getSerializable("msg");
|
|
|
|
|
System.out.println("code=!!!!!!!!1"+response.getCode());
|
|
|
|
|
Log.i("response+++++",response+"返回值");
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
@ -130,9 +129,11 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
List<ContentData> list = new LinkedList<>();
|
|
|
|
|
String data=(String)response.getData();
|
|
|
|
|
JSONObject jo=new JSONObject(data);
|
|
|
|
|
String medicine_symptom=jo.getString("symptom");
|
|
|
|
|
// JSONObject jo=new JSONObject(response.getData().toString());
|
|
|
|
|
String str=(String)response.getData();
|
|
|
|
|
System.out.println("返回的数据事:"+str);
|
|
|
|
|
JSONObject jo=new JSONObject(str.toString());
|
|
|
|
|
String medicine_symptom=jo.getString("fuction");
|
|
|
|
|
list.add(new ContentData(medicine_symptom));
|
|
|
|
|
lists.add(list);
|
|
|
|
|
String disease_names=new String(jo.getString("name"));
|
|
|
|
@ -183,20 +184,25 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
* 药——作用 联想搜索:nhm能治什么病,nhm的证候,nhm的功能
|
|
|
|
|
*/
|
|
|
|
|
TextView asscoiate_text=findViewById(R.id.asscoiate_text);//显示文本“你可能感兴趣”
|
|
|
|
|
String[] texts=new String[3];//存放listView中的显示的数据
|
|
|
|
|
// String[] texts=new String[3];//存放listView中的显示的数据,只针对
|
|
|
|
|
// String[] new_texts=new String[1];
|
|
|
|
|
// String[]
|
|
|
|
|
String[] texts;
|
|
|
|
|
|
|
|
|
|
if(response.getCode()==DiseaseToSymptom){
|
|
|
|
|
/**
|
|
|
|
|
* 病——症状 nm能吃什么药
|
|
|
|
|
*/
|
|
|
|
|
texts=new String[1];
|
|
|
|
|
texts[0]=response.getMsg()+"应该吃什么药";
|
|
|
|
|
model_Text=Model_Symptom;
|
|
|
|
|
model_Text=Model_Medicines;
|
|
|
|
|
}else if(response.getCode()==DiseaseToMedicines){
|
|
|
|
|
/**
|
|
|
|
|
* 病——药 nhm能指什么病,nhm能治什么病,nhm能治什么病
|
|
|
|
|
* 随机选三种药品
|
|
|
|
|
*/
|
|
|
|
|
Random r=new Random();
|
|
|
|
|
texts=new String[3];
|
|
|
|
|
for(int i=0;i<3;i++) {
|
|
|
|
|
index[i] = r.nextInt(9) + 1;
|
|
|
|
|
texts[i]=content.get(index[i])+"能治什么病症";
|
|
|
|
@ -207,6 +213,7 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
* 药——操作方法
|
|
|
|
|
* nhm能治什么病
|
|
|
|
|
*/
|
|
|
|
|
texts=new String[1];
|
|
|
|
|
texts[0]=response.getMsg()+"能治什么病";
|
|
|
|
|
model_Text=Model_Function;
|
|
|
|
|
}else {
|
|
|
|
@ -214,6 +221,7 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
*药——作用,能治什么病
|
|
|
|
|
* nhm 操作方法
|
|
|
|
|
*/
|
|
|
|
|
texts=new String[1];
|
|
|
|
|
texts[0]=response.getMsg()+"的用法";
|
|
|
|
|
model_Text=Model_Operation;
|
|
|
|
|
}
|
|
|
|
@ -246,6 +254,8 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
listView.setAdapter(view_adapter);
|
|
|
|
|
for(int i:new_color)
|
|
|
|
|
System.out.println("i="+i);
|
|
|
|
|
adapter.updateData(Arrays.asList(new_color),lists);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|