MAGVIM02 ;WOIFO/MAT,PMK - Utilities for RPC calls for DICOM file processing ; Feb 15, 2022@09:33:55
;;3.0;IMAGING;**118,138,305**;Mar 19, 2002;Build 3
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q
;
; +++++ Wrap calls to___ To retrieve____________
;
; OER^GMRCSLM1 ..... consult/procedure list (IA #2740).
; ORDERS^MAGDRPCB .. Radiology Exam List.
;
; RPC: MAGV GET PAT ORDERS
;
; INPUTS
; ======
;
; MAGVRY ........... Name of output array, passed by reference.
; PIDENT ........... EnterprisePatientID
; PIDTYPE .......... EnterprisePatientIDType
; PIDAUTHN ......... AssigningAuthority
; PIDCR8OR ......... CreatingEntity
; ORDRTYPE ......... OrderType
; ORDTSTRT ......... DateStart
; ORDTSTOP ......... DateEnd
;
; OUTPUTS
; =======
;
; Array of radiology or consult orders as f(OrderType). Descriptions of each
; appear before their respective tags, GETORCON & GETORAD.
;
; NOTES
; =====
;
GETORD(MAGVRY,PIDENT,PIDTYPE,PIDAUTHN,PIDCR8OR,ORDRTYPE,ORDTSTRT,ORDTSTOP) ;
;
;--- Initialize.
K RETURN
;
;--- Set output array separators per MAG*3.0*34 convention.
N SEPOUTP,SEPSTAT D ZRUSEPIN
;
;--- Validate inputs exist. External calls validate further.
N MAGVERR S MAGVERR=0
D
. I '$D(ORDRTYPE)!(ORDRTYPE'?3U) S MAGVERR="Undefined or mis-formatted Order Type." Q
. I "CON/RAD/LAB"'[ORDRTYPE S MAGVERR="Unsupported Order Type "_ORDRTYPE_"." Q
. I '$D(ORDTSTRT) S MAGVERR="Undefined Order Start Date." Q
. I '$D(ORDTSTOP) S MAGVERR="Undefined Order Stop Date." Q
. I ORDTSTRT'?8N S MAGVERR="Unexpected Order Start Date format." Q
. I ORDTSTOP'?8N S MAGVERR="Unexpected Order Stop Date format." Q
. Q
;
I MAGVERR'=0 S MAGVRY(0)="-1"_SEPSTAT_MAGVERR Q
;
;--- Convert incoming MMDDYYYY dates to FileMan format.
D DT^DILF(,ORDTSTRT,.ORDTSTRT)
D DT^DILF(,ORDTSTOP,.ORDTSTOP)
;
;--- Set defaults for incoming undefined.
S:PIDTYPE="" PIDTYPE="D"
S:PIDAUTHN="" PIDAUTHN="V"
S:PIDCR8OR="" PIDCR8OR="Unknown." ;???_Lookup_in_^MAGV(2005.62,_Field_#.03
;
;--- Filter consults by ORDER STATUS file (#100.01) IEN's.
N ORDRSTAT S ORDRSTAT="2,3,4,5,6,8,9,10,15,16" ; P305 PMK 8/19/2021
;
;--- Branch to processor.
D:ORDRTYPE["CON" GETORCON(PIDENT,"",ORDTSTRT,ORDTSTOP,ORDRSTAT,ORDRTYPE)
D:ORDRTYPE["RAD" GETORRAD(PIDENT,ORDRTYPE)
D:ORDRTYPE["LAB" GETORLAB(PIDENT,ORDTSTRT,ORDTSTOP)
M MAGVRY=RETURN K RETURN
Q
;
;+++++ Wrap call to OER^GMRCSLM1 (IA #2740).
;
;
GETORCON(MAGVPDFN,MAGVNULL,STARTDT,STOPDT,STATUS,OTYPE) ;
;
S MAGVNULL=""
;
;--- IA #2740.
D OER^GMRCSLM1(MAGVPDFN,MAGVNULL,STARTDT,STOPDT,STATUS,1)
;
;--- Re-format output w/o trailing "0" subscript.
N MAGVGBL S MAGVGBL=$NA(^TMP("GMRCR",$J,"CS",1,0))
;
;--- Process if none found, or error, & QUIT.
I $E($G(@MAGVGBL))="<" D Q
. ;
. I $G(@MAGVGBL)["PATIENT DOES NOT HAVE ANY" D
. . S RETURN(0)="0"_SEPSTAT_"0"
. . Q
. E S RETURN(0)="-1"_SEPSTAT_$G(@MAGVGBL)
. K @MAGVGBL
. Q
;
S MAGVGBL=$NA(^TMP("GMRCR",$J,"CS",0))
;
;--- Process expected output.
E D
. N LINETOT S LINETOT=$P($G(@MAGVGBL),U,4)
. S RETURN(0)="0"_SEPSTAT_LINETOT
. N CT F CT=1:1:LINETOT S MAGVGBL=$Q(@MAGVGBL) D
. . N DATA S DATA=$G(@MAGVGBL)
. . K MAGV
. . ;
. . ;--- Parse incoming data.
. . S MAGV("GMRCIEN")=$P(DATA,U,1)
. . S MAGV("REQSTDT")=$$FMTE^XLFDT($P(DATA,U,2),1)
. . S MAGV("ORDRSTAT")=$P(DATA,U,3)
. . S MAGV("SERVTO")=$P(DATA,U,4)
. . S MAGV("NMPROCON")=$P(DATA,U,5)
. . S MAGV("SERVFROM")=$P(DATA,U,6)
. . S MAGV("CONTITLE")=$P(DATA,U,7)
. . S MAGV("OERRDFN")=$P(DATA,U,8)
. . ;
. . ;--- record type for proper GUI icon
. . ;--- "C"=reg cons, "P"=reg proc, "M"=clin proc, "I"=IF cons, "R"=IF proc
. . S MAGV("CONTYPE")=$P(DATA,U,9)
. . ;
. . ;--- First line of Reason for Request (#123.01,.01).
. . S MAGV("ORDREASN")=$$GET1^DIQ(123.01,"1,"_MAGV("GMRCIEN")_",",.01)
. . ;
. . S MAGV("CLINPROC")=$$GET1^DIQ(123,MAGV("GMRCIEN"),1.01)
. . ;
. . ;--- Re-format output.
. . N LINEOUT S LINEOUT=$QS(MAGVGBL,4)
. . S $P(RETURN(LINEOUT),U,1)=OTYPE
. . S $P(RETURN(LINEOUT),U,2)=MAGVPDFN
. . S $P(RETURN(LINEOUT),U,3)=MAGV("REQSTDT")
. . S $P(RETURN(LINEOUT),U,4)=MAGV("ORDREASN")
. . S $P(RETURN(LINEOUT),U,5)=MAGV("SERVTO")
. . S $P(RETURN(LINEOUT),U,7)=$$GMRCACN^MAGDFCNV(MAGV("GMRCIEN"))
. . S $P(RETURN(LINEOUT),U,8)=MAGV("ORDRSTAT")
. . S $P(RETURN(LINEOUT),U,9)=MAGV("GMRCIEN")
. . S $P(RETURN(LINEOUT),U,10)=MAGV("CONTITLE")
. . S $P(RETURN(LINEOUT),U,11)=$G(MAGV("CLINPROC"))
. . S $P(RETURN(LINEOUT),U,12)=$G(MAGV("EXAMIEN"))
. . S $P(RETURN(LINEOUT),U,13)=$G(MAGV("RAOIEN"))
. . S $P(RETURN(LINEOUT),U,14)=$G(MAGV("EXAMIEN2"))
. . S $P(RETURN(LINEOUT),U,15)=$G(MAGV("ORDRPHYS"))
. . S $P(RETURN(LINEOUT),U,16)=$G(MAGV("ORDRLOCIEN"))
. . S $P(RETURN(LINEOUT),U,17)=$G(MAGV("PROCMOD"))
. . ;
. . S RETURN($QS(MAGVGBL,4))=$TR(RETURN(LINEOUT),U,SEPOUTP)
. . Q
. K MAGV
. Q
K @MAGVGBL
Q
;
;+++++ Wrap call to modified code from ORDERS^MAGDRPCB (RPC: MAG DICOM GET RAD ORDERS)
;
; NOTES
; =====
; Filters on REQUEST STATUS field (#5) of the RAD/NUC MED ORDERS file (#75.1)
; ,QUITting if status is DISCONTINUED, UNRELEASED or is null.
;
; Procedure Modifiers are multiple, concatenated as "Name1|1~Name2|2~...",
; and get re-formatted as "NAME1~NAME2~..."
;
; Possible errors:
;
; . S ARRAY(1)="-1,Invalid or missing patient identifier: """_DFN_"""."
; . S ARRAY(1)="-2,DFN_" undefined in the RAD/NUC MED PATIENT file (#70).
;
GETORRAD(PATDFN,OTYPE) ;
;
K RETURN
D ORDERS^MAGVIM07(.RETURN,PATDFN) ;MAGDRPCB(.RETURN,PATDFN)
;
;--- Process error output & QUIT.
I $P(RETURN(1),",")<0 D Q
. S $P(MAGTMP(0),SEPSTAT,2)=$P(RETURN(1),",",2)
. K RETURN S RETURN(0)="-1"_MAGTMP(0)
. K MAGTMP
. Q
;
;--- Re-subscript.
N CTIN S CTIN=0
F S CTIN=$O(RETURN(CTIN)) Q:CTIN="" S RETURN(CTIN-1)=RETURN(CTIN)
S CTIN=$O(RETURN(""),-1) K RETURN(CTIN)
;
N LINECUR S LINECUR=0
N LINETOT S LINETOT=RETURN(0)
N LINEOUT S LINEOUT=0
;
F LINECUR=1:1:LINETOT D
. ;
. K MAGV
. ;
. ;--- Array "^" pieces & re-write line.
. S MAGV("RAOIEN")=$P(RETURN(LINECUR),U,1)
. S MAGV("PROCIEN")=$P(RETURN(LINECUR),U,2)
. S MAGV("PROCMOD")=$P(RETURN(LINECUR),U,3)
. ;--- Re-format Procedure Modifiers
. I $G(MAGV("PROCMOD"))'="" N PCES S PCES="" D S MAGV("PROCMOD")=PCES
. . N CT F CT=1:1:$L(MAGV("PROCMOD"),"~") D
. . . N PCE S PCE=$P($P(MAGV("PROCMOD"),"~",CT),"|",1),$P(PCES,"~",CT)=PCE
. . . Q
. . Q
. . ;
. ; S MAGV("ORDRSTAT")=$P(RETURN(LINECUR),U,4)
. S MAGV("ORDERDT")=$$FMTE^XLFDT($P(RETURN(LINECUR),U,5),1)
. S MAGV("ORDREASN")=$P(RETURN(LINECUR),U,6)
. S MAGV("EXAMACN")=$P(RETURN(LINECUR),U,9)
. N SS
. F SS="EXAMADC","EXAMCASE","EXAMIEN","EXAMIEN2","EXAMSTAT","CREDMETH","UIDSTUDY" S MAGV(SS)=""
. D:MAGV("EXAMACN")'=""
. . ;
. . ;--- Resolve DAY-CASE, CASE from (Site-)Access'n Number [###-]MMDDYY-#####
. . N ACNL S ACNL=$L(MAGV("EXAMACN"),"-")
. . I ACNL>1 D
. . . S MAGV("EXAMADC")=$P(MAGV("EXAMACN"),"-",ACNL-1,ACNL)
. . E D
. . . S MAGV("EXAMADC")=MAGV("EXAMACN")
. . S MAGV("EXAMCASE")=$P(MAGV("EXAMACN"),"-",ACNL)
. . ;
. . ;--- Resolve examination IEN from DAY-CASE/ACN.
. . N ROOT S ROOT=$NA(^RADPT("ADC",MAGV("EXAMADC"),PATDFN)),ROOT=$Q(@ROOT)
. . Q:$QS(ROOT,1)'="ADC"
. . S MAGV("EXAMIEN")=$QS(ROOT,4)
. . S MAGV("EXAMIEN2")=$QS(ROOT,5)
. . ;
. . ;--- Resolve Examination Status and Credit Method.
. . N EXSTP
. . S EXSTP=$P($G(^RADPT(PATDFN,"DT",MAGV("EXAMIEN"),"P",MAGV("EXAMIEN2"),0)),U,3)
. . S MAGV("EXAMSTAT")=$$GET1^DIQ(72,EXSTP,.01,"E")
. . ;
. . N IENS S IENS=MAGV("EXAMIEN2")_","_MAGV("EXAMIEN")_","_PATDFN_","
. . S MAGV("CREDMETH")=$$GET1^DIQ(70.03,IENS,26,"E")
. . ;
. . ;--- Resolve Study Instance UID
. . S MAGV("UIDSTUDY")=$$GET1^DIQ(70.03,IENS,81)
. . Q
. ;--- IA #10103 (Supported).
. S MAGV("EXAMDATE")=$$FMTE^XLFDT($P(RETURN(LINECUR),U,10),1)
. ;--- IA #2056 (Supported).
. S MAGV("PROCNAME")=$$GET1^DIQ(71,MAGV("PROCIEN"),.01) ; procedure name
. S MAGV("ORDRLOCN")=$$GET1^DIQ(75.1,MAGV("RAOIEN"),22) D
. . ;
. . I MAGV("ORDRLOCN")="" S MAGV("ORDRLOCIEN")="" Q
. . S MAGV("ORDRLOCIEN")=$$GET1^DIQ(75.1,MAGV("RAOIEN"),22,"I")
. . Q
. S LINEOUT=LINEOUT+1
. ;
. S MAGV("ORDRPHYS")=$$GET1^DIQ(75.1,MAGV("RAOIEN"),14,"I") ; Requesting Phys.
. ;
. ;--- Re-order for output.
. S $P(RETURN(LINEOUT),SEPOUTP,1)=OTYPE
. S $P(RETURN(LINEOUT),SEPOUTP,2)=PATDFN
. S $P(RETURN(LINEOUT),SEPOUTP,3)=MAGV("ORDERDT")
. S $P(RETURN(LINEOUT),SEPOUTP,4)=MAGV("ORDREASN")
. S $P(RETURN(LINEOUT),SEPOUTP,5)=MAGV("ORDRLOCN")
. S $P(RETURN(LINEOUT),SEPOUTP,6)=MAGV("EXAMDATE")
. S $P(RETURN(LINEOUT),SEPOUTP,7)=MAGV("EXAMACN")
. S $P(RETURN(LINEOUT),SEPOUTP,8)=MAGV("EXAMSTAT")
. S $P(RETURN(LINEOUT),SEPOUTP,9)=MAGV("PROCIEN")
. S $P(RETURN(LINEOUT),SEPOUTP,10)=MAGV("PROCNAME")
. S $P(RETURN(LINEOUT),SEPOUTP,11)=MAGV("EXAMCASE")
. S $P(RETURN(LINEOUT),SEPOUTP,12)=MAGV("EXAMIEN")
. S $P(RETURN(LINEOUT),SEPOUTP,13)=MAGV("RAOIEN")
. S $P(RETURN(LINEOUT),SEPOUTP,14)=MAGV("EXAMIEN2")
. S $P(RETURN(LINEOUT),SEPOUTP,15)=MAGV("ORDRPHYS")
. S $P(RETURN(LINEOUT),SEPOUTP,16)=MAGV("ORDRLOCIEN")
. S $P(RETURN(LINEOUT),SEPOUTP,17)=MAGV("PROCMOD")
. S $P(RETURN(LINEOUT),SEPOUTP,18)=MAGV("CREDMETH")
. S $P(RETURN(LINEOUT),SEPOUTP,19)=MAGV("UIDSTUDY")
. Q
. ;
S RETURN(0)="0"_SEPSTAT_LINEOUT
Q
;
;
; NOTES
; =====
; The case in the LAB DATA file (#63) is defined by three fields:
; 1) LRDFN - this is the patient ien in the file. It is stored
; in the PATIENT file (#2) in file 63 (^DPT(DFN,"LR")=LRDFN
; 2) LRSS -- lab section ("CY", "EM", or "SP"), each has its own subfile
; See $$GETFILE^MAGT7MA(LRSS) for details
; 3) LRI --- the is the inverse date/time of the study. The cases are
; stored in reverse chronological order.
;
; There are only two return variables to define the case in the LAB DATA file.
; 1) EXAMIEN -- this is the subfile number for the corresponding lab section
; 2) EXAMIEN2 - this is the LRI value, the inverse date/time subsript
;
; It is assumed that LRDFN can be obtained from the following code:
; S LRDFN=$$GET1^DIQ(2,DFN,63,"I")
;
GETORLAB(PATDFN,ORDRSTRT,ORDRSTOP) ;
;
N ERROR
N FILE ; ------ LAB DATA file (#63) subfile numbers
N IORDRSTRT ;-- inverted order start date/time
N IORDRSTOP ;-- inverted order stop date/time
N LRDFN ; ----- ien for patient in LAB DATA file (#63)
N LRI ; ------- inverted date/time for LAB DATA file (#63)
N LRSS ; ------ lab section (EM, CY, and SP)
N LRSSIX ;----- index for lab section
N MAGVGBL ; --- pointer to temporary lab data
N A,B,L,L1 ;--- scratch variables from GETS^DIQ
;
N LINEOUT S LINEOUT=0
K RETURN
;
S IORDRSTRT=9999999.9999-ORDRSTRT
S IORDRSTOP=9999999.9999-ORDRSTOP-2 ; fudge for $O-ing
;
S LRDFN=$$GET1^DIQ(2,PATDFN,63)
I 'LRDFN S RETURN(0)=0_SEPSTAT_0 Q
;
S MAGVGBL=$NA(^TMP("MAG",$J,"MAGVIM02")) K @MAGVGBL
F LRSS="EM","CY","SP" D
. N IENS,LRILIST
. ; get FILE information
. S ERROR=$$GETFILE^MAGT7MA(LRSS)
. K @MAGVGBL
. D GETS^DIQ(63,LRDFN,FILE("FIELD")_"*","I",MAGVGBL,"ERROR")
. S IENS="" F S IENS=$O(@MAGVGBL@(FILE(0),IENS)) Q:IENS="" D
. . S LRILIST($P(IENS,",",1))=""
. . Q
. S LRI=IORDRSTOP ; file 63 is in reverse chronological order
. F S LRI=$O(LRILIST(LRI)) Q:LRI="" Q:(LRI)>IORDRSTRT D
. . D GETLCASE(MAGVGBL,.FILE,LRDFN,LRSS,LRI)
. . Q
. Q
S RETURN(0)="0"_SEPSTAT_LINEOUT
K @MAGVGBL
Q
;
GETLCASE(MAGVGBL,FILE,LRDFN,LRSS,LRI) ; get the data for one lab case
N ACNUMB,LABTEST,IENS,MAGV,X
S IENS=LRI_","_LRDFN_","
K @MAGVGBL
D GETS^DIQ(FILE(0),IENS,"**","I",MAGVGBL,"ERROR")
S X=$G(@MAGVGBL@(FILE(0),IENS,.01,"I")) ; date/time specimen taken
S MAGV("ORDERDT")=$$FMTE^XLFDT(X)
S MAGV("ORDREASN")="Perform pathology exam on specimen(s)."
S MAGV("ORDRLOCN")=@MAGVGBL@(FILE(0),IENS,.08,"I") ; patient location at order time
S X=$G(@MAGVGBL@(FILE(0),IENS,.1,"I")) ; date/time specimen received in lab
S MAGV("EXAMDATE")=$$FMTE^XLFDT(X)
S (ACNUMB,MAGV("EXAMACN"))=$G(@MAGVGBL@(FILE(0),IENS,.06,"I"))
S X=$G(@MAGVGBL@(FILE(0),IENS,.03,"I")) ; date report completed
S MAGV("EXAMSTAT")=$S(X:"Completed",1:"Active")
D TESTLKUP^MAGT7SB(MAGVGBL,.LABTEST)
S MAGV("PROCIEN")=LABTEST("ID")
S MAGV("PROCNAME")=LABTEST("TEXT")
S MAGV("EXAMCASE")=$P(ACNUMB," ",3)
S MAGV("EXAMIEN")=FILE(0)
S MAGV("RAOIEN")=""
S MAGV("EXAMIEN2")=LRI
S MAGV("ORDRPHYS")=$G(@MAGVGBL@(FILE(0),IENS,.07,"I")) ; surgeon/physician
S MAGV("ORDRLOCIEN")=""
S MAGV("PROCMOD")=""
;
S LINEOUT=LINEOUT+1
S $P(RETURN(LINEOUT),SEPOUTP,1)="LAB"
S $P(RETURN(LINEOUT),SEPOUTP,2)=PATDFN
S $P(RETURN(LINEOUT),SEPOUTP,3)=MAGV("ORDERDT")
S $P(RETURN(LINEOUT),SEPOUTP,4)=MAGV("ORDREASN")
S $P(RETURN(LINEOUT),SEPOUTP,5)=MAGV("ORDRLOCN")
S $P(RETURN(LINEOUT),SEPOUTP,6)=MAGV("EXAMDATE")
S $P(RETURN(LINEOUT),SEPOUTP,7)=MAGV("EXAMACN")
S $P(RETURN(LINEOUT),SEPOUTP,8)=MAGV("EXAMSTAT")
S $P(RETURN(LINEOUT),SEPOUTP,9)=MAGV("PROCIEN")
S $P(RETURN(LINEOUT),SEPOUTP,10)=MAGV("PROCNAME")
S $P(RETURN(LINEOUT),SEPOUTP,11)=MAGV("EXAMCASE")
S $P(RETURN(LINEOUT),SEPOUTP,12)=MAGV("EXAMIEN")
S $P(RETURN(LINEOUT),SEPOUTP,13)=MAGV("RAOIEN")
S $P(RETURN(LINEOUT),SEPOUTP,14)=MAGV("EXAMIEN2")
S $P(RETURN(LINEOUT),SEPOUTP,15)=MAGV("ORDRPHYS")
S $P(RETURN(LINEOUT),SEPOUTP,16)=MAGV("ORDRLOCIEN")
S $P(RETURN(LINEOUT),SEPOUTP,17)=MAGV("PROCMOD")
Q
;
;+++ Routine Utility: Initialize Separators
ZRUSEPIN ;
S SEPOUTP=$$OUTSEP^MAGVIM01
S SEPSTAT=$$STATSEP^MAGVIM01
Q
;
; MAGVIM02
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGVIM02 14808 printed Nov 22, 2024@17:19:55 Page 2
MAGVIM02 ;WOIFO/MAT,PMK - Utilities for RPC calls for DICOM file processing ; Feb 15, 2022@09:33:55
+1 ;;3.0;IMAGING;**118,138,305**;Mar 19, 2002;Build 3
+2 ;; Per VHA Directive 2004-038, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | Use of unreleased versions of this software requires the user |
+7 ;; | to execute a written test agreement with the VistA Imaging |
+8 ;; | Development Office of the Department of Veterans Affairs, |
+9 ;; | telephone (301) 734-0100. |
+10 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a medical device. As such, it may not be changed in any way. |
+12 ;; | Modifications to this software may result in an adulterated |
+13 ;; | medical device under 21CFR820, the use of which is considered |
+14 ;; | to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 QUIT
+18 ;
+19 ; +++++ Wrap calls to___ To retrieve____________
+20 ;
+21 ; OER^GMRCSLM1 ..... consult/procedure list (IA #2740).
+22 ; ORDERS^MAGDRPCB .. Radiology Exam List.
+23 ;
+24 ; RPC: MAGV GET PAT ORDERS
+25 ;
+26 ; INPUTS
+27 ; ======
+28 ;
+29 ; MAGVRY ........... Name of output array, passed by reference.
+30 ; PIDENT ........... EnterprisePatientID
+31 ; PIDTYPE .......... EnterprisePatientIDType
+32 ; PIDAUTHN ......... AssigningAuthority
+33 ; PIDCR8OR ......... CreatingEntity
+34 ; ORDRTYPE ......... OrderType
+35 ; ORDTSTRT ......... DateStart
+36 ; ORDTSTOP ......... DateEnd
+37 ;
+38 ; OUTPUTS
+39 ; =======
+40 ;
+41 ; Array of radiology or consult orders as f(OrderType). Descriptions of each
+42 ; appear before their respective tags, GETORCON & GETORAD.
+43 ;
+44 ; NOTES
+45 ; =====
+46 ;
GETORD(MAGVRY,PIDENT,PIDTYPE,PIDAUTHN,PIDCR8OR,ORDRTYPE,ORDTSTRT,ORDTSTOP) ;
+1 ;
+2 ;--- Initialize.
+3 KILL RETURN
+4 ;
+5 ;--- Set output array separators per MAG*3.0*34 convention.
+6 NEW SEPOUTP,SEPSTAT
DO ZRUSEPIN
+7 ;
+8 ;--- Validate inputs exist. External calls validate further.
+9 NEW MAGVERR
SET MAGVERR=0
+10 Begin DoDot:1
+11 IF '$DATA(ORDRTYPE)!(ORDRTYPE'?3U)
SET MAGVERR="Undefined or mis-formatted Order Type."
QUIT
+12 IF "CON/RAD/LAB"'[ORDRTYPE
SET MAGVERR="Unsupported Order Type "_ORDRTYPE_"."
QUIT
+13 IF '$DATA(ORDTSTRT)
SET MAGVERR="Undefined Order Start Date."
QUIT
+14 IF '$DATA(ORDTSTOP)
SET MAGVERR="Undefined Order Stop Date."
QUIT
+15 IF ORDTSTRT'?8N
SET MAGVERR="Unexpected Order Start Date format."
QUIT
+16 IF ORDTSTOP'?8N
SET MAGVERR="Unexpected Order Stop Date format."
QUIT
+17 QUIT
End DoDot:1
+18 ;
+19 IF MAGVERR'=0
SET MAGVRY(0)="-1"_SEPSTAT_MAGVERR
QUIT
+20 ;
+21 ;--- Convert incoming MMDDYYYY dates to FileMan format.
+22 DO DT^DILF(,ORDTSTRT,.ORDTSTRT)
+23 DO DT^DILF(,ORDTSTOP,.ORDTSTOP)
+24 ;
+25 ;--- Set defaults for incoming undefined.
+26 if PIDTYPE=""
SET PIDTYPE="D"
+27 if PIDAUTHN=""
SET PIDAUTHN="V"
+28 ;???_Lookup_in_^MAGV(2005.62,_Field_#.03
if PIDCR8OR=""
SET PIDCR8OR="Unknown."
+29 ;
+30 ;--- Filter consults by ORDER STATUS file (#100.01) IEN's.
+31 ; P305 PMK 8/19/2021
NEW ORDRSTAT
SET ORDRSTAT="2,3,4,5,6,8,9,10,15,16"
+32 ;
+33 ;--- Branch to processor.
+34 if ORDRTYPE["CON"
DO GETORCON(PIDENT,"",ORDTSTRT,ORDTSTOP,ORDRSTAT,ORDRTYPE)
+35 if ORDRTYPE["RAD"
DO GETORRAD(PIDENT,ORDRTYPE)
+36 if ORDRTYPE["LAB"
DO GETORLAB(PIDENT,ORDTSTRT,ORDTSTOP)
+37 MERGE MAGVRY=RETURN
KILL RETURN
+38 QUIT
+39 ;
+40 ;+++++ Wrap call to OER^GMRCSLM1 (IA #2740).
+41 ;
+42 ;
GETORCON(MAGVPDFN,MAGVNULL,STARTDT,STOPDT,STATUS,OTYPE) ;
+1 ;
+2 SET MAGVNULL=""
+3 ;
+4 ;--- IA #2740.
+5 DO OER^GMRCSLM1(MAGVPDFN,MAGVNULL,STARTDT,STOPDT,STATUS,1)
+6 ;
+7 ;--- Re-format output w/o trailing "0" subscript.
+8 NEW MAGVGBL
SET MAGVGBL=$NAME(^TMP("GMRCR",$JOB,"CS",1,0))
+9 ;
+10 ;--- Process if none found, or error, & QUIT.
+11 IF $EXTRACT($GET(@MAGVGBL))="<"
Begin DoDot:1
+12 ;
+13 IF $GET(@MAGVGBL)["PATIENT DOES NOT HAVE ANY"
Begin DoDot:2
+14 SET RETURN(0)="0"_SEPSTAT_"0"
+15 QUIT
End DoDot:2
+16 IF '$TEST
SET RETURN(0)="-1"_SEPSTAT_$GET(@MAGVGBL)
+17 KILL @MAGVGBL
+18 QUIT
End DoDot:1
QUIT
+19 ;
+20 SET MAGVGBL=$NAME(^TMP("GMRCR",$JOB,"CS",0))
+21 ;
+22 ;--- Process expected output.
+23 IF '$TEST
Begin DoDot:1
+24 NEW LINETOT
SET LINETOT=$PIECE($GET(@MAGVGBL),U,4)
+25 SET RETURN(0)="0"_SEPSTAT_LINETOT
+26 NEW CT
FOR CT=1:1:LINETOT
SET MAGVGBL=$QUERY(@MAGVGBL)
Begin DoDot:2
+27 NEW DATA
SET DATA=$GET(@MAGVGBL)
+28 KILL MAGV
+29 ;
+30 ;--- Parse incoming data.
+31 SET MAGV("GMRCIEN")=$PIECE(DATA,U,1)
+32 SET MAGV("REQSTDT")=$$FMTE^XLFDT($PIECE(DATA,U,2),1)
+33 SET MAGV("ORDRSTAT")=$PIECE(DATA,U,3)
+34 SET MAGV("SERVTO")=$PIECE(DATA,U,4)
+35 SET MAGV("NMPROCON")=$PIECE(DATA,U,5)
+36 SET MAGV("SERVFROM")=$PIECE(DATA,U,6)
+37 SET MAGV("CONTITLE")=$PIECE(DATA,U,7)
+38 SET MAGV("OERRDFN")=$PIECE(DATA,U,8)
+39 ;
+40 ;--- record type for proper GUI icon
+41 ;--- "C"=reg cons, "P"=reg proc, "M"=clin proc, "I"=IF cons, "R"=IF proc
+42 SET MAGV("CONTYPE")=$PIECE(DATA,U,9)
+43 ;
+44 ;--- First line of Reason for Request (#123.01,.01).
+45 SET MAGV("ORDREASN")=$$GET1^DIQ(123.01,"1,"_MAGV("GMRCIEN")_",",.01)
+46 ;
+47 SET MAGV("CLINPROC")=$$GET1^DIQ(123,MAGV("GMRCIEN"),1.01)
+48 ;
+49 ;--- Re-format output.
+50 NEW LINEOUT
SET LINEOUT=$QSUBSCRIPT(MAGVGBL,4)
+51 SET $PIECE(RETURN(LINEOUT),U,1)=OTYPE
+52 SET $PIECE(RETURN(LINEOUT),U,2)=MAGVPDFN
+53 SET $PIECE(RETURN(LINEOUT),U,3)=MAGV("REQSTDT")
+54 SET $PIECE(RETURN(LINEOUT),U,4)=MAGV("ORDREASN")
+55 SET $PIECE(RETURN(LINEOUT),U,5)=MAGV("SERVTO")
+56 SET $PIECE(RETURN(LINEOUT),U,7)=$$GMRCACN^MAGDFCNV(MAGV("GMRCIEN"))
+57 SET $PIECE(RETURN(LINEOUT),U,8)=MAGV("ORDRSTAT")
+58 SET $PIECE(RETURN(LINEOUT),U,9)=MAGV("GMRCIEN")
+59 SET $PIECE(RETURN(LINEOUT),U,10)=MAGV("CONTITLE")
+60 SET $PIECE(RETURN(LINEOUT),U,11)=$GET(MAGV("CLINPROC"))
+61 SET $PIECE(RETURN(LINEOUT),U,12)=$GET(MAGV("EXAMIEN"))
+62 SET $PIECE(RETURN(LINEOUT),U,13)=$GET(MAGV("RAOIEN"))
+63 SET $PIECE(RETURN(LINEOUT),U,14)=$GET(MAGV("EXAMIEN2"))
+64 SET $PIECE(RETURN(LINEOUT),U,15)=$GET(MAGV("ORDRPHYS"))
+65 SET $PIECE(RETURN(LINEOUT),U,16)=$GET(MAGV("ORDRLOCIEN"))
+66 SET $PIECE(RETURN(LINEOUT),U,17)=$GET(MAGV("PROCMOD"))
+67 ;
+68 SET RETURN($QSUBSCRIPT(MAGVGBL,4))=$TRANSLATE(RETURN(LINEOUT),U,SEPOUTP)
+69 QUIT
End DoDot:2
+70 KILL MAGV
+71 QUIT
End DoDot:1
+72 KILL @MAGVGBL
+73 QUIT
+74 ;
+75 ;+++++ Wrap call to modified code from ORDERS^MAGDRPCB (RPC: MAG DICOM GET RAD ORDERS)
+76 ;
+77 ; NOTES
+78 ; =====
+79 ; Filters on REQUEST STATUS field (#5) of the RAD/NUC MED ORDERS file (#75.1)
+80 ; ,QUITting if status is DISCONTINUED, UNRELEASED or is null.
+81 ;
+82 ; Procedure Modifiers are multiple, concatenated as "Name1|1~Name2|2~...",
+83 ; and get re-formatted as "NAME1~NAME2~..."
+84 ;
+85 ; Possible errors:
+86 ;
+87 ; . S ARRAY(1)="-1,Invalid or missing patient identifier: """_DFN_"""."
+88 ; . S ARRAY(1)="-2,DFN_" undefined in the RAD/NUC MED PATIENT file (#70).
+89 ;
GETORRAD(PATDFN,OTYPE) ;
+1 ;
+2 KILL RETURN
+3 ;MAGDRPCB(.RETURN,PATDFN)
DO ORDERS^MAGVIM07(.RETURN,PATDFN)
+4 ;
+5 ;--- Process error output & QUIT.
+6 IF $PIECE(RETURN(1),",")<0
Begin DoDot:1
+7 SET $PIECE(MAGTMP(0),SEPSTAT,2)=$PIECE(RETURN(1),",",2)
+8 KILL RETURN
SET RETURN(0)="-1"_MAGTMP(0)
+9 KILL MAGTMP
+10 QUIT
End DoDot:1
QUIT
+11 ;
+12 ;--- Re-subscript.
+13 NEW CTIN
SET CTIN=0
+14 FOR
SET CTIN=$ORDER(RETURN(CTIN))
if CTIN=""
QUIT
SET RETURN(CTIN-1)=RETURN(CTIN)
+15 SET CTIN=$ORDER(RETURN(""),-1)
KILL RETURN(CTIN)
+16 ;
+17 NEW LINECUR
SET LINECUR=0
+18 NEW LINETOT
SET LINETOT=RETURN(0)
+19 NEW LINEOUT
SET LINEOUT=0
+20 ;
+21 FOR LINECUR=1:1:LINETOT
Begin DoDot:1
+22 ;
+23 KILL MAGV
+24 ;
+25 ;--- Array "^" pieces & re-write line.
+26 SET MAGV("RAOIEN")=$PIECE(RETURN(LINECUR),U,1)
+27 SET MAGV("PROCIEN")=$PIECE(RETURN(LINECUR),U,2)
+28 SET MAGV("PROCMOD")=$PIECE(RETURN(LINECUR),U,3)
+29 ;--- Re-format Procedure Modifiers
+30 IF $GET(MAGV("PROCMOD"))'=""
NEW PCES
SET PCES=""
Begin DoDot:2
+31 NEW CT
FOR CT=1:1:$LENGTH(MAGV("PROCMOD"),"~")
Begin DoDot:3
+32 NEW PCE
SET PCE=$PIECE($PIECE(MAGV("PROCMOD"),"~",CT),"|",1)
SET $PIECE(PCES,"~",CT)=PCE
+33 QUIT
End DoDot:3
+34 QUIT
+35 ;
End DoDot:2
SET MAGV("PROCMOD")=PCES
+36 ; S MAGV("ORDRSTAT")=$P(RETURN(LINECUR),U,4)
+37 SET MAGV("ORDERDT")=$$FMTE^XLFDT($PIECE(RETURN(LINECUR),U,5),1)
+38 SET MAGV("ORDREASN")=$PIECE(RETURN(LINECUR),U,6)
+39 SET MAGV("EXAMACN")=$PIECE(RETURN(LINECUR),U,9)
+40 NEW SS
+41 FOR SS="EXAMADC","EXAMCASE","EXAMIEN","EXAMIEN2","EXAMSTAT","CREDMETH","UIDSTUDY"
SET MAGV(SS)=""
+42 if MAGV("EXAMACN")'=""
Begin DoDot:2
+43 ;
+44 ;--- Resolve DAY-CASE, CASE from (Site-)Access'n Number [###-]MMDDYY-#####
+45 NEW ACNL
SET ACNL=$LENGTH(MAGV("EXAMACN"),"-")
+46 IF ACNL>1
Begin DoDot:3
+47 SET MAGV("EXAMADC")=$PIECE(MAGV("EXAMACN"),"-",ACNL-1,ACNL)
End DoDot:3
+48 IF '$TEST
Begin DoDot:3
+49 SET MAGV("EXAMADC")=MAGV("EXAMACN")
End DoDot:3
+50 SET MAGV("EXAMCASE")=$PIECE(MAGV("EXAMACN"),"-",ACNL)
+51 ;
+52 ;--- Resolve examination IEN from DAY-CASE/ACN.
+53 NEW ROOT
SET ROOT=$NAME(^RADPT("ADC",MAGV("EXAMADC"),PATDFN))
SET ROOT=$QUERY(@ROOT)
+54 if $QSUBSCRIPT(ROOT,1)'="ADC"
QUIT
+55 SET MAGV("EXAMIEN")=$QSUBSCRIPT(ROOT,4)
+56 SET MAGV("EXAMIEN2")=$QSUBSCRIPT(ROOT,5)
+57 ;
+58 ;--- Resolve Examination Status and Credit Method.
+59 NEW EXSTP
+60 SET EXSTP=$PIECE($GET(^RADPT(PATDFN,"DT",MAGV("EXAMIEN"),"P",MAGV("EXAMIEN2"),0)),U,3)
+61 SET MAGV("EXAMSTAT")=$$GET1^DIQ(72,EXSTP,.01,"E")
+62 ;
+63 NEW IENS
SET IENS=MAGV("EXAMIEN2")_","_MAGV("EXAMIEN")_","_PATDFN_","
+64 SET MAGV("CREDMETH")=$$GET1^DIQ(70.03,IENS,26,"E")
+65 ;
+66 ;--- Resolve Study Instance UID
+67 SET MAGV("UIDSTUDY")=$$GET1^DIQ(70.03,IENS,81)
+68 QUIT
End DoDot:2
+69 ;--- IA #10103 (Supported).
+70 SET MAGV("EXAMDATE")=$$FMTE^XLFDT($PIECE(RETURN(LINECUR),U,10),1)
+71 ;--- IA #2056 (Supported).
+72 ; procedure name
SET MAGV("PROCNAME")=$$GET1^DIQ(71,MAGV("PROCIEN"),.01)
+73 SET MAGV("ORDRLOCN")=$$GET1^DIQ(75.1,MAGV("RAOIEN"),22)
Begin DoDot:2
+74 ;
+75 IF MAGV("ORDRLOCN")=""
SET MAGV("ORDRLOCIEN")=""
QUIT
+76 SET MAGV("ORDRLOCIEN")=$$GET1^DIQ(75.1,MAGV("RAOIEN"),22,"I")
+77 QUIT
End DoDot:2
+78 SET LINEOUT=LINEOUT+1
+79 ;
+80 ; Requesting Phys.
SET MAGV("ORDRPHYS")=$$GET1^DIQ(75.1,MAGV("RAOIEN"),14,"I")
+81 ;
+82 ;--- Re-order for output.
+83 SET $PIECE(RETURN(LINEOUT),SEPOUTP,1)=OTYPE
+84 SET $PIECE(RETURN(LINEOUT),SEPOUTP,2)=PATDFN
+85 SET $PIECE(RETURN(LINEOUT),SEPOUTP,3)=MAGV("ORDERDT")
+86 SET $PIECE(RETURN(LINEOUT),SEPOUTP,4)=MAGV("ORDREASN")
+87 SET $PIECE(RETURN(LINEOUT),SEPOUTP,5)=MAGV("ORDRLOCN")
+88 SET $PIECE(RETURN(LINEOUT),SEPOUTP,6)=MAGV("EXAMDATE")
+89 SET $PIECE(RETURN(LINEOUT),SEPOUTP,7)=MAGV("EXAMACN")
+90 SET $PIECE(RETURN(LINEOUT),SEPOUTP,8)=MAGV("EXAMSTAT")
+91 SET $PIECE(RETURN(LINEOUT),SEPOUTP,9)=MAGV("PROCIEN")
+92 SET $PIECE(RETURN(LINEOUT),SEPOUTP,10)=MAGV("PROCNAME")
+93 SET $PIECE(RETURN(LINEOUT),SEPOUTP,11)=MAGV("EXAMCASE")
+94 SET $PIECE(RETURN(LINEOUT),SEPOUTP,12)=MAGV("EXAMIEN")
+95 SET $PIECE(RETURN(LINEOUT),SEPOUTP,13)=MAGV("RAOIEN")
+96 SET $PIECE(RETURN(LINEOUT),SEPOUTP,14)=MAGV("EXAMIEN2")
+97 SET $PIECE(RETURN(LINEOUT),SEPOUTP,15)=MAGV("ORDRPHYS")
+98 SET $PIECE(RETURN(LINEOUT),SEPOUTP,16)=MAGV("ORDRLOCIEN")
+99 SET $PIECE(RETURN(LINEOUT),SEPOUTP,17)=MAGV("PROCMOD")
+100 SET $PIECE(RETURN(LINEOUT),SEPOUTP,18)=MAGV("CREDMETH")
+101 SET $PIECE(RETURN(LINEOUT),SEPOUTP,19)=MAGV("UIDSTUDY")
+102 QUIT
+103 ;
End DoDot:1
+104 SET RETURN(0)="0"_SEPSTAT_LINEOUT
+105 QUIT
+106 ;
+107 ;
+108 ; NOTES
+109 ; =====
+110 ; The case in the LAB DATA file (#63) is defined by three fields:
+111 ; 1) LRDFN - this is the patient ien in the file. It is stored
+112 ; in the PATIENT file (#2) in file 63 (^DPT(DFN,"LR")=LRDFN
+113 ; 2) LRSS -- lab section ("CY", "EM", or "SP"), each has its own subfile
+114 ; See $$GETFILE^MAGT7MA(LRSS) for details
+115 ; 3) LRI --- the is the inverse date/time of the study. The cases are
+116 ; stored in reverse chronological order.
+117 ;
+118 ; There are only two return variables to define the case in the LAB DATA file.
+119 ; 1) EXAMIEN -- this is the subfile number for the corresponding lab section
+120 ; 2) EXAMIEN2 - this is the LRI value, the inverse date/time subsript
+121 ;
+122 ; It is assumed that LRDFN can be obtained from the following code:
+123 ; S LRDFN=$$GET1^DIQ(2,DFN,63,"I")
+124 ;
GETORLAB(PATDFN,ORDRSTRT,ORDRSTOP) ;
+1 ;
+2 NEW ERROR
+3 ; ------ LAB DATA file (#63) subfile numbers
NEW FILE
+4 ;-- inverted order start date/time
NEW IORDRSTRT
+5 ;-- inverted order stop date/time
NEW IORDRSTOP
+6 ; ----- ien for patient in LAB DATA file (#63)
NEW LRDFN
+7 ; ------- inverted date/time for LAB DATA file (#63)
NEW LRI
+8 ; ------ lab section (EM, CY, and SP)
NEW LRSS
+9 ;----- index for lab section
NEW LRSSIX
+10 ; --- pointer to temporary lab data
NEW MAGVGBL
+11 ;--- scratch variables from GETS^DIQ
NEW A,B,L,L1
+12 ;
+13 NEW LINEOUT
SET LINEOUT=0
+14 KILL RETURN
+15 ;
+16 SET IORDRSTRT=9999999.9999-ORDRSTRT
+17 ; fudge for $O-ing
SET IORDRSTOP=9999999.9999-ORDRSTOP-2
+18 ;
+19 SET LRDFN=$$GET1^DIQ(2,PATDFN,63)
+20 IF 'LRDFN
SET RETURN(0)=0_SEPSTAT_0
QUIT
+21 ;
+22 SET MAGVGBL=$NAME(^TMP("MAG",$JOB,"MAGVIM02"))
KILL @MAGVGBL
+23 FOR LRSS="EM","CY","SP"
Begin DoDot:1
+24 NEW IENS,LRILIST
+25 ; get FILE information
+26 SET ERROR=$$GETFILE^MAGT7MA(LRSS)
+27 KILL @MAGVGBL
+28 DO GETS^DIQ(63,LRDFN,FILE("FIELD")_"*","I",MAGVGBL,"ERROR")
+29 SET IENS=""
FOR
SET IENS=$ORDER(@MAGVGBL@(FILE(0),IENS))
if IENS=""
QUIT
Begin DoDot:2
+30 SET LRILIST($PIECE(IENS,",",1))=""
+31 QUIT
End DoDot:2
+32 ; file 63 is in reverse chronological order
SET LRI=IORDRSTOP
+33 FOR
SET LRI=$ORDER(LRILIST(LRI))
if LRI=""
QUIT
if (LRI)>IORDRSTRT
QUIT
Begin DoDot:2
+34 DO GETLCASE(MAGVGBL,.FILE,LRDFN,LRSS,LRI)
+35 QUIT
End DoDot:2
+36 QUIT
End DoDot:1
+37 SET RETURN(0)="0"_SEPSTAT_LINEOUT
+38 KILL @MAGVGBL
+39 QUIT
+40 ;
GETLCASE(MAGVGBL,FILE,LRDFN,LRSS,LRI) ; get the data for one lab case
+1 NEW ACNUMB,LABTEST,IENS,MAGV,X
+2 SET IENS=LRI_","_LRDFN_","
+3 KILL @MAGVGBL
+4 DO GETS^DIQ(FILE(0),IENS,"**","I",MAGVGBL,"ERROR")
+5 ; date/time specimen taken
SET X=$GET(@MAGVGBL@(FILE(0),IENS,.01,"I"))
+6 SET MAGV("ORDERDT")=$$FMTE^XLFDT(X)
+7 SET MAGV("ORDREASN")="Perform pathology exam on specimen(s)."
+8 ; patient location at order time
SET MAGV("ORDRLOCN")=@MAGVGBL@(FILE(0),IENS,.08,"I")
+9 ; date/time specimen received in lab
SET X=$GET(@MAGVGBL@(FILE(0),IENS,.1,"I"))
+10 SET MAGV("EXAMDATE")=$$FMTE^XLFDT(X)
+11 SET (ACNUMB,MAGV("EXAMACN"))=$GET(@MAGVGBL@(FILE(0),IENS,.06,"I"))
+12 ; date report completed
SET X=$GET(@MAGVGBL@(FILE(0),IENS,.03,"I"))
+13 SET MAGV("EXAMSTAT")=$SELECT(X:"Completed",1:"Active")
+14 DO TESTLKUP^MAGT7SB(MAGVGBL,.LABTEST)
+15 SET MAGV("PROCIEN")=LABTEST("ID")
+16 SET MAGV("PROCNAME")=LABTEST("TEXT")
+17 SET MAGV("EXAMCASE")=$PIECE(ACNUMB," ",3)
+18 SET MAGV("EXAMIEN")=FILE(0)
+19 SET MAGV("RAOIEN")=""
+20 SET MAGV("EXAMIEN2")=LRI
+21 ; surgeon/physician
SET MAGV("ORDRPHYS")=$GET(@MAGVGBL@(FILE(0),IENS,.07,"I"))
+22 SET MAGV("ORDRLOCIEN")=""
+23 SET MAGV("PROCMOD")=""
+24 ;
+25 SET LINEOUT=LINEOUT+1
+26 SET $PIECE(RETURN(LINEOUT),SEPOUTP,1)="LAB"
+27 SET $PIECE(RETURN(LINEOUT),SEPOUTP,2)=PATDFN
+28 SET $PIECE(RETURN(LINEOUT),SEPOUTP,3)=MAGV("ORDERDT")
+29 SET $PIECE(RETURN(LINEOUT),SEPOUTP,4)=MAGV("ORDREASN")
+30 SET $PIECE(RETURN(LINEOUT),SEPOUTP,5)=MAGV("ORDRLOCN")
+31 SET $PIECE(RETURN(LINEOUT),SEPOUTP,6)=MAGV("EXAMDATE")
+32 SET $PIECE(RETURN(LINEOUT),SEPOUTP,7)=MAGV("EXAMACN")
+33 SET $PIECE(RETURN(LINEOUT),SEPOUTP,8)=MAGV("EXAMSTAT")
+34 SET $PIECE(RETURN(LINEOUT),SEPOUTP,9)=MAGV("PROCIEN")
+35 SET $PIECE(RETURN(LINEOUT),SEPOUTP,10)=MAGV("PROCNAME")
+36 SET $PIECE(RETURN(LINEOUT),SEPOUTP,11)=MAGV("EXAMCASE")
+37 SET $PIECE(RETURN(LINEOUT),SEPOUTP,12)=MAGV("EXAMIEN")
+38 SET $PIECE(RETURN(LINEOUT),SEPOUTP,13)=MAGV("RAOIEN")
+39 SET $PIECE(RETURN(LINEOUT),SEPOUTP,14)=MAGV("EXAMIEN2")
+40 SET $PIECE(RETURN(LINEOUT),SEPOUTP,15)=MAGV("ORDRPHYS")
+41 SET $PIECE(RETURN(LINEOUT),SEPOUTP,16)=MAGV("ORDRLOCIEN")
+42 SET $PIECE(RETURN(LINEOUT),SEPOUTP,17)=MAGV("PROCMOD")
+43 QUIT
+44 ;
+45 ;+++ Routine Utility: Initialize Separators
ZRUSEPIN ;
+1 SET SEPOUTP=$$OUTSEP^MAGVIM01
+2 SET SEPSTAT=$$STATSEP^MAGVIM01
+3 QUIT
+4 ;
+5 ; MAGVIM02