#235Mysql\u6570\u636E\u5E93 url_235 = jdbc:mysql://1.1.1.1:3306/scale?useUnicode=true&characterEncoding=UTF-8 userNmae_235 = root pass_235 = diagbot@20180822 # neo4j bolt credentials #\u7EBF\u4E0A\u4F7F\u7528 bolt.uri=bolt://10.58.4.152:7687 bolt.user=neo4j bolt.passwd=lantone #\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 #\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 #\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:Symptom or h:Vital or h:LISResult or h:PACSResult or h:History or h:Other or h:Cause or h:Prognosis or h:PrevailHistory or h:Disease or h:Indicators or h:UntowardEffect) and \ 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; #\u6392\u9664\u8BCA\u65AD excludeDiag=match (ex)-[q:\u6392\u9664\u4F9D\u636E]-(c)-[r:\u6392\u9664]->(d:Disease) where ex.name in infostr return d #\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})-[r:\u6CBB\u7597\u65B9\u6848]->(t:Treat)-[r0:\u63A8\u8350]->(m:Drugs)-[:\u5305\u542B]->(n:Medicine),(t:Treat)-[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 \ match(i:Indicators) WHERE i.name=m.name and age>i.minAge and age(m:UntowardEffect)\n \ where n.name in fildList\n \ with distinct m,r\n \ return m.name as name,type(r) as tr #\u6839\u636E\u75BE\u75C5\u67E5\u627E\u76F8\u5E94\u7684Lis Pacs serchLisPacs=unwind disList as row \n \ match (d:Disease)-[r1:\u63A8\u8350|:\u8868\u73B0]->(m) where d.name=row return labels(m)[0] as label,m.name as name # \u65B0\u7ED3\u6784\u6CBB\u7597\u67E5\u8BE2 searchTreat=match(h:Disease{name:disName})-[r:\u6CBB\u7597\u65B9\u6848]->(t:Treat)-[r2:\u63A8\u8350]->(m:Medicine)-[r1:\u5C5E\u4E8E]->(d:Drugs)\n \ with t,m,d\n \ match(t)-[r:\u63A8\u8350]->(m)-[r1:\u5C5E\u4E8E]->(h:Drugs)\n \ where d.name=h.bigDrugs \n \ with t,m,d,h\n \ match(m)<-[R:\u614E\u7528|:\u5FCC\u7528]-(i) where i.name in filds\n \ return t.name as treat,d.name as big,h.name as sub,m.name as med,type(R) as ty\n \ order by h.p\n \ union\n \ match(h:Disease{name:disName})-[r:\u6CBB\u7597\u65B9\u6848]->(t:Treat)-[r2:\u63A8\u8350]->(m:Medicine)-[r1:\u5C5E\u4E8E]->(d:Drugs)\n \ with t,m,d\n \ match(t)-[r:\u63A8\u8350]->(m)-[r1:\u5C5E\u4E8E]->(h:Drugs)\n \ where d.name=h.bigDrugs \n \ return t.name as treat,d.name as big,h.name as sub, m.name as med,null as ty\n \ order by h.p #\u89C4\u5219\u7528\u836F medicationRule=match(h)-[r:\u8BCA\u65AD\u4F9D\u636E]->(c:Condition) \n \ where (h:HistoryDiagnose or h:LISResult ) and \n \ h.name in filds \n \ with c,count(distinct r)>=c.path as hh \n \ where hh =true \n \ with c \n \ match(c)-[r:\u63A8\u8350]->(t:TreatCollection) \n \ return c.design as design,r.p as p,r.category as category,r.disName as disName,collect(t.name) as collection order by p searchRuleMedicaton=match(h:Disease{name:disName})-[r:\u6CBB\u7597\u65B9\u6848]->(t:Treat)-[r2:\u63A8\u8350]->(m:Medicine)-[r1:\u5C5E\u4E8E]->(d:Drugs)\n \ with t,m,d\n \ match(t)-[r:\u63A8\u8350]->(m)-[r1:\u5C5E\u4E8E]->(h:Drugs)\n \ where d.name=h.bigDrugs and h.name in drugsList\n \ with t,m,d,h\n \ match(m)<-[R:\u614E\u7528|:\u5FCC\u7528]-(i) where i.name in filds\n \ return t.name as treat,d.name as big,h.name as sub,m.name as med,type(R) as ty\n \ order by h.p\n \ union\n \ match(h:Disease{name:disName})-[r:\u6CBB\u7597\u65B9\u6848]->(t:Treat)-[r2:\u63A8\u8350]->(m:Medicine)-[r1:\u5C5E\u4E8E]->(d:Drugs)\n \ with t,m,d\n \ match(t)-[r:\u63A8\u8350]->(m)-[r1:\u5C5E\u4E8E]->(h:Drugs)\n \ where d.name=h.bigDrugs and h.name in drugsList\n \ return t.name as treat,d.name as big,h.name as sub, m.name as med,null as ty\n \ order by h.p # \u65B0\u7ED3\u6784\u7BA1\u7406\u8BC4\u4F30 mangement=match(d:Disease)-[r:\u7BA1\u7406\u8BC4\u4F30]->(m)-[r1]->(e) where d.name='disName' \ return e.name as name,e.filds as filds,type(r1) as type order by r1.p #\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