| 1 | MAGDMEDI ;WOIFO/LB - Routine for Medicine DICOM ID ; [ 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 | DICOMID(RETURN,MAGMFILE,MAGMFIEN,MAGPROC,MAGDFN) ;
 | 
|---|
| 20 |  ;MAGMFILE= Medicine file number  ( i.e. 699 , 699.5  etc)
 | 
|---|
| 21 |  ;MAGMFIEN= Medicine file entry, IEN  (699,xxx)
 | 
|---|
| 22 |  ;MAGPROC=  Medicine procedure IEN  ( 697.2,yyy points to 699, 699.5 etc)
 | 
|---|
| 23 |  ;MAGDFN=   Patient's DFN 
 | 
|---|
| 24 |  ; RETURN piece 1= 1 or 0
 | 
|---|
| 25 |  ;        piece 2= DICOM ID  
 | 
|---|
| 26 |  ;           DICOM ID= medicine file id code-Medicine file IEN
 | 
|---|
| 27 |  N OK,MAGID,MCFILE
 | 
|---|
| 28 |  S RETURN="0^Invalid information sent"
 | 
|---|
| 29 |  Q:'MAGMFILE!('MAGMFIEN)!('MAGDFN)
 | 
|---|
| 30 |  ; Will check to see if valid information is sent
 | 
|---|
| 31 |  I '$D(^MAG(2005.03,MAGMFILE)) D  Q
 | 
|---|
| 32 |  . S RETURN="0^Invalid Imaging Parent file."
 | 
|---|
| 33 |  S MCFILE=MAGMFILE
 | 
|---|
| 34 |  S OK=$$VALID^MCUIMAG0(MAGMFILE,MAGMFIEN,MAGDFN,MAGPROC)
 | 
|---|
| 35 |  I 'OK S RETURN=OK Q
 | 
|---|
| 36 |  ;
 | 
|---|
| 37 |  S MAGID=$$TYPE(MAGMFILE)
 | 
|---|
| 38 |  S RETURN="1^DICOM ID: "_MAGID_"-"_MAGMFIEN
 | 
|---|
| 39 |  Q
 | 
|---|
| 40 | TYPE(FILE) ;Set the id code for the Medicine file
 | 
|---|
| 41 |  ; If we add addtl. Medicine files, the following will need to be chgd.
 | 
|---|
| 42 |  N MAGCODE
 | 
|---|
| 43 |  S MAGCODE="unknown"
 | 
|---|
| 44 |  I 'FILE Q MAGCODE
 | 
|---|
| 45 |  S MAGCODE=$S(FILE=691:"EC",FILE=691.1:"CC",FILE=691.5:"EL",FILE=694:"HE",FILE=699:"EN",1:"GM")
 | 
|---|
| 46 |  Q MAGCODE
 | 
|---|
| 47 | FILE(CODE) ;Set the file number according to the Medicine id file code
 | 
|---|
| 48 |  ; If we add addtl. Medicine files, the following will need to be chgd.
 | 
|---|
| 49 |  ; Default is the Generalized Procedure/Consult Medicine file.
 | 
|---|
| 50 |  N MAGFILE
 | 
|---|
| 51 |  I '$D(CODE) Q 0
 | 
|---|
| 52 |  S MAGFILE=$S(CODE="EC":691,CODE="CC":691.1,CODE="EL":691.5,CODE="HE":694,CODE="EN":699,1:699.5)
 | 
|---|
| 53 |  Q MAGFILE
 | 
|---|