RAMAGRP2 ;HCIOFO/SG - ORDERS/EXAMS API (REMOTE PROCEDURES) ; 2/19/08 3:46pm
 ;;5.0;Radiology/Nuclear Medicine;**90**;Mar 16, 1998;Build 20
 ;
 Q
 ;
 ;+++++ INDICATES THAT THE PROCEDURE HAS BEEN PERFORMED
 ; RPC: [RAMAG EXAMINED]
 ;
 ; .RARESULT     Reference to a local variable where the results
 ;               are returned to.
 ;
 ; See the comments preceding the $$EXAMINED^RAMAG07 function for
 ; description of other parameters.
 ;
 ; Return Values:
 ;
 ; A negative value of the first "^"-piece of the RARESULT(0)
 ; indicates an error (see the RPCSTK^RAERR01 procedure for more
 ; details).
 ;
 ; Otherwise, 0 is returned in the RARESULT(0).
 ;
EXAMINED(RARESULT,RACASE,RAMSC) ;
 N RAERROR,RAMISC,RC
 N:'$G(RAPARAMS("DEBUG")) RAPARAMS
 K RARESULT  S (RARESULT(0),RC)=0
 D CLEAR^RAERR(1)
 ;--- Debug code
 D:$G(RAPARAMS("DEBUG"))>1
 . D W^RAMAGU11("RAMAG EXAMINED","!!")
 . D VARS^RAMAGU11("RACASE")
 . D ZW^RAUTL22("RAMSC")
 D
 . ;--- Parse miscellaneous parameters
 . S RC=$$RPCMISC^RAMAGU01(.RAMSC,.RAMISC)  Q:RC<0
 . K RAMSC
 . ;--- Indicate that the procedure has been performed
 . S RC=$$EXAMINED^RAMAG07(.RAPARAMS,.RACASE,.RAMISC)
 ;---
 D:RC<0 RPCSTK^RAERR01(.RARESULT,RC)
 Q
 ;
 ;+++++ RETURNS EXAM STATUS REQUIREMENTS
 ; RPC: [RAMAG EXAM STATUS REQUIREMENTS]
 ;
 ; .RARESULT     Reference to a local variable where the results
 ;               are returned to.
 ;
 ; RACTION       Action that is going to be performed on an
 ;               exam/case record (single character):
 ;
 ;                 E  Examined (procedure has been performed,
 ;                    images have been acquired)
 ;
 ;                 C  Complete
 ;
 ; RAIMGTYI      Imaging type IEN (file #79.2).
 ;
 ; [RAPROC]      Radiology procedure IEN (file #71). This parameter
 ;               is required to determine exact nuclear medicine
 ;               requirements. See the $$EXMSTREQ^RAMAGU06 for more
 ;               details.
 ;
 ; Return Values:
 ;
 ; A negative value of the first "^"-piece of the RARESULT(0)
 ; indicates an error (see the RPCSTK^RAERR01 procedure for more
 ; details).
 ;
 ; Otherwise, exam status requirements are returned in the
 ; RARESULT(0). See the $$EXMSTREQ^RAMAGU06 for details.
 ; Descriptor of the exam status is returned in the RARESULT(1).
 ; See the ^RAMAGU06 for details.
 ;
EXMSTREQ(RARESULT,RACTION,RAIMGTYI,RAPROC) ;
 N EXMST,RAERROR,RC
 N:'$G(RAPARAMS("DEBUG")) RAPARAMS
 K RARESULT  S (EXMST,RARESULT(0),RC)=0
 D CLEAR^RAERR(1)
 ;=== Debug code
 D:$G(RAPARAMS("DEBUG"))>1
 . D W^RAMAGU11("RAMAG EXAM STATUS REQUIREMENTS","!!")
 . D VARS^RAMAGU11("RACTION,RAIMGTYI")
 ;
 ;=== Find the exam status record
 D
 . I RACTION="C"  D  Q
 . . S EXMST=$$EXMSTINF^RAMAGU06("^^9",.RAIMGTYI)
 . ;---
 . I RACTION="E"  D  Q
 . . S EXMST=$$EXMSTINF^RAMAGU06("^^1",.RAIMGTYI)  Q:EXMST<0
 . . S EXMST=$$GETEXMND^RAMAGU06(+EXMST)
 . ;---
 . S EXMST=$$IPVE^RAERR("RACTION")
 S:EXMST<0 RC=EXMST
 ;
 ;=== Get the status requirements
 I RC'<0  D
 . S (RARESULT(0),RC)=$$EXMSTREQ^RAMAGU06(+EXMST,.RAPROC)  Q:RC<0
 . S RARESULT(1)=EXMST
 D:RC<0 RPCSTK^RAERR01(.RARESULT,RC)
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRAMAGRP2   3195     printed  Sep 23, 2025@20:13:03                                                                                                                                                                                                    Page 2
RAMAGRP2  ;HCIOFO/SG - ORDERS/EXAMS API (REMOTE PROCEDURES) ; 2/19/08 3:46pm
 +1       ;;5.0;Radiology/Nuclear Medicine;**90**;Mar 16, 1998;Build 20
 +2       ;
 +3        QUIT 
 +4       ;
 +5       ;+++++ INDICATES THAT THE PROCEDURE HAS BEEN PERFORMED
 +6       ; RPC: [RAMAG EXAMINED]
 +7       ;
 +8       ; .RARESULT     Reference to a local variable where the results
 +9       ;               are returned to.
 +10      ;
 +11      ; See the comments preceding the $$EXAMINED^RAMAG07 function for
 +12      ; description of other parameters.
 +13      ;
 +14      ; Return Values:
 +15      ;
 +16      ; A negative value of the first "^"-piece of the RARESULT(0)
 +17      ; indicates an error (see the RPCSTK^RAERR01 procedure for more
 +18      ; details).
 +19      ;
 +20      ; Otherwise, 0 is returned in the RARESULT(0).
 +21      ;
EXAMINED(RARESULT,RACASE,RAMSC) ;
 +1        NEW RAERROR,RAMISC,RC
 +2        if '$GET(RAPARAMS("DEBUG"))
               NEW RAPARAMS
 +3        KILL RARESULT
           SET (RARESULT(0),RC)=0
 +4        DO CLEAR^RAERR(1)
 +5       ;--- Debug code
 +6        if $GET(RAPARAMS("DEBUG"))>1
               Begin DoDot:1
 +7                DO W^RAMAGU11("RAMAG EXAMINED","!!")
 +8                DO VARS^RAMAGU11("RACASE")
 +9                DO ZW^RAUTL22("RAMSC")
               End DoDot:1
 +10       Begin DoDot:1
 +11      ;--- Parse miscellaneous parameters
 +12           SET RC=$$RPCMISC^RAMAGU01(.RAMSC,.RAMISC)
               if RC<0
                   QUIT 
 +13           KILL RAMSC
 +14      ;--- Indicate that the procedure has been performed
 +15           SET RC=$$EXAMINED^RAMAG07(.RAPARAMS,.RACASE,.RAMISC)
           End DoDot:1
 +16      ;---
 +17       if RC<0
               DO RPCSTK^RAERR01(.RARESULT,RC)
 +18       QUIT 
 +19      ;
 +20      ;+++++ RETURNS EXAM STATUS REQUIREMENTS
 +21      ; RPC: [RAMAG EXAM STATUS REQUIREMENTS]
 +22      ;
 +23      ; .RARESULT     Reference to a local variable where the results
 +24      ;               are returned to.
 +25      ;
 +26      ; RACTION       Action that is going to be performed on an
 +27      ;               exam/case record (single character):
 +28      ;
 +29      ;                 E  Examined (procedure has been performed,
 +30      ;                    images have been acquired)
 +31      ;
 +32      ;                 C  Complete
 +33      ;
 +34      ; RAIMGTYI      Imaging type IEN (file #79.2).
 +35      ;
 +36      ; [RAPROC]      Radiology procedure IEN (file #71). This parameter
 +37      ;               is required to determine exact nuclear medicine
 +38      ;               requirements. See the $$EXMSTREQ^RAMAGU06 for more
 +39      ;               details.
 +40      ;
 +41      ; Return Values:
 +42      ;
 +43      ; A negative value of the first "^"-piece of the RARESULT(0)
 +44      ; indicates an error (see the RPCSTK^RAERR01 procedure for more
 +45      ; details).
 +46      ;
 +47      ; Otherwise, exam status requirements are returned in the
 +48      ; RARESULT(0). See the $$EXMSTREQ^RAMAGU06 for details.
 +49      ; Descriptor of the exam status is returned in the RARESULT(1).
 +50      ; See the ^RAMAGU06 for details.
 +51      ;
EXMSTREQ(RARESULT,RACTION,RAIMGTYI,RAPROC) ;
 +1        NEW EXMST,RAERROR,RC
 +2        if '$GET(RAPARAMS("DEBUG"))
               NEW RAPARAMS
 +3        KILL RARESULT
           SET (EXMST,RARESULT(0),RC)=0
 +4        DO CLEAR^RAERR(1)
 +5       ;=== Debug code
 +6        if $GET(RAPARAMS("DEBUG"))>1
               Begin DoDot:1
 +7                DO W^RAMAGU11("RAMAG EXAM STATUS REQUIREMENTS","!!")
 +8                DO VARS^RAMAGU11("RACTION,RAIMGTYI")
               End DoDot:1
 +9       ;
 +10      ;=== Find the exam status record
 +11       Begin DoDot:1
 +12           IF RACTION="C"
                   Begin DoDot:2
 +13                   SET EXMST=$$EXMSTINF^RAMAGU06("^^9",.RAIMGTYI)
                   End DoDot:2
                   QUIT 
 +14      ;---
 +15           IF RACTION="E"
                   Begin DoDot:2
 +16                   SET EXMST=$$EXMSTINF^RAMAGU06("^^1",.RAIMGTYI)
                       if EXMST<0
                           QUIT 
 +17                   SET EXMST=$$GETEXMND^RAMAGU06(+EXMST)
                   End DoDot:2
                   QUIT 
 +18      ;---
 +19           SET EXMST=$$IPVE^RAERR("RACTION")
           End DoDot:1
 +20       if EXMST<0
               SET RC=EXMST
 +21      ;
 +22      ;=== Get the status requirements
 +23       IF RC'<0
               Begin DoDot:1
 +24               SET (RARESULT(0),RC)=$$EXMSTREQ^RAMAGU06(+EXMST,.RAPROC)
                   if RC<0
                       QUIT 
 +25               SET RARESULT(1)=EXMST
               End DoDot:1
 +26       if RC<0
               DO RPCSTK^RAERR01(.RARESULT,RC)
 +27       QUIT