source: WorldVistAEHR/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORHL16.m@ 1211

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

initial load of WorldVistAEHR

File size: 3.2 KB
RevLine 
[613]1RORHL16 ;HOIFO/BH,SG - HL7 VITALS DATA: OBR,OBX ; 8/31/05 2:16pm
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4 ; This routine uses the following IAs:
5 ;
6 ; #1446 EN1^GMRVUT0 (controlled)
7 ;
8 Q
9 ;
10 ;***** SEARCHES FOR VITALS DATA
11 ;
12 ; RORDFN IEN of the patient in the PATIENT file (#2)
13 ;
14 ; .DXDTS Reference to a local variable where the
15 ; data extraction time frames are stored.
16 ;
17 ; Return Values:
18 ; <0 Error code
19 ; 0 Ok
20 ; >0 Non-fatal error(s)
21 ;
22 ; The function uses ^UTILITY($J,"GMRVD") global node.
23 ;
24EN1(RORDFN,DXDTS) ;
25 N DFN,GMRVSTR,IDX,PAT,RC,RORENDT,RORSTDT
26 S (ERRCNT,RC)=0
27 ;
28 S IDX=0
29 F S IDX=$O(DXDTS(15,IDX)) Q:IDX'>0 D Q:RC<0
30 . S RORSTDT=$P(DXDTS(15,IDX),U),RORENDT=$P(DXDTS(15,IDX),U,2)
31 . ;--- Check to see if the patient has any Vitals data
32 . K ^UTILITY($J,"GMRVD")
33 . S DFN=RORDFN,GMRVSTR="BP;T;R;P;HT;WT;PN"
34 . S GMRVSTR(0)=RORSTDT_"^"_RORENDT_"^999999^0"
35 . D EN1^GMRVUT0
36 . Q:$D(^UTILITY($J,"GMRVD"))<10
37 . ;--- Process the data
38 . S TMP=$$OBR()
39 . I TMP Q:TMP<0 S ERRCNT=ERRCNT+TMP
40 . S TMP=$$OBX()
41 . I TMP Q:TMP<0 S ERRCNT=ERRCNT+TMP
42 ;
43 K ^UTILITY($J,"GMRVD")
44 Q $S(RC<0:RC,1:ERRCNT)
45 ;
46 ;***** VITALS OBR SEGMENT BUILDER
47 ;
48 ; Return Values:
49 ; <0 Error code
50 ; 0 Ok
51 ; >0 Non-fatal error(s)
52 ;
53OBR() ;
54 N CS,ERRCNT,RC,RORSEG
55 S (ERRCNT,RC)=0
56 D ECH^RORHL7(.CS)
57 ;
58 ;--- Initialize the segment
59 S RORSEG(0)="OBR"
60 ;
61 ;--- OBR-4 - Vitals CPT Code
62 S RORSEG(4)="94150"_CS_"VITAL CAPACITY TEST"_CS_"C4"
63 ;
64 ;--- OBR-24 - Diagnostic Service ID
65 S RORSEG(24)="EC"
66 ;
67 ;--- OBR-44 - Division
68 S RORSEG(44)=$$SITE^RORUTL03(CS)
69 ;
70 ;--- Store the segment
71 D ADDSEG^RORHL7(.RORSEG)
72 Q ERRCNT
73 ;
74 ;***** VITALS OBX SEGMENT(S) BUILDER
75 ;
76 ; Return Values:
77 ; <0 Error code
78 ; 0 Ok
79 ; >0 Non-fatal error(s)
80 ;
81OBX() ;
82 N CS,ERRCNT,RC,OBID
83 S (ERRCNT,RC)=0
84 D ECH^RORHL7(.CS)
85 ;
86 F OBID="BP^Blood Pressue^VA080","T^Temperature^VA080","R^Respiration^VA080","P^Pulse^VA080","HT^Height^VA080","WT^Weight^VA080","PN^Pain^VA080" D
87 . D VITALTYP($TR(OBID,"^",CS),CS)
88 ;
89 Q ERRCNT
90 ;
91 ;***** LOOPS THROUGH THE UTILITY GLOBAL FOR VITAL TYPE
92VITALTYP(OBID,CS) ;
93 N BODYMASS,DATA,DTE,IEN,MEASDATE,OBX5,TYPE,UNITS
94 S TYPE=$P(OBID,CS)
95 Q:'$D(^UTILITY($J,"GMRVD",TYPE))
96 ;---
97 S DTE=""
98 F S DTE=$O(^UTILITY($J,"GMRVD",TYPE,DTE)) Q:'DTE D
99 . S IEN=""
100 . F S IEN=$O(^UTILITY($J,"GMRVD",TYPE,DTE,IEN)) Q:'IEN D
101 . . S DATA=^UTILITY($J,"GMRVD",TYPE,DTE,IEN)
102 . . ;
103 . . S MEASDATE=$P(DATA,U) ;??? Temporary fix for Vitals API bug
104 . . I $L(MEASDATE)=8 S:$E(MEASDATE,8)="0" MEASDATE=$E(MEASDATE,1,7)
105 . . S MEASDATE=$$FM2HL^RORHL7(MEASDATE)
106 . . S UNITS=$P(DATA,U,13)
107 . . S BODYMASS=$S(TYPE="WT":$P(DATA,U,14),1:"")
108 . . ;
109 . . S OBX5=$P(DATA,U,8)_U_$P(DATA,U,11)_U_$P(DATA,U,17)
110 . . D SETOBX(OBID,IEN,OBX5,UNITS,BODYMASS,MEASDATE)
111 ;
112 Q
113 ;
114 ;*** CREATES AND STORES THE OBX SEGMENT
115SETOBX(OBX3,OBX4,OBX5,OBX6,OBX7,OBX14) ;
116 N RORSEG
117 ;--- Initialize the segment
118 S RORSEG(0)="OBX"
119 ;--- OBX-2
120 S RORSEG(2)="FT"
121 ;---
122 S RORSEG(3)=OBX3
123 S RORSEG(4)=OBX4
124 S RORSEG(5)=$$ESCAPE^RORHL7(OBX5)
125 S:$G(OBX6)'="" RORSEG(6)=OBX6
126 S:$G(OBX7)'="" RORSEG(7)=OBX7
127 S:$G(OBX14)'="" RORSEG(14)=OBX14
128 ;--- OBX-11
129 S RORSEG(11)="F"
130 ;--- Store the segment
131 D ADDSEG^RORHL7(.RORSEG)
132 Q
Note: See TracBrowser for help on using the repository browser.