source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOZ06.m

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

initial load of FOIAVistA 6/30/08 version

File size: 8.4 KB
Line 
1OCXOZ06 ;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 ;
13CHK95 ; Look through the current environment for valid Event/Elements for this patient.
14 ; Called from UPDATE+13^OCXOZ01.
15 ;
16 Q:$G(OCXOERR)
17 ;
18 ; Local CHK95 Variables
19 ; OCXDF(27) ---> Data Field: ORDER FLAGGED FOR CLARIFICATION (BOOLEAN)
20 ; OCXDF(28) ---> Data Field: ORDER REQ. CHART SIGN. (BOOLEAN)
21 ; OCXDF(29) ---> Data Field: SERV. ORDER REQ CHART SIG. (BOOLEAN)
22 ; OCXDF(30) ---> Data Field: ORDER REQ. CO-SIG. (BOOLEAN)
23 ; OCXDF(31) ---> Data Field: ORDER REQ. ELEC. SIG. (BOOLEAN)
24 ;
25 ; Local Extrinsic Functions
26 ; FILE(DFN,45, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER REQUIRES CHART SIGNATURE)
27 ; FILE(DFN,46, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: SERVICE ORDER REQUIRES CHART SIGNATURE)
28 ; FILE(DFN,47, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER REQUIRES CO-SIGNATURE)
29 ; FILE(DFN,48, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER REQUIRES ELECTRONIC SIGNATURE)
30 ;
31 S OCXDF(27)=$P($G(OCXORD),"^",4) I $L(OCXDF(27)) D CHK97
32 S OCXDF(28)=$P($G(OCXORD),"^",5) I $L(OCXDF(28)),(OCXDF(28)) S OCXOERR=$$FILE(DFN,45,"") Q:OCXOERR
33 S OCXDF(29)=$P($G(OCXORD),"^",6) I $L(OCXDF(29)),(OCXDF(29)) S OCXOERR=$$FILE(DFN,46,"") Q:OCXOERR
34 S OCXDF(30)=$P($G(OCXORD),"^",7) I $L(OCXDF(30)),(OCXDF(30)) S OCXOERR=$$FILE(DFN,47,"") Q:OCXOERR
35 S OCXDF(31)=$P($G(OCXORD),"^",8) I $L(OCXDF(31)),(OCXDF(31)) S OCXOERR=$$FILE(DFN,48,"") Q:OCXOERR
36 Q
37 ;
38CHK97 ; Look through the current environment for valid Event/Elements for this patient.
39 ; Called from CHK95+18.
40 ;
41 Q:$G(OCXOERR)
42 ;
43 ; Local CHK97 Variables
44 ; OCXDF(27) ---> Data Field: ORDER FLAGGED FOR CLARIFICATION (BOOLEAN)
45 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
46 ; OCXDF(115) --> Data Field: CURRENT DATE/TIME (FREE TEXT)
47 ;
48 ; Local Extrinsic Functions
49 ; DT2INT( ----------> CONVERT DATE FROM FILEMAN FORMAT TO OCX FORMAT
50 ; FILE(DFN,134, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER UNFLAGGED)
51 ; FILE(DFN,44, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER FLAGGED)
52 ; INT2DT( ----------> CONVERT DATE FROM OCX FORMAT TO READABLE FORMAT
53 ;
54 I (OCXDF(27)) S OCXDF(37)=$P($G(OCXORD),"^",1),OCXDF(115)=$$INT2DT($$DT2INT("N"),0),OCXOERR=$$FILE(DFN,44,"37,115") Q:OCXOERR
55 I '(OCXDF(27)) S OCXDF(37)=$P($G(OCXORD),"^",1),OCXDF(115)=$$INT2DT($$DT2INT("N"),0),OCXOERR=$$FILE(DFN,134,"37,115") Q:OCXOERR
56 Q
57 ;
58CHK113 ; Look through the current environment for valid Event/Elements for this patient.
59 ; Called from CHK1+30^OCXOZ02.
60 ;
61 Q:$G(OCXOERR)
62 ;
63 ; Local CHK113 Variables
64 ; OCXDF(32) ---> Data Field: ORDER FLAGGED FOR RESULTS (BOOLEAN)
65 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
66 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
67 ; OCXDF(105) --> Data Field: ORDER TEXT (51 CHARS) (FREE TEXT)
68 ; OCXDF(112) --> Data Field: ORDERED BY (FREE TEXT)
69 ; OCXDF(149) --> Data Field: ORDER CANCELED BY (FREE TEXT)
70 ;
71 ; Local Extrinsic Functions
72 ; CANCELER( --------> ORDER CANCELING PROVIDER
73 ; FILE(DFN,49, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER FLAGGED FOR RESULTS)
74 ; ORDERER( ---------> ORDERING PROVIDER
75 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
76 ;
77 S OCXDF(32)=$$RSLTFLG^ORQOR2(OCXDF(34)) I $L(OCXDF(32)),(OCXDF(32)) S OCXDF(96)=$$ORDITEM(OCXDF(34)),OCXOERR=$$FILE(DFN,49,"96") Q:OCXOERR
78 S OCXDF(112)=$$ORDERER(OCXDF(34)),OCXDF(149)=$$CANCELER(OCXDF(34)) I '(OCXDF(112)=OCXDF(149)) S OCXDF(105)=$P($$TEXT^ORKOR(OCXDF(34),51),"^",2) D CHK293^OCXOZ0B
79 Q
80 ;
81CANCELER(ORNUM) ; Compiler Function: ORDER CANCELING PROVIDER
82 ;
83 Q:'$G(ORNUM) ""
84 S ORNUM=+$G(ORNUM)
85 N ORQDUZ
86 Q:'$D(^OR(100,ORNUM,6)) ""
87 S ORQDUZ=$P(^OR(100,ORNUM,6),U,2)
88 Q ORQDUZ
89 ;
90DT2INT(OCXDT) ; This Local Extrinsic Function converts a date into an integer
91 ; By taking the Years, Months, Days, Hours and Minutes converting
92 ; Them into Seconds and then adding them all together into one big integer
93 ;
94 Q:'$L($G(OCXDT)) ""
95 N OCXDIFF,OCXVAL S (OCXDIFF,OCXVAL)=0
96 ;
97 I $L(OCXDT),'OCXDT,(OCXDT[" at ") D ; EXTERNAL EXPERT SYSTEM FORMAT 1 TO EXTERNAL FORMAT
98 .N OCXHR,OCXMIN,OCXTIME
99 .S OCXTIME=$P($P(OCXDT," at ",2),".",1),OCXHR=$P(OCXTIME,":",1),OCXMIN=$P(OCXTIME,":",2)
100 .S:(OCXDT["Midnight") OCXHR=00
101 .S:(OCXDT["PM") OCXHR=OCXHR+12
102 .S OCXDT=$P(OCXDT," at ")_"@"_$E(OCXHR+100,2,3)_$E(OCXMIN+100,2,3)
103 ;
104 I $L(OCXDT),(OCXDT?1.2N1"/"1.2N.1" ".2N.1":".2N) D ; EXTERNAL EXPERT SYSTEM FORMAT 2 TO EXTERNAL FORMAT
105 .N OCXMON
106 .S OCXMON=$P("January^February^March^April^May^June^July^August^September^October^November^December",U,$P(OCXDT,"/",1))
107 .I $L($P(OCXDT," ",2)) S OCXDT=OCXMON_" "_$P($P(OCXDT," ",1),"/",2)_"@"_$TR($P(OCXDT," ",2),":","")
108 .E S OCXDT=OCXMON_" "_$P($P(OCXDT," ",1),"/",2)
109 ;
110 I $L(OCXDT),(OCXDT?1.2N1"/"1.2N1"/"1.2N.1" ".2N.1":".2N) D ; EXTERNAL EXPERT SYSTEM FORMAT 3 TO EXTERNAL FORMAT
111 .N OCXMON
112 .S OCXMON=$P("January^February^March^April^May^June^July^August^September^October^November^December",U,$P(OCXDT,"/",1))
113 .I $L($P(OCXDT," ",2)) S OCXDT=OCXMON_" "_$P($P(OCXDT," ",1),"/",2)_","_$P($P(OCXDT," ",1),"/",3)_"@"_$TR($P(OCXDT," ",2),":","")
114 .E S OCXDT=OCXMON_" "_$P($P(OCXDT," ",1),"/",2)_", "_$P($P(OCXDT," ",1),"/",3)
115 ;
116 I $L(OCXDT),'OCXDT D ; EXTERNAL FORMAT TO INTERNAL FILEMAN FORMAT
117 .I (OCXDT["@0000") S OCXDT=$P(OCXDT,"@",1),OCXDIFF=1
118 .N %DT,X,Y S X=OCXDT,%DT="" S:(OCXDT["@")!(OCXDT="N") %DT="T" D ^%DT S OCXDT=+Y
119 ;
120 I ($L(OCXDT\1)>7) S OCXDT=$$HL7TFM^XLFDT(OCXDT) ; HL7 FORMAT TO INTERNAL FILEMAN FORMAT
121 ;
122 I ($L(OCXDT\1)=7) S OCXDT=$$FMTH^XLFDT(+OCXDT) ; INTERNAL FILEMAN FORMAT TO $H FORMAT
123 ;
124 I (OCXDT?5N1","1.5N) S OCXVAL=(OCXDT*86400)+$P(OCXDT,",",2) ; $H FORMAT TO EXPERT SYSTEM INTERNAL FORMAT
125 ;
126 Q OCXVAL
127 ;
128FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function logs a validated event/element.
129 ;
130 N OCXTIMN,OCXTIML,OCXTIMT1,OCXTIMT2,OCXDATA,OCXPC,OCXPC,OCXVAL,OCXSUB,OCXDFI
131 S DFN=+$G(DFN),OCXELE=+$G(OCXELE)
132 ;
133 Q:'DFN 1 Q:'OCXELE 1 K OCXDATA
134 ;
135 S OCXDATA(DFN,OCXELE)=1
136 F OCXPC=1:1:$L(OCXDFL,",") S OCXDFI=$P(OCXDFL,",",OCXPC) I OCXDFI D
137 .S OCXVAL=$G(OCXDF(+OCXDFI)),OCXDATA(DFN,OCXELE,+OCXDFI)=OCXVAL
138 ;
139 M ^TMP("OCXCHK",$J,DFN)=OCXDATA(DFN)
140 ;
141 Q 0
142 ;
143INT2DT(OCXDT,OCXF) ; This Local Extrinsic Function converts an OCX internal format
144 ; date into an Externl Format (Human Readable) date. 'OCXF=SHORT FORMAT OCXF=LONG FORMAT
145 ;
146 Q:'$L($G(OCXDT)) "" S OCXF=+$G(OCXF)
147 N OCXYR,OCXLPYR,OCXMON,OCXDAY,OCXHR,OCXMIN,OCXSEC,OCXCYR
148 S (OCXYR,OCXLPYR,OCXMON,OCXDAY,OCXHR,OCXMIN,OCXSEC,OCXAP)=""
149 S OCXSEC=$E(OCXDT#60+100,2,3),OCXDT=OCXDT\60
150 S OCXMIN=$E(OCXDT#60+100,2,3),OCXDT=OCXDT\60
151 S OCXHR=$E(OCXDT#24+100,2,3),OCXDT=OCXDT\24
152 S OCXCYR=($H\1461)*4+1841+(($H#1461)\365)
153 S OCXYR=(OCXDT\1461)*4+1841,OCXDT=OCXDT#1461
154 S OCXLPYR=(OCXDT\365),OCXDT=OCXDT-(OCXLPYR*365),OCXYR=OCXYR+OCXLPYR
155 S OCXCNT="031^059^090^120^151^181^212^243^273^304^334^365"
156 S:(OCXLPYR=3) OCXCNT="031^060^091^121^152^182^213^244^274^305^335^366"
157 F OCXMON=1:1:12 Q:(OCXDT<$P(OCXCNT,U,OCXMON))
158 S OCXDAY=OCXDT-$P(OCXCNT,U,OCXMON-1)+1
159 I OCXF S OCXMON=$P("January^February^March^April^May^June^July^August^September^October^November^December",U,OCXMON)
160 E S OCXMON=$E(OCXMON+100,2,3)
161 S OCXAP=$S('OCXHR:"Midnight",(OCXHR=12):"Noon",(OCXHR<12):"AM",1:"PM")
162 I OCXF S OCXHR=OCXHR#12 S:'OCXHR OCXHR=12
163 Q:'OCXF $E(OCXMON+100,2,3)_"/"_$E(OCXDAY+100,2,3)_$S((OCXCYR=OCXYR):" "_OCXHR_":"_OCXMIN,1:"/"_$E(OCXYR,3,4))
164 Q:(OCXHR+OCXMIN+OCXSEC) OCXMON_" "_OCXDAY_","_OCXYR_" at "_OCXHR_":"_OCXMIN_"."_OCXSEC_" "_OCXAP
165 Q OCXMON_" "_OCXDAY_","_OCXYR
166 ;
167ORDERER(ORNUM) ; Compiler Function: ORDERING PROVIDER
168 ;
169 Q:'$G(ORNUM) ""
170 S ORNUM=+$G(ORNUM)
171 N ORQDUZ,ORQI S ORQDUZ=""
172 I $L($G(^OR(100,ORNUM,8,0))) D
173 .S ORQI=0,ORQI=$O(^OR(100,ORNUM,8,"C","NW",ORQI))
174 Q:+$G(ORQI)<1 ""
175 S ORQDUZ=$P(^OR(100,ORNUM,8,ORQI,0),U,3)
176 Q ORQDUZ
177 ;
178ORDITEM(OIEN) ; Compiler Function: GET ORDERABLE ITEM FROM ORDER NUMBER
179 Q:'$G(OIEN) ""
180 ;
181 N OITXT,X S OITXT=$$OI^ORQOR2(OIEN) Q:'OITXT "No orderable item found."
182 S X=$G(^ORD(101.43,+OITXT,0)) Q:'$L(X) "No orderable item found."
183 Q $P(X,U,1)
184 ;
Note: See TracBrowser for help on using the repository browser.