#235Mysql\u6570\u636E\u5E93
url_235 = jdbc:mysql://192.168.2.235:3306/scale?useUnicode=true&characterEncoding=UTF-8
userNmae_235 = root
pass_235 = diagbot@20180822

# neo4j bolt credentials
#\u7EBF\u4E0A\u4F7F\u7528
bolt.uri=bolt://192.168.2.232
bolt.user=neo4j
bolt.passwd=root


#\u6D4B\u8BD5\u4F7F\u7528
bolt112.uri=bolt://192.168.3.112
bolt112.user=neo4j
bolt112.passwd=123456

#\u63A8\u786E\u8BCA\u5904\u7406sql
#\u67E5\u627E\u662F\u5426\u6709\u7EC4\u5408\u7684\u8BCD
searchCollection=with fildList as data unwind data as row \n \
match (n)-[r:\u5C5E\u4E8E]->(m)-[r1:\u7EC4\u5408]->(k) \n \
where n.name= row \n \
return m.name as condition, count(distinct r)>=m.path as jundgement, labels(m)[0] as label,k.name as standName

searchCollection1=match (n)-[r:\u5C5E\u4E8E]->(m)-[r1:\u7EC4\u5408]->(k) \n \
where n.name in fildList \n \
return m.name as condition, count(distinct r)>=m.path as jundgement, labels(m)[0] as label,k.name as standName
#\u67E5\u627E\u8FD1\u4E49\u8BCD\u7CBE\u534E\u7248
serchCollect=match (n)-[r:\u8BCA\u65AD\u4F9D\u636E|:\u8FD1\u4E49\u8BCD]->(e) where n.name in fildList return n.name as fild,collect(distinct type(r)) as typeCollect
#\u67E5\u627E\u80FD\u63A8\u51FA\u8BCA\u65AD\u4F9D\u636E\u7684\u8BCD
searchCondition=with newList as data unwind data as row\n \
match (l)-[r:\u8BCA\u65AD\u4F9D\u636E]->(m)\n \
where l.name= row\n \
with m,fildList as data unwind data as row\n \
match (n)-[r:\u8BCA\u65AD\u4F9D\u636E]->(m)\n \
where n.name= row\n \
return m.name as condition, count(distinct r)>=m.path as jundgement, labels(m)[0] as label

searchCondition1=match (l)-[r:\u8BCA\u65AD\u4F9D\u636E]->(m)\n \
where l.name in newList\n \
with m,fildList as data\n \
match (n)-[r:\u8BCA\u65AD\u4F9D\u636E]->(m)\n \
where n.name in data\n \
with m.name as condition, count(distinct r) as sd,m.path as jundgement\n \
where sd>=jundgement\n \
return condition
#\u67E5\u627E\u786E\u8BCA,\u62DF\u8BCA\u7684\u8BED\u53E5
searchQuezhen=match (n)-[r:\u786E\u8BCA|:\u62DF\u8BCA]->(m:Disease)\n \
where n.name in fildList\n \
with distinct m,r\n \
return m.name as name, labels(m)[0] as label,type(r) as relationType

#\u63A8\u9001\u786E\u8BCA,\u65B0\u7ED3\u6784,\u5305\u542B\u5173\u8054\u8BCD
#\u67E5\u627E\u8FD9\u4E2A\u8BCD\u5C5E\u4E8E\u54EA\u4E2A\u5E8F\u53F7\u96C6\u5408
searchNumColl=match(h)-[r:\u5C5E\u4E8E|:\u8BCA\u65AD\u4F9D\u636E]->(c:Condition)\n \
where h.name in startList\n \
with c.name as v,count(distinct r)>=c.path as hh\n \
where hh =true\n \
return v
#\u67E5\u627E\u8BCA\u65AD\u4F9D\u636E
searchNewCondition=match (l:Condition)-[r:\u8BCA\u65AD\u4F9D\u636E]->(m:Condition)\n \
where l.name in newList \n \
with m,fildList as data\n \
match (n)-[r:\u8BCA\u65AD\u4F9D\u636E]->(m:Condition)\n \
where n.name in data\n \
with m.name as condition, count(distinct r) as sd,m.path as jundgement\n \
where sd>=jundgement\n \
return condition
#\u67E5\u627E\u786E\u8BCA
searchDis=match (n:Condition)-[r:\u786E\u8BCA|:\u62DF\u8BCA|:\u8B66\u60D5]->(m:Disease)\n \
where n.name in startList\n \
with distinct m,r\n \
return m.name as name, labels(m)[0] as label,type(r) as relationType;

