# Conflicts:
#	cmkg/pom.xml
#	cmkg/src/main/java/com/cmkg/cmkg/CmkgApplication.java
#	cmkg/src/main/java/com/cmkg/cmkg/Controller/QuestionController.java
#	cmkg/src/main/java/com/cmkg/cmkg/database/ReturnData.java
#	cmkg/src/main/java/com/cmkg/cmkg/node/medicine.java
#	cmkg/src/main/java/com/cmkg/cmkg/process/ModelProcess.java
#	cmkg/src/main/java/com/cmkg/cmkg/repository/MedicineRespository.java
#	cmkg/src/main/java/com/cmkg/cmkg/repository/QuestionRespository.java
#	cmkg/src/main/java/com/cmkg/cmkg/server/QuestionService.java
#	cmkg/src/main/java/com/cmkg/cmkg/server/impl/QuestionServiceImpl.java
#	cmkg/src/main/resources/application.properties
master
hanxueqing 5 years ago
parent 2ab1d8345d
commit 35b1e60173

@ -2,7 +2,10 @@ package com.example.SearchCenter;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
@ -12,6 +15,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;
@ -23,6 +28,7 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
@ -30,6 +36,8 @@ import java.util.Random;
public class SearchEntryActivity extends AppCompatActivity implements CardStackView.ItemExpendListener,ConditionCode{
public static ArrayList<String> content=new ArrayList<String>();//存储数据内容
public static String model_Text;
public static int[] index=new int[3];//在随机生成选定联想搜索产生的索引值
Integer[] color = {
R.color.holo_blue_bright,
R.color.holo_orange_light,
@ -174,17 +182,17 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
* nhm nhmnhm
* nhmnhmnhm
*/
TextView asscoiate_text=findViewById(R.id.asscoiate_text);
TextView[] textViews =new TextView[3];
String[] texts=new String[3];
TextView asscoiate_text=findViewById(R.id.asscoiate_text);//显示文本“你可能感兴趣”
String[] texts=new String[3];//存放listView中的显示的数据
if(response.getCode()==DiseaseToSymptom){
/**
* nm
*/
TextView textView_1=findViewById(R.id.asscoiate_entry);
textView_1.setText(response.getMsg()+"应该吃什么药");
texts[0]=(String)textView_1.getText();
TextView textView=findViewById(R.id.asscoiate_entry);
textView.setText(response.getMsg()+"应该吃什么药");
texts[0]=(String)textView.getText();
model_Text=Model_Symptom;
}else if(response.getCode()==DiseaseToMedicines){
/**
* nhmnhmnhm
@ -193,10 +201,11 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
Random r=new Random();
for(int i=0;i<3;i++) {
TextView textView = findViewById(R.id.asscoiate_entry);
int index = r.nextInt(9) + 1;
textView.setText(content.get(index) + "能治什么病症");
index[i] = r.nextInt(9) + 1;
textView.setText(content.get(index[i]) + "能治什么病症");
texts[i]=(String)textView.getText();
}
model_Text=Model_Medicines;
}else if(response.getCode()==MedicineToOperation){
/**
*
@ -205,24 +214,7 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
TextView textView_1=findViewById(R.id.asscoiate_entry);
textView_1.setText(response.getMsg()+"能治什么病");
texts[0]=(String)textView_1.getText();
// textView_1.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// new Thread(new Runnable() {
// @Override
// public void run() {
// ReturnData rd=cmkgWebServiceGet.executeHttpGet(publicStringUtil.questionArgsname+response.getMsg()+"作用",publicStringUtil.questionSearchURL);
// Intent intent=new Intent();
// Message m = new Message();
// Bundle bundle = new Bundle();
// bundle.putSerializable("msg", rd);
// intent.putExtras(bundle);
// intent.setClass(SearchEntryActivity.this,SearchEntryActivity.class);
// startActivity(intent);
// }
// }).start();
// }
// });
model_Text=Model_Function;
}else {
/**
*
@ -231,33 +223,37 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
TextView textView=findViewById(R.id.asscoiate_entry);
textView.setText(response.getMsg()+"的用法");
texts[0]=(String)textView.getText();
// textView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// new Thread(new Runnable() {
// @Override
// public void run() {
// ReturnData rd=cmkgWebServiceGet.executeHttpGet(publicStringUtil.questionArgsname+response.getMsg()+"用法",publicStringUtil.questionSearchURL);
// Intent intent=new Intent();
// Message m = new Message();
// Bundle bundle = new Bundle();
// bundle.putSerializable("msg", rd);
// intent.putExtras(bundle);
// intent.setClass(SearchEntryActivity.this,SearchEntryActivity.class);
// startActivity(intent);
// }
// }).start();
// }
// });
model_Text=Model_Operation;
}
ArrayAdapter<String> view_adapter = new ArrayAdapter<String>(SearchEntryActivity.this,android.R.layout.simple_list_item_1, texts);
ListView listView=findViewById(R.id.listview_group);
listView.setAdapter(view_adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
new Thread(new Runnable() {
@Override
public void run() {
ReturnData rd=null;
if(response.getCode()==DiseaseToMedicines) {
rd = cmkgWebServiceGet.executeHttpGet(publicStringUtil.questionArgsname + content.get(index[position]) + model_Text, publicStringUtil.questionSearchURL);
}
else{
rd= cmkgWebServiceGet.executeHttpGet(publicStringUtil.questionArgsname+response.getMsg()+model_Text, publicStringUtil.questionSearchURL);
}
Message m = new Message();
Bundle bundle = new Bundle();
bundle.putSerializable("msg", rd);
Intent intent = new Intent();
intent.setClass(SearchEntryActivity.this, SearchEntryActivity.class);
intent.putExtras(bundle);
startActivity(intent);
}
}).start();
}
});
listView.setAdapter(view_adapter);
adapter.updateData(Arrays.asList(new_color),lists);
}
}

@ -12,5 +12,15 @@ public interface ConditionCode {
public final int DiseaseToMedicines=200;
public final int MedicineToOperation=300;
public final int MedicineToSymptom=400;
/***
*Model_Symptom
* Model_Medicines
* Model_Operation
* Model_Function
*/
public final String Model_Symptom="的症状";
public final String Model_Medicines="治疗方法";
public final String Model_Operation="用法";
public final String Model_Function="作用";
}

@ -16,8 +16,9 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:textSize="24sp"
android:text="你可能感兴趣"
android:textStyle="bold"
android:paddingLeft="50dp"
android:paddingTop="100dp"
android:id="@+id/asscoiate_text"
@ -35,7 +36,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="50dp"
android:paddingTop="100dp"
android:paddingTop="50dp"
android:background="@color/holo_blue_light"
android:id="@+id/listview_group"/>

Loading…
Cancel
Save