| 1 | MAGDRA3 ;WOIFO Routine to lookup patient by casenumber of name  [ 06/20/2001 08:56 ]
 | 
|---|
| 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
 | 
|---|
| 19 | ASK() ;Prompt user
 | 
|---|
| 20 |  N DIR,X,Y
 | 
|---|
| 21 |  S DIR(0)="F:1:30",DIR("A")="Enter patient or case number"
 | 
|---|
| 22 |  S DIR("?")="Enter a patient name or case number to associate this image."
 | 
|---|
| 23 |  D ^DIR
 | 
|---|
| 24 |  Q Y
 | 
|---|
| 25 | READ(RESULT) ;
 | 
|---|
| 26 |  N ANS
 | 
|---|
| 27 |  S RESULT=0,ANS=$$ASK
 | 
|---|
| 28 |  I ANS=""!(ANS="^") S RESULT="^" Q RESULT
 | 
|---|
| 29 |  I ANS?1.5N!(ANS?6N1"-".N) D CASE(ANS,.RESULT) I +RESULT Q RESULT
 | 
|---|
| 30 |  I ANS?1.8N Q RESULT  ;Incomplete ssn sent. Couldn't be a case number?
 | 
|---|
| 31 |  D:ANS'?.N1"-".E PAT(ANS,.RESULT)
 | 
|---|
| 32 |  Q RESULT
 | 
|---|
| 33 | CASE(CASE,RESULT) ;
 | 
|---|
| 34 |  N MAGXR,MAGDFN,MAGDTI,MAGCNI
 | 
|---|
| 35 |  S MAGXR=$S(CASE["-":"ADC",1:"AE")
 | 
|---|
| 36 |  I $D(^RADPT(MAGXR,CASE)) D
 | 
|---|
| 37 |  . S MAGDFN=$O(^RADPT(MAGXR,CASE,0))
 | 
|---|
| 38 |  . S MAGDTI=$O(^RADPT(MAGXR,CASE,MAGDFN,0))
 | 
|---|
| 39 |  . S MAGCNI=$O(^RADPT(MAGXR,CASE,MAGDFN,MAGDTI,0))
 | 
|---|
| 40 |  . S RESULT=MAGDFN_"~"_MAGDTI_"~"_MAGCNI
 | 
|---|
| 41 |  Q 
 | 
|---|
| 42 | PAT(PAT,RESULT) ;
 | 
|---|
| 43 |  N DIR,X,Y
 | 
|---|
| 44 |  S DIR(0)="P^70:EMZ",DIR("B")=PAT
 | 
|---|
| 45 |  D ^DIR
 | 
|---|
| 46 |  S RESULT=Y
 | 
|---|
| 47 |  Q
 | 
|---|