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

APCDFPPV.m

Go to the documentation of this file.
APCDFPPV ; IHS/CMI/LAB - PRINT UNCODED DX ;
 ;;2.0;IHS PCC SUITE;**7,11**;MAY 14, 2009;Build 58
 ;
LOC ;
 K APCDLOCT S APCDLOCT=""
 S DIR(0)="S^A:ALL Locations/Facilities;S:One SERVICE UNIT'S Locations/Facilities;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")="O" K DA D ^DIR K DIR,DA
 G:$D(DIRUT) XIT
 S APCDLOCT=Y
 I APCDLOCT="A" G DATE
 D @APCDLOCT
 G:$D(APCDQUIT) LOC
DATE ;
 S APCDFILE=9000010.07
 W !!,"The search for Uncoded "_$P(^DIC(APCDFILE,0),U),"'s can begin at any date",!,"that you specify.  To get all of the uncoded entries enter a really early "
 W !,"date like 01/01/1930.  If you want to only review data for visits ",!,"in the past week, enter T-7.",!
 S APCDFUDT=""
 S DIR(0)="D^::EP",DIR("A")="Enter the Beginning Date to Search for Uncoded entries" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) G LOC
 S APCDFUDT=Y
 S DIR(0)="D^::EP",DIR("A")="Enter the Ending Date to Search for Uncoded entries" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) G LOC
 S APCDFUET=Y
 I APCDFUET<APCDFUDT W !,"Ending date cannot be before beginning date." G DATE
PROV ;
 K APCDPRVT S APCDPRVT=""
 S DIR(0)="S^A:ALL Providers (PRIMARY);O:ONE Provider (PRIMARY)",DIR("A")="Include Visits to Which Provider",DIR("B")="A"
 S DIR("A")="Enter a code indicating what LOCATIONS/FACILITIES are of interest",DIR("B")="O" K DA D ^DIR K DIR,DA
 G:$D(DIRUT) XIT
 S APCDPRVT=Y
 I APCDPRVT="A" G FILE
 K DIC S DIC("A")="Which Provider: ",DIC="^VA(200,",DIC(0)="AEMQ" D ^DIC K DIC,DA G:X="^" PROV K DIC,DA
 G:Y=-1 PROV
 S APCDPRVT("ONE")=+Y
FILE ;WHICH FILE?
 S APCDWFIL=""
 S DIR(0)="S^POV:V POV;PRB:PROBLEM LIST;PRC:V PROCEDURE;FH:FAMILY HISTORY;PHX:PERSONAL HISTORY;A:ALL OF THE ABOVE"
 S DIR("A")="Which File would like to print from",DIR("B")="A" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) G PROV
 S APCDWFIL=Y
ZIS ;
 S APCDCODE=$P($$ICDDX^ICDEX(".9999"),U,1)
 I APCDCODE="" W !!,"ERROR -- .9999 NOT IN ICD DIAGNOSIS FILE, NOTIFY YOUR SUPERVISOR" H 3 G XIT
 S APCDCODO=$P($$ICDDX^ICDEX("ZZZ.999"),U,1)
 I APCDCODO="" W !!,"ERROR -- ZZZ.999 NOT IN ICD DIAGNOSIS FILE, NOTIFY YOUR SUPERVISOR" H 3 G XIT
 S APCDCODE=$P($$ICDOP^ICDEX(".9999",,,"E"),U,1)
 S APCDCODO=$P($$ICDOP^ICDEX("ZZZ999",,,"E"),U,1)
 I APCDCODE="" W !!,"ERROR -- .9999 NOT IN ICD OPERATION FILE, NOTIFY YOUR SUPERVISOR" H 3 G XIT
 I APCDCODO="" W !!,"ERROR -- ZZZ999 NOT IN ICD OPERATON FILE, NOTIFY YOUR SUPERVISOR" H 3 G XIT
 K IO("Q")
 W !!,"Enter the Device for printing"
 S %ZIS="PQ" D ^%ZIS
 I POP K IO("Q") G XIT
 I $D(IO("Q")) G TSKMN
 ;
