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

BMCRTC1.m

Go to the documentation of this file.
BMCRTC1 ; IHS/OIT/FCJ- LIST APPROVED REFERRALS WITH TOC PENDING; 15 Mar 2013  9:02 AM
 ;;4.0;REFERRED CARE INFO SYSTEM;**8,12**;JAN 09, 2006;Build 101
 ;IHS/ITSC/FCJ PATCH 8 NEW ROUTINE
 ;
 ; This routine lists approved referrals where the TOC status is pending
 ;
 ;
START ;
 W !!,"This report prints out a list of all approved referrals for which the status",!,"of the transition of care document is pending.",!!
 W "Report will include Primary and Secondary Referrals.",!
 S BMCJOB=$J
 ;
BD ;GET BEG DATE OF REPORT
 W ! S DIR(0)="D^:DT:EP",DIR("A")="Enter beginning Referral Date" D ^DIR S:$D(DUOUT) DIRUT=1 K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) G EOJ
 S (BMCBD,BMCSD)=Y
 D INIT
 Q:BMCQ
 D DBQUE
 Q
 ;
INIT ; INITIALIZAION
 S BMCQ=0
 D:$G(BMCPARM)="" PARMSET^BMC
 F  D  Q:BMCBT]""
 . S BMCBT=$H
 K ^XTMP("BMCRTC1",$J,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^BMCRTC1",XBRC="REFCHK^BMCRTC1",XBRX="EOJ^BMCRTC1",XBNS="BMC"
 D ^XBDBQUE
 Q
 ;
BROWSE ;
 S XBRP="VIEWR^XBLM(""REFPRT^BMCRTC1"")"
 S XBRC="REFCHK^BMCRTC1",XBRX="EOJ^BMCRTC1",XBNS="BMC",XBIOP=0
 D ^XBDBQUE
 Q
 ;
REFCHK ; CHECK FOR PENDING TOC AND APPROVED  
 Q:'$D(^BMCREF("TOC","P"))
 S BMCODAT=BMCSD-1
 S BMCUSVN="" I $D(^AUTTVNDR("B","UNSPECIFIED")) S BMCUSVN=$O(^AUTTVNDR("B","UNSPECIFIED",0))  ;BMC*4.0*12
 F  S BMCODAT=$O(^BMCREF("B",BMCODAT)) Q:BMCODAT=""  D
 .S (BMCRIEN,BMCPROV,BMCPDIR)="" F  S BMCRIEN=$O(^BMCREF("B",BMCODAT,BMCRIEN)) Q:BMCRIEN'=+BMCRIEN  D
 ..Q:$P(^BMCREF(BMCRIEN,0),U,4)="N"  ;BMC*4.0*12
 ..;BMC*4.0*12 IHS/OIT/FCJ NO LONGER CHECKING FOR TOC PENDING AND APPROVED, NOW ONLY CHECKNG FOR PRINTED OR TRANSMITTED
 ..;I $D(^BMCREF("TOC","P",BMCRIEN)),$P(^BMCREF(BMCRIEN,0),U,15)="A1"  D
 ..S CT=0 I $D(^BMCREF(BMCRIEN,6)) S L=0,CT=0 F  S L=$O(^BMCREF(BMCRIEN,6,L)) Q:L'?1N.N  S CT=CT+1
 ..I CT=0 D
 ...S BMCPROV=$P(^BMCREF(BMCRIEN,0),U,7)
 ...I BMCPROV="" Q:'BMCUSVN  S BMCPROV=BMCUSVN  ;BMC*4.0*12
 ...S BMCPDIR=$S($P($G(^AUTTVNDR(BMCPROV,21)),U,4)'="":$$VAL^XBDIQ1(9999999.11,BMCPROV,2104),1:"NO")
 ...S ^XTMP("BMCRTC1",BMCJOB,"DATA HITS",BMCPDIR,BMCPROV,BMCRIEN)=""
 K CT,L
 Q
 ;
REFPRT ; PRINT REFERRALS SELECTED
 S $P(BMC80E,"=",80)=""
 S $P(BMC80D,"-",80)=""
 D REFPRT2
 K ^XTMP("BMCRTC1",BMCJOB)
 Q
 ;
REFPRT2 ;
 S BMCPG=0 D @("HEAD"_(2-($E(IOST,1,2)="C-"))) I '$D(^XTMP("BMCRTC1",BMCJOB,"DATA HITS")) W !,"No referrals to report",! D PAUSE^BMC Q
 S BMCPDIR=0
 F  S BMCPDIR=$O(^XTMP("BMCRTC1",BMCJOB,"DATA HITS",BMCPDIR)) Q:BMCPDIR=""!($D(BMCQUIT))  D
 .S BMCPROV=0 F  S BMCPROV=$O(^XTMP("BMCRTC1",BMCJOB,"DATA HITS",BMCPDIR,BMCPROV)) Q:BMCPROV=""!($D(BMCQUIT))  D PRINT
 Q:$D(BMCQUIT)
 D PAUSE^BMC
 Q
 ;
PRINT ;Print Prov
 I $Y>(IOSL-5) D HEAD Q:$D(BMCQUIT)
 W !,$S(BMCPDIR="YES":"Direct ",1:""),"Provider:  ",$$VAL^XBDIQ1(9999999.11,BMCPROV,.01),!
 S BMCRIEN=0
 F  S BMCRIEN=$O(^XTMP("BMCRTC1",BMCJOB,"DATA HITS",BMCPDIR,BMCPROV,BMCRIEN)) Q:BMCRIEN=""!($D(BMCQUIT))  D PRINTR
 Q
 ;
PRINTR ;Print Ref
 I $Y>(IOSL-5) D HEAD Q:$D(BMCQUIT)
 S BMCRREC=^BMCREF(BMCRIEN,0)
 S Y=BMCRIEN
 D ^BMCREF
 W BMCRNUMB_BMCSUF
 W ?16,$E(BMCREC("PAT NAME"),1,25)
 W ?48,$$FMTE^XLFDT($P(BMCRREC,U),"2D")
 ;
 K ^UTILITY($J,"W")
 F BMCL=0:0 S BMCL=$O(^BMCREF(BMCRIEN,1,BMCL)) Q:'BMCL  S X=^(BMCL,0) D
 . S DIWL=10,DIWR=70,DIWF="W"
 . D ^DIWP
 D ^DIWW
 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("APPROVED REFERRALS WHERE TRANSITION OF CARE DOCUMENT IS PENDING",80),!  ;BMC*4.0*12 IHS/OIT/FCJ
 W $$CTR^BMC("TRANSITION OF CARE DOCUMENT PENDING PRINTED OR TRANSMITTED",80),!  ;BMC*4.0*12 IHS/OIT/FCJ
 S Y=BMCBD D DD^%DT W ?17,"BEG DATE: "_Y
 ;S Y=BMCED D DD^%DT W ?40,"END DATE: "_Y,!
 S Y=DT D DD^%DT W ?40,"END DATE: "_Y,!
 W !,"REFERRAL #",?16,"PATIENT NAME",?45,"REFERRAL-DATE"
 W !,BMC80D
 W !
 Q
 ;
EOJ ; END OF JOB
 K ^XTMP("BMCRTC1",BMCJOB)
 D ^BMCKILL
 K BMC80D,BMC80E,BMCBOS,BMCBT,BMCJOB,BMCCL,BMCOPT,BMCPG,BMCRREC,BMCRSTAT,BMCSKIP
 K BMCBD,BMCED,BMCBDD,BMCEDD,BMCSD,BMCUSVN
 Q