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

BPCPC2.m

Go to the documentation of this file.
BPCPC2 ; IHS/OIT/MJL - PATIENT CHART GUI ROUTINES ;
 ;;1.5;BPC;;MAY 26, 2005
 ;
AGENTS(RESULT,BPCAGENT) ;EP CALL FROM REMOTE PROC: BPC GETAGENTS
 S U="^",XWBWRAP=1,BPCSUB=$J K ^BPCRES(BPCSUB),^BPCTMP(BPCSUB)
 S RESULT="^BPCRES("_BPCSUB_")",BPCAGENT=$G(BPCAGENT),BPCCTR=0,BPCLIST=0
 I BPCAGENT="" S ^BPCRES(BPCSUB,0)=-1,^BPCRES(BPCSUB,1)="No Agent Sent!" D KILL Q
 I $E(BPCAGENT)="?" S BPCLIST=1,BPCAGENT=$P(BPCAGENT,"?",2) I BPCAGENT="" S ^BPCRES(BPCSUB,0)=-1,^BPCRES(BPCSUB,1)=""""_"?"_""""_" Cannot Be Entered By Itself" D KILL Q
 D:'BPCLIST GETAG1
 D:BPCLIST GETAG2
 D GETRES,KILL
 Q
GETAG1 ;
 I $D(^GMRD(120.82,"B",BPCAGENT)) D  Q:BPCIEN'=""
 .S BPCIEN=$O(^GMRD(120.82,"B",BPCAGENT,""))
 .S:BPCIEN'="" BPCDTA=^GMRD(120.82,BPCIEN,0),BPCTYPE=$P(BPCDTA,U,2)
 .S:BPCIEN'="" ^BPCTMP(BPCSUB,BPCAGENT)=BPCAGENT_U_BPCIEN_"^GMRD(120.82,^GMR ALLERGIES^B"_U_BPCTYPE
 I $D(^PS(50.416,"P",BPCAGENT)) D  Q:BPCIEN'=""
 .S BPCIEN=$O(^PS(50.416,"P",BPCAGENT,""))
 .S:BPCIEN'="" ^BPCTMP(BPCSUB,BPCAGENT)=BPCAGENT_U_BPCIEN_"^PS(50.416,^DRUG INGREDIENTS^P^D"
 I $D(^PS(50.605,"C",BPCAGENT)) D  Q:BPCIEN'=""
 .S BPCIEN=$O(^PS(50.605,"C",BPCAGENT,""))
 .S:BPCIEN'="" ^BPCTMP(BPCSUB,BPCAGENT)=BPCAGENT_U_BPCIEN_"^PS(50.605,^VA DRUG CLASS^C^D"
 I $D(^PSNDF("B",BPCAGENT)) D  Q:BPCIEN'=""
 .S BPCIEN=$O(^PSNDF("B",BPCAGENT,""))
 .S:BPCIEN'="" ^BPCTMP(BPCSUB,BPCAGENT)=BPCAGENT_U_BPCIEN_"^PSNDF(^NATIONAL DRUG^B^D"
 I $D(^PSDRUG("B",BPCAGENT)) D  Q:BPCIEN'=""
 .S BPCIEN=$O(^PSDRUG("B",BPCAGENT,""))
 .S:BPCIEN'="" ^BPCTMP(BPCSUB,BPCAGENT)=BPCAGENT_U_BPCIEN_"^PSDRUG(^DRUG^B^D"
 Q
