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

BMCRRSPP.m

Go to the documentation of this file.
BMCRRSPP ; IHS/PHXAO/TMJ - SECONDARY PROVIDER LETTER ;    
 ;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
 ;
 ;IHS/ITSC/FCJ WAS NOT PRINTING COMMENTS ;WRONG FIELDS WERE PRINTING
 ;    PRINT REF TYPE;REMOVED KILL AND RESET BMCOLOC; PRT SUFFIX
 ;
 S BMCPG=0 D @("HEAD"_(2-($E(IOST,1,2)="C-"))) I '$D(^XTMP("BMCRRSP",BMCJOB,BMCBT)) W !,"No referrals to report",! G XIT
 S BMCPN=0,BMCQUIT=0
 S BMCDATE="" F  S BMCDATE=$O(^XTMP("BMCRRSP",BMCJOB,BMCBT,"DATA HITS",BMCDATE)) Q:BMCDATE=""!(BMCQUIT)  D P
XIT ;
 K ^XTMP("BMCRRSP",BMCJOB,BMCBT)
 D DONE^BMCRLP2
 D KILL^AUPNPAT
 K BMCI,BMCDATE,BMCOMDT,BMCRDT,BMCREVN,BMCREVP
 S BMCOLOC=$P(^BMCPARM(DUZ(2),0),U,11)
 Q
P ;
 S BMCPN="" F  S BMCPN=$O(^XTMP("BMCRRSP",BMCJOB,BMCBT,"DATA HITS",BMCDATE,BMCPN)) Q:BMCPN=""!(BMCQUIT)  D PRINT
 Q
PRINT ;print one referral
 I $Y>(IOSL-10) D HEAD Q:BMCQUIT
 S BMCRDT=0
 F  S BMCRDT=$O(^XTMP("BMCRRSP",BMCJOB,BMCBT,"DATA HITS",BMCDATE,BMCPN,BMCRDT)) Q:BMCRDT'=+BMCRDT!(BMCQUIT)  D  D PRINT1
 .S BMCRREC=^BMCREF(BMCRDT,0),DFN=$P(BMCRREC,U,3)
 .S BMCREF=$P(^BMCREF(BMCRDT,1),U,2)
 .S BMCSUF=$P($G(^BMCREF(BMCRDT,1)),U)
 Q
PRINT1 ;
 I $Y>(IOSL-3) D HEAD Q:BMCQUIT
 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 #: ",$P($G(^BMCREF(BMCRDT,0)),U,2)," ",BMCSUF
 W ?29,"Date Init: ",$$REFDTI^BMCRLU(BMCRDT,"S")
 W ?50,"Tribe: ",$E($$TRIBE^AUPNPAT(DFN,"E"),1,20)
 ;
 ;
LETTER ;Print Letter Information
 ;
 W !,"Refferal Type: "_$$VAL^XBDIQ1(90001,BMCREF,.04)
 S Y=$P(BMCRREC,U,1) D DD^%DT S BMCCOMDT=Y
 W !,"LETTER DATE: "_BMCCOMDT
 S BMCREVP=$P(BMCRREC,U,25) S BMCREVN=$P(^VA(200,BMCREVP,0),U,1)
 W ?43,"USER CREATED: "_BMCREVN,!
 S BMCAPPT=$P(^BMCREF(BMCRDT,11),U,5) ;Exp Appt Date
 S BMCPUR=$P($G(^BMCREF(BMCRDT,12)),U) ; Purpose
 S BMCIHSP=$P(BMCRREC,U,8) ;IHS Provider
 S BMCSPRV=$P(BMCRREC,U,7) ;Provider/Vendor IEN
 S:BMCSPRV'="" BMCSPRV=$P(^AUTTVNDR(BMCSPRV,0),U)
 S Y=BMCAPPT D DD^%DT S BMCAPPT=Y
 W !,"Expected Appoinment Date: ",BMCAPPT
 W !,"Purpose of Appointment: ",BMCPUR
 W !,"Contract Vendor: ",BMCSPRV
 S:BMCIHSP'="" BMCIHSP=$P(^DIC(4,BMCIHSP,0),U)
 W !,"IHS Facility: ",BMCIHSP
 ;
LOCAT ;Print Local Categories
 I $D(^BMCREF(BMCREF,21,0)) D
 . S BMCLOCC=0
 .F  S BMCLOCC=$O(^BMCREF(BMCREF,21,"B",BMCLOCC)) Q:BMCLOCC'=+BMCLOCC  D
 ..S BMCLOCI=0
 ..F  S BMCLOCI=$O(^BMCREF(BMCREF,21,"B",BMCLOCC,BMCLOCI)) Q:BMCLOCI'=+BMCLOCI  D
 ... S BMCLOCP=$P(^BMCREF(BMCREF,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,BMCREF,1401)
 ;
BO ;Business office comments
 S BMCI=0,Y=0
 F  S BMCI=$O(^BMCCOM("AD",BMCREF,BMCI)) Q:BMCI'?1N.N  D  Q:BMCQUIT
 .Q:$P(^BMCCOM(BMCI,0),U,5)'="B"
 .I Y=0 W !,"Business Office Comments:"
 .S BMCNODE=1,BMCIOM=70,BMCFILE=90001.03,BMCDA=BMCI 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
 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 ?21,"**SECONDARY PROVIDER LETTER BY DATE**",!
 S Y=BMCBD D DD^%DT W ?17,"BEG DATE: "_Y
 S Y=BMCED D DD^%DT W ?40,"END DATE: "_Y,!
 W !,$TR($J(" ",80)," ","-")
 Q