- RAMAG02 ;HCIOFO/SG - ORDERS/EXAMS API (EXAM REQUEST) ; 4/8/08 3:28pm
- ;;5.0;Radiology/Nuclear Medicine;**90**;Mar 16, 1998;Build 20
- ;
- Q
- ;
- ;##### ORDERS/REQUESTS AN EXAM
- ;
- ; .RAPARAMS Reference to the API descriptor
- ; (see the ^RA01 routine for details).
- ;
- ; RADFN Patient IEN (DFN).
- ;
- ; RAMLC IEN of the imaging location (file #79.1).
- ;
- ; RAPROC Radiology procedure and modifiers
- ; ^01: Procedure IEN in file #71
- ; ^02: Optional procedure modifiers (IENs in
- ; ... the PROCEDURE MODIFIERS file (#71.2))
- ; ^nn:
- ;
- ; RADTE Desired date for the exam (FileMan). If time is
- ; provided, it is ignored. The date must be exact.
- ;
- ; RACAT Exam category: internal value for the CATEGORY
- ; OF EXAM field (4) of the RAD/NUC MED ORDERS
- ; file (#75.1).
- ;
- ; REQLOC IEN of the requesting location in the HOSPITAL
- ; LOCATION file (#44).
- ;
- ; For the inpatient exam category, location should
- ; be either an operating room or a ward.
- ;
- ; For the outpatient exam category, location should
- ; be either an operating room or a clinic.
- ;
- ; REQPHYS IEN of the requesting physician in the NEW PERSON
- ; file (#200).
- ;
- ; This user should be active and have the PROVIDER
- ; key.
- ;
- ; RAREASON Reason for study (see the REASON FOR STUDY
- ; field (1.1) of the file #75.1).
- ;
- ; [.RAMISC] Reference to a local array containing miscellaneous
- ; request parameters.
- ;
- ; See the ^RAMAG routine for additional important
- ; details regarding this parameter.
- ;
- ; RAMISC(
- ;
- ; "CLINHIST", Text for the CLINICAL HISTORY FOR EXAM field (400)
- ; Seq#) of the file #75.1.
- ; Required: No
- ; Default: undefined
- ;
- ; "ISOLPROC") Internal value for the ISOLATION PROCEDURES
- ; field (24) of the file #75.1.
- ; Required: Yes
- ; Default: "n" (NO)
- ;
- ; "PREGNANT") Internal value for the PREGNANT field (13)
- ; of the file #75.1.
- ; Required: Only for female patients
- ; Default: undefined for male patients,
- ; "u" for female patients.
- ;
- ; "PREOPDT") Internal date value (FileMan) for the PRE-OP
- ; SCHEDULED DATE/TIME field (12) of the file #75.1.
- ; If seconds are provided, they are ignored. The
- ; date must be exact.
- ; Required: No
- ; Default: undefined
- ;
- ; "REQNATURE") Internal value for the NATURE OF (NEW) ORDER
- ; ACTIVITY field (26) of the file #75.1.
- ; Required: Yes
- ; Default: "s" (SERVICE CORRECTION)
- ;
- ; "REQURG") Internal value for the REQUEST URGENCY field (6)
- ; of the file #75.1.
- ; Required: Yes
- ; Default: "9" (ROUTINE)
- ;
- ; "TRANSPMODE") Internal value for the MODE OF TRANSPORT
- ; field (19) of the file #75.1.
- ; Required: Yes
- ; Default: "w" (WHEEL CHAIR) if RACAT="I",
- ; "a" (AMBULATORY) otherwise
- ;
- ; Return values:
- ; <0 Error descriptor (see $$ERROR^RAERR)
- ; >0 IEN of the order in the file #75.1
- ;
- ORDER(RAPARAMS,RADFN,RAMLC,RAPROC,RADTE,RACAT,REQLOC,REQPHYS,RAREASON,RAMISC) ;
- N RAIMGTYI ; Imaging type IEN (file #79.2)
- N RAMDIV ; Radiology division IEN (file #79)
- ;
- N RAOIFN,RC,VA,VADM
- D:$G(RAPARAMS("DEBUG"))>1
- . D W^RAMAGU11("$$ORDER^RAMAG02","!!")
- . D VARS^RAMAGU11("RADFN,RAMLC,RAPROC")
- . D VARS^RAMAGU11("RADTE,RACAT,REQLOC,REQPHYS")
- . D VARS^RAMAGU11("RAREASON")
- . D ZW^RAUTL22("RAMISC")
- ;--- Validate parameters
- S RC=$$VALIDATE^RAMAG02A() Q:RC<0 RC
- ;
- ;--- Make sure that the patient is registered
- S RC=$$RAPTREG^RAMAGU04(RADFN) Q:RC<0 RC
- ;
- ;--- Request the exam
- S RAOIFN=$$ORD^RAMAG02A() Q:RAOIFN<0 RAOIFN
- ;
- ;--- Generate the HL7 message to create the OE/RR record
- D ZOERRHL7(RADFN,+RAPROC,RAOIFN,+REQLOC)
- ;
- ;--- Return IEN of the order
- Q RAOIFN
- ;
- ;+++++ GENERATES OE/RR HL7 MESSAGE
- ;
- ; RADFN Patient IEN (DFN)
- ; RAPIFN Radiology procedure IEN
- ; RAOIFN IEN of the order in file #75.1
- ; RALIFN Requesting location IEN in file #44
- ;
- ; NOTE: This is an internal procedure. Do not call it from
- ; outside of this routine.
- ;
- ZOERRHL7(RADFN,RAPIFN,RAOIFN,RALIFN) ;
- N DA,DE,DIC,DIDEL,DIE,DINUM,DLAYGO,DQ,DR,DTOUT,DUOUT,I,ORIFN,ORIT,ORL,ORPCL,ORPK,ORPURG,ORSTRT,ORSTS,ORTX,ORVP,RABLNK,RAMOD,RAORD0,RAPRCD,RASEX,X,Y
- ;--- Prepare "old style" parameters for an old
- ;--- version of the OE/RR (just in case)
- S RASEX=$P($G(VADM(5)),U) ; Patient's sex ("F" or "M")
- S RAORD0=^RAO(75.1,RAOIFN,0) ; 0-node of the order
- ;--- Generate the HL7 message to create the OE/RR record
- D SETORD^RAORDU
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRAMAG02 5356 printed Feb 19, 2025@00:03:02 Page 2
- RAMAG02 ;HCIOFO/SG - ORDERS/EXAMS API (EXAM REQUEST) ; 4/8/08 3:28pm
- +1 ;;5.0;Radiology/Nuclear Medicine;**90**;Mar 16, 1998;Build 20
- +2 ;
- +3 QUIT
- +4 ;
- +5 ;##### ORDERS/REQUESTS AN EXAM
- +6 ;
- +7 ; .RAPARAMS Reference to the API descriptor
- +8 ; (see the ^RA01 routine for details).
- +9 ;
- +10 ; RADFN Patient IEN (DFN).
- +11 ;
- +12 ; RAMLC IEN of the imaging location (file #79.1).
- +13 ;
- +14 ; RAPROC Radiology procedure and modifiers
- +15 ; ^01: Procedure IEN in file #71
- +16 ; ^02: Optional procedure modifiers (IENs in
- +17 ; ... the PROCEDURE MODIFIERS file (#71.2))
- +18 ; ^nn:
- +19 ;
- +20 ; RADTE Desired date for the exam (FileMan). If time is
- +21 ; provided, it is ignored. The date must be exact.
- +22 ;
- +23 ; RACAT Exam category: internal value for the CATEGORY
- +24 ; OF EXAM field (4) of the RAD/NUC MED ORDERS
- +25 ; file (#75.1).
- +26 ;
- +27 ; REQLOC IEN of the requesting location in the HOSPITAL
- +28 ; LOCATION file (#44).
- +29 ;
- +30 ; For the inpatient exam category, location should
- +31 ; be either an operating room or a ward.
- +32 ;
- +33 ; For the outpatient exam category, location should
- +34 ; be either an operating room or a clinic.
- +35 ;
- +36 ; REQPHYS IEN of the requesting physician in the NEW PERSON
- +37 ; file (#200).
- +38 ;
- +39 ; This user should be active and have the PROVIDER
- +40 ; key.
- +41 ;
- +42 ; RAREASON Reason for study (see the REASON FOR STUDY
- +43 ; field (1.1) of the file #75.1).
- +44 ;
- +45 ; [.RAMISC] Reference to a local array containing miscellaneous
- +46 ; request parameters.
- +47 ;
- +48 ; See the ^RAMAG routine for additional important
- +49 ; details regarding this parameter.
- +50 ;
- +51 ; RAMISC(
- +52 ;
- +53 ; "CLINHIST", Text for the CLINICAL HISTORY FOR EXAM field (400)
- +54 ; Seq#) of the file #75.1.
- +55 ; Required: No
- +56 ; Default: undefined
- +57 ;
- +58 ; "ISOLPROC") Internal value for the ISOLATION PROCEDURES
- +59 ; field (24) of the file #75.1.
- +60 ; Required: Yes
- +61 ; Default: "n" (NO)
- +62 ;
- +63 ; "PREGNANT") Internal value for the PREGNANT field (13)
- +64 ; of the file #75.1.
- +65 ; Required: Only for female patients
- +66 ; Default: undefined for male patients,
- +67 ; "u" for female patients.
- +68 ;
- +69 ; "PREOPDT") Internal date value (FileMan) for the PRE-OP
- +70 ; SCHEDULED DATE/TIME field (12) of the file #75.1.
- +71 ; If seconds are provided, they are ignored. The
- +72 ; date must be exact.
- +73 ; Required: No
- +74 ; Default: undefined
- +75 ;
- +76 ; "REQNATURE") Internal value for the NATURE OF (NEW) ORDER
- +77 ; ACTIVITY field (26) of the file #75.1.
- +78 ; Required: Yes
- +79 ; Default: "s" (SERVICE CORRECTION)
- +80 ;
- +81 ; "REQURG") Internal value for the REQUEST URGENCY field (6)
- +82 ; of the file #75.1.
- +83 ; Required: Yes
- +84 ; Default: "9" (ROUTINE)
- +85 ;
- +86 ; "TRANSPMODE") Internal value for the MODE OF TRANSPORT
- +87 ; field (19) of the file #75.1.
- +88 ; Required: Yes
- +89 ; Default: "w" (WHEEL CHAIR) if RACAT="I",
- +90 ; "a" (AMBULATORY) otherwise
- +91 ;
- +92 ; Return values:
- +93 ; <0 Error descriptor (see $$ERROR^RAERR)
- +94 ; >0 IEN of the order in the file #75.1
- +95 ;
- ORDER(RAPARAMS,RADFN,RAMLC,RAPROC,RADTE,RACAT,REQLOC,REQPHYS,RAREASON,RAMISC) ;
- +1 ; Imaging type IEN (file #79.2)
- NEW RAIMGTYI
- +2 ; Radiology division IEN (file #79)
- NEW RAMDIV
- +3 ;
- +4 NEW RAOIFN,RC,VA,VADM
- +5 if $GET(RAPARAMS("DEBUG"))>1
- Begin DoDot:1
- +6 DO W^RAMAGU11("$$ORDER^RAMAG02","!!")
- +7 DO VARS^RAMAGU11("RADFN,RAMLC,RAPROC")
- +8 DO VARS^RAMAGU11("RADTE,RACAT,REQLOC,REQPHYS")
- +9 DO VARS^RAMAGU11("RAREASON")
- +10 DO ZW^RAUTL22("RAMISC")
- End DoDot:1
- +11 ;--- Validate parameters
- +12 SET RC=$$VALIDATE^RAMAG02A()
- if RC<0
- QUIT RC
- +13 ;
- +14 ;--- Make sure that the patient is registered
- +15 SET RC=$$RAPTREG^RAMAGU04(RADFN)
- if RC<0
- QUIT RC
- +16 ;
- +17 ;--- Request the exam
- +18 SET RAOIFN=$$ORD^RAMAG02A()
- if RAOIFN<0
- QUIT RAOIFN
- +19 ;
- +20 ;--- Generate the HL7 message to create the OE/RR record
- +21 DO ZOERRHL7(RADFN,+RAPROC,RAOIFN,+REQLOC)
- +22 ;
- +23 ;--- Return IEN of the order
- +24 QUIT RAOIFN
- +25 ;
- +26 ;+++++ GENERATES OE/RR HL7 MESSAGE
- +27 ;
- +28 ; RADFN Patient IEN (DFN)
- +29 ; RAPIFN Radiology procedure IEN
- +30 ; RAOIFN IEN of the order in file #75.1
- +31 ; RALIFN Requesting location IEN in file #44
- +32 ;
- +33 ; NOTE: This is an internal procedure. Do not call it from
- +34 ; outside of this routine.
- +35 ;
- ZOERRHL7(RADFN,RAPIFN,RAOIFN,RALIFN) ;
- +1 NEW DA,DE,DIC,DIDEL,DIE,DINUM,DLAYGO,DQ,DR,DTOUT,DUOUT,I,ORIFN,ORIT,ORL,ORPCL,ORPK,ORPURG,ORSTRT,ORSTS,ORTX,ORVP,RABLNK,RAMOD,RAORD0,RAPRCD,RASEX,X,Y
- +2 ;--- Prepare "old style" parameters for an old
- +3 ;--- version of the OE/RR (just in case)
- +4 ; Patient's sex ("F" or "M")
- SET RASEX=$PIECE($GET(VADM(5)),U)
- +5 ; 0-node of the order
- SET RAORD0=^RAO(75.1,RAOIFN,0)
- +6 ;--- Generate the HL7 message to create the OE/RR record
- +7 DO SETORD^RAORDU
- +8 QUIT