GETAG2 ;
 S BPCX=$O(^GMRD(120.82,"B",BPCAGENT),-1),BPCFLAG=0
 F  S BPCX=$O(^GMRD(120.82,"B",BPCX)) Q:BPCX=""  D  Q:BPCFLAG
 .I $E(BPCX,1,$L(BPCAGENT))'=BPCAGENT S BPCFLAG=1 Q
 .I '$D(^BPCTMP(BPCSUB,BPCX)) D
 ..S BPCIEN=$O(^GMRD(120.82,"B",BPCX,""))
 ..S:BPCIEN'="" BPCDTA=^GMRD(120.82,BPCIEN,0),BPCTYPE=$P(BPCDTA,U,2)
 ..S:BPCIEN'="" ^BPCTMP(BPCSUB,BPCX)=BPCX_U_BPCIEN_"^GMRD(120.82,^GMR ALLERGIES^B^"_BPCTYPE
 S BPCX=$O(^PS(50.416,"P",BPCAGENT),-1),BPCFLAG=0
 F  S BPCX=$O(^PS(50.416,"P",BPCX)) Q:BPCX=""  D  Q:BPCFLAG
 .I $E(BPCX,1,$L(BPCAGENT))'=BPCAGENT S BPCFLAG=1 Q
 .I '$D(^BPCTMP(BPCSUB,BPCX)) D
 ..S BPCIEN=$O(^PS(50.416,"P",BPCX,""))
 ..S:BPCIEN'="" ^BPCTMP(BPCSUB,BPCX)=BPCX_U_BPCIEN_"^PS(50.416,^DRUG INGREDIENTS^P^D"
 S BPCX=$O(^PS(50.605,"C",BPCAGENT),-1),BPCFLAG=0
 F  S BPCX=$O(^PS(50.605,"C",BPCX)) Q:BPCX=""  D  Q:BPCFLAG
 .I $E(BPCX,1,$L(BPCAGENT))'=BPCAGENT S BPCFLAG=1 Q
 .I '$D(^BPCTMP(BPCSUB,BPCX)) D
 ..S BPCIEN=$O(^PS(50.605,"C",BPCX,""))
 ..S:BPCIEN'="" ^BPCTMP(BPCSUB,BPCX)=BPCX_U_BPCIEN_"^PS(50.605,^VA DRUG CLASS^C^D"
 S BPCX=$O(^PSNDF("B",BPCAGENT),-1),BPCFLAG=0
 F  S BPCX=$O(^PSNDF("B",BPCX)) Q:BPCX=""  D  Q:BPCFLAG
 .I $E(BPCX,1,$L(BPCAGENT))'=BPCAGENT S BPCFLAG=1 Q
 .I '$D(^BPCTMP(BPCSUB,BPCX)) D
 ..S BPCIEN=$O(^PSNDF("B",BPCX,""))
 ..S:BPCIEN'="" ^BPCTMP(BPCSUB,BPCX)=BPCX_U_BPCIEN_"^PSNDF(^NATIONAL DRUG^B"
 S BPCX=$O(^PSDRUG("B",BPCAGENT),-1),BPCFLAG=0
 F  S BPCX=$O(^PSDRUG("B",BPCX)) Q:BPCX=""  D  Q:BPCFLAG
 .I $E(BPCX,1,$L(BPCAGENT))'=BPCAGENT S BPCFLAG=1 Q
 .I '$D(^BPCTMP(BPCSUB,BPCX)) D
 ..S BPCIEN=$O(^PSDRUG("B",BPCX,""))
 ..S:BPCIEN'="" ^BPCTMP(BPCSUB,BPCX)=BPCX_U_BPCIEN_"^PSDRUG(^DRUG^B^D"
 Q
GETRES ;
 I '$D(^BPCTMP(BPCSUB)) S ^BPCRES(BPCSUB,0)=1,^BPCRES(BPCSUB,1)="NO MATCH" Q
 S BPCX="" F  S BPCX=$O(^BPCTMP(BPCSUB,BPCX)) Q:BPCX=""  D
 .S BPCCTR=BPCCTR+1
 .S ^BPCRES(BPCSUB,BPCCTR)=^BPCTMP(BPCSUB,BPCX)
 S ^BPCRES(BPCSUB,0)=BPCCTR
 K ^BPCTMP(BPCSUB)
 Q
 ;
RELLIST(RESULT,BPCX,BPCMAX,BPCMORE,BPCPARAM) ;EP CALL FROM REMOTE PROC: BPC GETRELIGIONS
 S U="^",XWBWRAP=1,BPCSUB=$J K ^BGURES(BPCSUB),RESULT
 S RESULT="^BGURES("_BPCSUB_")"
 S BPCX=$G(BPCX),BPCMAX=$G(BPCMAX),BPCMORE=$G(BPCMORE),BPCPARAM=$G(BPCPARAM),BPCLEN=$L(BPCX),BPCCTR=0,BPCFLAG=0
 S BPCN="" S:BPCX'="" BPCN=$O(^DIC(13,"B",BPCX),-1)
 S:'BPCMAX BPCMAX=50
 I BPCMORE'="" D MORE I BPCFLAG D KILL Q
 D GETREL,KILL
 Q
KILL ;
 K BPCAGENT,BPCCTR,BPCDTA,BPCFLAG,BPCIEN,BPCLEN,BPCLIST,BPCMAX,BPCMORE,BPCN,BPCPARAM,BPCSUB,BPCTYPE,BPCX
 Q
 ;
MORE ;
 S BPCN=$P(BPCMORE,"|",1),BPCIEN=$P(BPCMORE,"|",2),BPCCTR=BPCCTR+1
 S ^BGURES(BPCSUB,BPCCTR)=BPCN_U_BPCIEN
 I BPCCTR=BPCMAX S BPCFLAG=1
 Q
GETREL ;
 F  S BPCN=$O(^DIC(13,"B",BPCN)) Q:BPCN=""  D  Q:BPCFLAG
 .I BPCX'="",$E(BPCN,1,BPCLEN)'=BPCX S BPCFLAG=1 Q
 .S BPCIEN="" F  S BPCIEN=$O(^DIC(13,"B",BPCN,BPCIEN)) Q:BPCIEN=""  D  Q:BPCFLAG
 ..I BPCCTR=BPCMAX D  Q
 ...S BPCCTR=BPCCTR+1,^BGURES(BPCSUB,BPCCTR)="..MORE"_U_BPCN_"|"_BPCIEN
 ...S BPCFLAG=1
 ..S BPCCTR=BPCCTR+1,^BGURES(BPCSUB,BPCCTR)=BPCN_U_BPCIEN
 S ^BGURES(BPCSUB,0)=BPCCTR
 Q