E-Rezept ist verpflichtend seit dem 01.01.2024
Alle Hinweise und Informationen zur Nutzung finden Sie unter folgendem Link.
BugFix für Microsoft OAuth 2.0 Email Problem
Alle Hinweise und Informationen Sie unter folgendem Link.

Liebe Tomedos

hier nochmal ein kleines Problem:

select d.*
from patient as p

left join patientendetails as pd on (p.patientendetails_ident = pd.ident)
left join patientendetailsrelationen as pdr on (pd.patientendetailsrelationen_ident = pdr.ident)
left join patientendetailsrelationen_kvscheine as pdrkv on (pdrkv.patientendetailsrelationen_ident = pdr.ident)
left join kvschein as kv on (pdrkv.kvscheine_ident = kv.ident)
join kvschein_quartalsdiagnosen on (kvschein_ident = kv.ident)
left join diagnose as d on (quartalsdiagnosen_ident = d.ident)
left join icdkatalogeintrag as icd on (d.icdkatalogeintrag_ident = icd.ident)
	
	where 
		kv.visible=true
            	and p.ident = $[patientident]$
    		and d.visible=true 
		and pd.privatpatient = FALSE
    		and
(
( icd.code ilike '%I10.90%' ) or
( icd.code ilike '%Z8%' ) 
)

Wie kann ich jetzt noch als Zusatz eine EBM Leisung hinzufügen a la

 

AND

( EBMCode = "03230" )

 

Gefragt von (3.5k Punkte)
0 Punkte

2 Antworten

ungefähr so (ungetestet)

...
left join Leistung L on (L.invkvschein_ident = kv.ident)

left join EBMKatalogEintrag  ebm on (L.ebmkatalogeintrag_ident = ebm.ident)
...

where ebm.code = '03230'
Beantwortet von (67.8k Punkte)
0 Punkte

hmmm so richtig komme ich doch nicht weiter - wollte eigentlich ein NOT machen?

also - wenn in den EBM Ziffern 03221H NICHT enthalten ist

 ( ebm.code not ilike '%03221H%' )

in summe

select d.*
from patient as p

left join patientendetails as pd on (p.patientendetails_ident = pd.ident)
left join patientendetailsrelationen as pdr on (pd.patientendetailsrelationen_ident = pdr.ident)
left join patientendetailsrelationen_kvscheine as pdrkv on (pdrkv.patientendetailsrelationen_ident = pdr.ident)
left join kvschein as kv on (pdrkv.kvscheine_ident = kv.ident)
join kvschein_quartalsdiagnosen on (kvschein_ident = kv.ident)
left join diagnose as d on (quartalsdiagnosen_ident = d.ident)
left join icdkatalogeintrag as icd on (d.icdkatalogeintrag_ident = icd.ident)
left join Leistung L on (L.invkvschein_ident = kv.ident)
left join EBMKatalogEintrag  ebm on (L.ebmkatalogeintrag_ident = ebm.ident)

	where 
		kv.visible=true
            	and p.ident = $[patientident]$
    		and d.visible=true 
		and pd.privatpatient = FALSE
		and
		
		(
                  ( ebm.code not ilike '%03221H%' ) OR ( ebm.code not ilike '%03220H%' )
	        )

    		and
(
( icd.code ilike '%I10.90%' ) or
( icd.code ilike '%Z8%' ) 
)

   

 

Ich vermute, dass es an Folgendem liegt:
Der Teil
( ebm.code not ilike '%03221H%' ) OR ( ebm.code not ilike '%03220H%' )
ist aktuell immer wahr, filtert die Ergebnisse also nicht.
Was Sie vermutlich schreiben wollten wäre:
(NOT ( ebm.code ilike '%03221H%' ) OR ( ebm.code ilike '%03220H%' ))
oder alternativ:
( ebm.code not ilike '%03221H%' ) AND ( ebm.code not ilike '%03220H%' )
Das Problem wurde im Telefonat gelöst, hier nochmal die Lösung:

...
AND kv.ident NOT IN
(SELECT L.invkvschein_ident FROM Leistung L
LEFT JOIN EBMKatalogEintrag ebm ON (L.ebmkatalogeintrag_ident = ebm.ident)
WHERE (( ebm.code = '03220H') OR ( ebm.code = '03221H' )))
...
Beantwortet von (120 Punkte)
0 Punkte
16,009 Beiträge
23,773 Antworten
41,823 Kommentare
11,518 Nutzer