source: WorldVistAEHR/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQDBIH3.m@ 1495

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

initial load of WorldVistAEHR

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