EN ; Entry point if for taskman.
 S %DT="",X="T" D ^%DT X ^DD("DD") S APCDDT=Y
 U IO
 S APCDFILE="",APCDPG=0
 K ^TMP($J,"APCDFPPV")
 ;D HEAD
GETCODE ;
 ;
 S APCDCODE=$P($$ICDDX^ICDEX(".9999"),U,1)
 S APCDCODO=$P($$ICDDX^ICDEX("ZZZ.999"),U,1)
 I APCDWFIL="A" F APCDFILE=9000010.07,9000011,9000014,9000013 D PROC
 I APCDWFIL="POV" F APCDFILE=9000010.07 D PROC Q:$D(APCDQUIT)
 I APCDWFIL="PRB" F APCDFILE=9000011 D PROC Q:$D(APCDQUIT)
 I APCDWFIL="PHX" F APCDFILE=9000013 D PROC Q:$D(APCDQUIT)
 I APCDWFIL="FH" F APCDFILE=9000014 D PROC Q:$D(APCDQUIT)
 S APCDCODE=$P($$ICDOP^ICDEX(".9999",,,"E"),U,1)
 S APCDCODO=$P($$ICDOP^ICDEX("ZZZ999",,,"E"),U,1)
 I APCDWFIL="PRC"!(APCDWFIL="A") F APCDFILE=9000010.08 D PROC Q:$D(APCDQUIT)
 D PRINT
 S:$D(ZTQUEUED) ZTREQ="@"
 ;
XIT K APCDDOB,APCDDFN,APCDFILE,IO("Q"),APCDVDG,APCDCODE,APCDG,APCDVIGR,APCDHRN,APCDF,APCDDT,APCDL,APCDPG,APCDQUIT,ZTSK,APCDVCTR
 K AUPNSEX,AUPNPAT,AUPNDOB,AUPNDOD,AUPNDAYS,APCDVSIT,APCDLOCT,APCDOK,APCDFUET,APCDFPPV,APCDFUDT,APCDPRVT
 K A,DX,Y,X,S,DA,D0,DIC,DIE,DIQ,DK,DL,DR,POP,D1,D2
 K ^TMP($J,"APCDFPPV")
 D ^%ZISC
 Q
CHKLOC ;
 S APCDVSIT=""
 I $L(APCDFILE)=7,APCDFILE'=9000011 S APCDOK=1 Q
 I APCDFILE=9000011 S Y=$P(^AUPNPROB(APCDDFN,0),U,6) D  Q
 .I APCDLOCT="O",Y'=APCDLOCT("ONE") S APCDOK=0 Q
 .I APCDLOCT="S",$$VALI^XBDIQ1(9999999.06,$P(^AUPNPROB(APCDDFN,0),U,6),.05)'=APCDLOCT("SU") S APCDOK=0 Q
 .S APCDOK=1
 S APCDOK=0
 S APCDG=APCDVDG_"APCDDFN,0)" S Y=$P(@APCDG,U,2),APCDVSIT=$P(@APCDG,U,3) I Y=""!(APCDVSIT="") W !,"ERROR IN GLOBAL -- NOTIFY PROGRAMMER - PATIENT OR VISIT DFN MISSING" Q
 I APCDLOCT="O",$P(^AUPNVSIT(APCDVSIT,0),U,6)'=APCDLOCT("ONE") Q
 I APCDLOCT="S",$$VALI^XBDIQ1(9999999.06,$P(^AUPNVSIT(APCDVSIT,0),U,6),.05)'=APCDLOCT("SU") Q
 S APCDOK=1
 Q
CHKPRV ;
 S APCDVSIT="" I $L(APCDFILE)=7 S APCDOK=1 Q
 S APCDOK=0
 S APCDG=APCDVDG_"APCDDFN,0)" S Y=$P(@APCDG,U,2),APCDVSIT=$P(@APCDG,U,3) I Y=""!(APCDVSIT="") W !,"ERROR IN GLOBAL -- NOTIFY PROGRAMMER - PATIENT OR VISIT DFN MISSING" Q
 I APCDPRVT="O",$$PRIMPROV^APCLV(APCDVSIT,"I")'=APCDPRVT("ONE") Q
 S APCDOK=1
 Q
