source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOZ03.m@ 619

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

initial load of WorldVistAEHR

File size: 6.5 KB
Line 
1OCXOZ03 ;SLC/RJS,CLA - Order Check Scan ;NOV 8,2009 at 18:44
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32,221,243**;Dec 17,1997;Build 242
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 ;
13CHK12 ; Look through the current environment for valid Event/Elements for this patient.
14 ; Called from CHK1+26^OCXOZ02.
15 ;
16 Q:$G(OCXOERR)
17 ;
18 ; Local CHK12 Variables
19 ; OCXDF(1) ----> Data Field: CONTROL CODE (FREE TEXT)
20 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
21 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
22 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
23 ; OCXDF(105) --> Data Field: ORDER TEXT (51 CHARS) (FREE TEXT)
24 ; OCXDF(146) --> Data Field: INPT/OUTPT (FREE TEXT)
25 ; OCXDF(147) --> Data Field: PATIENT LOCATION (FREE TEXT)
26 ; OCXDF(148) --> Data Field: FOOD-DRUG INTERACTION MED (BOOLEAN)
27 ;
28 ; Local Extrinsic Functions
29 ; FILE(DFN,126, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 DCED OERR ORDER)
30 ; FILE(DFN,20, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 LAB ORDER CANCELLED)
31 ; FILE(DFN,30, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: RADIOLOGY ORDER PUT ON-HOLD)
32 ; FILE(DFN,31, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: RADIOLOGY ORDER CANCELLED)
33 ; FILE(DFN,32, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: RADIOLOGY ORDER DISCONTINUED)
34 ; FILE(DFN,40, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 LAB REQUEST CANCELLED)
35 ; FILE(DFN,6, ------> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 NEW OERR ORDER)
36 ; FOODDRG( ---------> FOOD-DRUG INTERACTION MED
37 ; LIST( ------------> IN LIST OPERATOR
38 ; PATLOC( ----------> PATIENT LOCATION
39 ;
40 I $$LIST(OCXDF(1),"NW,SN,XR"),$L(OCXDF(37)) S OCXDF(147)=$P($$PATLOC(OCXDF(37)),"^",2),OCXOERR=$$FILE(DFN,6,"147") Q:OCXOERR
41 I (OCXDF(1)="OC"),$L(OCXDF(2)),($E(OCXDF(2),1,2)="LR"),$L(OCXDF(34)) S OCXDF(105)=$P($$TEXT^ORKOR(OCXDF(34),51),"^",2),OCXOERR=$$FILE(DFN,20,"105") Q:OCXOERR
42 I (OCXDF(1)="OH"),$L(OCXDF(2)),(OCXDF(2)="RA"),$L(OCXDF(34)) S OCXDF(105)=$P($$TEXT^ORKOR(OCXDF(34),51),"^",2),OCXOERR=$$FILE(DFN,30,"105") Q:OCXOERR
43 I (OCXDF(1)="OD"),$L(OCXDF(2)),(OCXDF(2)="RA"),$L(OCXDF(34)) S OCXDF(105)=$P($$TEXT^ORKOR(OCXDF(34),51),"^",2),OCXOERR=$$FILE(DFN,31,"105") Q:OCXOERR
44 I (OCXDF(1)="DC"),$L(OCXDF(2)),(OCXDF(2)="RA"),$L(OCXDF(34)) S OCXDF(105)=$P($$TEXT^ORKOR(OCXDF(34),51),"^",2),OCXOERR=$$FILE(DFN,32,"105") Q:OCXOERR
45 I (OCXDF(1)="CA"),$L(OCXDF(2)),($E(OCXDF(2),1,2)="LR"),$L(OCXDF(34)) S OCXDF(105)=$P($$TEXT^ORKOR(OCXDF(34),51),"^",2),OCXOERR=$$FILE(DFN,40,"105") Q:OCXOERR
46 I $$LIST(OCXDF(1),"NW,SN,XO"),$L(OCXDF(37)) S OCXDF(146)=$P($$PATLOC(OCXDF(37)),"^",1) I $L(OCXDF(146)),$L(OCXDF(34)) D CHK131^OCXOZ07
47 I $$LIST(OCXDF(1),"NW,SN"),$L(OCXDF(34)) S OCXDF(148)=$P($$FOODDRG(OCXDF(34)),"^",1) I $L(OCXDF(148)),(OCXDF(148)),$L(OCXDF(37)) D CHK270^OCXOZ0B
48 I $$LIST(OCXDF(1),"DC,CA,OD,OC"),$L(OCXDF(37)) S OCXDF(147)=$P($$PATLOC(OCXDF(37)),"^",2),OCXOERR=$$FILE(DFN,126,"147") Q:OCXOERR
49 Q
50 ;
51CHK23 ; Look through the current environment for valid Event/Elements for this patient.
52 ; Called from UPDATE+11^OCXOZ01.
53 ;
54 Q:$G(OCXOERR)
55 ;
56 ; Local CHK23 Variables
57 ; OCXDF(25) ---> Data Field: PATIENT MOVEMENT TYPE CURRENT (FREE TEXT)
58 ; OCXDF(92) ---> Data Field: PATIENT MOVEMENT WARD IEN CURRENT (NUMERIC)
59 ; OCXDF(93) ---> Data Field: PATIENT MOVEMENT WARD IEN PREVIOUS (NUMERIC)
60 ; OCXDF(94) ---> Data Field: PATIENT MOVEMENT SERVICE PREVIOUS (FREE TEXT)
61 ;
62 ; Local Extrinsic Functions
63 ; POINTER( ---------> RETURN POINTED TO VALUE
64 ; WARDSERV( --------> GET WARD SERVICE
65 ;
66 S OCXDF(25)=$$POINTER(405.3,$P($G(DGPMA),"^",2)) I $L(OCXDF(25)) D CHK25^OCXOZ04
67 S OCXDF(93)=$P($G(DGPM0),"^",6) I $L(OCXDF(93)) S OCXDF(94)=$$WARDSERV(OCXDF(93)) I $L(OCXDF(94)),(OCXDF(94)="PSYCHIATRY") S OCXDF(92)=$P($G(DGPMA),"^",6) D CHK87^OCXOZ05
68 Q
69 ;
70FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function logs a validated event/element.
71 ;
72 N OCXTIMN,OCXTIML,OCXTIMT1,OCXTIMT2,OCXDATA,OCXPC,OCXPC,OCXVAL,OCXSUB,OCXDFI
73 S DFN=+$G(DFN),OCXELE=+$G(OCXELE)
74 ;
75 Q:'DFN 1 Q:'OCXELE 1 K OCXDATA
76 ;
77 S OCXDATA(DFN,OCXELE)=1
78 F OCXPC=1:1:$L(OCXDFL,",") S OCXDFI=$P(OCXDFL,",",OCXPC) I OCXDFI D
79 .S OCXVAL=$G(OCXDF(+OCXDFI)),OCXDATA(DFN,OCXELE,+OCXDFI)=OCXVAL
80 ;
81 M ^TMP("OCXCHK",$J,DFN)=OCXDATA(DFN)
82 ;
83 Q 0
84 ;
85FOODDRG(OCXOR) ;func rtns 1^<med name> if OCXOR is food-drug med
86 N OCXTL,OCXT,OCXFD,OCXOI
87 S OCXOI=$$OI(OCXOR)
88 Q:'$L(OCXOI) "0^"
89 Q:'$$TERMLKUP("FOOD-DRUG INTERACTION MED",.OCXTL) "0^"
90 S OCXFD="",OCXT=0 F S OCXT=$O(OCXTL(OCXT)) Q:'OCXT D Q:$L(OCXFD)
91 .I OCXT=OCXOI S OCXFD="1^"_OCXTL(OCXT)
92 Q:'$L(OCXFD) "0^"
93 Q OCXFD
94 ;
95LIST(DATA,LIST) ; IS THE DATA FIELD IN THE LIST
96 ;
97 S:'($E(LIST,1)=",") LIST=","_LIST S:'($E(LIST,$L(LIST))=",") LIST=LIST_"," S DATA=","_DATA_","
98 Q (LIST[DATA)
99 ;
100OI(OCXOR) ;func rtns orderable item for an order number (OCXOR)
101 Q:+$G(OCXOR)<1 ""
102 N OCXOI S OCXOI=""
103 S OCXOI=+$G(^OR(100,+$G(OCXOR),.1,1,0))
104 Q OCXOI
105 ;
106PATLOC(DFN) ; Compiler Function: PATIENT LOCATION
107 ;
108 N OCXP1,OCXP2
109 S OCXP1=$G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",2))
110 S OCXP2=$P($G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",3)),"^",1)
111 I OCXP2 D
112 .S OCXP2=$P($G(^SC(+OCXP2,0)),"^",1,2)
113 .I $L($P(OCXP2,"^",2)) S OCXP2=$P(OCXP2,"^",2)
114 .E S OCXP2=$P(OCXP2,"^",1)
115 .S:'$L(OCXP2) OCXP2="NO LOC"
116 I $L(OCXP1),$L(OCXP2) Q OCXP1_"^"_OCXP2
117 ;
118 S OCXP2=$G(^DPT(+$G(DFN),.1))
119 I $L(OCXP2) Q "I^"_OCXP2
120 Q "O^OUTPT"
121 ;
122POINTER(OCXFILE,D0) ; This Local Extrinsic Function gets the value of the name field
123 ; of record D0 in file OCXFILE
124 Q:'$G(D0) "" Q:'$L($G(OCXFILE)) ""
125 N GLREF
126 I '(OCXFILE=(+OCXFILE)) S GLREF=U_OCXFILE
127 E S GLREF=$$FILE^OCXBDTD(+OCXFILE,"GLOBAL NAME") Q:'$L(GLREF) ""
128 Q $P($G(@(GLREF_(+D0)_",0)")),U,1)
129 ;
130TERMLKUP(OCXTERM,OCXLIST) ;
131 Q $$TERM^OCXOZ01(OCXTERM,.OCXLIST)
132 ;
133WARDSERV(WARD) ; Compiler Function: GET WARD SERVICE
134 ;
135 N CODESET,PC,SERV,DIC,X,Y,DA
136 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"
137 S DIC=42,DIC(0)="NZ",X="`"_(+WARD) D ^DIC Q:(Y<1) ""
138 S SERV=$P($G(Y(0)),U,3)
139 Q:'$L(SERV) "" Q:'$L(CODESET) ""
140 F PC=1:1:$L(CODESET,";"),0 I PC,($P($P(CODESET,";",PC),":",1)=SERV) Q
141 Q:'PC "" Q $P($P(CODESET,";",PC),":",2)
142 ;
Note: See TracBrowser for help on using the repository browser.