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

APCDCAFD.m

Go to the documentation of this file.
  1. APCDCAFD ; IHS/CMI/LAB - ;
  1. ;;2.0;IHS PCC SUITE;**2,7,11,15,16,20**;MAY 14, 2009;Build 25
  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 ;
  1. W !!,"You should limit your date range to no more than 7 days. Viewing more"
  1. W !,"than 7 days worth of visits may take a while to process."
  1. K APCDED,APCDBD
  1. K DIR 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. I $$FMDIFF^XLFDT(APCDED,APCDBD)>7 S APCDQ=0 D I APCDQ G DATES
  1. . W !,"You have selected a ",$$FMDIFF^XLFDT(APCDED,APCDBD)," date range. Depending on the number of visits per"
  1. . W !,"day at your facility it may take a while to gather up and process that many",!,"visits."
  1. . S DIR(0)="Y",DIR("A")="Do you wish to continue with this date range",DIR("B")="Y" KILL DA D ^DIR KILL DIR
  1. . I $D(DIRUT) S APCDQ=1
  1. . I 'Y S APCDQ=1
  1. . Q
  1. S APCDSD=$$FMADD^XLFDT(APCDBD,-1)_".9999"
  1. ;
  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 CLINIC
  1. D @(APCDLOCT_"LOC")
  1. G:$D(APCDQ) FAC
  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;X:No Clinic Assigned",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) FAC
  1. S APCDCLNT=Y
  1. I APCDCLNT="A" G HOSPLOC
  1. I APCDCLNT="X" 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 provider on the visit."_$G(IORVOFF),!
  1. S APCDPRVT=""
  1. K APCDPRVS
  1. S DIR(0)="S^A:ALL Primary Providers;S:Selected set or Taxonomy of Primary Providers;O:ONE Primary Provider;X:No Visit Primary Provider Assigned;C:One Secondary 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. I APCDPRVT="X" G STATUS
  1. D @(APCDPRVT_"PRV")
  1. G:$D(APCDQ) PRIMPROV
  1. STATUS ;
  1. ;K APCDQ
  1. ;W !!,"You can choose to display visits with a particular chart audit status: Reviewed",!,"or Incomplete.",!
  1. ;S APCDCAST=""
  1. ;K APCDCASS
  1. STATUS1 ;
  1. ;S DIR(0)="9000010.45,.04O",DIR("A")="Include Visits with which Chart Audit Status",DIR("B")="I" KILL DA D ^DIR KILL DIR
  1. ;I $D(DIRUT) G CDR
  1. ;I Y="" G CDR
  1. ;S APCDCASS(Y)=""
  1. CDR ;
  1. K APCDQ
  1. W !!,"A chart deficiency reason may have been previously entered for a visit."
  1. W !,"If you wish to display only visits whose LAST chart deficiency reason matches"
  1. W !,"one or more that you select, please enter them.",!
  1. S APCDCDRT=""
  1. K APCDCDRS
  1. S DIR(0)="S^D:Do NOT screen on Chart Deficiency Reason;S:Screen on Chart Deficiency Reason",DIR("A")="Include Visits to Which Hospital Locations",DIR("B")="A"
  1. S DIR("A")="Select visits based on chart deficiency reason",DIR("B")="D" K DA D ^DIR K DIR,DA
  1. G:$D(DIRUT) STATUS
  1. S APCDCDRT=Y
  1. I APCDCDRT="D" G DEMO
  1. D @(APCDCDRT_"CDR")
  1. G:$D(APCDQ) CDR
  1. DEMO ;
  1. D DEMOCHK^APCLUTL(.APCDDEMO)
  1. I APCDDEMO=-1 G CDR
  1. PROCESS ;
  1. W:$D(IOF) @IOF W !!
  1. W !!,"I will display visits that meet the following criteria:"
  1. W !!,"VISIT DATES: ",$$FMTE^XLFDT(APCDBD)," to ",$$FMTE^XLFDT(APCDED)
  1. ;W !,"SERVICE CATEGORY: A, O, S, C, T, M"
  1. W !,"SERVICE CATEGORY: "
  1. S X=$P(^DD(9000010,.07,0),U,3),D=""
  1. F Y=1:1 S J=$P(X,";",Y) Q:J="" D
  1. .S C=$P(J,":")
  1. .Q:'$$SCW^APCDCAF(C)
  1. .S:D]"" D=D_", "
  1. .S D=D_C
  1. W D
  1. W !,"VISIT TYPE: NOT Contract"
  1. W !,"Visits with at least one POV."
  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 !!,"CLINICS: " D
  1. .I APCDCLNT="X" W "Visits with no Clinic Assigned" Q
  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 APCDPRVT="X" W "No Visit Primary Provider Assigned" Q
  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. ;W !!,"CHART AUDIT STATUS: " D
  1. ;.I '$D(APCDCASS) W "All" Q
  1. ;.S Y=0,C=0 F S Y=$O(APCDCASS(Y)) Q:Y'=+Y S C=C+1 W:C>1 ";" W ?24,$$EXTSET^XBFUNC(9000010.45,Y,.04)
  1. W !!,"CHART DEFICIENCY REASONS: " D
  1. .I '$D(APCDCDRS) W "All (includes visits with no chart deficiency reason entered)" Q
  1. .S Y=0,C=0 F S Y=$O(APCDCDRS(Y)) Q:Y'=+Y S C=C+1 W:C>1 ";" W ?24,$E($P(^AUTTCDR(Y,0),U),1,15)
  1. CONT ;
  1. S DIR(0)="Y",DIR("A")="Do you wish to continue",DIR("B")="Y" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G XIT
  1. I 'Y G XIT
  1. W !!,"Please note: On the list of visits that will be displayed"
  1. W !,"there is a column labeled 'INS', in this column M stands for"
  1. W !,"Medicare, C stands for Medicaid and P stands for Private"
  1. W !,"Insurance. This does not mean the visit is billable, it just"
  1. W !,"is an indication of whether or not the patient has a policy on"
  1. W !,"file that is currently active.",!
  1. SORT ;how to sort list of visits
  1. VA S APCDSORT=""
  1. S DIR(0)="S^N:Patient Name;H:HRN;D:Date of Visit;T:Terminal Digit of HRN;S:Service Category;L:Location of Encounter;C:Clinic;O:Hospital Location;P:Primary Provider"
  1. S DIR(0)=DIR(0)_";A:Chart Audit Status;I:Has Medicare/Medicaid or PI"
  1. S DIR("A")="How would you like the list of visits sorted",DIR("B")="H" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) G XIT
  1. S APCDSORT=Y
  1. PROC1 ; call listmanager
  1. D EN^APCDCAF
  1. D XIT
  1. Q
  1. XIT ;
  1. K DIR
  1. D EN^APCDEKL
  1. D EN2^APCDEKL
  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. PROC ;EP - called from xbdbque
  1. Q
  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 $$LOC,$$CTR("PCC/EHR CODING AUDIT")
  1. W !,"This list can be used to audit visits that are created by EHR users."
  1. W !,"The visits displayed in the list are those with an INCOMPLETE or blank"
  1. W !,"chart audit status. This list can be sorted by date, primary provider"
  1. W !,"clinic code, hospital location (scheduling clinic), and facility."
  1. W !,"Once the visit has been reviewed, the review status can be set as reviewed/"
  1. W !,"complete or incomplete. All visits set as reviewed/complete will be passed"
  1. W !,"to the IHS/RPMS billing package."
  1. W !,"Contract Health visits are excluded."
  1. W !,"Visits that do not have a provider (primary or secondary) are ",$S($P(^APCDSITE(DUZ(2),0),U,28):"included in ",1:"excluded from "),!,"the list."
  1. W !,"Visits with the following service categories are NOT included in the list:"
  1. W !?10,"- Event (Historical)"
  1. S X="" F S X=$O(^APCDSITE(DUZ(2),13,"B",X)) Q:X="" W !?10,"- ",$$EXTSET^XBFUNC(9000010,.07,X)
  1. W !,$G(IORVON)_"PLEASE NOTE:"_$G(IORVOFF)_" A visit will NOT pass to Billing until it is marked"
  1. W !,"as reviewed/completed."
  1. Q
  1. OLOC ;EP - 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 ;EP - 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 ;EP - 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 ;EP - 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 PROV
  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. ;I $D(APCDIASE) G S
  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. Q
  1. CPRV ;one PROV
  1. S DIC="^VA(200,",DIC(0)="AEMQ",DIC("A")="Which SECONDARY PROVIDER: " D ^DIC K DIC
  1. I Y=-1 S APCDQ="" Q
  1. S APCDPRVS(+Y)=""
  1. Q