MAGIP183 ;WOIFO/PMK - Install code for MAG*3.0*183 ;12 Oct 2017 4:10 PM
 ;;3.0;IMAGING;**183**;Mar 19, 2002;Build 11
 ;; Per VHA Directive 2004-038, this routine should not be modified.
 ;; +---------------------------------------------------------------+
 ;; | Property of the US Government.                                |
 ;; | No permission to copy or redistribute this software is given. |
 ;; | Use of unreleased versions of this software requires the user |
 ;; | to execute a written test agreement with the VistA Imaging    |
 ;; | Development Office of the Department of Veterans Affairs,     |
 ;; | telephone (301) 734-0100.                                     |
 ;; | The Food and Drug Administration classifies this software as  |
 ;; | a medical device.  As such, it may not be changed in any way. |
 ;; | Modifications to this software may result in an adulterated   |
 ;; | medical device under 21CFR820, the use of which is considered |
 ;; | to be a violation of US Federal Statutes.                     |
 ;; +---------------------------------------------------------------+
 ;;
 ; There are no environment checks here but the MAGIP183 has to be
 ; referenced by the "Environment Check Routine" field of the KIDS
 ; build so that entry points of the routine are available to the
 ; KIDS during all installation phases.
 ; 
 ; Supported IA #1157 reference for $$ADD^XPDMENU function
 ; 
 Q
 ;
 ;+++++ INSTALLATION ERROR HANDLING
ERROR ;
 S:$D(XPDNM) XPDABORT=1
 ;--- Display the messages and store them to the INSTALL file
 D DUMP^MAGUERR1(),ABTMSG^MAGKIDS()
 Q
 ;
 ;
 ;
 ;***** PRE-INSTALL CODE
PRE ;
 Q
 ;
 ;
 ;
 ;***** POST-INSTALL CODE
POS ;
 N CALLBACK
 D CLEAR^MAGUERR(1)
 ;
 ;--- Various Updates
 I $$CP^MAGKIDS("MAG P183 UPDATE","$$UPDATE^"_$T(+0))<0  D ERROR  Q
 ;
 W !!!,"Setting DICOM Text Gateway to use Radiology HL7 V2.4 protocols -- PASS 1"
 D MAGIP183^MAGDHPS ; set the Radiology HL7 V2.4 for MAG SEND ORM/ORU
 W !!!,"Setting DICOM Text Gateway to use Radiology HL7 V2.4 protocols -- PASS 2"
 D MAGIP183^MAGDHPS ; run twice to remove any incorrect settings
 ;
 ;--- Send the notification e-mail
 D BMES^XPDUTL("Post Install Mail Message: "_$$FMTE^XLFDT($$NOW^XLFDT))
 D INS^MAGQBUT4(XPDNM,DUZ,$$NOW^XLFDT,XPDA)
 Q
 ;
UPDATE() ;
 ; This subroutine creates the MAGD PATHOLOGY entry in the
 ; HLO SUBSCRIPTION REGISTRY (file 779.4).
 D NEW7794 ; create new entry in file 779.4
 D UPDTMENU ; set display order for IHE menu option
 Q 0
 ;
NEW7794 ; create an entry in the HLO SUBSCRIPTION REGISTRY (file 779.4)
 N DESCRIPTION,NAME,OWNER
 ; create the MAGD PATHOLOGY entry
 S NAME="MAGD PATHOLOGY"
 S DESCRIPTION="Subscription list for anatomic pathology"
 S OWNER="MAGD (Imaging)"
 D NEW7794A(NAME,DESCRIPTION,OWNER)
 Q
 ;
