# 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 14748debba
commit 2ab1d8345d

@ -19,7 +19,7 @@
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>

@ -3,16 +3,15 @@ package com.example.SearchCenter;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
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;
@ -24,7 +23,6 @@ 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;
@ -51,8 +49,6 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
private CMKGStackAdapter cmkgStackAdapter;
Integer[] new_color;
String[] name = {"数据结构","计算机网络","编译原理","C语言","算法设计","FPGA编程"};
String[] scores = {"77","87","65","98","74","80"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -83,29 +79,11 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
String message = response.getMsg();
Log.i("msg:",""+message);
// if(code== ConditionCode.DiseaseToMedicines || code == ConditionCode.MedicineToSymptom){
//// //病的治疗方法和药的作用,返回数组
//// JSONArray jsonArray = jsonObject.getJSONArray("data");
//// Log.i("length==",""+jsonArray.length());
//// for(int i=0;i<jsonArray.length();i++) Log.i("dataJsonArray=====",""+jsonArray.get(i));
//// }if(code == ConditionCode.DiseaseToSymptom || code ==ConditionCode.MedicineToOperation){
//// //病的症状或者药的用法,返回字符串
//// String jsonString = jsonObject.getString("data");
//// Log.i("dataString=====",jsonString);
////
//// }
if(code == DiseaseToSymptom){
/**
* //返回的是病症
* listslist
*/
// for(int i=0;i<content.size();i++){
// System.out.println("content="+content.get(i));
// List<ContentData> list=new LinkedList<>();
// list.add(new ContentData(content.get(i)));
// lists.add(list);
// }
List<ContentData> list = new LinkedList<>();
list.add(new ContentData((String)response.getData()));
lists.add(list);
@ -129,11 +107,7 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
* //返回的是药的用法
* //标题就是药品的名字,内容是用法
*/
// for(int i=0;i<content.size();i++){
// List<ContentData> list=new LinkedList<>();
// list.add(new ContentData(content.get(i)));
// lists.add(list);
// }
List<ContentData> list = new LinkedList<>();
list.add(new ContentData((String)response.getData()));
lists.add(list);
@ -143,11 +117,7 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
* //返回的是药的主治症状和对应的
*
*/
// for(int i = 0; i< content.size(); i++){
// List<ContentData> list=new LinkedList<>();
// list.add(new ContentData(content.get(i)));
// lists.add(list);
// }
List<ContentData> list = new LinkedList<>();
JSONObject jo=(JSONObject)response.getData();
String medicine_symptom=jo.getString("symptom");
@ -193,8 +163,6 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
*
*/
// adapter.updateData(Arrays.asList(color),lists);
mCardStack.setAnimatorAdapter(new AllMoveDownAnimatorAdapter(mCardStack));
mCardStack.setAnimatorAdapter(new UpDownAnimatorAdapter(mCardStack));
mCardStack.setAnimatorAdapter(new UpDownStackAnimatorAdapter(mCardStack));
@ -207,18 +175,16 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
* nhmnhmnhm
*/
TextView asscoiate_text=findViewById(R.id.asscoiate_text);
TextView[] textViews =new TextView[3];
String[] texts=new String[3];
if(response.getCode()==DiseaseToSymptom){
/**
* nm
*/
TextView textView_1=findViewById(R.id.asscoiate_entry);
textView_1.setText(response.getMsg()+"应该吃什么药");
textView_1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
cmkgWebServiceGet.executeHttpGet(publicStringUtil.questionSearchURL,publicStringUtil.questionSearchURL+response.getMsg()+"吃什么药");
}
});
texts[0]=(String)textView_1.getText();
}else if(response.getCode()==DiseaseToMedicines){
/**
* nhmnhmnhm
@ -227,14 +193,9 @@ 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(10) + 1;
int index = r.nextInt(9) + 1;
textView.setText(content.get(index) + "能治什么病症");
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
cmkgWebServiceGet.executeHttpGet(publicStringUtil.questionSearchURL,publicStringUtil.questionSearchURL+response.getMsg()+"作用");
}
});
texts[i]=(String)textView.getText();
}
}else if(response.getCode()==MedicineToOperation){
/**
@ -243,12 +204,25 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
*/
TextView textView_1=findViewById(R.id.asscoiate_entry);
textView_1.setText(response.getMsg()+"能治什么病");
textView_1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
cmkgWebServiceGet.executeHttpGet(publicStringUtil.questionSearchURL,publicStringUtil.questionSearchURL+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();
// }
// });
}else {
/**
*
@ -256,15 +230,33 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
*/
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()+"用法");
}
});
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();
// }
// });
}
adapter.updateData(Arrays.asList(new_color),lists);
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);
}
}

@ -9,11 +9,9 @@
<com.loopeer.cardstack.CardStackView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/cardStackView"
>
</com.loopeer.cardstack.CardStackView>
android:layout_width="match_parent"
android:layout_height="299dp"></com.loopeer.cardstack.CardStackView>
<TextView
android:layout_width="wrap_content"
@ -29,8 +27,16 @@
android:layout_height="wrap_content"
android:textSize="14sp"
android:paddingLeft="50dp"
android:paddingTop="10dp"
android:paddingTop="30dp"
android:background="@color/holo_blue_light"
android:id="@+id/asscoiate_entry"
/>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="50dp"
android:paddingTop="100dp"
android:background="@color/holo_blue_light"
android:id="@+id/listview_group"/>
</LinearLayout>
Loading…
Cancel
Save