| 1 | MAGGSCP ;WOIFO/GEK - Imaging RPC Broker call for CP. | 
|---|
| 2 | ;;3.0;IMAGING;**7,8**;Sep 15, 2004 | 
|---|
| 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 | ;; |                                                               | | 
|---|
| 11 | ;; | The Food and Drug Administration classifies this software as  | | 
|---|
| 12 | ;; | a medical device.  As such, it may not be changed in any way. | | 
|---|
| 13 | ;; | Modifications to this software may result in an adulterated   | | 
|---|
| 14 | ;; | medical device under 21CFR820, the use of which is considered | | 
|---|
| 15 | ;; | to be a violation of US Federal Statutes.                     | | 
|---|
| 16 | ;; +---------------------------------------------------------------+ | 
|---|
| 17 | ;; | 
|---|
| 18 | ;; | 
|---|
| 19 | Q | 
|---|
| 20 | LIST(MAGRY,MAGDFN,PROC) ;RPC [MAG4 CP GET REQUESTS] | 
|---|
| 21 | ; Get list of CP Requests | 
|---|
| 22 | ; PROC = IEN FROM FILE 702.01 IF JUST ONE PROCEURE DESIRED, DEFAULTS TO ALL | 
|---|
| 23 | ; | 
|---|
| 24 | ; The compressed listing, 4 columns | 
|---|
| 25 | ; Not restructuring the output yet | 
|---|
| 26 | ;    "Date^Spec^Desc^Img Count^procedure info" | 
|---|
| 27 | N MAGX,I,ACT,NODE,TMP | 
|---|
| 28 | K ^TMP($J,"MAGCP") | 
|---|
| 29 | K ^TMP($J,"MAGCP1") | 
|---|
| 30 | S PROC=$G(PROC) | 
|---|
| 31 | ;S MAGRY=$NA(^TMP($J,"MAGCP1")) | 
|---|
| 32 | D CPLIST^GMRCCP(MAGDFN,PROC,$NA(^TMP($J,"MAGCP"))) | 
|---|
| 33 | I '$D(^TMP($J,"MAGCP")) S MAGRY(0)="0^There are no Clinical Procedure Requests for Patient : "_$$GET1^DIQ(2,MAGDFN,.01) Q | 
|---|
| 34 | S ACT=1 | 
|---|
| 35 | S I="" F  S I=$O(^TMP($J,"MAGCP",I)) Q:I=""  S NODE=^(I) D | 
|---|
| 36 | . ; screening out x - cancelled and 'dc' - discontinued | 
|---|
| 37 | . I ",x,dc,"[(","_$P(NODE,U,4)_",") Q | 
|---|
| 38 | . S X=$$INF(NODE) | 
|---|
| 39 | . S ACT=ACT+1 | 
|---|
| 40 | . S MAGRY(ACT)=X ;S @MAGRY@(ACT)=X | 
|---|
| 41 | S MAGRY(1)="Date~S1^CP DEF nam^urgency^status" ;^cons #^CP DEF ien | 
|---|
| 42 | S MAGRY(0)=ACT-1_"^"_ACT-1_" Clinical Procedure Requests." | 
|---|
| 43 | Q | 
|---|
| 44 | INF(NODE) ; | 
|---|
| 45 | N RY | 
|---|
| 46 | ; FOR NOW JUST SEND THE SAME DATA (TESTING) | 
|---|
| 47 | S RY=$P(NODE,U,1,4)_"|"_$P(NODE,U,5,99) | 
|---|
| 48 | S $P(RY,U)=$$EXTDT^MAGGSU1($P(RY,U)) | 
|---|
| 49 | Q RY | 
|---|
| 50 | ;S RY=$$EXTDT^MAGGSU1($P(NODE,U,3))_U_"TIU"_U_$P(NODE,U,2)_U | 
|---|
| 51 | ;S RY=RY_$$IMGCT($P(NODE,U))_U_$P($P(NODE,U,5),";",2)_U | 
|---|
| 52 | ;S RY=RY_"|TIU^"_$P(NODE,U) | 
|---|
| 53 | Q RY | 
|---|
| 54 | TIUDA(MAGRY,MAGDFN,MAGCONS,MAGVSTR,MAGCMP) ;RPC [MAG4 CP CONSULT TO TIUDA] | 
|---|
| 55 | ; | 
|---|
| 56 | K MAGRY S MAGVSTR=$G(MAGVSTR),MAGCMP=$G(MAGCMP,0) | 
|---|
| 57 | ; No longer sending CP the 'Complete' Flag 9/20/01 GEK | 
|---|
| 58 | ;D ITIU^MDAPI(.MAGRY,MAGDFN,MAGCONS,MAGVSTR,MAGCMP) | 
|---|
| 59 | ; CODE^DFN^MAGIEN^<computed time 'now'>^TEXT | 
|---|
| 60 | D ACTION^MAGGTAU("API^"_MAGDFN_"|ITIU-MDAPI Params: Cnslt#-"_MAGCONS_" vstr-"_MAGVSTR) | 
|---|
| 61 | D ITIU^MDAPI(.MAGRY,MAGDFN,MAGCONS,MAGVSTR) | 
|---|
| 62 | D ACTION^MAGGTAU("API^"_MAGDFN_"|ITIU-MDAPI Result: "_MAGRY(0)) | 
|---|
| 63 | Q | 
|---|
| 64 | VISITS(MAGRY,MAGDFN,MAGCONS) ;RPC [MAG4 CP GET VISITS] | 
|---|
| 65 | N I,MAGCT,MAGNODE,MAGI,MAGZ,MAGVISIT,DFN | 
|---|
| 66 | S DFN=MAGDFN | 
|---|
| 67 | S RESULTS="MAGVISIT" | 
|---|
| 68 | ; RESULTS and DFN variables are needed by MDRPCOP | 
|---|
| 69 | D GETVST^MDRPCOP | 
|---|
| 70 | I '$D(MAGVISIT(0)) S MAGRY(0)="0^ERROR: Listing visits." Q | 
|---|
| 71 | S I=0,MAGCT=1 F  S I=$O(MAGVISIT(I)) Q:'I  D | 
|---|
| 72 | . S MAGZ=MAGVISIT(I) | 
|---|
| 73 | . S $P(MAGNODE,"^")=$$EXTDT^MAGGSU1($P(MAGZ,"^",2)) ;Date | 
|---|
| 74 | . S $P(MAGNODE,"^",2,3)=$P(MAGZ,"^",3,4) ; Clinic, Status | 
|---|
| 75 | . S $P(MAGNODE,"|",2)=$P(MAGZ,"^",1) ; VSTRING; | 
|---|
| 76 | . S MAGCT=MAGCT+1,MAGRY(MAGCT)=MAGNODE | 
|---|
| 77 | I '$D(MAGRY) S MAGRY(0)="0^0 Visits for patient" Q | 
|---|
| 78 | S MAGRY(0)=$O(MAGRY(""),-1)-1_"^Visits for patient" | 
|---|
| 79 | S MAGRY(1)="Date~S1^Location^Status" | 
|---|
| 80 | Q | 
|---|
| 81 | UPDCONS(MAGRY,MAGCONS,MAGTIU,MAGCMP) ;Update Consults; | 
|---|
| 82 | ; Update Consults with the Complete Flag. Consults will update | 
|---|
| 83 | ; it's status to 'pr' partial results. | 
|---|
| 84 | D ACTION^MAGGTAU("API|CPDOC-GMRCCP Params: Cnslt#-"_MAGCONS_" tiuda-"_MAGTIU_" cmpfl-"_MAGCMP) | 
|---|
| 85 | S MAGRY=$$CPDOC^GMRCCP(MAGCONS,MAGTIU,MAGCMP) ; MAGCMP IS 2 | 
|---|
| 86 | Q | 
|---|