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

BPCSC.m

Go to the documentation of this file.
BPCSC ; IHS/OIT/MJL - SPECIAL CROSS REFERENCE ROUTINE ;
 ;;1.5;BPC;;MAY 26, 2005
 ;
DX ;FHL 12/31/99
 S BGUCRFS1="AIHS"
 I BGUBEGIN?.N1".".N!(BGUBEGIN?1"V".N.1".".N)!(BGUBEGIN="") D  Q
 .I BGUBEGIN'="",$D(^ICD9("BA",BGUBEGIN)) D  Q:BGUIEN'=""
 ..S BGUIEN=$O(^ICD9("BA",BGUBEGIN,""))
 ..I BGUIEN'="" S (BGUBEGIN,BGUEND,BGUCRFS,BGUCRFS1)=""
 .S BGUCRFS1="BA"
 I BGUBEGIN?1N.N D
 .S BGUCRFS1="BA"
 .S BGUBEGIN=BGUBEGIN_"."
 .S BGUEND=BGUBEGIN_"~"
 Q
INTERACT ;
 I '$D(BGUDRIVR) D  Q
 .S BGUDRIVR="INTERACT^BPCSC",BGUCRFS="",BPCDIEN2=BGUBEGIN
 .S BPCDIEN1=BGUEND,BGUMAX=32000
 .S (BGUBEGIN,BGUEND)=""
 Q:BPCDIEN1=""!(BPCDIEN2="")
 I $D(^PSDRUG(BPCDIEN1,"ND")),$D(^PSDRUG(BPCDIEN2,"ND")) D INTACT1
 Q
INTACT1 ;
 S BPCND=^PSDRUG(BPCDIEN1,"ND"),BPCNDF1=$P(BPCND,"^",1)_"A"_$P(BPCND,"^",3)
 S BPCND=^PSDRUG(BPCDIEN2,"ND"),BPCNDF2=$P(BPCND,"^",1)_"A"_$P(BPCND,"^",3)
 S BPCIEN=$O(^PS(56,"APD",BPCNDF1,BPCNDF2,0)) Q:BPCIEN=""
 S BGUSUB(1)=BPCIEN D FIELDS^BGULIST
 ;F BPCX=1:1:$L(BPCDIENS,"`") D
 .S BPCDRGI=$P(BPCDIENS,"`",BPCX)
 .I $D(^PSDRUG(BPCDRGI,"ND")) D
 ..S BPCND=^PSDRUG(BPCDRGI,"ND")
 ..S BPCNDF1=$P(BPCND,"^",1)_"A"_$P(BPCND,"^",3)
 ..S BPCIEN=$O(^PS(56,"APD",BPCNDF1,BPCNDF2,0)) Q:BPCIEN=""
 ..S BGUSUB(1)=BPCIEN D FIELDS^BGULIST
 Q
MEDS ;
 I '$D(BGUDRIVR) D  Q
 .S BGUDRIVR="MEDS^BPCSC",BGUCRFS="",BPCPIEN=BGUBEGIN
 .S BPCOPT=$P(BGUEND,"`",1),BPCSDATE=$P(BGUEND,"`",2)
 .S BPCEDATE=$P(BGUEND,"`",3),BPCLIM=BGUMAX,BGUMAX=32000
 .S (BGUBEGIN,BGUEND)=""
 Q:BPCPIEN=""
 S:BPCOPT=2 BPCLIM=9999999
 S BPCC=0,BPCX=0 F  S BPCX=$O(^AUPNVSIT("AA",BPCPIEN,BPCX)) Q:BPCX=""!(BPCC=BPCLIM)  D
 .S BPCVIEN="" F  S BPCVIEN=$O(^AUPNVSIT("AA",BPCPIEN,BPCX,BPCVIEN)) Q:BPCVIEN=""!(BPCC=BPCLIM)  D
 ..I BPCOPT=3,'$D(^AUPNVLAB("AD",BPCVIEN)) Q
 ..S BPCY=^AUPNVSIT(BPCVIEN,0),BPCVDT=$P(BPCY,U,1),BPCCKD=$P(BPCVDT,".",1)
 ..I BPCSDATE'="",BPCEDATE'="",((BPCCKD<BPCSDATE)!(BPCCKD>BPCEDATE)) Q
 ..S BPCVMIEN=0,BPCC=BPCC+1 F  S BPCVMIEN=$O(^AUPNVMED("AD",BPCVIEN,BPCVMIEN)) Q:BPCVMIEN=""  D
 ...S BPCSTAT=0
 ...I $D(^PSRX("APCC",BPCVMIEN)) D
 ....S BPCRXIEN=$O(^PSRX("APCC",BPCVMIEN,"")) Q:BPCRXIEN=""
 ....S BPCCK=$O(^PSRX("APCC",BPCVMIEN,BPCRXIEN,""))
 ....I BPCCK'="" S BPCSTAT=-1 Q
 ....S BPCSTAT=+$P(^PSRX(BPCRXIEN,0),"^",15)
 ...I BPCSTAT=0 S BGUSUB(1)=BPCVMIEN D FIELDS^BGULIST
 Q
