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

AZXBV1.m

Go to the documentation of this file.
AZXBV1 ; IHS/OHPRD/TMJ - PRNT BILL VSTS ; [ 02/20/98  12:42 PM ]
 ;;3.0T3;IHS PCC REPORTS;;NOV 22, 1996
START ;
 S APCL80E="==============================================================================="
 S APCL80D="-------------------------------------------------------------------------------"
 S (APCLPG,APCLPN)=0
 G:$D(APCLPALL) ALL
 D HEAD I '$D(^XTMP("APCLBV",APCLJOB,APCLBT)) W !,"No visits to report",! G DONE
 S APCLPN=0 K APCLQUIT
 I '$D(APCLPALL) F  S APCLPN=$O(^XTMP("APCLBV",APCLJOB,APCLBT,APCLRNUM,APCLPN)) Q:APCLPN=""!($D(APCLQUIT))  D DFN
 G:APCLPN=""!($D(APCLQUIT)) DONE
 ;G:$D(APCLQUIT) DONE
 I $Y>(IOSL-6) D HEAD G:$D(APCLQUIT) DONE
ALL ;print ALL coverage reports
 F APCLCNTR=1:1:6 Q:$D(APCLQUIT)  S (APCLPROC,APCLRNUM)=APCLCNTR D ALL1 Q:$D(APCLQUIT)  D PTN
 G:$D(APCLQUIT) DONE
 K ^XTMP("APCLBV",APCLJOB,APCLBT)
 Q
ALL1 ;
 D HEAD Q:$D(APCLQUIT)
 I '$D(^XTMP("APCLBV",APCLJOB,APCLBT,APCLRNUM)) W !,"No visits to report",! S APCLPN=0 K APCLQUIT
 Q
DONE ;
 D DONE^APCLOSUT
 K ^XTMP("APCLBV",APCLJOB,APCLBT)
 Q
