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

BMCRR22P.m

Go to the documentation of this file.
BMCRR22P ; IHS/PHXAO/TMJ - DETAILED OLOG REPORT ;      
 ;;4.0;REFERRED CARE INFO SYSTEM;**9**;JAN 09, 2006;Build 101
 ;IHS/ITSC/FCJ PRINTS COMMENTS FROM RCIS COMMENT FILE
 ;IHS/ITSC/FCJ MODIFIED PRINT FORMAT AND ADDED SR SUF
 ;4.0*9 11.11.2012 IHS.OIT.FCJ ADDED ICD-10 CHANGE
 ;
 S BMC80E="==============================================================================="
 S BMC80D="-------------------------------------------------------------------------------"
 S BMCPG=0 I '$D(^XTMP("BMCRR22",BMCJOB,BMCBT)) D @("HEAD"_(2-($E(IOST,1,2)="C-"))) W !,"No referrals to report",! G XIT
 S BMCPN=0 K BMCQUIT D @("HEAD"_(2-($E(IOST,1,2)="C-")))
 F  S BMCPN=$O(^XTMP("BMCRR22",BMCJOB,BMCBT,"DATA HITS",BMCPN)) Q:BMCPN=""!($D(BMCQUIT))  D DFN
XIT ;
 K ^XTMP("BMCRR22",BMCJOB,BMCBT)
 K BMCRREC,BMCREF,BMC2,BMCI,BMCG,BMCX,BMCSTR,BMCCTR,BMCFILE,BMCNODE,BMCAR,BMC1,BMCBT,BMCH,BMCPG,BMCV,BMCVDFN,BMCVDG,BMCVFLE,BMCVI,BMCVIGR,BMCVL,BMCVNM,BMCX,BMCY
 K BMCCTYP
 D KILL^AUPNPAT
 K DFN
 Q
DFN ;
 S DFN="" F  S DFN=$O(^XTMP("BMCRR22",BMCJOB,BMCBT,"DATA HITS",BMCPN,DFN)) Q:DFN=""!($D(BMCQUIT))  D PRINT
 Q
PRINT ;print one referral
 S BMC2="15,61",BMC1="1,45"
 S BMCREF=0 F  S BMCREF=$O(^XTMP("BMCRR22",BMCJOB,BMCBT,"DATA HITS",BMCPN,DFN,BMCREF)) Q:BMCREF'=+BMCREF!($D(BMCQUIT))  S BMCRREC=^BMCREF(BMCREF,0) D BUILD
 Q
BUILD ; build array
 K BMCAR
 S BMCRREC=^BMCREF(BMCREF,0)
 I $P($G(^BMCREF(BMCREF,1)),U)'="",BMCTYPR'="Y" Q
 W !!
 S Y=$P(BMCRREC,U,3) D ^AUPNPAT
 S BMCSTR="",BMCCTR=0
 W "Name: "_$E($P(^DPT($P(BMCRREC,U,3),0),U),1,25),?32,$$FMTE^XLFDT(AUPNDOB,"5D")_" "_$$VAL^XBDIQ1(9000001,DFN,1102.98)_" "_$$SSN^AUPNPAT(DFN)
 W ?60,"Ref:",$$VAL^XBDIQ1(90001,BMCREF,.02),$P($G(^BMCREF(BMCREF,1)),U)
 K BMCAR D ENPM^XBDIQ1(2.01,DFN_",0",".01","BMCAR(")
 S I=0 F  S I=$O(BMCAR(I)) Q:I'=+I  S BMCSTR=BMCAR(I,.01)_"  "
 I BMCSTR]"" S BMCSTR="AKA'S: "_BMCSTR D SET Q:$D(BMCQUIT)
 S BMCSTR="Tribe: "_$E($$VAL^XBDIQ1(9000001,DFN,1108),1,20)_"  Tribal #: "_$S($$VAL^XBDIQ1(9000001,DFN,.07)]"":$$VAL^XBDIQ1(9000001,DFN,.07),1:"< ? >")
 S BMCSTR=BMCSTR_"  "_$$VAL^XBDIQ1(9000001,DFN,1118) D SET Q:$D(BMCQUIT)
