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

MAGGA02A.m

Go to the documentation of this file.
  1. MAGGA02A ;WOIFO/SG/NST - REMOTE PROCEDURES FOR IMAGE PROPERTIES ; 24 Sep 2010 8:23 AM
  1. ;;3.0;IMAGING;**93,117**;Mar 19, 2002;Build 2238;Jul 15, 2011
  1. ;; Per VHA Directive 2004-038, this routine should not be modified.
  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. ;; | 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. Q
  1. ;
  1. IPDEFS ;+++++ DEFINITIONS OF PROPERTIES FOR IMAGE FILE (#2005)
  1. ;;==================================================================
  1. ;;| Parameter | File |Field|Type |Flags| Comment |
  1. ;;|------------+-------+-----+-----+-----+-------------------------|
  1. ;;|CAPTAPP |2005 | 8.1 | S | R | CAPTURE APPLICATION |
  1. ;;|CRTNDT |2005 | 110 | D | RW | CREATION DATE |
  1. ;;|DTSAVED |2005 | 7 | D | R | DATE/TIME IMAGE SAVED |
  1. ;;|GDESC |2005 | 10 | | RW | SHORT DESCRIPTION |
  1. ;;|IDFN |2005 | 5 | P | R | PATIENT |
  1. ;;|ISTAT |2005 |113 | S | RW | STATUS |
  1. ;;|ISTATBY |2005 |113.2| P | R | STATUS BY |
  1. ;;|ISTATDT |2005 |113.1| D | R | STATUS DATE |
  1. ;;|ISTATRSN |2005 |113.3| P | RW | STATUS REASON |
  1. ;;|IXCLASS | | | P | R | CLASS INDEX |
  1. ;;|IXORIGIN |2005 | 45 | S | RW | ORIGIN INDEX |
  1. ;;|IXPKG |2005 | 40 | S | RW | PACKAGE INDEX |
  1. ;;|IXPROC |2005 | 43 | P | RW | PROC/EVENT INDEX |
  1. ;;|IXSPEC |2005 | 44 | P | RW | SPEC/SUBSPEC INDEX |
  1. ;;|IXTYPE |2005 | 42 | P | RW | TYPE INDEX |
  1. ;;|LDESCR |2005 | 11 | W | R | LONG DESCRIPTION |
  1. ;;|OBJNAME |2005 | .01 | | R | OBJECT NAME |
  1. ;;|OBJTYPE |2005 | 3 | P | R | OBJECT TYPE |
  1. ;;|PARDF |2005 | 16 | P | RW | PARENT DATA FILE# |
  1. ;;|PARGRD0 |2005 | 17 | | RW | PARENT GLOBAL ROOT D0 |
  1. ;;|PARGRD1 |2005 | 63 | | RW | PARENT GLOBAL ROOT D1 |
  1. ;;|PARIPTR |2005 | 18 | | RW | PARENT...IMAGE POINTER |
  1. ;;|PROC |2005 | 6 | | RW | PROCEDURE |
  1. ;;|PROCDT |2005 | 15 | D | RW | PROCEDURE/EXAM DATE/TIME|
  1. ;;|SAVEDBY |2005 | 8 | P | R | IMAGE SAVE BY |
  1. ;;|SENSBY |2005 |112.2| P | R | CONTROLLED BY |
  1. ;;|SENSDT |2005 |112.1| D | R | CONTROLLED DATE |
  1. ;;|SENSIMG |2005 |112 | S | RW | CONTROLLED IMAGE |
  1. ;;==================================================================
  1. ;
  1. ; Custom Flags:
  1. ; R Image property can be read
  1. ; W Image property can be modified
  1. ;
  1. Q
  1. ;
  1. IPDEFS1 ;+++++ DEFINITIONS OF PROPERTIES FOR IMAGE AUDIT FILE (#2005.1)
  1. ;;==================================================================
  1. ;;| Parameter | File |Field|Type |Flags| Comment |
  1. ;;|------------+-------+-----+-----+-----+-------------------------|
  1. ;;|CAPTAPP |2005.1 | 8.1 | S | R | CAPTURE APPLICATION |
  1. ;;|CRTNDT |2005.1 | 110 | D | R | CREATION DATE |
  1. ;;|DTSAVED |2005.1 | 7 | D | R | DATE/TIME IMAGE SAVED |
  1. ;;|GDESC |2005.1 | 10 | | R | SHORT DESCRIPTION |
  1. ;;|IDFN |2005.1 | 5 | P | R | PATIENT |
  1. ;;|ISTAT |2005.1 |113 | S | R | STATUS |
  1. ;;|ISTATBY |2005.1 |113.2| P | R | STATUS BY |
  1. ;;|ISTATDT |2005.1 |113.1| D | R | STATUS DATE |
  1. ;;|ISTATRSN |2005.1 |113.3| P | R | STATUS REASON |
  1. ;;|IXCLASS | | | P | R | CLASS INDEX |
  1. ;;|IXORIGIN |2005.1 | 45 | S | R | ORIGIN INDEX |
  1. ;;|IXPKG |2005.1 | 40 | S | R | PACKAGE INDEX |
  1. ;;|IXPROC |2005.1 | 43 | P | R | PROC/EVENT INDEX |
  1. ;;|IXSPEC |2005.1 | 44 | P | R | SPEC/SUBSPEC INDEX |
  1. ;;|IXTYPE |2005.1 | 42 | P | R | TYPE INDEX |
  1. ;;|LDESCR |2005.1 | 11 | W | R | LONG DESCRIPTION |
  1. ;;|OBJNAME |2005.1 | .01 | | R | OBJECT NAME |
  1. ;;|OBJTYPE |2005.1 | 3 | P | R | OBJECT TYPE |
  1. ;;|PARDF |2005.1 | 16 | P | R | PARENT DATA FILE# |
  1. ;;|PARGRD0 |2005.1 | 17 | | R | PARENT GLOBAL ROOT D0 |
  1. ;;|PARGRD1 |2005.1 | 63 | | R | PARENT GLOBAL ROOT D1 |
  1. ;;|PARIPTR |2005.1 | 18 | | R | PARENT...IMAGE POINTER |
  1. ;;|PROC |2005.1 | 6 | | R | PROCEDURE |
  1. ;;|PROCDT |2005.1 | 15 | D | R | PROCEDURE/EXAM DATE/TIME|
  1. ;;|SAVEDBY |2005.1 | 8 | P | R | IMAGE SAVE BY |
  1. ;;|SENSBY |2005.1 |112.2| P | R | CONTROLLED BY |
  1. ;;|SENSDT |2005.1 |112.1| D | R | CONTROLLED DATE |
  1. ;;|SENSIMG |2005.1 |112 | S | R | CONTROLLED IMAGE |
  1. ;;==================================================================
  1. ;
  1. ; Custom Flags:
  1. ; R Image property can be read
  1. ; W Image property can be modified
  1. ;
  1. Q
  1. ;
  1. ;+++++ COMPUTES THE VALUE OF THE IMAGE CLASS PROPERTY
  1. ;
  1. ; IMGFILE Image file number
  1. ;
  1. ; IENS IENS of the image record
  1. ;
  1. ; TPIENS IEN or IENS of the Image Type record in the
  1. ; IMAGE INDEX FOR TYPES file (#2005.83). If this
  1. ; parameter is not greater than 0, then the IEN is
  1. ; loaded from the image record referenced by the
  1. ; IMGFILE and IENS parameters.
  1. ;
  1. ; FLAGS Flags that control the execution (can be combined):
  1. ;
  1. ; E Return external value
  1. ;
  1. ; I Return internal value
  1. ;
  1. ; Return Values
  1. ; =============
  1. ; <0 Error descriptor (see $$ERROR^MAGUERR)
  1. ; 0 Class value is not available
  1. ; ... Property record (for the result array)
  1. ;
  1. ; Notes
  1. ; =====
  1. ;
  1. ; This is an internal entry point. Do not call it from outside
  1. ; of the MAGGA02* routines.
  1. ;
  1. IXCLASS(IMGFILE,IENS,TPIENS,FLAGS) ;
  1. N MAGBUF1,MAGMSG,RC,TMP
  1. S RC=0
  1. ;--- If the Type Index IEN is not provided,
  1. ;--- then get it form the image record
  1. I TPIENS'>0 D Q:(RC<0)!(TPIENS'>0) RC
  1. . S TPIENS=$$GET1^DIQ(IMGFILE,IENS,42,"I",,"MAGMSG")
  1. . S:$G(DIERR) RC=$$DBS^MAGUERR("MAGMSG",IMGFILE,IENS)
  1. . Q
  1. S TPIENS=(+TPIENS)_","
  1. ;--- Load the Image Class value(s)
  1. S TMP=$$TRFLAGS^MAGUTL05(FLAGS,"EI")
  1. D GETS^DIQ(2005.83,TPIENS,1,TMP,"MAGBUF1","MAGMSG")
  1. Q:$G(DIERR) $$DBS^MAGUERR("MAGMSG",2005.83,TPIENS)
  1. ;--- Store the property value(s) to the result array
  1. S TMP="IXCLASS"_U
  1. S:FLAGS["I" TMP=TMP_U_MAGBUF1(2005.83,TPIENS,1,"I")
  1. S:FLAGS["E" TMP=TMP_U_MAGBUF1(2005.83,TPIENS,1,"E")
  1. Q TMP
  1. ;
  1. ;+++++ REPLICATES THE CHANGES FOR A GROUP OF 1 IMAGE
  1. ;
  1. ; IMGIEN IEN of the image record in the IMAGE file (#2005)
  1. ;
  1. ; .MAGFDA FDA array with new data
  1. ;
  1. ; Return Values
  1. ; =============
  1. ; <0 Error descriptor (see the $$ERROR^MAGUERR)
  1. ; 0 Replication is not needed
  1. ; >0 IEN of the destination record for replication
  1. ;
  1. REPLIC(IMGIEN,MAGFDA) ;
  1. N CNT,FIELD,IENS,IENS1,IMGIEN1
  1. ;
  1. ;=== Check if the data replication is needed
  1. S IMGIEN1=$$GRPIEN^MAGGI12(IMGIEN) Q:IMGIEN1<0 IMGIEN1
  1. I IMGIEN1>0 D Q:CNT<0 CNT Q:+CNT'=1 0
  1. . ;--- Check if the IMGIEN references the only "child" of a group
  1. . S CNT=$$GRPCT^MAGGI14(IMGIEN1)
  1. . Q
  1. E D Q:IMGIEN1'>0 IMGIEN1
  1. . ;--- Check if the IMGIEN references a group of 1 child
  1. . S CNT=$$GRPCT^MAGGI14(IMGIEN)
  1. . I CNT<0 S IMGIEN1=CNT Q
  1. . S IMGIEN1=$S(+CNT=1:$$GRPCH1^MAGGI14(IMGIEN,"E"),1:0)
  1. . Q
  1. ;
  1. ;=== Prepare the data for replication
  1. S IENS=IMGIEN_",",IENS1=IMGIEN1_","
  1. F FIELD=10,42,43,44,45,110,112,113,113.3 D
  1. . Q:'$D(MAGFDA(2005,IENS,FIELD))
  1. . S MAGFDA(2005,IENS1,FIELD)=MAGFDA(2005,IENS,FIELD)
  1. . Q
  1. ;---
  1. Q IMGIEN1
  1. ;
  1. ;+++++ Change the STATUS of the first image in the Group
  1. ;
  1. ; IMGIEN IEN of the image record in the IMAGE file (#2005)
  1. ;
  1. ; .MAGFDA FDA array with new data
  1. ;
  1. ; Return Values
  1. ; =============
  1. ; <0 Error descriptor (see the $$ERROR^MAGUERR)
  1. ; 0 Modification is not needed
  1. ; >0 IEN of the first child
  1. ;
  1. STATUS1(IMGIEN,MAGFDA) ;
  1. N IMGIEN1,IENS,IENS1,FOUND,FIELD
  1. S IENS=IMGIEN_","
  1. S FOUND=0
  1. ; 113 STATUS, 113.3 STATUS REASON
  1. F FIELD=113,113.3 I $D(MAGFDA(2005,IENS,FIELD)) S FOUND=1 Q
  1. Q:'FOUND 0 ; A field is not in the array
  1. S IMGIEN1=$$GRPCH1^MAGGI14(IMGIEN,"E") ; First child in the group
  1. I IMGIEN1'>0 Q IMGIEN1
  1. ;
  1. ;=== Set STATUS on first child and delete the group from FDA array
  1. S IENS1=IMGIEN1_","
  1. F FIELD=113,113.3 D
  1. . Q:'$D(MAGFDA(2005,IENS,FIELD))
  1. . S MAGFDA(2005,IENS1,FIELD)=MAGFDA(2005,IENS,FIELD)
  1. . K MAGFDA(2005,IENS,FIELD)
  1. . Q
  1. Q IMGIEN1