source: WorldVistAEHR/trunk/r/GEN_MED_REC_VITALS-GMRV/GMRVUTL.m@ 1006

Last change on this file since 1006 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.0 KB
Line 
1GMRVUTL ;HIRMFO/RM,MD-CALLABLE ENTRY POINTS FOR PROGRAMMER UTILITIES ;12/7/90
2 ;;4.0;Vitals/Measurements;;Apr 25, 1997
3EN1 ; CALL TO CONVERT TEMPERATURE (F) IN VARIABLE X TO TEMPERATURE (C)
4 ; IN VARIABLE Y
5 S Y=$J(X-32*5/9,0,1)
6 Q
7EN2 ; CALL TO CONVERT AN INCHES MEASUREMENT IN X TO A CENTIMETER
8 ; MEASUREMENT IN Y
9 S Y=$J(2.54*X,0,2)
10 Q
11EN3 ; CALL TO CONVERT A WEIGHT (LBS) IN VARIABLE X TO A WEIGHT (KG)
12 ; IN VARIABLE Y
13 S Y=$J(X/2.2,0,2)
14 Q
15EN4 ; CALL TO RETURN PATIENTS LATEST WEIGHT READING
16 ; PATIENT DEFINED BY DFN, WEIGHT RETURNED IN X
17 Q:'$D(DFN) S X="",GMRVIT=$O(^GMRD(120.51,"B","WEIGHT",0)) I GMRVIT'>0 K GMRVIT Q
18 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
19 . 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:"")
20 K GMRVIT,GMRX,GMRY,GMRZ
21 Q
22 ;Q
23EN6 ; ENTRY TO GET LATEST PATIENT VITAL/MEASURMENT DATA
24 ; INPUT VARIABLES:
25 ; DFN = Patient IEN (REQUIRED)
26 ; GMRVSTR = Abbreviation of vital type in Vital Type (120.51) file.
27 ; (REQUIRED)
28 ; OUTPUT VARIABLES:
29 ; X = ^GMR(120.5,IEN,0) where IEN is entry number of latest V/M.
30 ; X Global contains qualifiers, for example
31 ; X(1)=R ARM, X(2)=LYING for BP
32 ; GMRVSTR will be killed.
33 S X="" I '$D(DFN)!'$D(GMRVSTR) Q
34 S GMRVSTR("TDA")=$O(^GMRD(120.51,"C",GMRVSTR,0)) G Q6:GMRVSTR("TDA")'>0
35 F GMRVSTR("R")=0:0 S GMRVSTR("R")=$O(^GMR(120.5,"AA",DFN,GMRVSTR("TDA"),GMRVSTR("R"))) Q:GMRVSTR("R")'>0!(X'="") D C6
36Q6 K GMRVSTR
37 Q
38C6 ;
39 F GMRVSTR("IEN")=0:0 S GMRVSTR("IEN")=$O(^GMR(120.5,"AA",DFN,GMRVSTR("TDA"),GMRVSTR("R"),GMRVSTR("IEN"))) Q:GMRVSTR("IEN")'>0 I $S('$D(^GMR(120.5,GMRVSTR("IEN"),2)):1,'$P(^(2),"^"):1,1:0) D
40 . S X=$S($D(^(0))&($P(^(0),"^",8)>0):^(0),1:"")
41 . F GMRVSTR("QUAL")=0:0 S GMRVSTR("QUAL")=$O(^GMR(120.5,GMRVSTR("IEN"),5,GMRVSTR("QUAL"))) Q:GMRVSTR("QUAL")'>0 S X(GMRVSTR("QUAL"))=$G(^GMRD(120.52,+^GMR(120.5,GMRVSTR("IEN"),5,GMRVSTR("QUAL"),0),0))
42 Q
Note: See TracBrowser for help on using the repository browser.