Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ORKCHK4

ORKCHK4.m

Go to the documentation of this file.
ORKCHK4 ; slc/CLA - Support routine called by ORKCHK to do SELECT mode order checks ;3/6/97  9:35
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**6,32,74,87,94,123,162,190,249**;Dec 17, 1997
 Q
 ;
EN(ORKS,ORKDFN,ORKA,ORENT,ORKTMODE) ;perform order checking for orderable item selection
 Q:$$GET^XPAR("DIV^SYS^PKG","ORK SYSTEM ENABLE/DISABLE",1,"I")="D"
 ;
 N OI,ORKDG,HL7,ODT,ORNUM,HL7NPTR,HL7NTXT,HL7NCOD,HL7LPTR,HL7LTXT,HL7LCOD
 N ORKMSG,ORKT,ORKTXT
 ;
 S OI=$P(ORKA,"|"),ORKDG=$P(ORKA,"|",2)
 S HL7=$P(ORKA,"|",3),ODT=$P(ORKA,"|",4),ORNUM=$P(ORKA,"|",5)
 S HL7NPTR=$P(HL7,U),HL7NTXT=$P(HL7,U,2),HL7NCOD=$P(HL7,U,3)
 S HL7LPTR=$P(HL7,U,4),HL7LTXT=$P(HL7,U,5),HL7LCOD=$P(HL7,U,6)
 ;
 I $E(ORKDG,1,2)="PS" D PHARM
 I $E(ORKDG,1,2)'="PS" D MLM^ORKCHK2(.ORKS,ORKDFN,ORKA,ORENT,"SELECT")
 Q
 ;