RAD ;
 I '$D(BGUDRIVR) D  Q
 .S BGUDRIVR="RAD^BPCSC",BGUCRFS="",BPCPIEN=BGUBEGIN
 .S BPCOPT=$P(BGUEND,"`",1),BPCSDATE=$P(BGUEND,"`",2)
 .S BPCEDATE=$P(BGUEND,"`",3),BPCLIM=BGUMAX,BGUMAX=32000
 .S (BGUBEGIN,BGUEND)=""
 Q:BPCPIEN=""
 S:BPCOPT=2 BPCLIM=9999999
 S BPCC=0,BPCX=0 F  S BPCX=$O(^AUPNVSIT("AA",BPCPIEN,BPCX)) Q:BPCX=""!(BPCC=BPCLIM)  D
 .S BPCVIEN="" F  S BPCVIEN=$O(^AUPNVSIT("AA",BPCPIEN,BPCX,BPCVIEN)) Q:BPCVIEN=""!(BPCC=BPCLIM)  D
 ..I BPCOPT=3,'$D(^AUPNVLAB("AD",BPCVIEN)) Q
 ..S BPCY=^AUPNVSIT(BPCVIEN,0),BPCVDT=$P(BPCY,U,1),BPCCKD=$P(BPCVDT,".",1)
 ..I BPCSDATE'="",BPCEDATE'="",((BPCCKD<BPCSDATE)!(BPCCKD>BPCEDATE)) Q
 ..S BPCVMIEN=0,BPCC=BPCC+1 F  S BPCVMIEN=$O(^AUPNVRAD("AD",BPCVIEN,BPCVMIEN)) Q:BPCVMIEN=""  D
 ...S BPCSTAT=0
 ...I $D(^PSRX("APCC",BPCVMIEN)) D
 ....S BPCRXIEN=$O(^PSRX("APCC",BPCVMIEN,"")) Q:BPCRXIEN=""
 ....S BPCCK=$O(^PSRX("APCC",BPCVMIEN,BPCRXIEN,""))
 ....I BPCCK'="" S BPCSTAT=-1 Q
 ....S BPCSTAT=+$P(^PSRX(BPCRXIEN,0),"^",15)
 ...I BPCSTAT=0 S BGUSUB(1)=BPCVMIEN D FIELDS^BGULIST
 Q
