MAGTP007 ;WOIFO/FG - TELEPATHOLOGY TAGS ; 25 Jul 2013 5:38 PM
;;3.0;IMAGING;**138**;Mar 19, 2002;Build 5380;Sep 03, 2013
;; 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 ;
;
;***** GET LAB INFO FOR A CASE AS SHOWN IN CPRS
; RPC: MAGTP GET CPRS REPORT
;
; .MAGRY Reference to a local variable where the results
; are returned to.
;
; LRSS AP Section
;
; YEAR Accession Year (Two figures)
;
; LRAN Accession Number
;
; Return Values
; =============
;
; If MAGRY(0) 1st '^'-piece is 0, then an error
; occurred during execution of the procedure: 0^0^ ERROR explanation
;
; Otherwise, the output array reproduces the structure
; of global ^TMP("ORDATA",$J), containing the CPRS report:
;
; MAGRY(0) Description
; ^01: 1
; ^02: Number of Lines
;
; MAGRY(i) Description
; ^01: Text from CPRS Report
;
; Notes
; =====
;
; The ^TMP("ORDATA",$J) global node is used by this procedure
;
GETREP(MAGRY,LRSS,YEAR,LRAN) ; RPC [MAGTP GET CPRS REPORT]
K MAGRY
N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
I $G(LRSS)=""!($G(YEAR)="")!($G(LRAN)="") D Q
. S MAGRY(0)="0^0^One or more input parameters are missing"
N INPUT
S INPUT=$$CONTEXT^MAGTP006(.MAGRY,LRSS,YEAR,LRAN) Q:'MAGRY(0)
N LRI,LRDFN,DFN,FIELD,LABEL,RPTID,ROOT,TEMP,CT,I,J
S LRI=$P(INPUT,",",2),LRDFN=$P(INPUT,",",3)
S DFN=$$GET1^DIQ(63,LRDFN_",",".03","I") ; Internal Patient ID
S FIELD=$S(LRSS="CY":9,LRSS="EM":2,1:8)
S LABEL=$$GET1^DID(63,FIELD,"","LABEL") ; Name (label) of AP Section
S RPTID="OR_"_LRSS_":"_LABEL_"~"_LRSS_";ORDV02A;0;1000"
D RPT^ORWRP(.ROOT,DFN,RPTID) ; Get all reports for a patient
M TEMP=@($P(ROOT,")")_","""_LRI_LRSS_""",""WP"")") ; Select only one case report
; Strip line numbers, set MAGRY
S (CT,I)=0
F S I=$O(TEMP(I)) Q:I="" D
. S J=""
. F S J=$O(TEMP(I,J)) Q:J="" D
. . S CT=CT+1
. . S MAGRY(CT)=$P(TEMP(I,J),U,2)
. . Q
. Q
S MAGRY(0)="1^"_CT
K ^TMP("ORDATA",$J),^TMP("LRC",$J) ; Clean up temporary globals
Q ;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGTP007 3129 printed Dec 13, 2024@02:08:41 Page 2
MAGTP007 ;WOIFO/FG - TELEPATHOLOGY TAGS ; 25 Jul 2013 5:38 PM
+1 ;;3.0;IMAGING;**138**;Mar 19, 2002;Build 5380;Sep 03, 2013
+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 ;***** GET LAB INFO FOR A CASE AS SHOWN IN CPRS
+20 ; RPC: MAGTP GET CPRS REPORT
+21 ;
+22 ; .MAGRY Reference to a local variable where the results
+23 ; are returned to.
+24 ;
+25 ; LRSS AP Section
+26 ;
+27 ; YEAR Accession Year (Two figures)
+28 ;
+29 ; LRAN Accession Number
+30 ;
+31 ; Return Values
+32 ; =============
+33 ;
+34 ; If MAGRY(0) 1st '^'-piece is 0, then an error
+35 ; occurred during execution of the procedure: 0^0^ ERROR explanation
+36 ;
+37 ; Otherwise, the output array reproduces the structure
+38 ; of global ^TMP("ORDATA",$J), containing the CPRS report:
+39 ;
+40 ; MAGRY(0) Description
+41 ; ^01: 1
+42 ; ^02: Number of Lines
+43 ;
+44 ; MAGRY(i) Description
+45 ; ^01: Text from CPRS Report
+46 ;
+47 ; Notes
+48 ; =====
+49 ;
+50 ; The ^TMP("ORDATA",$J) global node is used by this procedure
+51 ;
GETREP(MAGRY,LRSS,YEAR,LRAN) ; RPC [MAGTP GET CPRS REPORT]
+1 KILL MAGRY
+2 NEW $ETRAP,$ESTACK
SET $ETRAP="D ERRA^MAGGTERR"
+3 IF $GET(LRSS)=""!($GET(YEAR)="")!($GET(LRAN)="")
Begin DoDot:1
+4 SET MAGRY(0)="0^0^One or more input parameters are missing"
End DoDot:1
QUIT
+5 NEW INPUT
+6 SET INPUT=$$CONTEXT^MAGTP006(.MAGRY,LRSS,YEAR,LRAN)
if 'MAGRY(0)
QUIT
+7 NEW LRI,LRDFN,DFN,FIELD,LABEL,RPTID,ROOT,TEMP,CT,I,J
+8 SET LRI=$PIECE(INPUT,",",2)
SET LRDFN=$PIECE(INPUT,",",3)
+9 ; Internal Patient ID
SET DFN=$$GET1^DIQ(63,LRDFN_",",".03","I")
+10 SET FIELD=$SELECT(LRSS="CY":9,LRSS="EM":2,1:8)
+11 ; Name (label) of AP Section
SET LABEL=$$GET1^DID(63,FIELD,"","LABEL")
+12 SET RPTID="OR_"_LRSS_":"_LABEL_"~"_LRSS_";ORDV02A;0;1000"
+13 ; Get all reports for a patient
DO RPT^ORWRP(.ROOT,DFN,RPTID)
+14 ; Select only one case report
MERGE TEMP=@($PIECE(ROOT,")")_","""_LRI_LRSS_""",""WP"")")
+15 ; Strip line numbers, set MAGRY
+16 SET (CT,I)=0
+17 FOR
SET I=$ORDER(TEMP(I))
if I=""
QUIT
Begin DoDot:1
+18 SET J=""
+19 FOR
SET J=$ORDER(TEMP(I,J))
if J=""
QUIT
Begin DoDot:2
+20 SET CT=CT+1
+21 SET MAGRY(CT)=$PIECE(TEMP(I,J),U,2)
+22 QUIT
End DoDot:2
+23 QUIT
End DoDot:1
+24 SET MAGRY(0)="1^"_CT
+25 ; Clean up temporary globals
KILL ^TMP("ORDATA",$JOB),^TMP("LRC",$JOB)
+26 ;
QUIT