APCDCAFE ; IHS/CMI/LAB - ;
;;2.0;IHS PCC SUITE;**2**;MAY 14, 2009
;
START ;
D XIT
I '$D(IOF) D HOME^%ZIS
D TERM^VALM0
W @(IOF),!!
D INFORM
I $P(^APCCCTRL(DUZ(2),0),U,12)="" W !!,"The EHR/PCC Coding Audit Start Date has not been set",!,"in the PCC Master Control file." D D XIT Q
.W !!,"Please see your Clinical Coordinator or PCC Manager."
.S DIR(0)="E",DIR("A")="Press Enter" KILL DA D ^DIR KILL DIR
.Q
DATES K APCDED,APCDBD
K DIR W ! S DIR(0)="DO^::EXP",DIR("A")="Enter Beginning Visit Date"
D ^DIR G:Y<1 XIT S APCDBD=Y
I APCDBD<$P($G(^APCCCTRL(DUZ(2),0)),U,12) D G DATES
.W !!,"That date is before the EHR/PCC Coding Start Date."
.W !,"Please enter a date on or after "_$$FMTE^XLFDT($P(^APCCCTRL(DUZ(2),0),U,12))
K DIR S DIR(0)="DO^:DT:EXP",DIR("A")="Enter Ending Visit Date"
D ^DIR G:Y<1 XIT S APCDED=Y
;
I APCDED<APCDBD D G DATES
. W !!,$C(7),"Sorry, Ending Date MUST not be earlier than Beginning Date."
S APCDSD=$$FMADD^XLFDT(APCDBD,-1)_".9999"
;
NOD ;
S APCDNOD=""
W !,"Enter the # of days to use to determine whether a visit was marked within"
W !,"the appropriate time limit. For example, if outpatient visits should"
W !,"be marked as completed/reviewed within 3 days of the visit date, enter 3."
S DIR(0)="N^1:9999:0",DIR("A")="How Many Days between the visit date and the date completed",DIR("B")="3" KILL DA D ^DIR KILL DIR
I $D(DIRUT) G DATES
S APCDNOD=Y
FAC ;
K APCDQ
W !!,$G(IORVON)_"Please enter which FACILITY visits will be included in the list."_$G(IORVOFF),!
S APCDLOCT=""
K APCDLOCS
S DIR(0)="S^A:ALL Locations/Facilities;S:Selected set or Taxonomy of Locations;O:ONE Location/Facility",DIR("A")="Include Visits to Which Location/Facilities",DIR("B")="A"
S DIR("A")="Enter a code indicating what LOCATIONS/FACILITIES are of interest",DIR("B")="A" K DA D ^DIR K DIR,DA
G:$D(DIRUT) DATES
S APCDLOCT=Y
I APCDLOCT="A" G SC
D @(APCDLOCT_"LOC")
G:$D(APCDQ) FAC
SC ;
K APCDQ
W !!,$G(IORVON)_"Please enter which SERVICE CATEGORIES will be included",!,"in the list."_$G(IORVOFF),!
S APCDSCT=""
K APCDSCS
K DIR S DIR(0)="S^A:ALL Service Categories;S:Selected set or Taxonomy of Service Categories;O:One Service Category",DIR("A")="Include Visits to Which Service Categories",DIR("B")="A"
S DIR("A")="Enter a code indicating what SERVICE CATEGORIES are of interest",DIR("B")="A" K DA D ^DIR K DIR,DA
G:$D(DIRUT) FAC
S APCDSCT=Y
I APCDSCT="A" G CLINIC
D @(APCDSCT_"SC")
G:$D(APCDQ) SC
CLINIC ;
K APCDQ
W !!,$G(IORVON)_"Please enter which CLINIC (IHS clinic codes) visits will be included",!,"in the list."_$G(IORVOFF),!
S APCDCLNT=""
K APCDCLNS
K DIR S DIR(0)="S^A:ALL Clinics;S:Selected set or Taxonomy of Clinics;O:ONE Clinic",DIR("A")="Include Visits to Which Clinics",DIR("B")="A"
S DIR("A")="Enter a code indicating what CLINICS (IHS clinic code) are of interest",DIR("B")="A" K DA D ^DIR K DIR,DA
G:$D(DIRUT) SC
S APCDCLNT=Y
I APCDCLNT="A" G HOSPLOC
D @(APCDCLNT_"CLN")
G:$D(APCDQ) CLINIC
HOSPLOC ;
K APCDQ
W !!,$G(IORVON)_"Please enter which HOSPITAL LOCATIONS will be included in the list."_$G(IORVOFF),!
S APCDHLT=""
K APCDHLS
S DIR(0)="S^A:ALL Hospital Locations;S:Selected set of Hospital Locations;O:ONE Hospital Location",DIR("A")="Include Visits to Which Hospital Locations",DIR("B")="A"
S DIR("A")="Enter a code indicating what HOSPITAL LOCATIONS are of interest",DIR("B")="A" K DA D ^DIR K DIR,DA
G:$D(DIRUT) CLINIC
S APCDHLT=Y
I APCDHLT="A" G PRIMPROV
D @(APCDHLT_"HL")
G:$D(APCDQ) HOSPLOC
PRIMPROV ;
K APCDQ
W !!,$G(IORVON)_"Please enter the Providers whose visits you want to display",!,"This will screen on the primary provider on the visit."_$G(IORVOFF),!
S APCDPRVT=""
K APCDPRVS
S DIR(0)="S^A:ALL Providers;S:Selected set or Taxonomy of Providers;O:ONE Provider",DIR("A")="Include Visits to Which Providers",DIR("B")="A"
S DIR("A")="Enter a code indicating which providers are of interest",DIR("B")="A" K DA D ^DIR K DIR,DA
G:$D(DIRUT) HOSPLOC
S APCDPRVT=Y
I APCDPRVT="A" G STATUS
D @(APCDPRVT_"PRV")
G:$D(APCDQ) PRIMPROV
STATUS ;
PROCESS ;
W:$D(IOF) @IOF W !!
W !!,"I will count visits that meet the following criteria:"
W !!,"VISIT DATES: ",$$FMTE^XLFDT(APCDBD)," to ",$$FMTE^XLFDT(APCDED)
W !,"VISIT TYPE: NOT Contract"
W !!,"LOCATION OF ENCOUNTER: " D
.I '$D(APCDLOCS) W "All" Q
.S Y=0,C=0 F S Y=$O(APCDLOCS(Y)) Q:Y'=+Y S C=C+1 W:C>1 ";" W ?24,$E($P(^DIC(4,Y,0),U),1,15)
W !!,"SERVICE CATEGORIES: " D
.I '$D(APCDSCS) W "All" Q
.S Y=0,C=0 F S Y=$O(APCDSCS(Y)) Q:Y'=+Y S C=C+1 W:C>1 ";" W ?24,$$EXTSET^XBFUNC(9000010,.07,Y)
W !!,"CLINICS: " D
.I '$D(APCDCLNS) W "All" Q
.S Y=0,C=0 F S Y=$O(APCDCLNS(Y)) Q:Y'=+Y S C=C+1 W:C>1 ";" W ?24,$E($P(^DIC(40.7,Y,0),U),1,15)
W !!,"HOSPITAL LOCATIONS: " D
.I '$D(APCDHLS) W "All" Q
.S Y=0,C=0 F S Y=$O(APCDHLS(Y)) Q:Y'=+Y S C=C+1 W:C>1 ";" W ?24,$E($P(^SC(Y,0),U),1,15)
W !!,"PRIMARY PROVIDER ON VISIT: " D
.I '$D(APCDPRV) W "All" Q
.S Y=0,C=0 F S Y=$O(APCDPRVS(Y)) Q:Y'=+Y S C=C+1 W:C>1 ";" W ?24,$E($P(^VA(200,Y,0),U),1,15)
;
COUNT ;
S APCDCORL=""
S DIR(0)="S^C:Count of Visits Only;L:List of Visits and a Count of Visits",DIR("A")="Do you want",DIR("B")="C" KILL DA D ^DIR KILL DIR
I $D(DIRUT) G PRIMPROV
S APCDCORL=Y
SORT ;how to sort list of visits
S APCDSORT=""
S DIR(0)="S^C:Clinic;O:Hospital Location"
S DIR("A")="How would you like to "_$S(APCDCORL="C":"tally the visits",1:"sort the list of visits"),DIR("B")="C" KILL DA D ^DIR KILL DIR
I $D(DIRUT) G XIT
S APCDSORT=Y
ZIS ;call xbdbque
S XBRC="DRIVER^APCDCAFE",XBRP="PRINT^APCDCAFF",XBRX="XIT^APCDCAFE",XBNS="APCD"
D ^XBDBQUE
D XIT
Q
DRIVER ;EP entry point for taskman
S APCDBT=$H,APCDJOB=$J
K ^XTMP("APCDCAFE",APCDJOB,APCDBT)
D ^APCDCAFF
S APCDET=$H
Q
XIT ;
K DIR
D EN^XBVK("APCD") ;clean up APCD variables
D ^XBFMK ;clean up fileman variables
D KILL^AUPNPAT ;clean up AUPN
D EN^XBVK("AMQQ") ;clean up after qman
Q
;
D(D) ;
I $G(D)="" Q ""
Q $E(D,4,5)_"/"_$E(D,6,7)_"/"_$E(D,2,3)
CTR(X,Y) ;EP - Center X in a field Y wide.
Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
;----------
EOP ;EP - End of page.
Q:$E(IOST)'="C"
Q:$D(ZTQUEUED)!'(IOT="TRM")!$D(IO("S"))
NEW DIR
K DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
S DIR("A")="End of report. Press Enter",DIR(0)="E" D ^DIR
Q
;----------
USR() ;EP - Return name of current user from ^VA(200.
Q $S($G(DUZ):$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
;----------
LOC() ;EP - Return location name from file 4 based on DUZ(2).
Q $S($G(DUZ(2)):$S($D(^DIC(4,DUZ(2),0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
;----------
INFORM ;inform user what this report is all about
W !,$$CTR($$LOC)
W !!,$$CTR("PCC/EHR CODING AUDIT")
W !!,"This report will count all visits that were not marked as"
W !,"reviewed/complete within a specified # of days from the date of the visit."
W !,"The visits can be selected by date, primary provider, facility"
W !,"clinic or hospital location. This list can be sorted by clinic code,"
W !," or hospital location (scheduling clinic)."
W !,"Contract Health visits are excluded."
W !,"Visits with the following service categories are INCLUDED in the list, "
W !,"unless you specify otherwise when prompted to do so:"
I '$D(^APCDSITE(DUZ(2),13,"B","A")) W !," - A Ambulatory"
I '$D(^APCDSITE(DUZ(2),13,"B","H")) W !," - H Hospitalization"
I '$D(^APCDSITE(DUZ(2),13,"B","I")) W !," - I In-Hospital"
I '$D(^APCDSITE(DUZ(2),13,"B","S")) W !," - S Day Surgery"
I '$D(^APCDSITE(DUZ(2),13,"B","O")) W !," - O Observation"
I '$D(^APCDSITE(DUZ(2),13,"B","T")) W !," - T Telecommunications"
I '$D(^APCDSITE(DUZ(2),13,"B","C")) W !," - C Chart Review"
I '$D(^APCDSITE(DUZ(2),13,"B","R")) W !," - R Nursing Home"
I '$D(^APCDSITE(DUZ(2),13,"B","N")) W !," - N Not Found"
I '$D(^APCDSITE(DUZ(2),13,"B","M")) W !," - M Telemedicine"
;W !,"Unless you opt to include a certain set of the above categories.",!
Q
OLOC ;one location
S DIC="^AUTTLOC(",DIC(0)="AEMQ",DIC("A")="Which LOCATION: " D ^DIC K DIC
I Y=-1 S APCDQ="" Q
S APCDLOCS(+Y)=""
Q
SLOC ;taxonomy of locations
S X="LOCATION OF ENCOUNTER",DIC="^AMQQ(5,",DIC(0)="FM",DIC("S")="I $P(^(0),U,14)" D ^DIC K DIC,DA I Y=-1 W "OOPS - QMAN NOT CURRENT - QUITTING" G XIT
D PEP^AMQQGTX0(+Y,"APCDLOCS(")
I '$D(APCDLOCS) S APCDQ="" Q
I $D(APCDLOCS("*")) S APCDLOCT="A" K APCDLOCS W !!,"**** all locations will be included ****",! Q
Q
;
OCLN ;one clinic
S DIC="^DIC(40.7,",DIC(0)="AEMQ",DIC("A")="Which CLINIC: " D ^DIC K DIC
I Y=-1 S APCDQ="" Q
S APCDCLNS(+Y)=""
Q
SCLN ;taxonomy of clinics
S X="CLINIC",DIC="^AMQQ(5,",DIC(0)="FM",DIC("S")="I $P(^(0),U,14)" D ^DIC K DIC,DA I Y=-1 W "OOPS - QMAN NOT CURRENT - QUITTING" G XIT
D PEP^AMQQGTX0(+Y,"APCDCLNS(")
I '$D(APCDCLNS) S APCDQ="" Q
I $D(APCDCLNS("*")) S APCDCLNT="A" K APCDCLNS W !!,"**** all CLINICS will be included ****",! Q
Q
;
OHL ;one hosp location
S DIC="^SC(",DIC(0)="AEMQ",DIC("A")="Which HOSPITAL LOCATION: " D ^DIC K DIC
I Y=-1 S APCDQ="" Q
S APCDHLS(+Y)=""
Q
SHL ;selected hospital locations
S DIC="^SC(",DIC(0)="AEMQ",DIC("A")="Which HOSPITAL LOCATION: " D ^DIC K DIC
I X="" Q
I Y=-1 S APCDQ="" Q
S APCDHLS(+Y)=""
G SHL
OPRV ;one clinic
S DIC="^VA(200,",DIC(0)="AEMQ",DIC("A")="Which PROVIDER: " D ^DIC K DIC
I Y=-1 S APCDQ="" Q
S APCDPRVS(+Y)=""
Q
SPRV ;taxonomy of PROVIDERS
S X="PRIMARY PROVIDER",DIC="^AMQQ(5,",DIC(0)="FM",DIC("S")="I $P(^(0),U,14)" D ^DIC K DIC,DA I Y=-1 W "OOPS - QMAN NOT CURRENT - QUITTING" G XIT
D PEP^AMQQGTX0(+Y,"APCDPRVS(")
I '$D(APCDPRVS) S APCDQ="" Q
I $D(APCDPRVS("*")) S APCDPRVT="A" K APCDPRVS W !!,"**** all PROVIDERS will be included ****",! Q
Q
;
SCDR ;selected CHART DEF REASONS
S DIC="^AUTTCDR(",DIC(0)="AEMQ",DIC("A")="Which CHART DEFICIENCY REASON: " D ^DIC K DIC
I X="" Q
I Y=-1 S APCDQ="" Q
S APCDCDRS(+Y)=""
G SCDR
SSC ;
S X="SERVICE CATEGORY",DIC="^AMQQ(5,",DIC(0)="FM",DIC("S")="I $P(^(0),U,14)" D ^DIC K DIC,DA I Y=-1 W "OOPS - QMAN NOT CURRENT - QUITTING" G DATES
D PEP^AMQQGTX0(+Y,"APCDSCS(")
I '$D(APCDSCS) S APCDQ="" Q
I $D(APCDSCS("*")) S APCDSCT="A" K APCDSCS W !!,"**** all Services Categories will be included ****",! Q
Q
OSC ;
K DIR S DIR(0)="9000010,.07",DIR("A")="Enter SERVICE CATEGORY" KILL DA D ^DIR KILL DIR
I $D(DIRUT) S APCDQ="" Q
S APCDSCS(Y)=""
Q
APCDCAFE ; IHS/CMI/LAB - ;
+1 ;;2.0;IHS PCC SUITE;**2**;MAY 14, 2009
+2 ;
START ;
+1 DO XIT
+2 IF '$DATA(IOF)
DO HOME^%ZIS
+3 DO TERM^VALM0
+4 WRITE @(IOF),!!
+5 DO INFORM
+6 IF $PIECE(^APCCCTRL(DUZ(2),0),U,12)=""
WRITE !!,"The EHR/PCC Coding Audit Start Date has not been set",!,"in the PCC Master Control file."
Begin DoDot:1
+7 WRITE !!,"Please see your Clinical Coordinator or PCC Manager."
+8 SET DIR(0)="E"
SET DIR("A")="Press Enter"
KILL DA
DO ^DIR
KILL DIR
+9 QUIT
End DoDot:1
DO XIT
QUIT
DATES KILL APCDED,APCDBD
+1 KILL DIR
WRITE !
SET DIR(0)="DO^::EXP"
SET DIR("A")="Enter Beginning Visit Date"
+2 DO ^DIR
IF Y<1
GOTO XIT
SET APCDBD=Y
+3 IF APCDBD<$PIECE($GET(^APCCCTRL(DUZ(2),0)),U,12)
Begin DoDot:1
+4 WRITE !!,"That date is before the EHR/PCC Coding Start Date."
+5 WRITE !,"Please enter a date on or after "_$$FMTE^XLFDT($PIECE(^APCCCTRL(DUZ(2),0),U,12))
End DoDot:1
GOTO DATES
+6 KILL DIR
SET DIR(0)="DO^:DT:EXP"
SET DIR("A")="Enter Ending Visit Date"
+7 DO ^DIR
IF Y<1
GOTO XIT
SET APCDED=Y
+8 ;
+9 IF APCDED<APCDBD
Begin DoDot:1
+10 WRITE !!,$CHAR(7),"Sorry, Ending Date MUST not be earlier than Beginning Date."
End DoDot:1
GOTO DATES
+11 SET APCDSD=$$FMADD^XLFDT(APCDBD,-1)_".9999"
+12 ;
NOD ;
+1 SET APCDNOD=""
+2 WRITE !,"Enter the # of days to use to determine whether a visit was marked within"
+3 WRITE !,"the appropriate time limit. For example, if outpatient visits should"
+4 WRITE !,"be marked as completed/reviewed within 3 days of the visit date, enter 3."
+5 SET DIR(0)="N^1:9999:0"
SET DIR("A")="How Many Days between the visit date and the date completed"
SET DIR("B")="3"
KILL DA
DO ^DIR
KILL DIR
+6 IF $DATA(DIRUT)
GOTO DATES
+7 SET APCDNOD=Y
FAC ;
+1 KILL APCDQ
+2 WRITE !!,$GET(IORVON)_"Please enter which FACILITY visits will be included in the list."_$GET(IORVOFF),!
+3 SET APCDLOCT=""
+4 KILL APCDLOCS
+5 SET DIR(0)="S^A:ALL Locations/Facilities;S:Selected set or Taxonomy of Locations;O:ONE Location/Facility"
SET DIR("A")="Include Visits to Which Location/Facilities"
SET DIR("B")="A"
+6 SET DIR("A")="Enter a code indicating what LOCATIONS/FACILITIES are of interest"
SET DIR("B")="A"
KILL DA
DO ^DIR
KILL DIR,DA
+7 IF $DATA(DIRUT)
GOTO DATES
+8 SET APCDLOCT=Y
+9 IF APCDLOCT="A"
GOTO SC
+10 DO @(APCDLOCT_"LOC")
+11 IF $DATA(APCDQ)
GOTO FAC
SC ;
+1 KILL APCDQ
+2 WRITE !!,$GET(IORVON)_"Please enter which SERVICE CATEGORIES will be included",!,"in the list."_$GET(IORVOFF),!
+3 SET APCDSCT=""
+4 KILL APCDSCS
+5 KILL DIR
SET DIR(0)="S^A:ALL Service Categories;S:Selected set or Taxonomy of Service Categories;O:One Service Category"
SET DIR("A")="Include Visits to Which Service Categories"
SET DIR("B")="A"
+6 SET DIR("A")="Enter a code indicating what SERVICE CATEGORIES are of interest"
SET DIR("B")="A"
KILL DA
DO ^DIR
KILL DIR,DA
+7 IF $DATA(DIRUT)
GOTO FAC
+8 SET APCDSCT=Y
+9 IF APCDSCT="A"
GOTO CLINIC
+10 DO @(APCDSCT_"SC")
+11 IF $DATA(APCDQ)
GOTO SC
CLINIC ;
+1 KILL APCDQ
+2 WRITE !!,$GET(IORVON)_"Please enter which CLINIC (IHS clinic codes) visits will be included",!,"in the list."_$GET(IORVOFF),!
+3 SET APCDCLNT=""
+4 KILL APCDCLNS
+5 KILL DIR
SET DIR(0)="S^A:ALL Clinics;S:Selected set or Taxonomy of Clinics;O:ONE Clinic"
SET DIR("A")="Include Visits to Which Clinics"
SET DIR("B")="A"
+6 SET DIR("A")="Enter a code indicating what CLINICS (IHS clinic code) are of interest"
SET DIR("B")="A"
KILL DA
DO ^DIR
KILL DIR,DA
+7 IF $DATA(DIRUT)
GOTO SC
+8 SET APCDCLNT=Y
+9 IF APCDCLNT="A"
GOTO HOSPLOC
+10 DO @(APCDCLNT_"CLN")
+11 IF $DATA(APCDQ)
GOTO CLINIC
HOSPLOC ;
+1 KILL APCDQ
+2 WRITE !!,$GET(IORVON)_"Please enter which HOSPITAL LOCATIONS will be included in the list."_$GET(IORVOFF),!
+3 SET APCDHLT=""
+4 KILL APCDHLS
+5 SET DIR(0)="S^A:ALL Hospital Locations;S:Selected set of Hospital Locations;O:ONE Hospital Location"
SET DIR("A")="Include Visits to Which Hospital Locations"
SET DIR("B")="A"
+6 SET DIR("A")="Enter a code indicating what HOSPITAL LOCATIONS are of interest"
SET DIR("B")="A"
KILL DA
DO ^DIR
KILL DIR,DA
+7 IF $DATA(DIRUT)
GOTO CLINIC
+8 SET APCDHLT=Y
+9 IF APCDHLT="A"
GOTO PRIMPROV
+10 DO @(APCDHLT_"HL")
+11 IF $DATA(APCDQ)
GOTO HOSPLOC
PRIMPROV ;
+1 KILL APCDQ
+2 WRITE !!,$GET(IORVON)_"Please enter the Providers whose visits you want to display",!,"This will screen on the primary provider on the visit."_$GET(IORVOFF),!
+3 SET APCDPRVT=""
+4 KILL APCDPRVS
+5 SET DIR(0)="S^A:ALL Providers;S:Selected set or Taxonomy of Providers;O:ONE Provider"
SET DIR("A")="Include Visits to Which Providers"
SET DIR("B")="A"
+6 SET DIR("A")="Enter a code indicating which providers are of interest"
SET DIR("B")="A"
KILL DA
DO ^DIR
KILL DIR,DA
+7 IF $DATA(DIRUT)
GOTO HOSPLOC
+8 SET APCDPRVT=Y
+9 IF APCDPRVT="A"
GOTO STATUS
+10 DO @(APCDPRVT_"PRV")
+11 IF $DATA(APCDQ)
GOTO PRIMPROV
STATUS ;
PROCESS ;
+1 IF $DATA(IOF)
WRITE @IOF
WRITE !!
+2 WRITE !!,"I will count visits that meet the following criteria:"
+3 WRITE !!,"VISIT DATES: ",$$FMTE^XLFDT(APCDBD)," to ",$$FMTE^XLFDT(APCDED)
+4 WRITE !,"VISIT TYPE: NOT Contract"
+5 WRITE !!,"LOCATION OF ENCOUNTER: "
Begin DoDot:1
+6 IF '$DATA(APCDLOCS)
WRITE "All"
QUIT
+7 SET Y=0
SET C=0
FOR
SET Y=$ORDER(APCDLOCS(Y))
IF Y'=+Y
QUIT
SET C=C+1
IF C>1
WRITE ";"
WRITE ?24,$EXTRACT($PIECE(^DIC(4,Y,0),U),1,15)
End DoDot:1
+8 WRITE !!,"SERVICE CATEGORIES: "
Begin DoDot:1
+9 IF '$DATA(APCDSCS)
WRITE "All"
QUIT
+10 SET Y=0
SET C=0
FOR
SET Y=$ORDER(APCDSCS(Y))
IF Y'=+Y
QUIT
SET C=C+1
IF C>1
WRITE ";"
WRITE ?24,$$EXTSET^XBFUNC(9000010,.07,Y)
End DoDot:1
+11 WRITE !!,"CLINICS: "
Begin DoDot:1
+12 IF '$DATA(APCDCLNS)
WRITE "All"
QUIT
+13 SET Y=0
SET C=0
FOR
SET Y=$ORDER(APCDCLNS(Y))
IF Y'=+Y
QUIT
SET C=C+1
IF C>1
WRITE ";"
WRITE ?24,$EXTRACT($PIECE(^DIC(40.7,Y,0),U),1,15)
End DoDot:1
+14 WRITE !!,"HOSPITAL LOCATIONS: "
Begin DoDot:1
+15 IF '$DATA(APCDHLS)
WRITE "All"
QUIT
+16 SET Y=0
SET C=0
FOR
SET Y=$ORDER(APCDHLS(Y))
IF Y'=+Y
QUIT
SET C=C+1
IF C>1
WRITE ";"
WRITE ?24,$EXTRACT($PIECE(^SC(Y,0),U),1,15)
End DoDot:1
+17 WRITE !!,"PRIMARY PROVIDER ON VISIT: "
Begin DoDot:1
+18 IF '$DATA(APCDPRV)
WRITE "All"
QUIT
+19 SET Y=0
SET C=0
FOR
SET Y=$ORDER(APCDPRVS(Y))
IF Y'=+Y
QUIT
SET C=C+1
IF C>1
WRITE ";"
WRITE ?24,$EXTRACT($PIECE(^VA(200,Y,0),U),1,15)
End DoDot:1
+20 ;
COUNT ;
+1 SET APCDCORL=""
+2 SET DIR(0)="S^C:Count of Visits Only;L:List of Visits and a Count of Visits"
SET DIR("A")="Do you want"
SET DIR("B")="C"
KILL DA
DO ^DIR
KILL DIR
+3 IF $DATA(DIRUT)
GOTO PRIMPROV
+4 SET APCDCORL=Y
SORT ;how to sort list of visits
+1 SET APCDSORT=""
+2 SET DIR(0)="S^C:Clinic;O:Hospital Location"
+3 SET DIR("A")="How would you like to "_$SELECT(APCDCORL="C":"tally the visits",1:"sort the list of visits")
SET DIR("B")="C"
KILL DA
DO ^DIR
KILL DIR
+4 IF $DATA(DIRUT)
GOTO XIT
+5 SET APCDSORT=Y
ZIS ;call xbdbque
+1 SET XBRC="DRIVER^APCDCAFE"
SET XBRP="PRINT^APCDCAFF"
SET XBRX="XIT^APCDCAFE"
SET XBNS="APCD"
+2 DO ^XBDBQUE
+3 DO XIT
+4 QUIT
DRIVER ;EP entry point for taskman
+1 SET APCDBT=$HOROLOG
SET APCDJOB=$JOB
+2 KILL ^XTMP("APCDCAFE",APCDJOB,APCDBT)
+3 DO ^APCDCAFF
+4 SET APCDET=$HOROLOG
+5 QUIT
XIT ;
+1 KILL DIR
+2 ;clean up APCD variables
DO EN^XBVK("APCD")
+3 ;clean up fileman variables
DO ^XBFMK
+4 ;clean up AUPN
DO KILL^AUPNPAT
+5 ;clean up after qman
DO EN^XBVK("AMQQ")
+6 QUIT
+7 ;
D(D) ;
+1 IF $GET(D)=""
QUIT ""
+2 QUIT $EXTRACT(D,4,5)_"/"_$EXTRACT(D,6,7)_"/"_$EXTRACT(D,2,3)
CTR(X,Y) ;EP - Center X in a field Y wide.
+1 QUIT $JUSTIFY("",$SELECT($DATA(Y):Y,1:IOM)-$LENGTH(X)\2)_X
+2 ;----------
EOP ;EP - End of page.
+1 IF $EXTRACT(IOST)'="C"
QUIT
+2 IF $DATA(ZTQUEUED)!'(IOT="TRM")!$DATA(IO("S"))
QUIT
+3 NEW DIR
+4 KILL DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
+5 SET DIR("A")="End of report. Press Enter"
SET DIR(0)="E"
DO ^DIR
+6 QUIT
+7 ;----------
USR() ;EP - Return name of current user from ^VA(200.
+1 QUIT $SELECT($GET(DUZ):$SELECT($DATA(^VA(200,DUZ,0)):$PIECE(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
+2 ;----------
LOC() ;EP - Return location name from file 4 based on DUZ(2).
+1 QUIT $SELECT($GET(DUZ(2)):$SELECT($DATA(^DIC(4,DUZ(2),0)):$PIECE(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
+2 ;----------
INFORM ;inform user what this report is all about
+1 WRITE !,$$CTR($$LOC)
+2 WRITE !!,$$CTR("PCC/EHR CODING AUDIT")
+3 WRITE !!,"This report will count all visits that were not marked as"
+4 WRITE !,"reviewed/complete within a specified # of days from the date of the visit."
+5 WRITE !,"The visits can be selected by date, primary provider, facility"
+6 WRITE !,"clinic or hospital location. This list can be sorted by clinic code,"
+7 WRITE !," or hospital location (scheduling clinic)."
+8 WRITE !,"Contract Health visits are excluded."
+9 WRITE !,"Visits with the following service categories are INCLUDED in the list, "
+10 WRITE !,"unless you specify otherwise when prompted to do so:"
+11 IF '$DATA(^APCDSITE(DUZ(2),13,"B","A"))
WRITE !," - A Ambulatory"
+12 IF '$DATA(^APCDSITE(DUZ(2),13,"B","H"))
WRITE !," - H Hospitalization"
+13 IF '$DATA(^APCDSITE(DUZ(2),13,"B","I"))
WRITE !," - I In-Hospital"
+14 IF '$DATA(^APCDSITE(DUZ(2),13,"B","S"))
WRITE !," - S Day Surgery"
+15 IF '$DATA(^APCDSITE(DUZ(2),13,"B","O"))
WRITE !," - O Observation"
+16 IF '$DATA(^APCDSITE(DUZ(2),13,"B","T"))
WRITE !," - T Telecommunications"
+17 IF '$DATA(^APCDSITE(DUZ(2),13,"B","C"))
WRITE !," - C Chart Review"
+18 IF '$DATA(^APCDSITE(DUZ(2),13,"B","R"))
WRITE !," - R Nursing Home"
+19 IF '$DATA(^APCDSITE(DUZ(2),13,"B","N"))
WRITE !," - N Not Found"
+20 IF '$DATA(^APCDSITE(DUZ(2),13,"B","M"))
WRITE !," - M Telemedicine"
+21 ;W !,"Unless you opt to include a certain set of the above categories.",!
+22 QUIT
OLOC ;one location
+1 SET DIC="^AUTTLOC("
SET DIC(0)="AEMQ"
SET DIC("A")="Which LOCATION: "
DO ^DIC
KILL DIC
+2 IF Y=-1
SET APCDQ=""
QUIT
+3 SET APCDLOCS(+Y)=""
+4 QUIT
SLOC ;taxonomy of locations
+1 SET X="LOCATION OF ENCOUNTER"
SET DIC="^AMQQ(5,"
SET DIC(0)="FM"
SET DIC("S")="I $P(^(0),U,14)"
DO ^DIC
KILL DIC,DA
IF Y=-1
WRITE "OOPS - QMAN NOT CURRENT - QUITTING"
GOTO XIT
+2 DO PEP^AMQQGTX0(+Y,"APCDLOCS(")
+3 IF '$DATA(APCDLOCS)
SET APCDQ=""
QUIT
+4 IF $DATA(APCDLOCS("*"))
SET APCDLOCT="A"
KILL APCDLOCS
WRITE !!,"**** all locations will be included ****",!
QUIT
+5 QUIT
+6 ;
OCLN ;one clinic
+1 SET DIC="^DIC(40.7,"
SET DIC(0)="AEMQ"
SET DIC("A")="Which CLINIC: "
DO ^DIC
KILL DIC
+2 IF Y=-1
SET APCDQ=""
QUIT
+3 SET APCDCLNS(+Y)=""
+4 QUIT
SCLN ;taxonomy of clinics
+1 SET X="CLINIC"
SET DIC="^AMQQ(5,"
SET DIC(0)="FM"
SET DIC("S")="I $P(^(0),U,14)"
DO ^DIC
KILL DIC,DA
IF Y=-1
WRITE "OOPS - QMAN NOT CURRENT - QUITTING"
GOTO XIT
+2 DO PEP^AMQQGTX0(+Y,"APCDCLNS(")
+3 IF '$DATA(APCDCLNS)
SET APCDQ=""
QUIT
+4 IF $DATA(APCDCLNS("*"))
SET APCDCLNT="A"
KILL APCDCLNS
WRITE !!,"**** all CLINICS will be included ****",!
QUIT
+5 QUIT
+6 ;
OHL ;one hosp location
+1 SET DIC="^SC("
SET DIC(0)="AEMQ"
SET DIC("A")="Which HOSPITAL LOCATION: "
DO ^DIC
KILL DIC
+2 IF Y=-1
SET APCDQ=""
QUIT
+3 SET APCDHLS(+Y)=""
+4 QUIT
SHL ;selected hospital locations
+1 SET DIC="^SC("
SET DIC(0)="AEMQ"
SET DIC("A")="Which HOSPITAL LOCATION: "
DO ^DIC
KILL DIC
+2 IF X=""
QUIT
+3 IF Y=-1
SET APCDQ=""
QUIT
+4 SET APCDHLS(+Y)=""
+5 GOTO SHL
OPRV ;one clinic
+1 SET DIC="^VA(200,"
SET DIC(0)="AEMQ"
SET DIC("A")="Which PROVIDER: "
DO ^DIC
KILL DIC
+2 IF Y=-1
SET APCDQ=""
QUIT
+3 SET APCDPRVS(+Y)=""
+4 QUIT
SPRV ;taxonomy of PROVIDERS
+1 SET X="PRIMARY PROVIDER"
SET DIC="^AMQQ(5,"
SET DIC(0)="FM"
SET DIC("S")="I $P(^(0),U,14)"
DO ^DIC
KILL DIC,DA
IF Y=-1
WRITE "OOPS - QMAN NOT CURRENT - QUITTING"
GOTO XIT
+2 DO PEP^AMQQGTX0(+Y,"APCDPRVS(")
+3 IF '$DATA(APCDPRVS)
SET APCDQ=""
QUIT
+4 IF $DATA(APCDPRVS("*"))
SET APCDPRVT="A"
KILL APCDPRVS
WRITE !!,"**** all PROVIDERS will be included ****",!
QUIT
+5 QUIT
+6 ;
SCDR ;selected CHART DEF REASONS
+1 SET DIC="^AUTTCDR("
SET DIC(0)="AEMQ"
SET DIC("A")="Which CHART DEFICIENCY REASON: "
DO ^DIC
KILL DIC
+2 IF X=""
QUIT
+3 IF Y=-1
SET APCDQ=""
QUIT
+4 SET APCDCDRS(+Y)=""
+5 GOTO SCDR
SSC ;
+1 SET X="SERVICE CATEGORY"
SET DIC="^AMQQ(5,"
SET DIC(0)="FM"
SET DIC("S")="I $P(^(0),U,14)"
DO ^DIC
KILL DIC,DA
IF Y=-1
WRITE "OOPS - QMAN NOT CURRENT - QUITTING"
GOTO DATES
+2 DO PEP^AMQQGTX0(+Y,"APCDSCS(")
+3 IF '$DATA(APCDSCS)
SET APCDQ=""
QUIT
+4 IF $DATA(APCDSCS("*"))
SET APCDSCT="A"
KILL APCDSCS
WRITE !!,"**** all Services Categories will be included ****",!
QUIT
+5 QUIT
OSC ;
+1 KILL DIR
SET DIR(0)="9000010,.07"
SET DIR("A")="Enter SERVICE CATEGORY"
KILL DA
DO ^DIR
KILL DIR
+2 IF $DATA(DIRUT)
SET APCDQ=""
QUIT
+3 SET APCDSCS(Y)=""
+4 QUIT