source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOZ04.m@ 1361

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

revised back to 6/30/08 version

File size: 7.1 KB
Line 
1OCXOZ04 ;SLC/RJS,CLA - Order Check Scan ;DEC 27,2007 at 06:00
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 ;
13CHK25 ; Look through the current environment for valid Event/Elements for this patient.
14 ; Called from CHK23+15^OCXOZ03.
15 ;
16 Q:$G(OCXOERR)
17 ;
18 ; Local CHK25 Variables
19 ; OCXDF(25) ---> Data Field: PATIENT MOVEMENT TYPE CURRENT (FREE TEXT)
20 ; OCXDF(26) ---> Data Field: PATIENT MOVEMENT DATE CURRENT (DATE/TIME)
21 ; OCXDF(97) ---> Data Field: NEW PATIENT MOVEMENT (BOOLEAN)
22 ;
23 ; Local Extrinsic Functions
24 ; DT2INT( ----------> CONVERT DATE FROM FILEMAN FORMAT TO OCX FORMAT
25 ; FILE(DFN,56, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: PATIENT DISCHARGE)
26 ;
27 I (OCXDF(25)="ADMISSION") S OCXDF(97)=('(+$G(DGPMA)=+$G(DGPM0))&'$L(DGPMP)) I $L(OCXDF(97)),(OCXDF(97)) S OCXDF(26)=$$DT2INT($P($G(DGPMA),"^",1)) D CHK30
28 I (OCXDF(25)="DISCHARGE") S OCXDF(26)=$$DT2INT($P($G(DGPMA),"^",1)),OCXOERR=$$FILE(DFN,56,"26") Q:OCXOERR
29 Q
30 ;
31CHK30 ; Look through the current environment for valid Event/Elements for this patient.
32 ; Called from CHK25+14.
33 ;
34 Q:$G(OCXOERR)
35 ;
36 ; Local CHK30 Variables
37 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
38 ; OCXDF(83) ---> Data Field: PATIENT WARD ROOM-BED (FREE TEXT)
39 ;
40 ; Local Extrinsic Functions
41 ; FILE(DFN,21, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: PATIENT ADMISSION)
42 ; WARDRMBD( --------> WARD ROOM-BED
43 ;
44 S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXDF(83)=$P($$WARDRMBD(OCXDF(37)),"^",2),OCXOERR=$$FILE(DFN,21,"26,83") Q:OCXOERR
45 Q
46 ;
47CHK34 ; Look through the current environment for valid Event/Elements for this patient.
48 ; Called from CHK1+28^OCXOZ02.
49 ;
50 Q:$G(OCXOERR)
51 ;
52 ; Local CHK34 Variables
53 ; OCXDF(1) ----> Data Field: CONTROL CODE (FREE TEXT)
54 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
55 ; OCXDF(6) ----> Data Field: ABNORMAL FLAG (FREE TEXT)
56 ; OCXDF(23) ---> Data Field: REQUEST STATUS (OBR) (FREE TEXT)
57 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
58 ;
59 ; Local Extrinsic Functions
60 ; LIST( ------------> IN LIST OPERATOR
61 ;
62 I $$LIST(OCXDF(6),"H,L") D CHK35
63 I $$LIST(OCXDF(6),"HH,LL"),$L(OCXDF(23)),$$LIST(OCXDF(23),"F,C"),$L(OCXDF(1)),$$LIST(OCXDF(1),"RE"),$L(OCXDF(2)),($E(OCXDF(2),1,2)="LR"),$L(OCXDF(34)) D CHK324^OCXOZ0C
64 Q
65 ;
66CHK35 ; Look through the current environment for valid Event/Elements for this patient.
67 ; Called from CHK34+15.
68 ;
69 Q:$G(OCXOERR)
70 ;
71 ; Local CHK35 Variables
72 ; OCXDF(1) ----> Data Field: CONTROL CODE (FREE TEXT)
73 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
74 ; OCXDF(15) ---> Data Field: RESULT STATUS (OBX) (FREE TEXT)
75 ; OCXDF(23) ---> Data Field: REQUEST STATUS (OBR) (FREE TEXT)
76 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
77 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
78 ;
79 ; Local Extrinsic Functions
80 ; LIST( ------------> IN LIST OPERATOR
81 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
82 ;
83 I $L(OCXDF(23)),$$LIST(OCXDF(23),"F,C"),$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 CHK43
84 I $L(OCXDF(15)),$$LIST(OCXDF(15),"F,C"),$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 CHK314^OCXOZ0C
85 Q
86 ;
87CHK43 ; Look through the current environment for valid Event/Elements for this patient.
88 ; Called from CHK35+17.
89 ;
90 Q:$G(OCXOERR)
91 ;
92 ; Local CHK43 Variables
93 ; OCXDF(113) --> Data Field: LAB TEST ID (NUMERIC)
94 ; OCXDF(114) --> Data Field: LAB TEST PRINT NAME (FREE TEXT)
95 ;
96 ; Local Extrinsic Functions
97 ; FILE(DFN,23, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 LAB ORDER RESULTS ABNORMAL)
98 ;
99 I $L(OCXDF(113)) S OCXDF(114)=$$PRINTNAM^ORQQLR1(OCXDF(113)),OCXOERR=$$FILE(DFN,23,"12,13,96,114") Q:OCXOERR
100 Q
101 ;
102DT2INT(OCXDT) ; This Local Extrinsic Function converts a date into an integer
103 ; By taking the Years, Months, Days, Hours and Minutes converting
104 ; Them into Seconds and then adding them all together into one big integer
105 ;
106 Q:'$L($G(OCXDT)) ""
107 N OCXDIFF,OCXVAL S (OCXDIFF,OCXVAL)=0
108 ;
109 I $L(OCXDT),'OCXDT,(OCXDT[" at ") D ; EXTERNAL EXPERT SYSTEM FORMAT 1 TO EXTERNAL FORMAT
110 .N OCXHR,OCXMIN,OCXTIME
111 .S OCXTIME=$P($P(OCXDT," at ",2),".",1),OCXHR=$P(OCXTIME,":",1),OCXMIN=$P(OCXTIME,":",2)
112 .S:(OCXDT["Midnight") OCXHR=00
113 .S:(OCXDT["PM") OCXHR=OCXHR+12
114 .S OCXDT=$P(OCXDT," at ")_"@"_$E(OCXHR+100,2,3)_$E(OCXMIN+100,2,3)
115 ;
116 I $L(OCXDT),(OCXDT?1.2N1"/"1.2N.1" ".2N.1":".2N) D ; EXTERNAL EXPERT SYSTEM FORMAT 2 TO EXTERNAL FORMAT
117 .N OCXMON
118 .S OCXMON=$P("January^February^March^April^May^June^July^August^September^October^November^December",U,$P(OCXDT,"/",1))
119 .I $L($P(OCXDT," ",2)) S OCXDT=OCXMON_" "_$P($P(OCXDT," ",1),"/",2)_"@"_$TR($P(OCXDT," ",2),":","")
120 .E S OCXDT=OCXMON_" "_$P($P(OCXDT," ",1),"/",2)
121 ;
122 I $L(OCXDT),(OCXDT?1.2N1"/"1.2N1"/"1.2N.1" ".2N.1":".2N) D ; EXTERNAL EXPERT SYSTEM FORMAT 3 TO EXTERNAL FORMAT
123 .N OCXMON
124 .S OCXMON=$P("January^February^March^April^May^June^July^August^September^October^November^December",U,$P(OCXDT,"/",1))
125 .I $L($P(OCXDT," ",2)) S OCXDT=OCXMON_" "_$P($P(OCXDT," ",1),"/",2)_","_$P($P(OCXDT," ",1),"/",3)_"@"_$TR($P(OCXDT," ",2),":","")
126 .E S OCXDT=OCXMON_" "_$P($P(OCXDT," ",1),"/",2)_", "_$P($P(OCXDT," ",1),"/",3)
127 ;
128 I $L(OCXDT),'OCXDT D ; EXTERNAL FORMAT TO INTERNAL FILEMAN FORMAT
129 .I (OCXDT["@0000") S OCXDT=$P(OCXDT,"@",1),OCXDIFF=1
130 .N %DT,X,Y S X=OCXDT,%DT="" S:(OCXDT["@")!(OCXDT="N") %DT="T" D ^%DT S OCXDT=+Y
131 ;
132 I ($L(OCXDT\1)>7) S OCXDT=$$HL7TFM^XLFDT(OCXDT) ; HL7 FORMAT TO INTERNAL FILEMAN FORMAT
133 ;
134 I ($L(OCXDT\1)=7) S OCXDT=$$FMTH^XLFDT(+OCXDT) ; INTERNAL FILEMAN FORMAT TO $H FORMAT
135 ;
136 I (OCXDT?5N1","1.5N) S OCXVAL=(OCXDT*86400)+$P(OCXDT,",",2) ; $H FORMAT TO EXPERT SYSTEM INTERNAL FORMAT
137 ;
138 Q OCXVAL
139 ;
140FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function logs a validated event/element.
141 ;
142 N OCXTIMN,OCXTIML,OCXTIMT1,OCXTIMT2,OCXDATA,OCXPC,OCXPC,OCXVAL,OCXSUB,OCXDFI
143 S DFN=+$G(DFN),OCXELE=+$G(OCXELE)
144 ;
145 Q:'DFN 1 Q:'OCXELE 1 K OCXDATA
146 ;
147 S OCXDATA(DFN,OCXELE)=1
148 F OCXPC=1:1:$L(OCXDFL,",") S OCXDFI=$P(OCXDFL,",",OCXPC) I OCXDFI D
149 .S OCXVAL=$G(OCXDF(+OCXDFI)),OCXDATA(DFN,OCXELE,+OCXDFI)=OCXVAL
150 ;
151 M ^TMP("OCXCHK",$J,DFN)=OCXDATA(DFN)
152 ;
153 Q 0
154 ;
155LIST(DATA,LIST) ; IS THE DATA FIELD IN THE LIST
156 ;
157 S:'($E(LIST,1)=",") LIST=","_LIST S:'($E(LIST,$L(LIST))=",") LIST=LIST_"," S DATA=","_DATA_","
158 Q (LIST[DATA)
159 ;
160ORDITEM(OIEN) ; Compiler Function: GET ORDERABLE ITEM FROM ORDER NUMBER
161 Q:'$G(OIEN) ""
162 ;
163 N OITXT,X S OITXT=$$OI^ORQOR2(OIEN) Q:'OITXT "No orderable item found."
164 S X=$G(^ORD(101.43,+OITXT,0)) Q:'$L(X) "No orderable item found."
165 Q $P(X,U,1)
166 ;
167WARDRMBD(DFN) ; Compiler Function: WARD ROOM-BED
168 ;
169 Q:'$G(DFN) 0
170 N OUT S OUT=$G(^DPT(DFN,.1)) Q:'$L(OUT) 0
171 S OUT=1_"^"_OUT_" "_$G(^DPT(DFN,.101)) Q OUT
172 ;
Note: See TracBrowser for help on using the repository browser.