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

BMCRR8P.m

Go to the documentation of this file.
BMCRR8P ; IHS/PHXAO/TMJ - PRNT BILL VSTS;POT HIGH COST CASES ;   [ 09/27/2006  2:16 PM ]
 ;;4.0;REFERRED CARE INFO SYSTEM;**1,3,9**;JAN 09, 2006;Build 101
 ;4.0*1 3.24.06 IHS/OIT/FCJ PRINT BEG AND END DT
 ;4.0*3 10.30.2007 IHS/OIT/FCJ ADDED CSV CHANGES
 ;4.0*9 11.11.2012 IHS.OIT.FCJ CHG FOR ICD-10
 ;
START ;
 S BMC80E="==============================================================================="
 S BMC80D="-------------------------------------------------------------------------------"
 S BMCPG=0 D @("HEAD"_(2-($E(IOST,1,2)="C-"))) I '$D(^XTMP("BMCRR8",BMCJOB,BMCBTH)) W !,"No referrals to report",! G DONE
 S BMCPN="" K BMCQUIT
 F  S BMCPN=$O(^XTMP("BMCRR8",BMCJOB,BMCBTH,"DATA HITS",BMCPN)) Q:BMCPN=""!($D(BMCQUIT))  D DFN
 G:$D(BMCQUIT) DONE
 I $Y>(IOSL-6) D HEAD G:$D(BMCQUIT) DONE
DONE ;
 K ^XTMP("BMCRR8",BMCJOB,BMCBTH)
 D DONE^BMCRLP2
 Q
DFN ;
 S DFN="" F  S DFN=$O(^XTMP("BMCRR8",BMCJOB,BMCBTH,"DATA HITS",BMCPN,DFN)) Q:DFN=""!($D(BMCQUIT))  D PRINT
 Q
PRINT ;print one referral
 S BMCREF=0 F  S BMCREF=$O(^XTMP("BMCRR8",BMCJOB,BMCBTH,"DATA HITS",BMCPN,DFN,BMCREF)) Q:BMCREF'=+BMCREF!($D(BMCQUIT))  S BMCRREC=^BMCREF(BMCREF,0) D PRINT1
 Q
PRINT1 ;
 I $Y>(IOSL-5) D HEAD Q:$D(BMCQUIT)
 W !,$$AVDOS^BMCRLU(BMCREF,"C")
 W ?13,$$VALI^XBDIQ1(90001,BMCREF,.15)
 S BMCHRN="????" I $D(^AUPNPAT(DFN,41,DUZ(2))) S BMCHRN=$P(^AUTTLOC(DUZ(2),0),U,7)_$P(^AUPNPAT(DFN,41,DUZ(2),0),U,2)
 W ?17,BMCHRN
 W ?28,$E($P(^DPT(DFN,0),U),1,20)
 W ?49,$S($P(BMCRREC,U,6):$$VAL^XBDIQ1(200,$P(BMCRREC,U,6),1),1:"--")
 W ?54,$E($$VAL^XBDIQ1(90001,BMCREF,.04),1,3)
 S BMCFAC=$$FACREF^BMCRLU(BMCREF)
 I BMCFAC="" S BMCFAC="????"
 W ?59,$E(BMCFAC,1,20)
 I $$VAL^XBDIQ1(90001,BMCREF,.09)]"" W !?59,$E($$VAL^XBDIQ1(90001,BMCREF,.09),1,20)
PURPOSE ;
 I $Y>(IOSL-5) D HEAD Q:$D(BMCQUIT)
 K BMCP W !,"Purpose:"
 S BMCP=$$GET1^DIQ(90001,BMCREF,1,"","BMCP")
 S DIWL=1,DIWF="C66",BMCX=0 F  S BMCX=$O(BMCP(BMCX)) Q:BMCX'=+BMCX!($D(BMCQUIT))  D
 .S X=BMCP(BMCX) D ^DIWP
 S (C,Z)=0 F  S Z=$O(^UTILITY($J,"W",DIWL,Z)) Q:Z'=+Z!($D(BMCQUIT))  S C=C+1 D:$Y>(IOSL-4) HEAD Q:$D(BMCQUIT)  W:C'=1 ! W ?12,^UTILITY($J,"W",DIWL,Z,0)
 K DIWL,DIWR,DIWF,Z,^UTILITY($J,"W"),BMCNODE,BMCFILE,BMCG,BMCCOL
