parent
7e09d63e63
commit
9711a7aa12
@ -1,17 +1,43 @@
|
||||
package com.cmkg.cmkg.Controller;
|
||||
|
||||
|
||||
import com.cmkg.cmkg.database.ReturnData;
|
||||
import com.cmkg.cmkg.repository.QuestionRespository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/rest/cmkg/question")
|
||||
public class QuestionController {
|
||||
|
||||
//做个小测试
|
||||
@Autowired
|
||||
public QuestionRespository questionRespository;
|
||||
|
||||
ReturnData rd=new ReturnData();
|
||||
@RequestMapping("/hello")
|
||||
public ReturnData JudgeAtrribute(@RequestParam("name") String name){
|
||||
|
||||
//去每个表里做查找,找到了的话做查询
|
||||
System.out.println(questionRespository);
|
||||
System.out.println(name);
|
||||
Long i = questionRespository.getDiseaseId(name);
|
||||
System.out.println(i);
|
||||
if(questionRespository.getDiseaseId(name)!=0){//说明输入的事病症
|
||||
String symptom=questionRespository.getDiseaseSymptom(name);
|
||||
String[] tomedicine=questionRespository.getDiseaseToMedicine(name);
|
||||
rd.setDiseaseSymptom(name);
|
||||
rd.setTomedicie(tomedicine);
|
||||
return rd;
|
||||
}else{//说明输入的是养生方法或药品名称
|
||||
String operation=questionRespository.getMedicineOperation(name);
|
||||
String syndromes=questionRespository.getMedicineSyndromes(name);
|
||||
rd.setOperation(operation);
|
||||
rd.setSyndromes(syndromes);
|
||||
return rd;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
package com.cmkg.cmkg.database;
|
||||
|
||||
public class returnDisease {
|
||||
|
||||
private String symptom;
|
||||
private String tomedicie;
|
||||
|
||||
public void setSymptom(String symptom){
|
||||
this.symptom=symptom;
|
||||
}
|
||||
|
||||
public void setTomedicie(String tomedicie){
|
||||
this.tomedicie=tomedicie;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue