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

BPCLRML.m

Go to the documentation of this file.
BPCLRML ; IHS/OIT/MJL - GUI GET MY LABS FOR DATE RANGE ;
 ;;1.5;BPC;;MAY 26, 2005
GETMLDSP(BGUARRAY,BPCPHY,BPCSDATE,BPCEDATE) ;EP REMOTE PROC: BPC GETMYLABS
 ;EP FOR REMOTE PROCEDURE CALL IS GETMLDSP
TEST S JOB=$J,BPCGUI=1,BPCCTR=1
 K ^XTMP("BPCML",JOB)
 S XWBWRAP=1,BGUARRAY="^XTMP(""BPCML"","_$J_")"
 I 'BPCSDATE S ^XTMP("BPCML",JOB,1)=-1,^XTMP("BPCML",JOB,2)="STARTING DATE NOT DEFINED!" D KILL Q
 I 'BPCEDATE S ^XTMP("BPCML",JOB,1)=-1,^XTMP("BPCML",JOB,2)="ENDING DATE NOT DEFINED!" D KILL Q
 S X1=BPCEDATE,X2=BPCSDATE D ^%DTC I X>31 S ^XTMP("BPCML",JOB,1)=-1,^XTMP("BPCML",JOB,2)="Date range can not exceed one month (31 days)!" D KILL Q
 I '$D(^VA(200,"B",BPCPHY)) S ^XTMP("BPCML",JOB,1)=-1,^XTMP("BPCML",JOB,2)="PROVIDER NAME NOT FOUND!" D KILL Q
 K ^XTMP("BPCML",JOB)
 S BPCSD=BPCSDATE-.0001
 S BPCED=BPCEDATE+.9999
RUN1 F  S BPCSD=$O(^LRO(69,BPCSD)) Q:BPCSD=""!(BPCSD>BPCED)  D
 .S BPCPNM="" F  S BPCPNM=$O(^LRO(69,BPCSD,1,"AP",BPCPHY,BPCPNM)) Q:BPCPNM=""  D
 ..S BPCLRDFN="",BPCLRDFN=$O(^LRO(69,BPCSD,1,"AP",BPCPHY,BPCPNM,BPCLRDFN)) Q:BPCLRDFN=""
 ..S BPCDFN=$P($G(^LR(BPCLRDFN,0)),U,3)
 ..S ^XTMP("BPCML",JOB,"P",BPCPNM)=BPCDFN
 S BPCPNM="",BPCPNM=$O(^XTMP("BPCML",JOB,"P",BPCPNM)) I BPCPNM="" S ^XTMP("BPCML",JOB,1)=2,^XTMP("BPCML",JOB,2)="No Patient Lab Data Found For This User For This Date Range" D KILL Q
RUN S BPCCTR=1
 S ^XTMP("BPCML",JOB,BPCCTR)="The following Patients have Lab Data Listed Below:",BPCCTR=BPCCTR+1
 S BPCPNM="" F  S BPCPNM=$O(^XTMP("BPCML",JOB,"P",BPCPNM)) Q:BPCPNM=""  D
 .S DFN=^XTMP("BPCML",JOB,"P",BPCPNM) D PID^VADPT6
 .S ^XTMP("BPCML",JOB,BPCCTR)=BPCPNM_"                               "
 .S ^XTMP("BPCML",JOB,BPCCTR)=$E(^XTMP("BPCML",JOB,BPCCTR),1,35)_$G(HRCN)_"                               "
 .S BPCDOB=$P($G(^DPT(DFN,0)),U,3),BPCSEX=$P($G(^(0)),U,2)
 .S:+BPCDOB BPCDOB=$$FMTE^XLFDT(BPCDOB,"5M")
 .S ^XTMP("BPCML",JOB,BPCCTR)=$E(^XTMP("BPCML",JOB,BPCCTR),1,45)_$G(BPCDOB)_"                               "
 .S ^XTMP("BPCML",JOB,BPCCTR)=$E(^XTMP("BPCML",JOB,BPCCTR),1,58)_$G(BPCSEX)_"          "
 .S ^XTMP("BPCML",JOB,BPCCTR)=$E(^XTMP("BPCML",JOB,BPCCTR),1,63)_$G(VA("PID"))
 .S BPCCTR=BPCCTR+1
 S ^XTMP("BPCML",JOB,BPCCTR)="#################################################################################",BPCCTR=BPCCTR+1
 S BPCEDATE=BPCEDATE+1
 S BPCPNM="" F  S BPCPNM=$O(^XTMP("BPCML",JOB,"P",BPCPNM)) Q:BPCPNM=""  D
 .S BPCDFN=^XTMP("BPCML",JOB,"P",BPCPNM)
 .D INTERIM^BPC7OGM(BGUARRAY,BPCDFN,BPCEDATE,BPCSDATE)
 .S ^XTMP("BPCML",JOB,BPCCTR)="#################################################################################",BPCCTR=BPCCTR+1
 .S ^XTMP("BPCML",JOB,BPCCTR)="Patient:  "_BPCPNM,BPCCTR=BPCCTR+1
 .S I=1 F  S I=$O(^TMP("BPC7OGX",JOB,"OUTPUT",I)) Q:+I=0  D
 ..S ^XTMP("BPCML",JOB,BPCCTR)="     "_^TMP("BPC7OGX",JOB,"OUTPUT",I),BPCCTR=BPCCTR+1
 .S ^XTMP("BPCML",JOB,BPCCTR)="#################################################################################",BPCCTR=BPCCTR+1
 S ^XTMP("BPCML",JOB,.5)=BPCCTR-1
 D KILL
 Q
 ;
KILL ;
 K BPCCTR,BPCDFN,BPCED,BPCEDATE,BPCGUI,BPCPNM,BPCSD,I,JOB,X1,X2
 Q