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

BPCAPPT.m

Go to the documentation of this file.
BPCAPPT ; IHS/OIT/MJL - GUI APPT LIST ;
 ;;1.5;BPC;;MAY 26, 2005
 ;MODIFIED FOR IHS GUI CHART FJE 5/1/00 FROM BPC2D RTN
 ;
GETAPPT(BGUARRAY,BPCPIEN,BPCSDATE,BPCEDATE) ;EP REMOTE PROC: BPC GET SD APPT DATA
 D ENA,KILL Q
 ;
ENA ;
 ;S BPCPIEN=25241,BPCSDATE="06/11/00",BPCEDATE="06/11/01"
 D ^XBKVAR
 S BPCCVD="S:Y]"""" Y=+Y,Y=$E(Y,4,5)_""/""_$S($E(Y,6,7):$E(Y,6,7)_""/"",1:"""")_$E(Y,2,3)"
 S BPCGUI=1,X="",XWBWRAP=1 K ^TMP($J)
 S BGUARRAY="^TMP("_$J_")"
 I $G(BPCPIEN)="" S ^TMP($J,1)=-1,^TMP($J,2)="PATIENT IEN NOT SENT!" Q
 I $G(BPCSDATE)="" S ^TMP($J,1)=-1,^TMP($J,2)="STARTING DATE NOT SENT!" Q
 I $G(BPCEDATE)="" S ^TMP($J,1)=-1,^TMP($J,2)="ENDING DATE NOT SENT!" Q
 S CNTR=2
 S BPCPAT=BPCPIEN
 S:BPCEDATE="" BPCEDATE="T"
 D DT^DILF("",BPCSDATE,.BPCSDAT)
 I BPCSDAT=-1 D
 .S BPCSDATE="1/1/1980"
 .D DT^DILF("",BPCSDATE,.BPCSDAT)
 D DT^DILF("",BPCEDATE,.BPCEDAT)
 I BPCEDAT=-1 D
 .S BPCEDATE="T"
 .D DT^DILF("",BPCEDATE,.BPCEDAT)
 I '$D(^DPT(BPCPAT,"S")) S ^TMP($J,1)=1,^TMP($J,2)="No Appointment Data Available" Q
 D:$O(^DPT(BPCPAT,"S",DT)) PEND
 D:$O(^DPT(BPCPAT,"S",0)) PAST
 I CNTR=2 S ^TMP($J,1)=1,^TMP($J,2)="No Data Available" Q
 S ^TMP($J,1)=CNTR-2
 Q
 ;
PAST ;
 S BPCN=0 F  S BPCN=$O(^DPT(BPCPAT,"S",BPCN)) Q:'BPCN  D
 .Q:BPCN<BPCSDAT
 .Q:BPCN>(DT-.01)
 .Q:BPCN>(BPCEDAT+.24)
 .S BPC(9999999-BPCN)=""
 S BPCIDT=0,BPCIDT=$O(BPC(BPCIDT)) I BPCIDT S ^TMP($J,CNTR)="Past:",CNTR=CNTR+1
 S BPCIDT=0 F  S BPCIDT=$O(BPC(BPCIDT)) Q:'BPCIDT  D
 .S BPCVDT=9999999-BPCIDT
 .S BPCN=^DPT(BPCPAT,"S",BPCVDT,0)
 .S Y=BPCVDT\1 X BPCCVD S BPCDAT=Y
 .S BPCVT=$E($P(BPCVDT,".",2)_"000",1,4) S:BPCVT>1300 BPCVT=BPCVT-1200 S:$L(BPCVT)=3 BPCVT=" "_BPCVT S:$E(BPCVT)="0" BPCVT=" "_$E(BPCVT,2,4) S BPCVT=$E(BPCVT,1,2)_":"_$E(BPCVT,3,4)
 .S BPCTST="" F BPCI=3,4,5 S BPCJ=$P(BPCN,U,BPCI) I BPCJ S:BPCTST]"" BPCTST=BPCTST_"," S BPCTST=BPCTST_$P("^^LAB^XRAY^EKG^",U,BPCI)
 .S BPCCP=+BPCN,BPCCN=$P($G(^SC(BPCCP,0)),U,1)
 .S BPCTST="",BPCVNT=""
 .S BPCVN=0 F BPCQ=0:0 S BPCVN=$O(^SC(BPCCP,"S",BPCVDT,1,BPCVN)) Q:'BPCVN  I +^(BPCVN,0)=BPCPAT S BPCTST=$P(^(0),U,2),BPCVNT=$P(^(0),U,4) S:BPCTST BPCTST=BPCTST_" min."
 .F BPCI=3,4,5 S BPCJ=$P(BPCN,U,BPCI) I BPCJ S:BPCTST]"" BPCTST=BPCTST_"," S BPCTST=BPCTST_$P("^^LAB^XRAY^EKG^",U,BPCI)
 .S ^TMP($J,CNTR)=BPCDAT_"^"_BPCVT_"^"_BPCCN S:BPCTST]"" BPCTST="<"_BPCTST_">" S ^TMP($J,CNTR)=^TMP($J,CNTR)_"^"_BPCTST
 .S ^TMP($J,CNTR)=^TMP($J,CNTR)_"^"_BPCVNT
 .S CNTR=CNTR+1
 Q
 ;
