Ignore:
Timestamp:
Dec 4, 2009, 8:26:01 PM (14 years ago)
Author:
George Lilly
Message:

WorldVistAEHR overlayed on FOIAVistA

Location:
FOIAVistA/tag/r
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • FOIAVistA/tag/r/CLINICAL_REMINDERS-PXRM/PXRMAGE.m

    r628 r636  
    1 PXRMAGE ; SLC/PKR - Utilities for age calculations. ;10/07/2005
    2  ;;2.0;CLINICAL REMINDERS;**4**;Feb 04, 2005;Build 21
     1PXRMAGE ; SLC/PKR - Utilities for age calculations. ;1/27/07  17:46
     2 ;;2.0;CLINICAL REMINDERS;**4,7**;Feb 04, 2005;Build 14
     3 ; Modified from FOIA VISTA,
     4 ; Copyright (C) 2007 WorldVistA
     5 ;
     6 ; This program is free software; you can redistribute it and/or modify
     7 ; it under the terms of the GNU General Public License as published by
     8 ; the Free Software Foundation; either version 2 of the License, or
     9 ; (at your option) any later version.
     10 ;
     11 ; This program is distributed in the hope that it will be useful,
     12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ; GNU General Public License for more details.
     15 ;
     16 ; You should have received a copy of the GNU General Public License
     17 ; along with this program; if not, write to the Free Software
     18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    319 ;===========================================
    420AGE(DOB,DOD,DATE) ;Given a date of birth, date of death, and a date
     
    622 ;return the age on the date of death. All dates should be in VA
    723 ;Fileman format.
    8  N CDATE
     24 N CDATE,X,X1,X2,X3
    925 S CDATE=$S(DOD="":DATE,DOD'="":DOD)
    10  Q (CDATE-DOB)\10000
     26 S X=(CDATE-DOB)\10000 Q:X>1 X ; Begin VOE changes to support pediatrics
     27 S X1=CDATE,X2=DOB
     28 D ^%DTC S X3=X\365.25,X=$S(X3>2:X3,1:X_"D")
     29 Q X ; End VOE changes to support pediatric ages
    1130 ;
    1231 ;===========================================
    13 AGECHECK(AGE,MINAGE,MAXAGE) ;Given an AGE, MINimumAGE, and MAXimumAGE
     32AGECHECK(PXRMAGE,MINAGE,MAXAGE) ;Given an AGE (with "Y", "M" or "D"), MINimumAGE, and MAXimumAGE
    1433 ;return true if age lies within the range.
    1534 ;Special values of NULL or 0 mean there are no limits.
    1635 ;
    17  S MAXAGE=+MAXAGE
    18  S MINAGE=+MINAGE
     36 ; IHS/CIA/MGH - 5/12/2004 PATCH 1001 Changed to function call to calculate age
     37 ; Two lines changed and one added ; for VOE too
     38 ;S MAXAGE=+MAXAGE
     39 ;S MINAGE=+MINAGE
     40 ;
     41 S MAXAGE=$$DECODE(MAXAGE) ; DECODE used in VOE Pediatric patients
     42 S MINAGE=$$DECODE(MINAGE)
     43 S AGEDAYS=$$DECODE(PXRMAGE)
     44 ;
    1945 ;See if too old.
    20  I (AGE>MAXAGE)&(MAXAGE>0) Q 0
     46 I (AGEDAYS>MAXAGE)&(MAXAGE>0) Q 0
    2147 ;
    2248 ;See if too young.
    2349 I MINAGE=0 Q 1
    24  I AGE<MINAGE Q 0
     50 I AGEDAYS<MINAGE Q 0
    2551 Q 1
    2652 ;
    27  ;===========================================
     53DECODE(AGEVALUE) ; Put age from VADPT into format for reminders ; for VOE too
     54 ; IHS/CIA/MGH - 5/12/2004 PATCH 1001 Added function to change age into days
     55 N NUM,CODE,MULT
     56 S NUM=+AGEVALUE,CODE=$P(AGEVALUE,NUM,2)
     57 S MULT=1.0
     58 I CODE="M" S MULT=30.42
     59 I CODE=""!(CODE="Y") S MULT=365.25
     60 Q +(MULT*NUM)
     61 ;======================================================================
    2862FMTAGE(MINAGE,MAXAGE) ;Format the minimum age and maximum age for display.
    2963 N STR
     
    79113OVERLAP(NAR,MINA,MAXA) ;Check age ranges for overlap.  Return an error message
    80114 ;if an overlap is found.
     115 ;IHS/CIA/MGH Changes made to decode the ages into numeric results
    81116 I NAR'>1 Q 0
    82117 N IC,IN,JC,MAXI,MAXJ,MINI,MINJ,OVRLAP,TEXT
    83118 S OVRLAP=0
    84119 F IC=1:1:NAR-1 D
    85  . S MAXI=MAXA(IC)
     120 . S MAXI=$$DECODE(MAXA(IC)) ; DECODE used in VOE Pediatric patients
    86121 . I MAXI="" S MAXI=1000
    87  . S MINI=MINA(IC)
     122 . S MINI=$$DECODE(MINA(IC))
    88123 . I MINI="" S MINI=0
    89124 . F JC=IC+1:1:NAR D
    90  .. S MAXJ=MAXA(JC)
     125 .. S MAXJ=$$DECODE(MAXA(JC))
    91126 .. I MAXJ="" S MAXJ=1000
    92  .. S MINJ=MINA(JC)
     127 .. S MINJ=$$DECODE(MINA(JC))
    93128 .. I MINJ="" S MINJ=0
    94129 .. S IN=0
     
    122157 Q OVERLAP
    123158 ;
     159 ;======================================================================
     160RESTORE(SOURCE,INDEX,FREQ,MINAGE,MAXAGE) ;Restore FREQ, MINAGE, and
     161 ;MAXAGE back to the original form.  From IHS for VOE
     162 N IND,TEMP
     163 I SOURCE="CFIND" D
     164 . S IND=$O(^PXD(811.9,PXRMITEM,10,"B",INDEX,""))
     165 . S TEMP=^PXD(811.9,PXRMITEM,10,IND,0)
     166 ;
     167 I SOURCE="HFIND" D
     168 . S IND=$O(^PXD(811.9,PXRMITEM,6,"B",INDEX,""))
     169 . S TEMP=^PXD(811.9,PXRMITEM,6,IND,0)
     170 ;
     171 I SOURCE="TFIND" D
     172 . S IND=$O(^PXD(811.9,PXRMITEM,4,"B",INDEX,""))
     173 . S TEMP=^PXD(811.9,PXRMITEM,4,IND,0)
     174 ;
     175 S MINAGE=$P(TEMP,U,2)
     176 S MAXAGE=$P(TEMP,U,3)
     177 S FREQ=$P(TEMP,U,4)
     178 Q
     179 ;
Note: See TracChangeset for help on using the changeset viewer.