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

BPCRC4.m

Go to the documentation of this file.
BPCRC4 ; IHS/OIT/MJL - FHL-12/5/96 - REFERRED CARE GUI ROUTINES ;
 ;;1.5;BPC;;MAY 26, 2005
PXLIST(BPCRES,BPCX,BPCMAX,BPCMORE,BPCPARAM) ;EP CALL FROM REMOTE PROC: BPC GETCPTLIST
 ;
 S BPCGUI=1
EN ;
 S U="^",XWBWRAP=1,BPCCTR=0,BPCSUB=$J,BPCC="",BPCMORE=$G(BPCMORE),BPCGUI=$G(BPCGUI),BPCMAX=$G(BPCMAX),BPCX=$G(BPCX),BPCPARAM=$G(BPCPARAM),BPCLEN=$L(BPCX)
 S BPCRES="^BPCRES("_BPCSUB_")",BPCN=""
 S:'BPCMAX BPCMAX=$S(BPCGUI:50,1:1E10) ;
 K ^BPCRES(BPCSUB)
 S BPCSAV=BPCX
 I BPCMORE'="" D MORE,KILL Q
 I BPCX'="" I $D(^ICPT("C",BPCX)) S BPCIEN="" D GETKWD,KILL Q
 I BPCX?.U1.N D GETNUMS,KILL Q
 I BPCX="" D GETCPTBA,KILL Q
 S BPCN=$O(^ICPT("C",BPCX),-1) D GETCPT,KILL
 Q
KILL ;
 K BPCCDE,BPCX,BPCMAX,BPCMORE,BPCPARAM,BPCCTR,BPCC,BPCGUI,BPCLEN,BPCN,BPCSAV,BPCIEN,BPCFLAG,BPCDTA,BPCIDX,BPCSUB,BPCNO,BPCSB
 Q
GETKWD ;
 S BPCFLAG=0,BPCIDX="C" F  S BPCIEN=$O(^ICPT("C",BPCX,BPCIEN)) Q:BPCIEN=""  D GETDATA Q:BPCFLAG
 S ^BPCRES(BPCSUB,0)=BPCCTR
 Q
GETDATA ;
 S BPCDTA=$G(^ICPT(BPCIEN,0))
 I BPCCTR=BPCMAX D SETMORE S BPCFLAG=1 Q
 S BPCCTR=BPCCTR+1,^BPCRES(BPCSUB,BPCCTR)=$P(BPCDTA,U,1)_U_$P(BPCDTA,U,2)_U_BPCIEN
 Q
GETNUMS ;
 S BPCFLAG=0,BPCN=BPCX_" ",BPCIDX="BA" I '$D(^ICPT("BA",BPCN)) D GETNUMS2 Q
 S BPCIEN=$O(^ICPT("BA",BPCN,"")) D:BPCIEN'="" GETDATA
 S ^BPCRES(BPCSUB,0)=BPCCTR
 Q
GETNUMS2 ;
 S:BPCX'="" BPCN=BPCX_" ",BPCN=$O(^ICPT("BA",BPCN),-1) F  S BPCN=$O(^ICPT("BA",BPCN)) Q:BPCN=""  D GETNUMS3 Q:BPCFLAG
 S ^BPCRES(BPCSUB,0)=BPCCTR
 Q
GETNUMS3 ;
 S BPCX=BPCSAV
 I BPCX'="",$E(BPCN,1,BPCLEN)'=BPCX S BPCFLAG=1 Q
 S BPCIEN="" F  S BPCIEN=$O(^ICPT("BA",BPCN,BPCIEN)) Q:BPCIEN=""  D GETDATA Q:BPCFLAG
 Q
GETCPTBA ;
 S BPCIDX="BA",BPCN=BPCX,BPCFLAG=0 D GETNUMS2
 Q
GETCPT ;
 S BPCIDX="C",BPCFLAG=0 F  S BPCN=$O(^ICPT("C",BPCN)) Q:BPCN=""  D GETCPT1 Q:BPCFLAG
 I 'BPCFLAG S BPCIDX="BA",BPCN=$O(^ICPT("BA",BPCX),-1) F  S BPCN=$O(^ICPT("BA",BPCN)) Q:BPCN=""  D GETCPT2 Q:BPCFLAG
 S ^BPCRES(BPCSUB,0)=BPCCTR
 Q
GETCPT1 ;
 S BPCX=BPCSAV
 I BPCX'="",$E(BPCN,1,BPCLEN)'=BPCX S BPCFLAG=1 Q
 S BPCIEN="" F  S BPCIEN=$O(^ICPT("C",BPCN,BPCIEN)) Q:BPCIEN=""  D GETDATA Q:BPCFLAG
 Q