CHARTS ;print duz(2) chart then first 4 in mult.
 K BMCAR D ENPM^XBDIQ1(9000001.41,DFN_",0",".02","BMCAR(")
 I $D(BMCAR(DUZ(2))) S BMCSTR=$P(^AUTTLOC(DUZ(2),0),U,7)_"#: "_BMCAR(DUZ(2),.02) S (I,F,C)=0 F  S I=$O(BMCAR(I)) Q:I'=+I!(C>4)  I I'=DUZ(2) S C=C+1,BMCSTR=BMCSTR_"  "_$P(^AUTTLOC(I,0),U,7)_"#: "_BMCAR(I,.02)
 D SET Q:$D(BMCQUIT)
REQ ;
 S BMCSTR="Referred To:",Y=$$FACREF^BMCRLU(BMCREF),BMCSTR=$$SETSTR^VALM1(Y,BMCSTR,15,$L(Y)),Y="Attending:"
 S BMCSTR=$$SETSTR^VALM1(Y,BMCSTR,45,$L(Y)),Y=$E($$VAL^XBDIQ1(90001,BMCREF,.09),1,18),BMCSTR=$$SETSTR^VALM1(Y,BMCSTR,56,$L(Y)) D SET Q:$D(BMCQUIT)
 S BMCSTR="Referred By:  "_$$VAL^XBDIQ1(90001,BMCREF,.06) D SET Q:$D(BMCQUIT)
 S BMCSTR="Case Manager: "_$$VAL^XBDIQ1(90001,BMCREF,.19) D SET Q:$D(BMCQUIT)
 S BMCSTR="Beg DOS: "_$$AVDOS^BMCRLU(BMCREF)_"   Date Discharge Consult Rec'd: "_$$VAL^XBDIQ1(90001,BMCREF,.18) D SET Q:$D(BMCQUIT)
 S BMCSTR="Purpose: "_$$VAL^XBDIQ1(90001,BMCREF,1201) D SET Q:$D(BMCQUIT)
DRG ;
 S BMCSTR="Primary Payor: "_$$VAL^XBDIQ1(90001,BMCREF,.11) D SET Q:$D(BMCQUIT)
 D VFILES
2 ;BUSINESS OFFICE COMMENTS
 I '$D(^BMCCOM("AD",BMCREF)) Q
 S BMCCTYP="B",BMCSTR="Business Office Notes: " D COMMENTS Q:$D(BMCQUIT)
3 ;
 S BMCCTYP="D",BMCSTR="Discharge Comments: " D COMMENTS Q:$D(BMCQUIT)
4 ;CASE REVIEW COMMENTS
 S BMCCTYP="C",BMCSTR="Case Review Comments: " D COMMENTS Q:$D(BMCQUIT)
 Q
COMMENTS ; ;CALLS BMCRR5P WAS DOING THE FUNCTION
 D COMMENTS^BMCRR5P
 Q:BMCOPT="B"
 ;S BMCSTR="" D SET S BMCSTR="Additional Comments:" D SET
 Q