PTN ;process patient name level
 F  S APCLPN=$O(^XTMP("APCLBV",APCLJOB,APCLBT,APCLRNUM,APCLPN)) Q:APCLPN=""!(APCLPROC'=APCLRNUM)!($D(APCLQUIT))  D DFN
 Q
DFN ;
 S DFN="" F  S DFN=$O(^XTMP("APCLBV",APCLJOB,APCLBT,APCLRNUM,APCLPN,DFN)) Q:DFN=""!($D(APCLQUIT))  D @APCLPROC
 Q
VISIT ;ENTRY POINT
 W !?8,"Visit Date",?21,"Category",?37,"PROVIDER NARRATIVE"
 W !?8 F I=1:1:71 W "-"
 S APCLVDFN=0 F  S APCLVDFN=$O(^XTMP("APCLBV",APCLJOB,APCLBT,APCLRNUM,APCLPN,DFN,APCLVDFN)) Q:APCLVDFN'=+APCLVDFN!($D(APCLQUIT))  S APCLVREC=^AUPNVSIT(APCLVDFN,0) D VWRT
 Q
VWRT ;
 I $Y>(IOSL-5) D HEAD Q:$D(APCLQUIT)
 S Y=$P(+APCLVREC,".") D DD^%DT S APCLDATE=Y
 K ^UTILITY("DIQ1",$J)
 K DIQ,DIC,DA,DR
 S DIC="^AUPNVSIT(",DR=".07",DA=APCLVDFN,DIQ(0)="E" D EN^DIQ1 K DIC,DA,DR,DIQ
 S APCLCAT=^UTILITY("DIQ1",$J,9000010,APCLVDFN,.07,"E")
 S (APCL1,APCL2)=0 F  S APCL2=$O(^AUPNVPRV("AD",APCLVDFN,APCL2)) Q:APCL2=""  I $P(^AUPNVPRV(APCL2,0),U,4)="P" S APCL1=APCL1+1,APCLAP=$P(^(0),U)
 I APCL1=0 Q
 S APCLDISC="" D CHKDISC
 W !?8,APCLDATE,?21,APCLCAT,?37,APCLDISC
 S (APCL1,APCL2)=0 F  S APCL1=$O(^AUPNVPOV("AD",APCLVDFN,APCL1)) Q:APCL1'=+APCL1!($D(APCLQUIT))  S APCLX=^AUPNVPOV(APCL1,0),APCL2=APCL2+1 D WPOV 
PROV ;Get Provider stuff
 W !
 S (APCLP,APCLP1)=0 F  S APCLP=$O(^AUPNVPRV("AD",APCLVDFN,APCLP)) Q:APCLP'=+APCLP!($D(APCLQUIT))  S APCLPPP=^AUPNVPRV(APCLP,0),APCLP1=APCLP1+1 D WPRV
 I $D(^AUPNVINP("AD",APCLVDFN)) S Y=$O(^AUPNVINP("AD",APCLVDFN,"")),Y=$P(^AUPNVINP(Y,0),U) D DD^%DT W !?8,"DISCHARGE DATE:  ",Y
 Q
WPOV ;
 I $Y>(IOSL-6),APCL2>1 D HEAD Q:$D(APCLQUIT)
 Q:$P(APCLX,U)=""
 Q:$P(APCLX,U,4)=""
 W:APCL2>1 ! W ?41,$P(^ICD9($P(APCLX,U),0),U),?49,$E($P(^AUTNPOV($P(APCLX,U,4),0),U),1,25)
 Q
WPRV ;Write Provider
 ;Q:$P(APCLP,U)=""
 ;Q:$P(APCLP,U,4)=""
 S APCLPS1=$P(^AUPNVPRV(APCLP,0),U)
 S APCLAPP=$S($P($G(^AUTTSITE(1,0)),U,22):$P(^VA(200,APCLPS1,0),U),1:$P(^DIC(16,$P(^DIC(6,APCLPS1,0),"^"),0),"^"))
 S APCLPSP=$P(^AUPNVPRV(APCLP,0),U,4)
 W:APCLP1>1 ! W ?10,APCLPSP,?15,$E(APCLAPP,1,20) I APCLP1>1 W ?41,"**POTENTIAL BILLABLE VISIT***"
 Q
CHKDISC ;
 I '$P($G(^AUTTSITE(1,0)),U,22) G CHKDISC6
 S APCLDISC=$$PROVCLSC^XBFUNC1(APCLAP)
 Q
CHKDISC6 ;
 Q:'$D(^DIC(6,APCLAP))
 S APCLY=$P(^DIC(6,APCLAP,0),U,4)
 Q:APCLY=""
 Q:'$D(^DIC(7,APCLY,9999999))
 S APCLDISC=$P(^DIC(7,APCLY,9999999),U)
 Q
HD ;ENTRY POINT
 S (DOB,Y)=$P(^DPT(DFN,0),U,3) I DOB]"" D DD^%DT S DOB=Y
 S APCLHRN=$P(^AUPNPAT(DFN,41,APCLSU,0),U,2)
 S SSN=$P(^DPT(DFN,0),U,9)
 W !!,APCLHRN,?8,APCLPN,?40,DOB,?60,SSN
 Q
1 ;Commissioned Officers/Dependents
 D 1^APCLBV11
 Q
2 ;Medicare Part A
 D 2^APCLBV11
 Q
3 ;Medicare Part B
 D 2^APCLBV11
 Q
5 ;Medicaid
 D 5^APCLBV11
 Q
4 ;Private Insurance
 D 4^APCLBV11
 Q
6 ;Non-Indians
 D 6^APCLBV11
 Q
 I 'APCLPG G HEAD1
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S APCLQUIT="" Q
HEAD1 ;
 W:$D(IOF) @IOF S APCLPG=APCLPG+1
 W ?(80-$L($P(^DIC(4,APCLSU,0),U))/2),$P(^DIC(4,APCLSU,0),U),?72,"Page ",APCLPG,!
 S APCLLENG=32+$L(APCLNAR(APCLRNUM))
 W ?((80-APCLLENG)/2),"POTENTIALLY BILLABLE VISITS FOR:  ",APCLNAR(APCLRNUM),!
 W ?19,"Visit Dates:  ",APCLSDY," and ",APCLEDY,!
 S APCLLENG=$L(APCLSCP)+28 W ?((80-APCLLENG)/2),"SERVICE CATEGORY OF VISIT:  ",APCLSCP
 ;
 I APCLCLN W ! S APCLLENG=$L($P(^DIC(40.7,APCLCLN,0),U))+0 W ?((80-APCLLENG)/2),"CLINIC:  ",$P(^DIC(40.7,APCLCLN,0),U)
 W !!?2,"HRCN",?8,"Patient Name",?40,"Date of Birth",?60,"   SSN"
 W !,APCL80D
 Q