PHARM ;process pharmacy order checks:
 N ORPSPKG,ORPSA,ORKDD
 N ORCRITN,ORCRITF,ORCRITD,ORSIGN,ORSIGF,ORSIGD,ORDUPN,ORDUPF,ORDUPD,ORDUPCN,ORDUPCF,ORDUPCD
 ;
 D PARAMS("CRITICAL DRUG INTERACTION",.ORCRITN,.ORCRITF,.ORCRITD)
 D PARAMS("SIGNIFICANT DRUG INTERACTION",.ORSIGN,.ORSIGF,.ORSIGD)
 D PARAMS("DUPLICATE DRUG ORDER",.ORDUPN,.ORDUPF,.ORDUPD)
 D PARAMS("DUPLICATE DRUG CLASS ORDER",.ORDUPCN,.ORDUPCF,.ORDUPCD)
 ;
 ;dispense drug selected:
 I $L($G(HL7LPTR)),($G(HL7LCOD)="99PSD") D
 .D RXOCS
 .D MLM^ORKCHK2(.ORKS,ORKDFN,ORKA,ORENT,"SELECT")
 ;
 ;dispense drug NOT selected, split OI into dispense drugs:
 I '$L($G(HL7LPTR)) D
 .S ORPSPKG=$E(ORKDG,3)
 .I ORPSPKG="H" S ORPSPKG="X"  ;change to "X" if "H"erbal/non-VA med
 .I "IOX"[ORPSPKG D OI2DD(.ORPSA,OI,ORPSPKG)
 .S ORKDD=0 F  S ORKDD=$O(ORPSA(ORKDD)) Q:'ORKDD  D
 ..S HL7LTXT=ORPSA(ORKDD)
 ..S HL7NPTR=$P(ORKDD,";",2)
 ..S HL7LPTR=+ORKDD
 ..S HL7LCOD="99PSD",HL7NCOD="99NDF"
 ..S $P(HL7,U)=HL7NPTR,$P(HL7,U,3)=HL7NCOD
 ..S $P(HL7,U,4)=HL7LPTR,$P(HL7,U,5)=HL7LTXT,$P(HL7,U,6)=HL7LCOD
 ..S $P(ORKA,"|",3)=HL7  ;set these for MLM OCX call
 ..D RXOCS
 ..D MLM^ORKCHK2(.ORKS,ORKDFN,ORKA,ORENT,"SELECT")
 Q
 ;
RXOCS ;drug-drug interaction, duplicate drug order, duplicate drug class
 Q:ORCRITF_ORSIGF_ORDUPF_ORDUPCF'["E"  ;quit if none are "E"nabled
 N ORKRX,ORPSNUM
 D CHECK^ORKPS(.ORKRX,ORKDFN,HL7LPTR,OI,ORKDG)
 N CHK,XX S CHK=0,XX=""
 F  S CHK=$O(ORKRX(CHK)) Q:'CHK  D
 .S XX=ORKRX(CHK)
 .;
 .;critical drug interaction:
 .I $P(XX,U)="DI",$P(XX,U,5)="CRITICAL" D  ;,(ORKTMODE'="ALL") D
 ..Q:ORCRITF="D"
 ..S ORPSNUM=$P(XX,U,8)  ;get the associated order number
 ..I $L(ORPSNUM),$G(^OR(100,+ORPSNUM,0)) S ORKT=$$FULLTEXT^ORQOR1(+ORPSNUM),ORKTXT=$P(ORKT,U)_" ["_$P(ORKT,U,2)_"]"
 ..E  S ORKTXT=$P(XX,U,3)
 ..S ORKMSG=$P(XX,U,5)_" drug-drug interaction: "_$P(XX,U,6)_" & "_$P(XX,U,7)
 ..S ORKS("ORK",ORCRITD_","_$G(ORNUM)_","_ORPSNUM_","_$E(ORKMSG,1,225))=ORNUM_U_ORCRITN_U_ORCRITD_U_ORKMSG_" ("_ORKTXT_")"_U_$G(ORPSNUM)
 .;
 .;significant drug interaction:
 .I $P(XX,U)="DI",$P(XX,U,5)="SIGNIFICANT" D  ;,(ORKTMODE'="ALL") D
 ..Q:ORSIGF="D"
 ..S ORPSNUM=$P(XX,U,8)  ;get the associated order number
 ..I $L(ORPSNUM),$G(^OR(100,+ORPSNUM,0)) S ORKT=$$FULLTEXT^ORQOR1(+ORPSNUM),ORKTXT=$P(ORKT,U)_" ["_$P(ORKT,U,2)_"]"
 ..E  S ORKTXT=$P(XX,U,3)
 ..S ORKMSG=$P(XX,U,5)_" drug-drug interaction: "_$P(XX,U,6)_" & "_$P(XX,U,7)
 ..S ORKS("ORK",ORSIGD_","_$G(ORNUM)_","_ORPSNUM_","_$E(ORKMSG,1,225))=ORNUM_U_ORSIGN_U_ORSIGD_U_ORKMSG_" ("_ORKTXT_")"_U_$G(ORPSNUM)
 .;
 .;duplicate drug:
 .I $P(XX,U)="DD" D  ;,(ORKTMODE'="ALL") D
 ..Q:ORDUPF="D"
 ..S ORPSNUM=$P(XX,U,4)  ;get the associated order number
 ..I $L(ORPSNUM),$G(^OR(100,+ORPSNUM,0)) S ORKT=$$FULLTEXT^ORQOR1(+ORPSNUM),ORKTXT=$P(ORKT,U)_" ["_$P(ORKT,U,2)_"]"
 ..E  S ORKTXT=$P(XX,U,3)
 ..S ORKMSG="Duplicate drug order: "_ORKTXT
 ..S ORKS("ORK",ORDUPD_","_$G(ORNUM)_","_ORPSNUM_",Duplicate drug order: "_$P(XX,U,3))=ORNUM_U_ORDUPN_U_ORDUPD_U_ORKMSG_U_$G(ORPSNUM)
 .;
 .;duplicate class:
 .I $P(XX,U)="DC" D  ;,(ORKTMODE'="ALL") D
 ..Q:ORDUPCF="D"
 ..S ORPSNUM=$P(XX,U,6)  ;get the associated order number
 ..I $L(ORPSNUM),$G(^OR(100,+ORPSNUM,0)) S ORKT=$$FULLTEXT^ORQOR1(+ORPSNUM),ORKTXT=$P(ORKT,U)_" ["_$P(ORKT,U,2)_"]"
 ..E  S ORKTXT=$P(XX,U,5)
 ..S ORKMSG="Duplicate drug class order: "_$P(XX,U,3)
 ..S ORKS("ORK",ORDUPCD_","_$G(ORNUM)_","_ORPSNUM_","_$E(ORKMSG,1,225))=ORNUM_U_ORDUPCN_U_ORDUPCD_U_ORKMSG_" ("_ORKTXT_")"_U_$G(ORPSNUM)
 Q
 ;
OI2DD(ORPSA,OROI,ORPSPKG)       ;rtn dispense drugs for a PS OI
 N PSOI
 Q:'$D(^ORD(101.43,OROI,0))
 S PSOI=$P($P(^ORD(101.43,OROI,0),U,2),";")
 Q:+$G(PSOI)<1
 D DRG^PSSUTIL1(.ORPSA,PSOI,ORPSPKG)
 Q
 ;
PARAMS(ORKNAME,ORKNUM,ORKFLAG,ORKDNGR) ; get parameter values for an order chk
 S ORKNUM=0,ORKNUM=$O(^ORD(100.8,"B",ORKNAME,ORKNUM))
 S ORKFLAG=$$GET^XPAR(ORENT,"ORK PROCESSING FLAG",ORKNUM,"I")
 S ORKDNGR=$$GET^XPAR("DIV^SYS^PKG","ORK CLINICAL DANGER LEVEL",ORKNUM,"I")
 Q