GMVSR0 ;HOIFO/RM,YH,FT-VITAL SIGNS RECORD SF 511 ;6/6/07
;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
;
; This routine uses the following IAs:
; #10039 - FILE 42 references (supported)
; #10061 - ^VADPT calls (supported)
; #10103 - ^XLFDT calls (supported)
; #10104 - ^XLFSTR calls (supported)
;
EN1(RESULT,GMVDATA) ; GMV PT GRAPH [RPC entry point]
; Queues a graphic report to a printer
; GMVDATA=DFN^START DT^END DT^TYPE OF GRAPH^DEVICE^DEVICE IEN(#3.5)^
; DATE/TIME TO PRINT REPORT^WARD IEN^LOCATION IEN^ROOM LIST
;
; DFN - patient internal entry number
; GMRSTRT - start date/time of report range (FileMan format)
; GMRFIN - end date/time of report range (FileMan format)
; GRAPH - number of the graph (1-5)
; GMVDEV - device name
; GMVIEN - device internal entry number
; GMVPDT - date/time to print the report
; GMVWARD - ward internal entry number
; GMVHLOC - hospital location internal entry number
; GMVRMLST - list of rooms separated by a comma (e.g., 210,220,230)
;
S RESULT="This report is no longer available. Please right click on the data grid and use 'Print Graph' instead."
Q
N DFN,G,GMROUT,GFLAG,GRAPH,GMRSTRT,GMRFIN,GMVPDT,GMVDEV,GMVIEN,GMREDB
N GMRLEN,GMVHLOC,GMRWARD,GMVRMLST,GSTRFIN,GMVDEVUC
S DFN=+$P(GMVDATA,"^"),GMRSTRT=$P(GMVDATA,"^",2),GMRFIN=$P(GMVDATA,"^",3),GRAPH=$P(GMVDATA,"^",4),GMVDEV=$P(GMVDATA,"^",5),GMVIEN=+$P(GMVDATA,"^",6),GMVPDT=$P(GMVDATA,"^",7)
S GMRWARD=$P(GMVDATA,"^",8),GMVHLOC=$P(GMVDATA,"^",9),GMVRMLST=$P(GMVDATA,"^",10)
S (GMROUT,GFLAG)=0
S ZTIO=GMVDEV ;device
S ZTDTH=$S($G(GMVPDT)>0:GMVPDT,1:$$NOW^XLFDT()) ;date/time to print
D:GRAPH<6 DATELN^GMVSR0
S GMREDB=$S(DFN>0:"P",GMVRMLST'="":"S",1:"A")
S GMRWARD(1)=$S(GMRWARD>0:$P($G(^DIC(42,GMRWARD,0)),U,1),1:"") ;ward name
I $G(GMREDB)="P" D
.D DEM^VADPT S GMRNAM=$P(VADM(1),"^"),SSN=$E($P(VADM(2),"^",2),8,11)
.D INP^VADPT ;get inpatient data
.S GMRWARD(1)=$P(VAIN(4),U,2),GMRWARD=$P(VAIN(4),U) ;inpatient location
.S GMRRMBD=$S(VAIN(5)'="":VAIN(5),1:" BLANK") ;roombed
.D KVAR^VADPT K VA
.Q
DEV ;
S GMVDEVUC=$$UP^XLFSTR(GMVDEV) ;device name in uppercase
I GRAPH=5,GMVDEVUC'["KYOCERA",GMVDEVUC'["HPLASER",GMVDEVUC'["HP LASER" D Q
.S RESULT="Sorry, you must select a Kyocera or HP Laser printer for the Pain Chart."
.Q
S ZTRTN=$S(GMREDB="P":"EN2^GMVSR0",1:"EN3^GMVSR0")
S ZTDESC="V/M GRAPHIC REPORTS"
F G="GRAPH","GMROUT","DFN","GMREDB","GMRNAM","SSN","GMRWARD","GMRSTRT","GMRFIN","GMRWARD(","GFLAG","GSTRFIN","GMREDB","GMVRMLST" S ZTSAVE(G)=""
D ^%ZTLOAD
S RESULT=$S($G(ZTSK)>0:"Report sent to device. Task #: "_ZTSK,1:"Unable to task the report.")
K ZTSK,ZTIO,ZTRTN,ZTDESC,ZTSAVE,ZTDTH
Q
EN2 ; Start the graphic report
; Note: Graphic reports must go to a printer
S:$D(ZTQUEUED) ZTREQ="@"
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^GMVGR0",GRAPH=2:"EN1^GMVBP0",GRAPH=3:"EN1^GMVWT0",GRAPH=4:"EN1^GMVKPO0",GRA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,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,X,Y
D ^%ZISC
Q
EN3 ; Entry to print report for all or selected group of patients,
; for ward stored in GMRWARD
S GMRPERR=0
S GMVWARD=GMRWARD ;ward ien
S GMVWARD(1)=GMRWARD(1) ;ward name
S GMVEDB=GMREDB ;A - all patients, S - selected rooms, P - 1 patient
; if selected roombeds, then set up GMVROOM array
I $L(GMVRMLST)>0 D
.F GMVLOOP=1:1 Q:$P(GMVRMLST,",",GMVLOOP)="" D
..S GMVROOM($P(GMVRMLST,",",GMVLOOP))=""
..Q
.Q
D WARD^GMVDS1 ;creates TMP global w/patients in ward or rooms
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
;
DATELN ;
S Y=GMRSTRT
X ^DD("DD")
S GSTRFIN=Y
S Y=GMRFIN
X ^DD("DD")
S GSTRFIN=GSTRFIN_" - "_Y
Q
GMVSR0 ;HOIFO/RM,YH,FT-VITAL SIGNS RECORD SF 511 ;6/6/07
+1 ;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
+2 ;
+3 ; This routine uses the following IAs:
+4 ; #10039 - FILE 42 references (supported)
+5 ; #10061 - ^VADPT calls (supported)
+6 ; #10103 - ^XLFDT calls (supported)
+7 ; #10104 - ^XLFSTR calls (supported)
+8 ;
EN1(RESULT,GMVDATA) ; GMV PT GRAPH [RPC entry point]
+1 ; Queues a graphic report to a printer
+2 ; GMVDATA=DFN^START DT^END DT^TYPE OF GRAPH^DEVICE^DEVICE IEN(#3.5)^
+3 ; DATE/TIME TO PRINT REPORT^WARD IEN^LOCATION IEN^ROOM LIST
+4 ;
+5 ; DFN - patient internal entry number
+6 ; GMRSTRT - start date/time of report range (FileMan format)
+7 ; GMRFIN - end date/time of report range (FileMan format)
+8 ; GRAPH - number of the graph (1-5)
+9 ; GMVDEV - device name
+10 ; GMVIEN - device internal entry number
+11 ; GMVPDT - date/time to print the report
+12 ; GMVWARD - ward internal entry number
+13 ; GMVHLOC - hospital location internal entry number
+14 ; GMVRMLST - list of rooms separated by a comma (e.g., 210,220,230)
+15 ;
+16 SET RESULT="This report is no longer available. Please right click on the data grid and use 'Print Graph' instead."
+17 QUIT
+18 NEW DFN,G,GMROUT,GFLAG,GRAPH,GMRSTRT,GMRFIN,GMVPDT,GMVDEV,GMVIEN,GMREDB
+19 NEW GMRLEN,GMVHLOC,GMRWARD,GMVRMLST,GSTRFIN,GMVDEVUC
+20 SET DFN=+$PIECE(GMVDATA,"^")
SET GMRSTRT=$PIECE(GMVDATA,"^",2)
SET GMRFIN=$PIECE(GMVDATA,"^",3)
SET GRAPH=$PIECE(GMVDATA,"^",4)
SET GMVDEV=$PIECE(GMVDATA,"^",5)
SET GMVIEN=+$PIECE(GMVDATA,"^",6)
SET GMVPDT=$PIECE(GMVDATA,"^",7)
+21 SET GMRWARD=$PIECE(GMVDATA,"^",8)
SET GMVHLOC=$PIECE(GMVDATA,"^",9)
SET GMVRMLST=$PIECE(GMVDATA,"^",10)
+22 SET (GMROUT,GFLAG)=0
+23 ;device
SET ZTIO=GMVDEV
+24 ;date/time to print
SET ZTDTH=$SELECT($GET(GMVPDT)>0:GMVPDT,1:$$NOW^XLFDT())
+25 IF GRAPH<6
DO DATELN^GMVSR0
+26 SET GMREDB=$SELECT(DFN>0:"P",GMVRMLST'="":"S",1:"A")
+27 ;ward name
SET GMRWARD(1)=$SELECT(GMRWARD>0:$PIECE($GET(^DIC(42,GMRWARD,0)),U,1),1:"")
+28 IF $GET(GMREDB)="P"
Begin DoDot:1
+29 DO DEM^VADPT
SET GMRNAM=$PIECE(VADM(1),"^")
SET SSN=$EXTRACT($PIECE(VADM(2),"^",2),8,11)
+30 ;get inpatient data
DO INP^VADPT
+31 ;inpatient location
SET GMRWARD(1)=$PIECE(VAIN(4),U,2)
SET GMRWARD=$PIECE(VAIN(4),U)
+32 ;roombed
SET GMRRMBD=$SELECT(VAIN(5)'="":VAIN(5),1:" BLANK")
+33 DO KVAR^VADPT
KILL VA
+34 QUIT
End DoDot:1
DEV ;
+1 ;device name in uppercase
SET GMVDEVUC=$$UP^XLFSTR(GMVDEV)
+2 IF GRAPH=5
IF GMVDEVUC'["KYOCERA"
IF GMVDEVUC'["HPLASER"
IF GMVDEVUC'["HP LASER"
Begin DoDot:1
+3 SET RESULT="Sorry, you must select a Kyocera or HP Laser printer for the Pain Chart."
+4 QUIT
End DoDot:1
QUIT
+5 SET ZTRTN=$SELECT(GMREDB="P":"EN2^GMVSR0",1:"EN3^GMVSR0")
+6 SET ZTDESC="V/M GRAPHIC REPORTS"
+7 FOR G="GRAPH","GMROUT","DFN","GMREDB","GMRNAM","SSN","GMRWARD","GMRSTRT","GMRFIN","GMRWARD(","GFLAG","GSTRFIN","GMREDB","GMVRMLST"
SET ZTSAVE(G)=""
+8 DO ^%ZTLOAD
+9 SET RESULT=$SELECT($GET(ZTSK)>0:"Report sent to device. Task #: "_ZTSK,1:"Unable to task the report.")
+10 KILL ZTSK,ZTIO,ZTRTN,ZTDESC,ZTSAVE,ZTDTH
+11 QUIT
EN2 ; Start the graphic report
+1 ; Note: Graphic reports must go to a printer
+2 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+3 NEW GAPICAL,GRADIAL,GBRACHI
+4 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))
+5 IF IOST["KYOCERA"!(IOST["Kyocera")
SET GROUTN=$SELECT(GRAPH=1:"EN1^GMVGR0",GRAPH=2:"EN1^GMVBP0",GRAPH=3:"EN1^GMVWT0",GRAPH=4:"EN1^GMVKPO0",GRAPH=5:"^GMVKPN0",1:"")
IF GROUTN'=""
DO @GROUTN
IF "Pp"[GMREDB
GOTO Q1
QUIT
+6 IF $$UP^XLFSTR(IOST)["HPLASER"
SET GROUTN=$SELECT(GRAPH=1:"EN1^GMVHG0",GRAPH=2:"EN1^GMVHB0",GRAPH=3:"EN1^GMVHW0",GRAPH=4:"EN1^GMVHPO0",GRAPH=5:"EN1^GMVHPN0",1:"")
IF GROUTN'=""
DO @GROUTN
IF "Pp"[GMREDB
GOTO Q1
QUIT
+7 IF GRAPH=2
DO ^GMVLBP0
IF "Pp"[GMREDB
GOTO Q1
QUIT
+8 IF GRAPH=3
DO ^GMVLWT0
IF "Pp"[GMREDB
GOTO Q1
QUIT
+9 IF GRAPH=4
DO ^GMVLPO0
IF "Pp"[GMREDB
GOTO Q1
QUIT
+10 IF GRAPH=5
IF '$GET(GMRPERR)
SET GMRPERR=1
IF "Pp"[GMREDB
GOTO Q1
QUIT
+11 SET GMRS=GMRSTRT-.0001
SET GMRQ=GMRFIN
+12 FOR GMRTY="B","P","R","T","H","W","PO2","CVP","CG","PN"
DO SETT^GMVSR1
+13 USE IO
DO SF511^GMVSR1
Q1 ;
+1 KILL 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
+2 DO KVAR^VADPT
KILL VA,%T
+3 KILL GVAR,GMRDIV,GMRHT,GMRQUAL,GMRS,GMRQ,GMRPOFF,GMRTOFF,GMRVWLOC,GMRVX,DIK,%ZIS,%DT,DIPGM,GMRLEN,GMRRMST,GMRVHLOC,GDA,GMRINF,GLINE,GMRVARY,GMRPERR,GMRVPS,GMVROOM,GMVWARD,GMVLOOP
+4 IF $EXTRACT(IOST)="P"!$DATA(IO("S"))&($$UP^XLFSTR(IOST)'["HPLASER")
WRITE !
+5 IF '("Pp"[GMREDB)
QUIT
Q2 ;
+1 KILL ^TMP($JOB),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
+2 KILL GSTRFIN,GMRVFLAG,SNN,GMVRMBD,GMVWRD,GRAPH,GROUTN,GIVDT,GSTAR,GSOL,GN,GNDATE,GNSHFT,GFLAG,X,Y
+3 DO ^%ZISC
+4 QUIT
EN3 ; Entry to print report for all or selected group of patients,
+1 ; for ward stored in GMRWARD
+2 SET GMRPERR=0
+3 ;ward ien
SET GMVWARD=GMRWARD
+4 ;ward name
SET GMVWARD(1)=GMRWARD(1)
+5 ;A - all patients, S - selected rooms, P - 1 patient
SET GMVEDB=GMREDB
+6 ; if selected roombeds, then set up GMVROOM array
+7 IF $LENGTH(GMVRMLST)>0
Begin DoDot:1
+8 FOR GMVLOOP=1:1
IF $PIECE(GMVRMLST,",",GMVLOOP)=""
QUIT
Begin DoDot:2
+9 SET GMVROOM($PIECE(GMVRMLST,",",GMVLOOP))=""
+10 QUIT
End DoDot:2
+11 QUIT
End DoDot:1
+12 ;creates TMP global w/patients in ward or rooms
DO WARD^GMVDS1
+13 SET GMRROOM=""
+14 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
+15 DO Q1
+16 GOTO Q2
+17 ;
PRT ;
+1 DO DEM^VADPT
+2 SET SSN=$PIECE(VADM(2),"^",2)
IF $GET(GMRPERR)&('$DATA(IO("Q")))
QUIT
+3 DO EN2
+4 QUIT
+5 ;
DATELN ;
+1 SET Y=GMRSTRT
+2 XECUTE ^DD("DD")
+3 SET GSTRFIN=Y
+4 SET Y=GMRFIN
+5 XECUTE ^DD("DD")
+6 SET GSTRFIN=GSTRFIN_" - "_Y
+7 QUIT