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

BMCRCHS2.m

Go to the documentation of this file.
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
 ;
 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