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

SD686PST.m

Go to the documentation of this file.
  1. SD686PST ; ALB/SAT - SD*5.3*686 POST-INSTALL ;
  1. ;;5.3;Scheduling;**686**;Aug 13, 1993;Build 53
  1. ;;Per VHA Directive 2004-038, this routine should not be modified
  1. ;
  1. ; Post-install routine for patch 686. Identifies data errors in scheduling request files (#403.5, 409.3, 123, 409.85).
  1. ;
  1. D EXECUTE ;
  1. D AD
  1. Q
  1. ;
  1. EXECUTE ;
  1. ;
  1. K ^TMP($J) ;
  1. ;
  1. N DA,I,FND,XMZ,LINE,X,SENDMSG ;
  1. S SENDMSG=0 ;
  1. W !,"Checking for data errors",! ;
  1. ;
  1. ; Check for missing patient pointers in Request/Consultation (#123) file
  1. ;
  1. W !,"Consults..." ;
  1. S LINE=1,^TMP($J,"SDEC",LINE)="Records in consult file (#123) with null patient pointers (field #.02)" ;
  1. S DA=0,FND=0 F I=1:1 S DA=$O(^GMR(123,DA)) Q:'DA W:I#1000=0 "." S X=$G(^(DA,0)) D ;
  1. . I $P(X,"^",2)="" S FND=1,LINE=LINE+1,^TMP($J,"SDEC",LINE)="Null patient pointer (field #.02) in record "_DA ;
  1. ;
  1. I 'FND S LINE=LINE+1,^TMP($J,"SDEC",LINE)="NONE FOUND" ;
  1. E S SENDMSG=1 ;
  1. S LINE=LINE+1,^TMP($J,"SDEC",LINE)=" " ;
  1. S LINE=LINE+1,^TMP($J,"SDEC",LINE)=" " ;
  1. ;
  1. ; Check for bad dates in Recall Reminders file (#403.5)
  1. ;
  1. W !,"Recall Reminders..." ;
  1. S LINE=LINE+1,^TMP($J,"SDEC",LINE)="Records in recall reminders file (#403.5) with imprecise dates (fields #5 and #5.5)" ;
  1. S DA=0,FND=0 F I=1:1 S DA=$O(^SD(403.5,DA)) Q:'DA W:I#1000=0 "." S X=$G(^(DA,0)) D ;
  1. . I $P(X,"^",6)?5N1"00" S FND=1,LINE=LINE+1,^TMP($J,"SDEC",LINE)="Recall Date (#5) incorrect in record "_DA ;
  1. . I $P(X,"^",12)?5N1"00" S FND=1,LINE=LINE+1,^TMP($J,"SDEC",LINE)="Recall Date Per Patient (#5.5) incorrect in record "_DA ;
  1. ;
  1. I 'FND S LINE=LINE+1,^TMP($J,"SDEC",LINE)="NONE FOUND" ;
  1. E S SENDMSG=1 ;
  1. S LINE=LINE+1,^TMP($J,"SDEC",LINE)=" " ;
  1. S LINE=LINE+1,^TMP($J,"SDEC",LINE)=" " ;
  1. ;
  1. ; Check for bad dates in Wait List file (#409.3)
  1. ;
  1. W !,"Wait List..." ;
  1. S LINE=LINE+1,^TMP($J,"SDEC",LINE)="Records in wait list file (#409.3) with imprecise dates (field #22)" ;
  1. S DA=0,FND=0 F I=1:1 S DA=$O(^SDWL(409.3,DA)) Q:'DA W:I#1000=0 "." S X=$G(^(DA,0)) D ;
  1. . I $P(X,"^",16)?5N1"00" S FND=1,LINE=LINE+1,^TMP($J,"SDEC",LINE)="Desired Date of Appointment (#22) incorrect in record "_DA ;
  1. ;
  1. I 'FND S LINE=LINE+1,^TMP($J,"SDEC",LINE)="NONE FOUND" ;
  1. E S SENDMSG=1 ;
  1. S LINE=LINE+1,^TMP($J,"SDEC",LINE)=" " ;
  1. S LINE=LINE+1,^TMP($J,"SDEC",LINE)=" " ;
  1. ;
  1. ; Check for bad dates in Appointment Request file (#409.85)
  1. ;
  1. W !,"Appointment Request..." ;
  1. S LINE=LINE+1,^TMP($J,"SDEC",LINE)="Records in appointment request file (#409.85) with imprecise dates" ;
  1. S DA=0,FND=0 F I=1:1 S DA=$O(^SDEC(409.85,DA)) Q:'DA W:I#1000=0 "." S X=$G(^(DA,0)) D ;
  1. . I $P(X,"^",16)?5N1"00" S FND=1,LINE=LINE+1,^TMP($J,"SDEC",LINE)="CID/Preferred Date of Appointment (#22) incorrect in record "_DA ;
  1. ;
  1. I 'FND S LINE=LINE+1,^TMP($J,"SDEC",LINE)="NONE FOUND" ;
  1. E S SENDMSG=1 ;
  1. S LINE=LINE+1,^TMP($J,"SDEC",LINE)=" " ;
  1. S LINE=LINE+1,^TMP($J,"SDEC",LINE)=" " ;
  1. ;
  1. ; Send e-mail message with database errors listed.
  1. ;
  1. I SENDMSG D ;
  1. . ;
  1. . N XMTO ;
  1. . S XMTO(DUZ)="" ; ,XMTO("Outlook e-mail address")="" ; <<== Tested with Outlook e-mail address (e.g., xxx.yyy@domain.ext). Add e-mail address of Outlook group if needed. wtc 9/6/2019
  1. . D SENDMSG^XMXAPI(DUZ,"Patch #686 - Database errors","^TMP($J,""SDEC"")",.XMTO,,.XMZ) ;
  1. . ;
  1. . W !,"A MailMan message has been sent to you containing a list of the database errors found. Please forward the message to your IRM representative.",! ;
  1. ;
  1. K ^TMP($J) ;
  1. Q ;
  1. ;
  1. W !,"Building AD cross-reference for SDEC CONTACT file (#409.86)..."
  1. I $D(^SDEC(409.86,"AD")) W !,"Cross-reference data already exists, aborting." Q
  1. N SDXREF
  1. S SDXREF=$O(^DD("IX","BB",409.86,"AD",""))
  1. I SDXREF="" W !,"Cross-reference definition missing, aborting." Q
  1. D INDEX^DIKC(409.86,"","",SDXREF,"KSW409.863")
  1. Q
  1. ;