GMRVUTL ;HIOFO/RM,MD,FT-CALLABLE ENTRY POINTS FOR PROGRAMMER UTILITIES ;5/8/07
;;5.0;GEN. MED. REC. - VITALS;**23,31**;Oct 31, 2002;Build 2
;
; This routine uses the following IAs:
; #4290 - ^PXRMINDX global (controlled)
; 05/02/2016 KAM GMRV*5*31 Rem Ticket 1004874 Vitals Measurement
; Remedy ticket closed and transferred to CA Ticket I9840386FY16
;
EN1 ; CALL TO CONVERT TEMPERATURE (F) IN VARIABLE X TO TEMPERATURE (C)
; IN VARIABLE Y
S Y=$J(X-32*5/9,0,1)
Q
EN2 ; CALL TO CONVERT AN INCHES MEASUREMENT IN X TO A CENTIMETER
; MEASUREMENT IN Y
S Y=$J(2.54*X,0,2)
Q
EN3 ; CALL TO CONVERT A WEIGHT (LBS) IN VARIABLE X TO A WEIGHT (KG)
; IN VARIABLE Y
;
; 05/02/2016 KAM GMRV*5*31 Rem Ticket 1004874 Changed next line
; lbs to kgs conversion factor
; Remedy ticket closed and transferred to CA Ticket I9840386FY16
;
;S Y=$J(X/2.2,0,2)
S Y=$J(X/2.20462262,0,2)
Q
;EN4 ; CALL TO RETURN PATIENT'S LATEST WEIGHT READING
; PATIENT DEFINED BY DFN, WEIGHT RETURNED IN X
;Q:'$D(DFN) S X="",GMRVIT=$O(^GMRD(120.51,"B","WEIGHT",0)) I GMRVIT'>0 K GMRVIT Q
;F GMRX=0:0 S GMRX=$O(^GMR(120.5,"AA",DFN,GMRVIT,GMRX)) Q:GMRX'>0!(X'="") F GMRY=0:0 S GMRY=$O(^GMR(120.5,"AA",DFN,GMRVIT,GMRX,GMRY)) Q:GMRY'>0 D
;. I $S('$D(^GMR(120.5,GMRY,2)):1,$P(^(2),"^")="":1,1:0) S X=$S($D(^(0))&($P(^(0),"^",8)>0):$P(^(0),"^",8),1:"")
;K GMRVIT,GMRX,GMRY,GMRZ
;Q
;Q
EN6 ; ENTRY TO GET LATEST PATIENT VITAL/MEASUREMENT DATA <IA 1120 - SUPPORTED>
; INPUT VARIABLES:
; DFN = Patient IEN (REQUIRED)
; GMRVSTR = Abbreviation of vital type in Vital Type (120.51) file.
; (REQUIRED)
; OUTPUT VARIABLES:
; X = ^GMR(120.5,IEN,0) where IEN is entry number of latest V/M.
; X Global contains qualifiers, for example
; X(1)=R ARM, X(2)=LYING for BP
; GMRVSTR will be killed.
S X="" I '$D(DFN)!'$D(GMRVSTR) Q
S GMRVSTR("TDA")=$O(^GMRD(120.51,"C",GMRVSTR,0))
G Q6:GMRVSTR("TDA")'>0
S GMRVSTR("R")=9999999
F S GMRVSTR("R")=$O(^PXRMINDX(120.5,"PI",DFN,GMRVSTR("TDA"),GMRVSTR("R")),-1) Q:GMRVSTR("R")'>0!(X'="") D C6
Q6 K GMRVSTR
Q
C6 ;
N GMVCNT,GMVLOOP,GMVQIEN,GMVTEMP
F GMRVSTR("IEN")=0:0 S GMRVSTR("IEN")=$O(^PXRMINDX(120.5,"PI",DFN,GMRVSTR("TDA"),GMRVSTR("R"),GMRVSTR("IEN"))) Q:$L(GMRVSTR("IEN"))'>0!(X'="") D
.I GMRVSTR("IEN")=+GMRVSTR("IEN") D
..D F1205^GMVUTL(.GMVTEMP,+GMRVSTR("IEN"),0)
..S X=$G(GMVTEMP(0)),GMVTEMP(5)=$G(GMVTEMP(5))
..Q
.I GMRVSTR("IEN")'=+GMRVSTR("IEN") D
..D CLIO^GMVUTL(.GMVTEMP,GMRVSTR("IEN"))
..I '$D(GMVTEMP(0)) Q
..S X=GMVTEMP(0),GMVTEMP(5)=$G(GMVTEMP(5))
..Q
.Q
I X="" Q
I "REFUSEDPASSUNAVAILABLE"[$$UP^XLFSTR($P(X,U,8)) S X="" Q
S GMVCNT=0
F GMVLOOP=1:1 Q:$P(GMVTEMP(5),U,GMVLOOP)="" D
.S GMVQIEN=$P(GMVTEMP(5),U,GMVLOOP)
.I GMVQIEN>0 D
..S GMVCNT=GMVCNT+1
..S X(GMVCNT)=$G(^GMRD(120.52,+GMVQIEN,0))
..Q
.Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRVUTL 2910 printed Dec 13, 2024@01:57:41 Page 2
GMRVUTL ;HIOFO/RM,MD,FT-CALLABLE ENTRY POINTS FOR PROGRAMMER UTILITIES ;5/8/07
+1 ;;5.0;GEN. MED. REC. - VITALS;**23,31**;Oct 31, 2002;Build 2
+2 ;
+3 ; This routine uses the following IAs:
+4 ; #4290 - ^PXRMINDX global (controlled)
+5 ; 05/02/2016 KAM GMRV*5*31 Rem Ticket 1004874 Vitals Measurement
+6 ; Remedy ticket closed and transferred to CA Ticket I9840386FY16
+7 ;
EN1 ; CALL TO CONVERT TEMPERATURE (F) IN VARIABLE X TO TEMPERATURE (C)
+1 ; IN VARIABLE Y
+2 SET Y=$JUSTIFY(X-32*5/9,0,1)
+3 QUIT
EN2 ; CALL TO CONVERT AN INCHES MEASUREMENT IN X TO A CENTIMETER
+1 ; MEASUREMENT IN Y
+2 SET Y=$JUSTIFY(2.54*X,0,2)
+3 QUIT
EN3 ; CALL TO CONVERT A WEIGHT (LBS) IN VARIABLE X TO A WEIGHT (KG)
+1 ; IN VARIABLE Y
+2 ;
+3 ; 05/02/2016 KAM GMRV*5*31 Rem Ticket 1004874 Changed next line
+4 ; lbs to kgs conversion factor
+5 ; Remedy ticket closed and transferred to CA Ticket I9840386FY16
+6 ;
+7 ;S Y=$J(X/2.2,0,2)
+8 SET Y=$JUSTIFY(X/2.20462262,0,2)
+9 QUIT
+10 ;EN4 ; CALL TO RETURN PATIENT'S LATEST WEIGHT READING
+11 ; PATIENT DEFINED BY DFN, WEIGHT RETURNED IN X
+12 ;Q:'$D(DFN) S X="",GMRVIT=$O(^GMRD(120.51,"B","WEIGHT",0)) I GMRVIT'>0 K GMRVIT Q
+13 ;F GMRX=0:0 S GMRX=$O(^GMR(120.5,"AA",DFN,GMRVIT,GMRX)) Q:GMRX'>0!(X'="") F GMRY=0:0 S GMRY=$O(^GMR(120.5,"AA",DFN,GMRVIT,GMRX,GMRY)) Q:GMRY'>0 D
+14 ;. I $S('$D(^GMR(120.5,GMRY,2)):1,$P(^(2),"^")="":1,1:0) S X=$S($D(^(0))&($P(^(0),"^",8)>0):$P(^(0),"^",8),1:"")
+15 ;K GMRVIT,GMRX,GMRY,GMRZ
+16 ;Q
+17 ;Q
EN6 ; ENTRY TO GET LATEST PATIENT VITAL/MEASUREMENT DATA <IA 1120 - SUPPORTED>
+1 ; INPUT VARIABLES:
+2 ; DFN = Patient IEN (REQUIRED)
+3 ; GMRVSTR = Abbreviation of vital type in Vital Type (120.51) file.
+4 ; (REQUIRED)
+5 ; OUTPUT VARIABLES:
+6 ; X = ^GMR(120.5,IEN,0) where IEN is entry number of latest V/M.
+7 ; X Global contains qualifiers, for example
+8 ; X(1)=R ARM, X(2)=LYING for BP
+9 ; GMRVSTR will be killed.
+10 SET X=""
IF '$DATA(DFN)!'$DATA(GMRVSTR)
QUIT
+11 SET GMRVSTR("TDA")=$ORDER(^GMRD(120.51,"C",GMRVSTR,0))
+12 if GMRVSTR("TDA")'>0
GOTO Q6
+13 SET GMRVSTR("R")=9999999
+14 FOR
SET GMRVSTR("R")=$ORDER(^PXRMINDX(120.5,"PI",DFN,GMRVSTR("TDA"),GMRVSTR("R")),-1)
if GMRVSTR("R")'>0!(X'="")
QUIT
DO C6
Q6 KILL GMRVSTR
+1 QUIT
C6 ;
+1 NEW GMVCNT,GMVLOOP,GMVQIEN,GMVTEMP
+2 FOR GMRVSTR("IEN")=0:0
SET GMRVSTR("IEN")=$ORDER(^PXRMINDX(120.5,"PI",DFN,GMRVSTR("TDA"),GMRVSTR("R"),GMRVSTR("IEN")))
if $LENGTH(GMRVSTR("IEN"))'>0!(X'="")
QUIT
Begin DoDot:1
+3 IF GMRVSTR("IEN")=+GMRVSTR("IEN")
Begin DoDot:2
+4 DO F1205^GMVUTL(.GMVTEMP,+GMRVSTR("IEN"),0)
+5 SET X=$GET(GMVTEMP(0))
SET GMVTEMP(5)=$GET(GMVTEMP(5))
+6 QUIT
End DoDot:2
+7 IF GMRVSTR("IEN")'=+GMRVSTR("IEN")
Begin DoDot:2
+8 DO CLIO^GMVUTL(.GMVTEMP,GMRVSTR("IEN"))
+9 IF '$DATA(GMVTEMP(0))
QUIT
+10 SET X=GMVTEMP(0)
SET GMVTEMP(5)=$GET(GMVTEMP(5))
+11 QUIT
End DoDot:2
+12 QUIT
End DoDot:1
+13 IF X=""
QUIT
+14 IF "REFUSEDPASSUNAVAILABLE"[$$UP^XLFSTR($PIECE(X,U,8))
SET X=""
QUIT
+15 SET GMVCNT=0
+16 FOR GMVLOOP=1:1
if $PIECE(GMVTEMP(5),U,GMVLOOP)=""
QUIT
Begin DoDot:1
+17 SET GMVQIEN=$PIECE(GMVTEMP(5),U,GMVLOOP)
+18 IF GMVQIEN>0
Begin DoDot:2
+19 SET GMVCNT=GMVCNT+1
+20 SET X(GMVCNT)=$GET(^GMRD(120.52,+GMVQIEN,0))
+21 QUIT
End DoDot:2
+22 QUIT
End DoDot:1
+23 QUIT