- RAMAG07 ;HCIOFO/SG - ORDERS/EXAMS API (EXAMINED) ; 9/30/08 8:52am
- ;;5.0;Radiology/Nuclear Medicine;**90**;Mar 16, 1998;Build 20
- ;
- Q
- ;
- ;##### INDICATES THAT THE PROCEDURE HAS BEEN PERFORMED
- ;
- ; .RAPARAMS Reference to the API descriptor
- ; (see the ^RA01 routine for details)
- ;
- ; RACASE 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)
- ;
- ; [.RAMISC] Reference to a local array containing miscellaneous
- ; exam parameters.
- ;
- ; See the ^RAMAG routine for additional important
- ; details regarding this parameter.
- ;
- ; RAMISC(
- ;
- ; "CMUSED") Internal value for the CONTRAST MEDIA USED field
- ; (10) of the EXAMINATIONS multiple (sub-file
- ; #70.03).
- ; Required: No
- ; Default: undefined
- ;
- ; "COMPLICAT") Internal values for the COMPLICATION (16)
- ; and COMPLICATION TEXT (16.5) fields of the
- ; sub-file #70.03.
- ; ^01: IEN in the COMPLICATION TYPES file (#78.1)
- ; ^02: Complication text
- ; Required: No
- ; Default: undefined
- ;
- ; "CONTMEDIA"
- ; Seq#) Internal value for the CONTRAST MEDIA field (.01)
- ; of the sub-file #70.3225.
- ; Required: No
- ; Default: undefined
- ;
- ; "CPTMODS",
- ; Seq#) Internal value for the CPT MODIFIERS field (.01)
- ; of the sub-file #70.3135: IEN in the CPT MODIFIER
- ; file (#81.3).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "FILMSIZE",
- ; Seq#) Internal values for the record of the FILM SIZE
- ; multiple (70) of the sub-file #70.03.
- ; ^01: IEN in the FILM SIZES file (#78.4)
- ; ^02: Amount (#films or cine ft)
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "FLAGS") Flags that control the execution (see the ^RAMAG
- ; routine for details). Supported flags: "F", "S".
- ; Required: No
- ; Default: undefined
- ;
- ; "PRIMCAM") Internal value for the PRIMARY CAMERA/EQUIP/RM
- ; field (18) of the sub-file #70.03: IEN in the
- ; CAMERA/EQUIP/RM file (#78.6).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "PRIMDXCODE") Internal value for the PRIMARY DIAGNOSTIC CODE
- ; field (13) of the sub-file #70.03: IEN in the
- ; DIAGNOSTIC CODES file (#78.3).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "PRIMINTRES") Internal value for the PRIMARY INTERPRETING
- ; RESIDENT field (12) of the sub-file #70.03: IEN in
- ; the NEW PERSON file (#200).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "PRIMINTSTF") Internal value for the PRIMARY INTERPRETING
- ; STAFF field (15) of the sub-file #70.03: IEN in
- ; the NEW PERSON file (#200).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "RAPROC",
- ; 1) Radiology procedure and modifiers
- ; ^01: Procedure IEN in file #71
- ; ^02: Optional procedure modifiers (IENs in
- ; ... the PROCEDURE MODIFIERS file (#71.2))
- ; ^nn:
- ; Required: No (if defined, replaces the existing
- ; value assigned by $$REGISTER^RAMAG03)
- ; Default: undefined
- ;
- ; NOTE: Only a single procedure is associated with
- ; a case. Therefore, only the first subnode
- ; of the "RAPROC" with a subscript greater
- ; than 0 is used.
- ;
- ; "RDPHARMS", INTERNAL VALUES FOR THE RECORDS OF THE
- ; i, 'RADIOPHARMACEUTICALS' MULTIPLE (100) OF THE
- ; 'NUC MED EXAM DATA' FILE (#70.2).
- ;
- ; "RDPH-ACDR") Internal value for the ACTIVITY DRAWN
- ; field (4).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "RDPH-DOSE") Internal value for the DOSE ADMINISTERED
- ; field (7).
- ; Required: Yes (if any other radiopharmaceutical
- ; parameters are provided)
- ; Default: undefined
- ;
- ; "RDPH-DRUG") Internal value for the RADIOPHARMACEUTICAL
- ; field (.01).
- ; Required: Yes (if any other radiopharmaceutical
- ; parameters are provided)
- ; Default: undefined
- ;
- ; "RDPH-DTADM") Internal value for the DATE/TIME DOSE
- ; ADMINISTERED field (8).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "RDPH-DTDRW") Internal value for the DATE/TIME DRAWN
- ; field (5).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "RDPH-FORM") Internal value for the FORM field (15).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "RDPH-LOTN") Internal value for the LOT NO field (13).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "RDPH-PWADM") Internal value for the PERSON WHO ADMINISTERED
- ; DOSE field (9).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "RDPH-PWMSD") Internal value for the PERSON WHO MEASURED DOSE
- ; field (6).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "RDPH-ROUTE") Internal value for the ROUTE OF ADMINISTRATION
- ; field (11).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "RDPH-SITE") Internal value for the SITE OF ADMINISTRATION
- ; field (12).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "RDPH-VOL") Internal value for the VOLUME field (14).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "TECH",
- ; Seq#) Internal value for the TECHNOLOGIST field (.01)
- ; of the subfile #70.12: IEN in the NEW PERSON
- ; file (#200).
- ; Required: Site and/or imaging type specific
- ; Default: undefined
- ;
- ; "TECHCOMM") Technologist comment
- ; Required: No
- ; Default: undefined
- ;
- ; "BEDSECT") If any of these optional parameters are defined,
- ; "EXAMCAT") their values replace the existing ones assigned
- ; "PRINCLIN") by the $$REGISTER^RAMAG03.
- ; "SERVICE")
- ; "WARD")
- ;
- ; Return values:
- ; <0 Error descriptor (see $$ERROR^RAERR)
- ; 0 Case has been marked as 'examined'
- ;
- EXAMINED(RAPARAMS,RACASE,RAMISC) ;
- N RACN ; Case number
- N RACNI ; IEN of the exam in the EXAMINATIONS multiple
- N RADFN ; IEN of the patient in the file #70
- N RADTE ; Date/time of the exam
- N RADTI ; Inverted date/time of the exam
- N RAIENS ; IENS of the exam record
- N RAIMGTYI ; Imaging type IEN (file #79.2)
- N RAMSPSDEFS ; Data for miscellaneous parameters validation
- N RANMDIEN ; IEN of the nuclear medicine data (file #70.2)
- N RAPROCIEN ; Radiology procedure IEN
- ;
- N RALOCK,RAMSG,RARC,TMP
- D:$G(RAPARAMS("DEBUG"))>1
- . D W^RAMAGU11("$$EXAMINED^RAMAG07","!!")
- . D VARS^RAMAGU11("RACASE")
- . D ZW^RAUTL22("RAMISC")
- ;
- ;--- Validate case identifiers
- S RARC=$$CHKREQ^RAUTL22("RACASE") Q:RARC<0 RARC
- S RARC=$$CHKEXMID^RAMAGU04(RACASE) Q:RARC<0 RARC
- S RADFN=$P(RACASE,U),RADTI=$P(RACASE,U,2),RACNI=$P(RACASE,U,3)
- S RAIENS=$$EXAMIENS^RAMAGU04(RACASE)
- ;
- ;--- Lock the exam
- K TMP S TMP(70.03,RAIENS)=""
- S RARC=$$LOCKFM^RALOCK(.TMP)
- Q:RARC $$LOCKERR^RAERR(RARC,"examination")
- M RALOCK=TMP
- ;
- D
- . ;--- Setup the error handler
- . N $ESTACK,$ETRAP D SETDEFEH^RAERR("RARC")
- . ;
- . ;--- Initialize variables
- . N EXMST,RACTION,RAFDA,RAFDAM,RAPRIEN,RATRKCMB
- . D LDMSPRMS^RAMAGU01(.RAMSPSDEFS)
- . S RACTION="E"
- . ;
- . ;--- Get the current exam status
- . S EXMST=$$EXMSTAT^RAMAGU05(RACASE)
- . I EXMST<0 S RARC=EXMST Q
- . ;--- Find the exam status that has 'E:Examined' value
- . ;--- in the VISTARAD CATEGORY field (9).
- . S RARC=$$GETEXMND^RAMAGU06(+EXMST) Q:RARC<0
- . I RARC'>0 D Q
- . . S RARC=$$ERROR^RAERR(-31,"RACASE='"_RACASE_"'","EXAMINED")
- . S EXMST=RARC ; New exam status
- . ;
- . ;--- Load exam properties and initialize key variables
- . S RARC=$$EXAMVARS^RAMAGU04(RAIENS) Q:RARC<0
- . ;
- . ;--- Validate general parameters
- . S RARC=$$VAL70^RAMAGU08(RAIENS,+EXMST,.RACTION,.RAMISC,.RAFDAM)
- . I RARC<0 S RARC=$$ERROR^RAERR(-11) Q
- . Q:RACTION="" ;--- Exam is at or past the requested status
- . ;
- . ;--- Nuclear medicine (including parameter validation)
- . S RARC=$$NUCMED^RAMAG06A(RACASE,RACTION,.RAMISC,.RAFDAM) Q:RARC<0
- . S RANMDIEN=RARC
- . ;
- . ;--- Pre-processing
- . S RARC=$$EDTPRE^RAMAG06A(RACTION,.RATRKCMB,.RAPRIEN) Q:RARC<0
- . K RAFDAM("RACNT"),RAFDAM("RAIENS")
- . ;
- . ;--- Update the exam record
- . K RAFDA,RAMSG M RAFDA(70.03)=RAFDAM(70.03) K RAFDAM(70.03)
- . I $D(RAFDA)>1 D Q:RARC<0
- . . D FILE^DIE(,"RAFDA","RAMSG")
- . . S:$G(DIERR) RARC=$$DBS^RAERR("RAMSG",-9,70.03,RAIENS)
- . ;
- . ;--- Update the nuclear medicine data
- . K RAFDA,RAMSG M RAFDA(70.21)=RAFDAM(70.21) K RAFDAM(70.21)
- . I $D(RAFDA)>1 D Q:RARC<0
- . . S RARC=$$UPDMULT^RAMAGU13(.RAFDA,RANMDIEN_",")
- . ;
- . ;--- Update procedure and modifiers
- . S TMP=$O(RAMISC("RAPROC",0))
- . I TMP>0 S TMP=$G(RAMISC("RAPROC",TMP)) D:TMP'="" Q:RARC<0
- . . S RARC=$$UPDEXMPR^RAMAGU04(RACASE,TMP)
- . ;
- . ;--- Update multiples of the exam record
- . I $D(RAFDAM)>1 D Q:RARC<0
- . . S RARC=$$UPDMULT^RAMAGU13(.RAFDAM,RAIENS)
- . ;
- . ;--- Create the stub report
- . S RARC=$$RPTSTUB^RAMAGU12(RACASE,RADTE,RACN) Q:RARC<0
- . ;
- . ;--- Exam status
- . S TMP=$$TRFLAGS^RAUTL22($G(RAMISC("FLAGS")),"F","F")
- . S RARC=$$UPDEXMST^RAMAGU05(RACASE,EXMST,TMP) Q:RARC<0
- . ;--- Activity log
- . S TMP=$G(RAMISC("TECHCOMM"))
- . S RARC=$$UPDEXMAL^RAMAGU05(RACASE,"C",TMP)
- . ;
- . ;--- Post-processing and notifications
- . S RARC=$$EDTPST^RAMAG06A(RACTION,RATRKCMB) Q:RARC<0
- ;
- ;=== Error handling and cleanup
- D UNLOCKFM^RALOCK(.RALOCK)
- Q $S(RARC<0:RARC,1:0)
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRAMAG07 11621 printed Mar 13, 2025@21:41:40 Page 2
- RAMAG07 ;HCIOFO/SG - ORDERS/EXAMS API (EXAMINED) ; 9/30/08 8:52am
- +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 ;
- +7 ; .RAPARAMS Reference to the API descriptor
- +8 ; (see the ^RA01 routine for details)
- +9 ;
- +10 ; RACASE Exam/case identifiers
- +11 ; ^01: IEN of the patient in the file #70 (RADFN)
- +12 ; ^02: IEN in the REGISTERED EXAMS multiple (RADTI)
- +13 ; ^03: IEN in the EXAMINATIONS multiple (RACNI)
- +14 ;
- +15 ; [.RAMISC] Reference to a local array containing miscellaneous
- +16 ; exam parameters.
- +17 ;
- +18 ; See the ^RAMAG routine for additional important
- +19 ; details regarding this parameter.
- +20 ;
- +21 ; RAMISC(
- +22 ;
- +23 ; "CMUSED") Internal value for the CONTRAST MEDIA USED field
- +24 ; (10) of the EXAMINATIONS multiple (sub-file
- +25 ; #70.03).
- +26 ; Required: No
- +27 ; Default: undefined
- +28 ;
- +29 ; "COMPLICAT") Internal values for the COMPLICATION (16)
- +30 ; and COMPLICATION TEXT (16.5) fields of the
- +31 ; sub-file #70.03.
- +32 ; ^01: IEN in the COMPLICATION TYPES file (#78.1)
- +33 ; ^02: Complication text
- +34 ; Required: No
- +35 ; Default: undefined
- +36 ;
- +37 ; "CONTMEDIA"
- +38 ; Seq#) Internal value for the CONTRAST MEDIA field (.01)
- +39 ; of the sub-file #70.3225.
- +40 ; Required: No
- +41 ; Default: undefined
- +42 ;
- +43 ; "CPTMODS",
- +44 ; Seq#) Internal value for the CPT MODIFIERS field (.01)
- +45 ; of the sub-file #70.3135: IEN in the CPT MODIFIER
- +46 ; file (#81.3).
- +47 ; Required: Site and/or imaging type specific
- +48 ; Default: undefined
- +49 ;
- +50 ; "FILMSIZE",
- +51 ; Seq#) Internal values for the record of the FILM SIZE
- +52 ; multiple (70) of the sub-file #70.03.
- +53 ; ^01: IEN in the FILM SIZES file (#78.4)
- +54 ; ^02: Amount (#films or cine ft)
- +55 ; Required: Site and/or imaging type specific
- +56 ; Default: undefined
- +57 ;
- +58 ; "FLAGS") Flags that control the execution (see the ^RAMAG
- +59 ; routine for details). Supported flags: "F", "S".
- +60 ; Required: No
- +61 ; Default: undefined
- +62 ;
- +63 ; "PRIMCAM") Internal value for the PRIMARY CAMERA/EQUIP/RM
- +64 ; field (18) of the sub-file #70.03: IEN in the
- +65 ; CAMERA/EQUIP/RM file (#78.6).
- +66 ; Required: Site and/or imaging type specific
- +67 ; Default: undefined
- +68 ;
- +69 ; "PRIMDXCODE") Internal value for the PRIMARY DIAGNOSTIC CODE
- +70 ; field (13) of the sub-file #70.03: IEN in the
- +71 ; DIAGNOSTIC CODES file (#78.3).
- +72 ; Required: Site and/or imaging type specific
- +73 ; Default: undefined
- +74 ;
- +75 ; "PRIMINTRES") Internal value for the PRIMARY INTERPRETING
- +76 ; RESIDENT field (12) of the sub-file #70.03: IEN in
- +77 ; the NEW PERSON file (#200).
- +78 ; Required: Site and/or imaging type specific
- +79 ; Default: undefined
- +80 ;
- +81 ; "PRIMINTSTF") Internal value for the PRIMARY INTERPRETING
- +82 ; STAFF field (15) of the sub-file #70.03: IEN in
- +83 ; the NEW PERSON file (#200).
- +84 ; Required: Site and/or imaging type specific
- +85 ; Default: undefined
- +86 ;
- +87 ; "RAPROC",
- +88 ; 1) Radiology procedure and modifiers
- +89 ; ^01: Procedure IEN in file #71
- +90 ; ^02: Optional procedure modifiers (IENs in
- +91 ; ... the PROCEDURE MODIFIERS file (#71.2))
- +92 ; ^nn:
- +93 ; Required: No (if defined, replaces the existing
- +94 ; value assigned by $$REGISTER^RAMAG03)
- +95 ; Default: undefined
- +96 ;
- +97 ; NOTE: Only a single procedure is associated with
- +98 ; a case. Therefore, only the first subnode
- +99 ; of the "RAPROC" with a subscript greater
- +100 ; than 0 is used.
- +101 ;
- +102 ; "RDPHARMS", INTERNAL VALUES FOR THE RECORDS OF THE
- +103 ; i, 'RADIOPHARMACEUTICALS' MULTIPLE (100) OF THE
- +104 ; 'NUC MED EXAM DATA' FILE (#70.2).
- +105 ;
- +106 ; "RDPH-ACDR") Internal value for the ACTIVITY DRAWN
- +107 ; field (4).
- +108 ; Required: Site and/or imaging type specific
- +109 ; Default: undefined
- +110 ;
- +111 ; "RDPH-DOSE") Internal value for the DOSE ADMINISTERED
- +112 ; field (7).
- +113 ; Required: Yes (if any other radiopharmaceutical
- +114 ; parameters are provided)
- +115 ; Default: undefined
- +116 ;
- +117 ; "RDPH-DRUG") Internal value for the RADIOPHARMACEUTICAL
- +118 ; field (.01).
- +119 ; Required: Yes (if any other radiopharmaceutical
- +120 ; parameters are provided)
- +121 ; Default: undefined
- +122 ;
- +123 ; "RDPH-DTADM") Internal value for the DATE/TIME DOSE
- +124 ; ADMINISTERED field (8).
- +125 ; Required: Site and/or imaging type specific
- +126 ; Default: undefined
- +127 ;
- +128 ; "RDPH-DTDRW") Internal value for the DATE/TIME DRAWN
- +129 ; field (5).
- +130 ; Required: Site and/or imaging type specific
- +131 ; Default: undefined
- +132 ;
- +133 ; "RDPH-FORM") Internal value for the FORM field (15).
- +134 ; Required: Site and/or imaging type specific
- +135 ; Default: undefined
- +136 ;
- +137 ; "RDPH-LOTN") Internal value for the LOT NO field (13).
- +138 ; Required: Site and/or imaging type specific
- +139 ; Default: undefined
- +140 ;
- +141 ; "RDPH-PWADM") Internal value for the PERSON WHO ADMINISTERED
- +142 ; DOSE field (9).
- +143 ; Required: Site and/or imaging type specific
- +144 ; Default: undefined
- +145 ;
- +146 ; "RDPH-PWMSD") Internal value for the PERSON WHO MEASURED DOSE
- +147 ; field (6).
- +148 ; Required: Site and/or imaging type specific
- +149 ; Default: undefined
- +150 ;
- +151 ; "RDPH-ROUTE") Internal value for the ROUTE OF ADMINISTRATION
- +152 ; field (11).
- +153 ; Required: Site and/or imaging type specific
- +154 ; Default: undefined
- +155 ;
- +156 ; "RDPH-SITE") Internal value for the SITE OF ADMINISTRATION
- +157 ; field (12).
- +158 ; Required: Site and/or imaging type specific
- +159 ; Default: undefined
- +160 ;
- +161 ; "RDPH-VOL") Internal value for the VOLUME field (14).
- +162 ; Required: Site and/or imaging type specific
- +163 ; Default: undefined
- +164 ;
- +165 ; "TECH",
- +166 ; Seq#) Internal value for the TECHNOLOGIST field (.01)
- +167 ; of the subfile #70.12: IEN in the NEW PERSON
- +168 ; file (#200).
- +169 ; Required: Site and/or imaging type specific
- +170 ; Default: undefined
- +171 ;
- +172 ; "TECHCOMM") Technologist comment
- +173 ; Required: No
- +174 ; Default: undefined
- +175 ;
- +176 ; "BEDSECT") If any of these optional parameters are defined,
- +177 ; "EXAMCAT") their values replace the existing ones assigned
- +178 ; "PRINCLIN") by the $$REGISTER^RAMAG03.
- +179 ; "SERVICE")
- +180 ; "WARD")
- +181 ;
- +182 ; Return values:
- +183 ; <0 Error descriptor (see $$ERROR^RAERR)
- +184 ; 0 Case has been marked as 'examined'
- +185 ;
- EXAMINED(RAPARAMS,RACASE,RAMISC) ;
- +1 ; Case number
- NEW RACN
- +2 ; IEN of the exam in the EXAMINATIONS multiple
- NEW RACNI
- +3 ; IEN of the patient in the file #70
- NEW RADFN
- +4 ; Date/time of the exam
- NEW RADTE
- +5 ; Inverted date/time of the exam
- NEW RADTI
- +6 ; IENS of the exam record
- NEW RAIENS
- +7 ; Imaging type IEN (file #79.2)
- NEW RAIMGTYI
- +8 ; Data for miscellaneous parameters validation
- NEW RAMSPSDEFS
- +9 ; IEN of the nuclear medicine data (file #70.2)
- NEW RANMDIEN
- +10 ; Radiology procedure IEN
- NEW RAPROCIEN
- +11 ;
- +12 NEW RALOCK,RAMSG,RARC,TMP
- +13 if $GET(RAPARAMS("DEBUG"))>1
- Begin DoDot:1
- +14 DO W^RAMAGU11("$$EXAMINED^RAMAG07","!!")
- +15 DO VARS^RAMAGU11("RACASE")
- +16 DO ZW^RAUTL22("RAMISC")
- End DoDot:1
- +17 ;
- +18 ;--- Validate case identifiers
- +19 SET RARC=$$CHKREQ^RAUTL22("RACASE")
- if RARC<0
- QUIT RARC
- +20 SET RARC=$$CHKEXMID^RAMAGU04(RACASE)
- if RARC<0
- QUIT RARC
- +21 SET RADFN=$PIECE(RACASE,U)
- SET RADTI=$PIECE(RACASE,U,2)
- SET RACNI=$PIECE(RACASE,U,3)
- +22 SET RAIENS=$$EXAMIENS^RAMAGU04(RACASE)
- +23 ;
- +24 ;--- Lock the exam
- +25 KILL TMP
- SET TMP(70.03,RAIENS)=""
- +26 SET RARC=$$LOCKFM^RALOCK(.TMP)
- +27 if RARC
- QUIT $$LOCKERR^RAERR(RARC,"examination")
- +28 MERGE RALOCK=TMP
- +29 ;
- +30 Begin DoDot:1
- +31 ;--- Setup the error handler
- +32 NEW $ESTACK,$ETRAP
- DO SETDEFEH^RAERR("RARC")
- +33 ;
- +34 ;--- Initialize variables
- +35 NEW EXMST,RACTION,RAFDA,RAFDAM,RAPRIEN,RATRKCMB
- +36 DO LDMSPRMS^RAMAGU01(.RAMSPSDEFS)
- +37 SET RACTION="E"
- +38 ;
- +39 ;--- Get the current exam status
- +40 SET EXMST=$$EXMSTAT^RAMAGU05(RACASE)
- +41 IF EXMST<0
- SET RARC=EXMST
- QUIT
- +42 ;--- Find the exam status that has 'E:Examined' value
- +43 ;--- in the VISTARAD CATEGORY field (9).
- +44 SET RARC=$$GETEXMND^RAMAGU06(+EXMST)
- if RARC<0
- QUIT
- +45 IF RARC'>0
- Begin DoDot:2
- +46 SET RARC=$$ERROR^RAERR(-31,"RACASE='"_RACASE_"'","EXAMINED")
- End DoDot:2
- QUIT
- +47 ; New exam status
- SET EXMST=RARC
- +48 ;
- +49 ;--- Load exam properties and initialize key variables
- +50 SET RARC=$$EXAMVARS^RAMAGU04(RAIENS)
- if RARC<0
- QUIT
- +51 ;
- +52 ;--- Validate general parameters
- +53 SET RARC=$$VAL70^RAMAGU08(RAIENS,+EXMST,.RACTION,.RAMISC,.RAFDAM)
- +54 IF RARC<0
- SET RARC=$$ERROR^RAERR(-11)
- QUIT
- +55 ;--- Exam is at or past the requested status
- if RACTION=""
- QUIT
- +56 ;
- +57 ;--- Nuclear medicine (including parameter validation)
- +58 SET RARC=$$NUCMED^RAMAG06A(RACASE,RACTION,.RAMISC,.RAFDAM)
- if RARC<0
- QUIT
- +59 SET RANMDIEN=RARC
- +60 ;
- +61 ;--- Pre-processing
- +62 SET RARC=$$EDTPRE^RAMAG06A(RACTION,.RATRKCMB,.RAPRIEN)
- if RARC<0
- QUIT
- +63 KILL RAFDAM("RACNT"),RAFDAM("RAIENS")
- +64 ;
- +65 ;--- Update the exam record
- +66 KILL RAFDA,RAMSG
- MERGE RAFDA(70.03)=RAFDAM(70.03)
- KILL RAFDAM(70.03)
- +67 IF $DATA(RAFDA)>1
- Begin DoDot:2
- +68 DO FILE^DIE(,"RAFDA","RAMSG")
- +69 if $GET(DIERR)
- SET RARC=$$DBS^RAERR("RAMSG",-9,70.03,RAIENS)
- End DoDot:2
- if RARC<0
- QUIT
- +70 ;
- +71 ;--- Update the nuclear medicine data
- +72 KILL RAFDA,RAMSG
- MERGE RAFDA(70.21)=RAFDAM(70.21)
- KILL RAFDAM(70.21)
- +73 IF $DATA(RAFDA)>1
- Begin DoDot:2
- +74 SET RARC=$$UPDMULT^RAMAGU13(.RAFDA,RANMDIEN_",")
- End DoDot:2
- if RARC<0
- QUIT
- +75 ;
- +76 ;--- Update procedure and modifiers
- +77 SET TMP=$ORDER(RAMISC("RAPROC",0))
- +78 IF TMP>0
- SET TMP=$GET(RAMISC("RAPROC",TMP))
- if TMP'=""
- Begin DoDot:2
- +79 SET RARC=$$UPDEXMPR^RAMAGU04(RACASE,TMP)
- End DoDot:2
- if RARC<0
- QUIT
- +80 ;
- +81 ;--- Update multiples of the exam record
- +82 IF $DATA(RAFDAM)>1
- Begin DoDot:2
- +83 SET RARC=$$UPDMULT^RAMAGU13(.RAFDAM,RAIENS)
- End DoDot:2
- if RARC<0
- QUIT
- +84 ;
- +85 ;--- Create the stub report
- +86 SET RARC=$$RPTSTUB^RAMAGU12(RACASE,RADTE,RACN)
- if RARC<0
- QUIT
- +87 ;
- +88 ;--- Exam status
- +89 SET TMP=$$TRFLAGS^RAUTL22($GET(RAMISC("FLAGS")),"F","F")
- +90 SET RARC=$$UPDEXMST^RAMAGU05(RACASE,EXMST,TMP)
- if RARC<0
- QUIT
- +91 ;--- Activity log
- +92 SET TMP=$GET(RAMISC("TECHCOMM"))
- +93 SET RARC=$$UPDEXMAL^RAMAGU05(RACASE,"C",TMP)
- +94 ;
- +95 ;--- Post-processing and notifications
- +96 SET RARC=$$EDTPST^RAMAG06A(RACTION,RATRKCMB)
- if RARC<0
- QUIT
- End DoDot:1
- +97 ;
- +98 ;=== Error handling and cleanup
- +99 DO UNLOCKFM^RALOCK(.RALOCK)
- +100 QUIT $SELECT(RARC<0:RARC,1:0)