GMVSC0 ;HOIFO/MD,YH,FT-CUMULATIVE VITALS/MEASUREMENTS FOR PATIENT OVER GIVEN DATE RANGE ;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)
;
EN1(RESULT,GMVDATA) ; GMV CUMULATIVE REPORT [RPC entry point]
; Cumulative Vitals Report
; DFN - patient internal entry number (FILE 2)
; GMRVSDT - start date/time of report range
; GMRVFDT - end date/time of report range
; GMVDEV - device name
; GMVIEN - device internal entry name (FILE 3.5)
; GMVPDT - date/time to print the report
; GMVWARD - ward internal entry number (FILE 42)
; GMVHLOC - hospital location internal entry number (FILE 44)
; GMVRMLST - list of room numbers separated by commas (e.g., 200,210)
;
N DFN,GMRVSDT,GMRVFDT,GMVDEV,GMVIEN,GMVPDT,GMVWARD,GMVHLOC,GMVRMLST
S DFN=$P(GMVDATA,U,1),GMRVSDT=$P(GMVDATA,U,2),GMRVFDT=$P(GMVDATA,U,3),GMVDEV=$P(GMVDATA,U,5),GMVIEN=+$P(GMVDATA,U,6),GMVPDT=$P(GMVDATA,U,7),GMVWARD=$P(GMVDATA,U,8),GMVHLOC=$P(GMVDATA,U,9),GMVRMLST=$P(GMVDATA,U,10)
S ZTIO=GMVDEV ;device
S ZTDTH=$S($G(GMVPDT)>0:GMVPDT,1:$$NOW^XLFDT()) ;date/time to print
S (ZTSAVE("DFN"),ZTSAVE("GMRVSDT"),ZTSAVE("GMRVFDT"))=""
S (ZTSAVE("GMVWARD"),ZTSAVE("GMVHLOC"),ZTSAVE("GMVRMLST"))=""
S ZTDESC="Cumulative vital/measurement report"
S ZTRTN="START^GMVSC0"
D ^%ZTLOAD
S RESULT=$S($G(ZTSK)>0:"Report sent to device. Task #: "_ZTSK,1:"Unable to task the report.")
K ZTSK,ZTIO,ZTDTH,ZTSAVE,ZTDESC,ZTRTN
Q
START ; Start the report output
S:$D(ZTQUEUED) ZTREQ="@"
; 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
S GMVEDB=$S(DFN>0:"P",GMVRMLST]"":"S",1:"A") ;P is one patient, A is whole ward, S is selected rooms
S GMVWARD(1)=$S(GMVWARD>0:$P($G(^DIC(42,GMVWARD,0)),U,1),1:"") ;ward name
I $G(GMVEDB)="P" D
.D DEM^VADPT,INP^VADPT
.S GMRRMBD=$S(VAIN(5)'="":VAIN(5),1:" BLANK") ;roombed
.S GMVNAME=$S(VADM(1)'="":VADM(1),1:" BLANK") ;patient name
.S GMVWARD=$P(VAIN(4),"^") ;ward ien
.S GMVWARD(1)=$P(VAIN(4),"^",2) ;ward name
.D KVAR^VADPT K VA ;kill VADPT variables
.S ^TMP($J,GMRRMBD,GMVNAME,DFN)=""
E D WARD^GMVDS1 ;returns TMP global with list of patients
S (GMROUT,GMRPG)=0
S GMVRANGE=$$FMTE^XLFDT(GMRVSDT)_"-"_$$FMTE^XLFDT(GMRVFDT)
D NOW^%DTC S Y=% D D^DIQ
S GMRPDT=$P(Y,"@")_" ("_$P($P(Y,"@",2),":",1,2)_")"
S $P(GMRDSH,"-",80)=""
U IO
S GMRRMBD=""
N GPEDIS S GPEDIS=$O(^GMRD(120.52,"B","DORSALIS PEDIS",0)) Q:GPEDIS'>0
F S GMRRMBD=$O(^TMP($J,GMRRMBD)) Q:GMRRMBD=""!GMROUT S GMRNAM="" F S GMRNAM=$O(^TMP($J,GMRRMBD,GMRNAM)) Q:GMRNAM=""!GMROUT S DFN=0 F S DFN=$O(^TMP($J,GMRRMBD,GMRNAM,DFN)) Q:DFN'>0!GMROUT S GMRPG=0 D WRT Q:GMROUT D EN1^GMVSC1
Q ; kill variables and quit
D Q^GMVSC1
K ^TMP($J)
K GMRBMI,GMRVHT,GMRINF,GMRPG,GMREDB,GMRNAM,GMRRMBD,GMRVWLOC,GMRWARD,GMRMSL,GMRROOM,GMRRMST,GMRVHLOC,GMRLEN,GMRI,GMROUT,GMRVSDT,GMRVFDT,GPRT,GMVLOOP
K GMVRMLST,GMVRANGE
D ^%ZISC
Q
W !!,"*** (E) - Error entry",!! W:VADM(1)'="" ?$X-3,$E(VADM(1),1,15) W:VADM(2)'="" ?17,$E($P(VADM(2),"^",2),8,11) W:VADM(3)'="" ?30,$P(VADM(3),"^",2) W:VADM(4)'="" ?43,$P(VADM(4),"^")_" YRS"
W:VADM(5)'="" ?51,$P(VADM(5),"^",2)
W ?65,"VAF 10-7987j" W !,"Unit: "_$S($P(VAIN(4),"^",2)'="":$P(VAIN(4),"^",2),1:" "),?32,"Room: "_$S($P(VAIN(5),"^")'="":$P(VAIN(5),"^"),1:" "),!
I '$D(GMRVHLOC) S GMRVHLOC=$$HOSPLOC^GMVUTL1(+$G(VAIN(4)))
W "Division: "_$$DIVISION^GMVUTL1(+GMRVHLOC),!
Q
WRT ;
S GMR1ST=1
K GMRSITE
D DEM^VADPT,INP^VADPT
S GWARD=$S($P(VAIN(4),"^",2)'="":$P(VAIN(4),"^",2),1:" ")
S GBED=$S(VAIN(5)'="":$P(VAIN(5),"^"),1:" ")
D HDR^GMVSC2
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMVSC0 3941 printed Nov 22, 2024@17:10:01 Page 2
GMVSC0 ;HOIFO/MD,YH,FT-CUMULATIVE VITALS/MEASUREMENTS FOR PATIENT OVER GIVEN DATE RANGE ;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 ;
EN1(RESULT,GMVDATA) ; GMV CUMULATIVE REPORT [RPC entry point]
+1 ; Cumulative Vitals Report
+2 ; DFN - patient internal entry number (FILE 2)
+3 ; GMRVSDT - start date/time of report range
+4 ; GMRVFDT - end date/time of report range
+5 ; GMVDEV - device name
+6 ; GMVIEN - device internal entry name (FILE 3.5)
+7 ; GMVPDT - date/time to print the report
+8 ; GMVWARD - ward internal entry number (FILE 42)
+9 ; GMVHLOC - hospital location internal entry number (FILE 44)
+10 ; GMVRMLST - list of room numbers separated by commas (e.g., 200,210)
+11 ;
+12 NEW DFN,GMRVSDT,GMRVFDT,GMVDEV,GMVIEN,GMVPDT,GMVWARD,GMVHLOC,GMVRMLST
+13 SET DFN=$PIECE(GMVDATA,U,1)
SET GMRVSDT=$PIECE(GMVDATA,U,2)
SET GMRVFDT=$PIECE(GMVDATA,U,3)
SET GMVDEV=$PIECE(GMVDATA,U,5)
SET GMVIEN=+$PIECE(GMVDATA,U,6)
SET GMVPDT=$PIECE(GMVDATA,U,7)
SET GMVWARD=$PIECE(GMVDATA,U,8)
SET GMVHLOC=$PIECE(GMVDATA,U,9)
SET GMVRMLST=$PIECE(GMVDATA,U,10)
+14 ;device
SET ZTIO=GMVDEV
+15 ;date/time to print
SET ZTDTH=$SELECT($GET(GMVPDT)>0:GMVPDT,1:$$NOW^XLFDT())
+16 SET (ZTSAVE("DFN"),ZTSAVE("GMRVSDT"),ZTSAVE("GMRVFDT"))=""
+17 SET (ZTSAVE("GMVWARD"),ZTSAVE("GMVHLOC"),ZTSAVE("GMVRMLST"))=""
+18 SET ZTDESC="Cumulative vital/measurement report"
+19 SET ZTRTN="START^GMVSC0"
+20 DO ^%ZTLOAD
+21 SET RESULT=$SELECT($GET(ZTSK)>0:"Report sent to device. Task #: "_ZTSK,1:"Unable to task the report.")
+22 KILL ZTSK,ZTIO,ZTDTH,ZTSAVE,ZTDESC,ZTRTN
+23 QUIT
START ; Start the report output
+1 if $DATA(ZTQUEUED)
SET ZTREQ="@"
+2 ; if selected roombeds, then set up GMVROOM array
+3 IF $LENGTH(GMVRMLST)>0
Begin DoDot:1
+4 FOR GMVLOOP=1:1
if $PIECE(GMVRMLST,",",GMVLOOP)=""
QUIT
Begin DoDot:2
+5 SET GMVROOM($PIECE(GMVRMLST,",",GMVLOOP))=""
+6 QUIT
End DoDot:2
+7 QUIT
End DoDot:1
+8 ;P is one patient, A is whole ward, S is selected rooms
SET GMVEDB=$SELECT(DFN>0:"P",GMVRMLST]"":"S",1:"A")
+9 ;ward name
SET GMVWARD(1)=$SELECT(GMVWARD>0:$PIECE($GET(^DIC(42,GMVWARD,0)),U,1),1:"")
+10 IF $GET(GMVEDB)="P"
Begin DoDot:1
+11 DO DEM^VADPT
DO INP^VADPT
+12 ;roombed
SET GMRRMBD=$SELECT(VAIN(5)'="":VAIN(5),1:" BLANK")
+13 ;patient name
SET GMVNAME=$SELECT(VADM(1)'="":VADM(1),1:" BLANK")
+14 ;ward ien
SET GMVWARD=$PIECE(VAIN(4),"^")
+15 ;ward name
SET GMVWARD(1)=$PIECE(VAIN(4),"^",2)
+16 ;kill VADPT variables
DO KVAR^VADPT
KILL VA
+17 SET ^TMP($JOB,GMRRMBD,GMVNAME,DFN)=""
End DoDot:1
+18 ;returns TMP global with list of patients
IF '$TEST
DO WARD^GMVDS1
+19 SET (GMROUT,GMRPG)=0
+20 SET GMVRANGE=$$FMTE^XLFDT(GMRVSDT)_"-"_$$FMTE^XLFDT(GMRVFDT)
+21 DO NOW^%DTC
SET Y=%
DO D^DIQ
+22 SET GMRPDT=$PIECE(Y,"@")_" ("_$PIECE($PIECE(Y,"@",2),":",1,2)_")"
+23 SET $PIECE(GMRDSH,"-",80)=""
+24 USE IO
+25 SET GMRRMBD=""
+26 NEW GPEDIS
SET GPEDIS=$ORDER(^GMRD(120.52,"B","DORSALIS PEDIS",0))
if GPEDIS'>0
QUIT
+27 FOR
SET GMRRMBD=$ORDER(^TMP($JOB,GMRRMBD))
if GMRRMBD=""!GMROUT
QUIT
SET GMRNAM=""
FOR
SET GMRNAM=$ORDER(^TMP($JOB,GMRRMBD,GMRNAM))
if GMRNAM=""!GMROUT
QUIT
SET DFN=0
FOR
SET DFN=$ORDER(^TMP($JOB,GMRRMBD,GMRNAM,DFN))
if DFN'>0!GMROUT
QUIT
SET GMRPG=0
DO WRT
if GMROUT
QUIT
DO EN1^GMVSC1
Q ; kill variables and quit
+1 DO Q^GMVSC1
+2 KILL ^TMP($JOB)
+3 KILL GMRBMI,GMRVHT,GMRINF,GMRPG,GMREDB,GMRNAM,GMRRMBD,GMRVWLOC,GMRWARD,GMRMSL,GMRROOM,GMRRMST,GMRVHLOC,GMRLEN,GMRI,GMROUT,GMRVSDT,GMRVFDT,GPRT,GMVLOOP
+4 KILL GMVRMLST,GMVRANGE
+5 DO ^%ZISC
+6 QUIT
+1 WRITE !!,"*** (E) - Error entry",!!
if VADM(1)'=""
WRITE ?$X-3,$EXTRACT(VADM(1),1,15)
if VADM(2)'=""
WRITE ?17,$EXTRACT($PIECE(VADM(2),"^",2),8,11)
if VADM(3)'=""
WRITE ?30,$PIECE(VADM(3),"^",2)
if VADM(4)'=""
WRITE ?43,$PIECE(VADM(4),"^")_" YRS"
+2 if VADM(5)'=""
WRITE ?51,$PIECE(VADM(5),"^",2)
+3 WRITE ?65,"VAF 10-7987j"
WRITE !,"Unit: "_$SELECT($PIECE(VAIN(4),"^",2)'="":$PIECE(VAIN(4),"^",2),1:" "),?32,"Room: "_$SELECT($PIECE(VAIN(5),"^")'="":$PIECE(VAIN(5),"^"),1:" "),!
+4 IF '$DATA(GMRVHLOC)
SET GMRVHLOC=$$HOSPLOC^GMVUTL1(+$GET(VAIN(4)))
+5 WRITE "Division: "_$$DIVISION^GMVUTL1(+GMRVHLOC),!
+6 QUIT
WRT ;
+1 SET GMR1ST=1
+2 KILL GMRSITE
+3 DO DEM^VADPT
DO INP^VADPT
+4 SET GWARD=$SELECT($PIECE(VAIN(4),"^",2)'="":$PIECE(VAIN(4),"^",2),1:" ")
+5 SET GBED=$SELECT(VAIN(5)'="":$PIECE(VAIN(5),"^"),1:" ")
+6 DO HDR^GMVSC2
+7 QUIT