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

DG531012P.m

Go to the documentation of this file.
  1. DG531012P ;OIT/KCL - POST-INSTALL ROUTINE FOR DG*5.3*1012 ;5/1/2020
  1. ;;5.3;Registration;**1012**;Aug 13,1993;Build 5
  1. ;
  1. ;no direct entry
  1. Q
  1. ;
  1. POST ;Main entry point for post-install item(s)
  1. ;
  1. D POST1
  1. Q
  1. ;
  1. POST1 ;Queue off job to file HISTORIC KATRINA ERI
  1. ;
  1. ;Queue off a job to file HISTORIC KATRINA ERI for patients(DFNs) temporarily
  1. ;stored in the ^XTMP("DG531011P") global by patch DG*5.3*1011.
  1. ;
  1. ; External References:
  1. ; ICR# TYPE DESCRIPTION
  1. ; ----- ---- -----------
  1. ; 10063 Sup ^%ZTLOAD
  1. ; 10141 Sup ^XPDUTL:BMES, MES, PATCH
  1. ; 10103 Sup NOW^XLFDT
  1. ;
  1. ;new ^%ZTLOAD input vars
  1. N ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSK,ZTSAVE
  1. ;
  1. D BMES^XPDUTL(">>> Patients (DFNs) temporarily stored in ^XTMP(""DG531011P"") global")
  1. D MES^XPDUTL(" by patch DG*5.3*1011 had an Emergency Response Indicator (ERI)")
  1. D MES^XPDUTL(" of 'HURRICANE KATRINA'. For historical purposes, this data will")
  1. D MES^XPDUTL(" now be filed back into the patient's record. It will be stored in")
  1. D MES^XPDUTL(" the HISTORIC KATRINA ERI (#.182) field of the PATIENT (#2) file.")
  1. ;
  1. ;quit if patch previously installed
  1. I $$PATCH^XPDUTL("DG*5.3*1012") D BMES^XPDUTL(" - Not needed since patch DG*5.3*1012 has been installed previously.") Q
  1. ;
  1. ;quit if ^xtmp global does not exist
  1. I '$D(^XTMP("DG531011P")) D BMES^XPDUTL(" - Not needed since ^XTMP(""DG531011P"") global does not exist.") Q
  1. ;
  1. ;queue off job to file HISTORIC KATRINA ERI
  1. S ZTRTN="FILEHERI^DG531012P" ;DO "LABEL^ROUTINE"
  1. S ZTDESC="DG*5.3*1012 Post-Install Process (File HISTORIC KATRINA ERI)" ;task description
  1. S ZTDTH=$$NOW^XLFDT ;start time
  1. S ZTIO="" ;device the task should use, NULL=no device is used
  1. S ZTSAVE=("DUZ")="" ;save installer DUZ for job
  1. D ^%ZTLOAD
  1. ;
  1. ;if job successfully queued
  1. I $G(ZTSK) D
  1. . D BMES^XPDUTL(" - File HISTORIC KATRINA ERI job has been queued.")
  1. . D MES^XPDUTL(" The task number is: "_$G(ZTSK)_".")
  1. . D BMES^XPDUTL(" - A MailMan message containing job results will be sent")
  1. . D MES^XPDUTL(" to the patch installer.")
  1. ;
  1. ;if job not successfully queued
  1. I '$G(ZTSK) D
  1. . D BMES^XPDUTL(" *********************************************************")
  1. . D MES^XPDUTL(" * !!!! WARNING !!!! *")
  1. . D MES^XPDUTL(" * *")
  1. . D MES^XPDUTL(" * Job to file HISTORIC KATRINA ERI could not be queued. *")
  1. . D MES^XPDUTL(" * Please log YOUR IT Services ticket for assistance. *")
  1. . D MES^XPDUTL(" * *")
  1. . D MES^XPDUTL(" *********************************************************")
  1. Q
  1. ;
  1. FILEHERI ;File Historical Emergency Response Indicator Job
  1. ;
  1. ;Patients (DFNs) temporarily stored in ^XTMP("DG531011P") global by patch DG*5.3*1011 had
  1. ;an Emergency Response Indicator (ERI) of 'HURRICANE KATRINA'. For historical purposes,
  1. ;this data will now be filed back into the patient's record. It will be stored in the
  1. ;new HISTORIC KATRINA ERI (#.182) field of the PATIENT (#2) file. A MailMan message will
  1. ;be sent to the patch installer (DUZ) with the results of the job.
  1. ;
  1. ; External References:
  1. ; ICR# TYPE DESCRIPTION
  1. ; ----- ---- -----------
  1. ; 2053 Sup FILE^DIE
  1. ;
  1. ;new vars
  1. N DGCNT1,DGCNT2,DGCNT3,DGERR,DGFDA,DGDFN,DGIENS,DGSUB1,DGSUB2
  1. ;
  1. ;init vars
  1. S (DGCNT1,DGCNT2,DGCNT3,DGSUB1,DGSUB2)=0
  1. K ^TMP("DG531012P") ;temp global used to store any filing errors
  1. ;
  1. ;get $j subscript ^xtmp global
  1. S DGSUB1=+$O(^XTMP("DG531011P",DGSUB1))
  1. ;
  1. ;loop through ^xtmp global to retrieve patients (DFNs) that had a HURRICANE KATRINA indicator
  1. F S DGSUB2=$O(^XTMP("DG531011P",DGSUB1,"DFN",DGSUB2)) Q:'DGSUB2 D
  1. . ;
  1. . ;count records processed
  1. . S DGCNT1=DGCNT1+1
  1. . ;
  1. . ;get DFN of patient record in PATIENT (#2) file
  1. . S DGDFN=+$G(^XTMP("DG531011P",DGSUB1,"DFN",DGSUB2))
  1. . ;
  1. . ;file 'HURRICANE KATRINA' indicator into patient's record - file into
  1. . ;the HISTORIC KATRINA ERI (#.182) field of PATIENT (#2) file
  1. . S DGIENS=DGDFN_"," ;FileMan IENs string
  1. . S DGFDA(2,DGIENS,.182)="K" ;FDA array for FILE^DIE
  1. . D FILE^DIE("","DGFDA","DGERR")
  1. . ;shouldn't happen, but if filing error returned from FILE^DIE call then record it
  1. . I $D(DGERR) D Q
  1. . . S DGCNT3=DGCNT3+1 ;total records not updated
  1. . . ;save DFN & error msg into ^tmp global, 1st piece=DFN & 2nd piece=error msg
  1. . . S ^TMP("DG531012P",$J,"ERRORS",DGCNT3)=DGDFN_"^"_$G(DGERR("DIERR",1,"TEXT",1))
  1. . . K DGERR
  1. . ;otherwise, filing was successful
  1. . S DGCNT2=DGCNT2+1 ;total records successfully updated
  1. . ;
  1. ;send msg with results
  1. D SENDMSG($G(DGCNT1),$G(DGCNT2),$G(DGCNT3),$G(DUZ))
  1. Q
  1. ;
  1. ;
  1. SENDMSG(DGCNT1,DGCNT2,DGCNT3,DGDUZ) ;Send MailMan Message
  1. ;
  1. ;This procedure will create and send a MailMan message to the patch installer.
  1. ;The message will contain results from running the DG*5.3*1012 post-install.
  1. ;
  1. ; Input:
  1. ; DGCNT1 - Total records processed in ^XTMP("DG531011P") global.
  1. ; DGCNT2 - Total records successfully updated in PATIENT (#2) file.
  1. ; DGCNT3 - Total records not successfully updated in PATIENT (#2) file.
  1. ; DGDUZ - Patch installer DUZ.
  1. ;
  1. ; Output: None
  1. ;
  1. ; External References:
  1. ; ICR# TYPE DESCRIPTION
  1. ; ----- ---- -----------
  1. ; 10070 Sup ^XMD
  1. ;
  1. ;new vars
  1. N DIFROM ;when invoking ^XMD in post-init routine of the KIDS build, the calling routine must NEW the DIFROM variable
  1. N XMSUB,XMTEXT,XMY ;input vars for ^XMD call
  1. N DGERROUT,DGI,DGLN,DGTEXT ;local vars
  1. ;
  1. ;construct mailman msg
  1. S XMSUB="DG*5.3*1012 Post-Install Job Results" ;msg subject
  1. S (XMY(.5),XMY($G(DGDUZ)))="" ;msg addressee array
  1. S XMTEXT="DGTEXT(" ;array containing the text of msg
  1. S DGLN=1 ;msg line #
  1. S DGTEXT(DGLN)="DG*5.3*1012 post-install job results."
  1. S DGLN=DGLN+1,DGTEXT(DGLN)=""
  1. ;
  1. ;if no filing errors
  1. S DGLN=DGLN+1,DGTEXT(DGLN)="Job was successful and no other action is required."
  1. ;
  1. ;if filing errors
  1. I $G(DGCNT3)>0 S DGTEXT(DGLN)="WARNING - Job was not successful!"
  1. ;
  1. ;total records processed and total records updated
  1. S DGLN=DGLN+1,DGTEXT(DGLN)=""
  1. S DGLN=DGLN+1,DGTEXT(DGLN)=" - Total records in ^XTMP(""DG531011P"") global: "_$G(DGCNT1)
  1. S DGLN=DGLN+1,DGTEXT(DGLN)=" - Total records updated in PATIENT (#2) file: "_$G(DGCNT2)
  1. ;
  1. ;if filing errors occurred, list them
  1. I $G(DGCNT3)>0 D
  1. . S DGLN=DGLN+1,DGTEXT(DGLN)=""
  1. . S DGLN=DGLN+1,DGTEXT(DGLN)="Filing errors were encountered while running DG*5.3*1012 post-install job!"
  1. . S DGLN=DGLN+1,DGTEXT(DGLN)=""
  1. . S DGLN=DGLN+1,DGTEXT(DGLN)="Please log YOUR IT Services ticket for assistance with resolving these errors."
  1. . S DGLN=DGLN+1,DGTEXT(DGLN)=""
  1. . S DGLN=DGLN+1,DGTEXT(DGLN)="Patient DFN Error"
  1. . S DGLN=DGLN+1,DGTEXT(DGLN)="-------------------------------------------------"
  1. . ;loop through errors in ^tmp global and get DFN(s) with error msg
  1. . S DGI=0
  1. . F S DGI=$O(^TMP("DG531012P",$J,"ERRORS",DGI)) Q:'DGI D
  1. . . S DGERROUT=$G(^TMP("DG531012P",$J,"ERRORS",DGI))
  1. . . S DGLN=DGLN+1,DGTEXT(DGLN)=$E($P($G(DGERROUT),U)_" ",1,20)_$P($G(DGERROUT),U,2)
  1. . ;
  1. . ;cleanup ^temp error global
  1. . K ^TMP("DG531012P")
  1. ;
  1. ;send mailman msg
  1. D ^XMD
  1. ;
  1. Q