Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: GMRVEE0

GMRVEE0.m

Go to the documentation of this file.
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