# 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 e1f1f6f051
commit 53cc181d28

@ -2,7 +2,6 @@ package com.example.PersonalCenter;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@ -69,7 +68,7 @@ public class SearchServiceGet {
if(code!=0){ //查询成功,在开始解析数据
System.out.println("code==@@@@@@@@@@20"+code);
try {
name_back=jo.getString("message");//查询的主语
name_back=jo.getString("msg");//查询的主语
} catch (JSONException e) {
e.printStackTrace();
}
@ -79,18 +78,19 @@ public class SearchServiceGet {
try {
jo_data = jo.getJSONObject("data");
if(jo_data==null) System.out.println(("jo_data==null"));
else System.out.println("jo_data!=null");
} catch (JSONException e) {
e.printStackTrace();
}
JSONArray data_arr=new JSONArray();
// JSONArray data_arr=new JSONArray();
ArrayList<String> datas=new ArrayList<String>();
try {
// jo_data.toJSONArray(data_arr);
datas.add(jo_data.toString());
data_arr=jo.getJSONArray("data");
System.out.println("data_arr======"+data_arr.length());
} catch (JSONException e) {
// data_arr=jo.getJSONArray("data");
// System.out.println("data_arr======"+data_arr.length());
} catch (Exception e) {
e.printStackTrace();
}
//遍历data_arr把里面的数据放入ArrayList<String> content里
@ -132,7 +132,7 @@ public class SearchServiceGet {
content.add("推拿法");
content.add("大蒜蒸西瓜");
content.add("红枣糕");
// content.add("00");
}
}

@ -3,10 +3,13 @@ package com.example.SearchCenter;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.example.PersonalCenter.SearchServiceGet;
import com.example.Util.ConditionCode;
import com.example.Util.ReturnData;
import com.example.cmknowledgegraph.R;
@ -17,12 +20,12 @@ 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;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
public class SearchEntryActivity extends AppCompatActivity implements CardStackView.ItemExpendListener,ConditionCode{
@ -112,7 +115,6 @@ 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.add(new ContentData("我是您的用法哦~请您看看我嘞\n我无比的期待您的光临嘞\n我们没有连数据呢马上就有嘞"));
@ -155,9 +157,6 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
new_color[i]=color[i];
}
} catch (JSONException e) {
e.printStackTrace();
}
@ -167,7 +166,6 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
new_color[i]=color[i];
}
CardStackView mCardStack = (CardStackView)findViewById(R.id.cardStackView);
CMKGStackAdapter adapter = new CMKGStackAdapter(this,response);
mCardStack.setAdapter(adapter);
@ -184,15 +182,87 @@ 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));
mCardStack.setAnimatorAdapter(new UpDownAnimatorAdapter(mCardStack));
mCardStack.setAnimatorAdapter(new UpDownStackAnimatorAdapter(mCardStack));
/**
*
* nm
* nhmnhmnhm
* nhm nhmnhm
* nhmnhmnhm
*/
TextView asscoiate_text=findViewById(R.id.asscoiate_text);
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) {
SearchServiceGet.executeSearchGet(response.getMsg()+"吃什么药");
}
});
}else if(response.getCode()==DiseaseToMedicines){
/**
* nhmnhmnhm
*
*/
Random r=new Random();
for(int i=0;i<3;i++) {
TextView textView = findViewById(R.id.asscoiate_entry);
int index = r.nextInt(10) + 1;
textView.setText(content.get(index) + "能治什么病症");
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
SearchServiceGet.executeSearchGet(content.get(index) + "能治什么病");
}
});
}
}else if(response.getCode()==MedicineToOperation){
/**
*
* nhm nhmnhm
*/
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) {
SearchServiceGet.executeSearchGet(response.getMsg() + "能治什么病");
}
});
textView_2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
SearchServiceGet.executeSearchGet(response.getMsg() + "的证候");
}
});
textView_3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
SearchServiceGet.executeSearchGet(response.getMsg() + "的功能");
}
});
}else if(response.getCode()==MedicineToSymptom){
/**
*
* nhmnhmnhm
*/
}
}
}

@ -14,6 +14,22 @@
>
</com.loopeer.cardstack.CardStackView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:text="你可能感兴趣"
android:paddingLeft="50dp"
android:paddingTop="100dp"
android:id="@+id/asscoiate_text"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:paddingLeft="50dp"
android:paddingTop="10dp"
android:id="@+id/asscoiate_entry"
/>
</LinearLayout>

@ -1,3 +1,4 @@
<resources>
<string name="app_name">CMKnowledgeGraph</string>
<string name="associate">你可能感兴趣</string>
</resources>

Loading…
Cancel
Save