source: FOIAVistA/trunk/r/IMAGING-MAG-ZMAG/MAGMC2CP.m@ 1757

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

initial load of FOIAVistA 6/30/08 version

File size: 2.5 KB
Line 
1MAGMC2CP ;WOIFO/JSL,SAF - Imaging API for Med conversion to CP
2 ;;3.0;IMAGING;**47**;Feb 02, 2005
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 ; CALL WITH:
20 ; MODE = Boolean value 0: TEST mode, 1: Real mode
21 ; VPtr = Variable pointer to Medicine file report that is being converted
22 ; MAGTIU = The internal entry number of TIU note that VI is converting the medicine pointer to
23 ; IPtr = The internal entry number was stored in the Medicine file pointer pointed back to MAG(2005
24 ;
25 ; RETURN:
26 ; Error -1^Description of error
27 ; No Action Needed 0^No Action
28 ; OK 1^Success message
29 ;
30TIU(MODE,VP,MAGTIU,IP) ;
31 N MAGIEN,MEDIEN,MSG,MAGRET,Y,D0,D1
32 S MAGRET="0^No Action",MSG=""
33 S MODE=$S($G(MODE)="":0,1:MODE)
34 S MEDIEN=+$G(VP) I 'MEDIEN Q "-1^No Medicine IEN"
35 S TIUIEN=+$G(MAGTIU) I 'TIUIEN Q "-1^No TIU IEN"
36 S MAGIEN=IP I '$G(MAGIEN) Q "-1^No MAG IEN"
37 I '$D(^MAG(2005,MAGIEN,0)) Q "-1^No image file "_MAGIEN
38 I '$$CHKMED(MEDIEN,MAGIEN) Q "-1^No Medicine report found - "_MSG
39 I MODE D
40 . D FILE^MAGGSTI(.MAGRET,MAGIEN,TIUIEN) I 'MAGRET S MAGRET="-1^Fail" Q
41 . D LOG(MAGIEN,"TIU MEDICINE CONVERSION"_U_MODE_U_MEDIEN_U_MAGTIU_U_MEDIEN)
42 . S MAGRET="1^Success"
43 E Q "0^No action"
44 Q MAGRET
45 ;
46CHKMED(MEDIEN,MAGIEN) ;
47 I '$G(MEDIEN)!'$G(MAGIEN) Q 0
48 S Y=$G(^MAG(2005,MAGIEN,2)),D0=$P(Y,U,6),D1=$P(Y,U,7)
49 I 'D0!'D1 S MSG="No report file "_MAGIEN_" found." Q 0
50 S MAGRPT=$G(^DIC(D0,0,"GL")),LN=$L(MAGRPT) Q:MAGRPT="" 0
51 S GLB=MAGRPT_$S($E(MAGRPT,LN)="(":"",$E(MAGRPT,LN)=",":"",1:",")_D1_")" ;report global
52 I $Q(@GLB)'[MAGRPT S MSG="No report file "_MAGRPT_" found." Q 0
53 Q 1 ;ok
54LOG(IEN,STR) ;
55 S ^MAGTMP("MAGZTIU",IEN)=STR
56 Q
57 ;
Note: See TracBrowser for help on using the repository browser.