source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOZ05.m@ 1154

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

initial load of FOIAVistA 6/30/08 version

File size: 7.6 KB
Line 
1OCXOZ05 ;SLC/RJS,CLA - Order Check Scan ;SEP 4,2007 at 23:12
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32,221**;Dec 17,1997
3 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
4 ;
5 ; ***************************************************************
6 ; ** Warning: This routine is automatically generated by the **
7 ; ** Rule Compiler (^OCXOCMP) and ANY changes to this routine **
8 ; ** will be lost the next time the rule compiler executes. **
9 ; ***************************************************************
10 ;
11 Q
12 ;
13CHK47 ; Look through the current environment for valid Event/Elements for this patient.
14 ; Called from CHK1+29^OCXOZ02.
15 ;
16 Q:$G(OCXOERR)
17 ;
18 ; Local CHK47 Variables
19 ; OCXDF(1) ----> Data Field: CONTROL CODE (FREE TEXT)
20 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
21 ; OCXDF(6) ----> Data Field: ABNORMAL FLAG (FREE TEXT)
22 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
23 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
24 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
25 ; OCXDF(146) --> Data Field: INPT/OUTPT (FREE TEXT)
26 ;
27 ; Local Extrinsic Functions
28 ; LIST( ------------> IN LIST OPERATOR
29 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
30 ; PATLOC( ----------> PATIENT LOCATION
31 ;
32 I $L(OCXDF(6)),$$LIST(OCXDF(6),"HH,LL"),$L(OCXDF(1)),$$LIST(OCXDF(1),"RE"),$L(OCXDF(2)),($E(OCXDF(2),1,2)="LR"),$L(OCXDF(34)) S OCXDF(96)=$$ORDITEM(OCXDF(34)) D CHK55
33 I $L(OCXDF(1)),$$LIST(OCXDF(1),"RE"),$L(OCXDF(2)),($E(OCXDF(2),1,2)="LR"),$L(OCXDF(37)) S OCXDF(146)=$P($$PATLOC(OCXDF(37)),"^",1) I $L(OCXDF(146)),$L(OCXDF(34)) D CHK144^OCXOZ07
34 Q
35 ;
36CHK55 ; Look through the current environment for valid Event/Elements for this patient.
37 ; Called from CHK47+19.
38 ;
39 Q:$G(OCXOERR)
40 ;
41 ; Local CHK55 Variables
42 ; OCXDF(113) --> Data Field: LAB TEST ID (NUMERIC)
43 ; OCXDF(114) --> Data Field: LAB TEST PRINT NAME (FREE TEXT)
44 ;
45 ; Local Extrinsic Functions
46 ; FILE(DFN,24, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 LAB TEST RESULTS CRITICAL)
47 ;
48 I $L(OCXDF(113)) S OCXDF(114)=$$PRINTNAM^ORQQLR1(OCXDF(113)),OCXOERR=$$FILE(DFN,24,"12,13,96,114") Q:OCXOERR
49 Q
50 ;
51CHK58 ; Look through the current environment for valid Event/Elements for this patient.
52 ; Called from UPDATE+12^OCXOZ01.
53 ;
54 Q:$G(OCXOERR)
55 ;
56 ; Local CHK58 Variables
57 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
58 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
59 ; OCXDF(40) ---> Data Field: ORDER MODE (FREE TEXT)
60 ; OCXDF(47) ---> Data Field: OI LOCAL TEXT (FREE TEXT)
61 ; OCXDF(73) ---> Data Field: ORDERABLE ITEM IEN (NUMERIC)
62 ; OCXDF(131) --> Data Field: PHARMACY LOCAL ID (FREE TEXT)
63 ; OCXDF(143) --> Data Field: DANGEROUS MEDS FOR PT > 64 NAME (FREE TEXT)
64 ;
65 ; Local Extrinsic Functions
66 ; DMED64( ----------> DANGEROUS MEDS FOR PATIENTS > 64
67 ;
68 S OCXDF(2)=$P($G(OCXPSD),"|",2) I $L(OCXDF(2)) D CHK60
69 S OCXDF(40)=$G(OCXPSM) I $L(OCXDF(40)) D CHK163^OCXOZ07
70 S OCXDF(47)=$P($P($G(OCXPSD),"|",3),"^",5) I $L(OCXDF(47)) D CHK188^OCXOZ09
71 S OCXDF(131)=$P($P($G(OCXPSD),"|",3),"^",4) I $L(OCXDF(131)) S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) D CHK347^OCXOZ0C
72 S OCXDF(73)=$P($G(OCXPSD),"|",1) I $L(OCXDF(73)) S OCXDF(143)=$P($$DMED64(OCXDF(73)),"^",2) I $L(OCXDF(143)) D CHK406^OCXOZ0E
73 S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) D CHK454^OCXOZ0F
74 Q
75 ;
76CHK60 ; Look through the current environment for valid Event/Elements for this patient.
77 ; Called from CHK58+17.
78 ;
79 Q:$G(OCXOERR)
80 ;
81 ; Local CHK60 Variables
82 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
83 ;
84 ; Local Extrinsic Functions
85 ; FILE(DFN,135, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: DIET ORDER)
86 ; FILE(DFN,137, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: PHARMACY ORDER)
87 ; FILE(DFN,28, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: RADIOLOGY ORDER)
88 ;
89 I (OCXDF(2)="RA") S OCXOERR=$$FILE(DFN,28,"") Q:OCXOERR
90 I (OCXDF(2)="FH") S OCXOERR=$$FILE(DFN,135,"") Q:OCXOERR
91 I ($E(OCXDF(2),1,2)="PS") S OCXOERR=$$FILE(DFN,137,"") Q:OCXOERR
92 Q
93 ;
94CHK87 ; Look through the current environment for valid Event/Elements for this patient.
95 ; Called from CHK23+16^OCXOZ03.
96 ;
97 Q:$G(OCXOERR)
98 ;
99 ; Local CHK87 Variables
100 ; OCXDF(90) ---> Data Field: PATIENT MOVEMENT WARD CURRENT (FREE TEXT)
101 ; OCXDF(91) ---> Data Field: PATIENT MOVEMENT SERVICE CURRENT (FREE TEXT)
102 ; OCXDF(92) ---> Data Field: PATIENT MOVEMENT WARD IEN CURRENT (NUMERIC)
103 ;
104 ; Local Extrinsic Functions
105 ; POINTER( ---------> RETURN POINTED TO VALUE
106 ; WARDSERV( --------> GET WARD SERVICE
107 ;
108 I $L(OCXDF(92)) S OCXDF(91)=$$WARDSERV(OCXDF(92)) I $L(OCXDF(91)),($L(OCXDF(91))>0),'(OCXDF(91)="PSYCHIATRY") S OCXDF(90)=$$POINTER(42,$P($G(DGPMA),"^",6)) D CHK93
109 Q
110 ;
111CHK93 ; Look through the current environment for valid Event/Elements for this patient.
112 ; Called from CHK87+14.
113 ;
114 Q:$G(OCXOERR)
115 ;
116 ; Local CHK93 Variables
117 ; OCXDF(95) ---> Data Field: PATIENT MOVEMENT WARD PREVIOUS (FREE TEXT)
118 ;
119 ; Local Extrinsic Functions
120 ; FILE(DFN,42, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: PATIENT TRANSFERRED FROM PSYCH WARD)
121 ; POINTER( ---------> RETURN POINTED TO VALUE
122 ;
123 S OCXDF(95)=$$POINTER(42,$P($G(DGPM0),"^",6)),OCXOERR=$$FILE(DFN,42,"90,95") Q:OCXOERR
124 Q
125 ;
126DMED64(OCXOI) ;ext func rtns med oi^med name if OCXOI is dangerous
127 N OCXTL,OCXT,OCXDM
128 Q:'$$TERMLKUP("DANGEROUS MEDS FOR PTS > 64",.OCXTL) "0^"
129 S OCXDM="",OCXT=0 F S OCXT=$O(OCXTL(OCXT)) Q:'OCXT D Q:$L(OCXDM)
130 .I OCXT=OCXOI S OCXDM=OCXT_"^"_OCXTL(OCXT)
131 Q:'$L(OCXDM) "0^"
132 Q OCXDM
133 ;
134FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function logs a validated event/element.
135 ;
136 N OCXTIMN,OCXTIML,OCXTIMT1,OCXTIMT2,OCXDATA,OCXPC,OCXPC,OCXVAL,OCXSUB,OCXDFI
137 S DFN=+$G(DFN),OCXELE=+$G(OCXELE)
138 ;
139 Q:'DFN 1 Q:'OCXELE 1 K OCXDATA
140 ;
141 S OCXDATA(DFN,OCXELE)=1
142 F OCXPC=1:1:$L(OCXDFL,",") S OCXDFI=$P(OCXDFL,",",OCXPC) I OCXDFI D
143 .S OCXVAL=$G(OCXDF(+OCXDFI)),OCXDATA(DFN,OCXELE,+OCXDFI)=OCXVAL
144 ;
145 M ^TMP("OCXCHK",$J,DFN)=OCXDATA(DFN)
146 ;
147 Q 0
148 ;
149LIST(DATA,LIST) ; IS THE DATA FIELD IN THE LIST
150 ;
151 S:'($E(LIST,1)=",") LIST=","_LIST S:'($E(LIST,$L(LIST))=",") LIST=LIST_"," S DATA=","_DATA_","
152 Q (LIST[DATA)
153 ;
154ORDITEM(OIEN) ; Compiler Function: GET ORDERABLE ITEM FROM ORDER NUMBER
155 Q:'$G(OIEN) ""
156 ;
157 N OITXT,X S OITXT=$$OI^ORQOR2(OIEN) Q:'OITXT "No orderable item found."
158 S X=$G(^ORD(101.43,+OITXT,0)) Q:'$L(X) "No orderable item found."
159 Q $P(X,U,1)
160 ;
161PATLOC(DFN) ; Compiler Function: PATIENT LOCATION
162 ;
163 N OCXP1,OCXP2
164 S OCXP1=$G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",2))
165 S OCXP2=$P($G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",3)),"^",1)
166 I OCXP2 D
167 .S OCXP2=$P($G(^SC(+OCXP2,0)),"^",1,2)
168 .I $L($P(OCXP2,"^",2)) S OCXP2=$P(OCXP2,"^",2)
169 .E S OCXP2=$P(OCXP2,"^",1)
170 .S:'$L(OCXP2) OCXP2="NO LOC"
171 I $L(OCXP1),$L(OCXP2) Q OCXP1_"^"_OCXP2
172 ;
173 S OCXP2=$G(^DPT(+$G(DFN),.1))
174 I $L(OCXP2) Q "I^"_OCXP2
175 Q "O^OUTPT"
176 ;
177POINTER(OCXFILE,D0) ; This Local Extrinsic Function gets the value of the name field
178 ; of record D0 in file OCXFILE
179 Q:'$G(D0) "" Q:'$L($G(OCXFILE)) ""
180 N GLREF
181 I '(OCXFILE=(+OCXFILE)) S GLREF=U_OCXFILE
182 E S GLREF=$$FILE^OCXBDTD(+OCXFILE,"GLOBAL NAME") Q:'$L(GLREF) ""
183 Q $P($G(@(GLREF_(+D0)_",0)")),U,1)
184 ;
185TERMLKUP(OCXTERM,OCXLIST) ;
186 Q $$TERM^OCXOZ01(OCXTERM,.OCXLIST)
187 ;
188WARDSERV(WARD) ; Compiler Function: GET WARD SERVICE
189 ;
190 N CODESET,PC,SERV,DIC,X,Y,DA
191 S CODESET="M:MEDICINE;S:SURGERY;P:PSYCHIATRY;NH:NHCU;NE:NEUROLOGY;I:INTERMEDIATE MED;R:REHAB MEDICINE;SCI:SPINAL CORD INJURY;D:DOMICILIARY;B:BLIND REHAB;NC:NON-COUNT"
192 S DIC=42,DIC(0)="NZ",X="`"_(+WARD) D ^DIC Q:(Y<1) ""
193 S SERV=$P($G(Y(0)),U,3)
194 Q:'$L(SERV) "" Q:'$L(CODESET) ""
195 F PC=1:1:$L(CODESET,";"),0 I PC,($P($P(CODESET,";",PC),":",1)=SERV) Q
196 Q:'PC "" Q $P($P(CODESET,";",PC),":",2)
197 ;
Note: See TracBrowser for help on using the repository browser.