VistA-WorldVistAEHR/r/GEN_MED_REC_VITALS-GMRV/GMRVSR0.m

69 lines
5.5 KiB
Mathematica

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