BQIRREG ;PRXM/HC/DB - Register Reports ; 1 Nov 2007  10:35 AM
 ;;2.1;ICARE MANAGEMENT SYSTEM;**1**;Feb 07, 2011;Build 5
 ;
 Q
 ;
 ; Will need to address missing/unpopulated taxonomies
 ;
SSR(DATA,PLIST) ; EP -- BQI PATIENT STATE SURV
 ;Description
 ;  Generates a State Surveillance report for a list of DFNs
 ;
 ;Input
 ;  PLIST - Either set to a single Patient Internal ID or
 ;          in an array in the following format:
 ;          
 ;          PLIST(IX)=DFN_$C(28)
 ;
 ;Output
 ;  DATA - Name of global in which data is stored(^TMP("BQISSR"))
 ;
 NEW UID
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQISSR",UID))
 K @DATA
 D EN^BKMQSSR(DATA,.PLIST)
 Q
 ;
QOC(DATA,BKMRPOP,BKMEDT,OWNR,PLIEN,BKMTAG,DFN) ; EP -- BQI PATIENT QUALITY OF CARE
 ;
 ; Input:
 ;    BKMEDT - Ending date for report
 ;    OWNR   - Owner Internal Entry Number if running report by panel
 ;    PLIEN  - Panel Internal Entry Number if running report by panel
 ;    DFN    - Either set to a single Patient Internal ID or
 ;             in an array in the following format:
 ;          
 ;          DFN(IX)=DFN_$C(28)
 ;    BKMRPOP - Patient selection criteria:
 ;            - R = Active on HMS Register
 ;            - D = Active HIV/AIDS Diagnostic Tag
 ;            - P = By selected patients
 ;    BKMTAG  - If BKMRPOP is by Diagnostic Tag, identifies the status:
 ;            - Proposed
 ;            - Accepted
 ;            - Proposed or Accepted
 ;
 NEW UID
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIQOC",UID))
 K @DATA
 D RUN^BKMQQCR(.DATA,BKMRPOP,BKMEDT,$G(OWNR),$G(PLIEN),$G(BKMTAG),.DFN)
 Q
 ;
QOCTR(DATA,RPOP) ; EP - BQI QOC TRIGGER HMS
 ;
 ; Input
 ;   RPOP - Report Population - if the user selected anything other than
 ;          "D" for Active HIV/AIDS Diagnostic Tag, the Diagnostic Tag
 ;          Status prompt should be disabled
 ;
 NEW UID,II,ABLE
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIQOCTR",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIRREG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="T00008SOURCE^T00001ABLE_FLAG"_$C(30)
 S ABLE="N"
 I $G(RPOP)="D" S ABLE="Y"
 S II=II+1,@DATA@(II)="BKMTAG^"_ABLE_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 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(BQII),$D(DATA) S BQII=BQII+1,@DATA@(BQII)=$C(31)
 I $$TMPFL^BQIUL1("C")
 Q
BQIRREG   ;PRXM/HC/DB - Register Reports ; 1 Nov 2007  10:35 AM
 +1       ;;2.1;ICARE MANAGEMENT SYSTEM;**1**;Feb 07, 2011;Build 5
 +2       ;
 +3        QUIT 
 +4       ;
 +5       ; Will need to address missing/unpopulated taxonomies
 +6       ;
SSR(DATA,PLIST) ; EP -- BQI PATIENT STATE SURV
 +1       ;Description
 +2       ;  Generates a State Surveillance report for a list of DFNs
 +3       ;
 +4       ;Input
 +5       ;  PLIST - Either set to a single Patient Internal ID or
 +6       ;          in an array in the following format:
 +7       ;          
 +8       ;          PLIST(IX)=DFN_$C(28)
 +9       ;
 +10      ;Output
 +11      ;  DATA - Name of global in which data is stored(^TMP("BQISSR"))
 +12      ;
 +13       NEW UID
 +14       SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
 +15       SET DATA=$NAME(^TMP("BQISSR",UID))
 +16       KILL @DATA
 +17       DO EN^BKMQSSR(DATA,.PLIST)
 +18       QUIT 
 +19      ;
QOC(DATA,BKMRPOP,BKMEDT,OWNR,PLIEN,BKMTAG,DFN) ; EP -- BQI PATIENT QUALITY OF CARE
 +1       ;
 +2       ; Input:
 +3       ;    BKMEDT - Ending date for report
 +4       ;    OWNR   - Owner Internal Entry Number if running report by panel
 +5       ;    PLIEN  - Panel Internal Entry Number if running report by panel
 +6       ;    DFN    - Either set to a single Patient Internal ID or
 +7       ;             in an array in the following format:
 +8       ;          
 +9       ;          DFN(IX)=DFN_$C(28)
 +10      ;    BKMRPOP - Patient selection criteria:
 +11      ;            - R = Active on HMS Register
 +12      ;            - D = Active HIV/AIDS Diagnostic Tag
 +13      ;            - P = By selected patients
 +14      ;    BKMTAG  - If BKMRPOP is by Diagnostic Tag, identifies the status:
 +15      ;            - Proposed
 +16      ;            - Accepted
 +17      ;            - Proposed or Accepted
 +18      ;
 +19       NEW UID
 +20       SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
 +21       SET DATA=$NAME(^TMP("BQIQOC",UID))
 +22       KILL @DATA
 +23       DO RUN^BKMQQCR(.DATA,BKMRPOP,BKMEDT,$GET(OWNR),$GET(PLIEN),$GET(BKMTAG),.DFN)
 +24       QUIT 
 +25      ;
QOCTR(DATA,RPOP) ; EP - BQI QOC TRIGGER HMS
 +1       ;
 +2       ; Input
 +3       ;   RPOP - Report Population - if the user selected anything other than
 +4       ;          "D" for Active HIV/AIDS Diagnostic Tag, the Diagnostic Tag
 +5       ;          Status prompt should be disabled
 +6       ;
 +7        NEW UID,II,ABLE
 +8        SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
 +9        SET DATA=$NAME(^TMP("BQIQOCTR",UID))
 +10       KILL @DATA
 +11       SET II=0
 +12      ; SAC 2006 2.2.3.3.2
           NEW $ESTACK,$ETRAP
           SET $ETRAP="D ERR^BQIRREG D UNWIND^%ZTER"
 +13      ;
 +14       SET @DATA@(II)="T00008SOURCE^T00001ABLE_FLAG"_$CHAR(30)
 +15       SET ABLE="N"
 +16       IF $GET(RPOP)="D"
               SET ABLE="Y"
 +17       SET II=II+1
           SET @DATA@(II)="BKMTAG^"_ABLE_$CHAR(30)
 +18       SET II=II+1
           SET @DATA@(II)=$CHAR(31)
 +19       QUIT 
 +20      ;
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(BQII)
               IF $DATA(DATA)
                   SET BQII=BQII+1
                   SET @DATA@(BQII)=$CHAR(31)
 +6        IF $$TMPFL^BQIUL1("C")
 +7        QUIT