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

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

initial load of WorldVistAEHR

File size: 4.4 KB
Line 
1MAGXCVX ;WOIFO/SEB,MLH - Image File Conversion Export ; 24 Mar 2005 11:00 AM
2 ;;3.0;IMAGING;**17,25,31**;Mar 31, 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 ;
20 ; Entry point for the Export Results option (MAG IMAGE INDEX EXPORT)
21EXPORT N FNAME,COUNT,MAGDATA,MAGFLD,MAGID,CT,DR,DIE,DA,%ZIS,CLEAR
22 N MAGIEN,GRPIEN,CHILD1,UTYPE,MAGTMP,MAGVALS,FLDNUM,START,END
23 N MAGNOD ; --- nodes of the current image record, for fast lookup
24 N I ; -------- scratch loop index
25 N INT ; ------ internal code value
26 N EXT ; ------ array for return of external code value from VAL^DIE
27 ;
28 S COUNT=0
29EX1 R !!,"Please enter the filename of the output file: ",FNAME:DTIME
30 I $E(FNAME)="?" D G EX1
31 . W !!,"Enter a file name, including the path, of the file to export."
32 . Q
33 I $TR(FNAME,"^")="" W !!,"No filename entered. Goodbye!" Q
34 S %ZIS="",%ZIS("HFSNAME")=FNAME,%ZIS("HFSMODE")="W",IOP="HFS"
35 S X="ERR^"_$T(+0),@^%ZOSF("TRAP")
36 D ^%ZIS I POP=1 W !,"Unable to open "_FNAME_" for output. Please try again." G EX1
37 W ! D BOUNDS^MAGXCVP(.START,.END) I START="^" S COUNT=-1 G ERR
38 S START=+$G(START),END=+$G(END) I END=0 S END=+$P($G(^MAG(2005,0)),U,3)
39 S MAGIEN=START-1 I MAGIEN=-1 S MAGIEN=0
40 W ! U IO W "Image IEN",$C(9),"Short Description",$C(9),"Procedure",$C(9),"Parent Data File",$C(9)
41 W "Document Category",$C(9),"Object Type",$C(9),"Save By Group",$C(9)
42 W "Package",$C(9),"Class",$C(9),"Type",$C(9),"Specialty",$C(9),"Proc/Event",$C(9),"Origin",!
43 F CT=0:1 S MAGIEN=$O(^XTMP("MAGIXCVGEN",MAGIEN)) Q:MAGIEN>END!(+MAGIEN'=MAGIEN) D
44 . U IO(0) W:CT#100=0 MAGIEN W:CT#10=0 "."
45 . S GRPIEN=$P($G(^MAG(2005,MAGIEN,0)),U,10) I GRPIEN="" S GRPIEN=MAGIEN
46 . F I=0,2,100 S MAGNOD(I)=$G(^MAG(2005,GRPIEN,I))
47 . K MAGVALS,UTYPE
48 . ; get internal values
49 . S MAGVALS(3,"I")=$P(MAGNOD(0),U,6) ; object type
50 . S CHILD1=$P($G(^MAG(2005,GRPIEN,1,1,0)),U)
51 . I CHILD1]"" S MAGVALS(3,"I")=$P($G(^MAG(2005,CHILD1,0)),U,6)
52 . S MAGVALS(6,"I")=$P(MAGNOD(0),U,8) ; procedure
53 . S MAGVALS(8,"I")=$P(MAGNOD(2),U,2) ; image save by
54 . S MAGVALS(10,"I")=$P(MAGNOD(2),U,4) ; short description
55 . S MAGVALS(16,"I")=$P(MAGNOD(2),U,6) ; parent data file
56 . S MAGVALS(100,"I")=$P(MAGNOD(100),U) ; descriptive category
57 . ; get external values
58 . I MAGVALS(3,"I") D
59 . . S MAGVALS(3,"E")=$P($G(^MAG(2005.02,MAGVALS(3,"I"),0)),U)
60 . . Q
61 . S MAGVALS(6,"E")=MAGVALS(6,"I")
62 . I MAGVALS(8,"I") S UTYPE=$$GET1^DIQ(200,MAGVALS(8,"I")_",",29,"E")
63 . S MAGVALS(10,"E")=MAGVALS(10,"I")
64 . I MAGVALS(16,"I") D
65 . . S MAGVALS(16,"E")=$P($G(^MAG(2005.03,MAGVALS(16,"I"),0)),U)
66 . . Q
67 . I MAGVALS(100,"I") D
68 . . S MAGVALS(100,"E")=$P($G(^MAG(2005.81,MAGVALS(100,"I"),0)),U)
69 . . Q
70 . U IO W MAGIEN F FLDNUM=10,6,16,100,3 W $C(9),$G(MAGVALS(FLDNUM,"E"))
71 . W $C(9),$G(UTYPE)
72 . S MAGDATA=$G(^XTMP("MAGIXCVGEN",MAGIEN))
73 . W $C(9),$P(MAGDATA,U,2)
74 . W $C(9) I $P(MAGDATA,U,3)'="" W $P(MAGDATA,U,3),"-",$P($G(^MAG(2005.82,$P(MAGDATA,U,3),0)),U)
75 . W $C(9) I $P(MAGDATA,U,4)'="" W $P(MAGDATA,U,4),"-",$P($G(^MAG(2005.83,$P(MAGDATA,U,4),0)),U)
76 . W $C(9) I $P(MAGDATA,U,6)'="" W $P(MAGDATA,U,6),"-",$P($G(^MAG(2005.84,$P(MAGDATA,U,6),0)),U)
77 . W $C(9) I $P(MAGDATA,U,5)'="" W $P(MAGDATA,U,5),"-",$P($G(^MAG(2005.85,$P(MAGDATA,U,5),0)),U)
78 . W $C(9) I $P(MAGDATA,U,7)'="" D ; convert set-of-codes to external value
79 . . S INT=$P(MAGDATA,U,7)
80 . . D VAL^DIE(2005,"",45,"E",INT,.EXT)
81 . . W INT_"-"_$G(EXT(0))
82 . . Q
83 . W !
84 . Q
85 U IO W "***end***",!
86 U IO(0)
87 D ^%ZISC G EXDONE
88 ;
89ERR ; Reached when an error (including end-of-file) occurs.
90 D ^%ZISC
91EXDONE S COUNT=COUNT+1
92 I COUNT=1 W !,"Done exporting generated index values."
93 Q
Note: See TracBrowser for help on using the repository browser.