EDP ;
 I '$D(BGUDRIVR) D  Q
 .S BGUDRIVR="MEDS^BPCSC",BGUCRFS="",BPCPIEN=BGUBEGIN
 .S BPCOPT=$P(BGUEND,"`",1),BPCSDATE=$P(BGUEND,"`",2)
 .S BPCEDATE=$P(BGUEND,"`",3),BPCLIM=BGUMAX,BGUMAX=32000
 .S (BGUBEGIN,BGUEND)=""
 Q:BPCPIEN=""
 S:BPCOPT=2 BPCLIM=9999999
 S BPCC=0,BPCX=0 F  S BPCX=$O(^AUPNVSIT("AA",BPCPIEN,BPCX)) Q:BPCX=""!(BPCC=BPCLIM)  D
 .S BPCVIEN="" F  S BPCVIEN=$O(^AUPNVSIT("AA",BPCPIEN,BPCX,BPCVIEN)) Q:BPCVIEN=""!(BPCC=BPCLIM)  D
 ..I BPCOPT=3,'$D(^AUPNVLAB("AD",BPCVIEN)) Q
 ..S BPCY=^AUPNVSIT(BPCVIEN,0),BPCVDT=$P(BPCY,U,1),BPCCKD=$P(BPCVDT,".",1)
 ..I BPCSDATE'="",BPCEDATE'="",((BPCCKD<BPCSDATE)!(BPCCKD>BPCEDATE)) Q
 ..S BPCVMIEN=0,BPCC=BPCC+1 F  S BPCVMIEN=$O(^AUPNVMED("AD",BPCVIEN,BPCVMIEN)) Q:BPCVMIEN=""  D
 ...S BPCSTAT=0
 ...I $D(^PSRX("APCC",BPCVMIEN)) D
 ....S BPCRXIEN=$O(^PSRX("APCC",BPCVMIEN,"")) Q:BPCRXIEN=""
 ....S BPCCK=$O(^PSRX("APCC",BPCVMIEN,BPCRXIEN,""))
 ....I BPCCK'="" S BPCSTAT=-1 Q
 ....S BPCSTAT=+$P(^PSRX(BPCRXIEN,0),"^",15)
 ...I BPCSTAT=0 S BGUSUB(1)=BPCVMIEN D FIELDS^BGULIST
 Q
XXXX ;
 I '$D(BGUDRIVR) D  Q
 .S BGUDRIVR="MEDS^BPCSC",BGUCRFS="",BPCPIEN=BGUBEGIN
 .S BPCOPT=$P(BGUEND,"`",1),BPCSDATE=$P(BGUEND,"`",2)
 .S BPCEDATE=$P(BGUEND,"`",3),BPCLIM=BGUMAX,BGUMAX=32000
 .S (BGUBEGIN,BGUEND)=""
 Q:BPCPIEN=""
 S:BPCOPT=2 BPCLIM=9999999
 S BPCC=0,BPCX=0 F  S BPCX=$O(^AUPNVSIT("AA",BPCPIEN,BPCX)) Q:BPCX=""!(BPCC=BPCLIM)  D
 .S BPCVIEN="" F  S BPCVIEN=$O(^AUPNVSIT("AA",BPCPIEN,BPCX,BPCVIEN)) Q:BPCVIEN=""!(BPCC=BPCLIM)  D
 ..I BPCOPT=3,'$D(^AUPNVLAB("AD",BPCVIEN)) Q
 ..S BPCY=^AUPNVSIT(BPCVIEN,0),BPCVDT=$P(BPCY,U,1),BPCCKD=$P(BPCVDT,".",1)
 ..I BPCSDATE'="",BPCEDATE'="",((BPCCKD<BPCSDATE)!(BPCCKD>BPCEDATE)) Q
 ..S BPCVMIEN=0,BPCC=BPCC+1 F  S BPCVMIEN=$O(^AUPNVMED("AD",BPCVIEN,BPCVMIEN)) Q:BPCVMIEN=""  D
 ...S BPCSTAT=0
 ...I $D(^PSRX("APCC",BPCVMIEN)) D
 ....S BPCRXIEN=$O(^PSRX("APCC",BPCVMIEN,"")) Q:BPCRXIEN=""
 ....S BPCCK=$O(^PSRX("APCC",BPCVMIEN,BPCRXIEN,""))
 ....I BPCCK'="" S BPCSTAT=-1 Q
 ....S BPCSTAT=+$P(^PSRX(BPCRXIEN,0),"^",15)
 ...I BPCSTAT=0 S BGUSUB(1)=BPCVMIEN D FIELDS^BGULIST
 Q