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

BMCRCHS3.m

Go to the documentation of this file.
BMCRCHS3 ; IHS/PHXAO/TMJ - LIST ACTIVE REFERRALS CHS DENIED ;   
 ;;4.0;REFERRED CARE INFO SYSTEM;**9**;JAN 09, 2006;Build 101
 ;IHS/ITSC/FCJ ADDED BEG AND END DATE SELECTION TO REPORT
 ;
 ; This routine lists active referrals that were denied by CHS.
 ;
START ;
 W !!,"This report prints out a list of all referrals that were denied by CHS",!,"but are still active.  These may reflect referrals that either have been",!,"or should be referred under some other mechanism, e.g. alternative resources"
 W !,"or another IHS facility, etc.",!!
 W "Report will include both Primary and Secondary Referrals.",!
BD ;GET BEG AND END DATE OF REPORT
 D BD^BMCRUTL
 G:$D(DIRUT) EOJ
 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("BMCRCHS3",BMCJOB,BMCBT):1
 . E  S BMCBT=""
 K ^XTMP("BMCRCHS3",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^BMCRCHS3",XBRC="REFCHK^BMCRCHS3",XBRX="EOJ^BMCRCHS3",XBNS="BMC"
 D ^XBDBQUE
 Q
 ;
BROWSE ;
 S XBRP="VIEWR^XBLM(""REFPRT^BMCRCHS3"")"
 S XBRC="REFCHK^BMCRCHS3",XBRX="EOJ^BMCRCHS3",XBNS="BMC",XBIOP=0
 D ^XBDBQUE
 Q
 ;
REFCHK ; CHECK EACH ACTIVE/CHS REFERRAL
 ;
 S BMCODAT=$O(^BMCREF("B",BMCSD)) I BMCODAT="" S BMCET=$H Q
 S BMCODAT=BMCSD_".9999" F  S BMCODAT=$O(^BMCREF("B",BMCODAT)) Q:BMCODAT=""!((BMCODAT\1)>BMCED)  D R1
 Q
R1 ;
 S BMCRIEN="" F  S BMCRIEN=$O(^BMCREF("B",BMCODAT,BMCRIEN)) Q:BMCRIEN'=+BMCRIEN  S BMCRREC=^BMCREF(BMCRIEN,0) D PROC
 Q
 ;
PROC ;
 ;Q:$P(BMCRREC,U,15)'="A"     ;QUIT IF NOT ACTIVE  ;BMC*4.0*9 IHS.OIT.FCJ
 Q:($P(BMCRREC,U,15)="C1")!($P(BMCRREC,U,15)="X")  ;QUIT IF NOT ACTIVE OR APPROVED ;BMC*4.0*9 IHS.OIT.FCJ
 S X=^BMCREF(BMCRIEN,0)
 I $P(X,U,4)="C" D  S:BMCHIT ^XTMP("BMCRCHS3",BMCJOB,BMCBT,"DATA HITS",BMCRIEN)=""
 . S BMCHIT=1
 . Q:$P($G(^BMCREF(BMCRIEN,11)),U,12)="D"
 . S BMCHIT=0
 Q
 ;
REFPRT ; PRINT REFERRALS SELECTED
 S $P(BMC80E,"=",80)=""
 S $P(BMC80D,"-",80)=""
 D REFPRT2
 K ^XTMP("BMCRCHS3",BMCJOB,BMCBT)
 Q
 ;
REFPRT2 ;
 S BMCPG=0 D @("HEAD"_(2-($E(IOST,1,2)="C-"))) I '$D(^XTMP("BMCRCHS3",BMCJOB,BMCBT)) W !,"No referrals to report",! D PAUSE^BMC Q
 S BMCRIEN=0 K BMCQUIT
 F  S BMCRIEN=$O(^XTMP("BMCRCHS3",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 DENIED STILL ACTIVE",80),!
 S Y=BMCBD D DD^%DT W ?17,"BEG DATE: "_Y
 S Y=BMCED D DD^%DT W ?40,"END DATE: "_Y,!
 W !,"REF DATE",?11,"PATIENT NAME",?32," HRN",?43,"PROV",?49,"FACILITY REF TO"
 W !,BMC80D
 W !
 Q
 ;
EOJ ; END OF JOB
 LOCK -^XTMP("BMCRCHS3",BMCJOB,BMCBT)
 K ^XTMP("BMCRCHS3",BMCJOB,BMCBT)
 K BMCBD,BMCED,BMCBDD,BMCEDD,BMCSD
 D ^BMCKILL
 Q