source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGGTMC1.m@ 1361

Last change on this file since 1361 was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 3.5 KB
Line 
1MAGGTMC1 ;WOIFO/GEK - RPC Calls for Imaging/Medicine procedures ; [ 06/20/2001 08:57 ]
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
19FILE(MAGRY,DATA,MAGARR) ;RPC Call to File the Image pointer into
20 ; the Procedure/Subspecialty and Proc/Subspec into Image file.
21 ;
22 ; DATA = DATETIME^PSIEN^DFN^MCIEN^PROCSTUB ; 6/19/97
23 ; If MCIEN isn't sent, this will be added as new procedure
24 ; MAGARR is array of image pointers
25 ; IF PROCSTUB is 1 we JUST want New Medicine procedure stub IEN 6/19/97
26 ; as the success i.e. MAGRY="IEN^Procdure Stub created" 6/19/97
27 IF $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGTERR"
28 E S X="ERR^MAGGTERR",@^%ZOSF("TRAP")
29 N I,J,K,X,Y,Z,TIME,PSIEN,DFN,MAGPTR,MAGMCIEN,MCFILE,MAGOK,MAGERR
30 ;
31 S X=$P(DATA,U,1),%DT="TS" D ^%DT S TIME=Y
32 S PSIEN=+$P(DATA,U,2)
33 S DFN=+$P(DATA,U,3)
34 S MAGMCIEN=+$P(DATA,U,4)
35 S PROCSTUB=+$P(DATA,U,5) ; NEW 6/19/97 GEK
36 S MCFILE=$P($P(^MCAR(697.2,PSIEN,0),U,2),"(",2)
37 I '$D(^MAG(2005.03,MCFILE)) S MAGRY="0^Procedure file is Invalid in Imaging Parent Data File " Q
38 S MAGOK=""
39 S I="" F S I=$O(MAGARR(I)) Q:I="" D
40 . S MAGPTR(I)=""
41 . I '$D(^MAG(2005,I)) S MAGERR="0^INVALID Image entry "_I
42 I $D(MAGERR) S MAGRY=MAGERR Q
43 ; 6/19/97 New Note .MAGMCIEN
44 D UPDATE^MCUIMAG0(TIME,PSIEN,DFN,.MAGPTR,.MAGMCIEN,.MAGOK)
45 ;
46 I 'MAGOK S MAGRY=MAGOK Q
47 ; Next if we're getting a stub, Quit with the stub if it was created
48 I MAGOK,PROCSTUB D Q
49 . I MAGMCIEN<1 S MAGRY="0^FAILED Creating New Procedure stub"_MAGOK Q
50 . S MAGRY=$P(MAGMCIEN,U,1)_"^Procedure Stub created"
51 ;
52 ; now enter the pointers to procedures, in the image file.
53 ; we get back MAGPTR(I)= MCFILE^PSIEN^MULTIPLE ENTRY IEN
54 S I="" F S I=$O(MAGPTR(I)) Q:I="" D
55 . S $P(^MAG(2005,I,2),U,6,8)=MAGPTR(I)
56 S MAGRY=MAGOK
57 Q
58 ;/GEK/ 4/29/98 put in modification to return DICOM ID for MED proc.
59DICOMID(MAGRY,DATA) ;RPC Call to return a Dicom ID for medicine procedure.
60 ; This is displayed on workstation, and used to link Dicom images
61 ; to a medicine procedure.
62 ; DATA is null ^ PSIEN ^ DFN ^ MCIEN ^ null
63 ;
64 N TMCFILE,TPSIEN,TDFN,TMCIEN
65 S TPSIEN=+$P(DATA,U,2)
66 S TDFN=+$P(DATA,U,3)
67 S TMCIEN=+$P(DATA,U,4)
68 S TMCFILE=$P($P($G(^MCAR(697.2,TPSIEN,0)),U,2),"(",2)
69 I 'TMCFILE S MAGRY="0^InValid data input PSIEN="_TPSIEN Q
70 D DICOMID^MAGDMEDI(.RETX,TMCFILE,TMCIEN,TPSIEN,TDFN)
71 S MAGRY=RETX
72 Q
73NEW(MAGRY,DATA) ;RPC call to Create NEW Procedure stub
74 ; for a medicine procedure
75 ;
76 ; DATA = DATETIME^PSIEN^DFN ; same as old call
77 S $P(DATA,"^",4)="^1" ; the 1 means we want a new procedure stub
78 K MAGARR ; we are not passing any images.
79 D FILE(.MAGRY,DATA,.MAGARR)
80 Q
Note: See TracBrowser for help on using the repository browser.