GMRVEE0 ;HIRMFO/RM,YH-ENTERED IN ERROR EDIT ;3/15/99 15:04
;;4.0;Vitals/Measurements;**1,7,11**;Apr 25, 1997
EN1 ; ENTRY FROM OPTION GMRV ERROR EDIT
S GMROUT=0 W ! S DIC="^DPT(",DIC(0)="AEMQ" D ^DIC K DIC S:+Y'>0 GMROUT=1 G Q:+Y'>0 S DFN=+Y
EN2 ; ENTRY TO VITALS ENTERED IN ERROR IF DFN IS KNOWN.
Q:'$D(DFN) S GMROUT=0 K ^TMP($J)
DATE S %DT(0)="-NOW",%DT("A")="Select DATE (TIME optional) of this error: ",%DT="AXET" D ^%DT K %DT I +Y'>0 S GMROUT=1 G Q
S GMRVDATE=+Y D DATACK I GMROUT W !,$C(7),"No data for this date" S GMROUT=0 G DATE
EN3 ;ENTRY TO ERROR EDIT PROVIDED DFN AND DATE/TIME ARE GIVEN
S GMRX=$O(GMRARTY("D",0)) I GMRX>0 D CHSDT G:GMROUT Q D EN1^GMRVEE1
I GMRARTY W ! S DIC=120.51,DIC(0)="AQEM",DIC("A")="Select a VITAL type record, or press return to correct DATE/TIME, PATIENT or set INVALID for the record: ",DIC("S")="I $D(GMRARTY(+Y))" D ^DIC K DIC
S:$D(DUOUT)!$D(DTOUT) GMROUT=1 G:GMROUT Q
S GMRVITY=$S(+Y>0:+Y,1:"A")
I 'GMRARTY S GMRVITY=$O(GMRARTY(0))
D:GMRVITY'="A" WHTL
I '($D(GMRARTY)\10) W !?3,$C(7),"There is no data for this patient for this date/time" G Q
S GMRVDT=$O(GMRARTY("D",0)) S:GMRVITY="A"&'$O(GMRARTY(+$O(GMRARTY("")))) GMRVITY=$O(GMRARTY(""))
D RESLS^GMRVEE1
Q K ^TMP($J),GMRAINP,GMRDA,GMRDAT,GMREDB,GMRFDT,GMRNM,GMRSDT,GMRTY,GMRVDATE,GMRVITY,GMRX,GMRDATE,GMRI,GMRSITE,GMRVIDT,GMRSTR,GMRVCH,GMRVIT,GMRVX,DR,DA,DIE,DFN,DIC,GMRARTY,GMRCHC,GMRDFN,GMRVDT,GMRVHLOC,GMRY,GMRZ,POP,GDATE,GSAVE,GDFN,GMRCNT
D KVAR^VADPT K GMRINF,GMRDATA,%T,%Y,D0,DI,DQ,VAERR,VAIP,GMRQUAL,GMRENTY,GFLAG,GMRZZ,GMRVARY
K GMROK,GDT I GMROUT K GMROUT Q
G EN1
WHTL ; ELIMINATE ALL NON GMRVITY CHILDREN FROM GMRARTY
F GMRX=0:0 S GMRX=$O(GMRARTY(GMRX)) Q:GMRX'>0 I GMRX'=GMRVITY K GMRARTY(GMRX)
F GMRX=0:0 S GMRX=$O(GMRARTY("D",GMRX)) Q:GMRX'>0 I '$D(GMRARTY(GMRVITY,GMRX)) K GMRARTY("D",GMRX)
Q
CHSDT ; CHOOSE A DATE FOR ALL VITAL TYPES, OR DROP THRU FROM SINGLE VITAL TYPE
S (GMRCNT,GMRNM)=0 K ^TMP($J,"GMRC") W !,"CHOOSE FROM: ",!
S GFLAG="" F GMRX=0:0 S GMRX=$O(GMRARTY("D",GMRX)) Q:GMRX'>0!GMROUT!(GFLAG["^") S GMRNM=GMRNM+1,^TMP($J,"GMRC",GMRNM)=GMRX,GMRCNT=GMRCNT+1 W !,?2,GMRNM_" " S Y=GMRX D DT^DIQ D PRTCHS I GMRCNT=3 D
. W !," Return to continue or enter ^ to stop listing: " R GFLAG:DTIME S:'$T GMROUT=1 S GMRCNT=0
. Q
CHNUM Q:GMROUT W !!,"Select VITAL/MEASUREMENT from the above list: " R GMRX:DTIME I '$T!(GMRX="^") S GMROUT=1 Q
I GMRX="" S GMROUT=1 Q
I '$D(^TMP($J,"GMRC",GMRX)) W !,$C(7),?3,"ANSWER WITH "_$S(GMRNM>0:"A NUMBER BETWEEN 1 AND "_GMRNM,1:"THE NUMBER 1") G CHNUM:GMRX'?1"?".E,CHSDT
SDA S GMRVDT=^TMP($J,"GMRC",GMRX) F GMRX=0:0 S GMRX=$O(GMRARTY(GMRX)) Q:GMRX'>0 F GMRY=0:0 S GMRY=$O(GMRARTY(GMRX,GMRY)) Q:GMRY'>0 I GMRY'=GMRVDT K GMRARTY(GMRX,GMRY),GMRARTY("D",GMRY)
Q
PRTCHS ; PRINT CHOICES FOR DATE/TIME DEFINED BY GMRX
F GMRY=0:0 S GMRY=$O(GMRARTY(GMRY)) Q:GMRY'>0 I $D(GMRARTY(GMRY,GMRX)) S GMRDA=GMRARTY(GMRY,GMRX) D PRTLN
Q
PRTLN ; PRINT DATA FOR VITAL RECORD DEFINED BY GMRDA
S GMRDAT=$S($D(^GMR(120.5,GMRDA,0)):^(0),1:"") Q:GMRDAT=""
K GMRVX S GMRVX=$S($D(^GMRD(120.51,GMRY,0)):$P(^(0),"^",2),1:""),GMRVX(0)=$P(GMRDAT,"^",8) D:GMRVX(0)>0 EN1^GMRVSAS0
S GMRZZ="",GMRZZ(1)="" I $P($G(^GMR(120.5,GMRDA,5,0)),"^",4)>0 K GMRVARY S GMRVARY="" D CHAR^GMRVCHAR(GMRDA,.GMRVARY,GMRY) S GMRZZ=$$WRITECH^GMRVCHAR(GMRDA,.GMRVARY,9) S:GMRZZ'=""&(GMRVX'="PO2") GMRZZ=" ("_GMRZZ_")"
I GMRVX="T",GMRVX(0)>0 S GMRVX(0)=GMRVX(0)_" F ("_$J(GMRVX(0)-32*5/9,0,1)_" C)"
I GMRVX="HT",GMRVX(0)>0 S GMRVX(0)=$S(GMRVX(0)\12:GMRVX(0)\12_" ft ",1:"")_$S(GMRVX(0)#12:GMRVX(0)#12_" in",1:"")_" ("_$J(GMRVX(0)*2.54,0,2)_" cm)"
I GMRVX="WT",GMRVX(0)>0 S GMRVX(0)=GMRVX(0)_" lb ("_$J(GMRVX(0)/2.2,0,2)_" kg)"
I GMRVX="PN" D
. I GMRVX(0)=0 S GMRVX(0)=GMRVX(0)_" No pain" Q
. I GMRVX(0)=99 S GMRVX(0)=GMRVX(0)_" Unable to respond" Q
. I GMRVX(0)=10 S GMRVX(0)=GMRVX(0)_" Worst imaginable pain" Q
I GMRVX="CG",GMRVX(0)>0 S GMRVX(0)=GMRVX(0)_" in ("_$J(+GMRVX(0)/.3937,0,2)_" cm)"
I GMRVX="CVP",GMRVX(0)>0 S GMRVX(0)=GMRVX(0)_" cmH2O ("_$J(GMRVX(0)/1.36,0,1)_" mmHg)"
I GMRVX="PO2",GMRVX(0)>0 D
.N GMRVPO S GMRVPO=$P(GMRDAT,"^",10)
.S GMRVX(0)="Pulse oximetry "_GMRVX(0)_"%"_$S(GMRVPO'="":" with supplemental O2 "_$S(GMRVPO["l/min":$P(GMRVPO," l/min")_"L/min",1:"")_$S(GMRVPO["l/min":$P(GMRVPO," l/min",2),1:GMRVPO),1:"")
.Q
I GMRVX="P" D
. I GMRZZ'="",GMRVX(0)=1 S:$F(GMRZZ,"DORSALIS PEDIS")>0 GMRVX(1)=""
. I GMRZZ'="",GMRVX(0)=0 S:$F(GMRZZ,"DORSALIS PEDIS")>0 GMRVX(1)=1
. Q
W !,?5,$S(GMRVX="PN":"Pain",1:GMRVX),": ",GMRVX(0),$S('$D(GMRVX(1)):" ",'GMRVX(1):" ",1:"*")
W:GMRVX="PO2" !,?10,"via " W GMRZZ
Q
DATACK ; CHECK TO SEE IF DATA FOR THIS PATIENT FOR THIS DATE. IF THERE IS
; SET UP AN ARRAY GMRARTY WITH GMRARTY=$S(0:ONE TYPE ONLY,1:MORE
; THAN ONE TYPE) AND GMRARTY(TYPE IEN)=120.5 ENTRY
K GMRARTY S X1=GMRVDATE,X2=1 D C^%DTC S GMRVDT(0)=$P(X,".",1)
F GMRVITY=0:0 S GMRVITY=$O(^GMR(120.5,"AA",DFN,GMRVITY)) Q:GMRVITY'>0 D CNLP
I '$D(GMRARTY) S GMROUT=1
Q
CNLP ;
F GMRVDT=(9999999-GMRVDT(0)):0 S GMRVDT=$O(^GMR(120.5,"AA",DFN,GMRVITY,GMRVDT)) Q:$P(9999999-GMRVDT,".")'[$P(GMRVDATE,".")!(GMRVDT'>0) D:$S('$P(GMRVDATE,".",2):1,1:GMRVDATE=(9999999-GMRVDT)) STARTY
Q
STARTY ; SET GMRARTY ARRAY
F GMRDA=0:0 S GMRDA=$O(^GMR(120.5,"AA",DFN,GMRVITY,GMRVDT,GMRDA)) Q:GMRDA'>0 I '$D(^GMR(120.5,GMRDA,2)) S GMRARTY=$S($D(GMRARTY):1,1:0),GMRARTY(GMRVITY,9999999-GMRVDT)=GMRDA,GMRARTY("D",9999999-GMRVDT)="" Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRVEE0 5463 printed Dec 13, 2024@01:56:18 Page 2
GMRVEE0 ;HIRMFO/RM,YH-ENTERED IN ERROR EDIT ;3/15/99 15:04
+1 ;;4.0;Vitals/Measurements;**1,7,11**;Apr 25, 1997
EN1 ; ENTRY FROM OPTION GMRV ERROR EDIT
+1 SET GMROUT=0
WRITE !
SET DIC="^DPT("
SET DIC(0)="AEMQ"
DO ^DIC
KILL DIC
if +Y'>0
SET GMROUT=1
if +Y'>0
GOTO Q
SET DFN=+Y
EN2 ; ENTRY TO VITALS ENTERED IN ERROR IF DFN IS KNOWN.
+1 if '$DATA(DFN)
QUIT
SET GMROUT=0
KILL ^TMP($JOB)
DATE SET %DT(0)="-NOW"
SET %DT("A")="Select DATE (TIME optional) of this error: "
SET %DT="AXET"
DO ^%DT
KILL %DT
IF +Y'>0
SET GMROUT=1
GOTO Q
+1 SET GMRVDATE=+Y
DO DATACK
IF GMROUT
WRITE !,$CHAR(7),"No data for this date"
SET GMROUT=0
GOTO DATE
EN3 ;ENTRY TO ERROR EDIT PROVIDED DFN AND DATE/TIME ARE GIVEN
+1 SET GMRX=$ORDER(GMRARTY("D",0))
IF GMRX>0
DO CHSDT
if GMROUT
GOTO Q
DO EN1^GMRVEE1
+2 IF GMRARTY
WRITE !
SET DIC=120.51
SET DIC(0)="AQEM"
SET DIC("A")="Select a VITAL type record, or press return to correct DATE/TIME, PATIENT or set INVALID for the record: "
SET DIC("S")="I $D(GMRARTY(+Y))"
DO ^DIC
KILL DIC
+3 if $DATA(DUOUT)!$DATA(DTOUT)
SET GMROUT=1
if GMROUT
GOTO Q
+4 SET GMRVITY=$SELECT(+Y>0:+Y,1:"A")
+5 IF 'GMRARTY
SET GMRVITY=$ORDER(GMRARTY(0))
+6 if GMRVITY'="A"
DO WHTL
+7 IF '($DATA(GMRARTY)\10)
WRITE !?3,$CHAR(7),"There is no data for this patient for this date/time"
GOTO Q
+8 SET GMRVDT=$ORDER(GMRARTY("D",0))
if GMRVITY="A"&'$ORDER(GMRARTY(+$ORDER(GMRARTY(""))))
SET GMRVITY=$ORDER(GMRARTY(""))
+9 DO RESLS^GMRVEE1
Q KILL ^TMP($JOB),GMRAINP,GMRDA,GMRDAT,GMREDB,GMRFDT,GMRNM,GMRSDT,GMRTY,GMRVDATE,GMRVITY,GMRX,GMRDATE,GMRI,GMRSITE,GMRVIDT,GMRSTR,GMRVCH,GMRVIT,GMRVX,DR,DA,DIE,DFN,DIC,GMRARTY,GMRCHC,GMRDFN,GMRVDT,GMRVHLOC,GMRY,GMRZ,POP,GDATE,GSAVE,GDFN,GMRCNT
+1 DO KVAR^VADPT
KILL GMRINF,GMRDATA,%T,%Y,D0,DI,DQ,VAERR,VAIP,GMRQUAL,GMRENTY,GFLAG,GMRZZ,GMRVARY
+2 KILL GMROK,GDT
IF GMROUT
KILL GMROUT
QUIT
+3 GOTO EN1
WHTL ; ELIMINATE ALL NON GMRVITY CHILDREN FROM GMRARTY
+1 FOR GMRX=0:0
SET GMRX=$ORDER(GMRARTY(GMRX))
if GMRX'>0
QUIT
IF GMRX'=GMRVITY
KILL GMRARTY(GMRX)
+2 FOR GMRX=0:0
SET GMRX=$ORDER(GMRARTY("D",GMRX))
if GMRX'>0
QUIT
IF '$DATA(GMRARTY(GMRVITY,GMRX))
KILL GMRARTY("D",GMRX)
+3 QUIT
CHSDT ; CHOOSE A DATE FOR ALL VITAL TYPES, OR DROP THRU FROM SINGLE VITAL TYPE
+1 SET (GMRCNT,GMRNM)=0
KILL ^TMP($JOB,"GMRC")
WRITE !,"CHOOSE FROM: ",!
+2 SET GFLAG=""
FOR GMRX=0:0
SET GMRX=$ORDER(GMRARTY("D",GMRX))
if GMRX'>0!GMROUT!(GFLAG["^")
QUIT
SET GMRNM=GMRNM+1
SET ^TMP($JOB,"GMRC",GMRNM)=GMRX
SET GMRCNT=GMRCNT+1
WRITE !,?2,GMRNM_" "
SET Y=GMRX
DO DT^DIQ
DO PRTCHS
IF GMRCNT=3
Begin DoDot:1
+3 WRITE !," Return to continue or enter ^ to stop listing: "
READ GFLAG:DTIME
if '$TEST
SET GMROUT=1
SET GMRCNT=0
+4 QUIT
End DoDot:1
CHNUM if GMROUT
QUIT
WRITE !!,"Select VITAL/MEASUREMENT from the above list: "
READ GMRX:DTIME
IF '$TEST!(GMRX="^")
SET GMROUT=1
QUIT
+1 IF GMRX=""
SET GMROUT=1
QUIT
+2 IF '$DATA(^TMP($JOB,"GMRC",GMRX))
WRITE !,$CHAR(7),?3,"ANSWER WITH "_$SELECT(GMRNM>0:"A NUMBER BETWEEN 1 AND "_GMRNM,1:"THE NUMBER 1")
if GMRX'?1"?".E
GOTO CHNUM
GOTO CHSDT
SDA SET GMRVDT=^TMP($JOB,"GMRC",GMRX)
FOR GMRX=0:0
SET GMRX=$ORDER(GMRARTY(GMRX))
if GMRX'>0
QUIT
FOR GMRY=0:0
SET GMRY=$ORDER(GMRARTY(GMRX,GMRY))
if GMRY'>0
QUIT
IF GMRY'=GMRVDT
KILL GMRARTY(GMRX,GMRY),GMRARTY("D",GMRY)
+1 QUIT
PRTCHS ; PRINT CHOICES FOR DATE/TIME DEFINED BY GMRX
+1 FOR GMRY=0:0
SET GMRY=$ORDER(GMRARTY(GMRY))
if GMRY'>0
QUIT
IF $DATA(GMRARTY(GMRY,GMRX))
SET GMRDA=GMRARTY(GMRY,GMRX)
DO PRTLN
+2 QUIT
PRTLN ; PRINT DATA FOR VITAL RECORD DEFINED BY GMRDA
+1 SET GMRDAT=$SELECT($DATA(^GMR(120.5,GMRDA,0)):^(0),1:"")
if GMRDAT=""
QUIT
+2 KILL GMRVX
SET GMRVX=$SELECT($DATA(^GMRD(120.51,GMRY,0)):$PIECE(^(0),"^",2),1:"")
SET GMRVX(0)=$PIECE(GMRDAT,"^",8)
if GMRVX(0)>0
DO EN1^GMRVSAS0
+3 SET GMRZZ=""
SET GMRZZ(1)=""
IF $PIECE($GET(^GMR(120.5,GMRDA,5,0)),"^",4)>0
KILL GMRVARY
SET GMRVARY=""
DO CHAR^GMRVCHAR(GMRDA,.GMRVARY,GMRY)
SET GMRZZ=$$WRITECH^GMRVCHAR(GMRDA,.GMRVARY,9)
if GMRZZ'=""&(GMRVX'="PO2")
SET GMRZZ=" ("_GMRZZ_")"
+4 IF GMRVX="T"
IF GMRVX(0)>0
SET GMRVX(0)=GMRVX(0)_" F ("_$JUSTIFY(GMRVX(0)-32*5/9,0,1)_" C)"
+5 IF GMRVX="HT"
IF GMRVX(0)>0
SET GMRVX(0)=$SELECT(GMRVX(0)\12:GMRVX(0)\12_" ft ",1:"")_$SELECT(GMRVX(0)#12:GMRVX(0)#12_" in",1:"")_" ("_$JUSTIFY(GMRVX(0)*2.54,0,2)_" cm)"
+6 IF GMRVX="WT"
IF GMRVX(0)>0
SET GMRVX(0)=GMRVX(0)_" lb ("_$JUSTIFY(GMRVX(0)/2.2,0,2)_" kg)"
+7 IF GMRVX="PN"
Begin DoDot:1
+8 IF GMRVX(0)=0
SET GMRVX(0)=GMRVX(0)_" No pain"
QUIT
+9 IF GMRVX(0)=99
SET GMRVX(0)=GMRVX(0)_" Unable to respond"
QUIT
+10 IF GMRVX(0)=10
SET GMRVX(0)=GMRVX(0)_" Worst imaginable pain"
QUIT
End DoDot:1
+11 IF GMRVX="CG"
IF GMRVX(0)>0
SET GMRVX(0)=GMRVX(0)_" in ("_$JUSTIFY(+GMRVX(0)/.3937,0,2)_" cm)"
+12 IF GMRVX="CVP"
IF GMRVX(0)>0
SET GMRVX(0)=GMRVX(0)_" cmH2O ("_$JUSTIFY(GMRVX(0)/1.36,0,1)_" mmHg)"
+13 IF GMRVX="PO2"
IF GMRVX(0)>0
Begin DoDot:1
+14 NEW GMRVPO
SET GMRVPO=$PIECE(GMRDAT,"^",10)
+15 SET GMRVX(0)="Pulse oximetry "_GMRVX(0)_"%"_$SELECT(GMRVPO'="":" with supplemental O2 "_$SELECT(GMRVPO["l/min":$PIECE(GMRVPO," l/min")_"L/min",1:"")_$SELECT(GMRVPO["l/min":$PIECE(GMRVPO," l/min",2),1:GMRVPO),1:"")
+16 QUIT
End DoDot:1
+17 IF GMRVX="P"
Begin DoDot:1
+18 IF GMRZZ'=""
IF GMRVX(0)=1
if $FIND(GMRZZ,"DORSALIS PEDIS")>0
SET GMRVX(1)=""
+19 IF GMRZZ'=""
IF GMRVX(0)=0
if $FIND(GMRZZ,"DORSALIS PEDIS")>0
SET GMRVX(1)=1
+20 QUIT
End DoDot:1
+21 WRITE !,?5,$SELECT(GMRVX="PN":"Pain",1:GMRVX),": ",GMRVX(0),$SELECT('$DATA(GMRVX(1)):" ",'GMRVX(1):" ",1:"*")
+22 if GMRVX="PO2"
WRITE !,?10,"via "
WRITE GMRZZ
+23 QUIT
DATACK ; CHECK TO SEE IF DATA FOR THIS PATIENT FOR THIS DATE. IF THERE IS
+1 ; SET UP AN ARRAY GMRARTY WITH GMRARTY=$S(0:ONE TYPE ONLY,1:MORE
+2 ; THAN ONE TYPE) AND GMRARTY(TYPE IEN)=120.5 ENTRY
+3 KILL GMRARTY
SET X1=GMRVDATE
SET X2=1
DO C^%DTC
SET GMRVDT(0)=$PIECE(X,".",1)
+4 FOR GMRVITY=0:0
SET GMRVITY=$ORDER(^GMR(120.5,"AA",DFN,GMRVITY))
if GMRVITY'>0
QUIT
DO CNLP
+5 IF '$DATA(GMRARTY)
SET GMROUT=1
+6 QUIT
CNLP ;
+1 FOR GMRVDT=(9999999-GMRVDT(0)):0
SET GMRVDT=$ORDER(^GMR(120.5,"AA",DFN,GMRVITY,GMRVDT))
if $PIECE(9999999-GMRVDT,".")'[$PIECE(GMRVDATE,".")!(GMRVDT'>0)
QUIT
if $SELECT('$PIECE(GMRVDATE,".",2)
DO STARTY
+2 QUIT
STARTY ; SET GMRARTY ARRAY
+1 FOR GMRDA=0:0
SET GMRDA=$ORDER(^GMR(120.5,"AA",DFN,GMRVITY,GMRVDT,GMRDA))
if GMRDA'>0
QUIT
IF '$DATA(^GMR(120.5,GMRDA,2))
SET GMRARTY=$SELECT($DATA(GMRARTY):1,1:0)
SET GMRARTY(GMRVITY,9999999-GMRVDT)=GMRDA
SET GMRARTY("D",9999999-GMRVDT)=""
QUIT
+2 QUIT