GMRVUT0 ;HIOFO/RM,YH,FT-INPUT TRANSFORMS FOR VITAL TYPES ;10/3/07
;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
;
; This routine uses the following IAs:
; #4290 - ^PXRMINDX global (controlled)
;
; This routine supports the following IAs:
; EN1 - 1446 (controlled)
;
EN2 ; CALLED FROM INPUT TRANSFORM OF RATE AND QUALITY SUBFIELDS OF SITE
; FIELD OF THE VITAL MEASUREMENT (#120.5) FILE - GMRFLD IS SET BEFORE
; ENTRY, BUT KILLED WITHIN THE ROUTINE
S GMRTYP=$S($D(^GMR(120.5,DA,0)):$P(^(0),U,3),1:"") G K:GMRTYP'>0
G K:GMRTYP'>0,Q2:$P(^GMRD(120.51,GMRTYP,0),U,$S(GMRFLD=1:4,GMRFLD=2:5,1:3))
K D EN^DDIOL($C(7)_"CANNOT EDIT THIS FIELD FOR THIS TYPE OF MEASUREMENT","","!?5") K X
Q2 K GMRTYP,GMRFLD Q
EN3 ; INPUT TRANSFORM FOR HEIGHT RATES
N GMR
S GMR=$P(X,+X,2,10) I GMR="" S X=0 Q
I $E(GMR)="C"!($E(GMR)="c")&("CMCmcMcm"[GMR) S X=$J(.3937*(+X),0,2) Q
I $E(GMR)="I"!($E(GMR)="i")!($E(GMR)="""") S X=+X Q
I $E(GMR)="F"!($E(GMR)="f")!($E(GMR)="'") D FTIN Q
S X=0
Q
FTIN ;
N GMRF,GMRIN,GMRXX,GMRYY
S GMRF=$E(GMR),GMR=$E(GMR,2,$L(GMR)) F GMRXX=1:0 S GMRYY=$E(GMR) Q:GMRYY?1N!(GMRYY="") S GMRF=GMRF_GMRYY,GMR=$E(GMR,2,$L(GMR))
I "FTFtfTft'"'[GMRF Q
S GMRIN=$P(GMR,+GMR,2) I "INIniNin""''"'[GMRIN!(GMRIN="'") Q
S X=+X*12+(+GMR)
Q
EN1 ; ENTRY TO GATHER PATIENT'S VITAL/MEASUREMENT DATA
; INPUT VARIABLES:
;
; DFN = Entry number of patient in Patient file.
; GMRVSTR = types of vital/measurements desired. Use the abbreviations
; found in the Vital Type (120.51) file. For multiple
; vitals, use the ; as a delimiter.
; GMRVSTR(0) = GMRVSTDT^GMRVENDT^GMRVOCC^GMRVSORD
; where GMRVSTDT = The start date/time that the utility will
; use in obtaining patient data. (OPTIONAL)
; GMRVENDT = The end date/time that the utility will use
; to stop the search. (OPTIONAL)
; GMRVOCC = The number of occurrences of the data that
; is desired by the search. (OPTIONAL)
; GMRVSORD = The sort order desired in output, see OUTPUT
; VARIABLES section. (REQUIRED)
; GMRVSTR("LT") = ^TYP1^[TYP2^...] (OPTIONAL)
; THIS VARIABLE IS AN ^ DELIMITED LIST OF HOSPITAL LOCATION
; TYPES TO EXTRACT MEASUREMENT DATA FOR. E.G., ^C^M^, WILL
; EXTRACT DATA FOR ONLY THOSE MEASUREMENTS TAKEN ON CLINICS
; OR MODULES.
;
; OUTPUT VARIABLES:
;
; The utility will create an array with the desired information. The
; array structure will be as follows if '$P(GMRVSTR(0),"^",4):
; ^UTILITY($J,"GMRVD",GMRVTYP,GMRVRDT,GMRVIEN)=GMRVDATA
; or if $P(GMRVSTR(0),"^",4) then the following will be returned:
; ^UTILITY($J,"GMRVD",GMRVRDT,GMRVTYP,GMRVIEN)=GMRVDATA
; where GMRVRDT = Reverse FileMan date/time.
; 9999999-Date/time vital/measurement was taken.
; GMRVTYP = The abbreviation used in the GMRVSTR string for the
; type of vital/measurement taken.
; GMRVIEN = Entry number in FILE 120.5 or
; pseudo entry number for File 704.117
; GMRVDATA = $P(^GMR(120.5,GMRVIEN,0),"^",1,9) will be the patient data as
; currently defined in the DD for file 120.5.
; $P(GMRVDATA,"^",10) = the first qualifier
; $P(GMRVDATA,"^",11) = the second qualifier
; $P(GMRVDATA,"^",12)= "*" for abnormal measurement, otherwise = ""
; $P(GMRVDATA,"^",13)= values in centigrade for T; KG for WT;
; in centimeter for HT and Circumference/Girth;
; in mmHg for CVP.
; $P(GMRVDATA,"^",14)= Body Mass Index.
; $P(GMRVDATA,"^",15)= L/Min of supplemental O2.
; $P(GMRVDATA,"^",16)= % of supplemental O2.
; $P(GMRVDATA,"^",17)= all qualifiers.
; The variable GMRVSTR will be killed.
Q:'$D(GMRVSTR(0))!'($D(GMRVSTR)#2)!'($D(DFN)#2) Q:DFN'>0
N GMVIENGUID
S GMRSAVE=GMRVSTR,GMRSAVE(0)=GMRVSTR(0),GMVIENGUID=0
S GMRVSTR="HT" D EN6^GMRVUTL S GMRVSTR=GMRSAVE,GMRVSTR(0)=GMRSAVE(0) S GMRHT=(+$P(X,U,8)*2.54)/100
I $G(GMRVSTR("LT"))="" S GMRVSTR("LT")=""
F GMRVSTR(1)=1:1:$L(GMRVSTR,";") D
.S GMRVSTR("T")=$P(GMRVSTR,";",GMRVSTR(1))
.I $L(GMRVSTR("T")) D
..S GMRVSTR("B")=$S($P(GMRVSTR(0),U,1):$P(GMRVSTR(0),U,1),1:0)
..S GMRVSTR("E")=$S($P(GMRVSTR(0),U,2):$P(GMRVSTR(0),U,2),1:9999999)
..S GMRVSTR("O")=0,GMRVSTR("E")=GMRVSTR("E")+.000001
..D GETD
K GMRINF,GG,GMRSAVE,GMRHT,GMRVARY,GMRVSTR,GMRSITE,GMRQUAL,GMRVX,GMRZTY,GDATA
Q
GETD ; LOOP THRU PXRMINDX XREF AND GET PATIENT DATA
S GMRVSTR("TDA")=$O(^GMRD(120.51,"C",GMRVSTR("T"),0)) Q:'GMRVSTR("TDA")
I GMRVSTR("T")="BP"!(GMRVSTR("T")="P") D BP^GMRVUT2 Q
F GMRVSTR("R")=GMRVSTR("E"):0 S GMRVSTR("R")=$O(^PXRMINDX(120.5,"PI",DFN,GMRVSTR("TDA"),GMRVSTR("R")),-1) Q:GMRVSTR("R")<GMRVSTR("B")!(GMRVSTR("R")'>0) D GETD1 Q:GMRVSTR("TMO")
Q
GETD1 ;
N GMVCLIO
S GMRVSTR("TMO")=0 ;max # of occurrences flag
S GMRVSTR("IEN")=0
F S GMRVSTR("IEN")=$O(^PXRMINDX(120.5,"PI",DFN,GMRVSTR("TDA"),GMRVSTR("R"),GMRVSTR("IEN"))) Q:$L(GMRVSTR("IEN"))'>0 D Q:GMRVSTR("TMO")
.I GMRVSTR("IEN")=+GMRVSTR("IEN") D
..D F1205^GMVUTL(.GMVCLIO,GMRVSTR("IEN"))
.I GMRVSTR("IEN")'=+GMRVSTR("IEN") D
..D CLIO^GMVUTL(.GMVCLIO,GMRVSTR("IEN"))
.S GMVCLIO(0)=$G(GMVCLIO(0)),GMVCLIO(5)=$G(GMVCLIO(5))
.I GMVCLIO(0)=""!($P(GMVCLIO(0),U,8)="") Q
.D SETU2^GMRVUT2
.Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRVUT0 5562 printed Dec 13, 2024@01:57:37 Page 2
GMRVUT0 ;HIOFO/RM,YH,FT-INPUT TRANSFORMS FOR VITAL TYPES ;10/3/07
+1 ;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
+2 ;
+3 ; This routine uses the following IAs:
+4 ; #4290 - ^PXRMINDX global (controlled)
+5 ;
+6 ; This routine supports the following IAs:
+7 ; EN1 - 1446 (controlled)
+8 ;
EN2 ; CALLED FROM INPUT TRANSFORM OF RATE AND QUALITY SUBFIELDS OF SITE
+1 ; FIELD OF THE VITAL MEASUREMENT (#120.5) FILE - GMRFLD IS SET BEFORE
+2 ; ENTRY, BUT KILLED WITHIN THE ROUTINE
+3 SET GMRTYP=$SELECT($DATA(^GMR(120.5,DA,0)):$PIECE(^(0),U,3),1:"")
if GMRTYP'>0
GOTO K
+4 if GMRTYP'>0
GOTO K
if $PIECE(^GMRD(120.51,GMRTYP,0),U,$SELECT(GMRFLD=1:4,GMRFLD=2:5,1:3))
GOTO Q2
K DO EN^DDIOL($CHAR(7)_"CANNOT EDIT THIS FIELD FOR THIS TYPE OF MEASUREMENT","","!?5")
KILL X
Q2 KILL GMRTYP,GMRFLD
QUIT
EN3 ; INPUT TRANSFORM FOR HEIGHT RATES
+1 NEW GMR
+2 SET GMR=$PIECE(X,+X,2,10)
IF GMR=""
SET X=0
QUIT
+3 IF $EXTRACT(GMR)="C"!($EXTRACT(GMR)="c")&("CMCmcMcm"[GMR)
SET X=$JUSTIFY(.3937*(+X),0,2)
QUIT
+4 IF $EXTRACT(GMR)="I"!($EXTRACT(GMR)="i")!($EXTRACT(GMR)="""")
SET X=+X
QUIT
+5 IF $EXTRACT(GMR)="F"!($EXTRACT(GMR)="f")!($EXTRACT(GMR)="'")
DO FTIN
QUIT
+6 SET X=0
+7 QUIT
FTIN ;
+1 NEW GMRF,GMRIN,GMRXX,GMRYY
+2 SET GMRF=$EXTRACT(GMR)
SET GMR=$EXTRACT(GMR,2,$LENGTH(GMR))
FOR GMRXX=1:0
SET GMRYY=$EXTRACT(GMR)
if GMRYY?1N!(GMRYY="")
QUIT
SET GMRF=GMRF_GMRYY
SET GMR=$EXTRACT(GMR,2,$LENGTH(GMR))
+3 IF "FTFtfTft'"'[GMRF
QUIT
+4 SET GMRIN=$PIECE(GMR,+GMR,2)
IF "INIniNin""''"'[GMRIN!(GMRIN="'")
QUIT
+5 SET X=+X*12+(+GMR)
+6 QUIT
EN1 ; ENTRY TO GATHER PATIENT'S VITAL/MEASUREMENT DATA
+1 ; INPUT VARIABLES:
+2 ;
+3 ; DFN = Entry number of patient in Patient file.
+4 ; GMRVSTR = types of vital/measurements desired. Use the abbreviations
+5 ; found in the Vital Type (120.51) file. For multiple
+6 ; vitals, use the ; as a delimiter.
+7 ; GMRVSTR(0) = GMRVSTDT^GMRVENDT^GMRVOCC^GMRVSORD
+8 ; where GMRVSTDT = The start date/time that the utility will
+9 ; use in obtaining patient data. (OPTIONAL)
+10 ; GMRVENDT = The end date/time that the utility will use
+11 ; to stop the search. (OPTIONAL)
+12 ; GMRVOCC = The number of occurrences of the data that
+13 ; is desired by the search. (OPTIONAL)
+14 ; GMRVSORD = The sort order desired in output, see OUTPUT
+15 ; VARIABLES section. (REQUIRED)
+16 ; GMRVSTR("LT") = ^TYP1^[TYP2^...] (OPTIONAL)
+17 ; THIS VARIABLE IS AN ^ DELIMITED LIST OF HOSPITAL LOCATION
+18 ; TYPES TO EXTRACT MEASUREMENT DATA FOR. E.G., ^C^M^, WILL
+19 ; EXTRACT DATA FOR ONLY THOSE MEASUREMENTS TAKEN ON CLINICS
+20 ; OR MODULES.
+21 ;
+22 ; OUTPUT VARIABLES:
+23 ;
+24 ; The utility will create an array with the desired information. The
+25 ; array structure will be as follows if '$P(GMRVSTR(0),"^",4):
+26 ; ^UTILITY($J,"GMRVD",GMRVTYP,GMRVRDT,GMRVIEN)=GMRVDATA
+27 ; or if $P(GMRVSTR(0),"^",4) then the following will be returned:
+28 ; ^UTILITY($J,"GMRVD",GMRVRDT,GMRVTYP,GMRVIEN)=GMRVDATA
+29 ; where GMRVRDT = Reverse FileMan date/time.
+30 ; 9999999-Date/time vital/measurement was taken.
+31 ; GMRVTYP = The abbreviation used in the GMRVSTR string for the
+32 ; type of vital/measurement taken.
+33 ; GMRVIEN = Entry number in FILE 120.5 or
+34 ; pseudo entry number for File 704.117
+35 ; GMRVDATA = $P(^GMR(120.5,GMRVIEN,0),"^",1,9) will be the patient data as
+36 ; currently defined in the DD for file 120.5.
+37 ; $P(GMRVDATA,"^",10) = the first qualifier
+38 ; $P(GMRVDATA,"^",11) = the second qualifier
+39 ; $P(GMRVDATA,"^",12)= "*" for abnormal measurement, otherwise = ""
+40 ; $P(GMRVDATA,"^",13)= values in centigrade for T; KG for WT;
+41 ; in centimeter for HT and Circumference/Girth;
+42 ; in mmHg for CVP.
+43 ; $P(GMRVDATA,"^",14)= Body Mass Index.
+44 ; $P(GMRVDATA,"^",15)= L/Min of supplemental O2.
+45 ; $P(GMRVDATA,"^",16)= % of supplemental O2.
+46 ; $P(GMRVDATA,"^",17)= all qualifiers.
+47 ; The variable GMRVSTR will be killed.
+48 if '$DATA(GMRVSTR(0))!'($DATA(GMRVSTR)#2)!'($DATA(DFN)#2)
QUIT
if DFN'>0
QUIT
+49 NEW GMVIENGUID
+50 SET GMRSAVE=GMRVSTR
SET GMRSAVE(0)=GMRVSTR(0)
SET GMVIENGUID=0
+51 SET GMRVSTR="HT"
DO EN6^GMRVUTL
SET GMRVSTR=GMRSAVE
SET GMRVSTR(0)=GMRSAVE(0)
SET GMRHT=(+$PIECE(X,U,8)*2.54)/100
+52 IF $GET(GMRVSTR("LT"))=""
SET GMRVSTR("LT")=""
+53 FOR GMRVSTR(1)=1:1:$LENGTH(GMRVSTR,";")
Begin DoDot:1
+54 SET GMRVSTR("T")=$PIECE(GMRVSTR,";",GMRVSTR(1))
+55 IF $LENGTH(GMRVSTR("T"))
Begin DoDot:2
+56 SET GMRVSTR("B")=$SELECT($PIECE(GMRVSTR(0),U,1):$PIECE(GMRVSTR(0),U,1),1:0)
+57 SET GMRVSTR("E")=$SELECT($PIECE(GMRVSTR(0),U,2):$PIECE(GMRVSTR(0),U,2),1:9999999)
+58 SET GMRVSTR("O")=0
SET GMRVSTR("E")=GMRVSTR("E")+.000001
+59 DO GETD
End DoDot:2
End DoDot:1
+60 KILL GMRINF,GG,GMRSAVE,GMRHT,GMRVARY,GMRVSTR,GMRSITE,GMRQUAL,GMRVX,GMRZTY,GDATA
+61 QUIT
GETD ; LOOP THRU PXRMINDX XREF AND GET PATIENT DATA
+1 SET GMRVSTR("TDA")=$ORDER(^GMRD(120.51,"C",GMRVSTR("T"),0))
if 'GMRVSTR("TDA")
QUIT
+2 IF GMRVSTR("T")="BP"!(GMRVSTR("T")="P")
DO BP^GMRVUT2
QUIT
+3 FOR GMRVSTR("R")=GMRVSTR("E"):0
SET GMRVSTR("R")=$ORDER(^PXRMINDX(120.5,"PI",DFN,GMRVSTR("TDA"),GMRVSTR("R")),-1)
if GMRVSTR("R")<GMRVSTR("B")!(GMRVSTR("R")'>0)
QUIT
DO GETD1
if GMRVSTR("TMO")
QUIT
+4 QUIT
GETD1 ;
+1 NEW GMVCLIO
+2 ;max # of occurrences flag
SET GMRVSTR("TMO")=0
+3 SET GMRVSTR("IEN")=0
+4 FOR
SET GMRVSTR("IEN")=$ORDER(^PXRMINDX(120.5,"PI",DFN,GMRVSTR("TDA"),GMRVSTR("R"),GMRVSTR("IEN")))
if $LENGTH(GMRVSTR("IEN"))'>0
QUIT
Begin DoDot:1
+5 IF GMRVSTR("IEN")=+GMRVSTR("IEN")
Begin DoDot:2
+6 DO F1205^GMVUTL(.GMVCLIO,GMRVSTR("IEN"))
End DoDot:2
+7 IF GMRVSTR("IEN")'=+GMRVSTR("IEN")
Begin DoDot:2
+8 DO CLIO^GMVUTL(.GMVCLIO,GMRVSTR("IEN"))
End DoDot:2
+9 SET GMVCLIO(0)=$GET(GMVCLIO(0))
SET GMVCLIO(5)=$GET(GMVCLIO(5))
+10 IF GMVCLIO(0)=""!($PIECE(GMVCLIO(0),U,8)="")
QUIT
+11 DO SETU2^GMRVUT2
+12 QUIT
End DoDot:1
if GMRVSTR("TMO")
QUIT
+13 QUIT