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

RAMAGRP1.m

Go to the documentation of this file.
  1. RAMAGRP1 ;HCIOFO/SG - ORDERS/EXAMS API (REMOTE PROCEDURES) ; 6/6/08 2:40pm
  1. ;;5.0;Radiology/Nuclear Medicine;**90**;Mar 16, 1998;Build 20
  1. ;
  1. Q
  1. ;
  1. ;+++++ COMPLETES THE EXAM
  1. ; RPC: [RAMAG EXAM COMPLETE]
  1. ;
  1. ; .RARESULT Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; See the comments preceding the $$COMPLETE^RAMAG06 function for
  1. ; description of other parameters.
  1. ;
  1. ; NOTE: Date/time values are passed into this RPC it in HL7
  1. ; format (TS): YYYYMMDD[HHMM[+/-ZZZZ]].
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RARESULT(0)
  1. ; indicates an error (see the RPCSTK^RAERR01 procedure for more
  1. ; details).
  1. ;
  1. ; Otherwise, 0 is returned in the RARESULT(0).
  1. ;
  1. COMPLETE(RARESULT,RACASE,RAMSC) ;
  1. N RAERROR,RAMISC,RC
  1. N:'$G(RAPARAMS("DEBUG")) RAPARAMS
  1. K RARESULT S (RARESULT(0),RC)=0
  1. ;---
  1. D CLEAR^RAERR(1)
  1. D:$G(RAPARAMS("DEBUG"))>1
  1. . D W^RAMAGU11("RAMAG EXAM COMPLETE","!!")
  1. . D VARS^RAMAGU11("RACASE")
  1. . D ZW^RAUTL22("RAMSC")
  1. D
  1. . ;--- Parse miscellaneous parameters
  1. . S RC=$$RPCMISC^RAMAGU01(.RAMSC,.RAMISC) Q:RC<0
  1. . K RAMSC
  1. . ;--- Complete the exam
  1. . S RC=$$COMPLETE^RAMAG06(.RAPARAMS,.RACASE,.RAMISC)
  1. ;---
  1. D:RC<0 RPCSTK^RAERR01(.RARESULT,RC)
  1. Q
  1. ;
  1. ;+++++ CANCELS THE EXAM
  1. ; RPC: [RAMAG EXAM CANCEL]
  1. ;
  1. ; .RARESULT Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; See the comments preceding the $$EXAMCANC^RAMAG05 function for
  1. ; description of other parameters.
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RARESULT(0)
  1. ; indicates an error (see the RPCSTK^RAERR01 procedure for more
  1. ; details).
  1. ;
  1. ; Otherwise, 0 is returned in the RARESULT(0).
  1. ;
  1. EXAMCANC(RARESULT,RACASE,RAREASON,RAFLAGS,RAMSC) ;
  1. N RAERROR,RAMISC,RC
  1. N:'$G(RAPARAMS("DEBUG")) RAPARAMS
  1. K RARESULT S (RARESULT(0),RC)=0
  1. ;---
  1. D CLEAR^RAERR(1)
  1. D:$G(RAPARAMS("DEBUG"))>1
  1. . D W^RAMAGU11("RAMAG EXAM CANCEL","!!")
  1. . D VARS^RAMAGU11("RACASE,RAREASON,RAFLAGS")
  1. . D ZW^RAUTL22("RAMSC")
  1. D
  1. . ;--- Parse miscellaneous parameters
  1. . S RC=$$RPCMISC^RAMAGU01(.RAMSC,.RAMISC) Q:RC<0
  1. . K RAMSC
  1. . ;--- Cancel the exam
  1. . S RC=$$EXAMCANC^RAMAG05(.RAPARAMS,.RACASE,.RAREASON,.RAFLAGS,.RAMISC)
  1. ;---
  1. D:RC<0 RPCSTK^RAERR01(.RARESULT,RC)
  1. Q
  1. ;
  1. ;+++++ CANCELS THE ORDER
  1. ; RPC: [RAMAG ORDER CANCEL]
  1. ;
  1. ; .RARESULT Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; See the comments preceding the $$ORDCANC^RAMAG04 function for
  1. ; description of other parameters.
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RARESULT(0)
  1. ; indicates an error (see the RPCSTK^RAERR01 procedure for more
  1. ; details).
  1. ;
  1. ; Otherwise, 0 is returned in the RARESULT(0).
  1. ;
  1. ORDCANC(RARESULT,RAOIFN,RAREASON,RAMSC) ;
  1. N RAERROR,RAMISC,RC
  1. N:'$G(RAPARAMS("DEBUG")) RAPARAMS
  1. K RARESULT S (RARESULT(0),RC)=0
  1. ;---
  1. D CLEAR^RAERR(1)
  1. D:$G(RAPARAMS("DEBUG"))>1
  1. . D W^RAMAGU11("RAMAG ORDER CANCEL","!!")
  1. . D VARS^RAMAGU11("RAOIFN,RAREASON")
  1. . D ZW^RAUTL22("RAMSC")
  1. D
  1. . ;--- Parse miscellaneous parameters
  1. . S RC=$$RPCMISC^RAMAGU01(.RAMSC,.RAMISC) Q:RC<0
  1. . K RAMSC
  1. . ;--- Cancel the order
  1. . S RC=$$ORDCANC^RAMAG04(.RAPARAMS,.RAOIFN,.RAREASON,.RAMISC)
  1. ;---
  1. D:RC<0 RPCSTK^RAERR01(.RARESULT,RC)
  1. Q
  1. ;
  1. ;+++++ ORDERS/REQUESTS AN EXAM
  1. ; RPC: [RAMAG EXAM ORDER]
  1. ;
  1. ; .RARESULT Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; See the comments preceding the $$ORDER^RAMAG02 function for
  1. ; description of other parameters.
  1. ;
  1. ; NOTE: Date/time values are passed into this RPC it in HL7
  1. ; format (TS): YYYYMMDD[HHMM[+/-ZZZZ]].
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RARESULT(0)
  1. ; indicates an error (see the RPCSTK^RAERR01 procedure for more
  1. ; details).
  1. ;
  1. ; Otherwise, IEN of the new order in the RAD/NUC MED ORDERS file
  1. ; (#75.1) is returned in the RARESULT(0).
  1. ;
  1. ORDER(RARESULT,RADFN,RAMLC,RAPROC,REQDTE,RACAT,REQLOC,REQPHYS,REASON,RAMSC) ;
  1. N REQDTE1,RAERROR,RAMISC,RC
  1. N:'$G(RAPARAMS("DEBUG")) RAPARAMS
  1. K RARESULT S (RARESULT(0),RC)=0
  1. ;---
  1. D CLEAR^RAERR(1)
  1. D:$G(RAPARAMS("DEBUG"))>1
  1. . D W^RAMAGU11("RAMAG EXAM ORDER","!!")
  1. . D VARS^RAMAGU11("RADFN,RAMLC,RAPROC")
  1. . D VARS^RAMAGU11("REQDTE,RACAT,REQLOC,REQPHYS")
  1. . D VARS^RAMAGU11("REASON")
  1. . D ZW^RAUTL22("RAMSC")
  1. D
  1. . ;--- Parse miscellaneous parameters
  1. . S RC=$$RPCMISC^RAMAGU01(.RAMSC,.RAMISC) Q:RC<0
  1. . K RAMSC
  1. . ;--- Convert the request date
  1. . S REQDTE1=$$HL7TFM^XLFDT($G(REQDTE))
  1. . I REQDTE1'>0 D Q
  1. . . S RC=$$IPVE^RAERR("REQDTE")
  1. . ;--- Request an exam
  1. . S RC=$$ORDER^RAMAG02(.RAPARAMS,.RADFN,.RAMLC,.RAPROC,REQDTE1,.RACAT,.REQLOC,.REQPHYS,.REASON,.RAMISC)
  1. . S:RC>0 RARESULT(0)=+RC
  1. ;---
  1. D:RC<0 RPCSTK^RAERR01(.RARESULT,RC)
  1. Q
  1. ;
  1. ;+++++ REGISTERS THE EXAM
  1. ; RPC: [RAMAG EXAM REGISTER]
  1. ;
  1. ; .RARESULT Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; See the comments preceding the $$REGISTER^RAMAG03 function for
  1. ; description of other parameters.
  1. ;
  1. ; NOTE: Date/time values are passed into this RPC and returned from
  1. ; it in HL7 format (TS): YYYYMMDD[HHMM[+/-ZZZZ]].
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RARESULT(0)
  1. ; indicates an error (see the RPCSTK^RAERR01 procedure for more
  1. ; details).
  1. ;
  1. ; Otherwise, number of registered examinations is returned in the
  1. ; RARESULT(0) and identifiers of the examinations are returned
  1. ; in the subsequent elements of the array.
  1. ;
  1. ; RARESULT(
  1. ; 0) Number of registered examinations
  1. ;
  1. ; i) Examination identifiers
  1. ; ^01: IEN of the patient in the file #70
  1. ; ^02: IEN in the REGISTERED EXAMS multiple
  1. ; ^03: IEN in the EXAMINATIONS multiple
  1. ; ^04: Case number
  1. ; ^05: Accession number
  1. ; ^06: Actual date/time of the case (value
  1. ; of the EXAM DATE field) in HL7 format
  1. ; (TS): YYYYMMDD[HHMM[+/-ZZZZ]]
  1. ;
  1. REGISTER(RARESULT,RAOIFN,EXMDTE,RAMSC) ;
  1. N I,EXMDTE1,RAERROR,RAMISC,RC
  1. N:'$G(RAPARAMS("DEBUG")) RAPARAMS
  1. K RARESULT S (RARESULT(0),RC)=0
  1. ;---
  1. D CLEAR^RAERR(1)
  1. D:$G(RAPARAMS("DEBUG"))>1
  1. . D W^RAMAGU11("RAMAG EXAM REGISTER","!!")
  1. . D VARS^RAMAGU11("RAOIFN,EXMDTE")
  1. . D ZW^RAUTL22("RAMSC")
  1. D
  1. . ;--- Parse miscellaneous parameters
  1. . S RC=$$RPCMISC^RAMAGU01(.RAMSC,.RAMISC) Q:RC<0
  1. . K RAMSC
  1. . ;--- Convert the exam date/time
  1. . S EXMDTE1=$$HL7TFM^XLFDT($G(EXMDTE))
  1. . I EXMDTE1'>0 D Q
  1. . . S RC=$$IPVE^RAERR("EXMDTE")
  1. . ;--- Register the exam
  1. . S RC=$$REGISTER^RAMAG03(.RAPARAMS,.RARESULT,.RAOIFN,EXMDTE1,.RAMISC)
  1. . Q:RC'>0
  1. . S RARESULT(0)=+RC
  1. . ;--- Convert the result date/time values to HL7 (TS) format
  1. . F I=1:1:RARESULT(0) D
  1. . . S $P(RARESULT(I),U,6)=$$FMTHL7^XLFDT($P(RARESULT(I),U,6))
  1. ;---
  1. D:RC<0 RPCSTK^RAERR01(.RARESULT,RC)
  1. Q