package com.dgt.graphdemo;

import com.alibaba.fastjson.JSON;
import com.dgt.graphdemo.entity.GraphData;
import com.dgt.graphdemo.entity.GraphDatilData;
import com.dgt.graphdemo.entity.RepTest;
import com.dgt.graphdemo.service.DatilFormGraphService;
import com.dgt.graphdemo.utils.Neo4jUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.ogm.model.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;


@RunWith(SpringRunner.class)
@SpringBootTest

public class GraphdemoApplicationTests {

    @Autowired
    Neo4jUtil neo4jUtil;
    @Autowired
    RepTest repTest;

    @Autowired
    DatilFormGraphService datilFormGraphService;

    @Test
    public void contextLoads() {
        String query="MATCH p=(c:Claimno{id:'A000CHD1830000303355'})-[*1..5]->(m) RETURN p";
        String query1="MATCH (n:`医院`)  RETURN distinct(n) limit 100";
        GraphData graphData = neo4jUtil.GetGraph(query);
        String s = JSON.toJSONString(graphData);
        System.out.println(s);

    }

    @Test
    public void graphTest(){
   /*     Result graph = repTest.getGraph();
        graph.forEach(seg ->seg.forEach((k,v)-> System.out.println("key:"+k+"value:"+v)));
        System.out.println("==========");*/

    }

    @Test
    public void test1(){
        GraphDatilData gg = datilFormGraphService.getDatilGraph("CHD1830000303355");
        System.out.println(gg);

    }

}
