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

PXRMP45D.m

Go to the documentation of this file.
PXRMP45D ;ISP/AGP - PATCH 45 DIALOG CONVERSION ;10/16/2019
 ;;2.0;CLINICAL REMINDERS;**45**;Feb 04, 2005;Build 566
 Q
 ;
DELETE(ARRAY) ;
 N FIELD,FDA,IEN,MSG
 S IEN=0 F  S IEN=$O(^XTMP(PXRMXTMP,IEN)) Q:IEN'>0  D
 .K FDA
 .S IENS=IEN_","
 .F FIELD=116,117,118 S FDA(801.41,IENS,FIELD)="@"
 .I $D(FDA) D FILE^DIE("","FDA","MSG")
 .I $D(MSG) D AWRITE^PXRMUTIL("MSG")
 .K ^PXRMD(801.41,IEN,49)
 Q
 ;
GTDIALOG ;
 N DARRAY,IEN,NAME,NODE,TEXT
 S IEN=0 F  S IEN=$O(^PXRMD(801.41,IEN)) Q:IEN'>0  D
 .S NAME=$P($G(^PXRMD(801.41,IEN,0)),U)
 .S NODE=$G(^PXRMD(801.41,IEN,49))
 .I $P(NODE,U)'>0 Q
 .S DARRAY(IEN)=""
 .I $P(NODE,U,2)>1!($P(NODE,U,2)<0)!($L($P(NODE,U,2))>1) D  Q
 ..S TEXT(1)="Branching Logic node for dialog definition: "_NAME
 ..S TEXT(2)="is not defined correctly. This dialog definition will not be converted."
 ..S TEXT(3)="Node is defined as: "_NODE
 ..D MES^XPDUTL(.TEXT)
 .S ^XTMP(PXRMXTMP,IEN)=NODE
 .S ^XTMP(PXRMXTMP,IEN,"DONE")=0
 D DELETE(.DARRAY)
 Q
 ;
PRE ;
 D MES^XPDUTL("  Copying Reminder dialogs with branching logic to a ^XTMP global...")
 N PXRMXTMP,PXRMSKIP,PXRMGTMP
 S PXRMXTMP="PXRM DIALOG CONVERSION"
 K ^XTMP(PXRMXTMP)
 S ^XTMP(PXRMXTMP,0)=$$FMADD^XLFDT(DT,30)_U_DT_U_"PXRM Patch 45 Dialog Conversion"
 D GTDIALOG
 D MES^XPDUTL("    DONE")
 Q
 ;
POST ;
 N PXRMXTMP
 S PXRMXTMP="PXRM DIALOG CONVERSION"
 D STDIALOG
 Q
 ;
REBUILD ;
 N DA,I,DIK
 D BMES^XPDUTL("  Reindexing component multiple in file #801.41...")
 ;S DIK="^PXRMD(801.41,"
 S I=0 F  S I=$O(^PXRMD(801.41,I)) Q:I'>0  D
 .S DA(1)=I,DIK="^PXRMD(801.41,"_DA(1)_",10,"
 .S DA=0 F  S DA=$O(^PXRMD(801.41,I,10,DA)) Q:DA'>0  D
 ..D IX^DIK
 D MES^XPDUTL("  DONE")
 Q
 ;
RESCIND ;
 N DA,DIE,DISABLE,DR,PXRMINST
 S PXRMINST=1
 S DA=$O(^PXD(811.9,"B","VA-WH MAMMOGRAM REVIEW RESULTS",""))
 I DA>0 D
 .S DISABLE=1
 .D MES^XPDUTL("Rescinding Reminder Defintion VA-WH MAMMOGRAM REVIEW RESULTS")
 .D RENAME^PXRMUTIL(811.9,"VA-WH MAMMOGRAM REVIEW RESULTS","ZZ VA-WH MAMMOGRAM REVIEW RESULTS")
 .S DIE="^PXD(811.9,",DR="1.6///^S X=DISABLE;69///^S X=DT"
 .D ^DIE
 ;
 K DA
 S DA=$O(^PXRMD(801.41,"B","VA-WH MAMMOGRAM REVIEW RESULTS",""))
 I DA>0 D
 .S DISABLE=2
 .D MES^XPDUTL("Rescinding Reminder Dialog VA-WH MAMMOGRAM REVIEW RESULTS")
 .D RENAME^PXRMUTIL(801.41,"VA-WH MAMMOGRAM REVIEW RESULTS","ZZ VA-WH MAMMOGRAM REVIEW RESULTS")
 .S DIE="^PXRMD(801.41,",DR="3///^S X=DISABLE"
 .D ^DIE
 Q
STDIALOG ;
 N IEN,NODE
 D BMES^XPDUTL("  Updating Reminder Dialogs...")
 S IEN=0 F  S IEN=$O(^XTMP(PXRMXTMP,IEN)) Q:IEN'>0  D
 .S NODE=$G(^XTMP(PXRMXTMP,IEN))
 .D UPDATE(IEN,NODE)
 D MES^XPDUTL("  DONE")
 Q
 ;
UPDATE(DIEN,NODE) ;
 N ACTION,EVALSTAT,FDA,IENS,MSG,NAME,RNAME,TEXT,TNAME
 S RNAME="",ACTION="H"
 S NAME=$P(^PXRMD(801.41,DIEN,0),U)
 S TNAME=$P($G(^PXRMD(811.5,$P(NODE,U),0)),U)
 S EVALSTAT=$S($P(NODE,U,2)=1:"T",1:"F")
 I $P(NODE,U,3)>0 S RNAME=$P($G(^PXRMD(801.41,$P(NODE,U,3),0)),U),ACTION="R"
 I TNAME="" D  Q
 .S TEXT(1)="Dialog Definition: "_NAME_"does not"
 .S TEXT(2)="have a valid Reminder Term assigned. This dialog definition will not be converted."
 .S TEXT(3)="Node is defined as: "_NODE
 .D MES^XPDUTL(.TEXT)
 S IENS="?+2,"_DIEN_","
 S FDA(801.41143,IENS,.01)=1
 S FDA(801.41143,IENS,1)="TM."_TNAME
 S FDA(801.41143,IENS,2)=EVALSTAT
 S FDA(801.41143,IENS,3)=ACTION
 I RNAME'="" S FDA(801.41143,IENS,4)=RNAME
 D MES^XPDUTL("  Updating dialog: "_NAME)
 D UPDATE^DIE("E","FDA","","MSG")
 I '$D(MSG) S ^XTMP(PXRMXTMP,DIEN,"DONE")=1
 I $D(MSG) D AWRITE^PXRMUTIL("MSG")
 Q
 ;
CLEANUP ;
 N IEN,NODE
 S PXRMXTMP="PXRM DIALOG CONVERSION"
 S IEN=0 F  S IEN=$O(^XTMP(PXRMXTMP,IEN)) Q:IEN'>0  D
 .;D CLEAND(IEN)
 .K ^PXRMD(801.41,IEN,"BL")
 Q
 ;
CLEAND(IEN) ;
 S NODE=$G(^XTMP(PXRMXTMP,IEN))
 I $P(NODE,U,3)>0 W !,"Skipping IEN: "_IEN Q
 I $G(^PXRMD(801.41,IEN,"BL",1,0))="" Q
 S $P(^PXRMD(801.41,IEN,"BL",1,0),U,4)="H"
 W !,"Upated IEN: "_IEN_"  "_^PXRMD(801.41,IEN,"BL",1,0)
 Q