VistA-FOIAVistA/r/GEN_MED_OTHER-GMV/GMVQUAL.m

36 lines
2.1 KiB
Mathematica

GMVQUAL ;HOIFO/YH,FT-VITAL QUALIFIERS ;2/17/05 14:39
;;5.0;GEN. MED. REC. - VITALS;**8**;Oct 31, 2002
;
; This routine uses the following IAs:
; <None>
;
LISTQ ; {called from GMVCAQU}
S (I,GMAX,J)=0
K GCHART,GCHART1,GMRW,GCOUNT,GMRENTR,GQUAL,GENTR
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
. Q:$$ACTIVE^GMVUID(120.52,"",GDA_",","") ;active vuid?
. S GCHA=$P($G(^GMRD(120.52,GDA,0)),"^") Q:GCHA=""
. S GQUAL(GMRVODR,GCHA)=GDA
. Q
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
. I GMRVITY="BP"!(GMRVITY="CG") S I=I+1,GCHART(I)=GCHA_"^"_GQUAL(GMRVODR,GCHA)_"^"_GMRVODR,GMRLAST(GMRVODR,GORDER(GMRVODR))=I
. I GMRVODR>1,GMRVITY'="BP",GMRVITY'="CG" S I=I+1,GCHART(I)=GCHA_"^"_GQUAL(GMRVODR,GCHA)_"^"_GMRVODR,GMRLAST(GMRVODR,GORDER(GMRVODR))=I
. I GMRVODR=1,GMRVITY'="BP",GMRVITY'="CG" S J=J+1,GCHART1(J)=GCHA_"^"_GQUAL(GMRVODR,GCHA)_"^"_GMRVODR,GMRLAST(GMRVODR,GORDER(GMRVODR))=J
. I $D(GMRDP),GMRVITY="BP" S J=J+1,GCHART1(J)=GCHA_"^"_GQUAL(GMRVODR,GCHA)_"^"_GMRVODR,GMRLAST(GMRVODR,GORDER(GMRVODR))=J
.S GCOUNT(GMRVODR,GORDER(GMRVODR))=$G(GCOUNT(GMRVODR,GORDER(GMRVODR)))+1
.I GMRVITY="BP"!(GMRVITY="CG"),$G(GCOUNT(GMRVODR,GORDER(GMRVODR)))>GMAX S GMAX=$G(GCOUNT(GMRVODR,GORDER(GMRVODR)))
.I GMRVITY'="CG",GMRVITY'="BP",GMRVODR'=1,$G(GCOUNT(GMRVODR,GORDER(GMRVODR)))>GMAX S GMAX=$G(GCOUNT(GMRVODR,GORDER(GMRVODR)))
.Q
Q
CATLG ;
S GDA(1)=$O(^GMRD(120.53,GCAT(1),1,"B",GMRVIT,0)) Q:GDA(1)'>0
S GLN=$G(^GMRD(120.53,GCAT(1),1,GDA(1),0)) Q:GLN=""
S GCAT=$G(^GMRD(120.53,GCAT(1),0)) Q:GCAT=""
S GMRVODR=+$P(GLN,"^",6),GMRVDFLT=$S($D(^GMRD(120.52,+$P(GLN,"^",7),0)):$P(^(0),"^"),1:"") S:GMRVODR=0 GMRVODR=1
S GMRVDFLT(GMRVODR)=GMRVDFLT I GMRVDFLT'="",$D(^GMRD(120.52,"B",GMRVDFLT)) S GMRVDFLT(GMRVODR)=GMRVDFLT(GMRVODR)_"^"_$O(^GMRD(120.52,"B",GMRVDFLT,0))
S GCOUNT(GMRVODR,GCAT)=0
S GORDER(GMRVODR)=GCAT,(GENTR(GMRVODR),GMRENTR(GMRVODR))=+$P(GLN,"^",3) S:GMRENTR(GMRVODR)=0 GMRENTR(GMRVODR)=1
Q