APCLAUD4 ; IHS/CMI/LAB - MORE AUDIT SEARCH ;
;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
;
;cmi/anch/maw 9/7/2007 code set versioning in ICDDSP
;
TOP ;EP
W !!,"This Audit Search is based on the following criteria:",!
W !!,"1. Ambulatory Visits from ",APCLBDY," through ",APCLEDY
I '$D(APCLLAGE) W !!,"2. All Patient Ages included." G SEX
W !!,"2. Patient Age Range (as of Visit Date) from ",APCLLAGE," - ",APCLHAGE,"."
SEX ;
W !!,"3. ",$S($D(APCLSEX):APCLSEXP,1:"ALL")," Patient Sex"
SC ;
W !!,"4. ",$S($D(APCLSC):APCLSCP,1:"ALL")," Visit Service Categor",$S($D(APCLSC):"y.",1:"ies.")
TYPE W !!,"5. ",$S($D(APCLTYPE):APCLTYPP,1:"ALL")," Visit Type",$S($D(APCLTYPE):".",1:"s.")
CLN W !!,"6. ",$S($D(APCLCLN):APCLCLNP,1:"ALL")," Visit Clinic Type",$S($D(APCLCLN):"s.",1:".")
LOC W !!,"7. ",$S($D(APCLLOC):APCLLOCP,1:"ALL")," Location of Encounter"
ICD I $D(APCLALLI) W !!,"8. ALL ICD Codes." G TOP1
W !!,"8. The following ICD Code ranges: ",!
S APCLDSP=0
F S APCLDSP=$O(^XTMP("APCLAUD",APCLJOB,APCLBT,APCLDSP)) Q:APCLDSP'=+APCLDSP W !,"ICD Code Range ",APCLDSP,": ",^XTMP("APCLAUD",APCLJOB,APCLBT,APCLDSP,"ICDB")," through ",^XTMP("APCLAUD",APCLJOB,APCLBT,APCLDSP,"ICDE"),"."
TOP1 I $Y>(IOSL-4) D TOPHD I $D(APCLQ) K APCLQ Q
I $D(APCLALLP),'$D(APCLNOSP) W !!,"9. ALL Primary Providers." G TOP2
I $D(APCLNOSP) W !!,"9. NOT by Primary Provider." G TOP2
W !!,"9. The following Primary Providers:",!
S APCLPRV=0
F JJ=0:0 S APCLPRV=$O(^XTMP("APCLAUD",APCLJOB,APCLBT,"PROV",APCLPRV)) Q:APCLPRV'=+APCLPRV D PRVDSP
TOP2 I $Y>(IOSL-4) D TOPHD I $D(APCLQ) K APCLQ Q
I $D(APCLALLR) W !!,"10. ALL Diagnoses that match the Search Criteria." G TOP3
W !!,"9. Limited to ",APCLLIM," randomized Diagnoses " W:'$D(APCLNOSP) "per Provider " W !," that match the Search Criteria."
TOP3 D TOPHD I $D(APCLQ) K APCLQ Q
Q
TOPHD ;EP
S APCLPG=APCLPG+1 G:APCLPG=1 TOPHD1
I $E(IOST)="C",IO(0)=IO S DIR(0)="EO" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
I $D(DIRUT) S APCLQ="" Q
TOPHD1 W:$D(IOF) @IOF
W $P(^DIC(4,APCLSITE,0),"^"),?58,APCLDTP,?72,"Page ",APCLPG,!
W !?30,"Audit Search Criteria",!!,APCL80D
Q
ICDDSP I $Y>(IOSL-4) D TOPHD I $D(APCLQ) K APCLQ Q
;W:$D(^ICD9(APCLDSP,0)) !?4,$P(^ICD9(APCLDSP,0),"^"),?11,$P(^(0),"^",3)
W !?4,$P($$ICDDX^ICDEX(APCLDSP),"^",2),?11,$P($$ICDDX^ICDEX(APCLDSP),"^",4)
;W:$D(^ICD9(APCLDSP,1)) !?11,$E($P(^(1),"^"),1,67),! ;NO API IN CSV
Q
PRVDSP I $Y>(IOSL-4) D TOPHD I $D(APCLQ) K APCLQ Q
W !?4,$S($P(^DD(9000010.06,.01,0),U,2)[200:$P(^VA(200,APCLPRV,0),U),1:$P(^DIC(16,$P(^DIC(6,APCLPRV,0),"^"),0),"^")),!
Q
ICDLN ;EP
I $Y>(IOSL-9) D HEAD^APCLAUD2
W !!!,"---> ICD Code Range: "
I $D(APCLALLI) W "ALL ICD Codes." G ICDLN1
W ^XTMP("APCLAUD",APCLJOB,APCLBT,APCLIRNG,"ICDB")," through ",^("ICDE")
ICDLN1 W !?6,"Total Matches: ",APCLCNT W " Matches Selected: ",APCLGOT
Q
APCLAUD4 ; IHS/CMI/LAB - MORE AUDIT SEARCH ;
+1 ;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
+2 ;
+3 ;cmi/anch/maw 9/7/2007 code set versioning in ICDDSP
+4 ;
TOP ;EP
+1 WRITE !!,"This Audit Search is based on the following criteria:",!
+2 WRITE !!,"1. Ambulatory Visits from ",APCLBDY," through ",APCLEDY
+3 IF '$DATA(APCLLAGE)
WRITE !!,"2. All Patient Ages included."
GOTO SEX
+4 WRITE !!,"2. Patient Age Range (as of Visit Date) from ",APCLLAGE," - ",APCLHAGE,"."
SEX ;
+1 WRITE !!,"3. ",$SELECT($DATA(APCLSEX):APCLSEXP,1:"ALL")," Patient Sex"
SC ;
+1 WRITE !!,"4. ",$SELECT($DATA(APCLSC):APCLSCP,1:"ALL")," Visit Service Categor",$SELECT($DATA(APCLSC):"y.",1:"ies.")
TYPE WRITE !!,"5. ",$SELECT($DATA(APCLTYPE):APCLTYPP,1:"ALL")," Visit Type",$SELECT($DATA(APCLTYPE):".",1:"s.")
CLN WRITE !!,"6. ",$SELECT($DATA(APCLCLN):APCLCLNP,1:"ALL")," Visit Clinic Type",$SELECT($DATA(APCLCLN):"s.",1:".")
LOC WRITE !!,"7. ",$SELECT($DATA(APCLLOC):APCLLOCP,1:"ALL")," Location of Encounter"
ICD IF $DATA(APCLALLI)
WRITE !!,"8. ALL ICD Codes."
GOTO TOP1
+1 WRITE !!,"8. The following ICD Code ranges: ",!
+2 SET APCLDSP=0
+3 FOR
SET APCLDSP=$ORDER(^XTMP("APCLAUD",APCLJOB,APCLBT,APCLDSP))
IF APCLDSP'=+APCLDSP
QUIT
WRITE !,"ICD Code Range ",APCLDSP,": ",^XTMP("APCLAUD",APCLJOB,APCLBT,APCLDSP,"ICDB")," through ",^XTMP("APCLAUD",APCLJOB,APCLBT,APCLDSP,"ICDE"),"."
TOP1 IF $Y>(IOSL-4)
DO TOPHD
IF $DATA(APCLQ)
KILL APCLQ
QUIT
+1 IF $DATA(APCLALLP)
IF '$DATA(APCLNOSP)
WRITE !!,"9. ALL Primary Providers."
GOTO TOP2
+2 IF $DATA(APCLNOSP)
WRITE !!,"9. NOT by Primary Provider."
GOTO TOP2
+3 WRITE !!,"9. The following Primary Providers:",!
+4 SET APCLPRV=0
+5 FOR JJ=0:0
SET APCLPRV=$ORDER(^XTMP("APCLAUD",APCLJOB,APCLBT,"PROV",APCLPRV))
IF APCLPRV'=+APCLPRV
QUIT
DO PRVDSP
TOP2 IF $Y>(IOSL-4)
DO TOPHD
IF $DATA(APCLQ)
KILL APCLQ
QUIT
+1 IF $DATA(APCLALLR)
WRITE !!,"10. ALL Diagnoses that match the Search Criteria."
GOTO TOP3
+2 WRITE !!,"9. Limited to ",APCLLIM," randomized Diagnoses "
IF '$DATA(APCLNOSP)
WRITE "per Provider "
WRITE !," that match the Search Criteria."
TOP3 DO TOPHD
IF $DATA(APCLQ)
KILL APCLQ
QUIT
+1 QUIT
TOPHD ;EP
+1 SET APCLPG=APCLPG+1
IF APCLPG=1
GOTO TOPHD1
+2 IF $EXTRACT(IOST)="C"
IF IO(0)=IO
SET DIR(0)="EO"
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+3 IF $DATA(DIRUT)
SET APCLQ=""
QUIT
TOPHD1 IF $DATA(IOF)
WRITE @IOF
+1 WRITE $PIECE(^DIC(4,APCLSITE,0),"^"),?58,APCLDTP,?72,"Page ",APCLPG,!
+2 WRITE !?30,"Audit Search Criteria",!!,APCL80D
+3 QUIT
ICDDSP IF $Y>(IOSL-4)
DO TOPHD
IF $DATA(APCLQ)
KILL APCLQ
QUIT
+1 ;W:$D(^ICD9(APCLDSP,0)) !?4,$P(^ICD9(APCLDSP,0),"^"),?11,$P(^(0),"^",3)
+2 WRITE !?4,$PIECE($$ICDDX^ICDEX(APCLDSP),"^",2),?11,$PIECE($$ICDDX^ICDEX(APCLDSP),"^",4)
+3 ;W:$D(^ICD9(APCLDSP,1)) !?11,$E($P(^(1),"^"),1,67),! ;NO API IN CSV
+4 QUIT
PRVDSP IF $Y>(IOSL-4)
DO TOPHD
IF $DATA(APCLQ)
KILL APCLQ
QUIT
+1 WRITE !?4,$SELECT($PIECE(^DD(9000010.06,.01,0),U,2)[200:$PIECE(^VA(200,APCLPRV,0),U),1:$PIECE(^DIC(16,$PIECE(^DIC(6,APCLPRV,0),"^"),0),"^")),!
+2 QUIT
ICDLN ;EP
+1 IF $Y>(IOSL-9)
DO HEAD^APCLAUD2
+2 WRITE !!!,"---> ICD Code Range: "
+3 IF $DATA(APCLALLI)
WRITE "ALL ICD Codes."
GOTO ICDLN1
+4 WRITE ^XTMP("APCLAUD",APCLJOB,APCLBT,APCLIRNG,"ICDB")," through ",^("ICDE")
ICDLN1 WRITE !?6,"Total Matches: ",APCLCNT
WRITE " Matches Selected: ",APCLGOT
+1 QUIT