GMTSPSI5 ; SLC/JER,KER - IV Rx Summary Component (V5) ; 02/11/2003
;;2.7;Health Summary;**15,28,56,62**;Oct 20, 1995
;
; External References
; DBIA 68 ENHS^PSJEEU0
;
MAIN ; Controls Branching
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 Q:$D(GMTSQIT)
. 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)
D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG HEAD W ?50,STAT,?57,SD,?69,FD,!
Q:$D(GMTSQIT)
S GMTSAD=1
F S GMTSAD=$O(^UTILITY("PSIV",$J,GMTSIDT,"A",GMTSAD)) Q:GMTSAD'>0 D Q:$D(GMTSQIT)
. 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),!
Q:$D(GMTSQIT)
LSTSOL ; Write Solutions
S SOL=0 F S SOL=$O(^UTILITY("PSIV",$J,GMTSIDT,"S",SOL)) Q:SOL'>0 D Q:$D(GMTSQIT)
. S SLN=^(SOL) D CKP^GMTSUP Q:$D(GMTSQIT) 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
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSPSI5 2138 printed Dec 13, 2024@01:59:34 Page 2
GMTSPSI5 ; SLC/JER,KER - IV Rx Summary Component (V5) ; 02/11/2003
+1 ;;2.7;Health Summary;**15,28,56,62**;Oct 20, 1995
+2 ;
+3 ; External References
+4 ; DBIA 68 ENHS^PSJEEU0
+5 ;
MAIN ; Controls Branching
+1 NEW GMI,GMTSIDT,MAX,ON,PS,PSIVREA,PSJEDT,PSJNKF,PSJPFWD,TN
+2 SET PSJEDT=$SELECT(GMTS2'=9999999:(9999999-GMTS2),1:"")
SET PSJNKF=1
+3 KILL ^UTILITY("PSIV",$JOB)
IF '$LENGTH($TEXT(ENHS^PSJEEU0))
DO NOPSJ
QUIT
+4 DO ENHS^PSJEEU0
IF '$DATA(^UTILITY("PSIV",$JOB))
QUIT
+5 SET GMI=0
+6 SET GMTSIDT=-9999999
FOR
SET GMTSIDT=$ORDER(^UTILITY("PSIV",$JOB,GMTSIDT))
if 'GMTSIDT
QUIT
DO WRT
if $DATA(GMTSQIT)
QUIT
+7 KILL ^UTILITY("PSIV",$JOB),^UTILITY("PSG",$JOB)
+8 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))
Begin DoDot:1
+10 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
if GMTSNPG
DO HEAD
+11 WRITE $EXTRACT($PIECE($PIECE(^UTILITY("PSIV",$JOB,GMTSIDT,"A",1),";",2),U),1,36),?38,$PIECE(^(1),U,2)
End DoDot:1
if $DATA(GMTSQIT)
QUIT
+12 DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
if GMTSNPG
DO HEAD
WRITE ?50,STAT,?57,SD,?69,FD,!
+13 if $DATA(GMTSQIT)
QUIT
+14 SET GMTSAD=1
+15 FOR
SET GMTSAD=$ORDER(^UTILITY("PSIV",$JOB,GMTSIDT,"A",GMTSAD))
if GMTSAD'>0
QUIT
Begin DoDot:1
+16 SET GMTSDRUG=^(GMTSAD)
DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
if GMTSNPG
DO HEAD
+17 WRITE $EXTRACT($PIECE($PIECE(GMTSDRUG,";",2),U),1,36),?38,$PIECE(GMTSDRUG,U,2),!
End DoDot:1
if $DATA(GMTSQIT)
QUIT
+18 if $DATA(GMTSQIT)
QUIT
LSTSOL ; Write Solutions
+1 SET SOL=0
FOR
SET SOL=$ORDER(^UTILITY("PSIV",$JOB,GMTSIDT,"S",SOL))
if SOL'>0
QUIT
Begin DoDot:1
+2 SET SLN=^(SOL)
DO CKP^GMTSUP
if $DATA(GMTSQIT)
QUIT
if GMTSNPG
DO HEAD
+3 WRITE ?3,$SELECT(SOL=1!GMTSNPG:"In: ",1:" ")
+4 WRITE $PIECE($PIECE(SLN,";",2),U)," ",$PIECE(SLN,U,2)," ",IR," ",SCH,!
End DoDot:1
if $DATA(GMTSQIT)
QUIT
+5 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