DX ;
 I $Y>(IOSL-5) D HEAD Q:$D(BMCQUIT)
 I $D(^BMCDX("AD",BMCREF)) D  I 1
 .W !,"Dx:"
 .S BMCDOS=$$AVDOS^BMCRLU(BMCREF,"N")            ;BMC*4.0*9
 .S (C,X)=0 F  S X=$O(^BMCDX("AD",BMCREF,X)) Q:X'=+X!($D(BMCQUIT))  D
 ..;4.0*3 10.30.2007 IHS/OIT/FCJ ADDED CSV CHANGES NXT 2 LINES;4.0*9 11.11.2012 IHS.OIT.FCJ CHG FOR ICD-10
 ..;S C=C+1,BMCD=+^BMCDX(X,0) D:$Y>(IOSL-4) HEAD Q:$D(BMCQUIT)  W:C'=1 ! W ?12,$P(^ICD9(BMCD,0),U),?19," - ",$E($P(^ICD9(BMCD,0),U,3),1,50)
 ..;S C=C+1,BMCD=+^BMCDX(X,0) D:$Y>(IOSL-4) HEAD Q:$D(BMCQUIT)  W:C'=1 ! W ?12,$P($$ICDDX^ICDCODE(BMCD,0),U,2),?19," - ",$E($P($$ICDDX^ICDCODE(BMCD,0),U,4),1,50)
 ..S C=C+1,BMCD=+^BMCDX(X,0) D:$Y>(IOSL-4) HEAD Q:$D(BMCQUIT)  W:C'=1 ! W ?12,$P($$ICDDX^ICDEX(BMCD,BMCDOS,,"I"),U,2),?19," - ",$E($P($$ICDDX^ICDEX(BMCD,BMCDOS,,"I"),U,4),1,50)
 E  D
 .W !,"Dx Cat:",?12,$$GET1^DIQ(90001,BMCREF,.12)
PROC ;
 I $Y>(IOSL-5) D HEAD Q:$D(BMCQUIT)
 I $D(^BMCPX("AD",BMCREF)) D  I 1
 .W !,"Proc:"
 .S (C,X)=0
 .;4.0*3 10.30.2007 IHS/OIT/FCJ ADDED CSV CHANGES
 .;F  S X=$O(^BMCPX("AD",BMCREF,X)) Q:X'=+X!($D(BMCQUIT))  S C=C+1,BMCD=+^BMCPX(X,0) D:$Y>(IOSL-4) HEAD Q:$D(BMCQUIT)  W:C'=1 ! W ?12,$P(^ICPT(BMCD,0),U),?19," - ",$E($P(^ICPT(BMCD,0),U,2),1,50)
 .F  S X=$O(^BMCPX("AD",BMCREF,X)) Q:X'=+X!($D(BMCQUIT))  S C=C+1,BMCD=+^BMCPX(X,0) D:$Y>(IOSL-4) HEAD Q:$D(BMCQUIT)  W:C'=1 ! W ?12,$P($$CPT^ICPTCOD(BMCD,0),U,2),?19," - ",$E($P($$CPT^ICPTCOD(BMCD,0),U,3),1,50)
 E  D
 .W !,"Srv Cat:",?12,$$GET1^DIQ(90001,BMCREF,.13)
 ;
