MAGGSCP ;WOIFO/GEK - Imaging RPC Broker call for CP.
;;3.0;IMAGING;**7,8**;Sep 15, 2004
;; +---------------------------------------------------------------+
;; | 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
LIST(MAGRY,MAGDFN,PROC) ;RPC [MAG4 CP GET REQUESTS]
; Get list of CP Requests
; PROC = IEN FROM FILE 702.01 IF JUST ONE PROCEURE DESIRED, DEFAULTS TO ALL
;
; The compressed listing, 4 columns
; Not restructuring the output yet
; "Date^Spec^Desc^Img Count^procedure info"
N MAGX,I,ACT,NODE,TMP
K ^TMP($J,"MAGCP")
K ^TMP($J,"MAGCP1")
S PROC=$G(PROC)
;S MAGRY=$NA(^TMP($J,"MAGCP1"))
D CPLIST^GMRCCP(MAGDFN,PROC,$NA(^TMP($J,"MAGCP")))
I '$D(^TMP($J,"MAGCP")) S MAGRY(0)="0^There are no Clinical Procedure Requests for Patient : "_$$GET1^DIQ(2,MAGDFN,.01) Q
S ACT=1
S I="" F S I=$O(^TMP($J,"MAGCP",I)) Q:I="" S NODE=^(I) D
. ; screening out x - cancelled and 'dc' - discontinued
. I ",x,dc,"[(","_$P(NODE,U,4)_",") Q
. S X=$$INF(NODE)
. S ACT=ACT+1
. S MAGRY(ACT)=X ;S @MAGRY@(ACT)=X
S MAGRY(1)="Date~S1^CP DEF nam^urgency^status" ;^cons #^CP DEF ien
S MAGRY(0)=ACT-1_"^"_ACT-1_" Clinical Procedure Requests."
Q
INF(NODE) ;
N RY
; FOR NOW JUST SEND THE SAME DATA (TESTING)
S RY=$P(NODE,U,1,4)_"|"_$P(NODE,U,5,99)
S $P(RY,U)=$$EXTDT^MAGGSU1($P(RY,U))
Q RY
;S RY=$$EXTDT^MAGGSU1($P(NODE,U,3))_U_"TIU"_U_$P(NODE,U,2)_U
;S RY=RY_$$IMGCT($P(NODE,U))_U_$P($P(NODE,U,5),";",2)_U
;S RY=RY_"|TIU^"_$P(NODE,U)
Q RY
TIUDA(MAGRY,MAGDFN,MAGCONS,MAGVSTR,MAGCMP) ;RPC [MAG4 CP CONSULT TO TIUDA]
;
K MAGRY S MAGVSTR=$G(MAGVSTR),MAGCMP=$G(MAGCMP,0)
; No longer sending CP the 'Complete' Flag 9/20/01 GEK
;D ITIU^MDAPI(.MAGRY,MAGDFN,MAGCONS,MAGVSTR,MAGCMP)
; CODE^DFN^MAGIEN^<computed time 'now'>^TEXT
D ACTION^MAGGTAU("API^"_MAGDFN_"|ITIU-MDAPI Params: Cnslt#-"_MAGCONS_" vstr-"_MAGVSTR)
D ITIU^MDAPI(.MAGRY,MAGDFN,MAGCONS,MAGVSTR)
D ACTION^MAGGTAU("API^"_MAGDFN_"|ITIU-MDAPI Result: "_MAGRY(0))
Q
VISITS(MAGRY,MAGDFN,MAGCONS) ;RPC [MAG4 CP GET VISITS]
N I,MAGCT,MAGNODE,MAGI,MAGZ,MAGVISIT,DFN
S DFN=MAGDFN
S RESULTS="MAGVISIT"
; RESULTS and DFN variables are needed by MDRPCOP
D GETVST^MDRPCOP
I '$D(MAGVISIT(0)) S MAGRY(0)="0^ERROR: Listing visits." Q
S I=0,MAGCT=1 F S I=$O(MAGVISIT(I)) Q:'I D
. S MAGZ=MAGVISIT(I)
. S $P(MAGNODE,"^")=$$EXTDT^MAGGSU1($P(MAGZ,"^",2)) ;Date
. S $P(MAGNODE,"^",2,3)=$P(MAGZ,"^",3,4) ; Clinic, Status
. S $P(MAGNODE,"|",2)=$P(MAGZ,"^",1) ; VSTRING;
. S MAGCT=MAGCT+1,MAGRY(MAGCT)=MAGNODE
I '$D(MAGRY) S MAGRY(0)="0^0 Visits for patient" Q
S MAGRY(0)=$O(MAGRY(""),-1)-1_"^Visits for patient"
S MAGRY(1)="Date~S1^Location^Status"
Q
UPDCONS(MAGRY,MAGCONS,MAGTIU,MAGCMP) ;Update Consults;
; Update Consults with the Complete Flag. Consults will update
; it's status to 'pr' partial results.
D ACTION^MAGGTAU("API|CPDOC-GMRCCP Params: Cnslt#-"_MAGCONS_" tiuda-"_MAGTIU_" cmpfl-"_MAGCMP)
S MAGRY=$$CPDOC^GMRCCP(MAGCONS,MAGTIU,MAGCMP) ; MAGCMP IS 2
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGSCP 3897 printed Dec 13, 2024@02:02:37 Page 2
MAGGSCP ;WOIFO/GEK - Imaging RPC Broker call for CP.
+1 ;;3.0;IMAGING;**7,8**;Sep 15, 2004
+2 ;; +---------------------------------------------------------------+
+3 ;; | Property of the US Government. |
+4 ;; | No permission to copy or redistribute this software is given. |
+5 ;; | Use of unreleased versions of this software requires the user |
+6 ;; | to execute a written test agreement with the VistA Imaging |
+7 ;; | Development Office of the Department of Veterans Affairs, |
+8 ;; | telephone (301) 734-0100. |
+9 ;; | |
+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 ;;
+18 QUIT
LIST(MAGRY,MAGDFN,PROC) ;RPC [MAG4 CP GET REQUESTS]
+1 ; Get list of CP Requests
+2 ; PROC = IEN FROM FILE 702.01 IF JUST ONE PROCEURE DESIRED, DEFAULTS TO ALL
+3 ;
+4 ; The compressed listing, 4 columns
+5 ; Not restructuring the output yet
+6 ; "Date^Spec^Desc^Img Count^procedure info"
+7 NEW MAGX,I,ACT,NODE,TMP
+8 KILL ^TMP($JOB,"MAGCP")
+9 KILL ^TMP($JOB,"MAGCP1")
+10 SET PROC=$GET(PROC)
+11 ;S MAGRY=$NA(^TMP($J,"MAGCP1"))
+12 DO CPLIST^GMRCCP(MAGDFN,PROC,$NAME(^TMP($JOB,"MAGCP")))
+13 IF '$DATA(^TMP($JOB,"MAGCP"))
SET MAGRY(0)="0^There are no Clinical Procedure Requests for Patient : "_$$GET1^DIQ(2,MAGDFN,.01)
QUIT
+14 SET ACT=1
+15 SET I=""
FOR
SET I=$ORDER(^TMP($JOB,"MAGCP",I))
if I=""
QUIT
SET NODE=^(I)
Begin DoDot:1
+16 ; screening out x - cancelled and 'dc' - discontinued
+17 IF ",x,dc,"[(","_$PIECE(NODE,U,4)_",")
QUIT
+18 SET X=$$INF(NODE)
+19 SET ACT=ACT+1
+20 ;S @MAGRY@(ACT)=X
SET MAGRY(ACT)=X
End DoDot:1
+21 ;^cons #^CP DEF ien
SET MAGRY(1)="Date~S1^CP DEF nam^urgency^status"
+22 SET MAGRY(0)=ACT-1_"^"_ACT-1_" Clinical Procedure Requests."
+23 QUIT
INF(NODE) ;
+1 NEW RY
+2 ; FOR NOW JUST SEND THE SAME DATA (TESTING)
+3 SET RY=$PIECE(NODE,U,1,4)_"|"_$PIECE(NODE,U,5,99)
+4 SET $PIECE(RY,U)=$$EXTDT^MAGGSU1($PIECE(RY,U))
+5 QUIT RY
+6 ;S RY=$$EXTDT^MAGGSU1($P(NODE,U,3))_U_"TIU"_U_$P(NODE,U,2)_U
+7 ;S RY=RY_$$IMGCT($P(NODE,U))_U_$P($P(NODE,U,5),";",2)_U
+8 ;S RY=RY_"|TIU^"_$P(NODE,U)
+9 QUIT RY
TIUDA(MAGRY,MAGDFN,MAGCONS,MAGVSTR,MAGCMP) ;RPC [MAG4 CP CONSULT TO TIUDA]
+1 ;
+2 KILL MAGRY
SET MAGVSTR=$GET(MAGVSTR)
SET MAGCMP=$GET(MAGCMP,0)
+3 ; No longer sending CP the 'Complete' Flag 9/20/01 GEK
+4 ;D ITIU^MDAPI(.MAGRY,MAGDFN,MAGCONS,MAGVSTR,MAGCMP)
+5 ; CODE^DFN^MAGIEN^<computed time 'now'>^TEXT
+6 DO ACTION^MAGGTAU("API^"_MAGDFN_"|ITIU-MDAPI Params: Cnslt#-"_MAGCONS_" vstr-"_MAGVSTR)
+7 DO ITIU^MDAPI(.MAGRY,MAGDFN,MAGCONS,MAGVSTR)
+8 DO ACTION^MAGGTAU("API^"_MAGDFN_"|ITIU-MDAPI Result: "_MAGRY(0))
+9 QUIT
VISITS(MAGRY,MAGDFN,MAGCONS) ;RPC [MAG4 CP GET VISITS]
+1 NEW I,MAGCT,MAGNODE,MAGI,MAGZ,MAGVISIT,DFN
+2 SET DFN=MAGDFN
+3 SET RESULTS="MAGVISIT"
+4 ; RESULTS and DFN variables are needed by MDRPCOP
+5 DO GETVST^MDRPCOP
+6 IF '$DATA(MAGVISIT(0))
SET MAGRY(0)="0^ERROR: Listing visits."
QUIT
+7 SET I=0
SET MAGCT=1
FOR
SET I=$ORDER(MAGVISIT(I))
if 'I
QUIT
Begin DoDot:1
+8 SET MAGZ=MAGVISIT(I)
+9 ;Date
SET $PIECE(MAGNODE,"^")=$$EXTDT^MAGGSU1($PIECE(MAGZ,"^",2))
+10 ; Clinic, Status
SET $PIECE(MAGNODE,"^",2,3)=$PIECE(MAGZ,"^",3,4)
+11 ; VSTRING;
SET $PIECE(MAGNODE,"|",2)=$PIECE(MAGZ,"^",1)
+12 SET MAGCT=MAGCT+1
SET MAGRY(MAGCT)=MAGNODE
End DoDot:1
+13 IF '$DATA(MAGRY)
SET MAGRY(0)="0^0 Visits for patient"
QUIT
+14 SET MAGRY(0)=$ORDER(MAGRY(""),-1)-1_"^Visits for patient"
+15 SET MAGRY(1)="Date~S1^Location^Status"
+16 QUIT
UPDCONS(MAGRY,MAGCONS,MAGTIU,MAGCMP) ;Update Consults;
+1 ; Update Consults with the Complete Flag. Consults will update
+2 ; it's status to 'pr' partial results.
+3 DO ACTION^MAGGTAU("API|CPDOC-GMRCCP Params: Cnslt#-"_MAGCONS_" tiuda-"_MAGTIU_" cmpfl-"_MAGCMP)
+4 ; MAGCMP IS 2
SET MAGRY=$$CPDOC^GMRCCP(MAGCONS,MAGTIU,MAGCMP)
+5 QUIT