Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: VAQDBIH3

VAQDBIH3.m

Go to the documentation of this file.
  1. VAQDBIH3 ;JRP/ALB - GET INFO ABOUT HEALTH SUMMARY COMPONENT;09-SEP-93
  1. ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
  1. ; Note: All the functions in this routine provide the same
  1. ; functionality as the functions in VAQDBIH1. This version
  1. ; does not call fileman. These function will be used inside
  1. ; fileman calls.
  1. ;
  1. HLTHSEG(PDXABB,NOLIMITS) ;DETERMINE IF PDX SEGMENT IS A H.S. COMPONENT
  1. ;INPUT : PDXABB - Abbreviation of segment in VAQ - DATA SEGMENT file
  1. ; NOLIMITS - Flag indicating if time & occurrence indicators
  1. ; should be returned
  1. ; 0 = Return indicators (default)
  1. ; 1 = Don't return indicators
  1. ;OUTPUT : A^B^C where
  1. ; A - Pointer to entry in HEALTH SUMMARY COMPONENT file
  1. ; (will be '0' if not a Health Summary Component)
  1. ; B - Time indicator
  1. ; 1 = Time limits applicable
  1. ; 0 = Time limits not applicable
  1. ; C - Occurrence indicator
  1. ; 1 = Occurrence limits applicable
  1. ; 0 = Occurrence limits not applicable
  1. ;NOTES : If NOLIMITS is set to 1, output will be A (not A^^)
  1. ; : If PDXABB is not passed or is not a valid abbreviation,
  1. ; output will be 0
  1. ;
  1. ;CHECK INPUT & SET DEFAULTS
  1. Q:($G(PDXABB)="") 0
  1. Q:('$D(^VAT(394.71,"C",PDXABB))) 0
  1. S NOLIMITS=+$G(NOLIMITS)
  1. ;DECLARE VARIABLES
  1. N PDXSEG,ANS,TMP
  1. ;GET POINTER TO SEGMENT
  1. S PDXSEG=+$O(^VAT(394.71,"C",PDXABB,""))
  1. Q:('PDXSEG) 0
  1. ;GET INFO
  1. S ANS=$$SEGHLTH(PDXSEG,NOLIMITS)
  1. ;NOT A HEALTH SUMMARY COMPONENT OR NO LIMIT INDICATORS REQUIRED
  1. Q:(('ANS)!(NOLIMITS)) (+ANS)
  1. ;CHECK FOR TIME LIMIT
  1. S TMP=$P(ANS,"^",2)
  1. S:(TMP="@") TMP=1
  1. S:(TMP="") TMP=0
  1. S:(TMP) TMP=1
  1. S $P(ANS,"^",2)=TMP
  1. ;CHECK FOR OCCURRENCE LIMIT
  1. S TMP=$P(ANS,"^",3)
  1. S:(TMP="@") TMP=1
  1. S:(TMP="") TMP=0
  1. S:(TMP) TMP=1
  1. S $P(ANS,"^",3)=TMP
  1. ;DONE
  1. Q ANS
  1. ;
  1. SEGHLTH(SEGPTR,NOMAX) ;DETERMINE IF PDX SEGMENT IS A H.S. COMPONENT
  1. ;INPUT : SEGPTR - Pointer to segment in VAQ - DATA SEGMENT file
  1. ; NOMAX - Flag indicating if maximium time & occurrence limits
  1. ; allowed by facility should be returned
  1. ; 0 = Return maximum limits (default)
  1. ; 1 = Don't return maximium limits
  1. ;OUTPUT : A^B^C where
  1. ; A - Pointer to entry in HEALTH SUMMARY COMPONENT file
  1. ; (will be '0' if not a Health Summary Component)
  1. ; B - Maximum time limit allowed
  1. ; C - Maximum occurrence limit allowed
  1. ;NOTES : If NOMAX is set to 1, output will be A (not A^^)
  1. ; : If SEGPTR is not passed or is not a valid abbreviation,
  1. ; output will be 0
  1. ; : '@' denotes that a limit is applicable but a maximum
  1. ; limit has not been set
  1. ; : NULL denotes that a limit is not applicable
  1. ;
  1. ;CHECK INPUT & SET DEFAULTS
  1. Q:('(+$G(SEGPTR))) 0
  1. Q:('$D(^VAT(394.71,SEGPTR))) 0
  1. S NOMAX=+$G(NOMAX)
  1. ;DECLARE VARIABLES
  1. N HLTHPTR,TIME,OCCUR,MAXTIM,MAXOCC,TMP,NODE
  1. ;DETERMINE IF SEGMENT IS PAIRED WITH HEALTH SUMMARY COMPONENT
  1. S NODE=$G(^VAT(394.71,SEGPTR,0))
  1. S HLTHPTR=+$P(NODE,"^",4)
  1. Q:('HLTHPTR) 0
  1. ;GET TIME & OCCURRENCE FLAGS
  1. S TIME=$$LIMITS(HLTHPTR)
  1. S OCCUR=+$P(TIME,"^",2)
  1. S TIME=+TIME
  1. ;GET MAXIMUM LIMITS
  1. S MAXTIM=$P(NODE,"^",5)
  1. S MAXOCC=+$P(NODE,"^",6)
  1. ;MAXIMUM TIME NOT APPLIED
  1. S:((MAXTIM="")&(TIME)) MAXTIM="@"
  1. ;MAXIMUM TIME NOT APPLICABLE
  1. S:('TIME) MAXTIM=""
  1. ;MAXIMUM OCCURRENCE NOT APPLIED
  1. S:(('MAXOCC)&(OCCUR)) MAXOCC="@"
  1. ;MAXIMUM OCCURRENCE NOT APPLICABLE
  1. S:('OCCUR) MAXOCC=""
  1. ;DONE
  1. Q:(NOMAX) HLTHPTR
  1. Q (HLTHPTR_"^"_MAXTIM_"^"_MAXOCC)
  1. ;
  1. LIMITS(HSPTR) ;DETERMINE IF HEALTH SUMMARY COMPONENT HAS LIMITS
  1. ;INPUT : HSPTR - Pointer to entry in HEALTH SUMMARY COMPONENT file
  1. ;OUTPUT : B^C where
  1. ; B - Time indicator
  1. ; 1 = Time limits applicable
  1. ; 0 = Time limits not applicable
  1. ; C - Occurrence indicator
  1. ; 1 = Occurrence limits applicable
  1. ; 0 = Occurrence limits not applicable
  1. ;NOTES : It is assumed that input is valid (not checked)
  1. ;
  1. ;DECLARE VARIABLES
  1. N TMP,TLIM,OLIM,HSND
  1. ;GET TIME & OCCURRENCE FLAGS
  1. S HSND=$G(^GMT(142.1,HSPTR,0))
  1. ;CHECK IF TIME LIMIT APPLICABLE
  1. S (TLIM,OLIM)=0
  1. S TMP=$P(HSND,U,3)
  1. S:((TMP="Y")!(TMP="YES")!(TMP="yes")!(TMP="Yes")) TLIM=1
  1. ;CHECK IF OCCURRENCE LIMIT APPLICABLE
  1. S TMP=$P(HSND,U,5)
  1. S:((TMP="Y")!(TMP="YES")!(TMP="yes")!(TMP="Yes")) OLIM=1
  1. Q (TLIM_"^"_OLIM)