| 1 | MAGGSIU2 ;WOIFO/GEK - Utilities for Image Add/Modify ; [ 12/27/2000 10:49 ]
 | 
|---|
| 2 |  ;;3.0;IMAGING;**7,8,85,59**;Nov 27, 2007;Build 20
 | 
|---|
| 3 |  ;;Per VHA Directive 2004-038, this routine should not be modified.
 | 
|---|
| 4 |  ;; +---------------------------------------------------------------+
 | 
|---|
| 5 |  ;; | Property of the US Government.                                |
 | 
|---|
| 6 |  ;; | No permission to copy or redistribute this software is given. |
 | 
|---|
| 7 |  ;; | Use of unreleased versions of this software requires the user |
 | 
|---|
| 8 |  ;; | to execute a written test agreement with the VistA Imaging    |
 | 
|---|
| 9 |  ;; | Development Office of the Department of Veterans Affairs,     |
 | 
|---|
| 10 |  ;; | telephone (301) 734-0100.                                     |
 | 
|---|
| 11 |  ;; |                                                               |
 | 
|---|
| 12 |  ;; | The Food and Drug Administration classifies this software as  |
 | 
|---|
| 13 |  ;; | a medical device.  As such, it may not be changed in any way. |
 | 
|---|
| 14 |  ;; | Modifications to this software may result in an adulterated   |
 | 
|---|
| 15 |  ;; | medical device under 21CFR820, the use of which is considered |
 | 
|---|
| 16 |  ;; | to be a violation of US Federal Statutes.                     |
 | 
|---|
| 17 |  ;; +---------------------------------------------------------------+
 | 
|---|
| 18 |  ;;
 | 
|---|
| 19 |  Q
 | 
|---|
| 20 | MAKEFDA(MAGGFDA,MAGARRAY,MAGACT,MAGCHLD,MAGGRP,MAGGWP) ;
 | 
|---|
| 21 |  ;  Create the FileMan FDA Array
 | 
|---|
| 22 |  ;  Create Imaging Action Codes Array (for Pre and Post processing)
 | 
|---|
| 23 |  N MAGGFLD,MAGGDAT,GRPCT,WPCT,Z
 | 
|---|
| 24 |  S Z="" F  S Z=$O(MAGARRAY(Z)) Q:Z=""  D  I $L(MAGERR) Q
 | 
|---|
| 25 |  . S MAGGFLD=$P(MAGARRAY(Z),U,1),MAGGDAT=$P(MAGARRAY(Z),U,2,99)
 | 
|---|
| 26 |  . ;  If this entry is one of the action codes, store it in the action array.
 | 
|---|
| 27 |  . I $$ACTCODE^MAGGSIV(MAGGFLD) S MAGACT(MAGGFLD)=MAGGDAT Q
 | 
|---|
| 28 |  . ;
 | 
|---|
| 29 |  . ; If we are Creating a Group Entry, add any Images that are to be members of this group.
 | 
|---|
| 30 |  . I MAGGFLD=2005.04 D  Q
 | 
|---|
| 31 |  . . S MAGGRP=1
 | 
|---|
| 32 |  . . I '+MAGGDAT Q  ; making a group entry, with no group entries yet. This is OK.
 | 
|---|
| 33 |  . . S MAGCHLD(MAGGDAT)=""
 | 
|---|
| 34 |  . . S GRPCT=GRPCT+1
 | 
|---|
| 35 |  . . S MAGGFDA(2005.04,"+"_GRPCT_",+1,",.01)=MAGGDAT
 | 
|---|
| 36 |  . ;
 | 
|---|
| 37 |  . ; if we are getting a WP for Long Desc, set array to pass.
 | 
|---|
| 38 |  . I MAGGFLD=11 D  ; this is one line of the WP Long Desc field.
 | 
|---|
| 39 |  . . S WPCT=WPCT+1,MAGGWP(WPCT)=MAGGDAT
 | 
|---|
| 40 |  . . S MAGGFDA(2005,"+1,",11)="MAGGWP"
 | 
|---|
| 41 |  . ;  Set the Node for the UPDATE^DIC Call.
 | 
|---|
| 42 |  . S MAGGFDA(2005,"+1,",MAGGFLD)=MAGGDAT
 | 
|---|
| 43 |  . Q
 | 
|---|
| 44 |  ; Patch 8.  Special processing for field 107 (ACQUISITION DEVICE)
 | 
|---|
| 45 |  ;  We'll change any MAGGFDA(2005,"+1,",107) to MAGACT("ACQD")
 | 
|---|
| 46 |  ;  This way the PRE processing of the array will check and create a new
 | 
|---|
| 47 |  ;  ACQUISITION DEVICE file entry, if needed. 
 | 
