RAMAGRP1 ;HCIOFO/SG - ORDERS/EXAMS API (REMOTE PROCEDURES) ; 6/6/08 2:40pm
;;5.0;Radiology/Nuclear Medicine;**90**;Mar 16, 1998;Build 20
;
Q
;
;+++++ COMPLETES THE EXAM
; RPC: [RAMAG EXAM COMPLETE]
;
; .RARESULT Reference to a local variable where the results
; are returned to.
;
; See the comments preceding the $$COMPLETE^RAMAG06 function for
; description of other parameters.
;
; NOTE: Date/time values are passed into this RPC it in HL7
; format (TS): YYYYMMDD[HHMM[+/-ZZZZ]].
;
; 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).
;
COMPLETE(RARESULT,RACASE,RAMSC) ;
N RAERROR,RAMISC,RC
N:'$G(RAPARAMS("DEBUG")) RAPARAMS
K RARESULT S (RARESULT(0),RC)=0
;---
D CLEAR^RAERR(1)
D:$G(RAPARAMS("DEBUG"))>1
. D W^RAMAGU11("RAMAG EXAM COMPLETE","!!")
. D VARS^RAMAGU11("RACASE")
. D ZW^RAUTL22("RAMSC")
D
. ;--- Parse miscellaneous parameters
. S RC=$$RPCMISC^RAMAGU01(.RAMSC,.RAMISC) Q:RC<0
. K RAMSC
. ;--- Complete the exam
. S RC=$$COMPLETE^RAMAG06(.RAPARAMS,.RACASE,.RAMISC)
;---
D:RC<0 RPCSTK^RAERR01(.RARESULT,RC)
Q
;
;+++++ CANCELS THE EXAM
; RPC: [RAMAG EXAM CANCEL]
;
; .RARESULT Reference to a local variable where the results
; are returned to.
;
; See the comments preceding the $$EXAMCANC^RAMAG05 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).
;
EXAMCANC(RARESULT,RACASE,RAREASON,RAFLAGS,RAMSC) ;
N RAERROR,RAMISC,RC
N:'$G(RAPARAMS("DEBUG")) RAPARAMS
K RARESULT S (RARESULT(0),RC)=0
;---
D CLEAR^RAERR(1)
D:$G(RAPARAMS("DEBUG"))>1
. D W^RAMAGU11("RAMAG EXAM CANCEL","!!")
. D VARS^RAMAGU11("RACASE,RAREASON,RAFLAGS")
. D ZW^RAUTL22("RAMSC")
D
. ;--- Parse miscellaneous parameters
. S RC=$$RPCMISC^RAMAGU01(.RAMSC,.RAMISC) Q:RC<0
. K RAMSC
. ;--- Cancel the exam
. S RC=$$EXAMCANC^RAMAG05(.RAPARAMS,.RACASE,.RAREASON,.RAFLAGS,.RAMISC)
;---
D:RC<0 RPCSTK^RAERR01(.RARESULT,RC)
Q
;
;+++++ CANCELS THE ORDER
; RPC: [RAMAG ORDER CANCEL]
;
; .RARESULT Reference to a local variable where the results
; are returned to.
;
; See the comments preceding the $$ORDCANC^RAMAG04 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).
;
ORDCANC(RARESULT,RAOIFN,RAREASON,RAMSC) ;
N RAERROR,RAMISC,RC
N:'$G(RAPARAMS("DEBUG")) RAPARAMS
K RARESULT S (RARESULT(0),RC)=0
;---
D CLEAR^RAERR(1)
D:$G(RAPARAMS("DEBUG"))>1
. D W^RAMAGU11("RAMAG ORDER CANCEL","!!")
. D VARS^RAMAGU11("RAOIFN,RAREASON")
. D ZW^RAUTL22("RAMSC")
D
. ;--- Parse miscellaneous parameters
. S RC=$$RPCMISC^RAMAGU01(.RAMSC,.RAMISC) Q:RC<0
. K RAMSC
. ;--- Cancel the order
. S RC=$$ORDCANC^RAMAG04(.RAPARAMS,.RAOIFN,.RAREASON,.RAMISC)
;---
D:RC<0 RPCSTK^RAERR01(.RARESULT,RC)
Q
;
;+++++ ORDERS/REQUESTS AN EXAM
; RPC: [RAMAG EXAM ORDER]
;
; .RARESULT Reference to a local variable where the results
; are returned to.
;
; See the comments preceding the $$ORDER^RAMAG02 function for
; description of other parameters.
;
; NOTE: Date/time values are passed into this RPC it in HL7
; format (TS): YYYYMMDD[HHMM[+/-ZZZZ]].
;
; 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, IEN of the new order in the RAD/NUC MED ORDERS file
; (#75.1) is returned in the RARESULT(0).
;
ORDER(RARESULT,RADFN,RAMLC,RAPROC,REQDTE,RACAT,REQLOC,REQPHYS,REASON,RAMSC) ;
N REQDTE1,RAERROR,RAMISC,RC
N:'$G(RAPARAMS("DEBUG")) RAPARAMS
K RARESULT S (RARESULT(0),RC)=0
;---
D CLEAR^RAERR(1)
D:$G(RAPARAMS("DEBUG"))>1
. D W^RAMAGU11("RAMAG EXAM ORDER","!!")
. D VARS^RAMAGU11("RADFN,RAMLC,RAPROC")
. D VARS^RAMAGU11("REQDTE,RACAT,REQLOC,REQPHYS")
. D VARS^RAMAGU11("REASON")
. D ZW^RAUTL22("RAMSC")
D
. ;--- Parse miscellaneous parameters
. S RC=$$RPCMISC^RAMAGU01(.RAMSC,.RAMISC) Q:RC<0
. K RAMSC
. ;--- Convert the request date
. S REQDTE1=$$HL7TFM^XLFDT($G(REQDTE))
. I REQDTE1'>0 D Q
. . S RC=$$IPVE^RAERR("REQDTE")
. ;--- Request an exam
. S RC=$$ORDER^RAMAG02(.RAPARAMS,.RADFN,.RAMLC,.RAPROC,REQDTE1,.RACAT,.REQLOC,.REQPHYS,.REASON,.RAMISC)
. S:RC>0 RARESULT(0)=+RC
;---
D:RC<0 RPCSTK^RAERR01(.RARESULT,RC)
Q
;
;+++++ REGISTERS THE EXAM
; RPC: [RAMAG EXAM REGISTER]
;
; .RARESULT Reference to a local variable where the results
; are returned to.
;
; See the comments preceding the $$REGISTER^RAMAG03 function for
; description of other parameters.
;
; NOTE: Date/time values are passed into this RPC and returned from
; it in HL7 format (TS): YYYYMMDD[HHMM[+/-ZZZZ]].
;
; 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, number of registered examinations is returned in the
; RARESULT(0) and identifiers of the examinations are returned
; in the subsequent elements of the array.
;
; RARESULT(
; 0) Number of registered examinations
;
; i) Examination identifiers
; ^01: IEN of the patient in the file #70
; ^02: IEN in the REGISTERED EXAMS multiple
; ^03: IEN in the EXAMINATIONS multiple
; ^04: Case number
; ^05: Accession number
; ^06: Actual date/time of the case (value
; of the EXAM DATE field) in HL7 format
; (TS): YYYYMMDD[HHMM[+/-ZZZZ]]
;
REGISTER(RARESULT,RAOIFN,EXMDTE,RAMSC) ;
N I,EXMDTE1,RAERROR,RAMISC,RC
N:'$G(RAPARAMS("DEBUG")) RAPARAMS
K RARESULT S (RARESULT(0),RC)=0
;---
D CLEAR^RAERR(1)
D:$G(RAPARAMS("DEBUG"))>1
. D W^RAMAGU11("RAMAG EXAM REGISTER","!!")
. D VARS^RAMAGU11("RAOIFN,EXMDTE")
. D ZW^RAUTL22("RAMSC")
D
. ;--- Parse miscellaneous parameters
. S RC=$$RPCMISC^RAMAGU01(.RAMSC,.RAMISC) Q:RC<0
. K RAMSC
. ;--- Convert the exam date/time
. S EXMDTE1=$$HL7TFM^XLFDT($G(EXMDTE))
. I EXMDTE1'>0 D Q
. . S RC=$$IPVE^RAERR("EXMDTE")
. ;--- Register the exam
. S RC=$$REGISTER^RAMAG03(.RAPARAMS,.RARESULT,.RAOIFN,EXMDTE1,.RAMISC)
. Q:RC'>0
. S RARESULT(0)=+RC
. ;--- Convert the result date/time values to HL7 (TS) format
. F I=1:1:RARESULT(0) D
. . S $P(RARESULT(I),U,6)=$$FMTHL7^XLFDT($P(RARESULT(I),U,6))
;---
D:RC<0 RPCSTK^RAERR01(.RARESULT,RC)
Q
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
+2 ;
+3 QUIT
+4 ;
+5 ;+++++ COMPLETES THE EXAM
+6 ; RPC: [RAMAG EXAM COMPLETE]
+7 ;
+8 ; .RARESULT Reference to a local variable where the results
+9 ; are returned to.
+10 ;
+11 ; See the comments preceding the $$COMPLETE^RAMAG06 function for
+12 ; description of other parameters.
+13 ;
+14 ; NOTE: Date/time values are passed into this RPC it in HL7
+15 ; format (TS): YYYYMMDD[HHMM[+/-ZZZZ]].
+16 ;
+17 ; Return Values:
+18 ;
+19 ; A negative value of the first "^"-piece of the RARESULT(0)
+20 ; indicates an error (see the RPCSTK^RAERR01 procedure for more
+21 ; details).
+22 ;
+23 ; Otherwise, 0 is returned in the RARESULT(0).
+24 ;
COMPLETE(RARESULT,RACASE,RAMSC) ;
+1 NEW RAERROR,RAMISC,RC
+2 IF '$GET(RAPARAMS("DEBUG"))
NEW RAPARAMS
+3 KILL RARESULT
SET (RARESULT(0),RC)=0
+4 ;---
+5 DO CLEAR^RAERR(1)
+6 IF $GET(RAPARAMS("DEBUG"))>1
Begin DoDot:1
+7 DO W^RAMAGU11("RAMAG EXAM COMPLETE","!!")
+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 ;--- Complete the exam
+15 SET RC=$$COMPLETE^RAMAG06(.RAPARAMS,.RACASE,.RAMISC)
End DoDot:1
+16 ;---
+17 IF RC<0
DO RPCSTK^RAERR01(.RARESULT,RC)
+18 QUIT
+19 ;
+20 ;+++++ CANCELS THE EXAM
+21 ; RPC: [RAMAG EXAM CANCEL]
+22 ;
+23 ; .RARESULT Reference to a local variable where the results
+24 ; are returned to.
+25 ;
+26 ; See the comments preceding the $$EXAMCANC^RAMAG05 function for
+27 ; description of other parameters.
+28 ;
+29 ; Return Values:
+30 ;
+31 ; A negative value of the first "^"-piece of the RARESULT(0)
+32 ; indicates an error (see the RPCSTK^RAERR01 procedure for more
+33 ; details).
+34 ;
+35 ; Otherwise, 0 is returned in the RARESULT(0).
+36 ;
EXAMCANC(RARESULT,RACASE,RAREASON,RAFLAGS,RAMSC) ;
+1 NEW RAERROR,RAMISC,RC
+2 IF '$GET(RAPARAMS("DEBUG"))
NEW RAPARAMS
+3 KILL RARESULT
SET (RARESULT(0),RC)=0
+4 ;---
+5 DO CLEAR^RAERR(1)
+6 IF $GET(RAPARAMS("DEBUG"))>1
Begin DoDot:1
+7 DO W^RAMAGU11("RAMAG EXAM CANCEL","!!")
+8 DO VARS^RAMAGU11("RACASE,RAREASON,RAFLAGS")
+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 ;--- Cancel the exam
+15 SET RC=$$EXAMCANC^RAMAG05(.RAPARAMS,.RACASE,.RAREASON,.RAFLAGS,.RAMISC)
End DoDot:1
+16 ;---
+17 IF RC<0
DO RPCSTK^RAERR01(.RARESULT,RC)
+18 QUIT
+19 ;
+20 ;+++++ CANCELS THE ORDER
+21 ; RPC: [RAMAG ORDER CANCEL]
+22 ;
+23 ; .RARESULT Reference to a local variable where the results
+24 ; are returned to.
+25 ;
+26 ; See the comments preceding the $$ORDCANC^RAMAG04 function for
+27 ; description of other parameters.
+28 ;
+29 ; Return Values:
+30 ;
+31 ; A negative value of the first "^"-piece of the RARESULT(0)
+32 ; indicates an error (see the RPCSTK^RAERR01 procedure for more
+33 ; details).
+34 ;
+35 ; Otherwise, 0 is returned in the RARESULT(0).
+36 ;
ORDCANC(RARESULT,RAOIFN,RAREASON,RAMSC) ;
+1 NEW RAERROR,RAMISC,RC
+2 IF '$GET(RAPARAMS("DEBUG"))
NEW RAPARAMS
+3 KILL RARESULT
SET (RARESULT(0),RC)=0
+4 ;---
+5 DO CLEAR^RAERR(1)
+6 IF $GET(RAPARAMS("DEBUG"))>1
Begin DoDot:1
+7 DO W^RAMAGU11("RAMAG ORDER CANCEL","!!")
+8 DO VARS^RAMAGU11("RAOIFN,RAREASON")
+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 ;--- Cancel the order
+15 SET RC=$$ORDCANC^RAMAG04(.RAPARAMS,.RAOIFN,.RAREASON,.RAMISC)
End DoDot:1
+16 ;---
+17 IF RC<0
DO RPCSTK^RAERR01(.RARESULT,RC)
+18 QUIT
+19 ;
+20 ;+++++ ORDERS/REQUESTS AN EXAM
+21 ; RPC: [RAMAG EXAM ORDER]
+22 ;
+23 ; .RARESULT Reference to a local variable where the results
+24 ; are returned to.
+25 ;
+26 ; See the comments preceding the $$ORDER^RAMAG02 function for
+27 ; description of other parameters.
+28 ;
+29 ; NOTE: Date/time values are passed into this RPC it in HL7
+30 ; format (TS): YYYYMMDD[HHMM[+/-ZZZZ]].
+31 ;
+32 ; Return Values:
+33 ;
+34 ; A negative value of the first "^"-piece of the RARESULT(0)
+35 ; indicates an error (see the RPCSTK^RAERR01 procedure for more
+36 ; details).
+37 ;
+38 ; Otherwise, IEN of the new order in the RAD/NUC MED ORDERS file
+39 ; (#75.1) is returned in the RARESULT(0).
+40 ;
ORDER(RARESULT,RADFN,RAMLC,RAPROC,REQDTE,RACAT,REQLOC,REQPHYS,REASON,RAMSC) ;
+1 NEW REQDTE1,RAERROR,RAMISC,RC
+2 IF '$GET(RAPARAMS("DEBUG"))
NEW RAPARAMS
+3 KILL RARESULT
SET (RARESULT(0),RC)=0
+4 ;---
+5 DO CLEAR^RAERR(1)
+6 IF $GET(RAPARAMS("DEBUG"))>1
Begin DoDot:1
+7 DO W^RAMAGU11("RAMAG EXAM ORDER","!!")
+8 DO VARS^RAMAGU11("RADFN,RAMLC,RAPROC")
+9 DO VARS^RAMAGU11("REQDTE,RACAT,REQLOC,REQPHYS")
+10 DO VARS^RAMAGU11("REASON")
+11 DO ZW^RAUTL22("RAMSC")
End DoDot:1
+12 Begin DoDot:1
+13 ;--- Parse miscellaneous parameters
+14 SET RC=$$RPCMISC^RAMAGU01(.RAMSC,.RAMISC)
IF RC<0
QUIT
+15 KILL RAMSC
+16 ;--- Convert the request date
+17 SET REQDTE1=$$HL7TFM^XLFDT($GET(REQDTE))
+18 IF REQDTE1'>0
Begin DoDot:2
+19 SET RC=$$IPVE^RAERR("REQDTE")
End DoDot:2
QUIT
+20 ;--- Request an exam
+21 SET RC=$$ORDER^RAMAG02(.RAPARAMS,.RADFN,.RAMLC,.RAPROC,REQDTE1,.RACAT,.REQLOC,.REQPHYS,.REASON,.RAMISC)
+22 IF RC>0
SET RARESULT(0)=+RC
End DoDot:1
+23 ;---
+24 IF RC<0
DO RPCSTK^RAERR01(.RARESULT,RC)
+25 QUIT
+26 ;
+27 ;+++++ REGISTERS THE EXAM
+28 ; RPC: [RAMAG EXAM REGISTER]
+29 ;
+30 ; .RARESULT Reference to a local variable where the results
+31 ; are returned to.
+32 ;
+33 ; See the comments preceding the $$REGISTER^RAMAG03 function for
+34 ; description of other parameters.
+35 ;
+36 ; NOTE: Date/time values are passed into this RPC and returned from
+37 ; it in HL7 format (TS): YYYYMMDD[HHMM[+/-ZZZZ]].
+38 ;
+39 ; Return Values:
+40 ;
+41 ; A negative value of the first "^"-piece of the RARESULT(0)
+42 ; indicates an error (see the RPCSTK^RAERR01 procedure for more
+43 ; details).
+44 ;
+45 ; Otherwise, number of registered examinations is returned in the
+46 ; RARESULT(0) and identifiers of the examinations are returned
+47 ; in the subsequent elements of the array.
+48 ;
+49 ; RARESULT(
+50 ; 0) Number of registered examinations
+51 ;
+52 ; i) Examination identifiers
+53 ; ^01: IEN of the patient in the file #70
+54 ; ^02: IEN in the REGISTERED EXAMS multiple
+55 ; ^03: IEN in the EXAMINATIONS multiple
+56 ; ^04: Case number
+57 ; ^05: Accession number
+58 ; ^06: Actual date/time of the case (value
+59 ; of the EXAM DATE field) in HL7 format
+60 ; (TS): YYYYMMDD[HHMM[+/-ZZZZ]]
+61 ;
REGISTER(RARESULT,RAOIFN,EXMDTE,RAMSC) ;
+1 NEW I,EXMDTE1,RAERROR,RAMISC,RC
+2 IF '$GET(RAPARAMS("DEBUG"))
NEW RAPARAMS
+3 KILL RARESULT
SET (RARESULT(0),RC)=0
+4 ;---
+5 DO CLEAR^RAERR(1)
+6 IF $GET(RAPARAMS("DEBUG"))>1
Begin DoDot:1
+7 DO W^RAMAGU11("RAMAG EXAM REGISTER","!!")
+8 DO VARS^RAMAGU11("RAOIFN,EXMDTE")
+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 ;--- Convert the exam date/time
+15 SET EXMDTE1=$$HL7TFM^XLFDT($GET(EXMDTE))
+16 IF EXMDTE1'>0
Begin DoDot:2
+17 SET RC=$$IPVE^RAERR("EXMDTE")
End DoDot:2
QUIT
+18 ;--- Register the exam
+19 SET RC=$$REGISTER^RAMAG03(.RAPARAMS,.RARESULT,.RAOIFN,EXMDTE1,.RAMISC)
+20 IF RC'>0
QUIT
+21 SET RARESULT(0)=+RC
+22 ;--- Convert the result date/time values to HL7 (TS) format
+23 FOR I=1:1:RARESULT(0)
Begin DoDot:2
+24 SET $PIECE(RARESULT(I),U,6)=$$FMTHL7^XLFDT($PIECE(RARESULT(I),U,6))
End DoDot:2
End DoDot:1
+25 ;---
+26 IF RC<0
DO RPCSTK^RAERR01(.RARESULT,RC)
+27 QUIT