PSBOHDR ;BIRMINGHAM/EFC - REPORT HEADERS ;5/28/10 2:51pm
;;3.0;BAR CODE MED ADMIN;**5,13,42**;Mar 2004;Build 62
;
; Reference/IA
; EN6^GMRVUTL/1120
; WARD^NURSUT5/3052
; IN5^VADPT/10061
; DEM^VADPT/10061
;
PT(DFN,PSBHDR,PSBCONT,PSBDT) ;
; DFN: Patient File IEN
; PSBCONT: True if this is a continuation page
; PSBDT: Date of Pt Information (Default to DT)
W:$Y>1 @IOF
W:$X>1 !
S:'$G(PSBDT) PSBDT=DT
; BUILD PSBHDR WITH ALL HEADER STUFF
D:'$D(PSBHDR("NAME"))
.S VAIP("D")="LAST"
.D DEM^VADPT,IN5^VADPT
.S PSBHDR("NAME")=VADM(1)
.S PSBHDR("SSN")=VA("PID")
.S PSBHDR("DOB")=$P(VADM(3),U,2)
.S PSBHDR("AGE")=VADM(4)
.S PSBHDR("SEX")=$P(VADM(5),U,2)
.S PSBHDR("MVMTTYPE")=$P(VAIP(2),U,2)
.S PSBHDR("MVMTLAST")=$P(VAIP(3),U,2)
.S PSBHDR("WARD")=$P(VAIP(5),U,2)
.S PSBHDR("ROOM")=$P(VAIP(6),U,2)
.S PSBHDR("DX")=VAIP(9)
.K VAIP,VADM,VA
.;
.;IHS/MSC/PLS - Call Vitals lookup based on agency code
.; and PCC Vitals package usage flag "BEHOVM USE VMSR"=1
.I $G(DUZ("AG"))="I",$$GET^XPAR("ALL","BEHOVM USE VMSR") D
..S X=+$P($$VITAL^APSPFUNC(DFN,"HT"),U,2)
..S X=$$VITCHT^APSPFUNC(X)\1,PSBHDR("HEIGHT")=$S(X:X_"cm",1:"*")
..S X=+$P($$VITAL^APSPFUNC(DFN,"WT"),U,2)
..S X=$$VITCWT^APSPFUNC(X)\1,PSBHDR("WEIGHT")=$S(X:X_"kg",1:"*")
.E D
..S GMRVSTR="HT" D EN6^GMRVUTL
..S X=+$P(X,U,8) S:X X=X*2.54\1 S PSBHDR("HEIGHT")=$S(X:X_"cm",1:"*")
..S GMRVSTR="WT" D EN6^GMRVUTL
..S X=+$P(X,U,8) S:X X=X*.45\1 S PSBHDR("WEIGHT")=$S(X:X_"kg",1:"*")
.;
.N PSBADRX D ALLR^PSBALL(.PSBADRX,DFN) S X=0,Y=""
.F S X=$O(PSBADRX(X)) Q:'X D
..Q:$P(PSBADRX(X),U,1)'="ADR" S Z=$P(PSBADRX(X),U,2) Q:Z=""
..I $L(Y_Z)>(IOM-22) S PSBHDR("REAC",$O(PSBHDR("REAC",""),-1)+1)=Y,Y=""
..S Y=Y_$S(Y]"":", ",1:"")_$P(PSBADRX(X),U,2)
.S:Y]"" PSBHDR("REAC",$O(PSBHDR("REAC",""),-1)+1)=Y
.I '$D(PSBHDR("REAC")) S PSBHDR("REAC",1)="No ADRs on file."
.D PSBALG
.K GMRAL,GMRVSTR,GMRA,PSBARX
.D NOW^%DTC S Y=+$E(%,1,12) D D^DIQ S PSBHDR("DATE")="Run Date: "_Y
.S PSBHDR("PAGE")=0
W $C(13),$TR($J("",IOM)," ","=")
W !,$G(PSBHDR(0))
W !,$G(PSBHDR(1)),?(IOM-$L(PSBHDR("DATE"))),PSBHDR("DATE")
S PSBHDR("PAGE")=PSBHDR("PAGE")+1
W !,$G(PSBHDR(2)),?(IOM-10),$J("Page: "_PSBHDR("PAGE"),10)
F X=3:1 Q:'$D(PSBHDR(X)) W !,PSBHDR(X) ; More Lines If Needed
I $G(PSBCONT) W !?(IOM-35\2),"*** CONTINUED FROM PREVIOUS PAGE ***"
W !!,"Patient:",?10,PSBHDR("NAME")
W ?40,$$GET^XPAR("ALL","PSB PATIENT ID LABEL")_":",?51,PSBHDR("SSN")
W ?75,"DOB:",?82,PSBHDR("DOB")," (",PSBHDR("AGE"),")"
D:'$G(PSBCONT)
.W !,"Sex: ",?10,PSBHDR("SEX"),?40,"Ht/Wt: ",PSBHDR("HEIGHT"),"/",PSBHDR("WEIGHT"),?75,"Ward: ",?82,PSBHDR("WARD")," Rm ",PSBHDR("ROOM")
.W !,"Dx:",?10,PSBHDR("DX"),?40,"Last Mvmt: ",PSBHDR("MVMTLAST"),?75,"Type: ",PSBHDR("MVMTTYPE")
.; Reactions/Allergies
.W !!,"ADRs:"
.F X=0:0 S X=$O(PSBHDR("REAC",X)) Q:'X W:$X>12 ! W ?12,PSBHDR("REAC",X)
.W !!,"Allergies:"
.F X=0:0 S X=$O(PSBHDR("ALERGY",X)) Q:'X W:$X>12 ! W ?12,PSBHDR("ALERGY",X)
.; Local Mods Allowed Here and showup only on First Page
.; Immunizations
.;D SHOT80^ASFSHOTF
W !,$TR($J("",IOM)," ","=")
Q
;
WARD(PSBWP,PSBHDR,PSBCONT,PSBDT) ;
; WARD: Nurse Location File IEN
; PSBCONT: True if this is a continuation page
; PSBDT: Date of Pt Information (Default to DT)
N PSBWRDA
S:'$G(PSBDT) PSBDT=DT
I '$D(PSBHDR("DATE")) D NOW^%DTC S Y=+$E(%,1,12) D D^DIQ S PSBHDR("DATE")="Run Date: "_Y
S:'$D(PSBHDR("PAGE")) PSBHDR("PAGE")=0
W:$Y>1 @IOF
W:$X>0 !
W $TR($J("",IOM)," ","="),!,$G(PSBHDR(0)),!,$G(PSBHDR(1)),?(IOM-$L(PSBHDR("DATE"))),PSBHDR("DATE")
S PSBHDR("PAGE")=PSBHDR("PAGE")+1
W !,$G(PSBHDR(2)),?(IOM-10),$J("Page: "_PSBHDR("PAGE"),10)
F X=3:1 Q:'$D(PSBHDR(X)) W !,PSBHDR(X) ; More Lines If Needed
I $G(PSBCONT) W !?(IOM-35\2),"*** CONTINUED FROM PREVIOUS PAGE ***"
D WARD^NURSUT5("L^"_PSBWP,.PSBWRDA)
W !!,"Ward Location: "_$P(PSBWRDA(PSBWP,.01),U,2)
S X="Division: "_$P(PSBWRDA(PSBWP,.02),U,2)
W ?(IOM-$L(X)),X,!,$TR($J("",IOM)," ","=")
Q
;
PSBALG ;
S YA=""
K PSBAL,GMRALA
S PSBLIST=""
D ALLR^PSBALL(.GMRALA,DFN)
S X="" F S X=$O(GMRALA(X)) Q:X="" D
.I $P(GMRALA(X),U,1)["ALL" D
..S PSBAL($P(GMRALA(X),U,2))=""
S XAB="" F S XAB=$O(PSBAL(XAB)) Q:XAB="" D
.S Z=XAB
.I $L(YA_Z)>(IOM-22) S PSBHDR("ALERGY",$O(PSBHDR("ALERGY",""),-1)+1)=YA,YA=""
.S YA=YA_$S(YA]"":", ",1:"")_XAB
S:YA]"" PSBHDR("ALERGY",$O(PSBHDR("ALERGY",""),-1)+1)=YA
I '$D(PSBHDR("ALERGY")) S PSBHDR("ALERGY",1)="No Allergies on file."
Q
;
PTFTR() ; [Extrinsic] Patient Page footer
;
I (IOSL<100) F Q:$Y>(IOSL-6) W !
W !,$TR($J("",IOM)," ","=")
S X="Ward: "_PSBHDR("WARD")_" Room-Bed: "_PSBHDR("ROOM")
W !,PSBHDR("NAME"),?(IOM-11\2),PSBHDR("SSN"),?(IOM-$L(X)),X
I $G(PSBUNK) S X="Note: ?? Indicates an administration with an *UNKNOWN* Action Status" W !!,X
Q ""
;
PSBOHDR ;BIRMINGHAM/EFC - REPORT HEADERS ;5/28/10 2:51pm
+1 ;;3.0;BAR CODE MED ADMIN;**5,13,42**;Mar 2004;Build 62
+2 ;
+3 ; Reference/IA
+4 ; EN6^GMRVUTL/1120
+5 ; WARD^NURSUT5/3052
+6 ; IN5^VADPT/10061
+7 ; DEM^VADPT/10061
+8 ;
PT(DFN,PSBHDR,PSBCONT,PSBDT) ;
+1 ; DFN: Patient File IEN
+2 ; PSBCONT: True if this is a continuation page
+3 ; PSBDT: Date of Pt Information (Default to DT)
+4 IF $Y>1
WRITE @IOF
+5 IF $X>1
WRITE !
+6 IF '$GET(PSBDT)
SET PSBDT=DT
+7 ; BUILD PSBHDR WITH ALL HEADER STUFF
+8 IF '$DATA(PSBHDR("NAME"))
Begin DoDot:1
+9 SET VAIP("D")="LAST"
+10 DO DEM^VADPT
DO IN5^VADPT
+11 SET PSBHDR("NAME")=VADM(1)
+12 SET PSBHDR("SSN")=VA("PID")
+13 SET PSBHDR("DOB")=$PIECE(VADM(3),U,2)
+14 SET PSBHDR("AGE")=VADM(4)
+15 SET PSBHDR("SEX")=$PIECE(VADM(5),U,2)
+16 SET PSBHDR("MVMTTYPE")=$PIECE(VAIP(2),U,2)
+17 SET PSBHDR("MVMTLAST")=$PIECE(VAIP(3),U,2)
+18 SET PSBHDR("WARD")=$PIECE(VAIP(5),U,2)
+19 SET PSBHDR("ROOM")=$PIECE(VAIP(6),U,2)
+20 SET PSBHDR("DX")=VAIP(9)
+21 KILL VAIP,VADM,VA
+22 ;
+23 ;IHS/MSC/PLS - Call Vitals lookup based on agency code
+24 ; and PCC Vitals package usage flag "BEHOVM USE VMSR"=1
+25 IF $GET(DUZ("AG"))="I"
IF $$GET^XPAR("ALL","BEHOVM USE VMSR")
Begin DoDot:2
+26 SET X=+$PIECE($$VITAL^APSPFUNC(DFN,"HT"),U,2)
+27 SET X=$$VITCHT^APSPFUNC(X)\1
SET PSBHDR("HEIGHT")=$SELECT(X:X_"cm",1:"*")
+28 SET X=+$PIECE($$VITAL^APSPFUNC(DFN,"WT"),U,2)
+29 SET X=$$VITCWT^APSPFUNC(X)\1
SET PSBHDR("WEIGHT")=$SELECT(X:X_"kg",1:"*")
End DoDot:2
+30 IF '$TEST
Begin DoDot:2
+31 SET GMRVSTR="HT"
DO EN6^GMRVUTL
+32 SET X=+$PIECE(X,U,8)
IF X
SET X=X*2.54\1
SET PSBHDR("HEIGHT")=$SELECT(X:X_"cm",1:"*")
+33 SET GMRVSTR="WT"
DO EN6^GMRVUTL
+34 SET X=+$PIECE(X,U,8)
IF X
SET X=X*.45\1
SET PSBHDR("WEIGHT")=$SELECT(X:X_"kg",1:"*")
End DoDot:2
+35 ;
+36 NEW PSBADRX
DO ALLR^PSBALL(.PSBADRX,DFN)
SET X=0
SET Y=""
+37 FOR
SET X=$ORDER(PSBADRX(X))
IF 'X
QUIT
Begin DoDot:2
+38 IF $PIECE(PSBADRX(X),U,1)'="ADR"
QUIT
SET Z=$PIECE(PSBADRX(X),U,2)
IF Z=""
QUIT
+39 IF $LENGTH(Y_Z)>(IOM-22)
SET PSBHDR("REAC",$ORDER(PSBHDR("REAC",""),-1)+1)=Y
SET Y=""
+40 SET Y=Y_$SELECT(Y]"":", ",1:"")_$PIECE(PSBADRX(X),U,2)
End DoDot:2
+41 IF Y]""
SET PSBHDR("REAC",$ORDER(PSBHDR("REAC",""),-1)+1)=Y
+42 IF '$DATA(PSBHDR("REAC"))
SET PSBHDR("REAC",1)="No ADRs on file."
+43 DO PSBALG
+44 KILL GMRAL,GMRVSTR,GMRA,PSBARX
+45 DO NOW^%DTC
SET Y=+$EXTRACT(%,1,12)
DO D^DIQ
SET PSBHDR("DATE")="Run Date: "_Y
+46 SET PSBHDR("PAGE")=0
End DoDot:1
+47 WRITE $CHAR(13),$TRANSLATE($JUSTIFY("",IOM)," ","=")
+48 WRITE !,$GET(PSBHDR(0))
+49 WRITE !,$GET(PSBHDR(1)),?(IOM-$LENGTH(PSBHDR("DATE"))),PSBHDR("DATE")
+50 SET PSBHDR("PAGE")=PSBHDR("PAGE")+1
+51 WRITE !,$GET(PSBHDR(2)),?(IOM-10),$JUSTIFY("Page: "_PSBHDR("PAGE"),10)
+52 ; More Lines If Needed
FOR X=3:1
IF '$DATA(PSBHDR(X))
QUIT
WRITE !,PSBHDR(X)
+53 IF $GET(PSBCONT)
WRITE !?(IOM-35\2),"*** CONTINUED FROM PREVIOUS PAGE ***"
+54 WRITE !!,"Patient:",?10,PSBHDR("NAME")
+55 WRITE ?40,$$GET^XPAR("ALL","PSB PATIENT ID LABEL")_":",?51,PSBHDR("SSN")
+56 WRITE ?75,"DOB:",?82,PSBHDR("DOB")," (",PSBHDR("AGE"),")"
+57 IF '$GET(PSBCONT)
Begin DoDot:1
+58 WRITE !,"Sex: ",?10,PSBHDR("SEX"),?40,"Ht/Wt: ",PSBHDR("HEIGHT"),"/",PSBHDR("WEIGHT"),?75,"Ward: ",?82,PSBHDR("WARD")," Rm ",PSBHDR("ROOM")
+59 WRITE !,"Dx:",?10,PSBHDR("DX"),?40,"Last Mvmt: ",PSBHDR("MVMTLAST"),?75,"Type: ",PSBHDR("MVMTTYPE")
+60 ; Reactions/Allergies
+61 WRITE !!,"ADRs:"
+62 FOR X=0:0
SET X=$ORDER(PSBHDR("REAC",X))
IF 'X
QUIT
IF $X>12
WRITE !
WRITE ?12,PSBHDR("REAC",X)
+63 WRITE !!,"Allergies:"
+64 FOR X=0:0
SET X=$ORDER(PSBHDR("ALERGY",X))
IF 'X
QUIT
IF $X>12
WRITE !
WRITE ?12,PSBHDR("ALERGY",X)
+65 ; Local Mods Allowed Here and showup only on First Page
+66 ; Immunizations
+67 ;D SHOT80^ASFSHOTF
End DoDot:1
+68 WRITE !,$TRANSLATE($JUSTIFY("",IOM)," ","=")
+69 QUIT
+70 ;
WARD(PSBWP,PSBHDR,PSBCONT,PSBDT) ;
+1 ; WARD: Nurse Location File IEN
+2 ; PSBCONT: True if this is a continuation page
+3 ; PSBDT: Date of Pt Information (Default to DT)
+4 NEW PSBWRDA
+5 IF '$GET(PSBDT)
SET PSBDT=DT
+6 IF '$DATA(PSBHDR("DATE"))
DO NOW^%DTC
SET Y=+$EXTRACT(%,1,12)
DO D^DIQ
SET PSBHDR("DATE")="Run Date: "_Y
+7 IF '$DATA(PSBHDR("PAGE"))
SET PSBHDR("PAGE")=0
+8 IF $Y>1
WRITE @IOF
+9 IF $X>0
WRITE !
+10 WRITE $TRANSLATE($JUSTIFY("",IOM)," ","="),!,$GET(PSBHDR(0)),!,$GET(PSBHDR(1)),?(IOM-$LENGTH(PSBHDR("DATE"))),PSBHDR("DATE")
+11 SET PSBHDR("PAGE")=PSBHDR("PAGE")+1
+12 WRITE !,$GET(PSBHDR(2)),?(IOM-10),$JUSTIFY("Page: "_PSBHDR("PAGE"),10)
+13 ; More Lines If Needed
FOR X=3:1
IF '$DATA(PSBHDR(X))
QUIT
WRITE !,PSBHDR(X)
+14 IF $GET(PSBCONT)
WRITE !?(IOM-35\2),"*** CONTINUED FROM PREVIOUS PAGE ***"
+15 DO WARD^NURSUT5("L^"_PSBWP,.PSBWRDA)
+16 WRITE !!,"Ward Location: "_$PIECE(PSBWRDA(PSBWP,.01),U,2)
+17 SET X="Division: "_$PIECE(PSBWRDA(PSBWP,.02),U,2)
+18 WRITE ?(IOM-$LENGTH(X)),X,!,$TRANSLATE($JUSTIFY("",IOM)," ","=")
+19 QUIT
+20 ;
PSBALG ;
+1 SET YA=""
+2 KILL PSBAL,GMRALA
+3 SET PSBLIST=""
+4 DO ALLR^PSBALL(.GMRALA,DFN)
+5 SET X=""
FOR
SET X=$ORDER(GMRALA(X))
IF X=""
QUIT
Begin DoDot:1
+6 IF $PIECE(GMRALA(X),U,1)["ALL"
Begin DoDot:2
+7 SET PSBAL($PIECE(GMRALA(X),U,2))=""
End DoDot:2
End DoDot:1
+8 SET XAB=""
FOR
SET XAB=$ORDER(PSBAL(XAB))
IF XAB=""
QUIT
Begin DoDot:1
+9 SET Z=XAB
+10 IF $LENGTH(YA_Z)>(IOM-22)
SET PSBHDR("ALERGY",$ORDER(PSBHDR("ALERGY",""),-1)+1)=YA
SET YA=""
+11 SET YA=YA_$SELECT(YA]"":", ",1:"")_XAB
End DoDot:1
+12 IF YA]""
SET PSBHDR("ALERGY",$ORDER(PSBHDR("ALERGY",""),-1)+1)=YA
+13 IF '$DATA(PSBHDR("ALERGY"))
SET PSBHDR("ALERGY",1)="No Allergies on file."
+14 QUIT
+15 ;
PTFTR() ; [Extrinsic] Patient Page footer
+1 ;
+2 IF (IOSL<100)
FOR
IF $Y>(IOSL-6)
QUIT
WRITE !
+3 WRITE !,$TRANSLATE($JUSTIFY("",IOM)," ","=")
+4 SET X="Ward: "_PSBHDR("WARD")_" Room-Bed: "_PSBHDR("ROOM")
+5 WRITE !,PSBHDR("NAME"),?(IOM-11\2),PSBHDR("SSN"),?(IOM-$LENGTH(X)),X
+6 IF $GET(PSBUNK)
SET X="Note: ?? Indicates an administration with an *UNKNOWN* Action Status"
WRITE !!,X
+7 QUIT ""
+8 ;