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

BCHRLU.m

Go to the documentation of this file.
BCHRLU ; IHS/CMI/LAB - TUCSON-OHPRD/LAB - GEN RETR UTILITIES ; 
 ;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
 ;Patch 11 added $$LOC call
 ;
 ;IHS/CMI/LAB - patch 6 replace BCHACE with D in MCR and PI
CTR(X,Y) ;EP - Center X in a field Y wide.
 Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
 ;----------
LOC() ;EP - Return location name from file 4 based on DUZ(2).
 Q $S($G(DUZ(2)):$S($D(^DIC(4,DUZ(2),0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
 ;----------
MCR(P,D) ;is patient medicare eligible on this date
 NEW BCHMIFN,BCHFLG
 S BCHFLG=0
 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
 S BCHMIFN=0 F  S BCHMIFN=$O(^AUPNMCR(P,11,BCHMIFN)) Q:BCHMIFN'=+BCHMIFN  D
 .Q:$P(^AUPNMCR(P,11,BCHMIFN,0),U)>D
 .I $P(^AUPNMCR(P,11,BCHMIFN,0),U,2)]"",$P(^(0),U,2)<D Q  ;IHS/CMI/LAB - changed BCHACE to D patch 6 9/21/98
 .S BCHFLG=1
 .Q
MCRX ;
 Q BCHFLG
 ;
MCD(P,D) ;
 NEW BCHMIFN,BCHNIFN,BCHFLG
 S BCHFLG=0
 I '$D(^DPT(P,0)) G MCRX
 I $P(^DPT(P,0),U,19) G MCRX
 I '$D(^AUPNPAT(P,0)) G MCDX
 I $D(^DPT(P,.35)),$P(^(.35),U)]"",$P(^(.35),U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