93 lines
2.4 KiB
Mathematica
93 lines
2.4 KiB
Mathematica
VEPEREM3 ;MRM/DAOU - Computed findings for DOQIT extracts. ; 6/30/05 8:03pm
|
|
;;2.0;CLINICAL REMINDERS;;Feb 04, 2005
|
|
;
|
|
;==========================================================
|
|
AGE ;
|
|
; Convert age to months if under 2 years old.
|
|
N FIELDS,DOB,YR,MN,DAY,C,DYR,DMN,DDAY,DC
|
|
S FIELDS=".03",DATE=DT
|
|
D GETS^DIQ(2,DFN,FIELDS,"I","PAT","ERR")
|
|
S DOB=PAT(2,DFN_",",.03,"I")
|
|
Q:'+DOB
|
|
S MN=$E(DT,4,5),DAY=$E(DT,6,7),C=$E(DT,1)
|
|
S YR=1700+(C*100)+$E(DT,2,3)
|
|
S DMN=$E(DOB,4,5),DDAY=$E(DOB,6,7),DC=$E(DOB,1)
|
|
S DYR=1700+(DC*100)+$E(DOB,2,3)
|
|
I (DT-DOB)>20000 S CAGE=YR-DYR_"Y" S:(MN<DMN) CAGE=CAGE-1_"Y" Q
|
|
S MNOLD=(YR-DYR*12)+(12-DMN)-MN I DDAY>DAY S MNOLD=MNOLD-1
|
|
S CAGE=MNOLD_"M"
|
|
Q
|
|
; The following tags are used for computed findings
|
|
M1(DFN,TEST,DATE,VALUE,TEXT) ;One Month
|
|
N PAT,ERR,CAGE
|
|
D AGE
|
|
I $D(ERR) S TEST=0,TEXT=$G(ERR("DIERR",1,"TEXT",1)) Q
|
|
S VALUE=CAGE,TEXT="AGE"
|
|
I CAGE'["M" S TEST=1 Q
|
|
I +CAGE>0 S TEST=1 Q
|
|
S TEST=0,TEXT=""
|
|
Q
|
|
M2(DFN,TEST,DATE,VALUE,TEXT) ;Two Months
|
|
N PAT,ERR,CAGE
|
|
D AGE
|
|
I $D(ERR) S TEST=0,TEXT=$G(ERR("DIERR",1,"TEXT",1)) Q
|
|
S VALUE=CAGE,TEXT="AGE"
|
|
I CAGE'["M" S TEST=1 Q
|
|
I +CAGE>1 S TEST=1 Q
|
|
S TEST=0,TEXT=""
|
|
Q
|
|
M4(DFN,TEST,DATE,VALUE,TEXT) ;Four Months
|
|
N PAT,ERR,CAGE
|
|
D AGE
|
|
I $D(ERR) S TEST=0,TEXT=$G(ERR("DIERR",1,"TEXT",1)) Q
|
|
S VALUE=CAGE,TEXT="AGE"
|
|
I CAGE'["M" S TEST=1 Q
|
|
I +CAGE>3 S TEST=1 Q
|
|
S TEST=0,TEXT=""
|
|
Q
|
|
M6(DFN,TEST,DATE,VALUE,TEXT) ;Six Months
|
|
N PAT,ERR,CAGE
|
|
D AGE
|
|
I $D(ERR) S TEST=0,TEXT=$G(ERR("DIERR",1,"TEXT",1)) Q
|
|
S VALUE=CAGE,TEXT="AGE"
|
|
I CAGE'["M" S TEST=1 Q
|
|
I +CAGE>5 S TEST=1 Q
|
|
S TEST=0,TEXT=""
|
|
Q
|
|
M12(DFN,TEST,DATE,VALUE,TEXT) ;Twelve Months
|
|
N PAT,ERR,CAGE
|
|
D AGE
|
|
I $D(ERR) S TEST=0,TEXT=$G(ERR("DIERR",1,"TEXT",1)) Q
|
|
S VALUE=CAGE,TEXT="AGE"
|
|
I CAGE'["M" S TEST=1 Q
|
|
I +CAGE>11 S TEST=1 Q
|
|
S TEST=0,TEXT=""
|
|
Q
|
|
M15(DFN,TEST,DATE,VALUE,TEXT) ;Fifteen Months
|
|
N PAT,ERR,CAGE
|
|
D AGE
|
|
I $D(ERR) S TEST=0,TEXT=$G(ERR("DIERR",1,"TEXT",1)) Q
|
|
S VALUE=CAGE,TEXT="AGE"
|
|
I CAGE'["M" S TEST=1 Q
|
|
I +CAGE>14 S TEST=1 Q
|
|
S TEST=0,TEXT=""
|
|
Q
|
|
M18(DFN,TEST,DATE,VALUE,TEXT) ;Eighteen Months
|
|
N PAT,ERR,CAGE
|
|
D AGE
|
|
I $D(ERR) S TEST=0,TEXT=$G(ERR("DIERR",1,"TEXT",1)) Q
|
|
S VALUE=CAGE,TEXT="AGE"
|
|
I CAGE'["M" S TEST=1 Q
|
|
I +CAGE>17 S TEST=1 Q
|
|
S TEST=0,TEXT=""
|
|
Q
|
|
M24(DFN,TEST,DATE,VALUE,TEXT) ;Twentyfour Months
|
|
N PAT,ERR,CAGE
|
|
D AGE
|
|
I $D(ERR) S TEST=0,TEXT=$G(ERR("DIERR",1,"TEXT",1)) Q
|
|
S VALUE=CAGE,TEXT="AGE"
|
|
I CAGE'["M" S TEST=1 Q
|
|
I CAGE>23 S TEST=1 Q
|
|
S TEST=0,TEXT=""
|
|
Q
|