source: FOIAVistA/tag/r/IMAGING-MAG-ZMAG/MAGDLB1.m@ 1093

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

initial load of FOIAVistA 6/30/08 version

File size: 7.3 KB
Line 
1MAGDLB1 ;WOIFO/LB - Routine to fix failed DICOM entries ; 09/08/2004 07:32
2 ;;3.0;IMAGING;**11,30**;16-September-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
19 ;
20DISPLAY ;
21 S OUT=0
22 W !,"**************Processing entry**********"
23 W !!?2,"PATIENT: ",PAT,?50,"SSN: ",PID,!,"RADIOLOGY CASE #: ",CASENO
24 W !?2,"Equipment: ",MOD,?50,"Model: ",MODEL
25 W !?2,"Date Processed: ",DATE,?50,"Problem with: ",REASON
26 W !?2,"Comment: ",COMNT1
27 W !?2,"Correcting file on Image gateway server ID: ",MACHID,!?5,FILE
28 S MSG="Do you want to Correct this entry? "
29 Q
30NEWCASE ;
31 S NEWDFN=$P(MAGDY,"^"),NEWNME=$P(MAGDY,"^",2),NEWSSN=$P(MAGDY,"^",3)
32 S NEWCAS=$P(MAGDY,"^",4),NEWPROC=$P(MAGDY,"^",5),NEWDTI=$P(MAGDY,"^",6)
33 S NEWMUL=$P(MAGDY,"^",7),NEWPIEN=$P(MAGDY,"^",8),PP=$P(MAGDY,"^",9)
34 Q
35ASK() ;
36 N ANS,ASK
37ASK1 S ASK="Y/N/D/Q"
38 I $G(PREV)'=$G(MAGIEN),MAGTYPE="RAD" S ASK=ASK_"/P"
39 W !,$G(MSG),"("_ASK_")// " R ANS:600
40 I '$T!(ANS["^") Q "^"
41 I ANS="" Q "N"
42 I "YNDPQyndpq"'[$E(ANS) D G ASK1
43 . W !,"Please respond with one of the following codes."
44 . W !,"Legend: Y=yes, N=no, D=delete, P=Previous entry, and Q=quit",!
45 S ANS=$TR(ANS,"yndpq","YNDPQ")
46 Q $E(ANS)
47CHK ;remove any punctuation before doing comparison on SSN
48 ;stop on 1st check.
49 N OLD,I
50 S OLD="" F I=1:1:$L(PID) I $E(PID,I)?1AN S OLD=OLD_$E(PID,I)
51 I NEWSSN'=OLD D Q
52 . S MSG="Social Security numbers do not match. Update? "
53 I NEWNME'=PAT D Q
54 . S MSG="Patient names do not match. Update? "
55 ;Finally the problem is with the case number...either no longer in "C"
56 ;xref or invalid number provided
57 S MSG="Radiology case number different. Update? "
58 Q
59NEWDIS ;
60 W !?2,"****Please review the following: *****"
61 W !?2,"Previous name: ",PAT,!?2," New name: ",NEWNME
62 W !?2,"Previous ssn: ",PID,!?2," New ssn: ",NEWSSN
63 W !?2,"Previous case #: ",CASENO,!?2," New case #: ",NEWCAS
64 I $L($G(PP)) W !?15,"Case number selected: ",PP
65 ; Variable PP already has text message about being part of printset.
66 Q
67UPDT ;
68 N GWLOC ; -- gateway location
69 W !,"Will change the following: " D NEWDIS
70 W !,"Are you sure you want to correct this entry? " S %=2 D YN^DICN
71 I %=-1!(%=2) S OUT=1 Q
72 W !,"Updating the file."
73 S NEWDTIM=$TR(NEWDTI,"0123456789","9876543210")
74 S ^MAGD(2006.575,MAGIEN,"FIXD")="1^"_NEWDFN_"^"_NEWNME_"^"_NEWSSN_"^"_NEWCAS_"^"_NEWDTI_"^"_NEWMUL_"^"_NEWDTIM W "."
75 S ^MAGD(2006.575,MAGIEN,"FIXPR")=NEWPIEN_"^"_NEWPROC W "."
76 ;Same as ^radpt(newdfn,"DT",newdti,"P",newmul,0) & ^RAMIS(71,newpien,0)
77 S MACHID=$S(MACHID="":"A",1:MACHID) ; server ID
78 S GWLOC=$P($G(^MAGD(2006.575,MAGIEN,1)),"^",5)
79 I GWLOC S ^MAGD(2006.575,"AFX",GWLOC,MACHID,MAGIEN)="" W "."
80 E W !,"Gateway place not defined on image entry "_MAGIEN_", continuing.."
81 ;Xref to loop & process entries; processing will be minimal.
82 S MAGFIX(MAGIEN)="F"
83 Q
84SETDEL ;Entry to be deleted
85 N GWLOC ; -- gateway location
86 D LOGERR I ANS="^" S OUT=1 Q
87 S GWLOC=$P($G(^MAGD(2006.575,MAGIEN,1)),"^",5)
88 I GWLOC S ^MAGD(2006.575,"AFX",GWLOC,MACHID,MAGIEN)="D" W "."
89 E W !,"Gateway place not defined on this image entry "_MAGIEN_", continuing.."
90 S $P(^MAGD(2006.575,MAGIEN,0),"^",6)="1"
91 S ^MAGD(2006.575,MAGIEN,"FIXD")=1
92 S MAGFIX(MAGIEN)="D"
93 Q
94LOGERR ;Need to record error
95 N DIR,DIRUT,DTOUT,ENTRY,I,MAGERR,MAGOUT,X,Y,WHY,WHO
96 W !! F I=1:1:80 W "*"
97 W !,"*** Will log in error log (file 2006.599). ****"
98 D NOW^%DTC
99 S DIR(0)="F^3:30"
100 S DIR("A")="Reason for deletion"
101 S DIR("A",1)="Please enter a reason for deleting."
102 S DIR("A",2)="For example: TEST PATIENT"
103 D ^DIR
104 I $D(DIRUT)!($D(DTOUT))!(Y="") D S ANS="^" Q
105 . W !,"Can not delete if a reason is not provided."
106 . Q
107 S WHY=Y,WHO=$G(DUZ)
108 I WHO D
109 . D GETS^DIQ(200,DUZ,".01","E","MAGOUT","MAGERR")
110 . Q:$D(MAGERR("DIERR"))
111 . S WHO=$G(MAGOUT(200,DUZ_",",.01,"E"))
112 I WHO="" S WHO="UNKNOWN"
113 I '$D(^MAGD(2006.599,0)) D
114 . S ^MAGD(2006.599,0)="Dicom Error Log^2006.599^^"
115 . Q
116 S ENTRY=$P(^MAGD(2006.599,0),"^",3)+1
117 S $P(^MAGD(2006.599,0),"^",3)=ENTRY
118 S $P(^MAGD(2006.599,0),"^",4)=$P(^MAGD(2006.599,0),"^",4)+1
119 S ^MAGD(2006.599,ENTRY,0)=%_"^"_WHY_"^"_FILE_"^"_MODEL
120 S ^MAGD(2006.599,ENTRY,1)=WHO_"^"_PAT_"^"_PID_"^"_CASENO_"^"_MACHID
121 S ^MAGD(2006.599,"B",%,ENTRY)=""
122 Q
123SET ;
124 S MAGTYPE=$P(^MAGD(2006.575,MAGIEN,"TYPE"),"^")
125 Q:$P($G(^MAGD(2006.575,MAGIEN,"FIXD")),"^") ; Already fixed.
126 ; Only process Radiology images...medicine images done by other rtns.
127 I MAGTYPE'["RAD" Q
128 S DATA=^MAGD(2006.575,MAGIEN,0)
129 S FILE=$P(^MAGD(2006.575,MAGIEN,0),"^")
130 S DATA1=^MAGD(2006.575,MAGIEN,1) ; Case no. info
131 S DATA2=^MAGD(2006.575,MAGIEN,"AMFG") ; Modality info
132 S PAT=$P(DATA,"^",4),PID=$P(DATA,"^",3),REASON=$P(DATA,"^",2)
133 S MOD=$P(DATA2,"^"),MODEL=$P(DATA2,"^",6)
134 S CASENO=$P(DATA1,"^",2),MACHID=$P(DATA1,"^",4)
135 S Y=$P(DATA1,"^",3) X ^DD("DD") S DATE=Y
136 S COMNT1=$G(^MAGD(2006.575,MAGIEN,"ACSTXT")) ; 1st line comment.
137 S MACHID=$P(DATA1,"^",4),GWLOC=$P(DATA2,"^",9)
138 S ANS="" D DISPLAY S ANS=$$ASK
139 I ANS="Q"!(ANS["^") S (OOUT,OUT)=1 D SETPREV Q
140 I ANS="N" S OUT=1 D SETPREV Q
141 I ANS="P" D CHKPREV Q
142 I ANS="D" D SETDEL,SETPREV Q
143 Q:OUT
144 K MAGDY W !," Lookup by case number or patient name"
145LOOK ;
146 ;D ^MAGDLB2 Q:'$D(MAGDY) Q:MAGDY'[""
147 D EN^MAGDRA2 Q:'$D(MAGDY) Q:MAGDY'[""
148 D NEWCASE,CHK,NEWDIS S ANS=$$ASK
149 I ANS="Q"!(ANS["^") S (OOUT,OUT)=1 D SETPREV Q
150 I ANS="D" D SETDEL,SETPREV Q
151 I ANS="P" D CHKPREV Q
152 I ANS="N" S OUT=1 D SETPREV Q
153 Q:OUT
154 D UPDT
155 I ANS="P" D CHKPREV Q
156 D SETMAG
157 Q
158DATELOOP(START,STOP) ;Loop thru the "AD" cross reference
159 N MAGIEN,SUID,THEDT,FIRST,OOUT,MAGFIX,MDV
160 S KFIXALL=$$SECKEY^MAGDLB12
161 S THEDT=START-.1,(OOUT,FIRST)=0
162 F S THEDT=$O(^MAGD(2006.575,"AD",THEDT)) Q:'THEDT!(THEDT>STOP)!(OOUT) D
163 . S MAGIEN=0
164 . F S MAGIEN=$O(^MAGD(2006.575,"AD",THEDT,MAGIEN)) Q:'MAGIEN D
165 . . I '$D(^MAGD(2006.575,MAGIEN,0)) D Q
166 . . . K ^MAGD(2006.575,"AD",THEDT,MAGIEN)
167 . . . Q
168 . . I $P($G(^MAGD(2006.575,MAGIEN,"TYPE")),U,1)'["RAD" Q
169 . . ; No security key, or gateway site other than this site
170 . . I 'KFIXALL,$P($G(^MAGD(2006.575,MAGIEN,1)),U,5)'=$G(DUZ(2)) Q
171 . . I 'FIRST S PREV=MAGIEN,FIRST=1
172 . . D SET
173 . . Q
174 . Q
175 Q
176SETPREV ;
177 S PREV=MAGIEN,PREVS=$G(SUID)
178 Q
179SETMAG ;
180 S FIRST=MAGIEN,FIRSTS=$G(SUID),MAGIEN=PREV,SUID=$G(PREVS)
181 S PREV=FIRST,PREVS=FIRSTS
182 Q
183CHKPREV ;
184 S OUT=1 N STATUS
185 I '$D(MAGFIX(PREV)) D SETMAG G SET
186 S STATUS=$S($G(MAGFIX(PREV))="D":"deleted",1:"corrected")
187 W !,"Previous entry has been "_STATUS_".",$C(7)
188 G SET
189 Q
190NAME(ENTRY) ;SITE NAME
191 N NAME,MAGOUT,MAGERR
192 I '$G(ENTRY) Q ""
193 D GETS^DIQ(4,ENTRY,".01","E","MAGOUT","MAGERR")
194 I $D(MAGERR("DIERR")) Q ""
195 S NAME=$G(MAGOUT(4,ENTRY_",",.01,"E"))
196 Q NAME
Note: See TracBrowser for help on using the repository browser.