O ;one community
 S DIC="^AUTTLOC(",DIC(0)="AEMQ",DIC("A")="Which LOCATION: " D ^DIC K DIC
 I Y=-1 S APCDQUIT="" Q
 S APCDLOCT("ONE")=+Y
 Q
S ;all communities within APCDSU su
 S DIC="^AUTTSU(",DIC("B")=$$VAL^XBDIQ1(9999999.06,DUZ(2),.05),DIC(0)="AEMQ",DIC("A")="Which SERVICE UNIT: " D ^DIC K DIC
 I Y=-1 S APCDQUIT="" Q
 S APCDLOCT("SU")=+Y
 Q
 ;
PROC ;
 K APCDQUIT
 S APCDDFN=""
 S APCDVDG=^DIC(APCDFILE,0,"GL")
 S APCDG=APCDVDG_"""B"",APCDCODE)"
 S APCDVIGR=APCDVDG_"""B"",APCDCODE,APCDDFN)"
 S APCDDFN=0 F  S APCDDFN=$O(@APCDVIGR) Q:APCDDFN'=+APCDDFN!($D(APCDQUIT))  S APCDOK=0 D CHKLOC I APCDOK D CHKPRV I APCDOK D PRT
 S APCDG=APCDVDG_"""B"",APCDCODO)"
 S APCDVIGR=APCDVDG_"""B"",APCDCODO,APCDDFN)"
 S APCDDFN=0 F  S APCDDFN=$O(@APCDVIGR) Q:APCDDFN'=+APCDDFN!($D(APCDQUIT))  S APCDOK=0 D CHKLOC I APCDOK D CHKPRV I APCDOK D PRT
 Q
PRT ;
 D CHKDATE I 'APCDOK Q
 I APCDFILE=9000011,$P(^AUPNPROB(APCDDFN,0),U,12)="D" Q  ;deleted
 I APCDFILE=9000011,$P($G(^AUPNPROB(APCDDFN,800)),U,1)]"" Q  ;SNOME CODED
 S ^TMP($J,"APCDFPPV",APCDFILE,APCDDFN)=""
 Q
PRINT ;
 I '$D(^TMP($J,"APCDFPPV")) D HEAD W !!,"There are no Uncoded entries." D XIT Q
 ;D HEAD
 S APCDFILE="" F  S APCDFILE=$O(^TMP($J,"APCDFPPV",APCDFILE)) Q:APCDFILE=""!($D(APCDQUIT))  D
 .D HEAD
 .Q:$D(APCDQUIT)
 .W !!,$P(^DIC(APCDFILE,0),U,1)," uncoded entries: "
 .S APCDDFN=0 F  S APCDDFN=$O(^TMP($J,"APCDFPPV",APCDFILE,APCDDFN)) Q:APCDDFN=""!($D(APCDQUIT))  D
 ..S Y=$$VALI^XBDIQ1(APCDFILE,APCDDFN,.02)
 ..S APCDVSIT="" I $L(APCDFILE)>7 S APCDVSIT=$$VALI^XBDIQ1(APCDFILE,APCDDFN,.03)
 ..D ^AUPNPAT
 ..S Y=AUPNDOB X ^DD("DD") S APCDDOB=Y
 ..S APCDHRN="" I $D(^AUPNPAT(AUPNPAT,41,DUZ(2),0)) S APCDHRN=$P(^AUPNPAT(AUPNPAT,41,DUZ(2),0),U,2)
 ..I $Y>(IOSL-7) D HEAD Q:$D(APCDQUIT)
 ..W !!,"HRN: ",APCDHRN,"     DOB: ",APCDDOB,"    SEX: ",AUPNSEX
 ..S DA=APCDDFN,DIC=^DIC(APCDFILE,0,"GL"),DR=0 D EN^DIQ K DIC,DA,DR
 ..I APCDVSIT,$L(APCDFILE)>7 S APCDVCTR=$$OPER(APCDVSIT) W ?2,"OPERATOR FROM FORMS TRACKING OR CREATED BY: " I APCDVCTR W $P(^VA(200,APCDVCTR,0),U) W !
 ..I APCDVSIT,$L(APCDFILE)>7 W ?2,"LOCATION OF ENCOUNTER: ",$$LOCENC^APCLV(APCDVSIT,"E")
 ..I APCDVSIT,$L(APCDFILE)>7 W !?2,"PROVIDER: ",$$PRIMPROV^APCLV(APCDVSIT,"N")
 ..I APCDFILE=9000011,$P($G(^AUPNPROB(APCDDFN,1)),U,4)]"" W ?2,"RECORDING PROVIDER: ",$$VAL^XBDIQ1(9000011,APCDDFN,1.04),!
 ..I APCDFILE=9000011,$P($G(^AUPNPROB(APCDDFN,1)),U,3)]"" W ?2,"ENTERED BY: ",$$VAL^XBDIQ1(9000011,APCDDFN,1.03),!
 ..I APCDFILE=9000011,$P($G(^AUPNPROB(APCDDFN,1)),U,5)]"" W !?2,"RESPONSIBLE PROVIDER: ",$$VAL^XBDIQ1(9000011,APCDDFN,1.05)
 Q
 ;
