BMCRCHS2 ; IHS/PHXAO/TMJ - LIST CHS REFERRALS NOT APPROVED ;
;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
;; IHS/ITSC/FCJ ADDED LINE TO KILL VARS
;
; This routine lists active CHS referrals that have not yet been
; approved.
;
START ;
W !!,"This report prints out a list of all CHS referrals whose CHS authorization ",!,"is still pending. This is useful if the CHS Office wishes to review",!," all those referrals which still require their decision.",!!
D INIT
Q:BMCQ
D DBQUE
Q
;
INIT ; INITIALIZAION
S BMCQ=0
D:$G(BMCPARM)="" PARMSET^BMC
S BMCJOB=$J
F D Q:BMCBT]""
. S BMCBT=$H
. LOCK +^XTMP("BMCRCHS2",BMCJOB,BMCBT):1
. E S BMCBT=""
. Q
K ^XTMP("BMCRCHS2",BMCJOB,BMCBT)
Q
;
DBQUE ;call to XBDBQUE
K BMCOPT
W ! S DIR(0)="S^P:PRINT Output;B:BROWSE Output on Screen",DIR("A")="Do you wish to",DIR("B")="P" K DA D ^DIR K DIR
I $D(DIRUT) S BMCQUIT=1 Q
S BMCOPT=Y
I $G(BMCOPT)="B" D BROWSE Q
S XBRP="REFPRT^BMCRCHS2",XBRC="REFCHK^BMCRCHS2",XBRX="EOJ^BMCRCHS2",XBNS="BMC"
D ^XBDBQUE
Q
;
BROWSE ;
S XBRP="VIEWR^XBLM(""REFPRT^BMCRCHS2"")"
S XBRC="REFCHK^BMCRCHS2",XBRX="EOJ^BMCRCHS2",XBNS="BMC",XBIOP=0
D ^XBDBQUE
Q
;
REFCHK ; CHECK EACH ACTIVE/CHS REFERRAL
S BMCRIEN=0
F S BMCRIEN=$O(^BMCREF("AB","A",BMCRIEN)) Q:'BMCRIEN D
. S X=^BMCREF(BMCRIEN,0)
. I $P(X,U,4)="C" D S:BMCHIT ^XTMP("BMCRCHS2",BMCJOB,BMCBT,"DATA HITS",BMCRIEN)=""
.. S BMCHIT=1
.. Q:$P($G(^BMCREF(BMCRIEN,11)),U,12)="P"
.. S BMCHIT=0
.. Q
. Q
Q
;
REFPRT ; PRINT REFERRALS SELECTED
S $P(BMC80E,"=",80)=""
S $P(BMC80D,"-",80)=""
D REFPRT2
K ^XTMP("BMCRCHS2",BMCJOB,BMCBT)
Q
;
REFPRT2 ;
S BMCPG=0 D @("HEAD"_(2-($E(IOST,1,2)="C-"))) I '$D(^XTMP("BMCRCHS2",BMCJOB,BMCBT)) W !,"No referrals to report",! D PAUSE^BMC Q
S BMCRIEN=0 K BMCQUIT
F S BMCRIEN=$O(^XTMP("BMCRCHS2",BMCJOB,BMCBT,"DATA HITS",BMCRIEN)) Q:BMCRIEN=""!($D(BMCQUIT)) D PRINT
Q:$D(BMCQUIT)
D PAUSE^BMC
Q
;
PRINT ;print one referral
S BMCRREC=^BMCREF(BMCRIEN,0)
S Y=BMCRIEN
D ^BMCREF
I $Y>(IOSL-5) D HEAD Q:$D(BMCQUIT)
W $$FMTE^XLFDT($P(BMCRREC,U),"5D")
W ?12,$E(BMCREC("PAT NAME"),1,18)
S BMCHRN="????" I $D(^AUPNPAT(BMCDFN,41,DUZ(2))) S BMCHRN=$P(^AUTTLOC(DUZ(2),0),U,7)_$P(^AUPNPAT(BMCDFN,41,DUZ(2),0),U,2)
W ?32,BMCHRN
W ?43,$S($P(BMCRREC,U,6):$$PROVINI^XBFUNC1($P(BMCRREC,U,6)),1:"--")
W ?49,$$TOFAC^BMC(BMCRIEN)
W !
I $P($G(^BMCREF(BMCRIEN,12)),U)="" Q ;no purpose of referral
S X=$P(^BMCREF(BMCRIEN,12),U),DIWF="",DIWL=10,DIWR=70 D ^DIWP
S Z=0 F S Z=$O(^UTILITY($J,"W",DIWL,Z)) Q:Z'=+Z W ?10,^UTILITY($J,"W",DIWL,Z,0),!
K DIWL,DIWR,DIWF,Z
K ^UTILITY($J,"W")
W !
Q
;
HEAD ;
D PAUSE^BMC
I $D(DIRUT) S BMCQUIT="" Q
D HEAD1
Q
;
HEAD1 ;
W:$D(IOF) @IOF
HEAD2 ; WRITE HEADER
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,!
W $$CTR^BMC("CHS REFERRALS PENDING APPROVAL",80),!
W !,"REF DATE",?11,"PATIENT NAME",?32," HRN",?43,"PROV",?49,"FACILITY REF TO"
W !,BMC80D
W !
Q
;
EOJ ; END OF JOB
LOCK -^XTMP("BMCRCHS2",BMCJOB,BMCBT)
K ^XTMP("BMCRCHS2",BMCJOB,BMCBT)
D ^BMCKILL
K BMC80D,BMC80E,BMCBT,BMCJOB,BMCOPT,BMCPG,BMCQUIT,BMCRREC,BMCRSTAT
Q
BMCRCHS2 ; IHS/PHXAO/TMJ - LIST CHS REFERRALS NOT APPROVED ;
+1 ;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
+2 ;; IHS/ITSC/FCJ ADDED LINE TO KILL VARS
+3 ;
+4 ; This routine lists active CHS referrals that have not yet been
+5 ; approved.
+6 ;
START ;
+1 WRITE !!,"This report prints out a list of all CHS referrals whose CHS authorization ",!,"is still pending. This is useful if the CHS Office wishes to review",!," all those referrals which still require their decision.",!!
+2 DO INIT
+3 IF BMCQ
QUIT
+4 DO DBQUE
+5 QUIT
+6 ;
INIT ; INITIALIZAION
+1 SET BMCQ=0
+2 IF $GET(BMCPARM)=""
DO PARMSET^BMC
+3 SET BMCJOB=$JOB
+4 FOR
Begin DoDot:1
+5 SET BMCBT=$HOROLOG
+6 LOCK +^XTMP("BMCRCHS2",BMCJOB,BMCBT):1
+7 IF '$TEST
SET BMCBT=""
+8 QUIT
End DoDot:1
IF BMCBT]""
QUIT
+9 KILL ^XTMP("BMCRCHS2",BMCJOB,BMCBT)
+10 QUIT
+11 ;
DBQUE ;call to XBDBQUE
+1 KILL BMCOPT
+2 WRITE !
SET DIR(0)="S^P:PRINT Output;B:BROWSE Output on Screen"
SET DIR("A")="Do you wish to"
SET DIR("B")="P"
KILL DA
DO ^DIR
KILL DIR
+3 IF $DATA(DIRUT)
SET BMCQUIT=1
QUIT
+4 SET BMCOPT=Y
+5 IF $GET(BMCOPT)="B"
DO BROWSE
QUIT
+6 SET XBRP="REFPRT^BMCRCHS2"
SET XBRC="REFCHK^BMCRCHS2"
SET XBRX="EOJ^BMCRCHS2"
SET XBNS="BMC"
+7 DO ^XBDBQUE
+8 QUIT
+9 ;
BROWSE ;
+1 SET XBRP="VIEWR^XBLM(""REFPRT^BMCRCHS2"")"
+2 SET XBRC="REFCHK^BMCRCHS2"
SET XBRX="EOJ^BMCRCHS2"
SET XBNS="BMC"
SET XBIOP=0
+3 DO ^XBDBQUE
+4 QUIT
+5 ;
REFCHK ; CHECK EACH ACTIVE/CHS REFERRAL
+1 SET BMCRIEN=0
+2 FOR
SET BMCRIEN=$ORDER(^BMCREF("AB","A",BMCRIEN))
IF 'BMCRIEN
QUIT
Begin DoDot:1
+3 SET X=^BMCREF(BMCRIEN,0)
+4 IF $PIECE(X,U,4)="C"
Begin DoDot:2
+5 SET BMCHIT=1
+6 IF $PIECE($GET(^BMCREF(BMCRIEN,11)),U,12)="P"
QUIT
+7 SET BMCHIT=0
+8 QUIT
End DoDot:2
IF BMCHIT
SET ^XTMP("BMCRCHS2",BMCJOB,BMCBT,"DATA HITS",BMCRIEN)=""
+9 QUIT
End DoDot:1
+10 QUIT
+11 ;
REFPRT ; PRINT REFERRALS SELECTED
+1 SET $PIECE(BMC80E,"=",80)=""
+2 SET $PIECE(BMC80D,"-",80)=""
+3 DO REFPRT2
+4 KILL ^XTMP("BMCRCHS2",BMCJOB,BMCBT)
+5 QUIT
+6 ;
REFPRT2 ;
+1 SET BMCPG=0
DO @("HEAD"_(2-($EXTRACT(IOST,1,2)="C-")))
IF '$DATA(^XTMP("BMCRCHS2",BMCJOB,BMCBT))
WRITE !,"No referrals to report",!
DO PAUSE^BMC
QUIT
+2 SET BMCRIEN=0
KILL BMCQUIT
+3 FOR
SET BMCRIEN=$ORDER(^XTMP("BMCRCHS2",BMCJOB,BMCBT,"DATA HITS",BMCRIEN))
IF BMCRIEN=""!($DATA(BMCQUIT))
QUIT
DO PRINT
+4 IF $DATA(BMCQUIT)
QUIT
+5 DO PAUSE^BMC
+6 QUIT
+7 ;
PRINT ;print one referral
+1 SET BMCRREC=^BMCREF(BMCRIEN,0)
+2 SET Y=BMCRIEN
+3 DO ^BMCREF
+4 IF $Y>(IOSL-5)
DO HEAD
IF $DATA(BMCQUIT)
QUIT
+5 WRITE $$FMTE^XLFDT($PIECE(BMCRREC,U),"5D")
+6 WRITE ?12,$EXTRACT(BMCREC("PAT NAME"),1,18)
+7 SET BMCHRN="????"
IF $DATA(^AUPNPAT(BMCDFN,41,DUZ(2)))
SET BMCHRN=$PIECE(^AUTTLOC(DUZ(2),0),U,7)_$PIECE(^AUPNPAT(BMCDFN,41,DUZ(2),0),U,2)
+8 WRITE ?32,BMCHRN
+9 WRITE ?43,$SELECT($PIECE(BMCRREC,U,6):$$PROVINI^XBFUNC1($PIECE(BMCRREC,U,6)),1:"--")
+10 WRITE ?49,$$TOFAC^BMC(BMCRIEN)
+11 WRITE !
+12 ;no purpose of referral
IF $PIECE($GET(^BMCREF(BMCRIEN,12)),U)=""
QUIT
+13 SET X=$PIECE(^BMCREF(BMCRIEN,12),U)
SET DIWF=""
SET DIWL=10
SET DIWR=70
DO ^DIWP
+14 SET Z=0
FOR
SET Z=$ORDER(^UTILITY($JOB,"W",DIWL,Z))
IF Z'=+Z
QUIT
WRITE ?10,^UTILITY($JOB,"W",DIWL,Z,0),!
+15 KILL DIWL,DIWR,DIWF,Z
+16 KILL ^UTILITY($JOB,"W")
+17 WRITE !
+18 QUIT
+19 ;
HEAD ;
+1 DO PAUSE^BMC
+2 IF $DATA(DIRUT)
SET BMCQUIT=""
QUIT
+3 DO HEAD1
+4 QUIT
+5 ;
HEAD1 ;
+1 IF $DATA(IOF)
WRITE @IOF
HEAD2 ; WRITE HEADER
+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 WRITE $$CTR^BMC("CHS REFERRALS PENDING APPROVAL",80),!
+5 WRITE !,"REF DATE",?11,"PATIENT NAME",?32," HRN",?43,"PROV",?49,"FACILITY REF TO"
+6 WRITE !,BMC80D
+7 WRITE !
+8 QUIT
+9 ;
EOJ ; END OF JOB
+1 LOCK -^XTMP("BMCRCHS2",BMCJOB,BMCBT)
+2 KILL ^XTMP("BMCRCHS2",BMCJOB,BMCBT)
+3 DO ^BMCKILL
+4 KILL BMC80D,BMC80E,BMCBT,BMCJOB,BMCOPT,BMCPG,BMCQUIT,BMCRREC,BMCRSTAT
+5 QUIT