package org.diagbot.graph.jdbc;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import java.util.ArrayList;

public class gdbtest {
    public static void main(String[] args) {
        ArrayList<String> lisres = new ArrayList<>();
        try {

            String jsonstr = "{" +
                    "\"age\":20," +
                    "\"diag\":\"上呼吸道感染，肺炎\"," +
                    "\"disease\":\"心脏病\"," +
                    "\"featureType\":\"1\"," +
                    "\"lis\":[" +
                    "{" +
                    "\"detailName\":\"红细胞计数\"," +
                    "\"maxValue\":5.5," +
                    "\"minValue\":3.5," +
                    "\"name\":\"血常规\"," +
                    "\"otherValue\":\"阳性\"," +
                    "\"units\":\"10^12/L\"," +
                    "\"value\":10" +
                    "}," +
                    "{" +
                    "\"detailName\":\"白细胞计数\"," +
                    "\"maxValue\":10," +
                    "\"minValue\":4," +
                    "\"name\":\"血常规\"," +
                    "\"otherValue\":\"\"," +
                    "\"units\":\"10^9/L\"," +
                    "\"value\":8" +
                    "}," +
                    "{" +
                    "\"detailName\":\"颜色\"," +
                    "\"maxValue\":\"\"," +
                    "\"minValue\":\"\"," +
                    "\"name\":\"脑脊液常规\"," +
                    "\"otherValue\":\"白色\"," +
                    "\"units\":\"10^9/L\"," +
                    "\"value\":\"\"" +
                    "}," +
                    "{" +
                    "\"detailName\":\"空腹血糖\"," +
                    "\"maxValue\":\"\"," +
                    "\"minValue\":\"4.2\"," +
                    "\"name\":\"空腹血糖\"," +
                    "\"otherValue\":\"\"," +
                    "\"units\":\"mmol/L\"," +
                    "\"value\":\"2\"" +
                    "}" +
                    "]," +
                    "\"other\":\"\"," +
                    "\"pacs\":\"\"," +
                    "\"past\":\"\"," +
                    "\"sex\":3," +
                    "\"symptom\":\"咳嗽1天\"," +
                    "\"vital\":\"\"" +
                    "}";

            JSONObject jobj = JSONObject.parseObject(jsonstr);
            JSONArray jarray = jobj.getJSONArray("lis");

            Neo4jAPI napi = new Neo4jAPI(DriverManager.newDrive("192.168.3.201:7687", "neo4j", "123456"));
            lisres = napi.AnalysisLISResult(jarray);

            for (String item:lisres) {
                System.out.println(item);
            }

            napi.CloseDriver();
        }
        catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
