PSBOCI ;BIRMINGHAM/TEJ-COVERSHEET IV OVERVIEW REPORT ;Mar 2004
;;3.0;BAR CODE MED ADMIN;**32**;Mar 2004;Build 32
;Per VHA Directive 2004-038 (or future revisions regarding same), this routine should not be modified.
;
; Reference/IA
; File 4/10090
EN ;
N PSBX1X,RESULTS,RESULT,PSBFUTR
S PSBFUTR=$TR(PSBRPT(1),"~","^")
S (PSBOCRIT,PSBXFLG,PSBCFLG,PSBBGX)="" ; srch crit - "A"ctive,"D"C ed,"E"xpired"
S PSBOCRIT="DEA"
S:$P(PSBFUTR,U,11) PSBXFLG=1
S:$P(PSBFUTR,U,12) PSBBGX=PSBBGX_"I"
S:$P(PSBFUTR,U,13) PSBBGX=PSBBGX_"S"
S:$P(PSBFUTR,U,14) PSBBGX=PSBBGX_"A"
I $D(PSBRPT(.2)) I $P(PSBRPT(.2),U,8) S PSBCFLG=1
K PSBSRTBY,PSBCMT,PSBADM,PSBDATA,PSBOUTP,PSBLGD
S PSBSORT=1
D NOW^%DTC S (Y,PSBNOWX)=% D DD^%DT S PSBDTTM=Y
D GETPAR^PSBPAR("ALL","PSB ADMIN BEFORE")
S PSBB4=0 S:RESULTS(0)>0 PSBB4=+RESULTS(0)
D GETPAR^PSBPAR("ALL","PSB ADMIN AFTER")
S PSBAFT=0 S:RESULTS(0)>0 PSBAFT=+RESULTS(0)
K ^XTMP("PSBO",$J,"PSBLIST")
S (PSBPGNUM,PSBLNTOT)=""
K PSBLIST,PSBLIST2
S PSBXDFN=$P(PSBRPT(.1),U,2)
S PSBLIST(PSBXDFN)=""
S (PSBX1X,PSBTOT)=0
F S PSBX1X=$O(PSBLIST(PSBX1X)) Q:+PSBX1X=0 D
.D RPC^PSBCSUTL(.PSBAREA,PSBX1X)
.M PSBDATA=@PSBAREA
.S PSBX2X=1
.S (PSBLIST2("All Other"),PSBLIST2("Infusing"),PSBLIST2("Stopped"),PSBLIST2(" * NO * "))=0
.K PSBBSO
.F S PSBX2X=$O(PSBDATA(PSBX2X)) Q:+PSBX2X=0 D
..S PSBDATA=PSBDATA(PSBX2X)
..I $P(PSBDATA,U)="ORD" K PSBORDN,PSBDRUGN D Q
...S PSBEND=0
...S PSBTB=$P(PSBDATA,U,29) S PSBTB=$S(PSBTB=1:"UD",PSBTB=2:"IVPB",PSBTB=3:"IV",1:" * ERROR * ")
...I (PSBTB'="IV") F PSBX2X=PSBX2X:1 D Q:PSBEND>0
....S PSBEND=0 I $P(PSBDATA(PSBX2X),U)="END" S PSBEND=PSBX2X
...Q:PSBEND>0
...S PSBSTS1=$P(PSBDATA,U,23)
...S PSBSTS=$S((PSBSTS1="A")&(($P(PSBDATA,U,27)>PSBNOWX)):"Active",PSBSTS1="H":"On Hold",PSBSTS1="D":"Discontinued",PSBSTS1="DE":"Discontinued (Edit)",(PSBSTS1="E")!($P(PSBDATA,U,27)'>PSBNOWX):"Expired",1:" * ERROR * ")
...S V=$$FMADD^XLFDT(PSBNOWX,,,PSBB4)
...S PSBSTSX=$S($P(PSBDATA,U,27)'>PSBNOWX:"EXPIRED/DC'd",$P(PSBDATA,U,22)'>V:"ACTIVE",V:"FUTURE",1:" * ERROR * ")
...I PSBSTSX=" * ERROR * " F PSBX2X=PSBX2X:1 D Q:PSBEND>0
....S PSBEND=0 I $P(PSBDATA(PSBX2X),U)="END" S PSBEND=PSBX2X
...Q:PSBEND>0
...S PSBORDN=$P(PSBDATA,U,3)
...S PSBORITX=$P(PSBDATA,U,9)
...S PSBSTS(PSBORDN,PSBSTS)=""
...S PSBOSTDT=$P(PSBDATA,U,22)
...S PSBOSTDT(PSBORDN,PSBOSTDT)=""
...S PSBOSPDT=$P(PSBDATA,U,27)
...S PSBOSPDT(PSBORDN,PSBOSPDT)=""
...S PSBDOSR=$P(PSBDATA,U,10)_", "_$P(PSBDATA,U,11)
...S PSBDOSR=$TR($E(PSBDOSR,1)," ")_$E(PSBDOSR,2,999)
...S PSBDOSR(PSBORDN,PSBDOSR)=""
...S X2="A",PSBLIST2("All Other",PSBORITX,PSBORDN,"*NA*")=" "
...S PSBBSO(PSBORDN)="" S:$G(PSBSTSX)="ACTIVE" PSBBSO(PSBORDN)="AVAILABLE"
..Q:'$D(PSBORDN)
..I $P(PSBDATA,U)="ORC" D Q
...S PSBSI=$P(PSBDATA(PSBX2X),U,2)
...I PSBSI]" " S PSBSI(PSBORDN,PSBSI)=""
..Q:'$D(PSBORDN)
..I "^DD^ADD^SOL"[(U_$P(PSBDATA(PSBX2X),U)) D Q
...F I=PSBX2X:1 S PSBDATA1=PSBDATA(I) D Q:$D(PSBOMDR(PSBORDN))
....I "^DD^ADD^SOL"[(U_$P(PSBDATA1,U)) S PSBX2X=I S PSBDRUGN=$G(PSBDRUGN,"")_$P(PSBDATA1,U,3)_", " Q
....S $E(PSBDRUGN,$L(PSBDRUGN)-1)="" S PSBDRUGN(PSBORDN,$E(PSBDRUGN,1,250))=PSBDRUGN
....S PSBOMDR(PSBORDN,$E((PSBDRUGN_"; "_PSBDOSR),1,250))=PSBDRUGN_"; "_PSBDOSR
..Q:'$D(PSBORDN)
..I $P(PSBDATA,U)="ORF" D Q
...S:$P(PSBDATA,U,2)]"" PSBFLGD(PSBORDN,$P(PSBDATA,U,3)_" - "_$P(PSBDATA,U,4))=""
..Q:'$D(PSBORDN)
..I $P(PSBDATA,U)="ID" D Q
...F PSBX3X=PSBX2X:1 S PSBDATA=PSBDATA(PSBX3X) Q:($P(PSBDATA,U)'="ID") D
....S PSBX2X=PSBX3X
....K X2
....S X2="A",PSBLIST2("All Other",PSBORITX,PSBORDN,$P(PSBDATA,U,2))=PSBBSO(PSBORDN) I $D(PSBLIST2("All Other",PSBORITX,PSBORDN,"*NA*")) K PSBLIST2("All Other",PSBORITX,PSBORDN,"*NA*")
..Q:'$D(PSBORDN)
..I ($P(PSBDATA,U)="ADM")&($P(PSBDATA,U,4)]"") D Q
...I $P(PSBDATA,U,3)]"" D
....K X2
....S PSBBID(PSBORDN,$P(PSBDATA,U,3))=""
....I $P(^PSB(53.79,$P(PSBDATA,U,4),0),U,9)="I" S X2="I",PSBLIST2("Infusing")=PSBLIST2("Infusing")+1,PSBLIST2("Infusing",PSBORITX,PSBORDN,$P(PSBDATA,U,3))="INFUSING"
....I $P(^PSB(53.79,$P(PSBDATA,U,4),0),U,9)="S" S X2="S",PSBLIST2("Stopped")=PSBLIST2("Stopped")+1,PSBLIST2("Stopped",PSBORITX,PSBORDN,$P(PSBDATA,U,3))="STOPPED"
....I PSBBGX[$G(X2,"A") S:PSBXFLG PSBLGD(PSBORDN,"INITIALS",$P(PSBDATA,U,8))=""
....S:'$D(X2) X2="A",PSBLIST2("All Other",PSBORITX,PSBORDN,$P(PSBDATA,U,3))=$$GET1^DIQ(53.79,$P(PSBDATA,U,4)_",","ACTION STATUS")
....I $D(PSBLIST2("All Other",PSBORITX,PSBORDN,"*NA*")) K PSBLIST2("All Other",PSBORITX,PSBORDN,"*NA*")
..Q:'$D(PSBORDN)
..I $P(PSBDATA,U,1)="END" Q
F I="All Other","Infusing","Stopped" S X="",PSBLIST2(I)=0 F S X=$O(PSBLIST2(I,X)) Q:X="" S XI="" F S XI=$O(PSBLIST2(I,X,XI),-1) Q:XI="" D
.S PSBX2X="" F S PSBX2X=$O(PSBLIST2(I,X,XI,PSBX2X),-1) Q:PSBX2X="" S PSBLIST2(I)=PSBLIST2(I)+1 I (PSBBGX[$E(I,1)) S PSBTOT=PSBTOT+1
D CREATHDR
D SUBHDR
D BLDRPT
D WRTRPT
Q
BLDRPT ; Bld RPT
K PSBL2ULN
S PSBTOPHD=PSBLNTOT-2
I '$D(PSBLIST2) D Q
.S PSBOUTP(0,PSBLNTOT)="W !!,""<<<< NO ORDERS TO DISPLAY >>>>"",!!"
S PSBMORE=5 F PSBX1X="Infusing","Stopped","All Other" D
.I PSBX1X'=" * ERROR * " S PSBSUM=PSBX1X_" ["_PSBLIST2(PSBX1X)_"]" S PSBOUTP($$PGTOT,PSBLNTOT)="W !!,"""_PSBSUM_""""
.Q:PSBLIST2(PSBX1X)=0
.Q:PSBBGX'[$E(PSBX1X,1)
.S:$L(PSBSUM)>$G(PSBL2ULN,0) PSBL2ULN=$L(PSBSUM)
.S PSBOUTP($$PGTOT(2),PSBLNTOT)="W !,$TR($J("""",PSBL2ULN),"" "",""=""),!"
.S PSBOUTP($$PGTOT,PSBLNTOT)="W !"
.K PSBDATA
.S X0="",PSBTOT1=0
.F S X0=$O(PSBLIST2(PSBX1X,X0)) Q:X0="" S PSBX2X="" F S PSBX2X=$O(PSBLIST2(PSBX1X,X0,PSBX2X)) Q:PSBX2X="" S XI="" F S XI=$O(PSBLIST2(PSBX1X,X0,PSBX2X,XI)) Q:XI="" D
..K PSBDATA(1)
..S PSBDATA(1,1)=XI
..S PSBDATA(1,2)=$O(PSBSTS(PSBX2X,""))
..S PSBDATA(1,3)=PSBLIST2(PSBX1X,X0,PSBX2X,XI)
..S Y0=$O(PSBOMDR(PSBX2X,"")) I Y0]"" S PSBDATA(1,4)="("_X0_")",PSBDATA(1,4,0)=PSBOMDR(PSBX2X,Y0)
..I "IS"[$E(PSBDATA(1,3),1) S (PSBCHG,PSBDATA(1,5))="",PSBORLST(0)=PSBX2X D RPC^PSBCHKIV(.PSBCHG,PSBXDFN,.PSBORLST)
..I $D(PSBCHG(0)) I PSBCHG(0)>0 I ($P(PSBCHG(1),U)=PSBX2X)!($P(PSBCHG(1),U,5)=PSBX2X) F X2=0:1 Q:PSBCHG(X2)="END" I $P(PSBCHG(X2),U)="CD" S PSBDATA(1,5)="Changed Order" Q
..S PSBDATA(1,6)=$$FMTDT^PSBOCE1($O(PSBOSTDT(PSBX2X,"")))
..S PSBDATA(1,7)=$$FMTDT^PSBOCE1($E($O(PSBOSPDT(PSBX2X,"")),1,12))
..S PSBSIDAT(1)=$O(PSBSI(PSBX2X,""))
..S PSBTOT1=PSBTOT1+1
..K PSBDATA(2),PSBSILN
..D BUILDLN^PSBOCI1,SIOPI^PSBOCM(.PSBSIDAT,PSBTAB7,"Other Print Info:")
..I $D(PSBRPLN) S PSBMORE=$O(PSBRPLN(""),-1)+6 I $D(PSBSILN) S PSBMORE=PSBMORE+$O(PSBSILN(""),-1)
..K PSB1 I $D(PSBFLGD(PSBX2X)) S PSB="" F S PSB=$O(PSBFLGD(PSBX2X,PSB)) Q:PSB="" I ($P(PSB,":")'="NOX")&($P(PSB,":")'="STAT") S PSB1=$G(PSB1,"")_PSB
..S PSBCNT=PSBTOT1_" "_$G(PSB1,"")
..S PSBOUTP($$PGTOT,PSBLNTOT)="W """_PSBCNT_""""
..S I="" F S I=$O(PSBRPLN(I)) Q:+I=0 D
...S PSBOUTP($$PGTOT,PSBLNTOT)="W !,"""_PSBRPLN(I)_""""
..S I="" F S I=$O(PSBSILN(I)) Q:+I=0 D
...S PSBOUTP($$PGTOT,PSBLNTOT)="W !,"""_PSBSILN(I)_""""
..S PSBOUTP($$PGTOT(2),PSBLNTOT)="W !,$TR($J("""",PSBTAB7),"" "",""-""),!"
..K PSBRPLN,PSBDATA,PSBSILN
K PSBNO S PSBNO=1 D:+PSBTOT>0 LGD^PSBOCM K PSBNO
Q
WRTRPT ; writ
I $O(PSBOUTP(""),-1)<1 D Q
.X PSBOUTP($O(PSBOUTP(""),-1),14)
.D PTFTR^PSBOCI1
S PSBPGNUM=1
S PSBZ="" F S PSBZ=$O(PSBOUTP(PSBZ)) Q:PSBZ="" D
.I PSBPGNUM'=PSBZ D PTFTR^PSBOCI1 S PSBPGNUM=PSBZ D HDR,SUBHDR
.S PSBX2X="" F S PSBX2X=$O(PSBOUTP(PSBZ,PSBX2X)) Q:PSBX2X="" D
..X PSBOUTP(PSBZ,PSBX2X)
D PTFTR^PSBOCI1
K ^XTMP("PSBO",$J,"PSBLIST"),PSBOUTP
Q
HDR ; Hder
W:$Y>1 @IOF
W:$X>1 !
S PSBRPNM="BCMA COVERSHEET IV OVERVIEW REPORT"
D:$P(PSBRPT(.1),U,1)="P"
.S PSBHDR(0)=PSBRPNM
.S PSBHDR(1)="Order Type(s): --"
.F Y=12,13,18 I $P(PSBFUTR,U,Y) S $P(PSBHDR(1),": ",2)=$P(PSBHDR(1),": ",2)_$S(PSBHDR(1)["--":"",1:"/ ")_$P("^^^^^^^^^^^Infusing Bags^Stopped Bags^^^^^All Others",U,Y)_" " S PSBHDR(1)=$TR(PSBHDR(1),"-","")
.I $P(PSBFUTR,U,11) S PSBHDR(2)="Include Action(s)"_$S(PSBCFLG:" & Comments/Reasons",1:"")
.D PT^PSBOHDR(PSBXDFN,.PSBHDR)
Q
SUBHDR ;
N PSBAL S PSBAL=$O(PSBHDR("ALERGY",""),-1) S PSBAL=$S((PSBAL/12)>(PSBAL\12):(PSBAL\12)+1,1:(PSBAL\12))
N PSBRE S PSBRE=$O(PSBHDR("REAC",""),-1) S PSBRE=$S((PSBRE/12)>(PSBRE\12):(PSBRE\12)+1,1:(PSBRE\12))
S PSBLNTOT=$O(PSBHDR(""),-1)+9+PSBAL+PSBRE+1
I $G(PSBPGNUM,0)=1 W !,?(PSBTAB7-($L("Total Items reported: "_+PSBTOT))),"Total Items reported: "_+PSBTOT,! S PSBLNTOT=PSBLNTOT+2
W !,$TR($J("",PSBTAB7)," ","_") S PSBLNTOT=PSBLNTOT+1
W !,$G(PSBHD1,"") S PSBLNTOT=PSBLNTOT+1
W !,$G(PSBHD2,"") S PSBLNTOT=PSBLNTOT+1
W !,$TR($J("",PSBTAB7)," ","="),! S PSBLNTOT=PSBLNTOT+2
I $D(NOTE(PSBPGNUM)) W NOTE(PSBPGNUM),!! S PSBLNTOT=PSBLNTOT+2
Q
PGTOT(X) ;PG Nmbr
I (PSBLNTOT+PSBMORE)>(IOSL) D PGC^PSBOCE1
I $G(X,1) S PSBLNTOT=PSBLNTOT+$G(X,1),PSBMORE=PSBMORE-$G(X,1)
Q PSBPGNUM
CREATHDR ;
K PSBHD1,PSBHD2
I IOM'<132 S PSBHD1=$P($T(HD132A),"~",2),PSBHD2=$P($T(HD132B),";",2),PSBBLANK=$P($T(C132BLK),";",2)
E S PSBHD1="THIS REPORT SUPPORTS >131 CHAR./LINE PRINT FORMATS ONLY" K PSBLIST2 Q
; tabs
S PSBTAB0=1 F PSBI=0:1:($L(PSBHD1,"|")-1) S:PSBI>0 @("PSBTAB"_PSBI)=($F(PSBHD1,"|",@("PSBTAB"_(PSBI-1))+1))-1
S PSBPGNUM=1
D HDR
Q
HD132A ;~ Bag ID | Order | Bag | Medication; Infusion Rate, Route | Bag Info | Order Start | Order Stop |
Q
HD132B ; | Status | Status | | | Date | Date |
Q
C132BLK ;; | | | | | | |
Q
PSBOCI ;BIRMINGHAM/TEJ-COVERSHEET IV OVERVIEW REPORT ;Mar 2004
+1 ;;3.0;BAR CODE MED ADMIN;**32**;Mar 2004;Build 32
+2 ;Per VHA Directive 2004-038 (or future revisions regarding same), this routine should not be modified.
+3 ;
+4 ; Reference/IA
+5 ; File 4/10090
EN ;
+1 NEW PSBX1X,RESULTS,RESULT,PSBFUTR
+2 SET PSBFUTR=$TRANSLATE(PSBRPT(1),"~","^")
+3 ; srch crit - "A"ctive,"D"C ed,"E"xpired"
SET (PSBOCRIT,PSBXFLG,PSBCFLG,PSBBGX)=""
+4 SET PSBOCRIT="DEA"
+5 IF $PIECE(PSBFUTR,U,11)
SET PSBXFLG=1
+6 IF $PIECE(PSBFUTR,U,12)
SET PSBBGX=PSBBGX_"I"
+7 IF $PIECE(PSBFUTR,U,13)
SET PSBBGX=PSBBGX_"S"
+8 IF $PIECE(PSBFUTR,U,14)
SET PSBBGX=PSBBGX_"A"
+9 IF $DATA(PSBRPT(.2))
IF $PIECE(PSBRPT(.2),U,8)
SET PSBCFLG=1
+10 KILL PSBSRTBY,PSBCMT,PSBADM,PSBDATA,PSBOUTP,PSBLGD
+11 SET PSBSORT=1
+12 DO NOW^%DTC
SET (Y,PSBNOWX)=%
DO DD^%DT
SET PSBDTTM=Y
+13 DO GETPAR^PSBPAR("ALL","PSB ADMIN BEFORE")
+14 SET PSBB4=0
IF RESULTS(0)>0
SET PSBB4=+RESULTS(0)
+15 DO GETPAR^PSBPAR("ALL","PSB ADMIN AFTER")
+16 SET PSBAFT=0
IF RESULTS(0)>0
SET PSBAFT=+RESULTS(0)
+17 KILL ^XTMP("PSBO",$JOB,"PSBLIST")
+18 SET (PSBPGNUM,PSBLNTOT)=""
+19 KILL PSBLIST,PSBLIST2
+20 SET PSBXDFN=$PIECE(PSBRPT(.1),U,2)
+21 SET PSBLIST(PSBXDFN)=""
+22 SET (PSBX1X,PSBTOT)=0
+23 FOR
SET PSBX1X=$ORDER(PSBLIST(PSBX1X))
IF +PSBX1X=0
QUIT
Begin DoDot:1
+24 DO RPC^PSBCSUTL(.PSBAREA,PSBX1X)
+25 MERGE PSBDATA=@PSBAREA
+26 SET PSBX2X=1
+27 SET (PSBLIST2("All Other"),PSBLIST2("Infusing"),PSBLIST2("Stopped"),PSBLIST2(" * NO * "))=0
+28 KILL PSBBSO
+29 FOR
SET PSBX2X=$ORDER(PSBDATA(PSBX2X))
IF +PSBX2X=0
QUIT
Begin DoDot:2
+30 SET PSBDATA=PSBDATA(PSBX2X)
+31 IF $PIECE(PSBDATA,U)="ORD"
KILL PSBORDN,PSBDRUGN
Begin DoDot:3
+32 SET PSBEND=0
+33 SET PSBTB=$PIECE(PSBDATA,U,29)
SET PSBTB=$SELECT(PSBTB=1:"UD",PSBTB=2:"IVPB",PSBTB=3:"IV",1:" * ERROR * ")
+34 IF (PSBTB'="IV")
FOR PSBX2X=PSBX2X:1
Begin DoDot:4
+35 SET PSBEND=0
IF $PIECE(PSBDATA(PSBX2X),U)="END"
SET PSBEND=PSBX2X
End DoDot:4
IF PSBEND>0
QUIT
+36 IF PSBEND>0
QUIT
+37 SET PSBSTS1=$PIECE(PSBDATA,U,23)
+38 SET PSBSTS=$SELECT((PSBSTS1="A")&(($PIECE(PSBDATA,U,27)>PSBNOWX)):"Active",PSBSTS1="H":"On Hold",PSBSTS1="D":"Discontinued",PSBSTS1="DE":"Discontinued (Edit)",(PSBSTS1="E")!($PIECE(PSBDATA,U,27)'>PSBNOWX):"Expired",1:" *
ERROR * ")
+39 SET V=$$FMADD^XLFDT(PSBNOWX,,,PSBB4)
+40 SET PSBSTSX=$SELECT($PIECE(PSBDATA,U,27)'>PSBNOWX:"EXPIRED/DC'd",$PIECE(PSBDATA,U,22)'>V:"ACTIVE",V:"FUTURE",1:" * ERROR * ")
+41 IF PSBSTSX=" * ERROR * "
FOR PSBX2X=PSBX2X:1
Begin DoDot:4
+42 SET PSBEND=0
IF $PIECE(PSBDATA(PSBX2X),U)="END"
SET PSBEND=PSBX2X
End DoDot:4
IF PSBEND>0
QUIT
+43 IF PSBEND>0
QUIT
+44 SET PSBORDN=$PIECE(PSBDATA,U,3)
+45 SET PSBORITX=$PIECE(PSBDATA,U,9)
+46 SET PSBSTS(PSBORDN,PSBSTS)=""
+47 SET PSBOSTDT=$PIECE(PSBDATA,U,22)
+48 SET PSBOSTDT(PSBORDN,PSBOSTDT)=""
+49 SET PSBOSPDT=$PIECE(PSBDATA,U,27)
+50 SET PSBOSPDT(PSBORDN,PSBOSPDT)=""
+51 SET PSBDOSR=$PIECE(PSBDATA,U,10)_", "_$PIECE(PSBDATA,U,11)
+52 SET PSBDOSR=$TRANSLATE($EXTRACT(PSBDOSR,1)," ")_$EXTRACT(PSBDOSR,2,999)
+53 SET PSBDOSR(PSBORDN,PSBDOSR)=""
+54 SET X2="A"
SET PSBLIST2("All Other",PSBORITX,PSBORDN,"*NA*")=" "
+55 SET PSBBSO(PSBORDN)=""
IF $GET(PSBSTSX)="ACTIVE"
SET PSBBSO(PSBORDN)="AVAILABLE"
End DoDot:3
QUIT
+56 IF '$DATA(PSBORDN)
QUIT
+57 IF $PIECE(PSBDATA,U)="ORC"
Begin DoDot:3
+58 SET PSBSI=$PIECE(PSBDATA(PSBX2X),U,2)
+59 IF PSBSI]" "
SET PSBSI(PSBORDN,PSBSI)=""
End DoDot:3
QUIT
+60 IF '$DATA(PSBORDN)
QUIT
+61 IF "^DD^ADD^SOL"[(U_$PIECE(PSBDATA(PSBX2X),U))
Begin DoDot:3
+62 FOR I=PSBX2X:1
SET PSBDATA1=PSBDATA(I)
Begin DoDot:4
+63 IF "^DD^ADD^SOL"[(U_$PIECE(PSBDATA1,U))
SET PSBX2X=I
SET PSBDRUGN=$GET(PSBDRUGN,"")_$PIECE(PSBDATA1,U,3)_", "
QUIT
+64 SET $EXTRACT(PSBDRUGN,$LENGTH(PSBDRUGN)-1)=""
SET PSBDRUGN(PSBORDN,$EXTRACT(PSBDRUGN,1,250))=PSBDRUGN
+65 SET PSBOMDR(PSBORDN,$EXTRACT((PSBDRUGN_"; "_PSBDOSR),1,250))=PSBDRUGN_"; "_PSBDOSR
End DoDot:4
IF $DATA(PSBOMDR(PSBORDN))
QUIT
End DoDot:3
QUIT
+66 IF '$DATA(PSBORDN)
QUIT
+67 IF $PIECE(PSBDATA,U)="ORF"
Begin DoDot:3
+68 IF $PIECE(PSBDATA,U,2)]""
SET PSBFLGD(PSBORDN,$PIECE(PSBDATA,U,3)_" - "_$PIECE(PSBDATA,U,4))=""
End DoDot:3
QUIT
+69 IF '$DATA(PSBORDN)
QUIT
+70 IF $PIECE(PSBDATA,U)="ID"
Begin DoDot:3
+71 FOR PSBX3X=PSBX2X:1
SET PSBDATA=PSBDATA(PSBX3X)
IF ($PIECE(PSBDATA,U)'="ID")
QUIT
Begin DoDot:4
+72 SET PSBX2X=PSBX3X
+73 KILL X2
+74 SET X2="A"
SET PSBLIST2("All Other",PSBORITX,PSBORDN,$PIECE(PSBDATA,U,2))=PSBBSO(PSBORDN)
IF $DATA(PSBLIST2("All Other",PSBORITX,PSBORDN,"*NA*"))
KILL PSBLIST2("All Other",PSBORITX,PSBORDN,"*NA*")
End DoDot:4
End DoDot:3
QUIT
+75 IF '$DATA(PSBORDN)
QUIT
+76 IF ($PIECE(PSBDATA,U)="ADM")&($PIECE(PSBDATA,U,4)]"")
Begin DoDot:3
+77 IF $PIECE(PSBDATA,U,3)]""
Begin DoDot:4
+78 KILL X2
+79 SET PSBBID(PSBORDN,$PIECE(PSBDATA,U,3))=""
+80 IF $PIECE(^PSB(53.79,$PIECE(PSBDATA,U,4),0),U,9)="I"
SET X2="I"
SET PSBLIST2("Infusing")=PSBLIST2("Infusing")+1
SET PSBLIST2("Infusing",PSBORITX,PSBORDN,$PIECE(PSBDATA,U,3))="INFUSING"
+81 IF $PIECE(^PSB(53.79,$PIECE(PSBDATA,U,4),0),U,9)="S"
SET X2="S"
SET PSBLIST2("Stopped")=PSBLIST2("Stopped")+1
SET PSBLIST2("Stopped",PSBORITX,PSBORDN,$PIECE(PSBDATA,U,3))="STOPPED"
+82 IF PSBBGX[$GET(X2,"A")
IF PSBXFLG
SET PSBLGD(PSBORDN,"INITIALS",$PIECE(PSBDATA,U,8))=""
+83 IF '$DATA(X2)
SET X2="A"
SET PSBLIST2("All Other",PSBORITX,PSBORDN,$PIECE(PSBDATA,U,3))=$$GET1^DIQ(53.79,$PIECE(PSBDATA,U,4)_",","ACTION STATUS")
+84 IF $DATA(PSBLIST2("All Other",PSBORITX,PSBORDN,"*NA*"))
KILL PSBLIST2("All Other",PSBORITX,PSBORDN,"*NA*")
End DoDot:4
End DoDot:3
QUIT
+85 IF '$DATA(PSBORDN)
QUIT
+86 IF $PIECE(PSBDATA,U,1)="END"
QUIT
End DoDot:2
End DoDot:1
+87 FOR I="All Other","Infusing","Stopped"
SET X=""
SET PSBLIST2(I)=0
FOR
SET X=$ORDER(PSBLIST2(I,X))
IF X=""
QUIT
SET XI=""
FOR
SET XI=$ORDER(PSBLIST2(I,X,XI),-1)
IF XI=""
QUIT
Begin DoDot:1
+88 SET PSBX2X=""
FOR
SET PSBX2X=$ORDER(PSBLIST2(I,X,XI,PSBX2X),-1)
IF PSBX2X=""
QUIT
SET PSBLIST2(I)=PSBLIST2(I)+1
IF (PSBBGX[$EXTRACT(I,1))
SET PSBTOT=PSBTOT+1
End DoDot:1
+89 DO CREATHDR
+90 DO SUBHDR
+91 DO BLDRPT
+92 DO WRTRPT
+93 QUIT
BLDRPT ; Bld RPT
+1 KILL PSBL2ULN
+2 SET PSBTOPHD=PSBLNTOT-2
+3 IF '$DATA(PSBLIST2)
Begin DoDot:1
+4 SET PSBOUTP(0,PSBLNTOT)="W !!,""<<<< NO ORDERS TO DISPLAY >>>>"",!!"
End DoDot:1
QUIT
+5 SET PSBMORE=5
FOR PSBX1X="Infusing","Stopped","All Other"
Begin DoDot:1
+6 IF PSBX1X'=" * ERROR * "
SET PSBSUM=PSBX1X_" ["_PSBLIST2(PSBX1X)_"]"
SET PSBOUTP($$PGTOT,PSBLNTOT)="W !!,"""_PSBSUM_""""
+7 IF PSBLIST2(PSBX1X)=0
QUIT
+8 IF PSBBGX'[$EXTRACT(PSBX1X,1)
QUIT
+9 IF $LENGTH(PSBSUM)>$GET(PSBL2ULN,0)
SET PSBL2ULN=$LENGTH(PSBSUM)
+10 SET PSBOUTP($$PGTOT(2),PSBLNTOT)="W !,$TR($J("""",PSBL2ULN),"" "",""=""),!"
+11 SET PSBOUTP($$PGTOT,PSBLNTOT)="W !"
+12 KILL PSBDATA
+13 SET X0=""
SET PSBTOT1=0
+14 FOR
SET X0=$ORDER(PSBLIST2(PSBX1X,X0))
IF X0=""
QUIT
SET PSBX2X=""
FOR
SET PSBX2X=$ORDER(PSBLIST2(PSBX1X,X0,PSBX2X))
IF PSBX2X=""
QUIT
SET XI=""
FOR
SET XI=$ORDER(PSBLIST2(PSBX1X,X0,PSBX2X,XI))
IF XI=""
QUIT
Begin DoDot:2
+15 KILL PSBDATA(1)
+16 SET PSBDATA(1,1)=XI
+17 SET PSBDATA(1,2)=$ORDER(PSBSTS(PSBX2X,""))
+18 SET PSBDATA(1,3)=PSBLIST2(PSBX1X,X0,PSBX2X,XI)
+19 SET Y0=$ORDER(PSBOMDR(PSBX2X,""))
IF Y0]""
SET PSBDATA(1,4)="("_X0_")"
SET PSBDATA(1,4,0)=PSBOMDR(PSBX2X,Y0)
+20 IF "IS"[$EXTRACT(PSBDATA(1,3),1)
SET (PSBCHG,PSBDATA(1,5))=""
SET PSBORLST(0)=PSBX2X
DO RPC^PSBCHKIV(.PSBCHG,PSBXDFN,.PSBORLST)
+21 IF $DATA(PSBCHG(0))
IF PSBCHG(0)>0
IF ($PIECE(PSBCHG(1),U)=PSBX2X)!($PIECE(PSBCHG(1),U,5)=PSBX2X)
FOR X2=0:1
IF PSBCHG(X2)="END"
QUIT
IF $PIECE(PSBCHG(X2),U)="CD"
SET PSBDATA(1,5)="Changed Order"
QUIT
+22 SET PSBDATA(1,6)=$$FMTDT^PSBOCE1($ORDER(PSBOSTDT(PSBX2X,"")))
+23 SET PSBDATA(1,7)=$$FMTDT^PSBOCE1($EXTRACT($ORDER(PSBOSPDT(PSBX2X,"")),1,12))
+24 SET PSBSIDAT(1)=$ORDER(PSBSI(PSBX2X,""))
+25 SET PSBTOT1=PSBTOT1+1
+26 KILL PSBDATA(2),PSBSILN
+27 DO BUILDLN^PSBOCI1
DO SIOPI^PSBOCM(.PSBSIDAT,PSBTAB7,"Other Print Info:")
+28 IF $DATA(PSBRPLN)
SET PSBMORE=$ORDER(PSBRPLN(""),-1)+6
IF $DATA(PSBSILN)
SET PSBMORE=PSBMORE+$ORDER(PSBSILN(""),-1)
+29 KILL PSB1
IF $DATA(PSBFLGD(PSBX2X))
SET PSB=""
FOR
SET PSB=$ORDER(PSBFLGD(PSBX2X,PSB))
IF PSB=""
QUIT
IF ($PIECE(PSB,":")'="NOX")&($PIECE(PSB,":")'="STAT")
SET PSB1=$GET(PSB1,"")_PSB
+30 SET PSBCNT=PSBTOT1_" "_$GET(PSB1,"")
+31 SET PSBOUTP($$PGTOT,PSBLNTOT)="W """_PSBCNT_""""
+32 SET I=""
FOR
SET I=$ORDER(PSBRPLN(I))
IF +I=0
QUIT
Begin DoDot:3
+33 SET PSBOUTP($$PGTOT,PSBLNTOT)="W !,"""_PSBRPLN(I)_""""
End DoDot:3
+34 SET I=""
FOR
SET I=$ORDER(PSBSILN(I))
IF +I=0
QUIT
Begin DoDot:3
+35 SET PSBOUTP($$PGTOT,PSBLNTOT)="W !,"""_PSBSILN(I)_""""
End DoDot:3
+36 SET PSBOUTP($$PGTOT(2),PSBLNTOT)="W !,$TR($J("""",PSBTAB7),"" "",""-""),!"
+37 KILL PSBRPLN,PSBDATA,PSBSILN
End DoDot:2
End DoDot:1
+38 KILL PSBNO
SET PSBNO=1
IF +PSBTOT>0
DO LGD^PSBOCM
KILL PSBNO
+39 QUIT
WRTRPT ; writ
+1 IF $ORDER(PSBOUTP(""),-1)<1
Begin DoDot:1
+2 XECUTE PSBOUTP($ORDER(PSBOUTP(""),-1),14)
+3 DO PTFTR^PSBOCI1
End DoDot:1
QUIT
+4 SET PSBPGNUM=1
+5 SET PSBZ=""
FOR
SET PSBZ=$ORDER(PSBOUTP(PSBZ))
IF PSBZ=""
QUIT
Begin DoDot:1
+6 IF PSBPGNUM'=PSBZ
DO PTFTR^PSBOCI1
SET PSBPGNUM=PSBZ
DO HDR
DO SUBHDR
+7 SET PSBX2X=""
FOR
SET PSBX2X=$ORDER(PSBOUTP(PSBZ,PSBX2X))
IF PSBX2X=""
QUIT
Begin DoDot:2
+8 XECUTE PSBOUTP(PSBZ,PSBX2X)
End DoDot:2
End DoDot:1
+9 DO PTFTR^PSBOCI1
+10 KILL ^XTMP("PSBO",$JOB,"PSBLIST"),PSBOUTP
+11 QUIT
HDR ; Hder
+1 IF $Y>1
WRITE @IOF
+2 IF $X>1
WRITE !
+3 SET PSBRPNM="BCMA COVERSHEET IV OVERVIEW REPORT"
+4 IF $PIECE(PSBRPT(.1),U,1)="P"
Begin DoDot:1
+5 SET PSBHDR(0)=PSBRPNM
+6 SET PSBHDR(1)="Order Type(s): --"
+7 FOR Y=12,13,18
IF $PIECE(PSBFUTR,U,Y)
SET $PIECE(PSBHDR(1),": ",2)=$PIECE(PSBHDR(1),": ",2)_$SELECT(PSBHDR(1)["--":"",1:"/ ")_$PIECE("^^^^^^^^^^^Infusing Bags^Stopped Bags^^^^^All Others",U,Y)_" "
SET PSBHDR(1)=$TRANSLATE(PSBHDR(1),"-","")
+8 IF $PIECE(PSBFUTR,U,11)
SET PSBHDR(2)="Include Action(s)"_$SELECT(PSBCFLG:" & Comments/Reasons",1:"")
+9 DO PT^PSBOHDR(PSBXDFN,.PSBHDR)
End DoDot:1
+10 QUIT
SUBHDR ;
+1 NEW PSBAL
SET PSBAL=$ORDER(PSBHDR("ALERGY",""),-1)
SET PSBAL=$SELECT((PSBAL/12)>(PSBAL\12):(PSBAL\12)+1,1:(PSBAL\12))
+2 NEW PSBRE
SET PSBRE=$ORDER(PSBHDR("REAC",""),-1)
SET PSBRE=$SELECT((PSBRE/12)>(PSBRE\12):(PSBRE\12)+1,1:(PSBRE\12))
+3 SET PSBLNTOT=$ORDER(PSBHDR(""),-1)+9+PSBAL+PSBRE+1
+4 IF $GET(PSBPGNUM,0)=1
WRITE !,?(PSBTAB7-($LENGTH("Total Items reported: "_+PSBTOT))),"Total Items reported: "_+PSBTOT,!
SET PSBLNTOT=PSBLNTOT+2
+5 WRITE !,$TRANSLATE($JUSTIFY("",PSBTAB7)," ","_")
SET PSBLNTOT=PSBLNTOT+1
+6 WRITE !,$GET(PSBHD1,"")
SET PSBLNTOT=PSBLNTOT+1
+7 WRITE !,$GET(PSBHD2,"")
SET PSBLNTOT=PSBLNTOT+1
+8 WRITE !,$TRANSLATE($JUSTIFY("",PSBTAB7)," ","="),!
SET PSBLNTOT=PSBLNTOT+2
+9 IF $DATA(NOTE(PSBPGNUM))
WRITE NOTE(PSBPGNUM),!!
SET PSBLNTOT=PSBLNTOT+2
+10 QUIT
PGTOT(X) ;PG Nmbr
+1 IF (PSBLNTOT+PSBMORE)>(IOSL)
DO PGC^PSBOCE1
+2 IF $GET(X,1)
SET PSBLNTOT=PSBLNTOT+$GET(X,1)
SET PSBMORE=PSBMORE-$GET(X,1)
+3 QUIT PSBPGNUM
CREATHDR ;
+1 KILL PSBHD1,PSBHD2
+2 IF IOM'<132
SET PSBHD1=$PIECE($TEXT(HD132A),"~",2)
SET PSBHD2=$PIECE($TEXT(HD132B),";",2)
SET PSBBLANK=$PIECE($TEXT(C132BLK),";",2)
+3 IF '$TEST
SET PSBHD1="THIS REPORT SUPPORTS >131 CHAR./LINE PRINT FORMATS ONLY"
KILL PSBLIST2
QUIT
+4 ; tabs
+5 SET PSBTAB0=1
FOR PSBI=0:1:($LENGTH(PSBHD1,"|")-1)
IF PSBI>0
SET @("PSBTAB"_PSBI)=($FIND(PSBHD1,"|",@("PSBTAB"_(PSBI-1))+1))-1
+6 SET PSBPGNUM=1
+7 DO HDR
+8 QUIT
HD132A ;~ Bag ID | Order | Bag | Medication; Infusion Rate, Route | Bag Info | Order Start | Order Stop |
+1 QUIT
HD132B ; | Status | Status | | | Date | Date |
+1 QUIT
C132BLK ;; | | | | | | |
+1 QUIT