ORSMART ;SLC/JMH - SMART UTILITY FUNCTIONS ; 4/15/21 1:06pm
;;3.0;ORDER ENTRY/RESULTS REPORTING;**377,498**;Dec 17, 1997;Build 38
;
SMRADPR(ORRAD,ORIEN) ;RETURN 1 IF ORRAD IS A RADIOLOGY PROCEDURE SMART IS INTERESTED IN
N CODE,DATE,EXDATE,IMGORD,ORARR,ORERR,ORRET,PAT S ORRET=0
; GET REMINDER TERM LIST FOR RADIOLOGY PROCEDURES
S CODE=$$GET1^DIQ(71,ORRAD_",",9,"")
I CODE'="" S ORARR("CODESYS")="CPT",ORARR("CODE")=CODE
S ORARR("ITEMTYPE")="RAMIS(71,",ORARR("ITEM")=ORRAD
S IMGORD=$P($G(^OR(100,ORIEN,4)),U)
I IMGORD="" Q ORRET
S PAT=+$P($G(^OR(100,ORIEN,0)),U,2) I PAT=0 Q ORRET
S EXDATE="",DATE=0
F S EXDATE=$O(^RADPT("AO",IMGORD,PAT,EXDATE)) Q:EXDATE="" D
.S ORARR("DATE")=9999999-$P(EXDATE,".")
S ORRET=+$$CHCKPROC^PXRMPRAD(.ORARR,.ORERR)
Q ORRET
;
SMRFIRE(ORIEN,ORMSG,ORORIG,ORNEW) ;INPUT IS FILE 100 IEN FROM ALERT. OUTPUT IS ORFIRE
S ORFIRE=0
I $$SMRADPR(+$$OR2PKG(+ORIEN),ORIEN) D
.I ORORIG'=53 S ORFIRE=1 Q
.I ORORIG=53,ORNEW=84,ORMSG["Abnormal" S ORFIRE=1 Q
.I ORORIG=53,ORNEW=85,ORMSG'["Abnormal" S ORFIRE=1 Q
I ORFIRE S ORNEWMSG="SMART: "_ORMSG
Q
;
OR2PKG(ORIEN) ;TURN FILE 100 IEN INTO PACKAGE REFERENCE
N ORRET S ORRET=""
N ORI S ORI=$O(^OR(100,ORIEN,4.5,"ID","ORDERABLE",0)) I ORI D
.N ORJ S ORJ=$G(^OR(100,ORIEN,4.5,ORI,1),0) I ORJ D
..S ORRET=$P($G(^ORD(101.43,ORJ,0)),U,2)
Q ORRET
;
OR2OI(ORIEN) ;TURN FILE 100 IEN INTO ORDERABLE ITEM
N ORRET S ORRET=""
N ORI S ORI=$O(^OR(100,ORIEN,4.5,"ID","ORDERABLE",0)) I ORI D
.N ORJ S ORJ=$G(^OR(100,ORIEN,4.5,ORI,1),0) I ORJ S ORRET=ORJ
Q ORRET
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORSMART 1584 printed Dec 13, 2024@02:34:12 Page 2
ORSMART ;SLC/JMH - SMART UTILITY FUNCTIONS ; 4/15/21 1:06pm
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**377,498**;Dec 17, 1997;Build 38
+2 ;
SMRADPR(ORRAD,ORIEN) ;RETURN 1 IF ORRAD IS A RADIOLOGY PROCEDURE SMART IS INTERESTED IN
+1 NEW CODE,DATE,EXDATE,IMGORD,ORARR,ORERR,ORRET,PAT
SET ORRET=0
+2 ; GET REMINDER TERM LIST FOR RADIOLOGY PROCEDURES
+3 SET CODE=$$GET1^DIQ(71,ORRAD_",",9,"")
+4 IF CODE'=""
SET ORARR("CODESYS")="CPT"
SET ORARR("CODE")=CODE
+5 SET ORARR("ITEMTYPE")="RAMIS(71,"
SET ORARR("ITEM")=ORRAD
+6 SET IMGORD=$PIECE($GET(^OR(100,ORIEN,4)),U)
+7 IF IMGORD=""
QUIT ORRET
+8 SET PAT=+$PIECE($GET(^OR(100,ORIEN,0)),U,2)
IF PAT=0
QUIT ORRET
+9 SET EXDATE=""
SET DATE=0
+10 FOR
SET EXDATE=$ORDER(^RADPT("AO",IMGORD,PAT,EXDATE))
if EXDATE=""
QUIT
Begin DoDot:1
+11 SET ORARR("DATE")=9999999-$PIECE(EXDATE,".")
End DoDot:1
+12 SET ORRET=+$$CHCKPROC^PXRMPRAD(.ORARR,.ORERR)
+13 QUIT ORRET
+14 ;
SMRFIRE(ORIEN,ORMSG,ORORIG,ORNEW) ;INPUT IS FILE 100 IEN FROM ALERT. OUTPUT IS ORFIRE
+1 SET ORFIRE=0
+2 IF $$SMRADPR(+$$OR2PKG(+ORIEN),ORIEN)
Begin DoDot:1
+3 IF ORORIG'=53
SET ORFIRE=1
QUIT
+4 IF ORORIG=53
IF ORNEW=84
IF ORMSG["Abnormal"
SET ORFIRE=1
QUIT
+5 IF ORORIG=53
IF ORNEW=85
IF ORMSG'["Abnormal"
SET ORFIRE=1
QUIT
End DoDot:1
+6 IF ORFIRE
SET ORNEWMSG="SMART: "_ORMSG
+7 QUIT
+8 ;
OR2PKG(ORIEN) ;TURN FILE 100 IEN INTO PACKAGE REFERENCE
+1 NEW ORRET
SET ORRET=""
+2 NEW ORI
SET ORI=$ORDER(^OR(100,ORIEN,4.5,"ID","ORDERABLE",0))
IF ORI
Begin DoDot:1
+3 NEW ORJ
SET ORJ=$GET(^OR(100,ORIEN,4.5,ORI,1),0)
IF ORJ
Begin DoDot:2
+4 SET ORRET=$PIECE($GET(^ORD(101.43,ORJ,0)),U,2)
End DoDot:2
End DoDot:1
+5 QUIT ORRET
+6 ;
OR2OI(ORIEN) ;TURN FILE 100 IEN INTO ORDERABLE ITEM
+1 NEW ORRET
SET ORRET=""
+2 NEW ORI
SET ORI=$ORDER(^OR(100,ORIEN,4.5,"ID","ORDERABLE",0))
IF ORI
Begin DoDot:1
+3 NEW ORJ
SET ORJ=$GET(^OR(100,ORIEN,4.5,ORI,1),0)
IF ORJ
SET ORRET=ORJ
End DoDot:1
+4 QUIT ORRET
+5 ;