source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORKCHK4.m@ 861

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

initial load of WorldVistAEHR

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