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) 
 ;
 
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
 
GMRLEN,GMVHLOC,GMRWARD,GMVRMLST,GSTRFIN,GMVDEVUC
 
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)
 
GMRWARD=$P(GMVDATA,"^",8),GMVHLOC=$P(GMVDATA,"^",9),GMVRMLST=$P(GMVDATA,"^",10)
 
(GMROUT,GFLAG)=0
 
ZTIO=GMVDEV ;device
 
ZTDTH=$S($G(GMVPDT)>0:GMVPDT,1:$$NOW^XLFDT()) ;date/time to print
 
D:GRAPH<6 DATELN^GMVSR0
 
GMREDB=$S(DFN>0:"P",GMVRMLST'="":"S",1:"A")
 
GMRWARD(1)=$S(GMRWARD>0:$P($G(^DIC(42,GMRWARD,0)),U,1),1:"";ward name
 
I $G(GMREDB)="P" D
 
.DEM^VADPT GMRNAM=$P(VADM(1),"^"),SSN=$E($P(VADM(2),"^",2),8,11)
 .
INP^VADPT ;get inpatient data
 
.GMRWARD(1)=$P(VAIN(4),U,2),GMRWARD=$P(VAIN(4),U;inpatient location
 
.GMRRMBD=$S(VAIN(5)'="":VAIN(5),1:"  BLANK";roombed
 
.KVAR^VADPT VA
 
.Q
DEV ;
 
GMVDEVUC=$$UP^XLFSTR(GMVDEV;device name in uppercase
 
GRAPH=5,GMVDEVUC'["KYOCERA",GMVDEVUC'["HPLASER",GMVDEVUC'["HP LASER" D  Q
 
.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")
 
ZTDESC="V/M GRAPHIC REPORTS"
 
G="GRAPH","GMROUT","DFN","GMREDB","GMRNAM","SSN","GMRWARD","GMRSTRT","GMRFIN","GMRWARD(","GFLAG","GSTRFIN","GMREDB","GMVRMLST" ZTSAVE(G)=""
 
^%ZTLOAD
 
RESULT=$S($G(ZTSK)>0:"Report sent to device. Task #: "_ZTSK,1:"Unable to task the report.")
 
ZTSK,ZTIO,ZTRTN,ZTDESC,ZTSAVE,ZTDTH
 
Q
EN2 ; Start the graphic report
 ; Note: Graphic reports must go to a printer
 
S:$D(ZTQUEUEDZTREQ="@"
 
GAPICAL,GRADIAL,GBRACHI
 
GAPICAL=$O(^GMRD(120.52,"B","APICAL",0)),GRADIAL=$O(^GMRD(120.52,"B","RADIAL",0)),GBRACHI=$O(^GMRD(120.52,"B","BRACHIAL",0))
 
IOST["KYOCERA"!(IOST["Ky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"!$D(IO("S"))&($$UP^XLFSTR(IOST)'["HPLASER") !
 
Q:'("Pp"[GMREDB)
Q2 ;
 
^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
 
GSTRFIN,GMRVFLAG,SNN,GMVRMBD,GMVWRD,GRAPH,GROUTN,GIVDT,GSTAR,GSOL,GN,GNDATE,GNSHFT,GFLAG,X,Y
 
^%ZISC
 
Q
EN3 ; Entry to print report for all or selected group of patients,
 ; for ward stored in GMRWARD
 
GMRPERR=0
 
GMVWARD=GMRWARD ;ward ien
 
GMVWARD(1)=GMRWARD(1) ;ward name
 
GMVEDB=GMREDB ;A - all patients, S - selected rooms, P - 1 patient
 ; if selected roombeds, then set up GMVROOM array
 
I $L(GMVRMLST)>0 D
 
.GMVLOOP=1:1 Q:$P(GMVRMLST,",",GMVLOOP)=""  D
 
..GMVROOM($P(GMVRMLST,",",GMVLOOP))=""
 
..Q
 
.Q
 D 
WARD^GMVDS1 ;creates TMP global w/patients in ward or rooms 
 
GMRROOM=""
 
GMRII=0:0 GMRROOM=$O(^TMP($J,GMRROOM)) Q:GMRROOM=""  GMRNAM="" GMRII=0:0 GMRNAM=$O(^TMP($J,GMRROOM,GMRNAM)) Q:GMRNAM=""  DFN=0:0 DFN=$O(^TMP($J,GMRROOM,GMRNAM,DFN)) Q:DFN'>0  D:DFN>0 PRT
 
Q1
 
Q2
 
;
PRT ;
 
DEM^VADPT
 
SSN=$P(VADM(2),"^",2) Q:$G(GMRPERR)&('$D(IO("Q")))
 
EN2
 
Q
 
;
DATELN ;
 
Y=GMRSTRT
 
^DD("DD")
 
GSTRFIN=Y
 
Y=GMRFIN
 
^DD("DD")
 
GSTRFIN=GSTRFIN_" - "_Y
 
Q