GMTSPSG ; SLC/JER,KER - UD Rx Summary Component (V4.5) ; 08/27/2002
;;2.7;Health Summary;**15,28,56**;Oct 20, 1995
;
; External References
; DBIA 486 ENHS^PSJEEU0
; DBIA 10141 $$VERSION^XPDUTL
;
MAIN ; Controls Branching
I $$VERSION^XPDUTL("PSJ")'<5 G MAIN^GMTSPSG5
N GMI,IX,ON,PS,PSIVREA,PSJEDT,PSJNKF,PSJPFWD,GMR,TN,UDS
S PSJEDT=$S(GMTS2'=9999999:(9999999-GMTS2),1:""),PSJNKF=1
K ^UTILITY("PSG",$J) I '$L($T(ENHS^PSJEEU0)) D NOPSJ Q
D ENHS^PSJEEU0
I '$D(^UTILITY("PSG",$J)) Q
S IX=-9999999,GMI=0
F S IX=$O(^UTILITY("PSG",$J,IX)) Q:'IX S GMR=^(IX) D WRT Q:$D(GMTSQIT)
W !
K ^UTILITY("PSG",$J),^UTILITY("PSIV",$J)
Q
NOPSJ ; Handles case where routine ^PSJEEU0 not installed
D CKP^GMTSUP Q:$D(GMTSQIT) W "Inpatient Pharmacy version 3.2 or greater is required.",!
Q
WRT ; Writes the Unit Dose Component
N SD,FD,DRG,DOSE,GMV,RT,STAT,SIG
S SD=$P(GMR,U),FD=$P(GMR,U,2),DRG=$P($P(GMR,U,3),";",2),STAT=$P($P(GMR,U,5),";")
;
; Don't display data when start date is after
; Date Range To Date and stop date is before
; Date Range End Date. (Need end date because of
; FOR LOOP on $O(^PS(53.1,"AC",DFN,Y)) in PSJEEU0
;
I +$G(GMRANGE),(SD>(9999999-GMTS1))!(FD<(9999999-GMTS2)) Q
F GMV="SD","FD" S X=@GMV D REGDT4^GMTSU S @GMV=X
D CKP^GMTSUP Q:$D(GMTSQIT) W:GMI>0&('GMTSNPG) !
I GMTSNPG!(GMI'>0) D HEAD
S GMI=1
S DOSE=$P(GMR,U,6),RT=$P($P(GMR,U,7),";",3),SIG=$P(GMR,U,8)
D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG HEAD W $E(DRG,1,36),?38,DOSE,?50,STAT,?57,SD,?69,FD,!
D CKP^GMTSUP Q:$D(GMTSQIT) G:GMTSNPG WRT W ?2,SIG," ",RT
Q
HEAD ; Prints Header
D CKP^GMTSUP Q:$D(GMTSQIT)
W "Drug",?38,"Dose",?50,"Status",?59,"Start",?71,"Stop",! W:$Y'>(IOSL-GMTSLO) !
Q
GMTSPSG ; SLC/JER,KER - UD 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 486 ENHS^PSJEEU0
+5 ; DBIA 10141 $$VERSION^XPDUTL
+6 ;
MAIN ; Controls Branching
+1 IF $$VERSION^XPDUTL("PSJ")'<5
GOTO MAIN^GMTSPSG5
+2 NEW GMI,IX,ON,PS,PSIVREA,PSJEDT,PSJNKF,PSJPFWD,GMR,TN,UDS
+3 SET PSJEDT=$SELECT(GMTS2'=9999999:(9999999-GMTS2),1:"")
SET PSJNKF=1
+4 KILL ^UTILITY("PSG",$JOB)
IF '$LENGTH($TEXT(ENHS^PSJEEU0))
DO NOPSJ
QUIT
+5 DO ENHS^PSJEEU0
+6 IF '$DATA(^UTILITY("PSG",$JOB))
QUIT
+7 SET IX=-9999999
SET GMI=0
+8 FOR
SET IX=$ORDER(^UTILITY("PSG",$JOB,IX))
IF 'IX
QUIT
SET GMR=^(IX)
DO WRT
IF $DATA(GMTSQIT)
QUIT
+9 WRITE !
+10 KILL ^UTILITY("PSG",$JOB),^UTILITY("PSIV",$JOB)
+11 QUIT
NOPSJ ; Handles case where routine ^PSJEEU0 not installed
+1 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
WRITE "Inpatient Pharmacy version 3.2 or greater is required.",!
+2 QUIT
WRT ; Writes the Unit Dose Component
+1 NEW SD,FD,DRG,DOSE,GMV,RT,STAT,SIG
+2 SET SD=$PIECE(GMR,U)
SET FD=$PIECE(GMR,U,2)
SET DRG=$PIECE($PIECE(GMR,U,3),";",2)
SET STAT=$PIECE($PIECE(GMR,U,5),";")
+3 ;
+4 ; Don't display data when start date is after
+5 ; Date Range To Date and stop date is before
+6 ; Date Range End Date. (Need end date because of
+7 ; FOR LOOP on $O(^PS(53.1,"AC",DFN,Y)) in PSJEEU0
+8 ;
+9 IF +$GET(GMRANGE)
IF (SD>(9999999-GMTS1))!(FD<(9999999-GMTS2))
QUIT
+10 FOR GMV="SD","FD"
SET X=@GMV
DO REGDT4^GMTSU
SET @GMV=X
+11 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
IF GMI>0&('GMTSNPG)
WRITE !
+12 IF GMTSNPG!(GMI'>0)
DO HEAD
+13 SET GMI=1
+14 SET DOSE=$PIECE(GMR,U,6)
SET RT=$PIECE($PIECE(GMR,U,7),";",3)
SET SIG=$PIECE(GMR,U,8)
+15 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
IF GMTSNPG
DO HEAD
WRITE $EXTRACT(DRG,1,36),?38,DOSE,?50,STAT,?57,SD,?69,FD,!
+16 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
IF GMTSNPG
GOTO WRT
WRITE ?2,SIG," ",RT
+17 QUIT
HEAD ; Prints Header
+1 DO CKP^GMTSUP
IF $DATA(GMTSQIT)
QUIT
+2 WRITE "Drug",?38,"Dose",?50,"Status",?59,"Start",?71,"Stop",!
IF $Y'>(IOSL-GMTSLO)
WRITE !
+3 QUIT