- APCLER1 ; IHS/CMI/LAB - APC visit counts by selected vars ;
- ;;2.0;IHS PCC SUITE;;MAY 14, 2009
- ;
- START ;
- I '$G(DUZ(2)) W $C(7),$C(7),!!,"SITE NOT SET IN DUZ(2) - NOTIFY SITE MANAGER!!",!! Q
- S APCLSITE=DUZ(2)
- S APCLJOB=$J,APCLBTH=$H
- D INFORM
- ;
- GETDATES ;
- BD ;get beginning date
- W ! S DIR(0)="D^:DT:EP",DIR("A")="Enter beginning Visit Date for Search" 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 for Search: " 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
- S X1=APCLBD,X2=-1 D C^%DTC S APCLSD=X
- ;
- CLINIC ;
- S APCLCLN=""
- S DIR(0)="S^A:ANY Clinic;O:One particular Clinic",DIR("A")="Include Returns from",DIR("B")="A" K DA D ^DIR K DIR
- G:$D(DIRUT) GETDATES
- I Y="A" G LOC
- CLN ;get clinic at which the patient should have been seen prior
- ;to returning to ER
- W !!,"You must indicate in which clinic the patient was to have seen seen prior",!,"to returning to the Emergency Room",!
- S DIC("A")="Which Clinic: ",DIC="^DIC(40.7,",DIC(0)="AEMQ" D ^DIC K DIC,DA G:X="^" CLINIC K DIC,DA G:Y<0 CLN
- S APCLCLN=+Y
- LOC ;get location
- W ! S DIR(0)="YO",DIR("A")="Include visits from ALL Locations",DIR("?")="If you wish to include visits from ALL locations answer Yes. If you wish to tabulate for only one location of encounter enter NO." D ^DIR K DIR
- G:$D(DIRUT) BD
- I Y=1 S APCLLOC="" G HR
- LOC1 ;enter location
- S DIC("A")="Which Location: ",DIC="^AUTTLOC(",DIC(0)="AEMQ" D ^DIC K DIC,DA G:Y<0 LOC
- S APCLLOC=+Y
- HR ;48 or 72 hr
- S APCLHR=""
- S DIR(0)="S^7:72 HOURS;4:48 HOURS",DIR("A")="Run Report for returns w/in how many hours",DIR("B")="7" KILL DA D ^DIR KILL DIR
- I $D(DIRUT) G LOC
- S APCLHR=Y
- DEF S X=30,DIC(0)="M",DIC="^DIC(40.7," D ^DIC K DIC,X I Y=-1 W !!,"CLINIC CODE 30 - EMERGENCY ROOM MISSING FROM FILE - NOTIFY YOUR SITE MANAGER!!" G XIT
- S APCLERCL=+Y
- PROV ;one provider or all
- S APCLPROV=""
- S DIR(0)="S^A:ANY Provider;O:One particular Provider",DIR("A")="Include Returns from Clinic Visits to",DIR("B")="A" K DA D ^DIR K DIR
- G:$D(DIRUT) GETDATES
- I Y="A" G ZIS
- PRV ;get provider which the patient should have been seen prior
- ;to returning to ER
- W !!,"You must indicate in which provider the patient was to have seen seen prior",!,"to returning to the Emergency Room",!
- S DIC("A")="Which Provider: ",DIC="^VA(200,",DIC(0)="AEMQ" D ^DIC K DIC,DA G:X="^" PROV K DIC,DA G:Y<0 PRV
- S APCLPROV=+Y
- ZIS ;call to XBDBQUE
- DEMO ;
- D DEMOCHK^APCLUTL(.APCLDEMO)
- I APCLDEMO=-1 G PROV
- S XBRP="^APCLER1P",XBRC="^APCLER11",XBRX="XIT^APCLER1",XBNS="APCL"
- D ^XBDBQUE
- D XIT
- Q
- XIT ;
- K APCL1,APCL2,APCL3D,APCLAGE,APCLAP,APCLBD,APCLBDD,APCLBT,APCLBTH,APCLCLIN,APCLCLN,APCLDATE,APCLDFN,APCLDISC,APCLDT,APCLED,APCLEDD,APCLERCL,APCLET,APCLFAC,APCLFRST,APCLFVD,APCLHIGH,APCLHRCN,APCLIVD,APCLJOB,APCLLOC,APCLLOCC,APCLNAME
- K APCLODAT,APCLP,APCLPG,APLCPPOV,APCLQUIT,APCLSD,APCLSITE,APCLSKIP,APCLT1,APCLT2,APCLV,APCLVD,APCLVDFN,APCLVLOC,APCLVREC,APCLX,APCLY,APCLZ
- K X,X1,X2,IO("Q"),%,Y,POP,DIRUT,ZTSK,ZTQUEUED,H,S,TS,M,DA,D0,DR,DIC,DIE,DIR,DTOUT,DUOUT,H,M,S
- Q
- INFORM ;
- W:$D(IOF) @IOF
- W !!,"This report will produce a list of patient visits. The visits are those",!,"for which the patient had a clinic visit and then returned within 48/72 hours "
- W !,"of that visit to the Emergency Room. The user selects which clinic"
- W !,"and which location of encounter.",!
- W "The user may limit the list to just visits to a particular provider."
- W !,"This list of visits can potentially be used for Ambulatory Indicator A-1",!,"of the Maryland Hospital Association Project.",!
- Q
- ;
- APCLER1 ; IHS/CMI/LAB - APC visit counts by selected vars ;
- +1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
- +2 ;
- START ;
- +1 IF '$GET(DUZ(2))
- WRITE $CHAR(7),$CHAR(7),!!,"SITE NOT SET IN DUZ(2) - NOTIFY SITE MANAGER!!",!!
- QUIT
- +2 SET APCLSITE=DUZ(2)
- +3 SET APCLJOB=$JOB
- SET APCLBTH=$HOROLOG
- +4 DO INFORM
- +5 ;
- GETDATES ;
- BD ;get beginning date
- +1 WRITE !
- SET DIR(0)="D^:DT:EP"
- SET DIR("A")="Enter beginning Visit Date for Search"
- DO ^DIR
- KILL DIR
- IF $DATA(DUOUT)
- SET DIRUT=1
- +2 IF $DATA(DIRUT)
- GOTO XIT
- +3 SET APCLBD=Y
- ED ;get ending date
- +1 WRITE !
- SET DIR(0)="DA^"_APCLBD_":DT:EP"
- SET DIR("A")="Enter ending Visit Date for Search: "
- SET Y=APCLBD
- DO DD^%DT
- SET Y=""
- DO ^DIR
- KILL DIR
- IF $DATA(DUOUT)
- SET DIRUT=1
- +2 IF $DATA(DIRUT)
- GOTO BD
- +3 SET APCLED=Y
- +4 SET X1=APCLBD
- SET X2=-1
- DO C^%DTC
- SET APCLSD=X
- +5 ;
- CLINIC ;
- +1 SET APCLCLN=""
- +2 SET DIR(0)="S^A:ANY Clinic;O:One particular Clinic"
- SET DIR("A")="Include Returns from"
- SET DIR("B")="A"
- KILL DA
- DO ^DIR
- KILL DIR
- +3 IF $DATA(DIRUT)
- GOTO GETDATES
- +4 IF Y="A"
- GOTO LOC
- CLN ;get clinic at which the patient should have been seen prior
- +1 ;to returning to ER
- +2 WRITE !!,"You must indicate in which clinic the patient was to have seen seen prior",!,"to returning to the Emergency Room",!
- +3 SET DIC("A")="Which Clinic: "
- SET DIC="^DIC(40.7,"
- SET DIC(0)="AEMQ"
- DO ^DIC
- KILL DIC,DA
- IF X="^"
- GOTO CLINIC
- KILL DIC,DA
- IF Y<0
- GOTO CLN
- +4 SET APCLCLN=+Y
- LOC ;get location
- +1 WRITE !
- SET DIR(0)="YO"
- SET DIR("A")="Include visits from ALL Locations"
- SET DIR("?")="If you wish to include visits from ALL locations answer Yes. If you wish to tabulate for only one location of encounter enter NO."
- DO ^DIR
- KILL DIR
- +2 IF $DATA(DIRUT)
- GOTO BD
- +3 IF Y=1
- SET APCLLOC=""
- GOTO HR
- LOC1 ;enter location
- +1 SET DIC("A")="Which Location: "
- SET DIC="^AUTTLOC("
- SET DIC(0)="AEMQ"
- DO ^DIC
- KILL DIC,DA
- IF Y<0
- GOTO LOC
- +2 SET APCLLOC=+Y
- HR ;48 or 72 hr
- +1 SET APCLHR=""
- +2 SET DIR(0)="S^7:72 HOURS;4:48 HOURS"
- SET DIR("A")="Run Report for returns w/in how many hours"
- SET DIR("B")="7"
- KILL DA
- DO ^DIR
- KILL DIR
- +3 IF $DATA(DIRUT)
- GOTO LOC
- +4 SET APCLHR=Y
- DEF SET X=30
- SET DIC(0)="M"
- SET DIC="^DIC(40.7,"
- DO ^DIC
- KILL DIC,X
- IF Y=-1
- WRITE !!,"CLINIC CODE 30 - EMERGENCY ROOM MISSING FROM FILE - NOTIFY YOUR SITE MANAGER!!"
- GOTO XIT
- +1 SET APCLERCL=+Y
- PROV ;one provider or all
- +1 SET APCLPROV=""
- +2 SET DIR(0)="S^A:ANY Provider;O:One particular Provider"
- SET DIR("A")="Include Returns from Clinic Visits to"
- SET DIR("B")="A"
- KILL DA
- DO ^DIR
- KILL DIR
- +3 IF $DATA(DIRUT)
- GOTO GETDATES
- +4 IF Y="A"
- GOTO ZIS
- PRV ;get provider which the patient should have been seen prior
- +1 ;to returning to ER
- +2 WRITE !!,"You must indicate in which provider the patient was to have seen seen prior",!,"to returning to the Emergency Room",!
- +3 SET DIC("A")="Which Provider: "
- SET DIC="^VA(200,"
- SET DIC(0)="AEMQ"
- DO ^DIC
- KILL DIC,DA
- IF X="^"
- GOTO PROV
- KILL DIC,DA
- IF Y<0
- GOTO PRV
- +4 SET APCLPROV=+Y
- ZIS ;call to XBDBQUE
- DEMO ;
- +1 DO DEMOCHK^APCLUTL(.APCLDEMO)
- +2 IF APCLDEMO=-1
- GOTO PROV
- +3 SET XBRP="^APCLER1P"
- SET XBRC="^APCLER11"
- SET XBRX="XIT^APCLER1"
- SET XBNS="APCL"
- +4 DO ^XBDBQUE
- +5 DO XIT
- +6 QUIT
- XIT ;
- +1 KILL APCL1,APCL2,APCL3D,APCLAGE,APCLAP,APCLBD,APCLBDD,APCLBT,APCLBTH,APCLCLIN,APCLCLN,APCLDATE,APCLDFN,APCLDISC,APCLDT,APCLED,APCLEDD,APCLERCL,APCLET,APCLFAC,APCLFRST,APCLFVD,APCLHIGH,APCLHRCN,APCLIVD,APCLJOB,APCLLOC,APCLLOCC,APCLNAME
- +2 KILL APCLODAT,APCLP,APCLPG,APLCPPOV,APCLQUIT,APCLSD,APCLSITE,APCLSKIP,APCLT1,APCLT2,APCLV,APCLVD,APCLVDFN,APCLVLOC,APCLVREC,APCLX,APCLY,APCLZ
- +3 KILL X,X1,X2,IO("Q"),%,Y,POP,DIRUT,ZTSK,ZTQUEUED,H,S,TS,M,DA,D0,DR,DIC,DIE,DIR,DTOUT,DUOUT,H,M,S
- +4 QUIT
- INFORM ;
- +1 IF $DATA(IOF)
- WRITE @IOF
- +2 WRITE !!,"This report will produce a list of patient visits. The visits are those",!,"for which the patient had a clinic visit and then returned within 48/72 hours "
- +3 WRITE !,"of that visit to the Emergency Room. The user selects which clinic"
- +4 WRITE !,"and which location of encounter.",!
- +5 WRITE "The user may limit the list to just visits to a particular provider."
- +6 WRITE !,"This list of visits can potentially be used for Ambulatory Indicator A-1",!,"of the Maryland Hospital Association Project.",!
- +7 QUIT
- +8 ;