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

BMCRR17P.m

Go to the documentation of this file.
BMCRR17P ; IHS/PHXAO/TMJ - PRNT BILL VSTS;OUTLIER REPORT ;     
 ;;4.0;REFERRED CARE INFO SYSTEM;**3,9**;JAN 09, 2006;Build 101
 ;IHS/ITSC/FCJ TEST FOR CASE COMMENT TYPE TO PRINT
 ;4.0*3 10.30.2007 IHS/OIT/FCJ ADDED CSV CHANGES
 ;4.0*9 11.11.2012 IHS.OIT.FCJ CHG FOR ICD-10
 ;
START ;
 S BMC80E="==============================================================================="
 S BMC80D="-------------------------------------------------------------------------------"
 S BMCPG=0 D @("HEAD"_(2-($E(IOST,1,2)="C-"))) I '$D(^XTMP("BMCRR17",BMCJOB,BMCBT)) W !,"No referrals to report",! G DONE
 S BMCSORT="" K BMCQUIT
 F  S BMCSORT=$O(^XTMP("BMCRR17",BMCJOB,BMCBT,"DATA HITS",BMCSORT)) Q:BMCSORT=""!($D(BMCQUIT))  D PRINT
 G:$D(BMCQUIT) DONE
 I $Y>(IOSL-6) D HEAD G:$D(BMCQUIT) DONE
 W !!!,"NOTE:  ",BMCNOES," referrals were missing an estimated Length of Stay value",!,"and were not included on this report.",!
DONE ;
 K ^XTMP("BMCRR17",BMCJOB,BMCBT)
 D DONE^BMCRLP2
 Q
PRINT ;print one referral
 I $G(BMCSPAGE),BMCPG'=1 D HEAD Q:$D(BMCQUIT)
 I $Y>(IOSL-10) D HEAD Q:$D(BMCQUIT)
 W !!,$S(BMCSTYPE="F":"FACILITY REFERRED TO:  ",BMCSTYPE="C":"CASE MANAGER:  ",BMCSTYPE="P":"PATIENT NAME:  ",1:"???:  "),BMCSORT,!
 S BMCREF=0 F  S BMCREF=$O(^XTMP("BMCRR17",BMCJOB,BMCBT,"DATA HITS",BMCSORT,BMCREF)) Q:BMCREF'=+BMCREF!($D(BMCQUIT))  S BMCRREC=^BMCREF(BMCREF,0),DFN=$P(BMCRREC,U,3) D PRINT1
 Q
PRINT1 ;
 I $Y>(IOSL-5) D HEAD Q:$D(BMCQUIT)
 S BMCHRN="????" S BMCHRN=$$HRN^AUPNPAT(DFN,DUZ(2)) I BMCHRN="" S BMCHRN="????"
 W !,BMCHRN