THIRD ;Third Party Coverage
 ;W !
 Q:'$G(DFN)
 S BMCRDATE=DT
 NEW BMCMSG,BMCI,BMCX
 S BMCI=1
 S BMCX=$$BEN^AUPNPAT(DFN,"E")
 S:BMCX="" BMCX="UNKNOWN"
 S BMCMSG(BMCI)="CLASSIFICATION/BENEFICIARY IS: "_BMCX,BMCI=+BMCI+1
 S BMCX=$$ELIGSTAT^AUPNPAT(DFN,"E")
 S:BMCX="" BMCX="UNKNOWN"
 S BMCMSG(BMCI)="ELIGIBILITY STATUS IS: "_BMCX,BMCI=+BMCI+1
 NEW BMCELG
 S BMCELG=BMCI
 I $$MCR^AUPNPAT(DFN,BMCRDATE) S BMCMSG(BMCI)="PATIENT HAS MEDICARE",BMCI=BMCI+1
 ;I $$MCD^AUPNPAT(DFN,BMCRDATE) S BMCMSG(BMCI)="PATIENT HAS MEDICAID--",BMCI=BMCI+1
 S BMCX=$$MCDPN^AUPNPAT(DFN,BMCRDATE,"E")
 S:BMCX="" BMCX="UNKNOWN"
 I $$MCD^AUPNPAT(DFN,BMCRDATE) S BMCMSG(BMCI)="PATIENT HAS MEDICAID-PLAN NAME:  "_BMCX,BMCI=+BMCI+1
 ;I $$PI^AUPNPAT(DFN,BMCRDATE) S BMCMSG(BMCI)="PATIENT HAS PRIVATE INSURANCE--",BMCI=BMCI+1
 S BMCX=$$PIN^AUPNPAT(DFN,BMCRDATE,"E")
 S:BMCX="" BMCX="UNKNOWN"
 I $$PI^AUPNPAT(DFN,BMCRDATE) S BMCMSG(BMCI)="PATIENT HAS INSURANCE-INSURER:  "_BMCX,BMCI=BMCI+1
 I BMCELG=BMCI S BMCMSG(BMCI)="NO THIRD PARTY COVERAGE RECORDED",BMCI=BMCI+1
 I $D(^AUPNPAT(DFN,13)) D
 .S BMCMSG(BMCI)="",BMCI=BMCI+1,BMCMSG(BMCI)="ADDITIONAL REGISTRATION INFORMATION:",BMCI=BMCI+1
 .K BMCAR D ENP^XBDIQ1(9000001,DFN,1301,"BMCAR(","E")
 .S I=0 F  S I=$O(BMCAR(1301,I)) Q:I'=+I  S BMCMSG(BMCI)=BMCAR(1301,I),BMCI=BMCI+1
 W:BMCI !!
 S BMCI=0
 F  S BMCI=$O(BMCMSG(BMCI)) Q:'BMCI  W BMCMSG(BMCI),!
 ;
 W !,"--------------------",!
 Q
 Q
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S BMCQUIT="" Q
HEAD1 ;
 W:$D(IOF) @IOF
HEAD2 ;
 S BMCPG=BMCPG+1
 W !?13,"********** CONFIDENTIAL PATIENT INFORMATION **********"
 W !?(80-$L($P(^DIC(4,DUZ(2),0),U))/2),$P(^DIC(4,DUZ(2),0),U),?72,"Page ",BMCPG,!
 ;4.0*1 3.24.06 IHS/OIT/FCJ ADDED NXT 2 LINES TO PRT BEG AND END DT
 S Y=BMCBD D DD^%DT W ?17,"BEG DATE: "_Y
 S Y=BMCED D DD^%DT W ?40,"END DATE: "_Y,!
 S X="POTENTIAL HIGH COST CASES - BASED ON DIAGNOSIS"
 W ?(80-$L(X))/2,X,!
 W !,?49,"REF"
 W !,"BEGIN D.O.S.",?13,"ST",?17,"HRN",?28,"PATIENT NAME",?49,"PROV",?54,"TYPE",?59,"FACILITY REFERRED TO"
 W !,BMC80D
 Q