#\u6CBB\u7597\u5904\u7406
#\u67E5\u627E\u8BCA\u65AD\u5BF9\u5E94\u7684\u7C7B\u548C\u836F,\u4EE5\u53CA\u4ED6\u4EEC\u7684\u6392\u5E8F
searchDrugsMedic=match (d:Disease{name:diseaseName})-[r0:\u63A8\u8350]->(m:Drugs)-[:\u5305\u542B]->(n:Medicine),(d:Disease)-[r1:\u63A8\u8350]->(n)\n \
where r0.p<6 \n \
return m.name as \u7C7B, r0.p as sort, n.name as \u836F\u7269, r1.rate as a order by sort , a desc
#\u67E5\u627E\u8BCA\u65AD\u5BF9\u5E94\u7684\u836F\u7269\u7684\u5927\u5C0F\u7C7B
searchBigSubDrugs=match (n:Disease{name:diseaseName})-[r0:\u63A8\u8350]->(m:Drugs)-[:\u5305\u542B]->(k:Drugs) return k.name as short,m.name as large

#\u67E5\u627E\u9274\u522B\u8BCA\u65AD\u7684\u8BED\u53E5
searchDifferentialDiagnose=match(d:Disease)-[r:\u9274\u522B\u8BCA\u65AD]->(h) where d.name='mainDis' return collect(h.name) as coll

#\u5224\u65AD\u662F\u5426\u4E3A\u6025\u8BCA,\u8B66\u60D5\u7684\u8BED\u53E5
searchEmergency=match(d:Disease) where d.name in disList return d.name as emDis,d.emergency as em

#\u67E5\u627E\u6307\u6807\u7684\u8BED\u53E5
searchIndication=match (n:Condition)-[r:\u786E\u8BCA|:\u62DF\u8BCA]->(m:Indicators)\n \
where n.name in fildList\n \
with distinct m,r\n \
return m.name as name

#\u67E5\u627E\u4E0D\u826F\u53CD\u5E94\u7684\u8BED\u53E5
searchUe=match (n:Condition)-[r:\u786E\u8BCA|:\u62DF\u8BCA]->(m:UntowardEffect)\n \
where n.name in fildList\n \
with distinct m,r\n \
return m.name as name

#\u67E5\u627E\u4E00\u4E9B\u8BCD\u662F\u5426\u5728\u56FE\u8C31\u4E2D
searchWords=match(d) where d.name in fildList return distinct d.name as name
#\u6839\u636E\u75BE\u75C5\u67E5\u627E\u76F8\u5E94\u7684Lis Pacs
serchLisPacs=match (d:Disease)-[r1:\u63A8\u8350]->(m)\n \
where d.name in diseaseNmae return distinct d.name as name,labels(m)[0] as lei,m.name as n

#\u66F4\u65B0\u8BCA\u65AD\u4F9D\u636E\u7684path
updateConditionPath=match (n:Condition)<-[:\u8BCA\u65AD\u4F9D\u636E]-(m) \n \
          with n,\n \
          case \n \
          when n.relation="\u6216" then 1 \n \
          when n.relation="\u4E14" then count(distinct m) \n \
          when n.relation="\u4EFB\u4E00" then 1 \n \
          when n.relation="\u4EFB\u4E8C" then 2 \n \
          when n.relation="\u4EFB\u4E09" then 3 \n \
          when n.relation="\u4EFB\u56DB" then 4 \n\
          else 100 end as a \n \
          set n.path=a
