source: WorldVistAEHR/trunk/r/GEN_MED_OTHER-GMV/GMVHDR.m@ 813

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1GMVHDR ;HIOFO/FT-HEALTH DATA REPOSITORY API ;10/21/04 13:03
2 ;;5.0;GEN. MED. REC. - VITALS;**2,17**;Oct 31, 2002
3 ;11/30/2005 KAM/BAY Remedy Call 121661 changes for HL7 message
4 ;
5 ; This routine uses the following IAs:
6 ; <None>
7 ;
8 ; This routine supports the following IAs:
9 ; EN - #4583 (Private)
10 ;
11EN(GMVIEN) ; This function returns a string containing the values
12 ; for the record number provided.
13 ;
14 ; Input: GMVIEN - FILE 120.5 Internal Entry Number (IEN)
15 ; Output: A string of data where:
16 ; piece 1 = (#.01) DATE/TIME VITALS TAKEN (internal)
17 ; piece 2 = (#.02) PATIENT (internal)
18 ; piece 3 = (#.03) VITAL TYPE (external)
19 ; piece 4 = (#.04) DATE/TIME VITALS ENTERED (internal)
20 ; piece 5 = (#.05) HOSPITAL LOCATION (internal)
21 ; piece 6 = (#.06) ENTERED BY (internal)
22 ; piece 7 = (#.03) VITAL TYPE (internal)
23 ; piece 8 = (#1.2) RATE
24 ; piece 9 = UNITS (value is computed by this routine)
25 ; piece 10 = (#1.4) SUPPLEMENTAL O2 (internal)
26 ; piece 11 = (#2) ENTERED IN ERROR (internal)
27 ; piece 12 = (#3) ERROR ENTERED BY (internal)
28 ; piece 13 = (#4) REASON ENTERED IN ERROR (multiple) (external)
29 ; Values are separated by a tilde (~).
30 ; piece 14 = (#5) QUALIFIER (multiple) (external)
31 ; Values are separated by a tilde (~).
32 ;
33 ; Returns a null value if the entry does not exist.
34 ;
35 I '$G(GMVIEN) Q ""
36 N GMVA,GMVLIST,GMVLOOP,GMVNODE,GMVNODE2,GMVQUALE,GMVQUALI,GMVUNIT,GMVVTE,GMVVTI,GMVX
37 S GMVNODE=$G(^GMR(120.5,+GMVIEN,0)) ; zero node of patient record
38 ; check if record is complete
39 F GMVLOOP=1,2,3,4,5,6,8 I $P(GMVNODE,U,GMVLOOP)="" D
40 .H 1
41 .S GMVNODE=$G(^GMR(120.5,+GMVIEN,0)) ;get zero node again
42 .Q
43 I GMVNODE="" Q ""
44 I $P(GMVNODE,U,1)'>0 Q "" ;date/time vitals taken
45 I $P(GMVNODE,U,2)'>0 Q "" ;dfn
46 S GMVVTI=+$P(GMVNODE,U,3) ;vital type ien
47 S GMVVTE=$P($G(^GMRD(120.51,GMVVTI,0)),U,1) ;vital type name
48 I GMVVTE="" Q ""
49 I $$ACTIVE^GMVUID(120.51,"",GMVVTI_",","") Q "" ; not active vuid
50 S GMVA=$P($G(^GMRD(120.51,GMVVTI,0)),U,2) ;vital abbreviation
51 S $P(GMVNODE,U,3)=GMVVTE,$P(GMVNODE,U,7)=GMVVTI
52 S GMVUNIT=$S(GMVA="BP":"mmHg",GMVA="T":"F",GMVA="R":"/min",GMVA="P":"/min",GMVA="HT":"in",GMVA="WT":"lb",GMVA="CVP":"cmH2O",GMVA="CG":"in",GMVA="PO2":"%SpO2",1:"")
53 S $P(GMVNODE,U,9)=GMVUNIT
54 S:+$P(GMVNODE,U,5)'>0 $P(GMVNODE,U,5)="" ;hospital location
55 S:+$P(GMVNODE,U,6)'>0 $P(GMVNODE,U,6)="" ;entered by
56 S GMVNODE2=$G(^GMR(120.5,GMVIEN,2))
57 S $P(GMVNODE,U,11)=$S($P(GMVNODE2,U,1)=1:"YES",1:"")
58 S $P(GMVNODE,U,12)=$S($P(GMVNODE2,U,2)>0:$P(GMVNODE2,U,2),1:"")
59 ; reason (multiple)
60 S GMVLOOP=0,GMVLIST=""
61 F S GMVLOOP=$O(^GMR(120.5,GMVIEN,2.1,GMVLOOP)) Q:'GMVLOOP D
62 .S GMVX=$P($G(^GMR(120.5,GMVIEN,2.1,GMVLOOP,0)),U,1)
63 .Q:GMVX=""
64 .S GMVX=GMVX_"-"_$S(GMVX=1:"INCORRECT DATE/TIME",GMVX=2:"INCORRECT READING",GMVX=3:"INCORRECT PATIENT",GMVX=4:"INVALID RECORD",1:"")
65 .S GMVLIST=GMVLIST_GMVX_"~"
66 .Q
67 I $E(GMVLIST,$L(GMVLIST))="~" S GMVLIST=$E(GMVLIST,1,($L(GMVLIST)-1))
68 S $P(GMVNODE,U,13)=GMVLIST
69 ;qualifiers (multiple)
70 S GMVLOOP=0,GMVLIST=""
71 F S GMVLOOP=$O(^GMR(120.5,GMVIEN,5,GMVLOOP)) Q:'GMVLOOP D
72 .S GMVQUALI=$P($G(^GMR(120.5,GMVIEN,5,GMVLOOP,0)),U,1)
73 .S GMVQUALE=$P($G(^GMRD(120.52,+GMVQUALI,0)),U,1)
74 .Q:GMVQUALE=""
75 .S GMVLIST=GMVLIST_GMVQUALE_"~"
76 .Q
77 I $E(GMVLIST,$L(GMVLIST))="~" S GMVLIST=$E(GMVLIST,1,($L(GMVLIST)-1))
78 S $P(GMVNODE,U,14)=GMVLIST
79 Q GMVNODE
80 ;
Note: See TracBrowser for help on using the repository browser.