BMCOUTRP ; IHS/PHXAO/TMJ - OUTSIDE PROVIDER REFERRALS ;
;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
;ITSC/IHS/FCJ REMOVED KILL AND RESET BMCOLOC
;ITSC/IHS/FCJ ADDED SEC REF PRINT
;
S BMCPG=0 D @("HEAD"_(2-($E(IOST,1,2)="C-"))) I '$D(^XTMP("BMCOUTRP",BMCJOB,BMCBT)) W !,"No referrals to report",! G XIT
S BMCPTN=0,BMCQUIT=0
S BMCDATE="" F S BMCDATE=$O(^XTMP("BMCOUTRP",BMCJOB,BMCBT,"DATA HITS",BMCDATE)) Q:BMCDATE=""!(BMCQUIT) D P
XIT ;
K ^XTMP("BMCOUTRP",BMCJOB,BMCBT)
D DONE^BMCRLP2
D KILL^AUPNPAT
K BMCDATE,BMCOMDT,BMCRIEN,BMCREVN,BMCREVP,BMCRNUMB
S BMCOLOC=$P(^BMCPARM(DUZ(2),0),U,11)
Q
P ;
S BMCPTN="" F S BMCPTN=$O(^XTMP("BMCOUTRP",BMCJOB,BMCBT,"DATA HITS",BMCDATE,BMCPTN)) Q:BMCPTN=""!(BMCQUIT) D PRINT
Q
PRINT ;print one referral
I $Y>(IOSL-10) D HEAD Q:BMCQUIT
S BMCRIEN=0 F S BMCRIEN=$O(^XTMP("BMCOUTRP",BMCJOB,BMCBT,"DATA HITS",BMCDATE,BMCPTN,BMCRIEN)) Q:BMCRIEN'=+BMCRIEN!(BMCQUIT) S BMCRREC=^BMCREF(BMCRIEN,0),DFN=$P(BMCRREC,U,3) D PRINT1
Q
PRINT1 ;
I $Y>(IOSL-3) D HEAD Q:BMCQUIT
S BMCRNUMB=$P($G(^BMCREF(BMCRIEN,0)),U,2)
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 !,$E($P(^DPT(DFN,0),U),1,30),?32,BMCHRN,?43,"DOB: ",$$DOB^AUPNPAT(DFN,"E")," ",$$AGE^AUPNPAT(DFN,DT,"R")," ",$$SSN^AUPNPAT(DFN)
W !,"Referral #: ",BMCRNUMB,$P($G(^BMCREF(BMCRIEN,1)),U)
W ?29,"Date Init: ",$$REFDTI^BMCRLU(BMCRIEN,"S")
W ?50,"Tribe: ",$E($$TRIBE^AUPNPAT(DFN,"E"),1,20)
;
SECREF ;
I $P($G(^BMCREF(BMCRIEN,1)),U)="" D SECREF2^BMCRUTL
;
W !,"Priority: ",$$VAL^XBDIQ1(90001,BMCRIEN,.32)," CHS Auth Dec: ",$$VAL^XBDIQ1(90001,BMCRIEN,1112)," MCC Action: ",$$VAL^XBDIQ1(90001,BMCRIEN,1123)
;W !,"Utilization Review by MD: ",$$VAL^XBDIQ1(90001,BMCRIEN,1125)
LOCAT ;Print Local Categories
I $D(^BMCREF(BMCRIEN,21,0)) D
. S BMCLOCC=0
.F S BMCLOCC=$O(^BMCREF(BMCRIEN,21,"B",BMCLOCC)) Q:BMCLOCC'=+BMCLOCC D
..S BMCLOCI=0
..F S BMCLOCI=$O(^BMCREF(BMCRIEN,21,"B",BMCLOCC,BMCLOCI)) Q:BMCLOCI'=+BMCLOCI D
... S BMCLOCP=$P(^BMCREF(BMCRIEN,21,BMCLOCI,0),U)
... Q:BMCLOCP=""
... S BMCLOCPP=$P(^BMCLCAT(BMCLOCP,0),U)
... W !,"Local Category: "_BMCLOCPP
;
;
ALT ;Alternate Resource Letter Date
I $Y>(IOSL-3) D HEAD Q:BMCQUIT
W !,"Alternate Resource Letter Date: ",$$VAL^XBDIQ1(90001,BMCRIEN,1401)
;
I '$D(^BMCREF(BMCRIEN,2)) G NEXT
W !,"Business Office Comments:"
S BMCNODE=1,BMCIOM=70,BMCFILE=90001.04,BMCDA=BMCRIEN D WP^BMCFDR K BMCIOM
S Y=0 F S Y=$O(BMCWP(Y)) Q:Y'=+Y!(BMCQUIT) D
.I $Y>(IOSL-3) D HEAD Q:BMCQUIT
.W !?5,BMCWP(Y)
Q:BMCQUIT
NEXT ;
W !,"--------------------",!
Q
HEAD ;ENTRY POINT
NEW X,Y,Z,C
I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S BMCQUIT=1 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,!
S Y=DT D DD^%DT W ?(80-$L(Y)/2),Y,!
W ?15,"**REFERRALS INITIATED AT OUTSIDE FACILITY (CALL'ins)**"
S Y=BMCBD D DD^%DT W !,?28,"BEG DATE: "_Y
S Y=BMCED D DD^%DT W !,?28,"END DATE: "_Y,!
W !,$TR($J(" ",80)," ","-")
Q
BMCOUTRP ; IHS/PHXAO/TMJ - OUTSIDE PROVIDER REFERRALS ;
+1 ;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
+2 ;ITSC/IHS/FCJ REMOVED KILL AND RESET BMCOLOC
+3 ;ITSC/IHS/FCJ ADDED SEC REF PRINT
+4 ;
+5 SET BMCPG=0
DO @("HEAD"_(2-($EXTRACT(IOST,1,2)="C-")))
IF '$DATA(^XTMP("BMCOUTRP",BMCJOB,BMCBT))
WRITE !,"No referrals to report",!
GOTO XIT
+6 SET BMCPTN=0
SET BMCQUIT=0
+7 SET BMCDATE=""
FOR
SET BMCDATE=$ORDER(^XTMP("BMCOUTRP",BMCJOB,BMCBT,"DATA HITS",BMCDATE))
IF BMCDATE=""!(BMCQUIT)
QUIT
DO P
XIT ;
+1 KILL ^XTMP("BMCOUTRP",BMCJOB,BMCBT)
+2 DO DONE^BMCRLP2
+3 DO KILL^AUPNPAT
+4 KILL BMCDATE,BMCOMDT,BMCRIEN,BMCREVN,BMCREVP,BMCRNUMB
+5 SET BMCOLOC=$PIECE(^BMCPARM(DUZ(2),0),U,11)
+6 QUIT
P ;
+1 SET BMCPTN=""
FOR
SET BMCPTN=$ORDER(^XTMP("BMCOUTRP",BMCJOB,BMCBT,"DATA HITS",BMCDATE,BMCPTN))
IF BMCPTN=""!(BMCQUIT)
QUIT
DO PRINT
+2 QUIT
PRINT ;print one referral
+1 IF $Y>(IOSL-10)
DO HEAD
IF BMCQUIT
QUIT
+2 SET BMCRIEN=0
FOR
SET BMCRIEN=$ORDER(^XTMP("BMCOUTRP",BMCJOB,BMCBT,"DATA HITS",BMCDATE,BMCPTN,BMCRIEN))
IF BMCRIEN'=+BMCRIEN!(BMCQUIT)
QUIT
SET BMCRREC=^BMCREF(BMCRIEN,0)
SET DFN=$PIECE(BMCRREC,U,3)
DO PRINT1
+3 QUIT
PRINT1 ;
+1 IF $Y>(IOSL-3)
DO HEAD
IF BMCQUIT
QUIT
+2 SET BMCRNUMB=$PIECE($GET(^BMCREF(BMCRIEN,0)),U,2)
+3 SET BMCHRN="????"
IF $DATA(^AUPNPAT(DFN,41,DUZ(2)))
SET BMCHRN=$PIECE(^AUTTLOC(DUZ(2),0),U,7)_$PIECE(^AUPNPAT(DFN,41,DUZ(2),0),U,2)
+4 WRITE !,$EXTRACT($PIECE(^DPT(DFN,0),U),1,30),?32,BMCHRN,?43,"DOB: ",$$DOB^AUPNPAT(DFN,"E")," ",$$AGE^AUPNPAT(DFN,DT,"R")," ",$$SSN^AUPNPAT(DFN)
+5 WRITE !,"Referral #: ",BMCRNUMB,$PIECE($GET(^BMCREF(BMCRIEN,1)),U)
+6 WRITE ?29,"Date Init: ",$$REFDTI^BMCRLU(BMCRIEN,"S")
+7 WRITE ?50,"Tribe: ",$EXTRACT($$TRIBE^AUPNPAT(DFN,"E"),1,20)
+8 ;
SECREF ;
+1 IF $PIECE($GET(^BMCREF(BMCRIEN,1)),U)=""
DO SECREF2^BMCRUTL
+2 ;
+3 WRITE !,"Priority: ",$$VAL^XBDIQ1(90001,BMCRIEN,.32)," CHS Auth Dec: ",$$VAL^XBDIQ1(90001,BMCRIEN,1112)," MCC Action: ",$$VAL^XBDIQ1(90001,BMCRIEN,1123)
+4 ;W !,"Utilization Review by MD: ",$$VAL^XBDIQ1(90001,BMCRIEN,1125)
LOCAT ;Print Local Categories
+1 IF $DATA(^BMCREF(BMCRIEN,21,0))
Begin DoDot:1
+2 SET BMCLOCC=0
+3 FOR
SET BMCLOCC=$ORDER(^BMCREF(BMCRIEN,21,"B",BMCLOCC))
IF BMCLOCC'=+BMCLOCC
QUIT
Begin DoDot:2
+4 SET BMCLOCI=0
+5 FOR
SET BMCLOCI=$ORDER(^BMCREF(BMCRIEN,21,"B",BMCLOCC,BMCLOCI))
IF BMCLOCI'=+BMCLOCI
QUIT
Begin DoDot:3
+6 SET BMCLOCP=$PIECE(^BMCREF(BMCRIEN,21,BMCLOCI,0),U)
+7 IF BMCLOCP=""
QUIT
+8 SET BMCLOCPP=$PIECE(^BMCLCAT(BMCLOCP,0),U)
+9 WRITE !,"Local Category: "_BMCLOCPP
End DoDot:3
End DoDot:2
End DoDot:1
+10 ;
+11 ;
ALT ;Alternate Resource Letter Date
+1 IF $Y>(IOSL-3)
DO HEAD
IF BMCQUIT
QUIT
+2 WRITE !,"Alternate Resource Letter Date: ",$$VAL^XBDIQ1(90001,BMCRIEN,1401)
+3 ;
+4 IF '$DATA(^BMCREF(BMCRIEN,2))
GOTO NEXT
+5 WRITE !,"Business Office Comments:"
+6 SET BMCNODE=1
SET BMCIOM=70
SET BMCFILE=90001.04
SET BMCDA=BMCRIEN
DO WP^BMCFDR
KILL BMCIOM
+7 SET Y=0
FOR
SET Y=$ORDER(BMCWP(Y))
IF Y'=+Y!(BMCQUIT)
QUIT
Begin DoDot:1
+8 IF $Y>(IOSL-3)
DO HEAD
IF BMCQUIT
QUIT
+9 WRITE !?5,BMCWP(Y)
End DoDot:1
+10 IF BMCQUIT
QUIT
NEXT ;
+1 WRITE !,"--------------------",!
+2 QUIT
HEAD ;ENTRY POINT
+1 NEW X,Y,Z,C
+2 IF $EXTRACT(IOST)="C"
IF IO=IO(0)
WRITE !
SET DIR(0)="EO"
DO ^DIR
KILL DIR
IF Y=0!(Y="^")!($DATA(DTOUT))
SET BMCQUIT=1
QUIT
HEAD1 ;
+1 IF $DATA(IOF)
WRITE @IOF
HEAD2 ;
+1 SET BMCPG=BMCPG+1
+2 WRITE !?13,"********** CONFIDENTIAL PATIENT INFORMATION **********"
+3 WRITE !?(80-$LENGTH($PIECE(^DIC(4,DUZ(2),0),U))/2),$PIECE(^DIC(4,DUZ(2),0),U),?72,"Page ",BMCPG,!
+4 SET Y=DT
DO DD^%DT
WRITE ?(80-$LENGTH(Y)/2),Y,!
+5 WRITE ?15,"**REFERRALS INITIATED AT OUTSIDE FACILITY (CALL'ins)**"
+6 SET Y=BMCBD
DO DD^%DT
WRITE !,?28,"BEG DATE: "_Y
+7 SET Y=BMCED
DO DD^%DT
WRITE !,?28,"END DATE: "_Y,!
+8 WRITE !,$TRANSLATE($JUSTIFY(" ",80)," ","-")
+9 QUIT