GETCPT2 ;
 S BPCX=BPCSAV
 I BPCX'="",$E(BPCN,1,BPCLEN)'=BPCX S BPCFLAG=1 Q
 S BPCIEN="" F  S BPCIEN=$O(^ICPT("BA",BPCN,BPCIEN)) Q:BPCIEN=""  D GETDATA Q:BPCFLAG
 Q
GETCPT3 ;
 S BPCFLAG=0 F  S BPCIEN=$O(^ICPT("C",BPCN,BPCIEN)) Q:BPCIEN=""  D GETDATA Q:BPCFLAG
 I BPCFLAG S ^BPCRES(BPCSUB,0)=BPCCTR Q
 D GETCPT
 Q
GETCPT4 ;
 S BPCFLAG=0 F  S BPCIEN=$O(^ICPT("BA",BPCN,BPCIEN)) Q:BPCIEN=""  D GETDATA Q:BPCFLAG
 I BPCFLAG S ^BPCRES(BPCSUB,0)=BPCCTR Q
 F  S BPCN=$O(^ICPT("BA",BPCN)) Q:BPCN=""  D GETCPT2 Q:BPCFLAG
 S ^BPCRES(BPCSUB,0)=BPCCTR
 Q
SETMORE ;
 S BPCCTR=BPCCTR+1,^BPCRES(BPCSUB,BPCCTR)="..MORE"_U_BPCIEN_"|"_$P(BPCDTA,U,1)_"|"_$P(BPCDTA,U,2)_"|"_BPCIDX_"|"_BPCN
 Q
MORE ;
 S BPCCTR=BPCCTR+1,^BPCRES(BPCSUB,BPCCTR)=$P(BPCMORE,"|",2)_U_$P(BPCMORE,"|",3)_U_$P(BPCMORE,"|",1)
 I BPCX="" S BPCIDX="BA",BPCN=$P(BPCMORE,"|",2)_" ",BPCFLAG=0 D GETNUMS2 Q
 I BPCX'="" I $D(^ICPT("C",BPCX)) S BPCIEN=$P(BPCMORE,"|",1),BPCIDX="C" D GETKWD,KILL Q
 I BPCX?.U1.N S BPCX="",BPCN=$P(BPCMORE,"|",2)_" ",BPCFLAG=0,BPCIDX="BA" D GETNUMS2,KILL Q
 S BPCIDX=$P(BPCMORE,"|",4),BPCN=$P(BPCMORE,"|",5),BPCIEN=$P(BPCMORE,"|",1) D:BPCIDX="C" GETCPT3 D:BPCIDX="BA" GETCPT4
 D KILL
 Q
DXLIST(BPCRES,BPCX,BPCMAX,BPCMORE,BPCPARAM) ;EP CALL FROM REMOTE PROC: BPC GETDXLIST
 S BPCGUI=1
EN1 ;
 S U="^",XWBWRAP=1,BPCCTR=0,BPCSUB=$J,BPCC="",BPCMORE=$G(BPCMORE),BPCGUI=$G(BPCGUI),BPCMAX=$G(BPCMAX),BPCX=$G(BPCX),BPCPARAM=$G(BPCPARAM),BPCLEN=$L(BPCX)
 S BPCRES="^BPCRES("_BPCSUB_")",BPCN=""
 S:'BPCMAX BPCMAX=$S(BPCGUI:50,1:1E10) ;
 K ^BPCRES(BPCSUB)
 K:BPCMORE="" ^BPCTMP(BPCSUB)
 S BPCSAV=BPCX
 I BPCMORE'="" D DXMORE,KILL Q
 I BPCX'="" I $D(^AICDKWLC(1,1,"B",BPCX)) D KWLC S BPCCTR=0 D SETRES,KILL Q
 I BPCX'="" I $D(^ICD9("AIHS",BPCX)) S BPCIEN="" D GETDKWD S BPCCTR=0 D SETRES,KILL Q
 ;I BPCX?.N.1"."1N.N!(BPCX="") D GETICD,KILL Q
 I BPCX?.N.1".".N!(BPCX="") D GETICD,KILL Q
 S BPCN=$O(^ICD9("D",BPCX),-1) D GETICD2 S BPCCTR=0 D SETRES,KILL
 Q
DXMORE ;
 I BPCX?.N.1".".N!(BPCX="") D DXMORE1 S ^BPCRES(BPCSUB,0)=BPCCTR Q
 S BPCIEN=$P(BPCMORE,"|",1),BPCCDE=+$P(BPCMORE,"|",2),BPCIDX=$P(BPCMORE,"|",4),BPCN=$P(BPCMORE,"|",5),BPCFLAG=0 D GETDX I BPCFLAG S BPCRES(BPCSUB,0)=BPCCTR Q
 D SETRES
 Q
