source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOZ02.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: 5.5 KB
Line 
1OCXOZ02 ;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 ;
13CHK1 ; Look through the current environment for valid Event/Elements for this patient.
14 ; Called from UPDATE+10^OCXOZ01.
15 ;
16 Q:$G(OCXOERR)
17 ;
18 ; Local CHK1 Variables
19 ; OCXDF(1) ----> Data Field: CONTROL CODE (FREE TEXT)
20 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
21 ; OCXDF(5) ----> Data Field: ORDER PRIORITY (OBR) (FREE TEXT)
22 ; OCXDF(6) ----> Data Field: ABNORMAL FLAG (FREE TEXT)
23 ; OCXDF(12) ---> Data Field: LAB RESULT (FREE TEXT)
24 ; OCXDF(15) ---> Data Field: RESULT STATUS (OBX) (FREE TEXT)
25 ; OCXDF(21) ---> Data Field: ORDER PRIORITY (ORC) (FREE TEXT)
26 ; OCXDF(23) ---> Data Field: REQUEST STATUS (OBR) (FREE TEXT)
27 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
28 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
29 ; OCXDF(113) --> Data Field: LAB TEST ID (NUMERIC)
30 ; OCXDF(146) --> Data Field: INPT/OUTPT (FREE TEXT)
31 ; OCXDF(152) --> Data Field: LAB SPECIMEN ID (NUMERIC)
32 ;
33 ; Local Extrinsic Functions
34 ; FILE(DFN,16, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 OERR ORDER)
35 ; LIST( ------------> IN LIST OPERATOR
36 ; PATLOC( ----------> PATIENT LOCATION
37 ;
38 I $L(OCXDF(23)) D CHK2
39 I $L(OCXDF(1)) D CHK12^OCXOZ03
40 I $L(OCXDF(2)),(OCXDF(2)="OR") S OCXOERR=$$FILE(DFN,16,"") Q:OCXOERR
41 I $L(OCXDF(6)) D CHK34^OCXOZ04
42 I $L(OCXDF(15)),$$LIST(OCXDF(15),"F,C") D CHK47^OCXOZ05
43 I $L(OCXDF(34)) D CHK113^OCXOZ06
44 I $L(OCXDF(5)),(OCXDF(5)="S") D CHK151^OCXOZ07
45 I $L(OCXDF(21)),(OCXDF(21)="S") D CHK157^OCXOZ07
46 I $L(OCXDF(37)) S OCXDF(146)=$P($$PATLOC(OCXDF(37)),"^",1) I $L(OCXDF(146)) D CHK444^OCXOZ0E
47 I $L(OCXDF(12)),$L(OCXDF(152)),$L(OCXDF(113)) D CHK471^OCXOZ0F
48 Q
49 ;
50CHK2 ; Look through the current environment for valid Event/Elements for this patient.
51 ; Called from CHK1+25.
52 ;
53 Q:$G(OCXOERR)
54 ;
55 ; Local CHK2 Variables
56 ; OCXDF(1) ----> Data Field: CONTROL CODE (FREE TEXT)
57 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
58 ; OCXDF(23) ---> Data Field: REQUEST STATUS (OBR) (FREE TEXT)
59 ;
60 ; Local Extrinsic Functions
61 ; LIST( ------------> IN LIST OPERATOR
62 ;
63 I $$LIST(OCXDF(23),"F,C"),$L(OCXDF(1)),$$LIST(OCXDF(1),"RE"),$L(OCXDF(2)) D CHK6
64 I (OCXDF(23)="F"),$L(OCXDF(1)),$$LIST(OCXDF(1),"RE"),$L(OCXDF(2)) D CHK121^OCXOZ07
65 Q
66 ;
67CHK6 ; Look through the current environment for valid Event/Elements for this patient.
68 ; Called from CHK2+13.
69 ;
70 Q:$G(OCXOERR)
71 ;
72 ; Local CHK6 Variables
73 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
74 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
75 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
76 ; OCXDF(55) ---> Data Field: SITE FLAGGED RESULT (BOOLEAN)
77 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
78 ; OCXDF(146) --> Data Field: INPT/OUTPT (FREE TEXT)
79 ; OCXDF(147) --> Data Field: PATIENT LOCATION (FREE TEXT)
80 ;
81 ; Local Extrinsic Functions
82 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
83 ; PATLOC( ----------> PATIENT LOCATION
84 ;
85 I ($E(OCXDF(2),1,2)="LR"),$L(OCXDF(34)) S OCXDF(96)=$$ORDITEM(OCXDF(34)) I $L(OCXDF(37)) S OCXDF(147)=$P($$PATLOC(OCXDF(37)),"^",2) D CHK11
86 I (OCXDF(2)="RA"),$L(OCXDF(37)) S OCXDF(146)=$P($$PATLOC(OCXDF(37)),"^",1) I $L(OCXDF(146)),$L(OCXDF(34)) S OCXDF(55)=$$SITERES^ORB3F1(OCXDF(34),OCXDF(146)) D CHK302^OCXOZ0C
87 I (OCXDF(2)="GMRC"),$L(OCXDF(37)) S OCXDF(146)=$P($$PATLOC(OCXDF(37)),"^",1) I $L(OCXDF(146)),$L(OCXDF(34)) S OCXDF(55)=$$SITERES^ORB3F1(OCXDF(34),OCXDF(146)) D CHK336^OCXOZ0C
88 Q
89 ;
90CHK11 ; Look through the current environment for valid Event/Elements for this patient.
91 ; Called from CHK6+18.
92 ;
93 Q:$G(OCXOERR)
94 ;
95 ; Local Extrinsic Functions
96 ; FILE(DFN,5, ------> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 FINAL LAB RESULT)
97 ;
98 S OCXOERR=$$FILE(DFN,5,"12,37,96,113,147,152") Q:OCXOERR
99 Q
100 ;
101FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function logs a validated event/element.
102 ;
103 N OCXTIMN,OCXTIML,OCXTIMT1,OCXTIMT2,OCXDATA,OCXPC,OCXPC,OCXVAL,OCXSUB,OCXDFI
104 S DFN=+$G(DFN),OCXELE=+$G(OCXELE)
105 ;
106 Q:'DFN 1 Q:'OCXELE 1 K OCXDATA
107 ;
108 S OCXDATA(DFN,OCXELE)=1
109 F OCXPC=1:1:$L(OCXDFL,",") S OCXDFI=$P(OCXDFL,",",OCXPC) I OCXDFI D
110 .S OCXVAL=$G(OCXDF(+OCXDFI)),OCXDATA(DFN,OCXELE,+OCXDFI)=OCXVAL
111 ;
112 M ^TMP("OCXCHK",$J,DFN)=OCXDATA(DFN)
113 ;
114 Q 0
115 ;
116LIST(DATA,LIST) ; IS THE DATA FIELD IN THE LIST
117 ;
118 S:'($E(LIST,1)=",") LIST=","_LIST S:'($E(LIST,$L(LIST))=",") LIST=LIST_"," S DATA=","_DATA_","
119 Q (LIST[DATA)
120 ;
121ORDITEM(OIEN) ; Compiler Function: GET ORDERABLE ITEM FROM ORDER NUMBER
122 Q:'$G(OIEN) ""
123 ;
124 N OITXT,X S OITXT=$$OI^ORQOR2(OIEN) Q:'OITXT "No orderable item found."
125 S X=$G(^ORD(101.43,+OITXT,0)) Q:'$L(X) "No orderable item found."
126 Q $P(X,U,1)
127 ;
128PATLOC(DFN) ; Compiler Function: PATIENT LOCATION
129 ;
130 N OCXP1,OCXP2
131 S OCXP1=$G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",2))
132 S OCXP2=$P($G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",3)),"^",1)
133 I OCXP2 D
134 .S OCXP2=$P($G(^SC(+OCXP2,0)),"^",1,2)
135 .I $L($P(OCXP2,"^",2)) S OCXP2=$P(OCXP2,"^",2)
136 .E S OCXP2=$P(OCXP2,"^",1)
137 .S:'$L(OCXP2) OCXP2="NO LOC"
138 I $L(OCXP1),$L(OCXP2) Q OCXP1_"^"_OCXP2
139 ;
140 S OCXP2=$G(^DPT(+$G(DFN),.1))
141 I $L(OCXP2) Q "I^"_OCXP2
142 Q "O^OUTPT"
143 ;
Note: See TracBrowser for help on using the repository browser.