source: FOIAVistA/trunk/r/GEN_MED_OTHER-GMV/GMVUTL7.m@ 914

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

initial load of FOIAVistA 6/30/08 version

File size: 4.8 KB
Line 
1GMVUTL7 ;HIOFO/DS,FT-RPC API TO RETURN ALL VITALS/CATEGORIES/QUALIFIERS ;7/17/02 14:52
2 ;;5.0;GEN. MED. REC. - VITALS;**3**;Oct 31, 2002
3 ;
4 ; This routine uses the following IAs:
5 ; #10035 - FILE 2 references (supported)
6 ; #10103 - ^XLFDT calls (supported)
7 ;
8 ; This routine supports the following IAs:
9 ; #4355 - GMV GET CURRENT TIME RPC is called at TIME (private)
10 ; #4359 - GMV VITALS/CAT/QUAL RPC is called at GETVITAL (private)
11 ;
12GETVITAL(RESULT,GMVLIST) ; GMV VITALS/CAT/QUAL [RPC entry point]
13 ; Returns all vital qual info in RESULT
14 ;GMVLIST is either "" for all vitals or a list of required eg 1^2^
15 N GMVNUM,GMVDATA,GMVDO,GMVLOOP
16 S GMVNUM=1
17 I GMVLIST'="" D
18 . F GMVLOOP=1:1:$L(GMVLIST,"^") D
19 .. S GMVDO=$P(GMVLIST,"^",GMVLOOP)
20 .. Q:GMVDO=""
21 .. S GMVDO=$$GETIEN(GMVDO)
22 .. Q:GMVDO=""
23 .. S RESULT(GMVNUM)=$$GETDATA(GMVDO)_"^"_$$ABBVAL(GMVDO)
24 .. D GETALL(GMVNUM,.RESULT)
25 .. S GMVNUM=GMVNUM+1
26 .. Q
27 . Q
28 E D
29 . S GMVLOOP=0
30 . F S GMVLOOP=$O(^GMRD(120.51,GMVLOOP)) Q:GMVLOOP'>0 D
31 .. S RESULT(GMVNUM)=$$GETDATA(GMVLOOP)_"^"_$$ABBVAL(GMVLOOP)
32 .. D GETALL(GMVNUM,.RESULT)
33 .. S GMVNUM=GMVNUM+1
34 .. Q
35 . Q
36 Q
37GETALL(GMVLOOP,RESULT) ;
38 S GMVCNT=0
39 ;S GMVLOOP="" F S GMVLOOP=$O(RESULT(GMVLOOP)) Q:GMVLOOP="" D
40 Q:$G(RESULT(GMVLOOP))=""
41 Q:$P(RESULT(GMVLOOP),"^",1)'="V"
42 S GMVITTYP=$P(RESULT(GMVLOOP),"^",2)
43 S GMVD2=""
44 S GMVCNT=GMVLOOP+.001
45 F S GMVD2=$O(^GMRD(120.53,"C",GMVITTYP,GMVD2)) Q:GMVD2'>0 D
46 . S GMVD1=0
47 . F S GMVD1=$O(^GMRD(120.53,"C",GMVITTYP,GMVD2,GMVD1)) Q:GMVD1'>0 D
48 .. S GMVDATA=$P($G(^GMRD(120.53,GMVD2,0)),U)
49 .. I GMVDATA]"" D
50 ... S GMVITTYP(0)=$G(^GMRD(120.51,+GMVITTYP,0))
51 ... S GMVITTYP(1)=GMVITTYP,GMVITTYP(2)=$P(GMVITTYP(0),U,2)
52 ... S GMVITTYP(3)=$P(GMVITTYP(0),U)
53 ... S GMVDEFQ=$P($G(^GMRD(120.53,GMVD2,1,GMVD1,0)),U,7)
54 ... S GMVDEFQ(0)=$G(^GMRD(120.52,+GMVDEFQ,0))
55 ... S GMVDEFQ(1)=GMVDEFQ,GMVDEFQ(2)=$P(GMVDEFQ(0),U,2)
56 ... S GMVDEFQ(3)=$P(GMVDEFQ(0),U)
57 ... S RESULT(GMVCNT)="C"_U_GMVD2_U_GMVDATA
58 ... D GETCAT(GMVITTYP,GMVD2,.RESULT,.GMVCNT)
59 ... S GMVCNT=GMVCNT+.001
60 ... Q
61 .. Q
62 . Q
63 Q
64GETDATA(GMVVITAL) ;
65 N GMVDATA,GMVD0,GMVD1
66 I $G(^GMRD(120.51,GMVVITAL,0))="" D Q GMVRES
67 . S GMVRES="V^"_GMVVITAL_"^ERROR"
68 . Q
69 S GMVDATA=$G(^GMRD(120.51,GMVVITAL,0))
70 I GMVDATA]"" S GMVRES="V"_U_GMVVITAL_U_$P(GMVDATA,U)_U_$P(GMVDATA,U,2)_U_$P(GMVDATA,U,7)
71 Q GMVRES
72GETCAT(GMVVTP,GMVITCAT,RESULT,GMVNUM) ;
73 N GMVD0,GMVD1,GMVCNT
74 S GMVD0=0,GMVCNT=0
75 F S GMVD0=$O(^GMRD(120.52,"C",GMVITTYP,GMVD0)) Q:GMVD0'>0 D
76 . S GMVD1=0
77 . F S GMVD1=$O(^GMRD(120.52,"C",GMVITTYP,GMVD0,GMVD1)) Q:GMVD1'>0 D
78 .. S GMVCATD0=$P($G(^GMRD(120.52,GMVD0,1,GMVD1,0)),U,2)
79 .. I $G(GMVITCAT)>0,GMVITCAT'=GMVCATD0 Q
80 .. S GMVDATA=$G(^GMRD(120.52,GMVD0,0))
81 .. I GMVDATA]"" D
82 ... S GMVITTYP(0)=$G(^GMRD(120.51,+GMVITTYP,0))
83 ... S GMVITTYP(1)=GMVITTYP,GMVITTYP(2)=$P(GMVITTYP(0),U,2)
84 ... S GMVITTYP(3)=$P(GMVITTYP(0),U)
85 ... S GMVITCAT(0)=$G(^GMRD(120.53,+GMVCATD0,0))
86 ... S GMVITCAT(1)=GMVCATD0,(GMVITCAT(2),GMVITCAT(3))=$P(GMVITCAT(0),U)
87 ... S GMVNUM=GMVNUM+.001
88 ... S RESULT(GMVNUM)="Q"_U_GMVD0_U_$P(GMVDATA,U)_U_$P(GMVDATA,U,2)
89 ... Q
90 .. Q
91 . Q
92 Q
93ABBVAL(VITALTYP) ;
94 N RESULT,GMVDATA
95 ; Gets high low values if they exist
96 I $G(^GMRD(120.57,1,1))="" Q ""
97 S RESULT=""
98 S GMVDATA=$P($G(^GMRD(120.57,1,1)),U,1,13)
99 I VITALTYP=1 D
100 . ; BP
101 . S RESULT=$P(GMVDATA,U,7,10)
102 . Q
103 I VITALTYP=2 D
104 . ; Temprature
105 . S RESULT=$P(GMVDATA,U,1,2)
106 . Q
107 I VITALTYP=5 D
108 . ; Pulse
109 . S RESULT=$P(GMVDATA,U,3,4)
110 . Q
111 I VITALTYP=3 D
112 . ;Respirations
113 . S RESULT=$P(GMVDATA,U,5,6)
114 . Q
115 I VITALTYP=19 D
116 . ;CVP
117 . S RESULT=$P(GMVDATA,U,11,13)
118 . Q
119 Q RESULT
120GETIEN(GMVABB) ; Gets IEN from the Abbreviation code.
121 Q $O(^GMRD(120.51,"C",GMVABB,""))
122ROOMPT(RESULTS,GMVWRD,GMVRLST) ; GMV WARD/ROOM PATIENTS [RPC entry point]
123 ; Returns a list of patients in the ward and rooms specified
124 ; Input:
125 ; RESULTS - name of the array to hold the patient list
126 ; GMVWRD - name of the ward (e.g., 2EAST)
127 ; GMVRLST - the room numbers of the ward separated by comma
128 ; (e.g., 200,210,220)
129 ; Output:
130 ; RESULT(n)=patient name^DFN^DOB (external)^SSN (no hyphens)
131 ;
132 ; n is a sequential number beginning with 0 (zero)
133 N GMRVROOM,GMRVLST,GMRVCNT,GMVT,GMVDF
134 K RESULTS
135 S GMVWARD(1)=GMVWRD
136 I GMVRLST["," D
137 . F GMVA=1:1:$L(GMVRLST)+1 D
138 . . Q:$P(GMVRLST,",",GMVA)=""
139 . . S GMVROOM($P($P(GMVRLST,",",GMVA),"-"))=""
140 . . Q
141 . Q
142 E D
143 . S GMVROOM($P(GMVRLST,"-"))=""
144 . Q
145 S GMVEDB="S"
146 K ^TMP($J)
147 D WARD^GMVDS1
148 S GMVT="",GMVCNT=0
149 F S GMVT=$O(^TMP($J,GMVT)) Q:GMVT="" D
150 . S GMVN=""
151 . F S GMVN=$O(^TMP($J,GMVT,GMVN)) Q:GMVN="" D
152 . . S GMVDF=""
153 . . F S GMVDF=$O(^TMP($J,GMVT,GMVN,GMVDF)) Q:GMVDF="" D
154 . . . S GMVDOB=$$FMTE^XLFDT($P(^DPT(GMVDF,0),"^",3))
155 . . . S GMVSSN=$P(^DPT(GMVDF,0),"^",9)
156 . . . S RESULTS(GMVCNT)=GMVN_"^"_GMVDF_"^"_GMVDOB_"^"_GMVSSN
157 . . . S GMVCNT=GMVCNT+1
158 . . . Q
159 . . Q
160 . Q
161 Q
162TIME(RESULT,P2) ;Gets current time
163 S RESULT=$$NOW^XLFDT()
164 Q
Note: See TracBrowser for help on using the repository browser.