|
@@ -10,6 +10,7 @@ import org.diagbot.entity.node.base.BaseNode;
|
|
|
import org.apache.commons.collections4.IteratorUtils;
|
|
|
import org.diagbot.repository.*;
|
|
|
import org.diagbot.vo.domain.FeatureRate;
|
|
|
+import org.diagbot.vo.domain.ResponseData;
|
|
|
import org.diagbot.vo.domain.SearchData;
|
|
|
import org.neo4j.driver.v1.types.Node;
|
|
|
import org.neo4j.driver.v1.types.Path;
|
|
@@ -192,6 +193,83 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResponseData getDis(SearchData searchData) {
|
|
|
+ ResponseData responseData = new ResponseData();
|
|
|
+ List<String> newList = new ArrayList<>();
|
|
|
+ List<String> inputList = new ArrayList<>();
|
|
|
+ Map<String, Map<String, String>> inputs = searchData.getInputs();
|
|
|
+ Set<String> ss = inputs.keySet();
|
|
|
+ inputList.addAll(ss);
|
|
|
+ //图谱计算是否有组合词
|
|
|
+ List<Map<String, Object>> collectionWord = baseNodeRepository.getCollectionWord(inputList);
|
|
|
+ if(collectionWord !=null && collectionWord.size()>0){
|
|
|
+ for (Map<String, Object> word:collectionWord) {
|
|
|
+ String jundgement = word.get("jundgement").toString();
|
|
|
+ String standName = word.get("standName").toString();
|
|
|
+ if("TRUE".equals(jundgement)){
|
|
|
+ inputList.add(standName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<Map<String, Object>> collectJYWord = baseNodeRepository.getCollectJYWord(inputList);
|
|
|
+ if(collectJYWord !=null && collectJYWord.size()>0){
|
|
|
+ for (Map<String, Object> word:collectJYWord) {
|
|
|
+ String fild = word.get("fild").toString();
|
|
|
+ String[] typeCollect = (String[])word.get("typeCollect");
|
|
|
+ if(typeCollect.length == 1 && "近义词".equals(typeCollect[0].toString())){
|
|
|
+ List<Map<String, Object>> jyWord = baseNodeRepository.getJYWord(fild);
|
|
|
+ if(jyWord !=null && jyWord.size()>0){
|
|
|
+ for (Map<String, Object> ji:jyWord) {
|
|
|
+ String js = ji.get("js").toString();
|
|
|
+ inputList.remove(fild);
|
|
|
+ inputList.add(js);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ newList.addAll(inputList);
|
|
|
+ while (newList.size()>0){
|
|
|
+ List<Map<String, Object>> condition = baseNodeRepository.getCondition(newList, inputList);
|
|
|
+ newList.clear();
|
|
|
+ if(condition !=null && condition.size()>0){
|
|
|
+ for (Map<String, Object> cd:condition) {
|
|
|
+ String conditionName = cd.get("condition").toString();
|
|
|
+ String jundgement = cd.get("jundgement").toString();
|
|
|
+ if ("true".equals(jundgement)) {
|
|
|
+ newList.add(conditionName);
|
|
|
+ inputList.add(conditionName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<String> que = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> disease = baseNodeRepository.getDisease(inputList);
|
|
|
+ if(disease !=null && disease.size()>0){
|
|
|
+ for (Map<String, Object> d: disease) {
|
|
|
+ String diseaseName = d.get("name").toString();
|
|
|
+ String relationType = d.get("relationType").toString();
|
|
|
+ if("确诊".equals(relationType) || "拟诊".equals(relationType)){
|
|
|
+ que.add(diseaseName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<FeatureRate> featureRates = new ArrayList<>();
|
|
|
+ if(que !=null && que.size()>0){
|
|
|
+ for (String quezhen:que) {
|
|
|
+ FeatureRate featureRate = new FeatureRate();
|
|
|
+ featureRate.setFeatureName(quezhen);
|
|
|
+ featureRate.setExtraProperty("");
|
|
|
+ featureRate.setDesc("");
|
|
|
+ featureRate.setRate("neo4j");
|
|
|
+ featureRates.add(featureRate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ responseData.setDis(featureRates);
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, List<FeatureRate>> getLisPacs(SearchData searchData) {
|
|
|
Map<String, List<FeatureRate>> lisPacsFeature = new HashMap<>();
|