source: FOIAVistA/trunk/r/GEN_MED_REC_VITALS-GMRV/GMRVQUAL.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 5.3 KB
Line 
1GMRVQUAL ;HIOFO/YH,FT-VITAL QUALIFIERS ;3/26/05 15:12
2 ;;5.0;GEN. MED. REC. - VITALS;**8**;Oct 31, 2002
3 ;
4 ; This routine uses the following IAs:
5 ; <None>
6 ;
7LISTQ ;
8 S (I,GMAX,J)=0 K GCHART,GCHART1,GMRW,GCOUNT,GMRENTR,GQUAL,GENTR
9 S GCAT(1)=0 F S GCAT(1)=$O(^GMRD(120.52,"AA",GMRVIT,GCAT(1))) Q:GCAT(1)'>0 D CATLG S GCHA="" F S GCHA=$O(^GMRD(120.52,"AA",GMRVIT,GCAT(1),GCHA)) Q:GCHA="" S GDA=$O(^GMRD(120.52,"AA",GMRVIT,GCAT(1),GCHA,0)) Q:GDA'>0 D
10 . Q:$$ACTIVE^GMVUID(120.52,"",GDA_",","") ;active vuid?
11 . S GCHA=$P($G(^GMRD(120.52,GDA,0)),"^") Q:GCHA=""
12 . S GQUAL(GMRVODR,GCHA)=GDA
13 . Q
14 S (I,J,GMRVODR)=0 F S GMRVODR=$O(GQUAL(GMRVODR)) Q:GMRVODR'>0 S GCHA="" F S GCHA=$O(GQUAL(GMRVODR,GCHA)) Q:GCHA="" D
15 . I GMRVITY="BP"!(GMRVITY="CG") S I=I+1,GCHART(I)=GCHA_"^"_GQUAL(GMRVODR,GCHA)_"^"_GMRVODR,GMRLAST(GMRVODR,GORDER(GMRVODR))=I
16 . I GMRVODR>1,GMRVITY'="BP",GMRVITY'="CG" S I=I+1,GCHART(I)=GCHA_"^"_GQUAL(GMRVODR,GCHA)_"^"_GMRVODR,GMRLAST(GMRVODR,GORDER(GMRVODR))=I
17 . I GMRVODR=1,GMRVITY'="BP",GMRVITY'="CG" S J=J+1,GCHART1(J)=GCHA_"^"_GQUAL(GMRVODR,GCHA)_"^"_GMRVODR,GMRLAST(GMRVODR,GORDER(GMRVODR))=J
18 . I $D(GMRDP),GMRVITY="BP" S J=J+1,GCHART1(J)=GCHA_"^"_GQUAL(GMRVODR,GCHA)_"^"_GMRVODR,GMRLAST(GMRVODR,GORDER(GMRVODR))=J
19 .S GCOUNT(GMRVODR,GORDER(GMRVODR))=$G(GCOUNT(GMRVODR,GORDER(GMRVODR)))+1
20 .I GMRVITY="BP"!(GMRVITY="CG"),$G(GCOUNT(GMRVODR,GORDER(GMRVODR)))>GMAX S GMAX=$G(GCOUNT(GMRVODR,GORDER(GMRVODR)))
21 .I GMRVITY'="CG",GMRVITY'="BP",GMRVODR'=1,$G(GCOUNT(GMRVODR,GORDER(GMRVODR)))>GMAX S GMAX=$G(GCOUNT(GMRVODR,GORDER(GMRVODR)))
22 .Q
23 Q:GLVL=8 I GLVL=9 D Q
24 . S I=0 F S I=$O(GCHART1(I)) Q:I'>0 S GMRW($P(GCHART1(I),"^"))=$P(GCHART1(I),"^",2)
25 . Q
26 W !,?3,$S($G(GMRVDFLT(1))'="":"Default: "_$P(GMRVDFLT(1),"^"),1:"Qualifiers: ") S GTXT="" D Q
27 . S I=0 F S I=$O(GCHART1(I)) Q:I'>0 S GCHA=$P(GCHART1(I),"^") Q:GCHA="" S GTXT=GTXT_$S(GTXT="":"",1:", ")_GCHA
28 . I GTXT'="" D WRITE
29 . Q
30 Q
31OTHERQ ;
32 Q:'$D(GCHART) S GCOL=1,GFLAG=0,$P(GLABEL," ",80)="",$P(GBLNK," ",80)=""
33 Q:+$G(GMAX)=0
34 K GTXT
35 F I=1:1:GMAX S $P(GTXT(I)," ",80)=""
36 S GMRVODR=$S(GMRVITY="BP"!(GMRVITY="CG"):0,1:1) F S GMRVODR=$O(GCOUNT(GMRVODR)) Q:GMRVODR'>0 D
37 . I GMRVITY'="BP",GMRVITY'="CG" S GCOL=$S(GMRVODR=2:1,GMRVODR=3:18,GMRVODR=4:37,1:58)
38 . E S GCOL=$S(GMRVODR=1:1,GMRVODR=2:18,GMRVODR=3:37,GMRVODR=4:58,1:70)
39 . S I=0,GCAT="" F S GCAT=$O(GCOUNT(GMRVODR,GCAT)) Q:GCAT="" D
40 . . S GLABEL=$S(GMRVODR=1:$E(GCAT_GBLNK,1,80),1:$E($E(GLABEL,1,GCOL)_GCAT_GBLNK,1,80))
41 . . S GMIN=GMRLAST(GMRVODR,GORDER(GMRVODR))-GCOUNT(GMRVODR,GCAT)+1
42 . . F J=GMIN:1:GMRLAST(GMRVODR,GORDER(GMRVODR)) S I=I+1,GTXT(I)=$S(GMRVODR=1:$E(J_" "_$E($P(GCHART(J),"^"),1,16)_GBLNK,1,80),1:$E($E(GTXT(I),1,GCOL)_J_" "_$E($P(GCHART(J),"^"),1,16)_GBLNK,1,80))
43 . . Q
44 . Q
45 D:$D(GLABEL) SELECT Q
46 ;
47SELECT ;OTHER QUALIFIERS
48 S (GTYPE,GSIDE)=0 W !!,"Qualifiers for "_GMRVIT(1)_": ",!!,GLABEL,!
49 F I=1:1:GMAX W !,GTXT(I)
50 I GMRVITY'="CG" W !!,"Select a number under each category (optional).",!,"Separate the numbers with ',': "
51 E W !!,"Enter a number under each category, separate numbers with a ',' ",!,"DO NOT select SITE if this is a HEAD/ABDOMINAL girth measurement: "
52 K GMRINF(GMRVITY) S GMRINF="" R GMRINF:DTIME I '$T!(GMRINF["^") S GMROUT=1 Q
53 I $L(GMRINF)>10 W !,"ERROR ENTRY!!!" G SELECT
54STRIP ; strip off trailing commas
55 S GMRVCOMA=$L(GMRINF)
56 I GMRVCOMA I $E(GMRINF,GMRVCOMA)="," S GMRINF=$E(GMRINF,1,GMRVCOMA-1) G STRIP
57 K GMRVCOMA
58 G:GMRVITY="CG"&(GMRINF="") SELECT
59 I GMRINF="" D BP Q
60 I GMRVITY="CG" S GTYPE=0 F I=1:1:$L(GMRINF,",") S J=+$P(GMRINF,",",I) I $D(GCHART(J)) S:"HEADABDOMINAL"[$P(GCHART(J),"^") GTYPE=1
61 I GMRVITY="P",$P(GMRSITE,"^")="APICAL" S GTYPE=1
62 S GMROUT(1)=0 F I=1:1:$L(GMRINF,",") Q:GMROUT(1) S J=+$P(GMRINF,",",I) D Q:GMROUT(1)
63 . I '$D(GCHART(J)) S GMROUT(1)=1 Q
64 . I GTYPE=1,"LEFTRIGHT"[$P(GCHART(J),"^") Q
65 . S GMRVODR=+$P(GCHART(J),"^",3)
66 . S GMRENTR(GMRVODR)=GMRENTR(GMRVODR)-1,GMRINF(GMRVITY,GMRVODR,$P(GCHART(J),"^"))=$P(GCHART(J),"^",2,3)
67 . I $G(GMRENTR(GMRVODR))<0 W !!,"More than maximum qualifier allowed for a category were selected!",! S GMROUT(1)=1 Q
68 . Q
69 I GMROUT(1) W !,"ERROR ENTRY!!!",! D RESET G SELECT
70 D BP Q:'$D(GMRINF(GMRVITY))
71 W ! S I=0 F S I=$O(GMRINF(GMRVITY,I)) Q:I'>0 S I(1)="" F S I(1)=$O(GMRINF(GMRVITY,I,I(1))) Q:I(1)="" W " "_I(1)
72RESET ;
73 S I=0 F S I=$O(GMRENTR(I)) Q:I'>0 S GMRENTR(I)=GENTR(I)
74 Q
75WRITE ;
76 N X S DIWR=75,DIWF="",DIWL=0,X=GTXT K ^UTILITY($J) D ^DIWP
77 S I=0 F S I=$O(^UTILITY($J,"W",0,I)) Q:I'>0 W !,?3,^UTILITY($J,"W",0,I,0)
78 K ^UTILITY($J) Q
79CATLG ;
80 S GDA(1)=$O(^GMRD(120.53,GCAT(1),1,"B",GMRVIT,0)) Q:GDA(1)'>0
81 S GLN=$G(^GMRD(120.53,GCAT(1),1,GDA(1),0)) Q:GLN=""
82 S GCAT=$G(^GMRD(120.53,GCAT(1),0)) Q:GCAT=""
83 S GMRVODR=+$P(GLN,"^",6),GMRVDFLT=$S($D(^GMRD(120.52,+$P(GLN,"^",7),0)):$P(^(0),"^"),1:"") S:GMRVODR=0 GMRVODR=1
84 S GMRVDFLT(GMRVODR)=GMRVDFLT I GMRVDFLT'="",$D(^GMRD(120.52,"B",GMRVDFLT)) S GMRVDFLT(GMRVODR)=GMRVDFLT(GMRVODR)_"^"_$O(^GMRD(120.52,"B",GMRVDFLT,0))
85 S GCOUNT(GMRVODR,GCAT)=0
86 S GORDER(GMRVODR)=GCAT,(GENTR(GMRVODR),GMRENTR(GMRVODR))=+$P(GLN,"^",3) S:GMRENTR(GMRVODR)=0 GMRENTR(GMRVODR)=1
87 Q
88CLEAR ;
89 K GMRENTR,GDA,I,J,GCH,GCAT,GCHART,GCHART1,GMRW,GMRVODR,GCOUNT,GMRLAST,GMIN,GMAX,GLABEL,GTXT,GMRVDFLT Q
90BP ; Blood Pressure Check
91 I GMRVITY="BP",($D(GMRIN)) D
92 .F GMRVODR=0:0 S GMRVODR=$O(GMRIN(GMRVODR)) Q:GMRVODR<1 D
93 ..S GCAT=$O(GMRIN(GMRVODR,""))
94 ..S GMRINF(GMRVITY,GMRVODR,GCAT)=$G(GMRIN(GMRVODR,GCAT))
95 ..Q
96 .Q
97 Q
Note: See TracBrowser for help on using the repository browser.