- RAMAG03 ;HCIOFO/SG - ORDERS/EXAMS API (EXAM REGISTRATION) ; 2/10/09 4:14pm
- ;;5.0;Radiology/Nuclear Medicine;**90**;Mar 16, 1998;Build 20
- ;
- Q
- ;
- ;##### REGISTERS THE EXAM(S)
- ;
- ; .RAPARAMS Reference to the API descriptor
- ; (see the ^RA01 routine for details)
- ;
- ; .RAEXAMS( Reference to a local array where identifiers of
- ; registered examination(s) are returned to.
- ;
- ; Seq#) Exam/case identifiers:
- ; ^01: IEN of the patient in the file #70 (RADFN)
- ; ^02: IEN in the REGISTERED EXAMS multiple (RADTI)
- ; ^03: IEN in the EXAMINATIONS multiple (RACNI)
- ; ^04: Case number
- ; ^05: Accession number.
- ; SSS-MMDDYY-NNNNN if RA*5*47 is installed;
- ; MMDDYY-NNNNN otherwise.
- ; ^06: Actual date/time of the case (FileMan)
- ;
- ; RAOIFN IEN of the order in the file #75.1
- ;
- ; RADTE Date/time of the exam (FileMan). If seconds are
- ; provided, they are ignored. The date must be exact
- ; and the time is required.
- ;
- ; .RAMISC Reference to a local array containing miscellaneous
- ; request parameters.
- ;
- ; See the ^RAMAG routine for additional important
- ; details regarding this parameter.
- ;
- ; RAMISC(
- ;
- ; "BEDSECT") IEN of the bedsection in the SPECIALTY
- ; file (#42.4).
- ; Required: No (used for inpatient category only)
- ; Default: Bedsection on exam date
- ;
- ; "EXAMCAT") Exam category: value for the CATEGORY OF EXAM field
- ; (4) of the EXAMINATIONS multiple (sub-file #70.03).
- ; Required: Yes
- ; Default: Exam category from the order
- ;
- ; "FLAGS") Flags that control the execution (see the ^RAMAG
- ; routine for details). Supported flags: "A" and "D".
- ; Required: No
- ; Default: undefined
- ;
- ; "PRINCLIN") IEN of the principal clinic in the HOSPITAL
- ; LOCATION file (#44).
- ; Required: Yes (for non-inpatient categories only)
- ; Default: Requesting location if it is a clinic
- ;
- ; "RAPROC",
- ; Seq#) Radiology procedure and modifiers
- ; ^01: Procedure IEN in file #71
- ; ^02: Optional procedure modifiers (IENs in
- ; ... the PROCEDURE MODIFIERS file (#71.2))
- ; ^nn:
- ; Required: Yes
- ; Default: Procedure and modifiers from the order
- ;
- ; "SERVICE") IEN of the service in the SERVICE/SECTION
- ; file (#49).
- ; Required: No (used for inpatient category only)
- ; Default: Service section on exam date
- ;
- ; "SINGLERPT") If this parameter is defined and not 0, then all
- ; cases should be associated with the same order
- ; and they will share the same report. See the
- ; MEMBER OF SET (25) and IMAGING ORDER (11) fields
- ; of the sub-file #70.03 for more details.
- ; Required: No
- ; Default: If the order references a parent
- ; procedure that requires a single report
- ; (see the SINGLE REPORT field (18) of the
- ; file #71), then a non-zero value is
- ; assigned to this parameter. Otherwise,
- ; it is undefined.
- ;
- ; NOTE: If a parent procedure is being registered,
- ; the default value cannot be overridden.
- ;
- ; "TECHCOMM") Technologist comment
- ; Required: No
- ; Default: undefined
- ;
- ; "WARD") IEN of the ward in the WARD LOCATION file (#42).
- ; Required: No (used for inpatient category only)
- ; Default: Ward location on exam date
- ;
- ; This function uses the ^TMP($J,"RAREG1") global node.
- ;
- ; ^TMP($J,
- ; "RAREG1",i) Exam identifiers
- ; ^01: IEN of the patient in the file #70
- ; ^02: IEN in the REGISTERED EXAMS multiple
- ; ^03: IEN in the EXAMINATIONS multiple
- ;
- ; Return values:
- ; <0 Error descriptor (see $$ERROR^RAERR)
- ; >0 Number of registered examinations
- ; (number of elements in the RAEXAMS array)
- ;
- REGISTER(RAPARAMS,RAEXAMS,RAOIFN,RADTE,RAMISC) ;
- N RADFN ; IEN of the patient in the file #70
- N RADTI ; "Inverted" date/time of registered exam(s)
- N RAEXMVAL ; Exam parameters extracted from the order
- N RASACN31 ; Use the new site accession number
- N RAIMGTYI ; Imaging type IEN (file #79.2)
- N RAMDIV ; Radiology division IEN (file #79)
- N RAMLC ; Imaging location IEN (file #79.1)
- N RAPARENT ; Indicator of an exam set
- N RAPRLST ; List of detailed/series procedures
- ;
- N HLA,RAEXMCNT,RAFLAGS,RALOCK,RARC,TMP
- D:$G(RAPARAMS("DEBUG"))>1
- . D W^RAMAGU11("$$REGISTER^RAMAG03","!!")
- . D VARS^RAMAGU11("RAOIFN,RADTE")
- . D ZW^RAUTL22("RAMISC")
- K RAEXAMS,^TMP($J,"RAREG1")
- S (RAEXMCNT,RARC)=0
- ;
- D
- . ;=== Setup the error handler
- . N $ESTACK,$ETRAP D SETDEFEH^RAERR("RARC")
- . ;
- . ;=== Validate parameters
- . S RARC=$$VALIDATE^RAMAG03A(.RALOCK) Q:RARC<0
- . S RAFLAGS=$$TRFLAGS^RAUTL22($G(RAMISC("FLAGS")),"AD","AD")
- . S RASACN31=$$USLNGACN^RAMAGU13($G(RAMDIV))
- . ;
- . ;=== Lock the exam date/time node and double check parameters
- . S RARC=$$LOCKDT^RAMAG03D(RADFN,.RADTE,.RALOCK,RAFLAGS) Q:RARC<0
- . S RADTI=$$INVDTE^RAMAGU04(RADTE)
- . ;
- . ;=== Register the exam(s)
- . S RARC=$$EXAM^RAMAG03C() Q:RARC<0
- . ;
- . ;=== Update order status and send OE v3.0 message
- . D:$D(^TMP($J,"RAREG1"))>1
- . . N RAOSTS,RAPROC D UOSM^RAREG2
- . ;
- . ;=== Additional post-processing
- . S TMP=$$POSTPROC^RAMAG03C(.RAEXAMS,RADTE)
- . S:TMP'<0 RAEXMCNT=+TMP
- ;
- ;=== Error handling and cleanup
- D:RARC<0 ROLLBACK^RAMAG03D($G(RADFN),$G(RADTI))
- ;--- Unlock the global nodes
- D UNLOCKFM^RALOCK(.RALOCK)
- ;--- Cleanup
- K ^TMP($J,"RAREG1")
- Q $S(RARC<0:RARC,1:RAEXMCNT)
- RAMAG03 ;HCIOFO/SG - ORDERS/EXAMS API (EXAM REGISTRATION) ; 2/10/09 4:14pm
- +1 ;;5.0;Radiology/Nuclear Medicine;**90**;Mar 16, 1998;Build 20
- +2 ;
- +3 QUIT
- +4 ;
- +5 ;##### REGISTERS THE EXAM(S)
- +6 ;
- +7 ; .RAPARAMS Reference to the API descriptor
- +8 ; (see the ^RA01 routine for details)
- +9 ;
- +10 ; .RAEXAMS( Reference to a local array where identifiers of
- +11 ; registered examination(s) are returned to.
- +12 ;
- +13 ; Seq#) Exam/case identifiers:
- +14 ; ^01: IEN of the patient in the file #70 (RADFN)
- +15 ; ^02: IEN in the REGISTERED EXAMS multiple (RADTI)
- +16 ; ^03: IEN in the EXAMINATIONS multiple (RACNI)
- +17 ; ^04: Case number
- +18 ; ^05: Accession number.
- +19 ; SSS-MMDDYY-NNNNN if RA*5*47 is installed;
- +20 ; MMDDYY-NNNNN otherwise.
- +21 ; ^06: Actual date/time of the case (FileMan)
- +22 ;
- +23 ; RAOIFN IEN of the order in the file #75.1
- +24 ;
- +25 ; RADTE Date/time of the exam (FileMan). If seconds are
- +26 ; provided, they are ignored. The date must be exact
- +27 ; and the time is required.
- +28 ;
- +29 ; .RAMISC Reference to a local array containing miscellaneous
- +30 ; request parameters.
- +31 ;
- +32 ; See the ^RAMAG routine for additional important
- +33 ; details regarding this parameter.
- +34 ;
- +35 ; RAMISC(
- +36 ;
- +37 ; "BEDSECT") IEN of the bedsection in the SPECIALTY
- +38 ; file (#42.4).
- +39 ; Required: No (used for inpatient category only)
- +40 ; Default: Bedsection on exam date
- +41 ;
- +42 ; "EXAMCAT") Exam category: value for the CATEGORY OF EXAM field
- +43 ; (4) of the EXAMINATIONS multiple (sub-file #70.03).
- +44 ; Required: Yes
- +45 ; Default: Exam category from the order
- +46 ;
- +47 ; "FLAGS") Flags that control the execution (see the ^RAMAG
- +48 ; routine for details). Supported flags: "A" and "D".
- +49 ; Required: No
- +50 ; Default: undefined
- +51 ;
- +52 ; "PRINCLIN") IEN of the principal clinic in the HOSPITAL
- +53 ; LOCATION file (#44).
- +54 ; Required: Yes (for non-inpatient categories only)
- +55 ; Default: Requesting location if it is a clinic
- +56 ;
- +57 ; "RAPROC",
- +58 ; Seq#) Radiology procedure and modifiers
- +59 ; ^01: Procedure IEN in file #71
- +60 ; ^02: Optional procedure modifiers (IENs in
- +61 ; ... the PROCEDURE MODIFIERS file (#71.2))
- +62 ; ^nn:
- +63 ; Required: Yes
- +64 ; Default: Procedure and modifiers from the order
- +65 ;
- +66 ; "SERVICE") IEN of the service in the SERVICE/SECTION
- +67 ; file (#49).
- +68 ; Required: No (used for inpatient category only)
- +69 ; Default: Service section on exam date
- +70 ;
- +71 ; "SINGLERPT") If this parameter is defined and not 0, then all
- +72 ; cases should be associated with the same order
- +73 ; and they will share the same report. See the
- +74 ; MEMBER OF SET (25) and IMAGING ORDER (11) fields
- +75 ; of the sub-file #70.03 for more details.
- +76 ; Required: No
- +77 ; Default: If the order references a parent
- +78 ; procedure that requires a single report
- +79 ; (see the SINGLE REPORT field (18) of the
- +80 ; file #71), then a non-zero value is
- +81 ; assigned to this parameter. Otherwise,
- +82 ; it is undefined.
- +83 ;
- +84 ; NOTE: If a parent procedure is being registered,
- +85 ; the default value cannot be overridden.
- +86 ;
- +87 ; "TECHCOMM") Technologist comment
- +88 ; Required: No
- +89 ; Default: undefined
- +90 ;
- +91 ; "WARD") IEN of the ward in the WARD LOCATION file (#42).
- +92 ; Required: No (used for inpatient category only)
- +93 ; Default: Ward location on exam date
- +94 ;
- +95 ; This function uses the ^TMP($J,"RAREG1") global node.
- +96 ;
- +97 ; ^TMP($J,
- +98 ; "RAREG1",i) Exam identifiers
- +99 ; ^01: IEN of the patient in the file #70
- +100 ; ^02: IEN in the REGISTERED EXAMS multiple
- +101 ; ^03: IEN in the EXAMINATIONS multiple
- +102 ;
- +103 ; Return values:
- +104 ; <0 Error descriptor (see $$ERROR^RAERR)
- +105 ; >0 Number of registered examinations
- +106 ; (number of elements in the RAEXAMS array)
- +107 ;
- REGISTER(RAPARAMS,RAEXAMS,RAOIFN,RADTE,RAMISC) ;
- +1 ; IEN of the patient in the file #70
- NEW RADFN
- +2 ; "Inverted" date/time of registered exam(s)
- NEW RADTI
- +3 ; Exam parameters extracted from the order
- NEW RAEXMVAL
- +4 ; Use the new site accession number
- NEW RASACN31
- +5 ; Imaging type IEN (file #79.2)
- NEW RAIMGTYI
- +6 ; Radiology division IEN (file #79)
- NEW RAMDIV
- +7 ; Imaging location IEN (file #79.1)
- NEW RAMLC
- +8 ; Indicator of an exam set
- NEW RAPARENT
- +9 ; List of detailed/series procedures
- NEW RAPRLST
- +10 ;
- +11 NEW HLA,RAEXMCNT,RAFLAGS,RALOCK,RARC,TMP
- +12 IF $GET(RAPARAMS("DEBUG"))>1
- Begin DoDot:1
- +13 DO W^RAMAGU11("$$REGISTER^RAMAG03","!!")
- +14 DO VARS^RAMAGU11("RAOIFN,RADTE")
- +15 DO ZW^RAUTL22("RAMISC")
- End DoDot:1
- +16 KILL RAEXAMS,^TMP($JOB,"RAREG1")
- +17 SET (RAEXMCNT,RARC)=0
- +18 ;
- +19 Begin DoDot:1
- +20 ;=== Setup the error handler
- +21 NEW $ESTACK,$ETRAP
- DO SETDEFEH^RAERR("RARC")
- +22 ;
- +23 ;=== Validate parameters
- +24 SET RARC=$$VALIDATE^RAMAG03A(.RALOCK)
- IF RARC<0
- QUIT
- +25 SET RAFLAGS=$$TRFLAGS^RAUTL22($GET(RAMISC("FLAGS")),"AD","AD")
- +26 SET RASACN31=$$USLNGACN^RAMAGU13($GET(RAMDIV))
- +27 ;
- +28 ;=== Lock the exam date/time node and double check parameters
- +29 SET RARC=$$LOCKDT^RAMAG03D(RADFN,.RADTE,.RALOCK,RAFLAGS)
- IF RARC<0
- QUIT
- +30 SET RADTI=$$INVDTE^RAMAGU04(RADTE)
- +31 ;
- +32 ;=== Register the exam(s)
- +33 SET RARC=$$EXAM^RAMAG03C()
- IF RARC<0
- QUIT
- +34 ;
- +35 ;=== Update order status and send OE v3.0 message
- +36 IF $DATA(^TMP($JOB,"RAREG1"))>1
- Begin DoDot:2
- +37 NEW RAOSTS,RAPROC
- DO UOSM^RAREG2
- End DoDot:2
- +38 ;
- +39 ;=== Additional post-processing
- +40 SET TMP=$$POSTPROC^RAMAG03C(.RAEXAMS,RADTE)
- +41 IF TMP'<0
- SET RAEXMCNT=+TMP
- End DoDot:1
- +42 ;
- +43 ;=== Error handling and cleanup
- +44 IF RARC<0
- DO ROLLBACK^RAMAG03D($GET(RADFN),$GET(RADTI))
- +45 ;--- Unlock the global nodes
- +46 DO UNLOCKFM^RALOCK(.RALOCK)
- +47 ;--- Cleanup
- +48 KILL ^TMP($JOB,"RAREG1")
- +49 QUIT $SELECT(RARC<0:RARC,1:RAEXMCNT)