# 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 61c81d7dbe
commit 14748debba

@ -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;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>

@ -35,7 +35,6 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
api 'com.hankcs:hanlp:portable-1.7.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.alibaba:fastjson:1.2.62'
implementation 'com.loopeer.library:cardstack:1.0.2'
implementation 'androidx.cardview:cardview:1.0.0'

@ -12,16 +12,12 @@ import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.Util.ConditionCode;
import com.example.Util.ReturnData;
import com.example.cmknowledgegraph.R;
import com.loopeer.cardstack.CardStackView;
import com.loopeer.cardstack.StackAdapter;
import org.json.JSONArray;
import org.json.JSONException;
import java.util.List;
public class CMKGStackAdapter extends StackAdapter<Integer> implements ConditionCode {
@ -118,8 +114,6 @@ public class CMKGStackAdapter extends StackAdapter<Integer> implements Condition
titleText.setText(returnData.getMsg());
}else {
//对应治疗方法,那么标题就要有多个
titleText.setText(SearchEntryActivity.content.get(title_num));
title_num++;
}

@ -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 nhmnhm
* 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){
/**
*
* nhmnhmnhm
*/
}
adapter.updateData(Arrays.asList(new_color),lists);
}
}

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".SearchEntryActivity">

Loading…
Cancel
Save