APCLWL1 ; IHS/CMI/LAB - CLINIC HOURLY WORKLOAD REPORT ;
;;2.0;IHS PCC SUITE;;MAY 14, 2009
DOC ;See INFORM section for documentation notes for this routine
;
;List of VARIABLES with brief descriptions:
;
START ;Start of routine
I '$G(DUZ(2)) W $C(7),$C(7),!!,"SITE NOT SET IN DUZ(2) - NOTIFY SITE MANAGER!!",!! K APCLSITE Q
S APCLSITE=DUZ(2)
INFORM ;
W:$D(IOF) @IOF
W !," ******* TALLY OF DAILY VISITS BY 24-HOUR TIME FRAMES *******"
W !,"- This report will generate an hourly visit count, by clinic,",!," for a date range that you specify.",!
W "- ALL visits in the database will be included in the tabulation with",!," the exception of the following: "
W !," VISIT TYPES: Contract, VA",!," VISIT SERVICE CATEGORIES: Chart Review, In-Hospital, Ancillary,",!?31,"Hospitalizations, Events, Telecommunications",!
W "- Visits MUST have a Primary Provider and Purpose of Visit.",!
W "- The report will be totaled by hourly time frames.",!
;
GETDATES ;This section gets BEGINNING and ENDING dates:
BD ;Get beginning date
W ! S DIR(0)="D^:DT:EP",DIR("A")="Enter Beginning Visit Date" D ^DIR
K DIR S:$D(DUOUT) DIRUT=1
I $D(DIRUT) G XIT
S APCLBD=Y
ED ;Get ending date
W ! S DIR(0)="DA^"_APCLBD_":DT:EP",DIR("A")="Enter Ending Visit Date: "
S Y=APCLBD D DD^%DT S Y="" D ^DIR
K DIR S:$D(DUOUT) DIRUT=1
I $D(DIRUT) G BD
S APCLED=Y,X1=APCLBD,X2=-1
S X1=APCLBD,X2=-1 D C^%DTC S APCLSD=X
;
LOC ;Enter facility
S DIC("A")="Select Facility: ",DIC="^AUTTLOC(",DIC(0)="AEMQ",DIC("B")=$P(^DIC(4,DUZ(2),0),U) D ^DIC K DIC,DA G:Y<0 BD
S APCLLOC=+Y
;
CLIN ;Select Clinic(s)
S DIR(0)="YO",DIR("A")="Include visits from ALL Clinics",DIR("B")="NO",DIR("?")="If you wish to include visits from ALL of clinics answer Yes. If you wish to tabulate for a single clinic enter NO." D ^DIR K DIR
G:$D(DIRUT) BD
I Y=1 S APCLCLN="" G AGE
CLIN1 ;
S DIC("A")="Select Clinic: ",DIC="^DIC(40.7,",DIC(0)="AEMQ" D ^DIC K DIC,DA G:Y<0 CLIN
S APCLCLN=+Y
AGE ;Age Screening
K APCLAGE,APCLAGET
W ! S DIR(0)="YO",DIR("A")="Would you like to restrict the report by Patient age range",DIR("B")="YES"
S DIR("?")="If you wish to include visits from ALL age ranges, anwser No. If you wish to include visits for only patients within a particular age range, enter Yes."
D ^DIR K DIR
G:$D(DIRUT) CLIN
I 'Y G PROV
;
AGER ;Age Screening
W !
S DIR(0)="FO^1:7",DIR("A")="Enter an Age Range (e.g. 5-12,1-1)" D ^DIR
I Y="" W !!,"No age range entered." G AGE
I Y'?1.3N1"-"1.3N W !!,$C(7),$C(7),"Enter a numeric range in the format nnn-nnn. e.g. 0-5, 0-99, 5-20." G AGER
S APCLAGET=Y
;
PROV ;Provider Screening
;
S DIR(0)="YO",DIR("A")="Include visits from ALL Providers",DIR("B")="NO",DIR("?")="If you wish to include visits from ALL of Providers answer Yes. If you wish to tabulate for a single Provider enter NO." D ^DIR K DIR
G:$D(DIRUT) BD
I Y=1 S APCLPROV="" G ZIS
PROV1 ;Provider Screening
;
S DIC("A")="Select Provider: ",DIC=$S($P(^DD(9000010.06,.01,0),U,2)[200:"^VA(200,",1:"^DIC(6,"),DIC(0)="AEMQ" D ^DIC K DIC,DA G:Y<0 PROV
S APCLPROV=+Y
ZIS ;
DEMO ;
D DEMOCHK^APCLUTL(.APCLDEMO)
I APCLDEMO=-1 G PROV
W !!,$C(7),$C(7),"THIS REPORT MUST BE PRINTED ON 132 COLUMN PAPER OR ON A PRINTER THAT IS",!,"SET UP FOR CONDENSED PRINT!!!",!!,"IF YOU DO NOT HAVE SUCH A PRINTER AVAILABLE - SEE YOUR SITE MANAGER.",!!
S XBRP="^APCLWL1P",XBRC="^APCLWL11",XBRX="XIT^APCLWL1",XBNS="APCL"
D ^XBDBQUE
D XIT
Q
ERR W $C(7),$C(7),!,"Must be a valid date and be Today or earlier. Time not allowed!" Q
XIT ;
K APCL132S,APCLBD,APCLBDD,APCLCLN,APCLCLNT,APCLDT,APCLED,APCLEDD,APCLTAB,APCLGTOT,APCLODAT,APCLPG,APCLSD,APCLSITE,APCLSRT2,APCLTIME,APCLET,APCLAGET
K APCLVDFN,APCLVLOC,APCLVREC,APCLBT,APCLLENG,APCLLOC,APCLLOCT,APCLQUIT,APCLJOB,APCLDATE,APCL1,APCL2,APCLDOW,APCLCLIN,APCLPROV,APCLFILE
K X,Y,ZTSK,X1,X2,XBNS,XBRC,XBRP,XBRX,DIC,DA,DIG,DIH,DIR,DIRUT,DIU,DIV
Q
;
APCLWL1 ; IHS/CMI/LAB - CLINIC HOURLY WORKLOAD REPORT ;
+1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
DOC ;See INFORM section for documentation notes for this routine
+1 ;
+2 ;List of VARIABLES with brief descriptions:
+3 ;
START ;Start of routine
+1 IF '$GET(DUZ(2))
WRITE $CHAR(7),$CHAR(7),!!,"SITE NOT SET IN DUZ(2) - NOTIFY SITE MANAGER!!",!!
KILL APCLSITE
QUIT
+2 SET APCLSITE=DUZ(2)
INFORM ;
+1 IF $DATA(IOF)
WRITE @IOF
+2 WRITE !," ******* TALLY OF DAILY VISITS BY 24-HOUR TIME FRAMES *******"
+3 WRITE !,"- This report will generate an hourly visit count, by clinic,",!," for a date range that you specify.",!
+4 WRITE "- ALL visits in the database will be included in the tabulation with",!," the exception of the following: "
+5 WRITE !," VISIT TYPES: Contract, VA",!," VISIT SERVICE CATEGORIES: Chart Review, In-Hospital, Ancillary,",!?31,"Hospitalizations, Events, Telecommunications",!
+6 WRITE "- Visits MUST have a Primary Provider and Purpose of Visit.",!
+7 WRITE "- The report will be totaled by hourly time frames.",!
+8 ;
GETDATES ;This section gets BEGINNING and ENDING dates:
BD ;Get beginning date
+1 WRITE !
SET DIR(0)="D^:DT:EP"
SET DIR("A")="Enter Beginning Visit Date"
DO ^DIR
+2 KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+3 IF $DATA(DIRUT)
GOTO XIT
+4 SET APCLBD=Y
ED ;Get ending date
+1 WRITE !
SET DIR(0)="DA^"_APCLBD_":DT:EP"
SET DIR("A")="Enter Ending Visit Date: "
+2 SET Y=APCLBD
DO DD^%DT
SET Y=""
DO ^DIR
+3 KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+4 IF $DATA(DIRUT)
GOTO BD
+5 SET APCLED=Y
SET X1=APCLBD
SET X2=-1
+6 SET X1=APCLBD
SET X2=-1
DO C^%DTC
SET APCLSD=X
+7 ;
LOC ;Enter facility
+1 SET DIC("A")="Select Facility: "
SET DIC="^AUTTLOC("
SET DIC(0)="AEMQ"
SET DIC("B")=$PIECE(^DIC(4,DUZ(2),0),U)
DO ^DIC
KILL DIC,DA
IF Y<0
GOTO BD
+2 SET APCLLOC=+Y
+3 ;
CLIN ;Select Clinic(s)
+1 SET DIR(0)="YO"
SET DIR("A")="Include visits from ALL Clinics"
SET DIR("B")="NO"
SET DIR("?")="If you wish to include visits from ALL of clinics answer Yes. If you wish to tabulate for a single clinic enter NO."
DO ^DIR
KILL DIR
+2 IF $DATA(DIRUT)
GOTO BD
+3 IF Y=1
SET APCLCLN=""
GOTO AGE
CLIN1 ;
+1 SET DIC("A")="Select Clinic: "
SET DIC="^DIC(40.7,"
SET DIC(0)="AEMQ"
DO ^DIC
KILL DIC,DA
IF Y<0
GOTO CLIN
+2 SET APCLCLN=+Y
AGE ;Age Screening
+1 KILL APCLAGE,APCLAGET
+2 WRITE !
SET DIR(0)="YO"
SET DIR("A")="Would you like to restrict the report by Patient age range"
SET DIR("B")="YES"
+3 SET DIR("?")="If you wish to include visits from ALL age ranges, anwser No. If you wish to include visits for only patients within a particular age range, enter Yes."
+4 DO ^DIR
KILL DIR
+5 IF $DATA(DIRUT)
GOTO CLIN
+6 IF 'Y
GOTO PROV
+7 ;
AGER ;Age Screening
+1 WRITE !
+2 SET DIR(0)="FO^1:7"
SET DIR("A")="Enter an Age Range (e.g. 5-12,1-1)"
DO ^DIR
+3 IF Y=""
WRITE !!,"No age range entered."
GOTO AGE
+4 IF Y'?1.3N1"-"1.3N
WRITE !!,$CHAR(7),$CHAR(7),"Enter a numeric range in the format nnn-nnn. e.g. 0-5, 0-99, 5-20."
GOTO AGER
+5 SET APCLAGET=Y
+6 ;
PROV ;Provider Screening
+1 ;
+2 SET DIR(0)="YO"
SET DIR("A")="Include visits from ALL Providers"
SET DIR("B")="NO"
SET DIR("?")="If you wish to include visits from ALL of Providers answer Yes. If you wish to tabulate for a single Provider enter NO."
DO ^DIR
KILL DIR
+3 IF $DATA(DIRUT)
GOTO BD
+4 IF Y=1
SET APCLPROV=""
GOTO ZIS
PROV1 ;Provider Screening
+1 ;
+2 SET DIC("A")="Select Provider: "
SET DIC=$SELECT($PIECE(^DD(9000010.06,.01,0),U,2)[200:"^VA(200,",1:"^DIC(6,")
SET DIC(0)="AEMQ"
DO ^DIC
KILL DIC,DA
IF Y<0
GOTO PROV
+3 SET APCLPROV=+Y
ZIS ;
DEMO ;
+1 DO DEMOCHK^APCLUTL(.APCLDEMO)
+2 IF APCLDEMO=-1
GOTO PROV
+3 WRITE !!,$CHAR(7),$CHAR(7),"THIS REPORT MUST BE PRINTED ON 132 COLUMN PAPER OR ON A PRINTER THAT IS",!,"SET UP FOR CONDENSED PRINT!!!",!!,"IF YOU DO NOT HAVE SUCH A PRINTER AVAILABLE - SEE YOUR SITE MANAGER.",!!
+4 SET XBRP="^APCLWL1P"
SET XBRC="^APCLWL11"
SET XBRX="XIT^APCLWL1"
SET XBNS="APCL"
+5 DO ^XBDBQUE
+6 DO XIT
+7 QUIT
ERR WRITE $CHAR(7),$CHAR(7),!,"Must be a valid date and be Today or earlier. Time not allowed!"
QUIT
XIT ;
+1 KILL APCL132S,APCLBD,APCLBDD,APCLCLN,APCLCLNT,APCLDT,APCLED,APCLEDD,APCLTAB,APCLGTOT,APCLODAT,APCLPG,APCLSD,APCLSITE,APCLSRT2,APCLTIME,APCLET,APCLAGET
+2 KILL APCLVDFN,APCLVLOC,APCLVREC,APCLBT,APCLLENG,APCLLOC,APCLLOCT,APCLQUIT,APCLJOB,APCLDATE,APCL1,APCL2,APCLDOW,APCLCLIN,APCLPROV,APCLFILE
+3 KILL X,Y,ZTSK,X1,X2,XBNS,XBRC,XBRP,XBRX,DIC,DA,DIG,DIH,DIR,DIRUT,DIU,DIV
+4 QUIT
+5 ;