VFILES ;set up array of all v file entries
 NEW DA,D0,DIC,DIQ,DR,DI
 S BMCVFLE=90001 F BMCVL=0:0 S BMCVFLE=$O(^DIC(BMCVFLE)) Q:BMCVFLE>90001.02!(BMCVFLE'=+BMCVFLE)!($D(BMCQUIT))  D VF2
 Q
 ;
VF2 ;
 S BMCVNM=$P(^DIC(BMCVFLE,0),U),BMCVDG=^DIC(BMCVFLE,0,"GL"),BMCVIGR=BMCVDG_"""AD"",BMCREF,BMCVDFN)",BMCVDFN=""
 F BMCVI=1:1 S BMCVDFN=$O(@BMCVIGR) Q:BMCVDFN=""  D VF3
 Q
 ;
VF3 ;
 I BMCVI<2 S BMCSTR=$E(BMCVNM)_$$LOW^XLFSTR($E(BMCVNM,2,99)) D SET Q:$D(BMCQUIT)
 K BMCAR D ENP^XBDIQ1(BMCVFLE,BMCVDFN,".01;.06","BMCAR(","E")
 ;4.0*9 11.11.2012 IHS.OIT.FCJ ADDED ICD-10 2 NEW LINES
 S BMCDOS=$$AVDOS^BMCRLU(BMCREF,"N")
 I BMCVFLE="90001.01" D ENP^XBDIQ1(BMCVFLE,BMCVDFN,".01","BMCAR(","I") S BMCAR(.01)=$P($$ICDDX^ICDEX(BMCAR(.01,"I"),BMCDOS,,"I"),U,2)
 S Y=BMCAR(.01)_" - "_BMCAR(.06),BMCSTR=$$SETSTR^VALM1(Y,BMCSTR,3,$L(Y)) D SET Q:$D(BMCQUIT)
 Q
S ;
 S (C,F)=0 F  S F=$O(BMCAR(F)) Q:F'=+F  I BMCAR(F)]"" D
 .S C=C+1,Y=$E($S($G(^DD(90001,F,.1))]"":$P(^DD(90001,F,.1),U),1:$P(^DD(90001,F,0),U)),1,13)_": ",Y=$E(Y)_$$LOW^XLFSTR($E(Y,2,999)),BMCSTR=$$SETSTR^VALM1(Y,BMCSTR,$P(BMC1,",",C),$L(Y))
 .S Y=$E(BMCAR(F),1,20),BMCSTR=$$SETSTR^VALM1(Y,BMCSTR,$P(BMC2,",",C),$L(Y))
 D SET Q:$D(BMCQUIT)
 Q
BUILD1 ;
 S BMCSTR=$E(BMCH,1,25)_":",BMCSTR=$$SETSTR^VALM1(BMCV,BMCSTR,28,$L(BMCV))
 D SET Q:$D(BMCQUIT)
 Q
SET ;set array
 I $Y>(IOSL-3),BMCOPT'="B" D HEAD Q:$D(BMCQUIT)
 W !,BMCSTR
 S BMCSTR=""
 Q
 ;
WP ;EP - Entry point to print wp fields pass node in BMCNODE
 ;PASS FILE IN BMCFILE, ENTRY IN BMCREF
 K ^UTILITY($J,"W")
 S BMCX=0
 I '$D(BMCG) S BMCG=^DIC(BMCFILE,0,"GL"),BMCG=BMCG_BMCREF_","_BMCNODE_",BMCX)"
 S DIWL=1,DIWR=75,DIWF="C75" F  S BMCX=$O(@BMCG) Q:BMCX'=+BMCX!($D(BMCQUIT))  D
 .S Y=$P(BMCG,")")_",0)" S X=@Y D ^DIWP
 .Q
WPS ;EP
 S Z=0 F  S Z=$O(^UTILITY($J,"W",DIWL,Z)) Q:Z'=+Z!($D(BMCQUIT))  S BMCSTR=$$SETSTR^VALM1(^UTILITY($J,"W",DIWL,Z,0),BMCSTR,5,$L(^UTILITY($J,"W",DIWL,Z,0))) D SET Q:$D(BMCQUIT)
 K DIWL,DIWR,DIWF,Z
 K ^UTILITY($J,"W"),BMCNODE,BMCFILE,BMCG,BMCCOL
 Q
 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 !,"***** CONFIDENTIAL PATIENT INFORMATION ***** Referral Summary (TLOG)  Page ",BMCPG
 W !,"Report Run Date: ",$$FMTE^XLFDT($$HTFM^XLFDT($H),"1P")
 W !,BMC80D
 Q