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

BMCRLU1.m

Go to the documentation of this file.
BMCRLU1 ; IHS/PHXAO/TMJ - GEN RETR UTILITIES ; 03 May 2018  4:47 PM
 ;;4.0;REFERRED CARE INFO SYSTEM;**3,12,13**;JAN 09, 2006;Build 101
 ;BMC 4.0*3 11/30/06 IHS/OIT/FCJ PRNT POL #
 ;4.0*13 4.1.18 IHS.OIT.FCJ ADDED NEW MBI FOR MEDICARE AND RRR
 ;
MCR ;display all current medicare data
 NEW BMCMIFN,BMCMBI
 I '$D(^DPT(P,0)) G MCRX
 I $P(^DPT(P,0),U,19) G MCRX
 I '$D(^AUPNPAT(P,0)) G MCRX
 I '$D(^AUPNMCR(P,11)) G MCRX
 I $D(^DPT(P,.35)),$P(^(.35),U)]"",$P(^(.35),U)<D G MCRX
 ;4.0*13 4.1.18 IHS.OIT.FCJ REWROTE SECTION FOR NEW MBI
 S BMCMBI=$$GETMBI^AUPNMBI(P,DT,0)
 I BMCMBI<1 S BMCMBI=$P($G(^AUPNMCR(P,0)),U,3) I $P(^AUPNMCR(P,0),U,4)'="" S BMCMBI=BMCMBI_$G(^AUTTMCS($P(^AUPNMCR(P,0),U,4),0))
 S BMCMIFN=0 F  S BMCMIFN=$O(^AUPNMCR(P,11,BMCMIFN)) Q:BMCMIFN'=+BMCMIFN  D
 .Q:$P(^AUPNMCR(P,11,BMCMIFN,0),U)>D
 .I $P(^AUPNMCR(P,11,BMCMIFN,0),U,2)]"",$P(^(0),U,2)<D Q
 .;S BMCPCNT=BMCPCNT+1,BMCPRNM(BMCPCNT)=$P(^AUPNMCR(DFN,0),U,3)_" ["_$S($P(^(0),U,4)]"":$P(^AUTTMCS($P(^(0),U,4),0),U),1:"-")_"]"
 .;TEST FOR COV "D"
 .S BMCPCNT=BMCPCNT+1,BMCPRNM(BMCPCNT)=$S($P(^AUPNMCR(P,11,BMCM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1,3)+1700)
 ;
PIX ;
 Q
ML ;EP - set up mailing address print array
 S BMCPCNT=0 K BMCPRNM
 F X=1:1:3 S Y=$P($G(^DPT(DFN,.11)),U,X) I Y]"" S BMCPCNT=BMCPCNT+1,BMCPRNM(BMCPCNT)=Y
 S X=$P($G(^DPT(DFN,.11)),U,4)_", "
 S Y="",Y=$P($G(^DPT(DFN,.11)),U,5) I Y S Y=$P(^DIC(5,Y,0),U)
 S X=X_$S(Y]"":Y,1:"  ")
 S X=X_" "_$P($G(^DPT(DFN,.11)),U,6)
 S BMCPCNT=BMCPCNT+1,BMCPRNM(BMCPCNT)=X
 Q
 ;
RRR(P,D) ;EP Railroad Retirement 
 ;P = PATIENT
 ;D = DATE
 ; I = IEN
 ; Y = 1:yes, 0:no
 I '$G(P) Q 0
 I '$G(D) Q 0
 NEW I,Y,J
 S Y=0,U="^"
 I '$D(^DPT(P,0)) Q Y
 I $P(^DPT(P,0),U,19) Q Y
 I '$D(^AUPNPAT(P,0)) Q Y
 I '$D(^AUPNRRE(P,11)) Q Y
 I $D(^DPT(P,.35)),$P(^(.35),U)]"",$P(^(.35),U)<D Q Y
 I $$GETMBI^AUPNMBI(P,D,0)>0 S Y=1 Q Y  ;BMC*4.0*13 TEST FOR NEW MBI
 S I=0 F  S I=$O(^AUPNRRE(P,11,I)) Q:I'=+I  D
 . Q:$P(^AUPNRRE(P,11,I,0),U)=""
 . Q:$P(^AUPNRRE(P,11,I,0),U,1)>D
 . I $P(^AUPNRRE(P,11,I,0),U,2)]"",$P(^(0),U,2)<D Q
 . S Y=1
 Q Y
 ;BMC*3.1*12;IHS/OIT/FCJ FACREQ NEW
FACREQ(R) ;EP return facility requesting referral
 N BMCF,BMCFDA
 S BMCFDA=0,BMCF=""
 S BMCF=$E($P(^BMCREF(R,0),U,2),1,6),BMCFDA=$O(^AUTTLOC("C",BMCF,BMCFDA))
 Q BMCFDA