source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRODEBR.m@ 1270

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

initial load of WorldVistAEHR

File size: 7.2 KB
RevLine 
[613]1DGRODEBR ;DJH/AMA - ROM DATA ELEMENT BUSINESS RULES ; 27 Apr 2004 12:57 PM
2 ;;5.3;Registration;**533,572**;Aug 13, 1993
3 ;
4 ;BUSINESS RULES TO BE CHECKED JUST BEFORE FILING THE
5 ;PATIENT DATA RETRIEVED FROM THE LAST SITE TREATED (LST)
6 ;
7 ;* DG*5.3*572 changed "I"nternal references to "E"xternal references
8POW(DGDATA,DFN,LSTDFN) ;POW STATUS INDICATED?
9 ; DGDATA - Data element array from LST, ^TMP("DGROFDA",$J)
10 ; DFN - Pointer to the PATIENT (#2) file
11 ; LSTDFN - Pointer to the patient data from the LST, in DGDATA
12 N RSPOW ;REQUESTING SITE POW STATUS INDICATED
13 N LSTPOW ;LAST SITE TREATED POW STATUS INDICATED
14 S RSPOW=$$GET1^DIQ(2,DFN,.525)
15 S LSTPOW=$G(@DGDATA@(2,LSTDFN_",",.525,"E"))
16 ;If either of the POW STATUS INDICATED? flags
17 ;are "N"o, don't file the POW data element(s)
18 I (RSPOW="NO")!(LSTPOW="NO") D
19 . N FIELD
20 . F FIELD=.525:.001:.528 K @DGDATA@(2,LSTDFN_",",FIELD)
21 Q
22 ;
23AO(DGDATA,DFN,LSTDFN) ;AGENT ORANGE EXPOSURE INDICATED?
24 ; DGDATA - Data element array from LST, ^TMP("DGROFDA",$J)
25 ; DFN - Pointer to the PATIENT (#2) file
26 ; LSTDFN - Pointer to the patient data from the LST, in DGDATA
27 N RSAO ;R.S. AGENT ORANGE EXPOSURE INDICATED
28 N LSTAO ;LST AGENT ORANGE EXPOSURE INDICATED
29 S RSAO=$$GET1^DIQ(2,DFN,.32102)
30 S LSTAO=$G(@DGDATA@(2,LSTDFN_",",.32102,"E"))
31 ;If either of the AGENT ORANGE EXPOSURE INDICATED?
32 ;flags are "N"o, delete the AO data element(s)
33 I (RSAO="NO")!(LSTAO="NO") D
34 . N FIELD
35 . ;added AO LOCATION OF EXPOSURE (2/.3213) for DG*5.3*572 DJH
36 . F FIELD=.32102,.32107,.32108,.32109,.3211,.3213 K @DGDATA@(2,LSTDFN_",",FIELD)
37 Q
38 ;
39IR(DGDATA,DFN,LSTDFN) ;RADIATION EXPOSURE INDICATED?
40 ; DGDATA - Data element array from LST, ^TMP("DGROFDA",$J)
41 ; DFN - Pointer to the PATIENT (#2) file
42 ; LSTDFN - Pointer to the patient data from the LST, in DGDATA
43 N RSIR ;R.S. RADIATION EXPOSURE INDICATED
44 N LSTIR ;LST RADIATION EXPOSURE INDICATED
45 S RSIR=$$GET1^DIQ(2,DFN,.32103)
46 S LSTIR=$G(@DGDATA@(2,LSTDFN_",",.32103,"E"))
47 ;If either of the RADIATION EXPOSURE INDICATED
48 ;flags are "N"o, delete the IR data elements
49 I (RSIR="NO")!(LSTIR="NO") D
50 . N FIELD
51 . F FIELD=.32103,.32111,.3212 K @DGDATA@(2,LSTDFN_",",FIELD)
52 Q
53 ;
54DOD(DGDATA,DFN,LSTDFN) ;DATE OF DEATH
55 ;Retrieve all DATE OF DEATH data elements, but instead of being filed,
56 ;they will be placed into a mail message to the appropriate group.
57 ;
58 ; DGDATA - Data element array from LST, ^TMP("DGROFDA",$J)
59 ; DFN - Pointer to the PATIENT (#2) file
60 ; LSTDFN - Pointer to the patient data from the LST, in DGDATA
61 ;
62 N DGMSG,FLD
63 ;Only send messages if actual DOD is defined (field # .351) ;DG*5.3*572
64 I $D(@DGDATA@(2,LSTDFN_",",.351)) D
65 . D DODMAIL^DGROMAIL(DGDATA,DFN,LSTDFN)
66 . S DGMSG(1)=" "
67 . S DGMSG(2)="Date of Death information has been retrieved from the LST."
68 . S DGMSG(3)="This information has NOT been filed into the patient's record."
69 . S DGMSG(4)="A mail message has been sent to the Register Once mail group."
70 . D EN^DDIOL(.DGMSG) R A:5
71 ;Delete DoD fields from FDA array so they're not filed.
72 F FLD=.351:.001:.355 K @DGDATA@(2,LSTDFN_",",FLD) ;DG*5.3*572 - added .355
73 Q
74 ;
75TA(DGDATA,LSTDFN) ;TEMPORARY ADDRESS
76 ; DGDATA - Data element array from LST, ^TMP("DGROFDA",$J)
77 ; LSTDFN - Pointer to the patient data from the LST, in DGDATA
78 N LSTTAED ;LST TEMPORARY ADDRESS END DATE (EXTERNAL)
79 N LSTTAEDF ;LST TEMPORARY ADDRESS END DATE FILEMAN (DG*5.3*572)
80 S LSTTAED=$G(@DGDATA@(2,LSTDFN_",",.1218,"E"))
81 ;*Convert External LST date to Fileman date (DG*5.3*572)
82 S X=LSTTAED
83 S %DT="RSN"
84 D ^%DT
85 S LSTTAEDF=Y
86 ;If the TEMPORARY ADDRESS END DATE is less than the
87 ;date of the query, delete the TA data elements
88 I (LSTTAEDF>0),(LSTTAEDF<DT) D
89 . N FIELD
90 . F FIELD=.12105,.12111,.12112,.1211:.0001:.1219 K @DGDATA@(2,LSTDFN_",",FIELD)
91 K X,%DT,Y
92 Q
93 ;
94SP(DGDATA,DFN,LSTDFN) ;SENSITIVE PATIENT
95 ; DGDATA - Data element array from LST, ^TMP("DGROFDA",$J)
96 ; DFN - Pointer to the PATIENT (#2) file
97 ; LSTDFN - Pointer to the patient data from the LST, in DGDATA
98 ;
99 N RSSP ;R.S. SENSITIVE PATIENT
100 N LSTSP ;LST SENSITIVE PATIENT
101 S RSSP=$$GET1^DIQ(38.1,DFN,2)
102 S LSTSP=$G(@DGDATA@(38.1,LSTDFN_",",2,"E"))
103 ;
104 ;* Remove code deleting Primary Eligibility Code (DG*5.3*572)
105 ;* In all cases, delete Patient Type
106 K @DGDATA@(2,LSTDFN_",",391)
107 ;
108 ;If the SENSITIVE PATIENT flag is received from the HEC -- OR -- if the
109 ;flag is NOT received from both the HEC and LST, retrieve and file all
110 ;Sensitive data elements, but NOT the fields for the Security Log file.
111 I '((RSSP'="SENSITIVE")&(LSTSP="SENSITIVE")) D I 1
112 . K @DGDATA@(38.1)
113 E D
114 . ;Otherwise (flag not received from the HEC but is from the LST),
115 . ;send a mail message to the ISO and the "Register Once" mail
116 . ;group that this patient is listed as Sensitive
117 . D SPMAIL^DGROMAIL(DFN)
118 . N DGMSG
119 . S DGMSG(1)=" "
120 . S DGMSG(2)="Sensitive Patient information has been retrieved from the LST."
121 . S DGMSG(3)="This information has been filed into the patient's record."
122 . S DGMSG(4)="A mail message has been sent to the Register Once mail group"
123 . S DGMSG(5)="and the ISO explaining that this information has been received."
124 . D EN^DDIOL(.DGMSG) R A:5
125 Q
126 ;
127RE ;RACE AND ETHNICITY
128 ;If the RACE AND ETHNICITY data not already
129 ;populated, file it (already the basic rule)
130 Q
131 ;
132CA(DGDATA,LSTDFN) ;CONFIDENTIAL ADDRESS
133 ; DGDATA - Data element array from LST, ^TMP("DGROFDA",$J)
134 ; LSTDFN - Pointer to the patient data from the LST, in DGDATA
135 N LSTCAAF ;LST CONFIDENTIAL ADDRESS ACTIVE FLAG
136 N LSTCAED ;LST CONFIDENTIAL ADDRESS END DATE
137 N LSTCAEDF ;LST CONFIDENTIAL ADDRESS END DATE FILEMAN (DG*5.3*572)
138 S LSTCAAF=$G(@DGDATA@(2,LSTDFN_",",.14105,"E"))
139 S LSTCAED=$G(@DGDATA@(2,LSTDFN_",",.1418,"E"))
140 ;*Convert LSTCAED to Fileman format date for compare (DG*5.3*572)
141 S X=LSTCAED
142 S %DT="RSN"
143 D ^%DT
144 S LSTCAEDF=Y
145 ;If the CONFIDENTIAL ADDRESS FLAG from the Last Site Treated is "N"o,
146 ; OR if the C.A. END DATE from the LST is less than the Query date,
147 ;delete the C.A. data elements
148 I (LSTCAAF'="YES")!((LSTCAEDF>0)&(LSTCAEDF<DT)) D
149 . N FIELD
150 . F FIELD=.14105,.14111,.1411:.0001:.1418 K @DGDATA@(2,LSTDFN_",",FIELD)
151 . K @DGDATA@(2.141)
152 ;Else the Confidential Address information will be filed
153 ;and a User Interface message will be displayed.
154 E D
155 . N DGMSG
156 . N DATEFM ;*DATE converted to Fileman format (DG*5.3*572)
157 . S DGMSG(1)=" "
158 . S DGMSG(2)="Confidential Address information has been retrieved from the LST."
159 . S DGMSG(3)="This information has been filed into the patient's record."
160 . S DATE=$G(@DGDATA@(2,LSTDFN_",",.1417,"E"))
161 . ;* Convert DATE to FM format (DG*5.3*572)
162 . K X,%DT,Y
163 . S X=DATE
164 . S %DT="RSN"
165 . D ^%DT
166 . S DATEFM=Y
167 . I DATEFM>DT D
168 . . S DGMSG(4)=" NOTE: Confidential Address Start Date is in the future, "_DATE
169 . . S DGMSG(5)=" "
170 . D EN^DDIOL(.DGMSG) R A:5
171 K X,%DT,Y
172 Q
173 ;
174PA(DGDATA,LSTDFN) ;PERMANENT ADDRESS
175 ; DGDATA - Data element array from LST, ^TMP("DGROFDA",$J)
176 ; LSTDFN - Pointer to the patient data from the LST, in DGDATA
177 N LSTBAI ;LST BAD ADDRESS INDICATOR
178 S LSTBAI=$G(@DGDATA@(2,LSTDFN_",",.121,"E"))
179 ;If the BAD ADDRESS INDICATOR from LST is NOT null,
180 ;delete the PERMANENT ADDRESS data elements
181 I LSTBAI'="" D
182 . N FIELD
183 . F FIELD=.1112,.111:.001:.119,.12,.121 K @DGDATA@(2,LSTDFN_",",FIELD)
184 Q
Note: See TracBrowser for help on using the repository browser.