source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORKCHK6.m@ 1607

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

initial load of FOIAVistA 6/30/08 version

File size: 4.7 KB
Line 
1ORKCHK6 ; slc/CLA - Support routine called by ORKCHK to do SESSION mode order checks ;3/6/97 9:35
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**6,32,74,87,94,123,162,190,249**;Dec 17, 1997
3 Q
4 ;
5EN(ORKS,ORKDFN,ORKA,ORENT,ORKTMODE) ;perform order checking for entire ordering session
6 Q:$$GET^XPAR("DIV^SYS^PKG","ORK SYSTEM ENABLE/DISABLE",1,"I")="D"
7 ;
8 N OI,ORKDG,HL7,ODT,ORNUM,HL7NPTR,HL7NTXT,HL7NCOD,HL7LPTR,HL7LTXT,HL7LCOD
9 N ORKMSG,ORKDGI,ORKT,ORKTXT,ORKPDATA
10 ;
11 S OI=$P(ORKA,"|"),ORKDG=$P(ORKA,"|",2),HL7=$P(ORKA,"|",3)
12 S ODT=$P(ORKA,"|",4),ORNUM=$P(ORKA,"|",5),ORKPDATA=$P(ORKA,"|",6)
13 S HL7NPTR=$P(HL7,U),HL7NTXT=$P(HL7,U,2),HL7NCOD=$P(HL7,U,3)
14 S HL7LPTR=$P(HL7,U,4),HL7LTXT=$P(HL7,U,5),HL7LCOD=$P(HL7,U,6)
15 ;
16 S:ORKDG="PSJ" ORKDG="PSI"
17 I $E(ORKDG,1,2)="PS" D PHARM
18 I $E(ORKDG,1,2)'="PS" D MLM^ORKCHK2(.ORKS,ORKDFN,ORKA,ORENT,"SESSION")
19 Q
20 ;
21PHARM ;process pharmacy order checks:
22 N ORPSPKG,ORPSA,ORKDD
23 N ORCRITN,ORCRITF,ORCRITD,ORSIGN,ORSIGF,ORSIGD,ORDUPN,ORDUPF,ORDUPD,ORDUPC,ORDUPCF,ORDUPCD
24 ;
25 D PARAMS("CRITICAL DRUG INTERACTION",.ORCRITN,.ORCRITF,.ORCRITD)
26 D PARAMS("SIGNIFICANT DRUG INTERACTION",.ORSIGN,.ORSIGF,.ORSIGD)
27 D PARAMS("DUPLICATE DRUG ORDER",.ORDUPN,.ORDUPF,.ORDUPD)
28 D PARAMS("DUPLICATE DRUG CLASS ORDER",.ORDUPCN,.ORDUPCF,.ORDUPCD)
29 ;
30 ;dispense drug selected:
31 I $L($G(HL7LPTR)),($G(HL7LCOD)="99PSD") D
32 .D RXOCS
33 .D MLM^ORKCHK2(.ORKS,ORKDFN,ORKA,ORENT,"SESSION")
34 ;
35 ;dispense drug NOT selected, split OI into dispense drugs:
36 I '$L($G(HL7LPTR)) D
37 .S ORPSPKG=$E(ORKDG,3)
38 .I ORPSPKG="H" S ORPSPKG="X" ;change to "X" if "H"erbal/non-VA med
39 .I "IOX"[ORPSPKG D OI2DD(.ORPSA,OI,ORPSPKG)
40 .S ORKDD=0 F S ORKDD=$O(ORPSA(ORKDD)) Q:'ORKDD D
41 ..S HL7LTXT=ORPSA(ORKDD)
42 ..S HL7NPTR=$P(ORKDD,";",2)
43 ..S HL7LPTR=+ORKDD
44 ..S HL7LCOD="99PSD",HL7NCOD="99NDF"
45 ..S $P(HL7,U)=HL7NPTR,$P(HL7,U,3)=HL7NCOD
46 ..S $P(HL7,U,4)=HL7LPTR,$P(HL7,U,5)=HL7LTXT,$P(HL7,U,6)=HL7LCOD
47 ..S $P(ORKA,"|",3)=HL7 ;set these for MLM OCX call
48 ..D RXOCS
49 ..D MLM^ORKCHK2(.ORKS,ORKDFN,ORKA,ORENT,"SESSION")
50 Q
51 ;
52RXOCS ;drug-drug interaction, duplicate drug order, duplicate drug class
53 Q:ORCRITF_ORSIGF_ORDUPF_ORDUPCF'["E" ;quit if none are "E"nabled
54 N ORKRX,ORPSNUM
55 I $L($G(HL7LPTR)),($G(HL7LCOD)="99PSD") D
56 .D CHKSESS^ORKPS(.ORKRX,ORKDFN,HL7LPTR,OI,ORKPDATA,ORKDG)
57 .N CHK,XX S CHK=0,XX=""
58 .F S CHK=$O(ORKRX(CHK)) Q:'CHK D
59 ..S XX=ORKRX(CHK)
60 ..;
61 ..;critical drug interaction:
62 ..I $P(XX,U)="DI",$P(XX,U,5)="CRITICAL" D
63 ...Q:ORCRITF="D"
64 ...S ORPSNUM=$P(XX,U,8) ;get the associated order number
65 ...I $L(ORPSNUM),$G(^OR(100,+ORPSNUM,0)) S ORKT=$$FULLTEXT^ORQOR1(+ORPSNUM),ORKTXT=$P(ORKT,U)_" ["_$P(ORKT,U,2)_"]"
66 ...E S ORKTXT=$P(XX,U,3)
67 ...S ORKMSG=$P(XX,U,5)_" drug-drug interaction: "_$P(XX,U,6)_" & "_$P(XX,U,7)
68 ...S ORKS("ORK",ORCRITD_","_$G(ORNUM)_","_ORPSNUM_","_$E(ORKMSG,1,225))=ORNUM_U_ORCRITN_U_ORCRITD_U_ORKMSG_" ("_ORKTXT_")"_U_$G(ORPSNUM)
69 ..;
70 ..;significant drug interaction:
71 ..I $P(XX,U)="DI",$P(XX,U,5)="SIGNIFICANT" D
72 ...Q:ORSIGF="D"
73 ...S ORPSNUM=$P(XX,U,8) ;get the associated order number
74 ...I $L(ORPSNUM),$G(^OR(100,+ORPSNUM,0)) S ORKT=$$FULLTEXT^ORQOR1(+ORPSNUM),ORKTXT=$P(ORKT,U)_" ["_$P(ORKT,U,2)_"]"
75 ...E S ORKTXT=$P(XX,U,3)
76 ...S ORKMSG=$P(XX,U,5)_" drug-drug interaction: "_$P(XX,U,6)_" & "_$P(XX,U,7)
77 ...S ORKS("ORK",ORSIGD_","_$G(ORNUM)_","_ORPSNUM_","_$E(ORKMSG,1,225))=ORNUM_U_ORSIGN_U_ORSIGD_U_ORKMSG_" ("_ORKTXT_")"_U_$G(ORPSNUM)
78 ..;
79 ..;duplicate drug:
80 ..I $P(XX,U)="DD" D
81 ...Q:ORDUPF="D"
82 ...S ORPSNUM=$P(XX,U,4) ;get the associated order number
83 ...I $L(ORPSNUM),$G(^OR(100,+ORPSNUM,0)) S ORKT=$$FULLTEXT^ORQOR1(+ORPSNUM),ORKTXT=$P(ORKT,U)_" ["_$P(ORKT,U,2)_"]"
84 ...E S ORKTXT=$P(XX,U,3)
85 ...S ORKMSG="Duplicate drug order: "_ORKTXT
86 ...S ORKS("ORK",ORDUPD_","_$G(ORNUM)_","_ORPSNUM_",Duplicate drug order: "_$P(XX,U,3))=ORNUM_U_ORDUPN_U_ORDUPD_U_ORKMSG_U_$G(ORPSNUM)
87 ..;
88 ..;duplicate class:
89 ..I $P(XX,U)="DC" D
90 ...Q:ORDUPCF="D"
91 ...S ORPSNUM=$P(XX,U,6) ;get the associated order number
92 ...I $L(ORPSNUM),$G(^OR(100,+ORPSNUM,0)) S ORKT=$$FULLTEXT^ORQOR1(+ORPSNUM),ORKTXT=$P(ORKT,U)_" ["_$P(ORKT,U,2)_"]"
93 ...E S ORKTXT=$P(XX,U,5)
94 ...S ORKMSG="Duplicate drug class order: "_$P(XX,U,3)
95 ...S ORKS("ORK",ORDUPCD_","_$G(ORNUM)_","_ORPSNUM_","_$E(ORKMSG,1,225))=ORNUM_U_ORDUPCN_U_ORDUPCD_U_ORKMSG_" ("_ORKTXT_")"_U_$G(ORPSNUM)
96 Q
97 ;
98OI2DD(ORPSA,OROI,ORPSPKG) ;rtn dispense drugs for a PS OI
99 N PSOI
100 Q:'$D(^ORD(101.43,OROI,0))
101 S PSOI=$P($P(^ORD(101.43,OROI,0),U,2),";")
102 Q:+$G(PSOI)<1
103 D DRG^PSSUTIL1(.ORPSA,PSOI,ORPSPKG)
104 Q
105 ;
106PARAMS(ORKNAME,ORKNUM,ORKFLAG,ORKDNGR) ; get parameter values for an order chk
107 S ORKNUM=0,ORKNUM=$O(^ORD(100.8,"B",ORKNAME,ORKNUM))
108 S ORKFLAG=$$GET^XPAR(ORENT,"ORK PROCESSING FLAG",ORKNUM,"I")
109 S ORKDNGR=$$GET^XPAR("DIV^SYS^PKG","ORK CLINICAL DANGER LEVEL",ORKNUM,"I")
110 Q
Note: See TracBrowser for help on using the repository browser.