DX ;
 I $D(^BMCDX("AD",BMCREF)) D  I 1
 .K BMCX S (C,X)=0
 .S BMCDOS=$$AVDOS^BMCRLU(BMCREF,"N")            ;BMC*4.0*9
 .;4.0*3 10.30.2007 IHS/OIT/FCJ ADDED CSV CHANGES NXT 2 LINES;4.0*9 11.11.2012 IHS.OIT.FCJ CHG FOR ICD-10
 .;F  S X=$O(^BMCDX("AD",BMCREF,X)) Q:X'=+X!($D(BMCQUIT))  S C=C+1,BMCD=+^BMCDX(X,0) S BMCX(C)=$E($P(^ICD9(BMCD,0),U,3),1,26)_U_$P(^ICD9(BMCD,0),U)
 .;F  S X=$O(^BMCDX("AD",BMCREF,X)) Q:X'=+X!($D(BMCQUIT))  S C=C+1,BMCD=+^BMCDX(X,0) S BMCX(C)=$E($P($$ICDDX^ICDCODE(BMCD,0),U,4),1,26)_U_$P($$ICDDX^ICDCODE(BMCD,0),U,2)
 .F  S X=$O(^BMCDX("AD",BMCREF,X)) Q:X'=+X!($D(BMCQUIT))  S C=C+1,BMCD=+^BMCDX(X,0) S BMCX(C)=$E($P($$ICDDX^ICDEX(BMCD,BMCDOS,,"I"),U,4),1,26)_U_$P($$ICDDX^ICDEX(BMCD,BMCDOS,,"I"),U,2)
 E  D
 .S BMCX(1)=$E($$GET1^DIQ(90001,BMCREF,.12),1,26)_U
 W ?9,$P(BMCX(1),U),?37,$P(BMCX(1),U,2)
 W ?46,$$AVDOS^BMCRLU(BMCREF,"C")
 W ?61,$$VAL^XBDIQ1(90001,BMCREF,.1499)
 S O=($$VAL^XBDIQ1(90001,BMCREF,.1499)-$$VAL^XBDIQ1(90001,BMCREF,1109))
 W ?72,O
 S Z=1 F  S Z=$O(BMCX(Z)) Q:Z'=+Z  D  Q:$D(BMCQUIT)
 .I $Y>(IOSL-3) D HEAD Q:$D(BMCQUIT)
 .W !?9,$P(BMCX(Z),U),?37,$P(BMCX(Z),U,2)
 I $Y>(IOSL-3) D HEAD Q:$D(BMCQUIT)
 W !,"Purpose: "_$$VAL^XBDIQ1(90001,BMCREF,1201),!
 W !?9,"REVIEWED",?20,"BY ",?26,"CASE REVIEW COMMENTS",?52,"3RD PARTY: "
 S O="",O=$S($$MCR^AUPNPAT(DFN,$S($$AVDOS^BMCRLU(BMCREF,"I")]"":$$AVDOS^BMCRLU(BMCREF,"I"),1:DT)):"MCR",1:O)
 S O=$S($$MCD^AUPNPAT(DFN,$S($$AVDOS^BMCRLU(BMCREF,"I")]"":$$AVDOS^BMCRLU(BMCREF,"I"),1:DT)):"MCD",1:0)
 S O=$S($$PI^AUPNPAT(DFN,$S($$AVDOS^BMCRLU(BMCREF,"I")]"":$$AVDOS^BMCRLU(BMCREF,"I"),1:DT)):"PRVT",1:O)
 W ?64,O,?70,"ELIG: ",$$VALI^XBDIQ1(9000001,DFN,1112),!
 W ?9,"-------- --- --- -------------------"
COMMENTS ;
 I '$D(^BMCCOM("AD",BMCREF)) W !?26,"<No comments on file.>",! Q
 S BMCI=0 F  S BMCI=$O(^BMCCOM("AD",BMCREF,BMCI)) Q:BMCI'=+BMCI!($D(BMCQUIT))  D
 .Q:$P(^BMCCOM(BMCI,0),U,5)'="C"
 .S Y=$P(^BMCCOM(BMCI,0),U) W !?9,$$FMTE^XLFDT(Y,"5D")
 .S Y=$P(^BMCCOM(BMCI,0),U,4),Y=$P(^VA(200,Y,0),U,2) W ?20,Y
 .S BMCG="^BMCCOM("_BMCI_",1,BMCX)" D WP
 .S Z=0 F  S Z=$O(BMCSTR(Z)) Q:Z'=+Z  D  Q:$D(BMCQUIT)
 ..I $Y>(IOSL-3) D HEAD Q:$D(BMCQUIT)
 ..W:Z>1 ! W ?26,BMCSTR(Z)
 Q
 I $Y>(IOSL-5) D HEAD Q:$D(BMCQUIT)
 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=52,DIWF="C52" F  S BMCX=$O(@BMCG) Q:BMCX'=+BMCX!($D(BMCQUIT))  D
 .S Y=$P(BMCG,")")_",0)" S X=@Y D ^DIWP
 .Q
WPS ;EP
 K BMCSTR S Z=0 F  S Z=$O(^UTILITY($J,"W",DIWL,Z)) Q:Z'=+Z!($D(BMCQUIT))  S BMCSTR(Z)=^UTILITY($J,"W",DIWL,Z,0)
 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="" 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,!
 W ?33,"OUTLIER REPORT"
 W !,"HRCN",?9,"DX CATEGORY/DX",?36,"ICD-9CM",?45,"ADM DATE",?57,"ACTUAL LOS",?71,"OUTLIER"
 W !,BMC80D
 Q