|
|
|
@ -11,6 +11,8 @@ import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
|
|
|
|
|
|
import com.example.Util.ConditionCode;
|
|
|
|
|
import com.example.Util.ReturnData;
|
|
|
|
|
import com.example.Util.cmkgWebServiceGet;
|
|
|
|
|
import com.example.Util.publicStringUtil;
|
|
|
|
|
import com.example.cmknowledgegraph.R;
|
|
|
|
|
import com.loopeer.cardstack.AllMoveDownAnimatorAdapter;
|
|
|
|
|
import com.loopeer.cardstack.CardStackView;
|
|
|
|
@ -19,6 +21,7 @@ import com.loopeer.cardstack.UpDownStackAnimatorAdapter;
|
|
|
|
|
|
|
|
|
|
import org.json.JSONArray;
|
|
|
|
|
import org.json.JSONException;
|
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
@ -114,13 +117,12 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
*/
|
|
|
|
|
Log.i("hah",""+(String)response.getData());
|
|
|
|
|
JSONArray jsonArray = new JSONArray((String)response.getData());
|
|
|
|
|
List<ContentData> list=new LinkedList<>();
|
|
|
|
|
for(int i=0;i<jsonArray.length();i++){
|
|
|
|
|
List<ContentData> list=new LinkedList<>();
|
|
|
|
|
list.add(new ContentData("我是您的用法哦~请您看看我嘞\n我无比的期待您的光临嘞\n我们没有连数据呢,马上就有嘞!"));
|
|
|
|
|
lists.add(list);
|
|
|
|
|
content.add((String) jsonArray.get(i));
|
|
|
|
|
lists.add(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new_color=new Integer[jsonArray.length()];
|
|
|
|
|
}else if(code==MedicineToOperation) {
|
|
|
|
|
/**
|
|
|
|
@ -138,8 +140,8 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
new_color=new Integer[1];
|
|
|
|
|
}else{
|
|
|
|
|
/**
|
|
|
|
|
* //返回的是药的主治症状
|
|
|
|
|
* 标题是药的名字,内容是主治症状
|
|
|
|
|
* //返回的是药的主治症状和对应的
|
|
|
|
|
* 标题是药的名字和“可以治疗的疾病”,内容是症状,和十种药物
|
|
|
|
|
*/
|
|
|
|
|
// for(int i = 0; i< content.size(); i++){
|
|
|
|
|
// List<ContentData> list=new LinkedList<>();
|
|
|
|
@ -147,8 +149,17 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
// lists.add(list);
|
|
|
|
|
// }
|
|
|
|
|
List<ContentData> list = new LinkedList<>();
|
|
|
|
|
list.add(new ContentData((String)response.getData()));
|
|
|
|
|
JSONObject jo=(JSONObject)response.getData();
|
|
|
|
|
String medicine_symptom=jo.getString("symptom");
|
|
|
|
|
list.add(new ContentData(medicine_symptom));
|
|
|
|
|
lists.add(list);
|
|
|
|
|
String disease_names=new String(jo.getString("name"));
|
|
|
|
|
JSONArray ja=new JSONArray(disease_names);
|
|
|
|
|
for(int i=0;i<ja.length();i++){
|
|
|
|
|
List<ContentData> list_1=new LinkedList<>();
|
|
|
|
|
list_1.add(new ContentData(content.get(i)));
|
|
|
|
|
lists.add(list);
|
|
|
|
|
}
|
|
|
|
|
new_color=new Integer[1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -177,11 +188,11 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
* 病-症状:标题是名字,内容是症状
|
|
|
|
|
* 病-治疗药品:标题是药的名字,内容是药的用法(暂时不做)
|
|
|
|
|
* 药-用法:标题是药的名字,内容是药的用法
|
|
|
|
|
* 药-作用:标题是药的名字,内容是药的用法
|
|
|
|
|
* 药-作用:标题是药的名字和 “可以治疗的疾病”,内容是药的用法
|
|
|
|
|
*
|
|
|
|
|
* 每种不同的情况对应不同的状态码,用接口实现状态码
|
|
|
|
|
*/
|
|
|
|
|
adapter.updateData(Arrays.asList(new_color),lists);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// adapter.updateData(Arrays.asList(color),lists);
|
|
|
|
|
mCardStack.setAnimatorAdapter(new AllMoveDownAnimatorAdapter(mCardStack));
|
|
|
|
@ -205,7 +216,7 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
textView_1.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
|
|
|
|
|
cmkgWebServiceGet.executeHttpGet(publicStringUtil.questionSearchURL,publicStringUtil.questionSearchURL+response.getMsg()+"吃什么药");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}else if(response.getCode()==DiseaseToMedicines){
|
|
|
|
@ -221,47 +232,39 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
textView.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
|
|
|
|
|
cmkgWebServiceGet.executeHttpGet(publicStringUtil.questionSearchURL,publicStringUtil.questionSearchURL+response.getMsg()+"作用");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}else if(response.getCode()==MedicineToOperation){
|
|
|
|
|
/**
|
|
|
|
|
* 药——操作方法
|
|
|
|
|
* nhm能治什么病 ,nhm的证候,nhm的功能
|
|
|
|
|
* nhm能治什么病
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
TextView textView_1=findViewById(R.id.asscoiate_entry);
|
|
|
|
|
TextView textView_2=findViewById(R.id.asscoiate_entry);
|
|
|
|
|
TextView textView_3=findViewById(R.id.asscoiate_entry);
|
|
|
|
|
textView_1.setText(response.getMsg()+"能治什么病");
|
|
|
|
|
textView_2.setText(response.getMsg()+"的证候");
|
|
|
|
|
textView_3.setText(response.getMsg()+"的功能");
|
|
|
|
|
textView_1.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
|
|
|
|
|
cmkgWebServiceGet.executeHttpGet(publicStringUtil.questionSearchURL,publicStringUtil.questionSearchURL+response.getMsg()+"作用");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
textView_2.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
textView_3.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
}else {
|
|
|
|
|
/**
|
|
|
|
|
*药——作用,能治什么病
|
|
|
|
|
* nhm 操作方法
|
|
|
|
|
*/
|
|
|
|
|
TextView textView=findViewById(R.id.asscoiate_entry);
|
|
|
|
|
textView.setText(response.getMsg()+"的用法");
|
|
|
|
|
textView.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
|
|
|
|
|
cmkgWebServiceGet.executeHttpGet(publicStringUtil.questionSearchURL,publicStringUtil.questionSearchURL+response.getMsg()+"用法");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}else if(response.getCode()==MedicineToSymptom){
|
|
|
|
|
/**
|
|
|
|
|
*药——作用
|
|
|
|
|
* nhm能治什么病,nhm的证候,nhm的功能
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
adapter.updateData(Arrays.asList(new_color),lists);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|