BQIMSLST ;PRXM/HC/ALA-Get list of My Measure values ; 04 May 2007 2:27 PM
;;2.3;ICARE MANAGEMENT SYSTEM;;Apr 18, 2012;Build 59
;
Q
;
EN(DATA,TYPE) ;EP -- BQI GET MEASURES LIST
;
; Input
; TYPE - type of measures to list
; 'D' for demographics only
; 'G' for GPRA only
; 'R' for Reminders only
; 'H' for HIV/AIDS
; null for all
;
NEW UID,II,TTYPE,SCAT,SCLIN,BQMEAS,CAT,CLIN,TITLE,SDIR
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("BQIMSLST",UID))
K @DATA
;
S II=0
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIMSLST D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
S TYPE=$G(TYPE,"")
S @DATA@(II)="I00010MEAS_IEN^T00030TYPE^T00030CATEGORY^T00030CLIN_GROUP^T00050DISPLAY_NAME^T00015CODE^T00001VIEW^T00001PER_DIRECT^T00001EXCEPT^I00003SIZE^"
S @DATA@(II)=@DATA@(II)_"T00003EDIT^T00003BATCH^T00001DEFAULT_SORT^T00001IPC_CAT"_$C(30)
;
K BQISORT
I TYPE'="" S TTYPE=TYPE D RET G DONE
;
S TTYPE=$G(TYPE,"") S:TTYPE="" TTYPE="M"
F S TYPE=$O(^BQI(90506.1,"AC",TYPE)) Q:TYPE="" D RET
;
DONE ;
S CAT=""
F S CAT=$O(BQISORT(CAT)) Q:CAT="" D
. S CLIN=""
. F S CLIN=$O(BQISORT(CAT,CLIN)) Q:CLIN="" D
.. S TITLE=""
.. F S TITLE=$O(BQISORT(CAT,CLIN,TITLE)) Q:TITLE="" D
... S BQMEAS=""
... F S BQMEAS=$O(BQISORT(CAT,CLIN,TITLE,BQMEAS)) Q:BQMEAS="" D
.... S II=II+1,@DATA@(II)=BQISORT(CAT,CLIN,TITLE,BQMEAS)
S II=II+1,@DATA@(II)=$C(31)
K BQISORT
Q
;
ERR ;
D ^%ZTER
NEW Y,ERRDTM
S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
S BMXSEC="Recording that an error occurred at "_ERRDTM
I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
Q
;
RET ; Data retrieval
NEW IEN,FDATA,SRC,GCAT,RCAT,DCAT,GCLIN,RCLIN,GVIEW,DVIEW,VIEW,DCLIN
NEW CAT,CLIN,RVIEW,MVIEW,PDIR,EXCEPT,SIZE,IPCAT,KEY
S IEN=""
F S IEN=$O(^BQI(90506.1,"AC",TYPE,IEN)) Q:IEN="" D
. S FDATA=$G(^BQI(90506.1,IEN,0)),EXCEPT="",SIZE=""
. I $$GET1^DIQ(90506.1,IEN_",",.1,"I")=1 Q
. I $$GET1^DIQ(90506.1,IEN_",",3.07,"I")=1 Q
. S KEY=$$GET1^DIQ(90506.1,IEN_",",3.1,"E")
. I KEY'="",'$$KEYCHK^BQIULSC(KEY,DUZ) Q
. S SRC=$$GET1^DIQ(90506.1,IEN_",",3.01,"E")
. S PDIR=$$GET1^DIQ(90506.1,IEN_",",.14,"I")
. S SIZE=$$GET1^DIQ(90506.1,IEN_",",.15,"E")
. S EDIT=+$$GET1^DIQ(90506.1,IEN_",",.16,"I")
. S EDIT=$S(EDIT=1:"YES",1:"NO")
. S BATCH=+$$GET1^DIQ(90506.1,IEN_",",.17,"I")
. S BATCH=$S(BATCH=1:"YES",1:"NO")
. S SDIR=$$GET1^DIQ(90506.1,IEN_",",3.08,"I")
. S:SDIR="" SDIR="A"
. S VIEW=$$GET1^DIQ(90506.1,IEN_",",3.04,"I")
. S:VIEW="" VIEW="O"
. S DCLIN=""
. S CAT=$$GET1^DIQ(90506.1,IEN_",",3.03,"E")
. S CLIN=$$GET1^DIQ(90506.1,IEN_",",3.02,"E")
. S IPCAT="N"
. I TYPE="G" D
.. NEW CODE,BQIH,BQIYR,BQMEAS,VER
.. S CODE=$P(FDATA,U,1),YEAR=$P(CODE,"_",1)
.. S BQMEAS=$P(CODE,"_",2)
.. S BQIH=$$SPM^BQIGPUTL()
.. S BQIYR=$$LKP^BQIGPUTL(YEAR)
.. S VER=$$VERSION^XPDUTL("BGP")
.. I VER>7.0 D
... D GFN^BQIGPUTL(BQIH,BQIYR)
... S EXCEPT=$$GET1^DIQ(BQIMEASF,BQMEAS_",",1704,"I")
... S EXCEPT=$S(EXCEPT="Y":"C",1:"N")
... S PDIR=$$GET1^DIQ(BQIMEASF,BQMEAS_",",1705,"E")
... S IPCAT=$$GET1^DIQ(BQIMEASF,BQMEAS_",",1707,"I"),IPCAT=$S(IPCAT=1:"Y",1:"N")
. S SCAT=$S(CAT="":"@",1:CAT),SCLIN=$S(CLIN="":"@",1:CLIN)
. S BQISORT(SCAT,SCLIN,$P(FDATA,U,3),IEN)=IEN_U_SRC_U_CAT_U_CLIN_U_$P(FDATA,U,3)_U_$P(FDATA,U,1)_U_VIEW_U_$G(PDIR)_U_$G(EXCEPT)_U_SIZE_U_EDIT_U_BATCH_U_SDIR_U_IPCAT_$C(30)
Q
BQIMSLST ;PRXM/HC/ALA-Get list of My Measure values ; 04 May 2007 2:27 PM
+1 ;;2.3;ICARE MANAGEMENT SYSTEM;;Apr 18, 2012;Build 59
+2 ;
+3 QUIT
+4 ;
EN(DATA,TYPE) ;EP -- BQI GET MEASURES LIST
+1 ;
+2 ; Input
+3 ; TYPE - type of measures to list
+4 ; 'D' for demographics only
+5 ; 'G' for GPRA only
+6 ; 'R' for Reminders only
+7 ; 'H' for HIV/AIDS
+8 ; null for all
+9 ;
+10 NEW UID,II,TTYPE,SCAT,SCLIN,BQMEAS,CAT,CLIN,TITLE,SDIR
+11 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+12 SET DATA=$NAME(^TMP("BQIMSLST",UID))
+13 KILL @DATA
+14 ;
+15 SET II=0
+16 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BQIMSLST D UNWIND^%ZTER"
+17 SET TYPE=$GET(TYPE,"")
+18 SET @DATA@(II)="I00010MEAS_IEN^T00030TYPE^T00030CATEGORY^T00030CLIN_GROUP^T00050DISPLAY_NAME^T00015CODE^T00001VIEW^T00001PER_DIRECT^T00001EXCEPT^I00003SIZE^"
+19 SET @DATA@(II)=@DATA@(II)_"T00003EDIT^T00003BATCH^T00001DEFAULT_SORT^T00001IPC_CAT"_$CHAR(30)
+20 ;
+21 KILL BQISORT
+22 IF TYPE'=""
SET TTYPE=TYPE
DO RET
GOTO DONE
+23 ;
+24 SET TTYPE=$GET(TYPE,"")
IF TTYPE=""
SET TTYPE="M"
+25 FOR
SET TYPE=$ORDER(^BQI(90506.1,"AC",TYPE))
IF TYPE=""
QUIT
DO RET
+26 ;
DONE ;
+1 SET CAT=""
+2 FOR
SET CAT=$ORDER(BQISORT(CAT))
IF CAT=""
QUIT
Begin DoDot:1
+3 SET CLIN=""
+4 FOR
SET CLIN=$ORDER(BQISORT(CAT,CLIN))
IF CLIN=""
QUIT
Begin DoDot:2
+5 SET TITLE=""
+6 FOR
SET TITLE=$ORDER(BQISORT(CAT,CLIN,TITLE))
IF TITLE=""
QUIT
Begin DoDot:3
+7 SET BQMEAS=""
+8 FOR
SET BQMEAS=$ORDER(BQISORT(CAT,CLIN,TITLE,BQMEAS))
IF BQMEAS=""
QUIT
Begin DoDot:4
+9 SET II=II+1
SET @DATA@(II)=BQISORT(CAT,CLIN,TITLE,BQMEAS)
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+10 SET II=II+1
SET @DATA@(II)=$CHAR(31)
+11 KILL BQISORT
+12 QUIT
+13 ;
ERR ;
+1 DO ^%ZTER
+2 NEW Y,ERRDTM
+3 SET Y=$$NOW^XLFDT()
XECUTE ^DD("DD")
SET ERRDTM=Y
+4 SET BMXSEC="Recording that an error occurred at "_ERRDTM
+5 IF $DATA(II)
IF $DATA(DATA)
SET II=II+1
SET @DATA@(II)=$CHAR(31)
+6 QUIT
+7 ;
RET ; Data retrieval
+1 NEW IEN,FDATA,SRC,GCAT,RCAT,DCAT,GCLIN,RCLIN,GVIEW,DVIEW,VIEW,DCLIN
+2 NEW CAT,CLIN,RVIEW,MVIEW,PDIR,EXCEPT,SIZE,IPCAT,KEY
+3 SET IEN=""
+4 FOR
SET IEN=$ORDER(^BQI(90506.1,"AC",TYPE,IEN))
IF IEN=""
QUIT
Begin DoDot:1
+5 SET FDATA=$GET(^BQI(90506.1,IEN,0))
SET EXCEPT=""
SET SIZE=""
+6 IF $$GET1^DIQ(90506.1,IEN_",",.1,"I")=1
QUIT
+7 IF $$GET1^DIQ(90506.1,IEN_",",3.07,"I")=1
QUIT
+8 SET KEY=$$GET1^DIQ(90506.1,IEN_",",3.1,"E")
+9 IF KEY'=""
IF '$$KEYCHK^BQIULSC(KEY,DUZ)
QUIT
+10 SET SRC=$$GET1^DIQ(90506.1,IEN_",",3.01,"E")
+11 SET PDIR=$$GET1^DIQ(90506.1,IEN_",",.14,"I")
+12 SET SIZE=$$GET1^DIQ(90506.1,IEN_",",.15,"E")
+13 SET EDIT=+$$GET1^DIQ(90506.1,IEN_",",.16,"I")
+14 SET EDIT=$SELECT(EDIT=1:"YES",1:"NO")
+15 SET BATCH=+$$GET1^DIQ(90506.1,IEN_",",.17,"I")
+16 SET BATCH=$SELECT(BATCH=1:"YES",1:"NO")
+17 SET SDIR=$$GET1^DIQ(90506.1,IEN_",",3.08,"I")
+18 IF SDIR=""
SET SDIR="A"
+19 SET VIEW=$$GET1^DIQ(90506.1,IEN_",",3.04,"I")
+20 IF VIEW=""
SET VIEW="O"
+21 SET DCLIN=""
+22 SET CAT=$$GET1^DIQ(90506.1,IEN_",",3.03,"E")
+23 SET CLIN=$$GET1^DIQ(90506.1,IEN_",",3.02,"E")
+24 SET IPCAT="N"
+25 IF TYPE="G"
Begin DoDot:2
+26 NEW CODE,BQIH,BQIYR,BQMEAS,VER
+27 SET CODE=$PIECE(FDATA,U,1)
SET YEAR=$PIECE(CODE,"_",1)
+28 SET BQMEAS=$PIECE(CODE,"_",2)
+29 SET BQIH=$$SPM^BQIGPUTL()
+30 SET BQIYR=$$LKP^BQIGPUTL(YEAR)
+31 SET VER=$$VERSION^XPDUTL("BGP")
+32 IF VER>7.0
Begin DoDot:3
+33 DO GFN^BQIGPUTL(BQIH,BQIYR)
+34 SET EXCEPT=$$GET1^DIQ(BQIMEASF,BQMEAS_",",1704,"I")
+35 SET EXCEPT=$SELECT(EXCEPT="Y":"C",1:"N")
+36 SET PDIR=$$GET1^DIQ(BQIMEASF,BQMEAS_",",1705,"E")
+37 SET IPCAT=$$GET1^DIQ(BQIMEASF,BQMEAS_",",1707,"I")
SET IPCAT=$SELECT(IPCAT=1:"Y",1:"N")
End DoDot:3
End DoDot:2
+38 SET SCAT=$SELECT(CAT="":"@",1:CAT)
SET SCLIN=$SELECT(CLIN="":"@",1:CLIN)
+39 SET BQISORT(SCAT,SCLIN,$PIECE(FDATA,U,3),IEN)=IEN_U_SRC_U_CAT_U_CLIN_U_$PIECE(FDATA,U,3)_U_$PIECE(FDATA,U,1)_U_VIEW_U_$GET(PDIR)_U_$GET(EXCEPT)_U_SIZE_U_EDIT_U_BATCH_U_SDIR_U_IPCAT_$CHAR(30)
End DoDot:1
+40 QUIT