GMTSPSI ; SLC/JER,KER - IV Rx Summary Component (V4.5) ; 08/27/2002
;;2.7;Health Summary;**15,28,56**;Oct 20, 1995
;
; External References
; DBIA 10141 $$VERSION^XPDUTL
; DBIA 68 ENHS^PSJEEU0
;
MAIN ; Controls Branching
I $$VERSION^XPDUTL("PSJ")'<5 G MAIN^GMTSPSI5
N GMI,GMTSIDT,MAX,ON,PS,PSIVREA,PSJEDT,PSJNKF,PSJPFWD,TN
S PSJEDT=$S(GMTS2'=9999999:(9999999-GMTS2),1:""),PSJNKF=1
K ^UTILITY("PSIV",$J) I '$L($T(ENHS^PSJEEU0)) D NOPSJ Q
D ENHS^PSJEEU0
I '$D(^UTILITY("PSIV",$J)) Q
S GMI=0
S GMTSIDT=-9999999 F S GMTSIDT=$O(^UTILITY("PSIV",$J,GMTSIDT)) Q:'GMTSIDT D WRT Q:$D(GMTSQIT)
K ^UTILITY("PSIV",$J),^UTILITY("PSG",$J)
Q
NOPSJ ; Handles case where ^PSJEEU0 not present
D CKP^GMTSUP Q:$D(GMTSQIT) W "Inpatient Pharmacy version 3.2 or greater is required.",!
Q
WRT ; Prints IV Pharmacy order
N GMV,GMW,GMTSAD,GMTSDRUG,SOL,SD,SLN,FD,STAT,IR,SCH
S SD=$P(^UTILITY("PSIV",$J,GMTSIDT,0),U),FD=$P(^(0),U,2),STAT=$P($P(^(0),U,4),";"),IR=$P(^(0),U,5),SCH=$P(^(0),U,6)
; Don't display data when start date is after To Date
Q:+$G(GMRANGE)&(SD>(9999999-GMTS1))
F GMV="SD","FD" S X=@GMV D REGDT4^GMTSU S @GMV=X K X
I GMI'>0 D HEAD
D CKP^GMTSUP Q:$D(GMTSQIT) W:GMI>0&('GMTSNPG) !
S GMI=1
I $D(^UTILITY("PSIV",$J,GMTSIDT,"A",1)) D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG HEAD W $E($P($P(^UTILITY("PSIV",$J,GMTSIDT,"A",1),";",2),U),1,36),?38,$P(^(1),U,2),?50,STAT,?57,SD,?69,FD,!
S GMTSAD=1
F S GMTSAD=$O(^UTILITY("PSIV",$J,GMTSIDT,"A",GMTSAD)) Q:GMTSAD'>0 S GMTSDRUG=^(GMTSAD) D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG HEAD W $E($P($P(GMTSDRUG,";",2),U),1,36),?38,$P(GMTSDRUG,U,2),!
LSTSOL ; Write Solutions
S SOL=0
F S SOL=$O(^UTILITY("PSIV",$J,GMTSIDT,"S",SOL)) Q:SOL'>0 S SLN=^(SOL) D CKP^GMTSUP Q:$D(GMTSQIT) D
. D:GMTSNPG HEAD
. W ?3,$S(SOL=1!GMTSNPG:"In: ",1:" ")
. W $P($P(SLN,";",2),U)," ",$P(SLN,U,2)," ",IR," ",SCH,!
Q
HEAD ; Prints Header
I 'GMTSNPG D CKP^GMTSUP Q:$D(GMTSQIT)
W "Drug",?38,"Dose",?50,"Status",?58,"Start",?68,"Stop",! W:$Y'>(IOSL-GMTSLO) !
Q
GMTSPSI ; SLC/JER,KER - IV Rx Summary Component (V4.5) ; 08/27/2002
+1 ;;2.7;Health Summary;**15,28,56**;Oct 20, 1995
+2 ;
+3 ; External References
+4 ; DBIA 10141 $$VERSION^XPDUTL
+5 ; DBIA 68 ENHS^PSJEEU0
+6 ;
MAIN ; Controls Branching
+1 IF $$VERSION^XPDUTL("PSJ")'<5
GOTO MAIN^GMTSPSI5
+2 NEW GMI,GMTSIDT,MAX,ON,PS,PSIVREA,PSJEDT,PSJNKF,PSJPFWD,TN
+3 SET PSJEDT=$SELECT(GMTS2'=9999999:(9999999-GMTS2),1:"")
SET PSJNKF=1
+4 KILL ^UTILITY("PSIV",$JOB)
IF '$LENGTH($TEXT(ENHS^PSJEEU0))
DO NOPSJ
QUIT
+5 DO ENHS^PSJEEU0
+6 IF '$DATA(^UTILITY("PSIV",$JOB))
QUIT
+7 SET GMI=0
+8 SET GMTSIDT=-9999999
FOR
SET GMTSIDT=$ORDER(^UTILITY("PSIV",$JOB,GMTSIDT))
IF 'GMTSIDT
QUIT
DO WRT
IF $DATA(GMTSQIT)
QUIT
+9 KILL ^UTILITY("PSIV",$JOB),^UTILITY("PSG",$JOB)
+10 QUIT
NOPSJ ; Handles case where ^PSJEEU0 not present
+1 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
WRITE "Inpatient Pharmacy version 3.2 or greater is required.",!
+2 QUIT
WRT ; Prints IV Pharmacy order
+1 NEW GMV,GMW,GMTSAD,GMTSDRUG,SOL,SD,SLN,FD,STAT,IR,SCH
+2 SET SD=$PIECE(^UTILITY("PSIV",$JOB,GMTSIDT,0),U)
SET FD=$PIECE(^(0),U,2)
SET STAT=$PIECE($PIECE(^(0),U,4),";")
SET IR=$PIECE(^(0),U,5)
SET SCH=$PIECE(^(0),U,6)
+3 ; Don't display data when start date is after To Date
+4 IF +$GET(GMRANGE)&(SD>(9999999-GMTS1))
QUIT
+5 FOR GMV="SD","FD"
SET X=@GMV
DO REGDT4^GMTSU
SET @GMV=X
KILL X
+6 IF GMI'>0
DO HEAD
+7 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
IF GMI>0&('GMTSNPG)
WRITE !
+8 SET GMI=1
+9 IF $DATA(^UTILITY("PSIV",$JOB,GMTSIDT,"A",1))
DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
IF GMTSNPG
DO HEAD
WRITE $EXTRACT($PIECE($PIECE(^UTILITY("PSIV",$JOB,GMTSIDT,"A",1),";",2),U),1,36),?38,$PIECE(^(1),U,2),?50,STAT,?57,SD,?69,FD,!
+10 SET GMTSAD=1
+11 FOR
SET GMTSAD=$ORDER(^UTILITY("PSIV",$JOB,GMTSIDT,"A",GMTSAD))
IF GMTSAD'>0
QUIT
SET GMTSDRUG=^(GMTSAD)
DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
IF GMTSNPG
DO HEAD
WRITE $EXTRACT($PIECE($PIECE(GMTSDRUG,";",2),U),1,36),?38,$PIECE(GMTSDRUG,U,2),!
LSTSOL ; Write Solutions
+1 SET SOL=0
+2 FOR
SET SOL=$ORDER(^UTILITY("PSIV",$JOB,GMTSIDT,"S",SOL))
IF SOL'>0
QUIT
SET SLN=^(SOL)
DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
Begin DoDot:1
+3 IF GMTSNPG
DO HEAD
+4 WRITE ?3,$SELECT(SOL=1!GMTSNPG:"In: ",1:" ")
+5 WRITE $PIECE($PIECE(SLN,";",2),U)," ",$PIECE(SLN,U,2)," ",IR," ",SCH,!
End DoDot:1
+6 QUIT
HEAD ; Prints Header
+1 IF 'GMTSNPG
DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+2 WRITE "Drug",?38,"Dose",?50,"Status",?58,"Start",?68,"Stop",!
IF $Y'>(IOSL-GMTSLO)
WRITE !
+3 QUIT