DXMORE1 ;
 S BPCIEN=$P(BPCMORE,"|",1),BPCN=$P(BPCMORE,"|",5),BPCFLAG=0 D GETDX Q:BPCFLAG
 F  S BPCIEN=$O(^ICD9("BA",BPCN,BPCIEN)) Q:BPCIEN=""  D GETDX Q:BPCFLAG
 Q:BPCFLAG
 S BPCX="" D GETICD
 Q
KWLC ;
 S BPCNO=$O(^AICDKWLC(1,1,"B",BPCX,"")) Q:BPCNO=""
 S BPCSB=0,BPCFLAG=0 F  S BPCSB=$O(^AICDKWLC(1,1,BPCNO,1,BPCSB)) Q:BPCSB=""  D KWLC1
 S BPCX=BPCSAV
 Q
KWLC1 ;
 S BPCX=$G(^AICDKWLC(1,1,BPCNO,1,BPCSB,0)) Q:BPCX=""
 I $D(^ICD9("AIHS",BPCX)) S BPCIEN="" D GETDKWD Q
 S BPCN=$O(^ICD9("D",BPCX),-1) D GETICD2
 Q
GETDKWD ;
 S BPCFLAG=0,BPCIDX="AIHS",BPCN=BPCX F  S BPCIEN=$O(^ICD9("AIHS",BPCN,BPCIEN)) Q:BPCIEN=""  D GETDX1
 Q
SETRES ;
 S BPCCTR=+$G(BPCCTR),BPCCDE=$G(BPCCDE),BPCFLAG=0 F  S BPCCDE=$O(^BPCTMP(BPCSUB,BPCCDE)) Q:BPCCDE=""  S BPCDTA=^(BPCCDE),BPCIEN=$P(BPCDTA,U,1),BPCN=$P(BPCDTA,U,2),BPCIDX=$P(BPCDTA,U,3) D GETDX Q:BPCFLAG
 S ^BPCRES(BPCSUB,0)=BPCCTR
 Q
GETICD ;
 S BPCIDX="BA",BPCFLAG=0 S:BPCX'="" BPCN=BPCX,BPCN=$O(^ICD9("BA",BPCN),-1) F  S BPCN=$O(^ICD9("BA",BPCN)) Q:BPCN=""  D GETICD1 Q:BPCFLAG
 S ^BPCRES(BPCSUB,0)=BPCCTR
 Q
GETICD1 ;
 S BPCX=BPCSAV
 I BPCX'="",$E(BPCN,1,BPCLEN)'=BPCX S BPCFLAG=1 Q
 S BPCIEN="" F  S BPCIEN=$O(^ICD9("BA",BPCN,BPCIEN)) Q:BPCIEN=""  D GETDX Q:BPCFLAG
 Q
GETICD2 ;
 S BPCIDX="D",BPCFLAG=0
 F  S BPCN=$O(^ICD9("D",BPCN)) Q:BPCN=""  D GETICD3 Q:BPCFLAG
 Q
GETICD3 ;
 S BPCX=BPCSAV
 I BPCX'="",$E(BPCN,1,BPCLEN)'=BPCX S BPCFLAG=1 Q
 S BPCIEN="" F  S BPCIEN=$O(^ICD9("D",BPCN,BPCIEN)) Q:BPCIEN=""  D GETDX1
 Q
GETDX ;
 S BPCDTA=$G(^ICD9(BPCIEN,0)) Q:$E(BPCDTA)="E"
 I BPCCTR=BPCMAX D SETMORDX S BPCFLAG=1 Q
 S BPCCTR=BPCCTR+1,^BPCRES(BPCSUB,BPCCTR)=$P(BPCDTA,U,1)_U_$P(BPCDTA,U,3)_U_BPCIEN
 Q
GETDX1 ;
 S BPCDTA=$G(^ICD9(BPCIEN,0)) Q:$E(BPCDTA)="E"
 S BPCC=$P(BPCDTA,U,1) I $E(BPCC)?1N S BPCC=+BPCC
 S:'$D(^BPCTMP(BPCSUB,BPCC)) BPCCTR=BPCCTR+1,^BPCTMP(BPCSUB,BPCC)=BPCIEN_U_BPCN_U_BPCIDX,^BPCTMP(BPCSUB)=BPCCTR
 Q
SETMORDX ;
 S BPCCTR=BPCCTR+1,^BPCRES(BPCSUB,BPCCTR)="..MORE"_U_BPCIEN_"|"_$P(BPCDTA,U,1)_"|"_$P(BPCDTA,U,3)_"|"_BPCIDX_"|"_BPCN
 Q