PEND ;
 S CNTR=CNTR+1,^TMP($J,CNTR)="Pending:",CNTR=CNTR+1
 S BPCDAT=0,BPCVDT=DT-.01 F BPCQ=0:0 S BPCVDT=$O(^DPT(BPCPAT,"S",BPCVDT)) Q:'BPCVDT  D
 .S BPCN=^DPT(BPCPAT,"S",BPCVDT,0)
 .S Y=BPCVDT\1 X BPCCVD S BPCDAT=Y
 .S BPCVT=$E($P(BPCVDT,".",2)_"000",1,4) S:BPCVT>1300 BPCVT=BPCVT-1200 S:$L(BPCVT)=3 BPCVT=" "_BPCVT S:$E(BPCVT)="0" BPCVT=" "_$E(BPCVT,2,4) S BPCVT=$E(BPCVT,1,2)_":"_$E(BPCVT,3,4)
 .S BPCTST="" F BPCI=3,4,5 S BPCJ=$P(BPCN,U,BPCI) I BPCJ S:BPCTST]"" BPCTST=BPCTST_"," S BPCTST=BPCTST_$P("^^LAB^XRAY^EKG^",U,BPCI)
 .S BPCCP=+BPCN,BPCCN=$P($G(^SC(BPCCP,0)),U,1)
 .S BPCTST="",BPCVNT=""
 .S BPCVN=0 F BPCQ=0:0 S BPCVN=$O(^SC(BPCCP,"S",BPCVDT,1,BPCVN)) Q:'BPCVN  I +^(BPCVN,0)=BPCPAT S BPCTST=$P(^(0),U,2),BPCVNT=$P(^(0),U,4) S:BPCTST BPCTST=BPCTST_" min."
 .F BPCI=3,4,5 S BPCJ=$P(BPCN,U,BPCI) I BPCJ S:BPCTST]"" BPCTST=BPCTST_"," S BPCTST=BPCTST_$P("^^LAB^XRAY^EKG^",U,BPCI)
 .S ^TMP($J,CNTR)=BPCDAT_"^"_BPCVT_"^"_BPCCN S:BPCTST]"" BPCTST="<"_BPCTST_">" S ^TMP($J,CNTR)=^TMP($J,CNTR)_"^"_BPCTST
 .S ^TMP($J,CNTR)=^TMP($J,CNTR)_"^"_BPCVNT
 .S CNTR=CNTR+1
 Q
KILL ;
 K BPC,BPCCN,BPCCP,BPCCVD,BPCDAT,BPCEDATE,BPCGUI,BPCIDT,BPCJ,BPCN,BPCPAT,BPCSDATE,BPCTST,BPCVDT,BPCVN,BPCVNT,BPCVT,CNTR,X,Y
 Q