GMRVSR0 ;HIRMFO/RM,YH-VITAL SIGNS RECORD SF 511 ;2/12/99 12:25
;;4.0;Vitals/Measurements;**1,3,7,9,11**;Apr 25, 1997
EN1 ; ENTRY POINT FROM OPTION GMRV SF511, SELECT TYPE OF GRAPH FOR THE REPORT
S (GMRVWLOC,GMROUT,GFLAG,GRAPH)=0 D SELECT^GMRVSR1(.GRAPH) I GRAPH'>0 K GFLAG,GMROUT,GRAPH,GMRVWLOC Q
D WARDPAT^GMRVED0 I GMROUT D Q1 K GFLAG,GMREDB,GMROUT,GMRWARD,DFN,GRAPH Q
PAT I "Pp"[GMREDB D DEM^VADPT S GMRNAM=$P(VADM(1),"^"),SSN=$P(VADM(2),"^",2)
I "Ss"[GMREDB D EN3^GMRVED6
I GMROUT D Q1 K GMREDB,GFLAG,GMROUT,GMRWARD,GRAPH Q
DATE S %DT("A")="Start DATE (TIME optional): ",%DT("B")="T-7",%DT="AETX" D ^%DT K %DT G:+Y'>0 Q1 S GMRSTRT=+Y
S %DT("A")="go to DATE (TIME optional): ",%DT="AETX",%DT("B")="NOW" D ^%DT K %DT G:+Y'>0 Q1 I $P(Y,".",2)'>0,Y=DT D NOW^%DTC S Y=%
I $P(Y,".",2)'>0 S Y=Y_$S(Y[".":"2400",1:".2400")
S (X1,GMRFIN)=+Y,X2=GMRSTRT D ^%DTC
I X<0!(X=0&(((+("."_$P(GMRFIN,".",2))*10000)-((+("."_$P(GMRSTRT,".",2))*10000)))'>0)) W !?5,"Ending date of range needs to be greater that starting date.",!?5,$C(7),"PLEASE REENTER!!" G DATE
D DATELN
DEV S %ZIS="NQ",%ZIS("B")=""
W ! D ^%ZIS G:POP Q1
N GMRVDEV S GMRVDEV=ION_";"_IOST_";"_IOM_";"_IOSL
I IOM'>131 W !!,"Sorry, you must select a DEVICE that can print 132 columns. Try again." G DEV ;device must be 132 columns
I '$D(IO("Q")) S IOP=GMRVDEV K %ZIS D ^%ZIS G Q1:POP,EN2:"Pp"[GMREDB,EN3
I $D(IO("Q")) S ZTDESC="V/M GRAPHIC REPORTS",ZTIO=GMRVDEV,ZTRTN=$S("Pp"[GMREDB:"EN2^GMRVSR0",1:"EN3^GMRVSR0") F G="GRAPH","GMROUT","DFN","GMRROOM(","GMREDB","GMRNAM","SSN","GMRWARD","GMRSTRT","GMRFIN","GMRWARD(","GFLAG","GSTRFIN" S ZTSAVE(G)=""
I $D(IO("Q")) D ^%ZTLOAD,HOME^%ZIS K ZTSK,ZTIO,DFN,GMRLEN,GMRRMST,GMRIFN,GMROUT,GMRSTRT,GMRVLOC,GMRWARD D Q1,Q2 Q
G:'("Pp"[GMREDB) EN3
EN2 ; ENTRY TO PRINT THIS REPORT AFTER IT HAS BEEN QUEUED
; NOTE: THIS REPORT MUST BE QUEUED TO A PRINTER.
N GAPICAL,GRADIAL,GBRACHI S GAPICAL=$O(^GMRD(120.52,"B","APICAL",0)),GRADIAL=$O(^GMRD(120.52,"B","RADIAL",0)),GBRACHI=$O(^GMRD(120.52,"B","BRACHIAL",0))
I IOST["KYOCERA"!(IOST["Kyocera") S GROUTN=$S(GRAPH=1:"EN1^GMRVGR0",GRAPH=2:"EN1^GMRVBP0",GRAPH=3:"EN1^GMRVWT0",GRAPH=4:"EN1^GMRVKPO0",GRAPH=5:"^GMRVKPN0",1:"") D:GROUTN'="" @GROUTN G:"Pp"[GMREDB Q1 Q
I $$UP^XLFSTR(IOST)["HPLASER" S GROUTN=$S(GRAPH=1:"EN1^GMRVHG0",GRAPH=2:"EN1^GMRVHB0",GRAPH=3:"EN1^GMRVHW0",GRAPH=4:"EN1^GMRVHPO0",GRAPH=5:"EN1^GMRVHPN0",1:"") D:GROUTN'="" @GROUTN G:"Pp"[GMREDB Q1 Q
I GRAPH=2 D ^GMRVLBP0 G:"Pp"[GMREDB Q1 Q
I GRAPH=3 D ^GMRVLWT0 G:"Pp"[GMREDB Q1 Q
I GRAPH=4 D ^GMRVLPO0 G:"Pp"[GMREDB Q1 Q
I GRAPH=5 W !!,"Sorry, you must select a Kyocera or HP Laser printer for the Pain Chart." S:'$G(GMRPERR) GMRPERR=1 G:"Pp"[GMREDB Q1 Q
S GMRS=(9999999-GMRFIN)-.0001,GMRQ=9999999-GMRSTRT
F GMRTY="B","P","R","T","H","W","PO2","CVP","CG","PN" D SETT^GMRVSR1
U IO D SF511^GMRVSR1
Q1 K J,G,GMR,GMR3,GMRDAT,GMRDT,GMREN,GMRHDR1,GMRHDR10,GMRHDR11,GMRHDR2,GMRHT,GMRI,GMRJ,GMRK,GMRLINE,GMRMSL,GMRNM,GMROLD,GMRP,GMRPDIF,GMRT,GMRX,GMRTY,GMRPG,GMRPGC,GMRPGS,GMRPHI,GMRPLO,GMRTDIF,GMRTHI,GMRTLO,GMRTNM,GMRX1,GMRX2 D KVAR^VADPT K VA,%T
K GVAR,GMRDIV,GMRHT,GMRQUAL,GMRS,GMRQ,GMRPOFF,GMRTOFF,GMRVWLOC,GMRVX,DIK,%ZIS,%DT,DIPGM,GMRLEN,GMRRMST,GMRVHLOC,GDA,GMRINF,GLINE,GMRVARY,GMRPERR,GMRVPS
W:$E(IOST)="P"!$D(IO("S"))&($$UP^XLFSTR(IOST)'["HPLASER") ! Q:'("Pp"[GMREDB)
Q2 S:$D(ZTQUEUED) ZTREQ="@" K ^TMP($J),GMRII,GMRQUAL,GMREDB,GMROUT,GMRROOM,GMRSTRT,GMRFIN,GMRNAM,GMRRMBD,GMRSITE,GMRVHLOC,GMRWARD,POP,SSN,DFN,ZTIO,ZTSK,GDT,GDTA,GFOUND,GMRAGE,GMRBED,GMRBTH,GMRCOL,GMRHLOC,GMROP,GMRSEX,GMRVADM,GRPT,GSUB,GTYPE1
K GSTRFIN,GMRVFLAG,SNN,GMVRMBD,GMVWRD,GRAPH,GROUTN,GIVDT,GSTAR,GSOL,GN,GNDATE,GNSHFT,GFLAG,ZTSAVE,ZTRTN W:$E(IOST)'="C"&(IOST'["KYOC"!(IOST'["Kyoc")!(IOST'["kyoc")!($$UP^XLFSTR(IOST)'["HPLASER")) @IOF D ^%ZISC Q
EN3 ; ENTRY TO PRINT REPORT FOR ALL OR SELECTED GROUP OF PATIENTS, FOR WARD STORED IN GMRWARD
S GMRPERR=0
D EN1^GMRVED2 S GMRROOM="" F GMRII=0:0 S GMRROOM=$O(^TMP($J,GMRROOM)) Q:GMRROOM="" S GMRNAM="" F GMRII=0:0 S GMRNAM=$O(^TMP($J,GMRROOM,GMRNAM)) Q:GMRNAM="" F DFN=0:0 S DFN=$O(^TMP($J,GMRROOM,GMRNAM,DFN)) Q:DFN'>0 D:DFN>0 PRT
D Q1 G Q2
PRT ;
D DEM^VADPT S SSN=$P(VADM(2),"^",2) Q:$G(GMRPERR)&('$D(IO("Q"))) D EN2
Q
EN4 ; ENTRY POINT IF DFN IS KNOWN TO PRINT THIS REPORT
Q:'$D(DFN) S GRAPH=1,GMREDB="P",GMROUT=0,GMRVHLOC=+ORL D INP^VADPT S GMRWARD(1)=$P(VAIN(4),"^",2),GMRWARD=$P(VAIN(4),"^") G PAT
Q
EN5 ; ENTRY POINT FOR APPLICATION TO GET REPORT. INPUT VARIABLES:
; DFN=PATIENT NUMBER
; GMRDATE=START DATE^FINISH DATE OF REPORT^TYPE OF GRAPH
; (OPTIONAL) GMRVWLO=LOCATION GROUPING OF PATIENT IF DIFFERENT HAN 42 FILE
Q:'$D(DFN)!'$D(GMRDATE)!(DFN'>0) Q:'$P(GMRDATE,"^")!'$P(GMRDATE,"^",2) S GMREDB="A",GMROUT=0,GMRSTRT=$P(GMRDATE,"^"),GMRFIN=$P(GMRDATE,"^",2) D INP^VADPT S GMRWARD(1)=$S($D(GMRVWLO):GMRVWLO,1:$P(VAIN(4),"^",2)),GMRWARD=$P(VAIN(4),"^")
D DATELN S GRAPH=$S($P(GMRDATE,"^",3)>0:+$P(GMRDATE,"^",3),1:1) D EN2 Q
EN6(DFN,GMRDATE) ; APPLICATION PROGRAM INTERFACE FOR SINGLE PATIENT REPORT. INPUT VARIABLES: DFN=PATIENT NUMBER
; GMRDATE=START DATE^FINISH DATE OF REPORT
Q:'$D(DFN)!'$D(GMRDATE) Q:'$P(GMRDATE,U)!'$P(GMRDATE,U,2) S GMREDB="P",GMROUT=0,GMRSTRT=$P(GMRDATE,U),GMRFIN=$P(GMRDATE,U,2) D DEM^VADPT,INP^VADPT S SSN=VA("PID"),GMRWARD=$P(VAIN(4),U),GMRWARD(1)=$P(VAIN(4),U,2)
I IOM'>130 D Q
.S GMRVDVIC=$E(IOST) ;device type chosen by user (e.g., 'C')
.D ^%ZISC
.W !,"THIS REPORT NEEDS 132 COLUMNS",!
.I GMRVDVIC'="C" H 3 ;if device is not a terminal hang 3 seconds
.K GMRVDVIC
.Q
D DATELN S GRAPH=$S($P(GMRDATE,"^",3)>0:+$P(GMRDATE,"^",3),1:1) D EN2 Q
DATELN ;
S Y=GMRSTRT X ^DD("DD") S GSTRFIN=Y S Y=GMRFIN X ^DD("DD") S GSTRFIN=GSTRFIN_" - "_Y Q
GMRVSR0 ;HIRMFO/RM,YH-VITAL SIGNS RECORD SF 511 ;2/12/99 12:25
+1 ;;4.0;Vitals/Measurements;**1,3,7,9,11**;Apr 25, 1997
EN1 ; ENTRY POINT FROM OPTION GMRV SF511, SELECT TYPE OF GRAPH FOR THE REPORT
+1 SET (GMRVWLOC,GMROUT,GFLAG,GRAPH)=0
DO SELECT^GMRVSR1(.GRAPH)
IF GRAPH'>0
KILL GFLAG,GMROUT,GRAPH,GMRVWLOC
QUIT
+2 DO WARDPAT^GMRVED0
IF GMROUT
DO Q1
KILL GFLAG,GMREDB,GMROUT,GMRWARD,DFN,GRAPH
QUIT
PAT IF "Pp"[GMREDB
DO DEM^VADPT
SET GMRNAM=$PIECE(VADM(1),"^")
SET SSN=$PIECE(VADM(2),"^",2)
+1 IF "Ss"[GMREDB
DO EN3^GMRVED6
+2 IF GMROUT
DO Q1
KILL GMREDB,GFLAG,GMROUT,GMRWARD,GRAPH
QUIT
DATE SET %DT("A")="Start DATE (TIME optional): "
SET %DT("B")="T-7"
SET %DT="AETX"
DO ^%DT
KILL %DT
IF +Y'>0
GOTO Q1
SET GMRSTRT=+Y
+1 SET %DT("A")="go to DATE (TIME optional): "
SET %DT="AETX"
SET %DT("B")="NOW"
DO ^%DT
KILL %DT
IF +Y'>0
GOTO Q1
IF $PIECE(Y,".",2)'>0
IF Y=DT
DO NOW^%DTC
SET Y=%
+2 IF $PIECE(Y,".",2)'>0
SET Y=Y_$SELECT(Y[".":"2400",1:".2400")
+3 SET (X1,GMRFIN)=+Y
SET X2=GMRSTRT
DO ^%DTC
+4 IF X<0!(X=0&(((+("."_$PIECE(GMRFIN,".",2))*10000)-((+("."_$PIECE(GMRSTRT,".",2))*10000)))'>0))
WRITE !?5,"Ending date of range needs to be greater that starting date.",!?5,$CHAR(7),"PLEASE REENTER!!"
GOTO DATE
+5 DO DATELN
DEV SET %ZIS="NQ"
SET %ZIS("B")=""
+1 WRITE !
DO ^%ZIS
IF POP
GOTO Q1
+2 NEW GMRVDEV
SET GMRVDEV=ION_";"_IOST_";"_IOM_";"_IOSL
+3 ;device must be 132 columns
IF IOM'>131
WRITE !!,"Sorry, you must select a DEVICE that can print 132 columns. Try again."
GOTO DEV
+4 IF '$DATA(IO("Q"))
SET IOP=GMRVDEV
KILL %ZIS
DO ^%ZIS
IF POP
GOTO Q1
IF "Pp"[GMREDB
GOTO EN2
GOTO EN3
+5 IF $DATA(IO("Q"))
SET ZTDESC="V/M GRAPHIC REPORTS"
SET ZTIO=GMRVDEV
SET ZTRTN=$SELECT("Pp"[GMREDB:"EN2^GMRVSR0",1:"EN3^GMRVSR0")
FOR G="GRAPH","GMROUT","DFN","GMRROOM(","GMREDB","GMRNAM","SSN","GMRWARD","GMRSTRT","GMRFIN","GMRWARD(","GFLAG","GSTRFIN"
SET ZTSAVE(G)=""
+6 IF $DATA(IO("Q"))
DO ^%ZTLOAD
DO HOME^%ZIS
KILL ZTSK,ZTIO,DFN,GMRLEN,GMRRMST,GMRIFN,GMROUT,GMRSTRT,GMRVLOC,GMRWARD
DO Q1
DO Q2
QUIT
+7 IF '("Pp"[GMREDB)
GOTO EN3
EN2 ; ENTRY TO PRINT THIS REPORT AFTER IT HAS BEEN QUEUED
+1 ; NOTE: THIS REPORT MUST BE QUEUED TO A PRINTER.
+2 NEW GAPICAL,GRADIAL,GBRACHI
SET GAPICAL=$ORDER(^GMRD(120.52,"B","APICAL",0))
SET GRADIAL=$ORDER(^GMRD(120.52,"B","RADIAL",0))
SET GBRACHI=$ORDER(^GMRD(120.52,"B","BRACHIAL",0))
+3 IF IOST["KYOCERA"!(IOST["Kyocera")
SET GROUTN=$SELECT(GRAPH=1:"EN1^GMRVGR0",GRAPH=2:"EN1^GMRVBP0",GRAPH=3:"EN1^GMRVWT0",GRAPH=4:"EN1^GMRVKPO0",GRAPH=5:"^GMRVKPN0",1:"")
IF GROUTN'=""
DO @GROUTN
IF "Pp"[GMREDB
GOTO Q1
QUIT
+4 IF $$UP^XLFSTR(IOST)["HPLASER"
SET GROUTN=$SELECT(GRAPH=1:"EN1^GMRVHG0",GRAPH=2:"EN1^GMRVHB0",GRAPH=3:"EN1^GMRVHW0",GRAPH=4:"EN1^GMRVHPO0",GRAPH=5:"EN1^GMRVHPN0",1:"")
IF GROUTN'=""
DO @GROUTN
IF "Pp"[GMREDB
GOTO Q1
QUIT
+5 IF GRAPH=2
DO ^GMRVLBP0
IF "Pp"[GMREDB
GOTO Q1
QUIT
+6 IF GRAPH=3
DO ^GMRVLWT0
IF "Pp"[GMREDB
GOTO Q1
QUIT
+7 IF GRAPH=4
DO ^GMRVLPO0
IF "Pp"[GMREDB
GOTO Q1
QUIT
+8 IF GRAPH=5
WRITE !!,"Sorry, you must select a Kyocera or HP Laser printer for the Pain Chart."
IF '$GET(GMRPERR)
SET GMRPERR=1
IF "Pp"[GMREDB
GOTO Q1
QUIT
+9 SET GMRS=(9999999-GMRFIN)-.0001
SET GMRQ=9999999-GMRSTRT
+10 FOR GMRTY="B","P","R","T","H","W","PO2","CVP","CG","PN"
DO SETT^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MRWARD
+1 SET GMRPERR=0
+2 DO EN1^GMRVED2
SET GMRROOM=""
FOR GMRII=0:0
SET GMRROOM=$ORDER(^TMP($JOB,GMRROOM))
IF GMRROOM=""
QUIT
SET GMRNAM=""
FOR GMRII=0:0
SET GMRNAM=$ORDER(^TMP($JOB,GMRROOM,GMRNAM))
IF GMRNAM=""
QUIT
FOR DFN=0:0
SET DFN=$ORDER(^TMP($JOB,GMRROOM,GMRNAM,DFN))
IF DFN'>0
QUIT
IF DFN>0
DO PRT
+3 DO Q1
GOTO Q2
PRT ;
+1 DO DEM^VADPT
SET SSN=$PIECE(VADM(2),"^",2)
IF $GET(GMRPERR)&('$DATA(IO("Q")))
QUIT
DO EN2
+2 QUIT
EN4 ; ENTRY POINT IF DFN IS KNOWN TO PRINT THIS REPORT
+1 IF '$DATA(DFN)
QUIT
SET GRAPH=1
SET GMREDB="P"
SET GMROUT=0
SET GMRVHLOC=+ORL
DO INP^VADPT
SET GMRWARD(1)=$PIECE(VAIN(4),"^",2)
SET GMRWARD=$PIECE(VAIN(4),"^")
GOTO PAT
+2 QUIT
EN5 ; ENTRY POINT FOR APPLICATION TO GET REPORT. INPUT VARIABLES:
+1 ; DFN=PATIENT NUMBER
+2 ; GMRDATE=START DATE^FINISH DATE OF REPORT^TYPE OF GRAPH
+3 ; (OPTIONAL) GMRVWLO=LOCATION GROUPING OF PATIENT IF DIFFERENT HAN 42 FILE
+4 IF '$DATA(DFN)!'$DATA(GMRDATE)!(DFN'>0)
QUIT
IF '$PIECE(GMRDATE,"^")!'$PIECE(GMRDATE,"^",2)
QUIT
SET GMREDB="A"
SET GMROUT=0
SET GMRSTRT=$PIECE(GMRDATE,"^")
SET GMRFIN=$PIECE(GMRDATE,"^",2)
DO INP^VADPT
SET GMRWARD(1)=$SELECT($DATA(GMRVWLO):GMRVWLO,1:$PIECE(VAIN(4),"^",2))
SET GMRWARD=$PIECE(VAIN(4),"^")
+5 DO DATELN
SET GRAPH=$SELECT($PIECE(GMRDATE,"^",3)>0:+$PIECE(GMRDATE,"^",3),1:1)
DO EN2
QUIT
EN6(DFN,GMRDATE) ; APPLICATION PROGRAM INTERFACE FOR SINGLE PATIENT REPORT. INPUT VARIABLES: DFN=PATIENT NUMBER
+1 ; GMRDATE=START DATE^FINISH DATE OF REPORT
+2 IF '$DATA(DFN)!'$DATA(GMRDATE)
QUIT
IF '$PIECE(GMRDATE,U)!'$PIECE(GMRDATE,U,2)
QUIT
SET GMREDB="P"
SET GMROUT=0
SET GMRSTRT=$PIECE(GMRDATE,U)
SET GMRFIN=$PIECE(GMRDATE,U,2)
DO DEM^VADPT
DO INP^VADPT
SET SSN=VA("PID")
SET GMRWARD=$PIECE(VAIN(4),U)
SET GMRWARD(1)=$PIECE(VAIN(4),U,2)
+3 IF IOM'>130
Begin DoDot:1
+4 ;device type chosen by user (e.g., 'C')
SET GMRVDVIC=$EXTRACT(IOST)
+5 DO ^%ZISC
+6 WRITE !,"THIS REPORT NEEDS 132 COLUMNS",!
+7 ;if device is not a terminal hang 3 seconds
IF GMRVDVIC'="C"
HANG 3
+8 KILL GMRVDVIC
+9 QUIT
End DoDot:1
QUIT
+10 DO DATELN
SET GRAPH=$SELECT($PIECE(GMRDATE,"^",3)>0:+$PIECE(GMRDATE,"^",3),1:1)
DO EN2
QUIT
DATELN ;
+1 SET Y=GMRSTRT
XECUTE ^DD("DD")
SET GSTRFIN=Y
SET Y=GMRFIN
XECUTE ^DD("DD")
SET GSTRFIN=GSTRFIN_" - "_Y
QUIT