OPER(V) ;
 I $G(V)="" Q ""
 ;find operator in forms tracking first, if none return .23 of visit (user who created)
 NEW Y,D,M S Y=""
 S D=$O(^APCDFORM("AB",V,"")) I D="" Q $P(^AUPNVSIT(V,0),U,23)
 S M=$O(^APCDFORM("AB",V,D,"")) I M="" Q $P(^AUPNVSIT(V,0),U,23)
 S Y=$P(^APCDFORM(D,11,M,0),U,2)
 Q $S(Y:Y,1:$P(^AUPNVSIT(V,0),U,23))
NONE ;
 W !!,"There are no Uncoded diagnoses or procedures in the ",$P(^DIC(APCDFILE,0),U)," file."
 Q
CHKDATE ;
 S APCDOK=0
 S APCDG=APCDVDG_"APCDDFN,0)" S Y=$P(@APCDG,U,2),APCDVSIT=$P(@APCDG,U,3) I Y=""!(APCDVSIT="") W !,"ERROR IN GLOBAL -- NOTIFY PROGRAMMER - PATIENT OR VISIT DFN MISSING" Q
 I $L(APCDFILE)>7 Q:'$D(^AUPNVSIT(APCDVSIT))  I $P($P(^AUPNVSIT(APCDVSIT,0),U),".")<APCDFUDT!($P($P(^AUPNVSIT(APCDVSIT,0),U),".")>APCDFUET) Q  ;before date wanted
 I $L(APCDFILE)=7,$P(@APCDG,U,3)<APCDFUDT Q  ;quit if problem modified before date
 S APCDOK=1
 Q
 I 'APCDPG G HEAD1
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR I Y=0!($D(DTOUT)) K DIR S APCDQUIT="" Q
HEAD1 ;
 ;
 W:$D(IOF) @IOF S APCDPG=APCDPG+1
 W !,APCDDT,?70,"Page: ",APCDPG
 W !?29,"PCC Data Entry Module"
 W !?16,"***********************************************"
 W !?16,"* LISTING OF UNCODED DIAGNOSES AND PROCEDURES *"
 W !?16,"***********************************************"
 Q
SUBHEAD ;
 W !!,"Uncoded ",$P(^DIC(APCDFILE,0),U)," entries:"
 Q
TSKMN ;
 K ZTSAVE
 S ZTSAVE("APCD*")=""
 S ZTSAVE("DUZ(2)")="",ZTIO=ION,ZTCPU=$G(IOCPU),ZTRTN="EN^APCDFPPV",ZTDTH="",ZTDESC="VISIT ERROR REPORT - DATA ENTRY" D ^%ZTLOAD
 D XIT
 Q
DOC ;
 ; need to change to go thru PT node of ICD9 and 
 ; fix all files in the 9000001-9000099 range.
 ;