Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MAGSDEL2

MAGSDEL2.m

Go to the documentation of this file.
  1. MAGSDEL2 ;WOIFO/SRR/RED - Delete parent pointers ; [ 06/20/2001 08:57 ]
  1. ;;3.0;IMAGING;**10**;Nov 06, 2003
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. DELPAR ; delete parent pointers
  1. I '$D(^MAG(2005,MAGIEN,2)) S DELMSG="Image IEN doesn't Exist in Image File" G ERROR
  1. S MAGTMP=^MAG(2005,MAGIEN,2),MAGSTORE=$P(MAGTMP,"^",6)_":"_$P(MAGTMP,"^",7)_":"_$P(MAGTMP,"^",8)_":"_$P(MAGTMP,"^",10)
  1. S MAGPARRT=$P(MAGTMP,"^",6) I MAGPARRT="" G EXIT ;No parent pointer
  1. I '$D(^MAG(2005.03,MAGPARRT,0)) S DELMSG="Image Entry has INVALID Pointer to Imaging Parent Data File " G ERROR
  1. S MAGPAR=^MAG(2005.03,MAGPARRT,0)
  1. S MAGTYP=$P(MAGPAR,"^",3)
  1. S MAGPARRT=$P(MAGPAR,"^",4) I MAGPARRT="" S DELMSG="Parent Data File entry is missing field 'File Pointer'" G ERROR
  1. S DA=$P(MAGTMP,"^",8) ;G:DA="" ERROR
  1. ; /GEK added next 2 lines, comment out G:DA in line above
  1. ; this will catch PACS images that don't send IEN of the 2005 Multiple
  1. ; in the parent file.
  1. N MAGRT,MAGROOT
  1. I 'DA,MAGPARRT[2006.5839 S DA=123
  1. ; Setting DA to 123 is for the DICOM TEMP file.
  1. I 'DA D GETDA^MAGSDEL4(MAGPARRT,$P(MAGTMP,"^",7),MAGIEN,.DA)
  1. I 'DA I '$P(^MAG(2005,MAGIEN,0),"^",10) D G ERROR
  1. . S DELMSG="Image entry invalid field: PARENT DATA FILE IMAGE POINTER"
  1. I 'DA I $P(^MAG(2005,MAGIEN,0),"^",10) G EXIT
  1. ;G:'DA ERROR
  1. D FILE^DID(MAGPARRT,"","GLOBAL NAME","MAGRT")
  1. S MAGROOT=$G(MAGRT("GLOBAL NAME")) Q:MAGROOT=""
  1. I MAGTYP<3 S DA(1)=$P(MAGTMP,"^",7),DIK=MAGROOT_DA(1)_",2005," K DA(2) G CHECK
  1. S DA(2)=$P(MAGTMP,"^",7),DA(1)=$P(MAGTMP,"^",10)
  1. S DIK=MAGROOT_DA(2)_","""_$E($P(MAGPAR,"^",2),1,2)_""","_DA(1)_","_2005_","
  1. CHECK I DIK'["^" S DELMSG="Can't resolve 'DIK' Global Node. " G ERROR
  1. ;I $D(MAGVERB) W !,"Ready to delete ",DIK,DA R !,"ok? ",ANS:DTIME Q:ANS="N"
  1. ;if medicine, call medicine api
  1. I MAGPARRT>690,MAGPARRT<705 G DELMED
  1. ;if TIU goto call TIU api
  1. I MAGPARRT=8925 G DELTIU
  1. ;if lab, call lab api
  1. I MAGPARRT["63" G DELLAB
  1. I MAGPARRT["2006.5839" G DELHCP
  1. D ^DIK
  1. I $D(MAGVERB) W !,"Parent pointer deleted from ",$P(MAGPAR,"^",1),"..."
  1. EXIT K DA,DA(1),DIK,DA(2) Q
  1. DELMED ;
  1. D KILL^MCUIMAG0(MAGPARRT,DA(1),DA,.MAGSTAT)
  1. I +MAGSTAT=1 G EXIT
  1. E S DELMSG="Error calling Medicine Routine to Delete Pointer." G ERROR
  1. Q
  1. DELTIU ; Delete the TIU pointers
  1. Q:$P(^MAG(2005,MAGIEN,0),"^",10)
  1. ; Quit if image is a child of a group.
  1. D DELIMAGE^TIUSRVPL(.MAGY,DA(1),MAGIEN)
  1. I 'MAGY S DELMSG="Error calling TIU API : "_$P(MAGY,"^",2) G ERROR
  1. G EXIT
  1. DELLAB ; delete lab pointer entries
  1. D EN^MAGSDEL3(MAGIEN,.MAGRES)
  1. I '+MAGRES S DELMSG="Error calling Lab Routine to Delete Pointer." G ERROR
  1. Q
  1. DELHCP ;Delete the DICOM GMRC TEMP file entry pointers
  1. D DCMTEMP^MAGSDHCP(.MAGY,MAGIEN)
  1. I '+MAGY S DELMSG=$G(MAGY(0)) G ERROR
  1. G EXIT
  1. ERROR I $D(MAGVERB) W !,"The backwards pointers are not correct. Image pointers cannot be removed from parent file."
  1. S MAGERR=1 G EXIT