|---|
| 48 |  I $D(MAGACT("107")) S MAGACT("ACQD")=MAGACT("107") K MAGACT("107")
 | 
|---|
| 49 |  I $D(MAGGFDA(2005,"+1,",107)) S MAGACT("ACQD")=MAGGFDA(2005,"+1,",107) K MAGGFDA(2005,"+1,",107)
 | 
|---|
| 50 |  Q
 | 
|---|
| 51 | REQPARAM() ;Do required parameters have values. Called from MAGGSIUI
 | 
|---|
| 52 |  ; VARIABLES ARE SET AND KILLED IN THAT ROUTINE.  
 | 
|---|
| 53 |  N CT
 | 
|---|
| 54 |  S CT=0
 | 
|---|
| 55 |  S MAGRY(0)="1^Checking for Required parameter values..."
 | 
|---|
| 56 |  I IDFN="" S CT=CT+1,MAGRY(CT)="DFN is Required. !"
 | 
|---|
| 57 |  I '$D(IMAGES),'CMTH S CT=CT+1,MAGRY(CT)="List of Images is Required. !"
 | 
|---|
| 58 |  ;
 | 
|---|
| 59 |  I (PXPKG=""),(DOCCTG=""),(IXTYPE="") S CT=CT+1,MAGRY(CT)="Procedure or Category or Index Type is Required. !"
 | 
|---|
| 60 |  I (PXPKG'=""),(DOCCTG'="") S CT=CT+1,MAGRY(CT)="Procedure OR Document Category. Not BOTH. !"
 | 
|---|
| 61 |  ;
 | 
|---|
| 62 |  I (PXPKG'=""),(PXIEN="") S CT=CT+1,MAGRY(CT)="Procedure IEN is Required. !"
 | 
|---|
| 63 |  I (PXPKG=""),(PXIEN'="") S CT=CT+1,MAGRY(CT)="Procedure Package is Required. !"
 | 
|---|
| 64 |  I (PXPKG'=""),(PXDT="") S CT=CT+1,MAGRY(CT)="Procedure Date is Required. !"
 | 
|---|
| 65 |  ;
 | 
|---|
| 66 |  ;Patch 8 index field check... could be using Patch 7 or Patch 8.
 | 
|---|
| 67 |  ;  We're this far, so either PXIEN or DOCCTG is defined
 | 
|---|
| 68 |  I (IXTYPE'=""),(DOCCTG'="") S CT=CT+1,MAGRY(CT)="Image Type OR Document Category. Not BOTH. !"
 | 
|---|
| 69 |  ; MAGGSIA computes PACKAGE #40 and CLASS #41 when adding an Image (2005) entry.
 | 
|---|
| 70 |  ;
 | 
|---|
| 71 |  I TRKID="" S CT=CT+1,MAGRY(CT)="Tracking ID is Required. !"
 | 
|---|
| 72 |  I ACQD="" S CT=CT+1,MAGRY(CT)="Acquisition Device is Required. !"
 | 
|---|
| 73 |  ;   ACQS ( could ? ) default to users institution i.e. DUZ(2)
 | 
|---|
| 74 |  I (ACQS="")&(ACQN="") S CT=CT+1,MAGRY(CT)="Acquisition Site IEN or Station Number is Required. !"
 | 
|---|
| 75 |  I (ACQS]"")&(ACQN]"") S CT=CT+1,MAGRY(CT)="Station IEN or Station Number, Not BOTH. !"
 | 
|---|
| 76 |  ;
 | 
|---|
| 77 |  I STSCB="" S CT=CT+1,MAGRY(CT)="Status Handler (TAG^ROUTINE) is Required. !"
 | 
|---|
| 78 |  ;
 | 
|---|
| 79 |  I (DOCCTG'=""),(DOCDT="") S CT=CT+1,MAGRY(CT)="Document Date is Required. !"
 | 
|---|
| 80 |  ;
 | 
|---|
| 81 |  I (CT>0) S MAGRY(0)="0^Required parameter is null" Q MAGRY(0)
 | 
|---|
| 82 |  ;Checks to stop Duplicate or incorrect Tracking ID's
 | 
|---|
| 83 |  ;  //TODO: ?? check the Queue File, is this Tracking ID already Queued.
 | 
|---|
| 84 |  I (TRKID'="") I $D(^MAG(2005,"ATRKID",TRKID)) S MAGRY(0)="0^Tracking ID Must be Unique !"
 | 
|---|
| 85 |  I (TRKID'="") I ($L(TRKID,";")<2) S MAGRY(0)="0^Tracking ID Must have "";"" Delimiter"
 | 
|---|
| 86 |  ;
 | 
|---|
| 87 |  Q MAGRY(0)
 | 
|---|