BQIDCMDP ;PRXM/HC/ALA-"MY PATIENTS-DPCP" ; 19 Oct 2005 5:49 PM
;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
;
Q
;
FND(DATA,PARMS,MPARMS) ;EP - Find all patients
;
;Description
; Executable to find all patients who has the designated primary provider
;Input
; PARMS = Array of parameters and their values
; MPARMS = Multiple array of a parameter (not currently used for this definition)
;Expected to return DATA
;
NEW UID
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("BQIDCMDP",UID))
K @DATA
;
NEW NM
I '$D(PARMS) Q
;
S NM=""
F S NM=$O(PARMS(NM)) Q:NM="" S @NM=PARMS(NM)
;
; If the DSPM package is installed
I $$VERSION^XPDUTL("BDP")'="" D DSPM Q
;
; If the DSPM package is NOT installed, use the alternate
; primary provider definition
NEW IEN
S IEN=""
F S IEN=$O(^AUPNPAT("AK",PROV,IEN)) Q:IEN="" D
. ; If patient is deceased, quit
. I $P($G(^DPT(IEN,.35)),U,1)'="" Q
. ; If patient has no active HRNs, quit
. I '$$HRN^BQIUL1(IEN) Q
. ; If patient has no visit in last 3 years, quit
. ;I '$$VTHR^BQIUL1(IEN) Q
. S @DATA@(IEN)=""
Q
;
DSPM ; Find the internal entry number
NEW DFN,CAT,DIC,IEN,Y,X
S DIC="^BDPTCAT("
S DIC(0)="Z",X="DESIGNATED PRIMARY PROVIDER" D ^DIC
S CAT=+Y I CAT=-1 Q
;
S IEN=""
F S IEN=$O(^BDPRECN("AC",PROV,IEN)) Q:IEN="" D
. I $$GET1^DIQ(90360.1,IEN_",",.01,"I")'=CAT Q
. S DFN=$$GET1^DIQ(90360.1,IEN_",",.02,"I") I DFN="" Q
. ; If patient is deceased, quit
. I $P($G(^DPT(DFN,.35)),U,1)'="" Q
. ; If patient has no active HRNs, quit
. I '$$HRN^BQIUL1(DFN) Q
. ; If patient has no visit in last 3 years, quit
. ;I '$$VTHR^BQIUL1(DFN) Q
. S @DATA@(DFN)=""
. ;
; Also check patient file
NEW IEN
S IEN=""
F S IEN=$O(^AUPNPAT("AK",PROV,IEN)) Q:IEN="" D
. ; If patient is deceased, quit
. I $P($G(^DPT(IEN,.35)),U,1)'="" Q
. ; If patient has no active HRNs, quit
. I '$$HRN^BQIUL1(IEN) Q
. ; If patient has no visit in last 3 years, quit
. ;I '$$VTHR^BQIUL1(IEN) Q
. S @DATA@(IEN)=""
Q
BQIDCMDP ;PRXM/HC/ALA-"MY PATIENTS-DPCP" ; 19 Oct 2005 5:49 PM
+1 ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
+2 ;
+3 QUIT
+4 ;
FND(DATA,PARMS,MPARMS) ;EP - Find all patients
+1 ;
+2 ;Description
+3 ; Executable to find all patients who has the designated primary provider
+4 ;Input
+5 ; PARMS = Array of parameters and their values
+6 ; MPARMS = Multiple array of a parameter (not currently used for this definition)
+7 ;Expected to return DATA
+8 ;
+9 NEW UID
+10 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+11 SET DATA=$NAME(^TMP("BQIDCMDP",UID))
+12 KILL @DATA
+13 ;
+14 NEW NM
+15 IF '$DATA(PARMS)
QUIT
+16 ;
+17 SET NM=""
+18 FOR
SET NM=$ORDER(PARMS(NM))
IF NM=""
QUIT
SET @NM=PARMS(NM)
+19 ;
+20 ; If the DSPM package is installed
+21 IF $$VERSION^XPDUTL("BDP")'=""
DO DSPM
QUIT
+22 ;
+23 ; If the DSPM package is NOT installed, use the alternate
+24 ; primary provider definition
+25 NEW IEN
+26 SET IEN=""
+27 FOR
SET IEN=$ORDER(^AUPNPAT("AK",PROV,IEN))
IF IEN=""
QUIT
Begin DoDot:1
+28 ; If patient is deceased, quit
+29 IF $PIECE($GET(^DPT(IEN,.35)),U,1)'=""
QUIT
+30 ; If patient has no active HRNs, quit
+31 IF '$$HRN^BQIUL1(IEN)
QUIT
+32 ; If patient has no visit in last 3 years, quit
+33 ;I '$$VTHR^BQIUL1(IEN) Q
+34 SET @DATA@(IEN)=""
End DoDot:1
+35 QUIT
+36 ;
DSPM ; Find the internal entry number
+1 NEW DFN,CAT,DIC,IEN,Y,X
+2 SET DIC="^BDPTCAT("
+3 SET DIC(0)="Z"
SET X="DESIGNATED PRIMARY PROVIDER"
DO ^DIC
+4 SET CAT=+Y
IF CAT=-1
QUIT
+5 ;
+6 SET IEN=""
+7 FOR
SET IEN=$ORDER(^BDPRECN("AC",PROV,IEN))
IF IEN=""
QUIT
Begin DoDot:1
+8 IF $$GET1^DIQ(90360.1,IEN_",",.01,"I")'=CAT
QUIT
+9 SET DFN=$$GET1^DIQ(90360.1,IEN_",",.02,"I")
IF DFN=""
QUIT
+10 ; If patient is deceased, quit
+11 IF $PIECE($GET(^DPT(DFN,.35)),U,1)'=""
QUIT
+12 ; If patient has no active HRNs, quit
+13 IF '$$HRN^BQIUL1(DFN)
QUIT
+14 ; If patient has no visit in last 3 years, quit
+15 ;I '$$VTHR^BQIUL1(DFN) Q
+16 SET @DATA@(DFN)=""
+17 ;
End DoDot:1
+18 ; Also check patient file
+19 NEW IEN
+20 SET IEN=""
+21 FOR
SET IEN=$ORDER(^AUPNPAT("AK",PROV,IEN))
IF IEN=""
QUIT
Begin DoDot:1
+22 ; If patient is deceased, quit
+23 IF $PIECE($GET(^DPT(IEN,.35)),U,1)'=""
QUIT
+24 ; If patient has no active HRNs, quit
+25 IF '$$HRN^BQIUL1(IEN)
QUIT
+26 ; If patient has no visit in last 3 years, quit
+27 ;I '$$VTHR^BQIUL1(IEN) Q
+28 SET @DATA@(IEN)=""
End DoDot:1
+29 QUIT