NEW7794A(NAME,DESCRIPTION,OWNER) ; create the entry in file 779.4
 N DIC,DIERR,I,IENS,MAGERR,MAGFDA,MAGIENS,X,Y
 ;
 ; check to see if <NAME> already exists
 S DIC=779.4,DIC(0)="BX",X=NAME D ^DIC
 I Y>0 D  Q
 . D MES^MAGKIDS(""""_NAME_""" already exists in the HLO SUBSCRIPTION REGISTRY.")
 . Q
 D MES^MAGKIDS("Creating new """_NAME_""" HLO SUBSCRIPTION REGISTRY entry.")
 ;
 S IENS="+1,"
 S MAGFDA(779.4,IENS,.01)=NAME        ; NAME
 S MAGFDA(779.4,IENS,.02)=OWNER       ; OWNER
 S MAGFDA(779.4,IENS,.03)=DESCRIPTION ; DESCRIPTION
 D UPDATE^DIE("","MAGFDA","MAGIENS","MAGERR")
 I $D(DIERR) D  Q
 . D MES^MAGKIDS("Error in creating """_NAME_""" in the HLO SUBSCRIPTION REGISTRY.")
 . F I=1:1 Q:'$D(MAGERR("DIERR",1,"TEXT",I))  D
 . . D MES^MAGKIDS(MAGERR("DIERR",1,"TEXT",I))
 . . Q
 . Q
 Q 
 ;
 N MENU,MSG,OPTION,ORDER,SYNONYM,X
 S MENU="MAG HL7 MAINT"
 S OPTION="MAG CONFIGURE IHE PACS HL7 I/F"
 S SYNONYM="IHE"
 S ORDER=20 ; display order
 S MSG="Updating DISPLAY ORDER for "_SYNONYM_" on "_MENU_" menu -- "
 S X=$$ADD^XPDMENU(MENU,OPTION,SYNONYM,ORDER)
 I X>0 D
 . D MES^MAGKIDS(MSG_"SUCCESS.")
 . Q
 E  D
 . D MES^MAGKIDS(MSG_"FAILURE: """_$P(X,"^",2,999)_"""")
 . Q
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGIP183   4109     printed  Sep 23, 2025@19:40:47                                                                                                                                                                                                    Page 2
MAGIP183  ;WOIFO/PMK - Install code for MAG*3.0*183 ;12 Oct 2017 4:10 PM
 +1       ;;3.0;IMAGING;**183**;Mar 19, 2002;Build 11
 +2       ;; Per VHA Directive 2004-038, this routine should not be modified.
 +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      ;; | The Food and Drug Administration classifies this software as  |
 +11      ;; | a medical device.  As such, it may not be changed in any way. |
 +12      ;; | Modifications to this software may result in an adulterated   |
 +13      ;; | medical device under 21CFR820, the use of which is considered |
 +14      ;; | to be a violation of US Federal Statutes.                     |
 +15      ;; +---------------------------------------------------------------+
 +16      ;;
 +17      ; There are no environment checks here but the MAGIP183 has to be
 +18      ; referenced by the "Environment Check Routine" field of the KIDS
 +19      ; build so that entry points of the routine are available to the
 +20      ; KIDS during all installation phases.
 +21      ; 
 +22      ; Supported IA #1157 reference for $$ADD^XPDMENU function
 +23      ; 
 +24       QUIT 
 +25      ;
 +26      ;+++++ INSTALLATION ERROR HANDLING
ERROR     ;
 +1        if $DATA(XPDNM)
               SET XPDABORT=1
 +2       ;--- Display the messages and store them to the INSTALL file
 +3        DO DUMP^MAGUERR1()
           DO ABTMSG^MAGKIDS()
 +4        QUIT 
 +5       ;
 +6       ;
 +7       ;
 +8       ;***** PRE-INSTALL CODE
PRE       ;
 +1        QUIT 
 +2       ;
 +3       ;
 +4       ;
 +5       ;***** POST-INSTALL CODE
POS       ;
 +1        NEW CALLBACK
 +2        DO CLEAR^MAGUERR(1)
 +3       ;
 +4       ;--- Various Updates
 +5        IF $$CP^MAGKIDS("MAG P183 UPDATE","$$UPDATE^"_$TEXT(+0))<0
               DO ERROR
               QUIT 
 +6       ;
 +7        WRITE !!!,"Setting DICOM Text Gateway to use Radiology HL7 V2.4 protocols -- PASS 1"
 +8       ; set the Radiology HL7 V2.4 for MAG SEND ORM/ORU
           DO MAGIP183^MAGDHPS
 +9        WRITE !!!,"Setting DICOM Text Gateway to use Radiology HL7 V2.4 protocols -- PASS 2"
 +10      ; run twice to remove any incorrect settings
           DO MAGIP183^MAGDHPS
 +11      ;
 +12      ;--- Send the notification e-mail
 +13       DO BMES^XPDUTL("Post Install Mail Message: "_$$FMTE^XLFDT($$NOW^XLFDT))
 +14       DO INS^MAGQBUT4(XPDNM,DUZ,$$NOW^XLFDT,XPDA)
 +15       QUIT 
 +16      ;
UPDATE()  ;
 +1       ; This subroutine creates the MAGD PATHOLOGY entry in the
 +2       ; HLO SUBSCRIPTION REGISTRY (file 779.4).
 +3       ; create new entry in file 779.4
           DO NEW7794
 +4       ; set display order for IHE menu option
           DO UPDTMENU
 +5        QUIT 0
 +6       ;
NEW7794   ; create an entry in the HLO SUBSCRIPTION REGISTRY (file 779.4)
 +1        NEW DESCRIPTION,NAME,OWNER
 +2       ; create the MAGD PATHOLOGY entry
 +3        SET NAME="MAGD PATHOLOGY"
 +4        SET DESCRIPTION="Subscription list for anatomic pathology"
 +5        SET OWNER="MAGD (Imaging)"
 +6        DO NEW7794A(NAME,DESCRIPTION,OWNER)
 +7        QUIT 
 +8       ;
NEW7794A(NAME,DESCRIPTION,OWNER) ; create the entry in file 779.4
 +1        NEW DIC,DIERR,I,IENS,MAGERR,MAGFDA,MAGIENS,X,Y
 +2       ;
 +3       ; check to see if <NAME> already exists
 +4        SET DIC=779.4
           SET DIC(0)="BX"
           SET X=NAME
           DO ^DIC
 +5        IF Y>0
               Begin DoDot:1
 +6                DO MES^MAGKIDS(""""_NAME_""" already exists in the HLO SUBSCRIPTION REGISTRY.")
 +7                QUIT 
               End DoDot:1
               QUIT 
 +8        DO MES^MAGKIDS("Creating new """_NAME_""" HLO SUBSCRIPTION REGISTRY entry.")
 +9       ;
 +10       SET IENS="+1,"
 +11      ; NAME
           SET MAGFDA(779.4,IENS,.01)=NAME
 +12      ; OWNER
           SET MAGFDA(779.4,IENS,.02)=OWNER
 +13      ; DESCRIPTION
           SET MAGFDA(779.4,IENS,.03)=DESCRIPTION
 +14       DO UPDATE^DIE("","MAGFDA","MAGIENS","MAGERR")
 +15       IF $DATA(DIERR)
               Begin DoDot:1
 +16               DO MES^MAGKIDS("Error in creating """_NAME_""" in the HLO SUBSCRIPTION REGISTRY.")
 +17               FOR I=1:1
                       if '$DATA(MAGERR("DIERR",1,"TEXT",I))
                           QUIT 
                       Begin DoDot:2
 +18                       DO MES^MAGKIDS(MAGERR("DIERR",1,"TEXT",I))
 +19                       QUIT 
                       End DoDot:2
 +20               QUIT 
               End DoDot:1
               QUIT 
 +21       QUIT 
 +22      ;
 +1        NEW MENU,MSG,OPTION,ORDER,SYNONYM,X
 +2        SET MENU="MAG HL7 MAINT"
 +3        SET OPTION="MAG CONFIGURE IHE PACS HL7 I/F"
 +4        SET SYNONYM="IHE"
 +5       ; display order
           SET ORDER=20
 +6        SET MSG="Updating DISPLAY ORDER for "_SYNONYM_" on "_MENU_" menu -- "
 +7        SET X=$$ADD^XPDMENU(MENU,OPTION,SYNONYM,ORDER)
 +8        IF X>0
               Begin DoDot:1
 +9                DO MES^MAGKIDS(MSG_"SUCCESS.")
 +10               QUIT 
               End DoDot:1
 +11      IF '$TEST
               Begin DoDot:1
 +12               DO MES^MAGKIDS(MSG_"FAILURE: """_$PIECE(X,"^",2,999)_"""")
 +13               QUIT 
               End DoDot:1
 +14       QUIT