Hi Mark,

not sure I understand your question.

MATCH (p1:Encounter {PatientAccount: '1002844934'})-[r:HasICD9Dx]-(i:ICD9DX)
return i
<- these "i" are the 3 codes ?

try this:

MATCH (p1:Encounter {PatientAccount: '1002844934'})-[r:HasICD9Dx]->(i:ICD9DX
)
with collect(distinct i) as codes
with codes[1..] as rest, codes[0] as first // now we have the split the
collection into the first single code and the rest
MATCH (first)<-[r2:HasICD9Dx]-(p2:Encounter)
WHERE ALL(c in rest WHERE (p2)-[r2:HasICD9Dx]->(c))
RETURN p2


On Mon, Dec 1, 2014 at 9:13 PM, Mark Jackson <[email protected]> wrote:

> I'm trying to write a statement that returns a list of encounters that all
> share the same diagnosis codes. But it appears to be returning accounts
> that match at least one of shared codes. The account referenced below has
> three ICD9DX codes associated with it. I'm wanting p2 to only return
> accounts that have those same three codes. It would be nice to know how to
> return accounts that only have those same three codes and also how to write
> it to return accounts with at least the same three codes.
>
> MATCH (p1:Encounter {PatientAccount: '1002844934'})-[r:HasICD9Dx]-(i:
> ICD9DX)-[r2:HasICD9Dx]-(p2:Encounter) RETURN p2
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to