VAQDBIH3 ;JRP/ALB - GET INFO ABOUT HEALTH SUMMARY COMPONENT;09-SEP-93
;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
; Note: All the functions in this routine provide the same
; functionality as the functions in VAQDBIH1. This version
; does not call fileman. These function will be used inside
; fileman calls.
;
HLTHSEG(PDXABB,NOLIMITS) ;DETERMINE IF PDX SEGMENT IS A H.S. COMPONENT
;INPUT : PDXABB - Abbreviation of segment in VAQ - DATA SEGMENT file
; NOLIMITS - Flag indicating if time & occurrence indicators
; should be returned
; 0 = Return indicators (default)
; 1 = Don't return indicators
;OUTPUT : A^B^C where
; A - Pointer to entry in HEALTH SUMMARY COMPONENT file
; (will be '0' if not a Health Summary Component)
; B - Time indicator
; 1 = Time limits applicable
; 0 = Time limits not applicable
; C - Occurrence indicator
; 1 = Occurrence limits applicable
; 0 = Occurrence limits not applicable
;NOTES : If NOLIMITS is set to 1, output will be A (not A^^)
; : If PDXABB is not passed or is not a valid abbreviation,
; output will be 0
;
;CHECK INPUT & SET DEFAULTS
Q:($G(PDXABB)="") 0
Q:('$D(^VAT(394.71,"C",PDXABB))) 0
S NOLIMITS=+$G(NOLIMITS)
;DECLARE VARIABLES
N PDXSEG,ANS,TMP
;GET POINTER TO SEGMENT
S PDXSEG=+$O(^VAT(394.71,"C",PDXABB,""))
Q:('PDXSEG) 0
;GET INFO
S ANS=$$SEGHLTH(PDXSEG,NOLIMITS)
;NOT A HEALTH SUMMARY COMPONENT OR NO LIMIT INDICATORS REQUIRED
Q:(('ANS)!(NOLIMITS)) (+ANS)
;CHECK FOR TIME LIMIT
S TMP=$P(ANS,"^",2)
S:(TMP="@") TMP=1
S:(TMP="") TMP=0
S:(TMP) TMP=1
S $P(ANS,"^",2)=TMP
;CHECK FOR OCCURRENCE LIMIT
S TMP=$P(ANS,"^",3)
S:(TMP="@") TMP=1
S:(TMP="") TMP=0
S:(TMP) TMP=1
S $P(ANS,"^",3)=TMP
;DONE
Q ANS
;
SEGHLTH(SEGPTR,NOMAX) ;DETERMINE IF PDX SEGMENT IS A H.S. COMPONENT
;INPUT : SEGPTR - Pointer to segment in VAQ - DATA SEGMENT file
; NOMAX - Flag indicating if maximium time & occurrence limits
; allowed by facility should be returned
; 0 = Return maximum limits (default)
; 1 = Don't return maximium limits
;OUTPUT : A^B^C where
; A - Pointer to entry in HEALTH SUMMARY COMPONENT file
; (will be '0' if not a Health Summary Component)
; B - Maximum time limit allowed
; C - Maximum occurrence limit allowed
;NOTES : If NOMAX is set to 1, output will be A (not A^^)
; : If SEGPTR is not passed or is not a valid abbreviation,
; output will be 0
; : '@' denotes that a limit is applicable but a maximum
; limit has not been set
; : NULL denotes that a limit is not applicable
;
;CHECK INPUT & SET DEFAULTS
Q:('(+$G(SEGPTR))) 0
Q:('$D(^VAT(394.71,SEGPTR))) 0
S NOMAX=+$G(NOMAX)
;DECLARE VARIABLES
N HLTHPTR,TIME,OCCUR,MAXTIM,MAXOCC,TMP,NODE
;DETERMINE IF SEGMENT IS PAIRED WITH HEALTH SUMMARY COMPONENT
S NODE=$G(^VAT(394.71,SEGPTR,0))
S HLTHPTR=+$P(NODE,"^",4)
Q:('HLTHPTR) 0
;GET TIME & OCCURRENCE FLAGS
S TIME=$$LIMITS(HLTHPTR)
S OCCUR=+$P(TIME,"^",2)
S TIME=+TIME
;GET MAXIMUM LIMITS
S MAXTIM=$P(NODE,"^",5)
S MAXOCC=+$P(NODE,"^",6)
;MAXIMUM TIME NOT APPLIED
S:((MAXTIM="")&(TIME)) MAXTIM="@"
;MAXIMUM TIME NOT APPLICABLE
S:('TIME) MAXTIM=""
;MAXIMUM OCCURRENCE NOT APPLIED
S:(('MAXOCC)&(OCCUR)) MAXOCC="@"
;MAXIMUM OCCURRENCE NOT APPLICABLE
S:('OCCUR) MAXOCC=""
;DONE
Q:(NOMAX) HLTHPTR
Q (HLTHPTR_"^"_MAXTIM_"^"_MAXOCC)
;
LIMITS(HSPTR) ;DETERMINE IF HEALTH SUMMARY COMPONENT HAS LIMITS
;INPUT : HSPTR - Pointer to entry in HEALTH SUMMARY COMPONENT file
;OUTPUT : B^C where
; B - Time indicator
; 1 = Time limits applicable
; 0 = Time limits not applicable
; C - Occurrence indicator
; 1 = Occurrence limits applicable
; 0 = Occurrence limits not applicable
;NOTES : It is assumed that input is valid (not checked)
;
;DECLARE VARIABLES
N TMP,TLIM,OLIM,HSND
;GET TIME & OCCURRENCE FLAGS
S HSND=$G(^GMT(142.1,HSPTR,0))
;CHECK IF TIME LIMIT APPLICABLE
S (TLIM,OLIM)=0
S TMP=$P(HSND,U,3)
S:((TMP="Y")!(TMP="YES")!(TMP="yes")!(TMP="Yes")) TLIM=1
;CHECK IF OCCURRENCE LIMIT APPLICABLE
S TMP=$P(HSND,U,5)
S:((TMP="Y")!(TMP="YES")!(TMP="yes")!(TMP="Yes")) OLIM=1
Q (TLIM_"^"_OLIM)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAQDBIH3 4585 printed Oct 16, 2024@18:25:44 Page 2
VAQDBIH3 ;JRP/ALB - GET INFO ABOUT HEALTH SUMMARY COMPONENT;09-SEP-93
+1 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
+2 ; Note: All the functions in this routine provide the same
+3 ; functionality as the functions in VAQDBIH1. This version
+4 ; does not call fileman. These function will be used inside
+5 ; fileman calls.
+6 ;
HLTHSEG(PDXABB,NOLIMITS) ;DETERMINE IF PDX SEGMENT IS A H.S. COMPONENT
+1 ;INPUT : PDXABB - Abbreviation of segment in VAQ - DATA SEGMENT file
+2 ; NOLIMITS - Flag indicating if time & occurrence indicators
+3 ; should be returned
+4 ; 0 = Return indicators (default)
+5 ; 1 = Don't return indicators
+6 ;OUTPUT : A^B^C where
+7 ; A - Pointer to entry in HEALTH SUMMARY COMPONENT file
+8 ; (will be '0' if not a Health Summary Component)
+9 ; B - Time indicator
+10 ; 1 = Time limits applicable
+11 ; 0 = Time limits not applicable
+12 ; C - Occurrence indicator
+13 ; 1 = Occurrence limits applicable
+14 ; 0 = Occurrence limits not applicable
+15 ;NOTES : If NOLIMITS is set to 1, output will be A (not A^^)
+16 ; : If PDXABB is not passed or is not a valid abbreviation,
+17 ; output will be 0
+18 ;
+19 ;CHECK INPUT & SET DEFAULTS
+20 if ($GET(PDXABB)="")
QUIT 0
+21 if ('$DATA(^VAT(394.71,"C",PDXABB)))
QUIT 0
+22 SET NOLIMITS=+$GET(NOLIMITS)
+23 ;DECLARE VARIABLES
+24 NEW PDXSEG,ANS,TMP
+25 ;GET POINTER TO SEGMENT
+26 SET PDXSEG=+$ORDER(^VAT(394.71,"C",PDXABB,""))
+27 if ('PDXSEG)
QUIT 0
+28 ;GET INFO
+29 SET ANS=$$SEGHLTH(PDXSEG,NOLIMITS)
+30 ;NOT A HEALTH SUMMARY COMPONENT OR NO LIMIT INDICATORS REQUIRED
+31 if (('ANS)!(NOLIMITS))
QUIT (+ANS)
+32 ;CHECK FOR TIME LIMIT
+33 SET TMP=$PIECE(ANS,"^",2)
+34 if (TMP="@")
SET TMP=1
+35 if (TMP="")
SET TMP=0
+36 if (TMP)
SET TMP=1
+37 SET $PIECE(ANS,"^",2)=TMP
+38 ;CHECK FOR OCCURRENCE LIMIT
+39 SET TMP=$PIECE(ANS,"^",3)
+40 if (TMP="@")
SET TMP=1
+41 if (TMP="")
SET TMP=0
+42 if (TMP)
SET TMP=1
+43 SET $PIECE(ANS,"^",3)=TMP
+44 ;DONE
+45 QUIT ANS
+46 ;
SEGHLTH(SEGPTR,NOMAX) ;DETERMINE IF PDX SEGMENT IS A H.S. COMPONENT
+1 ;INPUT : SEGPTR - Pointer to segment in VAQ - DATA SEGMENT file
+2 ; NOMAX - Flag indicating if maximium time & occurrence limits
+3 ; allowed by facility should be returned
+4 ; 0 = Return maximum limits (default)
+5 ; 1 = Don't return maximium limits
+6 ;OUTPUT : A^B^C where
+7 ; A - Pointer to entry in HEALTH SUMMARY COMPONENT file
+8 ; (will be '0' if not a Health Summary Component)
+9 ; B - Maximum time limit allowed
+10 ; C - Maximum occurrence limit allowed
+11 ;NOTES : If NOMAX is set to 1, output will be A (not A^^)
+12 ; : If SEGPTR is not passed or is not a valid abbreviation,
+13 ; output will be 0
+14 ; : '@' denotes that a limit is applicable but a maximum
+15 ; limit has not been set
+16 ; : NULL denotes that a limit is not applicable
+17 ;
+18 ;CHECK INPUT & SET DEFAULTS
+19 if ('(+$GET(SEGPTR)))
QUIT 0
+20 if ('$DATA(^VAT(394.71,SEGPTR)))
QUIT 0
+21 SET NOMAX=+$GET(NOMAX)
+22 ;DECLARE VARIABLES
+23 NEW HLTHPTR,TIME,OCCUR,MAXTIM,MAXOCC,TMP,NODE
+24 ;DETERMINE IF SEGMENT IS PAIRED WITH HEALTH SUMMARY COMPONENT
+25 SET NODE=$GET(^VAT(394.71,SEGPTR,0))
+26 SET HLTHPTR=+$PIECE(NODE,"^",4)
+27 if ('HLTHPTR)
QUIT 0
+28 ;GET TIME & OCCURRENCE FLAGS
+29 SET TIME=$$LIMITS(HLTHPTR)
+30 SET OCCUR=+$PIECE(TIME,"^",2)
+31 SET TIME=+TIME
+32 ;GET MAXIMUM LIMITS
+33 SET MAXTIM=$PIECE(NODE,"^",5)
+34 SET MAXOCC=+$PIECE(NODE,"^",6)
+35 ;MAXIMUM TIME NOT APPLIED
+36 if ((MAXTIM="")&(TIME))
SET MAXTIM="@"
+37 ;MAXIMUM TIME NOT APPLICABLE
+38 if ('TIME)
SET MAXTIM=""
+39 ;MAXIMUM OCCURRENCE NOT APPLIED
+40 if (('MAXOCC)&(OCCUR))
SET MAXOCC="@"
+41 ;MAXIMUM OCCURRENCE NOT APPLICABLE
+42 if ('OCCUR)
SET MAXOCC=""
+43 ;DONE
+44 if (NOMAX)
QUIT HLTHPTR
+45 QUIT (HLTHPTR_"^"_MAXTIM_"^"_MAXOCC)
+46 ;
LIMITS(HSPTR) ;DETERMINE IF HEALTH SUMMARY COMPONENT HAS LIMITS
+1 ;INPUT : HSPTR - Pointer to entry in HEALTH SUMMARY COMPONENT file
+2 ;OUTPUT : B^C where
+3 ; B - Time indicator
+4 ; 1 = Time limits applicable
+5 ; 0 = Time limits not applicable
+6 ; C - Occurrence indicator
+7 ; 1 = Occurrence limits applicable
+8 ; 0 = Occurrence limits not applicable
+9 ;NOTES : It is assumed that input is valid (not checked)
+10 ;
+11 ;DECLARE VARIABLES
+12 NEW TMP,TLIM,OLIM,HSND
+13 ;GET TIME & OCCURRENCE FLAGS
+14 SET HSND=$GET(^GMT(142.1,HSPTR,0))
+15 ;CHECK IF TIME LIMIT APPLICABLE
+16 SET (TLIM,OLIM)=0
+17 SET TMP=$PIECE(HSND,U,3)
+18 if ((TMP="Y")!(TMP="YES")!(TMP="yes")!(TMP="Yes"))
SET TLIM=1
+19 ;CHECK IF OCCURRENCE LIMIT APPLICABLE
+20 SET TMP=$PIECE(HSND,U,5)
+21 if ((TMP="Y")!(TMP="YES")!(TMP="yes")!(TMP="Yes"))
SET OLIM=1
+22 QUIT (TLIM_"^"_OLIM)