source: WorldVistAEHR/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMPDS.m@ 1093

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

initial load of WorldVistAEHR

File size: 8.6 KB
Line 
1PXRMPDS ; SLC/PKR - Routines for patient data source. ;12/30/2004
2 ;;2.0;CLINICAL REMINDERS;;Feb 04, 2005
3 ;
4 ;====================================================
5KPDS(X,X1,X2,DAS) ;Kill the patient data source fields in the expanded
6 ;taxonomy. Called from cross-reference on patient data source.
7 ;Do not execute as part of a verify fields.
8 I $G(DIUTIL)="VERIFY FIELDS" Q
9 ;Do not execute as part of exchange.
10 I $G(PXRMEXCH) Q
11 I '$D(^PXD(811.3,DAS)) Q
12 N DA,DIK,XS
13 ;Protect X because DIK uses it without newing it.
14 M XS=X
15 S DIK="^PXD(811.3,"_DAS_",""PDS"","
16 S DA(1)=DAS,DA=0
17 F S DA=+$O(^PXD(811.3,DAS,"PDS",DA)) Q:DA=0 D ^DIK
18 ;If the Patient Data Source is being deleted then rebuild the
19 ;list. The null value for PDS means search all nodes.
20 I X2="" D SPDS(.X,.X1,.X2,DAS)
21 M X=XS
22 Q
23 ;
24 ;====================================================
25PDSXHELP ;Taxonomy field Patient Data Source executable help.
26 N DONE,IND,TEXT
27 S DONE=0
28 F IND=1:1 Q:DONE D
29 . S TEXT=$P($T(TEXT+IND),";",3)
30 . I TEXT="**End Text**" S DONE=1 Q
31 . W !,TEXT
32 Q
33 ;
34 ;====================================================
35SPDS(X,X1,X2,DA) ;Set the patient data source fields in the expanded
36 ;taxonomy. Called from cross-reference on patient data source.
37 ;Do not execute as part of a verify fields.
38 I $G(DIUTIL)="VERIFY FIELDS" Q
39 ;Do not execute as part of exchange.
40 I $G(PXRMEXCH) Q
41 I '$D(^PXD(811.3,DA)) Q
42 N FDA,IEN,IENS,IENT,IND,NNODE,NSOURCE,PDS,PDSL
43 N ALL,EN,ENPP,ENPD,IN,INDXLS,INM,INPD,INPR,PL,RA
44 ;If this is an edit and the current Patient Data Source is null
45 ;delete the existing entries.
46 I X1="" D KPDS(.X,.X1,.X2,DA)
47 ;Build the list of patient data sources.
48 S NSOURCE=$L(X,",")
49 F IND=1:1:NSOURCE D
50 . S PDS=$P(X,",",IND)
51 . I PDS'="" S PDSL(PDS)=""
52 S ALL=$S($D(PDSL("ALL")):1,X="":1,1:0)
53 S EN=$S($D(PDSL("-EN")):0,$D(PDSL("EN")):1,ALL:1,1:0)
54 S ENPD=$S($D(PDSL("-ENPD")):0,$D(PDSL("ENPD")):1,1:0)
55 S ENPP=$S($D(PDSL("-ENPP")):0,$D(PDSL("ENPP")):1,1:0)
56 S IN=$S($D(PDSL("-IN")):0,$D(PDSL("IN")):1,ALL:1,1:0)
57 S INDXLS=$S($D(PDSL("-INDXLS")):0,$D(PDSL("INDXLS")):1,IN:1,1:0)
58 S INM=$S($D(PDSL("-INM")):0,$D(PDSL("INM")):1,IN:1,1:0)
59 S INPD=$S($D(PDSL("-INPD")):0,$D(PDSL("INPD")):1,IN:1,1:0)
60 S INPR=$S($D(PDSL("-INPR")):0,$D(PDSL("INPR")):1,IN:1,1:0)
61 S PL=$S($D(PDSL("-PL")):0,$D(PDSL("PL")):1,ALL:1,1:0)
62 S RA=$S($D(PDSL("-RA")):0,$D(PDSL("RA")):1,ALL:1,1:0)
63 ;Setup the nodes for each source file.
64 S IEN=DA
65 I (IN)!(INDXLS)!(INM)!(INPD)!(INPR) D
66 . S NNODE=0
67 . S IEN=IEN+1,IENS="+"_IEN_","_+DA_","
68 . S FDA(811.33,IENS,.01)=45
69 .;PTF ICD0 codes.
70 . I (IN)!(INPR) D
71 ..;PTF ICD0 codes.
72 .. S IEN=IEN+1,IENS="+"_IEN_","_IENS,IENT=IENS
73 .. S FDA(811.335,IENS,.01)=80.1
74 .. F IND=1:1:5 D
75 ... S IEN=IEN+1,IENS="+"_IEN_","_IENT,NNODE=NNODE+1
76 ... S FDA(811.3355,IENS,.01)="P"_IND
77 .. F IND=1:1:5 D
78 ... S IEN=IEN+1,IENS="+"_IEN_","_IENT,NNODE=NNODE+1
79 ... S FDA(811.3355,IENS,.01)="S"_IND
80 .. S FDA(811.335,IENT,1)=NNODE
81 . S IENT=IEN
82 .;PTF ICD9 codes.
83 . I (IN)!(INDXLS)!(INM)!(INPD) D
84 .. S NNODE=0
85 .. S IEN=DA+1,IENS="+"_IEN_","_+DA_","
86 .. S IEN=IENT
87 .. S IEN=IEN+1,IENS="+"_IEN_","_IENS
88 .. S FDA(811.335,IENS,.01)=80
89 .. S IENT=IENS
90 .. I IN D
91 ... F IND=1:1:13 D
92 .... S IEN=IEN+1,IENS="+"_IEN_","_IENT,NNODE=NNODE+1
93 .... S FDA(811.3355,IENS,.01)="D SD"_IND
94 .. I INDXLS D
95 ... S IEN=IEN+1,IENS="+"_IEN_","_IENT,NNODE=NNODE+1
96 ... S FDA(811.3355,IENS,.01)="DXLS"
97 .. I INM D
98 ... F IND=1:1:10 D
99 .... S IEN=IEN+1,IENS="+"_IEN_","_IENT,NNODE=NNODE+1
100 .... S FDA(811.3355,IENS,.01)="M ICD"_IND
101 .. I INPD D
102 ... S IEN=IEN+1,IENS="+"_IEN_","_IENT,NNODE=NNODE+1
103 ... S FDA(811.3355,IENS,.01)="PDX"
104 .. S FDA(811.335,IENT,1)=NNODE
105 ;RAD/NUC MED PATIENT
106 I RA D
107 . S IEN=IEN+1,IENS="+"_IEN_","_+DA_","
108 . S FDA(811.33,IENS,.01)=70
109 . S IEN=IEN+1,IENS="+"_IEN_","_IENS
110 . S FDA(811.335,IENS,.01)=81
111 ;PROBLEM LIST
112 I PL D
113 . S IEN=IEN+1,IENS="+"_IEN_","_+DA_","
114 . S FDA(811.33,IENS,.01)=9000011
115 . S IEN=IEN+1,IENS="+"_IEN_","_IENS
116 . S FDA(811.335,IENS,.01)=80
117 ;V POV
118 I (EN)!(ENPD) D
119 . S NNODE=0
120 . S IEN=IEN+1,IENS="+"_IEN_","_+DA_","
121 . S FDA(811.33,IENS,.01)=9000010.07
122 . S IEN=IEN+1,IENS="+"_IEN_","_IENS
123 . S FDA(811.335,IENS,.01)=80
124 . S IENT=IENS
125 . S IEN=IEN+1,IENS="+"_IEN_","_IENT,NNODE=NNODE+1
126 . S FDA(811.3355,IENS,.01)="P"
127 . I 'ENPD D
128 .. S IEN=IEN+1,IENS="+"_IEN_","_IENT,NNODE=NNODE+1
129 .. S FDA(811.3355,IENS,.01)="S"
130 .. S IEN=IEN+1,IENS="+"_IEN_","_IENT,NNODE=NNODE+1
131 .. S FDA(811.3355,IENS,.01)="U"
132 . S FDA(811.335,IENT,1)=NNODE
133 ;V CPT
134 I (EN)!(ENPP) D
135 . S NNODE=0
136 . S IEN=IEN+1,IENS="+"_IEN_","_+DA_","
137 . S FDA(811.33,IENS,.01)=9000010.18
138 . S IEN=IEN+1,IENS="+"_IEN_","_IENS
139 . S FDA(811.335,IENS,.01)=81
140 . S IENT=IENS
141 . S IEN=IEN+1,IENS="+"_IEN_","_IENT,NNODE=NNODE+1
142 . S FDA(811.3355,IENS,.01)="Y"
143 . I 'ENPP D
144 .. S IEN=IEN+1,IENS="+"_IEN_","_IENT,NNODE=NNODE+1
145 .. S FDA(811.3355,IENS,.01)="U"
146 . S FDA(811.335,IENT,1)=NNODE
147 D UPDATE(.FDA)
148 Q
149 ;
150 ;====================================================
151TEXT ;Taxonomy field Patient Data Source executable help text.
152 ;;Taxonomy matching looks for all codes in the taxonomy. It searches for
153 ;;ICD9 codes in Problem List, PTF, and V POV. It searches for ICD0 codes
154 ;;in PTF and CPT codes in V CPT and Radiology.
155 ;;
156 ;;This comma separated list of patient data sources is used to refine the
157 ;;taxonomy search by specifying exactly which patient data sources are searched.
158 ;;You may use any combination of valid entries. The valid entries are:
159 ;;
160 ;; ALL - all sources
161 ;; EN - All PCE encounter data (CPT & ICD9)
162 ;; ENPP - PCE encounter data, principal procedure (CPT) only
163 ;; ENPD - PCE encounter data primary diagnosis (ICD9) only
164 ;; IN - All PTF inpatient data (ICD9 & ICD0)
165 ;; INDXLS - PTF inpatient DXLS diagnosis (ICD9) only
166 ;; INM - PTF inpatient diagnosis (ICD9) movement only
167 ;; INPD - PTF inpatient principal diagnosis (ICD9) only
168 ;; INPR - PTF inpatient procedure (ICD0) only
169 ;; PL - Problem List (ICD9)
170 ;; RA - Radiology (CPT) only
171 ;;
172 ;;You may also use a minus sign to remove a particular source from the list.
173 ;;For example: IN,-INM would search for all inpatient diagnoses, except those
174 ;;associated with a movement, and all inpatient procedures.
175 ;;
176 ;;The default is to search all sources for all codes in the taxonomy.
177 ;;
178 ;;Note: ICD0 = ICD Operation/Procedure, used for inpatient coding of procedures.
179 ;;
180 ;;**End Text**
181 Q
182 ;
183 ;====================================================
184UPDATE(FDA) ;
185 N MSG
186 D UPDATE^DIE("E","FDA","","MSG")
187 I $D(MSG) D
188 . W !,"The expanded taxonomy search node update failed."
189 . W !,"UPDATE^DIE returned the following error message:"
190 . D AWRITE^PXRMUTIL("MSG")
191 . W !,"Examine the above error message for the reason.",!
192 . H 2
193 Q
194 ;
195 ;====================================================
196VPDS(X) ;Taxonomy field Patient Data Source input transform. Check for valid
197 ;patient data sources.
198 N IND,NSOURCE,PDS,PDSL,TEXT,VALID
199 ;Do not execute as part of a verify fields.
200 I $G(DIUTIL)="VERIFY FIELDS" Q 1
201 ;Do not execute as part of exchange.
202 I $G(PXRMEXCH) Q 1
203 S VALID=1
204 S NSOURCE=$L(X,",")
205 F IND=1:1:NSOURCE D
206 . S PDS=$P(X,",",IND),PDSL(PDS)=""
207 .;Check for valid source abbreviations.
208 . I PDS="ALL" Q
209 . I (PDS="EN")!(PDS="-EN") Q
210 . I (PDS="ENPD")!(PDS="-ENPD") Q
211 . I (PDS="ENPP")!(PDS="-ENPP") Q
212 . I (PDS="IN")!(PDS="-IN") Q
213 . I (PDS="INDXLS")!(PDS="-INDXLS") Q
214 . I (PDS="INM")!(PDS="-INM") Q
215 . I (PDS="INPD")!(PDS="-INPD") Q
216 . I (PDS="INPR")!(PDS="-INPR") Q
217 . I (PDS="PL")!(PDS="-PL") Q
218 . I (PDS="RA")!(PDS="-RA") Q
219 . S VALID=0
220 . S TEXT=PDS_" is not a valid Patient Data Source"
221 . D EN^DDIOL(TEXT)
222 ;Check for invalid combinations.
223 I $D(PDSL("EN")),$D(PDSL("-EN")) S TEXT="EN and -EN is an invalid combination",VALID=0 D EN^DDIOL(TEXT)
224 I $D(PDSL("ENPD")),$D(PDSL("-ENPD")) S TEXT="ENPD and -ENPD is an invalid combination",VALID=0 D EN^DDIOL(TEXT)
225 I $D(PDSL("ENPP")),$D(PDSL("-ENPP")) S TEXT="ENPP and -ENPP is an invalid combination",VALID=0 D EN^DDIOL(TEXT)
226 I $D(PDSL("IN")),$D(PDSL("-IN")) S TEXT="IN and -IN is an invalid combination",VALID=0 D EN^DDIOL(TEXT)
227 I $D(PDSL("INDXLS")),$D(PDSL("-INDXLS")) S TEXT="INDXLS and -INDXLS is an invalid combination",VALID=0 D EN^DDIOL(TEXT)
228 I $D(PDSL("INM")),$D(PDSL("-INM")) S TEXT="INM and -INM is an invalid combination",VALID=0 D EN^DDIOL(TEXT)
229 I $D(PDSL("INPD")),$D(PDSL("-INPD")) S TEXT="INPD and -INPD is an invalid combination",VALID=0 D EN^DDIOL(TEXT)
230 I $D(PDSL("INPR")),$D(PDSL("-INPR")) S TEXT="INPR and -INPR is an invalid combination",VALID=0 D EN^DDIOL(TEXT)
231 I $D(PDSL("PL")),$D(PDSL("-PL")) S TEXT="PL and -PL is an invalid combination",VALID=0 D EN^DDIOL(TEXT)
232 I $D(PDSL("RA")),$D(PDSL("-RA")) S TEXT="RA and -RA is an invalid combination",VALID=0 D EN^DDIOL(TEXT)
233 Q VALID
234 ;
Note: See TracBrowser for help on using the repository browser.