Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: APCDCAFE

APCDCAFE.m

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