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

ORUTL3.m

Go to the documentation of this file.
  1. ORUTL3 ;SLC/JLC - OE/RR Utilities ;Oct 12, 2021@10:42:54
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**111,397,405**;Dec 17, 1997;Build 211
  1. ;
  1. ;
  1. ;
  1. NATURE(ORIFN) ;find nature of order
  1. ;ORIFN is the order;action being requested
  1. ;if no action is present, the API will find the most recent action that has
  1. ;a nature of order
  1. N OR8,ORACT,ORNAT,ORNATURE
  1. S ORACT=$P(ORIFN,";",2),ORIFN=$P(ORIFN,";")
  1. I '$D(^OR(100,ORIFN,0)) Q 0 ; not a valid order
  1. I ORACT="" D
  1. . N S1,A
  1. . S S1=0
  1. . F S S1=$O(^OR(100,ORIFN,8,S1)) Q:'S1 S A=$P($G(^(S1,0)),"^",12) I A]"" S ORACT=S1
  1. I ORACT="" Q 0 ;not a valid order action
  1. I '$D(^OR(100,ORIFN,8,ORACT)) Q 0 ;not a valid order action
  1. S OR8=$G(^OR(100,ORIFN,8,ORACT,0)) S ORNATURE=$P(OR8,"^",12),ORNAT=$$TEXT(ORNATURE)
  1. Q ORNATURE_"^"_ORNAT
  1. TEXT(X) ; -- Returns 3 ^-piece identifier for nature X
  1. N ORN,Y S ORN=$G(^ORD(100.02,+$G(X),0))
  1. S Y=$P(ORN,U,2)_U_$P(ORN,U)_"^99ORN"
  1. Q Y
  1. ISSUPPLY(ORDDIEN) ;IS THIS DISPENSE DRUG A SUPPLY ORDER
  1. ;INPUT: ORDDIEN - DISPENSE DRUG TO BE CHECKED
  1. D ZERO^PSS50(ORDDIEN,,,,,"ORDRUG")
  1. I ^TMP($J,"ORDRUG",0)<1 Q
  1. I "^XA^XX^"[("^"_$E(^TMP($J,"ORDRUG",ORDDIEN,2),1,2)_"^") Q 1
  1. I ^TMP($J,"ORDRUG",ORDDIEN,2)="DX900",$G(^TMP($J,"ORDRUG",ORDDIEN,3))["S" Q 1
  1. Q 0
  1. ;
  1. ISOISPLY(OROIIEN) ;is this orderable item a supply order
  1. ; Input: OROIIEN - Orderable Item IEN (#101.43) to be checked
  1. N ORDRUG,ORLST,ORSPLY
  1. ;
  1. S ORSPLY=1
  1. ;
  1. D OI2DD^ORKCHK5(.ORLST,OROIIEN,"O")
  1. I '$O(ORLST(0)) S ORSPLY=0
  1. S ORDRUG=""
  1. F S ORDRUG=$O(ORLST(ORDRUG)) Q:ORDRUG=""!('ORSPLY) D
  1. . I '$$ISSUPPLY(+ORDRUG) S ORSPLY=0
  1. ;
  1. Q ORSPLY
  1. ;
  1. ISTITR(ORIFN) ; Is this a titration order?
  1. ;
  1. ; ORIFN is the Order (#100) IEN
  1. ;
  1. N OR0,ORDG,ORTITR,ORTITRVAL
  1. ;
  1. S OR0=$G(^OR(100,+ORIFN,0))
  1. S ORDG=$P($G(^ORD(100.98,+$P(OR0,U,11),0)),U,3)
  1. I ORDG'="O RX" Q 0
  1. ;
  1. S ORTITR=+$O(^OR(100,+ORIFN,4.5,"ID","TITR",0))
  1. I ORTITR D Q $G(ORTITRVAL)
  1. . S ORTITRVAL=+$G(^OR(100,+ORIFN,4.5,ORTITR,1))
  1. ;
  1. ; also check backdoor pharmacy (in case of orders marked
  1. ; in backdoor pharmacy as titrating pre-v32/p405)
  1. S PSIFN=$G(^OR(100,+ORIFN,4))
  1. I PSIFN["S" Q 0
  1. I $$TITRX^PSOUTL(PSIFN)="t" Q 1
  1. ;
  1. Q 0