source: FOIAVistA/trunk/r/HEALTH_SUMMARY-GMTS/GMTSVSS.m@ 1742

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

initial load of FOIAVistA 6/30/08 version

File size: 6.5 KB
Line 
1GMTSVSS ; SLC/KER - Selected Vital Signs ; 02/27/2002
2 ;;2.7;Health Summary;**8,20,28,35,49,78**;Oct 20, 1995
3 ;
4 ; External References
5 ; DBIA 4791 EN1^GMVHS
6 ; DBIA 10141 $$VERSION^XPDUTL
7 ; DBIA 10015 EN^DIQ1
8 ; DBIA 10022 %XY^%RCR
9 ;
10 ; Health Summary patch GMTS*2.7*35 will require
11 ; Vitals version 4.0, patch GMRV*4.0*7
12 ;
13OUTPAT ; Outpatient Select Vitals Signs Main control
14 N CNT,COL,COLL,HDR,GMTSDA,GMTSDT,GMTSF,GMTSI,GMW,GMRVSTR,LOOP,MAX,ROW,WIDTH
15 K ^UTILITY($J,"GMRVD") S MAX=$S(+($G(GMTSNDM))>0:+($G(GMTSNDM)),1:100)
16 S GMTSI=0 F S GMTSI=$O(GMTSEG(GMTSEGN,120.51,GMTSI)) Q:GMTSI'>0 S GMTSDA=GMTSEG(GMTSEGN,120.51,GMTSI) D BLDSTR
17 Q:'$D(GMRVSTR)
18 S GMRVSTR(0)=GMTSBEG_U_GMTSEND_U_MAX_U_1
19 ; Set to only get Vital Sign for Clinics
20 S GMRVSTR("LT")="^C^"
21 ;D BLDHDR,EN1^GMRVUT0
22 D BLDHDR,EN1^GMVHS
23 ; If no data, display most recent inpatient measurements
24 I '$D(^UTILITY($J,"GMRVD")) D Q
25 . D CKP^GMTSUP Q:$D(GMTSQIT) W "*** No Outpatient measurements ***",!!
26 . S MAX=1 D ENVS
27 S ROW=1 D NXTROW
28 D WRTHDR,WRTHDR1
29 S GMTSDT="" F GMTSF=1:1:MAX S GMTSDT=$O(^UTILITY($J,"GMRVD",GMTSDT)) Q:GMTSDT'>0 D WRT Q:$D(GMTSQIT) D CKP^GMTSUP Q:$D(GMTSQIT) W !
30 I $O(COL(ROW)) F ROW=2:1 Q:'$D(COL(ROW))!($D(GMTSQIT)) D
31 . D NXTROW
32 . W !! D WRTHDR,WRTHDR1
33 . S GMTSDT="" F GMTSF=1:1:MAX S GMTSDT=$O(^UTILITY($J,"GMRVD",GMTSDT)) Q:GMTSDT'>0 D WRT Q:$D(GMTSQIT) D CKP^GMTSUP Q:$D(GMTSQIT) W !
34 K ^UTILITY($J,"GMRVD"),GMTSVMVR
35 Q
36ENVS ; Set up for extraction routine
37 N CNT,COL,COLL,HDR,HDR1,GMTSDA,GMTSDT,GMTSF,GMTSI,GMW,LOOP,ROW,WIDTH
38 K ^UTILITY($J,"GMRVD"),GMRVSTR("LT")
39 S MAX=$S(+($G(MAX))>0:MAX,+($G(MAX))'>0&(+($G(GMTSNDM))>0):+($G(GMTSNDM)),1:100)
40 S GMTSI=0 F S GMTSI=$O(GMTSEG(GMTSEGN,120.51,GMTSI)) Q:GMTSI'>0 S GMTSDA=GMTSEG(GMTSEGN,120.51,GMTSI) D BLDSTR
41 Q:'$D(GMRVSTR)
42 S GMRVSTR(0)=GMTSBEG_U_GMTSEND_U_MAX_U_1
43 ;D BLDHDR,EN1^GMRVUT0
44 D BLDHDR,EN1^GMVHS
45 I '$D(^UTILITY($J,"GMRVD")) Q
46 S ROW=1 D NXTROW
47 D WRTHDR,WRTHDR1
48 S GMTSDT="" F GMTSF=1:1:MAX S GMTSDT=$O(^UTILITY($J,"GMRVD",GMTSDT)) Q:GMTSDT'>0 D WRT Q:$D(GMTSQIT) D CKP^GMTSUP Q:$D(GMTSQIT) W !
49 I $O(COL(ROW)) F ROW=2:1 Q:'$D(COL(ROW))!($D(GMTSQIT)) D
50 . D NXTROW
51 . W !! D WRTHDR,WRTHDR1
52 . S GMTSDT="" F GMTSF=1:1:MAX S GMTSDT=$O(^UTILITY($J,"GMRVD",GMTSDT)) Q:GMTSDT'>0 D WRT Q:$D(GMTSQIT) D CKP^GMTSUP Q:$D(GMTSQIT) W !
53 K ^UTILITY($J,"GMRVD"),GMTSVMVR
54 Q
55BLDSTR ; Builds GMRVSTR string for extract call
56 N DA,DIC,DIQ,DR,VIT
57 S GMTSVMVR=+$$VERSION^XPDUTL("GMRV")
58 S DIQ="VIT(",DIQ(0)="E",DIC=120.51,DR="1",DA=GMTSDA
59 D EN^DIQ1 S VIT=VIT(120.51,DA,1,"E")
60 S GMRVSTR=$S($D(GMRVSTR):GMRVSTR_";"_VIT,1:VIT)
61 Q
62BLDHDR ; Builds the HDR array
63 N ABB,GMTSI S COL=18
64 F GMTSI=1:1:$L(GMRVSTR,";") D
65 . S (HDR(GMTSI-1),ABB)=$P(GMRVSTR,";",GMTSI)
66 . S HDR(GMTSI-1)=HDR(GMTSI-1)_U
67 . S HDR(GMTSI-1)=HDR(GMTSI-1)_$S(ABB="BP":"BP",ABB="PN":"PAIN",ABB="HT":"HEIGHT",ABB="WT":"WEIGHT",ABB="P":"PULSE",ABB="R":"RESP",ABB="T":"TEMP",ABB="PO2":"POx",1:ABB)
68 . S WIDTH=$S($P(HDR(GMTSI-1),U)="T":13,$P(HDR(GMTSI-1),U)="P":8,$P(HDR(GMTSI-1),U)="R":12,$P(HDR(GMTSI-1),U)="WT":20,$P(HDR(GMTSI-1),U)="CG":34,$P(HDR(GMTSI-1),U)="CVP":16,$P(HDR(GMTSI-1),U)="HT":13,$P(HDR(GMTSI-1),U)="PO2":13,1:12)
69 . S COLL=$P(COL,U,GMTSI)+WIDTH
70 . S COL=COL_U
71 . S COL=COL_COLL
72 . S HDR(GMTSI-1)=HDR(GMTSI-1)_U_COLL_U_WIDTH
73 S ROW=1,COL(ROW)=18,COLL=18,CNT=0
74 F LOOP=0:1 Q:'$D(HDR(LOOP)) D
75 . I $P(HDR(LOOP),U,4)+COLL'>80 D Q
76 . . S COLL=$P(HDR(LOOP),U,4)+COLL
77 . . S COL(ROW)=COL(ROW)_U_COLL
78 . . S HDR1(ROW,CNT)=HDR(LOOP)
79 . . S CNT=CNT+1
80 . . K HDR(LOOP)
81 . S ROW=ROW+1,COL(ROW)=18,COLL=18,CNT=0
82 . S COLL=$P(HDR(LOOP),U,4)+COLL
83 . S COL(ROW)=COL(ROW)_U_COLL
84 . S HDR1(ROW,CNT)=HDR(LOOP)
85 . S CNT=CNT+1
86 . K HDR(LOOP)
87 Q
88WRTHDR ; Writes Header
89 N GMI
90 D CKP^GMTSUP Q:$D(GMTSQIT) W "Measurement DT"
91 I GMTSVMVR'>3 F GMI=0:1:5 D CKP^GMTSUP Q:'$D(HDR(GMI))!($D(GMTSQIT)) D
92 . W ?$P(COL,U,GMI+1),$P(HDR(GMI),U,2)
93 I GMTSVMVR>3 S GMI="" F S GMI=$O(HDR(GMI)) Q:(GMI="") Q:('$D(HDR(GMI)))!($D(GMTSQIT)) D CKP^GMTSUP D
94 . W ?$P(COL,U,GMI+1),$P(HDR(GMI),U,2)
95 D CKP^GMTSUP Q:$D(GMTSQIT) W !
96 Q
97WRTHDR1 ; Writes 2nd line of header
98 N GMI
99 I GMTSVMVR'>3 F GMI=0:1:5 D CKP^GMTSUP Q:'$D(HDR(GMI))!($D(GMTSQIT)) D
100 . I $P(HDR(GMI),U)="HT" W ?$P(COL,U,GMI+1),"IN(CM)"
101 . I $P(HDR(GMI),U)="WT" W ?$P(COL,U,GMI+1),"LB(KG)"
102 . I $P(HDR(GMI),U)="T" W ?$P(COL,U,GMI+1),"F(C)"
103 I GMTSVMVR>3 S GMI="" F S GMI=$O(HDR(GMI)) Q:(GMI="") Q:('$D(HDR(GMI)))!($D(GMTSQIT)) D CKP^GMTSUP D
104 . I $P(HDR(GMI),U)="HT" W ?$P(COL,U,GMI+1),"IN(CM)"
105 . I $P(HDR(GMI),U)="WT" W ?$P(COL,U,GMI+1),"LB(KG)[BMI]"
106 . I $P(HDR(GMI),U)="T" W ?$P(COL,U,GMI+1),"F(C)"
107 . I $P(HDR(GMI),U)="CVP" W ?$P(COL,U,GMI+1),"CMH20(MMHG)"
108 . I $P(HDR(GMI),U)="PO2" W ?$P(COL,U,GMI+1),"(L/MIN)(%)"
109 . I $P(HDR(GMI),U)="CG" W ?$P(COL,U,GMI+1),"IN(CM)"
110 D CKP^GMTSUP Q:$D(GMTSQIT) W !!
111 Q
112WRT ; Writes vitals record for one observation time
113 N GMLEN,GMTSBMI,GMTSI,GMTSVAL,GMTDT,GMTSVI,GMTSVT,GMTSMET,GMTSPERC,GMTSLMIN,GMTSQUAL,IEN,X
114 S GMTSVI="",X=9999999-GMTSDT D REGDTM4^GMTSU S GMTDT=X
115 D CKP^GMTSUP Q:$D(GMTSQIT) D:GMTSNPG WRTHDR,WRTHDR1 W GMTDT
116 I GMTSVMVR'>3 F GMTSI=0:1:5 S GMTSVI=$O(HDR(GMTSVI)) Q:GMTSVI=""!($D(GMTSQIT)) D
117 . S GMTSVT=$P(HDR(GMTSVI),U),IEN=$O(^UTILITY($J,"GMRVD",GMTSDT,GMTSVT,0))
118 . I +IEN D CKP^GMTSUP Q:$D(GMTSQIT) D
119 . . S GMTSVAL=$P(^UTILITY($J,"GMRVD",GMTSDT,GMTSVT,+IEN),U,8)
120 . . W ?$P(COL,U,GMTSI+1),GMTSVAL
121 . . S GMTSMET=$P(^UTILITY($J,"GMRVD",GMTSDT,GMTSVT,+IEN),U,13) I GMTSMET'="" W "("_$P(^(+IEN),U,13)_")"
122 . . Q
123 . Q
124 I GMTSVMVR>3 F GMTSI=0:1 S GMTSVI=$O(HDR(GMTSVI)) Q:GMTSVI=""!($D(GMTSQIT)) D
125 . S GMTSVT=$P(HDR(GMTSVI),U),IEN=$O(^UTILITY($J,"GMRVD",GMTSDT,GMTSVT,0))
126 . I +IEN D CKP^GMTSUP Q:$D(GMTSQIT) D
127 . . S GMTSVAL=$P(^UTILITY($J,"GMRVD",GMTSDT,GMTSVT,+IEN),U,8)
128 . . S:GMTSVT="PN"&(GMTSVAL=99) GMTSVAL="No Response"
129 . . S:GMTSVT="P"&(GMTSVAL?1A.E) GMTSVAL=$E(GMTSVAL,1,7)
130 . . W ?$P(COL,U,GMTSI+1),GMTSVAL
131 . . S GMTSMET=$P(^UTILITY($J,"GMRVD",GMTSDT,GMTSVT,+IEN),U,13,17)
132 . . S GMTSLMIN=$P(GMTSMET,U,3),GMTSPERC=$P(GMTSMET,U,4)
133 . . S GMTSQUAL=$P(GMTSMET,U,5) S:GMTSQUAL]"" GMTSQUAL=$E(GMTSQUAL,1,15)
134 . . S GMTSBMI=$P(GMTSMET,U,2),GMTSMET=$P(GMTSMET,U,1)
135 . . I GMTSMET'="" W "("_GMTSMET_")" ; centigrade/kilos/centimeters
136 . . I GMTSBMI'="" W "["_GMTSBMI_"]" ; body mass index
137 . . I GMTSLMIN'=""!(GMTSPERC'="") W "["_GMTSLMIN_"]["_GMTSPERC_"]" ; [liters/min supplemental O2][% supplemental O2]
138 . . I GMTSVT="CG",GMTSQUAL]"" W "["_GMTSQUAL_"]" ; qualifiers
139 . . Q
140 . Q
141 Q
142NXTROW ; Get the Next Row of Vital Signs
143 Q:$G(ROW)'>0 K HDR S %X="HDR1(ROW,",%Y="HDR(" D %XY^%RCR
144 S COL=COL(ROW) K %X,%Y
145 Q
Note: See TracBrowser for help on using the repository browser.