| 1 | MAGGTCPR ;WOIFO/GEK - RPC Calls for Patient DHCP Reports ; [ 06/20/2001 08:56 ]
 | 
|---|
| 2 |  ;;3.0;IMAGING;;Mar 01, 2002
 | 
|---|
| 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 |  Q
 | 
|---|
| 19 | DGRPD(MAGRPTY,DFN) ;RPC Call to  Generate Patient Profile
 | 
|---|
| 20 |  ;
 | 
|---|
| 21 |  ; -- MAGRPTY  -- is the name of the global holding the report.
 | 
|---|
| 22 |  ; -- @MAGRPTY@(0)-- if = 0 then error occurred
 | 
|---|
| 23 |  ; -- DFN := Patient File IEN
 | 
|---|
| 24 |  ;  the variable MAGRPTY is referenced by CLOSE^MAGGTU5 to load 
 | 
|---|
| 25 |  ;  the report from the VMS file WS.DAT into the referenced global;
 | 
|---|
| 26 |  ;
 | 
|---|
| 27 |  S MAGRPTY=$NA(^TMP($J,"WSDAT"))
 | 
|---|
| 28 |  K @MAGRPTY
 | 
|---|
| 29 |  S @MAGRPTY@(0)="0^-Cannot Open Workstation Redirection Device"
 | 
|---|
| 30 |  S IOP="IMAGING WORKSTATION",%ZIS=0 D ^%ZIS Q:POP  ;Redirect Output Here
 | 
|---|
| 31 |  U IO
 | 
|---|
| 32 |  D EN^DGRPD
 | 
|---|
| 33 |  D:IO'=IO(0) ^%ZISC
 | 
|---|
| 34 |  S @MAGRPTY@(0)="1^OK"
 | 
|---|
| 35 |  Q
 | 
|---|
| 36 | HSUM(MAGRPTY,MAGGZ) ;RPC Call to Get Health Summary for Patient
 | 
|---|
| 37 |  ; MAGGZ    ->   DFN  ^  HS Type (IEN)
 | 
|---|
| 38 |  ;
 | 
|---|
| 39 |  N Y,X,GMTSTYP,GMTSTITL
 | 
|---|
| 40 |  IF $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTCPR"
 | 
|---|
| 41 |  E  S X="ERRA^MAGGTCPR",@^%ZOSF("TRAP")
 | 
|---|
| 42 |  S MAGRPTY=$NA(^TMP($J,"WSDAT"))
 | 
|---|
| 43 |  K @MAGRPTY
 | 
|---|
| 44 |  S @MAGRPTY@(0)="0^Health Summary Report NOT successful"
 | 
|---|
| 45 |  S IOP="IMAGING WORKSTATION",%ZIS=0 D ^%ZIS Q:POP
 | 
|---|
| 46 |  S GMTSTYP=$P(MAGGZ,U,2),DFN=$P(MAGGZ,U)
 | 
|---|
| 47 |  S GMTSTITL=$$GET1^DIQ(142,GMTSTYP,".02","I")
 | 
|---|
| 48 |  U IO
 | 
|---|
| 49 |  D SELTYP1^GMTS,EN^GMTS1
 | 
|---|
| 50 |  D END^GMTS K GMTSEG,GMTSEGI,GMTSEGC ; MOD GEK 5\13\96
 | 
|---|
| 51 |  D:IO'=IO(0) ^%ZISC
 | 
|---|
| 52 |  S @MAGRPTY@(0)="1^OK"
 | 
|---|
| 53 |  Q
 | 
|---|
| 54 | HSLIST(MAGRY,ZY) ;RPC Call To do a lookup using LIST^DIC to return
 | 
|---|
| 55 |  ;  the List of Health Summary Types for a user to select from.
 | 
|---|
| 56 |  ; MAGRY is the Array to return.
 | 
|---|
| 57 |  ; ZY is NOT USED
 | 
|---|
| 58 |  ; Kernel uses Y, we have to New it because calls to DIC etc
 | 
|---|
| 59 |  ;            also use it and change it, and kill it.
 | 
|---|
| 60 |  N Y,XI,Z,FI,MAGIEN,INFO
 | 
|---|
| 61 |  N FILE,IENS,FLDS,FLAGS,VAL,NUM,FROM,PART,INDEX,SCR,IDENT,TROOT
 | 
|---|
| 62 |  S (FILE,IENS,FLDS,FLAGS,VAL,NUM,FROM,PART,INDEX,SCR,IDENT,TROOT)=""
 | 
|---|
| 63 |  ;
 | 
|---|
| 64 |  ;  Format
 | 
|---|
| 65 |  ;LIST^DIC(FILE,IENS,FIELDS,FLAGS,NUMBER,
 | 
|---|
| 66 |  ;  [.]FROM,[.]PART,INDEX,[.]SCREEN,IDENTIFIER,TARGET_ROOT,MSG_ROOT)
 | 
|---|
| 67 |  ;
 | 
|---|
| 68 |  K ^TMP("DILIST",$J) ; is this necessary ?
 | 
|---|
| 69 |  K ^TMP("DIERR",$J) ; This is.
 | 
|---|
| 70 |  S FILE=142,NUM=9000,FROM="",PART="",FLDS="@;.01",INDEX="B"
 | 
|---|
| 71 |  D LIST^DIC(FILE,IENS,FLDS,FLAGS,NUM,FROM,PART,INDEX,SCR,IDENT,TROOT)
 | 
|---|
| 72 |  ;
 | 
|---|
| 73 |  I '$D(^TMP("DILIST",$J,2)) D  Q
 | 
|---|
| 74 |  . S MAGRY(XI)="0^NO Health Summary Types Found in VistA"
 | 
|---|
| 75 |  S INFO=^TMP("DILIST",$J,0)
 | 
|---|
| 76 |  S XI="" F  S XI=$O(^TMP("DILIST",$J,2,XI)) Q:XI=""  S MAGIEN=^(XI) D
 | 
|---|
| 77 |  . S Z=".01",X=^TMP("DILIST",$J,"ID",XI,Z)
 | 
|---|
| 78 |  . F  S Z=$O(^TMP("DILIST",$J,"ID",XI,Z)) Q:Z=""  S X=X_"   "_^(Z)
 | 
|---|
| 79 |  . S MAGRY(XI)=X_"^"_MAGIEN
 | 
|---|
| 80 |  ;
 | 
|---|
| 81 |  S MAGRY(0)=$P(INFO,"^")_U_"Found "_$P(INFO,"^")_" entr"_$S((+INFO=1):"y",1:"ies")
 | 
|---|
| 82 |  I $P(INFO,"^",3)>0 S MAGRY(0)=MAGRY(0)_" there are more"
 | 
|---|
| 83 |  Q
 | 
|---|
| 84 | DISSUM(MAGRPTY,DFN) ; Discharge summary
 | 
|---|
| 85 |  S MAGRPTY=$NA(^TMP($J,"WSDAT"))
 | 
|---|
| 86 |  S @MAGRPTY@(0)="0^NOT YET IMPLEMENTED"
 | 
|---|
| 87 |  Q
 | 
|---|
| 88 | ERRA S @MAGRPTY@(0)="0^"_$$EC^%ZOSV
 | 
|---|
| 89 |  D @^%ZOSF("ERRTN")
 | 
|---|
| 90 |  Q
 | 
|---|