BQITD04 ;PRXM/HC/ALA-CVD Highest Risk ; 10 Apr 2006 4:29 PM
;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
;
Q
;
POP(BQARY,TGLOB) ; EP
;
;Description
; Finds all patients who meet the criteria for CVD Highest Risk
;Input
; BQARY - Array of taxonomies and other information
; TGLOB - Global where data is to be stored
; Structure:
; TGLOB(DFN,"CRITERIA",criteria or taxonomy,visit or problem ien)=date/time
;Variables
; TAX - Taxonomy name
; NIT - Number of iterations
; TMFRAME - Timeframe
; FREF - File number to search
; GREF - Global reference of FREF
; TREF - Taxonomy temporary global
;
NEW TDFN,TDXNCN,TPPGLOB,DXNN,TDFN,RGIEN
S TPPGLOB=$NA(^TMP("TEMPD",UID))
K @TPPGLOB
;
; Using same logic as Diabetes, find if valid for Highest Risk
S TDFN="",TDXNCN=$$GDXN^BQITUTL("Diabetes")
S BQDREF="BQIREF" K @BQDREF
D ARY^BQITUTL(TDXNCN,BQDREF)
I $D(@BQDREF) D
. D POP^BQITDGN(.BQDREF,.TPPGLOB)
K @BQDREF,BQDREF
;
; Check for ESRD
I $D(@BQARY) D
. D POP^BQITDGN(.BQARY,.TGLOB,1)
;
S DFN=0
F S DFN=$O(@TPPGLOB@(DFN)) Q:'DFN M @TGLOB@(DFN)=@TPPGLOB@(DFN)
I $D(@TPPGLOB) K @TPPGLOB
;
; If already CVD Known, then cannot be at highest risk
NEW TDFN,TDXNCN
S TDFN="",TDXNCN=$$GDXN^BQITUTL("CVD Known")
F S TDFN=$O(@TGLOB@(TDFN)) Q:'TDFN D
. ; If the patient has been tagged as CVD Known
. I $$ATAG^BQITDUTL(TDFN,"CVD Known") K @TGLOB@(TDFN)
;
Q
;
PAT(DEF,BTGLOB,BDFN) ; EP -- By patient
NEW DXOK,BQDXN,TGLOB,BQREF,TDXNCN,TDXNCN1,DXNN
S DXOK=0
;
; If patient already active for 'CVD Known', quit
I $$ATAG^BQITDUTL(BDFN,"CVD Known") Q DXOK
; See if patient meets diabetes criteria
S BQDXN=$$GDXN^BQITUTL("Diabetes")
S BQDREF="BQIREF" K @BQDREF
D GDF^BQITUTL(BQDXN,BQDREF)
S DXOK=$$PAT^BQITDGN(.BQDREF,BTGLOB,BDFN)
I DXOK Q DXOK
;
; Check for ESRD
S BQDXN=$$GDXN^BQITUTL(DEF)
S BQREF="BQIRY"
D GDF^BQITUTL(BQDXN,BQREF)
S DXOK=$$PAT^BQITDGN(BQREF,BTGLOB,BDFN,1)
Q DXOK
BQITD04 ;PRXM/HC/ALA-CVD Highest Risk ; 10 Apr 2006 4:29 PM
+1 ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
+2 ;
+3 QUIT
+4 ;
POP(BQARY,TGLOB) ; EP
+1 ;
+2 ;Description
+3 ; Finds all patients who meet the criteria for CVD Highest Risk
+4 ;Input
+5 ; BQARY - Array of taxonomies and other information
+6 ; TGLOB - Global where data is to be stored
+7 ; Structure:
+8 ; TGLOB(DFN,"CRITERIA",criteria or taxonomy,visit or problem ien)=date/time
+9 ;Variables
+10 ; TAX - Taxonomy name
+11 ; NIT - Number of iterations
+12 ; TMFRAME - Timeframe
+13 ; FREF - File number to search
+14 ; GREF - Global reference of FREF
+15 ; TREF - Taxonomy temporary global
+16 ;
+17 NEW TDFN,TDXNCN,TPPGLOB,DXNN,TDFN,RGIEN
+18 SET TPPGLOB=$NAME(^TMP("TEMPD",UID))
+19 KILL @TPPGLOB
+20 ;
+21 ; Using same logic as Diabetes, find if valid for Highest Risk
+22 SET TDFN=""
SET TDXNCN=$$GDXN^BQITUTL("Diabetes")
+23 SET BQDREF="BQIREF"
KILL @BQDREF
+24 DO ARY^BQITUTL(TDXNCN,BQDREF)
+25 IF $DATA(@BQDREF)
Begin DoDot:1
+26 DO POP^BQITDGN(.BQDREF,.TPPGLOB)
End DoDot:1
+27 KILL @BQDREF,BQDREF
+28 ;
+29 ; Check for ESRD
+30 IF $DATA(@BQARY)
Begin DoDot:1
+31 DO POP^BQITDGN(.BQARY,.TGLOB,1)
End DoDot:1
+32 ;
+33 SET DFN=0
+34 FOR
SET DFN=$ORDER(@TPPGLOB@(DFN))
IF 'DFN
QUIT
MERGE @TGLOB@(DFN)=@TPPGLOB@(DFN)
+35 IF $DATA(@TPPGLOB)
KILL @TPPGLOB
+36 ;
+37 ; If already CVD Known, then cannot be at highest risk
+38 NEW TDFN,TDXNCN
+39 SET TDFN=""
SET TDXNCN=$$GDXN^BQITUTL("CVD Known")
+40 FOR
SET TDFN=$ORDER(@TGLOB@(TDFN))
IF 'TDFN
QUIT
Begin DoDot:1
+41 ; If the patient has been tagged as CVD Known
+42 IF $$ATAG^BQITDUTL(TDFN,"CVD Known")
KILL @TGLOB@(TDFN)
End DoDot:1
+43 ;
+44 QUIT
+45 ;
PAT(DEF,BTGLOB,BDFN) ; EP -- By patient
+1 NEW DXOK,BQDXN,TGLOB,BQREF,TDXNCN,TDXNCN1,DXNN
+2 SET DXOK=0
+3 ;
+4 ; If patient already active for 'CVD Known', quit
+5 IF $$ATAG^BQITDUTL(BDFN,"CVD Known")
QUIT DXOK
+6 ; See if patient meets diabetes criteria
+7 SET BQDXN=$$GDXN^BQITUTL("Diabetes")
+8 SET BQDREF="BQIREF"
KILL @BQDREF
+9 DO GDF^BQITUTL(BQDXN,BQDREF)
+10 SET DXOK=$$PAT^BQITDGN(.BQDREF,BTGLOB,BDFN)
+11 IF DXOK
QUIT DXOK
+12 ;
+13 ; Check for ESRD
+14 SET BQDXN=$$GDXN^BQITUTL(DEF)
+15 SET BQREF="BQIRY"
+16 DO GDF^BQITUTL(BQDXN,BQREF)
+17 SET DXOK=$$PAT^BQITDGN(BQREF,BTGLOB,BDFN,1)
+18 QUIT DXOK