source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGDLBSR.m@ 1073

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

initial load of WorldVistAEHR

File size: 4.6 KB
Line 
1MAGDLBSR ;WOIFO/LB,MLH - Sort/print for 2006.575 ; 01/30/2004 17:11
2 ;;3.0;IMAGING;**10,11**;14-April-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 Q
19SRT ;Sort the file first by the patient name but only the unique entries.
20 ;The "F" cross reference uses the study uid number and gateway site.
21 N MAGSUID,MAGIEN,MAGPT
22 N GWLOC ; -- gateway site number
23 N KFIXALL ; -- does user hold MAGDFIX ALL security key?
24 N MAGTYPE ; -- type of image (rad/med/clinspec)
25 ;
26 S KFIXALL=$$SECKEY^MAGDLB12
27 Q:'$D(^MAGD(2006.575,"F")) ;nothing to sort
28 K ^MAGD(2006.575,"D")
29 S GWLOC=""
30 F S GWLOC=$O(^MAGD(2006.575,"F",GWLOC)) Q:GWLOC="" D
31 . ; if this isn't the user's site, bail unless the user holds the
32 . ; MAGDFIX ALL security key
33 . I GWLOC'=DUZ(2),'KFIXALL Q
34 . S MAGSUID=""
35 . F S MAGSUID=$O(^MAGD(2006.575,"F",GWLOC,MAGSUID)) Q:MAGSUID="" D
36 . . S MAGIEN=0
37 . . F S MAGIEN=$O(^MAGD(2006.575,"F",GWLOC,MAGSUID,MAGIEN)) Q:'MAGIEN D
38 . . . ; if no main failed image rec, there's a xref prob, so bail
39 . . . I '$D(^MAGD(2006.575,MAGIEN,0)) D Q ; clean up xref
40 . . . . K ^MAGD(2006.575,"F",GWLOC,MAGSUID,MAGIEN)
41 . . . . Q
42 . . . ; If entry has been corrected, do not include in sort
43 . . . I $D(^MAGD(2006.575,MAGIEN,"FIXD")),$P(^("FIXD"),"^") Q
44 . . . ;Only radiology images!
45 . . . I $P($G(^MAGD(2006.575,MAGIEN,"TYPE")),U)'="RAD" Q
46 . . . S MAGPT=$P(^MAGD(2006.575,MAGIEN,0),"^",4)
47 . . . S ^MAGD(2006.575,"D",MAGPT,MAGIEN)=""
48 . . . Q
49 . . Q
50 . Q
51 Q
52SRTDT ;Provide sorting by date entry but only if NOT fixed and by unique suid
53 N MAGSUID,MAGIEN,MAGDT
54 N KFIXALL ; -- does user hold MAGDFIX ALL security key?
55 N GWLOC ; -- gateway site number
56 ;
57 S KFIXALL=$$SECKEY^MAGDLB12
58 Q:'$D(^MAGD(2006.575,"F"))
59 K ^MAGD(2006.575,"AD")
60 S GWLOC=""
61 F S GWLOC=$O(^MAGD(2006.575,"F",GWLOC)) Q:'GWLOC D
62 . ; if this isn't the user's site, bail unless the user holds the
63 . ; MAGDFIX ALL security key
64 . I GWLOC'=DUZ(2),'KFIXALL Q
65 . S MAGSUID=""
66 . F S MAGSUID=$O(^MAGD(2006.575,"F",GWLOC,MAGSUID)) Q:MAGSUID="" D
67 . . S MAGIEN=0
68 . . F S MAGIEN=$O(^MAGD(2006.575,"F",GWLOC,MAGSUID,MAGIEN)) Q:'MAGIEN D
69 . . . ; if no main failed image rec, there's a xref prob, so bail
70 . . . I '$D(^MAGD(2006.575,MAGIEN,0)) D Q ; CLEAN UP XREF
71 . . . . K ^MAGD(2006.575,"F",GWLOC,MAGSUID,MAGIEN)
72 . . . . Q
73 . . . ; If entry has been corrected, do not include in sort
74 . . . I $D(^MAGD(2006.575,MAGIEN,"FIXD")),$P(^("FIXD"),"^") Q
75 . . . ;Only radiology images!
76 . . . I $P($G(^MAGD(2006.575,MAGIEN,"TYPE")),U)'="RAD" Q
77 . . . Q:'$D(^MAGD(2006.575,MAGIEN,1))
78 . . . S MAGDT=$P(^MAGD(2006.575,MAGIEN,1),"^",3)
79 . . . S ^MAGD(2006.575,"AD",MAGDT,MAGIEN)=""
80 . . . Q
81 . . Q
82 . Q
83 Q
84PRTDT(SORT,START,STOP) ;
85 ;Print entries using the "AD" cross reference (date order)
86 ; OR the "F" cross reference (unique study uid)
87 I '$D(DUZ) W !,"DUZ variable not defined." Q
88 I "DF"'[SORT Q ;only the date or unique suid
89 N DIC,BY,FLDS,L,FR,TO
90 ;I 'STOP!'START Q
91 S L(0)=2
92 I SORT="D" S SORT="AD" D
93 . I $L($G(START))>1,$L($G(STOP))>1 S FR(0,1)=START,TO(0,1)=STOP
94 S DIC="^MAGD(2006.575,",BY(0)="^MAGD(2006.575,"""_SORT_""","
95 S FLDS="[MAG FAILED IMAGES]",L=0
96 D EN1^DIP
97 Q
98ADATE() ;date
99 N DIR,X,Y
100 S DIR(0)="DU",DIR("A")=$G(MESSAGE) D ^DIR
101 Q Y
102ASKDT ;Ask date range
103 N MESSAGE
104 S MESSAGE="Enter start date" S STR=$$ADATE
105 I '$D(DTOUT),'$D(DUOUT)
106 E K STR,STP Q
107 Q:'STR
108 I STR'?7N W "Wrong date format." Q
109 S MESSAGE="Enter stop date" S STP=$$ADATE
110 I '$D(DTOUT),'$D(DUOUT)
111 E K STR,STP Q
112 I STP'?7N W "Wrong date format." Q
113 Q
114PRNT ;
115 N DIR,X,Y,BY
116 S DIR(0)="S^D:Date;F:Unique Entries"
117 D ^DIR
118 Q:"DF"'[Y
119 I Y="D" D Q:'$D(STR)!'$D(STP)
120 . D ASKDT Q:'$D(STR)!'$D(STP)
121 . W !,"Please hold sorting by Date. " D SRTDT
122 S BY=Y K DIR,X,Y,DTOUT,DIRUT,DTOUT
123 D PRTDT(BY,$G(STR),$G(STP))
124 K BY,STR,STP
125 Q
Note: See TracBrowser for help on using the repository browser.