source: WorldVistAEHR/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQDBIH1.m@ 1147

Last change on this file since 1147 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.2 KB
Line 
1VAQDBIH1 ;JRP/ALB - GET INFO ABOUT HEALTH SUMMARY COMPONENT;09-SEP-93
2 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
3HLTHSEG(PDXABB,NOLIMITS) ;DETERMINE IF PDX SEGMENT IS A H.S. COMPONENT
4 ;INPUT : PDXABB - Abbreviation of segment in VAQ - DATA SEGMENT file
5 ; NOLIMITS - Flag indicating if time & occurrence indicators
6 ; should be returned
7 ; 0 = Return indicators (default)
8 ; 1 = Don't return indicators
9 ;OUTPUT : A^B^C where
10 ; A - Pointer to entry in HEALTH SUMMARY COMPONENT file
11 ; (will be '0' if not a Health Summary Component)
12 ; B - Time indicator
13 ; 1 = Time limits applicable
14 ; 0 = Time limits not applicable
15 ; C - Occurrence indicator
16 ; 1 = Occurrence limits applicable
17 ; 0 = Occurrence limits not applicable
18 ;NOTES : If NOLIMITS is set to 1, output will be A (not A^^)
19 ; : If PDXABB is not passed or is not a valid abbreviation,
20 ; output will be 0
21 ;
22 ;CHECK INPUT & SET DEFAULTS
23 Q:($G(PDXABB)="") 0
24 Q:('$D(^VAT(394.71,"C",PDXABB))) 0
25 S NOLIMITS=+$G(NOLIMITS)
26 ;DECLARE VARIABLES
27 N PDXSEG,ANS,TMP
28 ;GET POINTER TO SEGMENT
29 S PDXSEG=+$O(^VAT(394.71,"C",PDXABB,""))
30 Q:('PDXSEG) 0
31 ;GET INFO
32 S ANS=$$SEGHLTH(PDXSEG,NOLIMITS)
33 ;NOT A HEALTH SUMMARY COMPONENT OR NO LIMIT INDICATORS REQUIRED
34 Q:(('ANS)!(NOLIMITS)) (+ANS)
35 ;CHECK FOR TIME LIMIT
36 S TMP=$P(ANS,"^",2)
37 S:(TMP="@") TMP=1
38 S:(TMP="") TMP=0
39 S:(TMP) TMP=1
40 S $P(ANS,"^",2)=TMP
41 ;CHECK FOR OCCURRENCE LIMIT
42 S TMP=$P(ANS,"^",3)
43 S:(TMP="@") TMP=1
44 S:(TMP="") TMP=0
45 S:(TMP) TMP=1
46 S $P(ANS,"^",3)=TMP
47 ;DONE
48 Q ANS
49 ;
50SEGHLTH(SEGPTR,NOMAX) ;DETERMINE IF PDX SEGMENT IS A H.S. COMPONENT
51 ;INPUT : SEGPTR - Pointer to segment in VAQ - DATA SEGMENT file
52 ; NOMAX - Flag indicating if maximium time & occurrence limits
53 ; allowed by facility should be returned
54 ; 0 = Return maximum limits (default)
55 ; 1 = Don't maximium limits
56 ;OUTPUT : A^B^C where
57 ; A - Pointer to entry in HEALTH SUMMARY COMPONENT file
58 ; (will be '0' if not a Health Summary Component)
59 ; B - Maximum time limit allowed
60 ; C - Maximum occurrence limit allowed
61 ;NOTES : If NOMAX is set to 1, output will be A (not A^^)
62 ; : If SEGPTR is not passed or is not a valid abbreviation,
63 ; output will be 0
64 ; : '@' denotes that a limit is applicable but a maximum
65 ; limit has not been set
66 ; : NULL denotes that a limit is not applicable
67 ;
68 ;CHECK INPUT & SET DEFAULTS
69 Q:('(+$G(SEGPTR))) 0
70 Q:('$D(^VAT(394.71,SEGPTR))) 0
71 S NOMAX=+$G(NOMAX)
72 ;DECLARE VARIABLES
73 N HLTHPTR,TIME,OCCUR,MAXTIM,MAXOCC,TMP,NODE
74 ;DETERMINE IF SEGMENT IS PAIRED WITH HEALTH SUMMARY COMPONENT
75 S NODE=$G(^VAT(394.71,SEGPTR,0))
76 S HLTHPTR=+$P(NODE,"^",4)
77 Q:('HLTHPTR) 0
78 ;GET TIME & OCCURRENCE FLAGS
79 S TIME=$$LIMITS(HLTHPTR)
80 S OCCUR=+$P(TIME,"^",2)
81 S TIME=+TIME
82 ;GET MAXIMUM LIMITS
83 S MAXTIM=$P(NODE,"^",5)
84 S MAXOCC=+$P(NODE,"^",6)
85 ;MAXIMUM TIME NOT APPLIED
86 S:((MAXTIM="")&(TIME)) MAXTIM="@"
87 ;MAXIMUM TIME NOT APPLICABLE
88 S:('TIME) MAXTIM=""
89 ;MAXIMUM OCCURRENCE NOT APPLIED
90 S:(('MAXOCC)&(OCCUR)) MAXOCC="@"
91 ;MAXIMUM OCCURRENCE NOT APPLICABLE
92 S:('OCCUR) MAXOCC=""
93 ;DONE
94 Q:(NOMAX) HLTHPTR
95 Q (HLTHPTR_"^"_MAXTIM_"^"_MAXOCC)
96 ;
97LIMITS(HSPTR) ;DETERMINE IF HEALTH SUMMARY COMPONENT HAS LIMITS
98 ;INPUT : HSPTR - Pointer to entry in HEALTH SUMMARY COMPONENT file
99 ;OUTPUT : B^C where
100 ; B - Time indicator
101 ; 1 = Time limits applicable
102 ; 0 = Time limits not applicable
103 ; C - Occurrence indicator
104 ; 1 = Occurrence limits applicable
105 ; 0 = Occurrence limits not applicable
106 ;NOTES : It is assumed that input is valid (not checked)
107 ;
108 ;DECLARE VARIABLES
109 N DIC,DR,DA,DIQ,TMPARR,TMP,TLIM,OLIM,TMPARR,X
110 ;GET TIME & OCCURRENCE FLAGS
111 S DIC="^GMT(142.1,"
112 S DR="2;4"
113 S DA=HSPTR
114 S DIQ="TMPARR"
115 S DIQ(0)="E"
116 D EN^DIQ1
117 ;CHECK IF TIME LIMIT APPLICABLE
118 S (TLIM,OLIM)=0
119 S TMP=$G(TMPARR(142.1,HSPTR,2,"E"))
120 S:((TMP="Y")!(TMP="YES")!(TMP="yes")!(TMP="Yes")) TLIM=1
121 ;CHECK IF OCCURRENCE LIMIT APPLICABLE
122 S TMP=$G(TMPARR(142.1,HSPTR,4,"E"))
123 S:((TMP="Y")!(TMP="YES")!(TMP="yes")!(TMP="Yes")) OLIM=1
124 Q (TLIM_"^"_OLIM)
Note: See TracBrowser for help on using the repository browser.