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

DG53P893.m

Go to the documentation of this file.
  1. DG53P893 ;ALB/LLS - Rebuild AEAR index ; 7/18/14 8:24am
  1. ;;5.3;REGISTRATION;**893**;08/13/93;Build 8
  1. ;
  1. ;
  1. Q
  1. ; This process will find all entries in the PATIENT file (#2) that
  1. ; have field APPOINTMENT REQUEST ON 1010EZ (#1010.159) set to Y
  1. ; and do not have an AEAR index for that field. The process will
  1. ; set the index.
  1. ;
  1. ; This clean up process will be completed in the steps listed below.
  1. ; 1) Searching and updating the PATIENT file (#2)
  1. ; 2) Printing the log
  1. ;
  1. ; A MailMan message will be sent to the user after the job completes.
  1. ; The purge date for the log in the ^XTMP global is set for 90 days
  1. ; after the report is processed.
  1. ;
  1. GBLDOC ;-----------------------------------------------------------------
  1. ; The report uses the ^XTMP("DG53P893") global to store the results.
  1. ; The format of the ^XTMP global is described below.
  1. ;
  1. ; DGIEN = IEN from the PATIENT file (#2)
  1. ;
  1. ; ^XTMP("DG53P893",0)=P1^P2^...
  1. ; P1 = Rebuild Date
  1. ; P2 = Date Processed
  1. ; P3 = Description
  1. ;
  1. ; ^XTMP("DG53P893",0,0)=P1^P2^...
  1. ; P1 = Status (0=Unprocessed,1=Compiling,2=Process Complete)
  1. ; P2 = TaskMan Task #
  1. ; P3 = Process Start Date/Time (FM format)
  1. ; P4 = Process Finish Date/Time (FM format)
  1. ; P5 = Number of patients examined
  1. ; P6 = Number of AEAR indices rebuilt
  1. ;
  1. ; ^XTMP("DG53P893",DGIEN)="" <-- DFNs OF PATIENTS WHO HAD
  1. ; AEAR INDEX REBUILT
  1. ;-----------------------------------------------------------------
  1. EP N DIFROM,DGSTAT,DGNODE,DGDESC,ZTREQ ;This section can be called to run the index
  1. ; rebuild process independently of the patch or to
  1. ; view the report of a previously run rebuild procesS
  1. S DGDESC="AEAR INDEX REBUILD"
  1. S DGNODE=$G(^XTMP("DG53P893",0,0))
  1. S DGSTAT=+$P(DGNODE,U)
  1. ;
  1. W @IOF ; clear the screen
  1. W !!," ",DGDESC
  1. W !,$$REPEAT^XLFSTR("*",65)
  1. ;
  1. I 'DGSTAT D USERDESC D TASK ;Task the job if it has not been started
  1. ;
  1. I DGSTAT D ASKPRINT Q ;Job has completed
  1. Q
  1. ;
  1. EP2 N DIFROM,DGSTAT,DGNODE,DGDESC,ZTREQ ;This section is run as post install
  1. ; routine by patch DG*5.3*893
  1. S DGDESC="AEAR INDEX REBUILD"
  1. S DGNODE=$G(^XTMP("DG53P893",0,0))
  1. S DGSTAT=+$P(DGNODE,U)
  1. ;
  1. W @IOF ; clear the screen
  1. W !!," ",DGDESC
  1. W !,$$REPEAT^XLFSTR("*",65)
  1. ;
  1. I 'DGSTAT D USERDESC D TASK ;Task the job if it has not been started
  1. ;
  1. I DGSTAT D D SNDMSG Q ;Process was run previously
  1. . W !,"AEAR index was previously rebuilt on ",$$FMTE^XLFDT($P(DGNODE,U,3))
  1. . W !,"You can run D EP^DG53P893 from a programmer prompt to see the report.",!!
  1. Q
  1. ;
  1. PROCESS ; Look at all entries in the PATIENT file (#2).
  1. N DGCTR,DGCTR2,DGIEN,DGPFAC
  1. ;
  1. K ^XTMP("DG53P893") ;Clean up old process
  1. S $P(DGNODE,U)=1 ;Status=compiling
  1. S $P(DGNODE,U,2)=$G(ZTSK) ;TaskMan Task #
  1. S $P(DGNODE,U,3)=$$NOW^XLFDT() ;Process Start Date/Time
  1. S $P(DGNODE,U,4)=+$H
  1. S ^XTMP("DG53P893",0,0)=DGNODE
  1. ;
  1. ; set up 0 node of ^XTMP to allow the system to purge after 90 days
  1. S ^XTMP("DG53P893",0)=$$FMADD^XLFDT(DT,90)_U_DT_U_ZTDESC
  1. ;
  1. S (DGIEN,DGCTR,DGCTR2)=0
  1. F S DGIEN=$O(^DPT(DGIEN)) Q:DGIEN<1 D
  1. . S DGCTR=DGCTR+1
  1. . Q:$P($G(^DPT(DGIEN,1010.15)),U,9)'=1 ;APPOINTMENT REQUEST ON 1010EZ is not Y
  1. . Q:$D(^DPT("AEAR",1,DGIEN)) ;index already exists
  1. . D REIND(DGIEN) S DGCTR2=DGCTR2+1
  1. . S ^XTMP("DG53P893",DGIEN)=""
  1. ;
  1. S $P(^XTMP("DG53P893",0,0),U,5,6)=DGCTR_U_DGCTR2
  1. S $P(^XTMP("DG53P893",0,0),U,4)=$$NOW^XLFDT() ;Process Stop Date/Time
  1. S $P(^XTMP("DG53P893",0,0),U)=2 ;Set status = processed
  1. ;
  1. D SNDMSG
  1. ;
  1. Q
  1. ;
  1. REIND(DG) ;re-index "AEAR" cross-reference.
  1. N DIK,DA
  1. S DIK="^DPT(",DIK(1)="1010.159^AEAR",DA=DG
  1. D EN1^DIK ;Re-create "AEAR" cross-reference
  1. Q
  1. ;
  1. ASKPRINT ; Prompt user to print detail report.
  1. N DIR,DTOUT,DUOUT,DIRUT,DIROUT,DGH,DGTSK,ZTSK,DGII,POP,Y
  1. W !!,"Process Start Date/Time: ",$$FMTE^XLFDT($P(DGNODE,U,3))
  1. I DGSTAT=1 D Q
  1. . S DGH=$P(DGNODE,U,4)
  1. . S DGTSK=$P(DGNODE,U,2)
  1. . S DGII="" F S DGII=$O(^%ZTER(1,DGH,1,DGII)) Q:DGII="" I $G(^%ZTER(1,DGH,1,DGII,"J"))[("Task "_DGTSK) D S DGH=1 Q
  1. . . W !!,"Task ",DGTSK," has stopped and logged error #",DGII
  1. . . W " on ",$$FMTE^XLFDT($$HTFM^XLFDT(DGH))
  1. . Q:DGH=1
  1. . W !!,"The process [task #",DGTSK,"] is currently running!"
  1. . W !,"A MailMan message will be sent when the process is complete."
  1. . W !
  1. W !," Process Stop Date/Time: ",$$FMTE^XLFDT($P(DGNODE,U,4))
  1. W !
  1. W !,"Number of patient records processed: ",$P(DGNODE,U,5)
  1. W !,"Number of AEAR indexes rebuilt: "
  1. W $S($P(DGNODE,U,6)'="":$P(DGNODE,U,6),1:"None")
  1. W !
  1. ;
  1. W !,"Please choose a device for the printing of"
  1. W !,"the detailed report or enter '^' to quit:"
  1. ;
  1. ; Prompt user for device and to task job to TaskMan if 'Q' is chosen.
  1. K IOP,%ZIS
  1. S %ZIS="Q" D ^%ZIS G:POP EXIT
  1. I $D(IO("Q")) D Q
  1. . N ZTRTN,ZTDESC,ZTDTH
  1. . S ZTDESC="AEAR INDEX REBULD REPORT",ZTRTN="PRINT^DG53P893(ZTDESC)",ZTDTH=$H
  1. . D ^%ZTLOAD
  1. . D ^%ZISC,HOME^%ZIS
  1. . W !,$S($D(ZTSK):"REQUEST QUEUED TASK: "_$G(ZTSK),1:"REQUEST CANCELLED!")
  1. U IO D PRINT("AEAR INDEX REBULD REPORT") G EXIT
  1. Q
  1. ;
  1. EXIT ;
  1. D ^%ZISC,HOME^%ZIS
  1. Q
  1. ;
  1. PRINT(DGDESC) ; Print detail report.
  1. N DGPFAC,DGIEN,DGNODE,DGLNCNT,DGPGNUM
  1. S DGPGNUM=0
  1. D PRNHEAD
  1. ;
  1. S DGIEN=0 F S DGIEN=$O(^XTMP("DG53P893",DGIEN)) Q:DGIEN="" D
  1. . S DGNODE=$G(^DPT(DGIEN,0))
  1. . W !,DGIEN
  1. . W ?15,$E($P(DGNODE,U),1,30)
  1. . S DGLNCNT=DGLNCNT+1 D:DGLNCNT=62 PRNHEAD
  1. D:DGLNCNT>55 PRNHEAD
  1. S DGNODE=$G(^XTMP("DG53P893",0,0))
  1. I DGNODE]"" D
  1. . W !!,"Process was run from ",$$FMTE^XLFDT($P(DGNODE,U,3))," to ",$$FMTE^XLFDT($P(DGNODE,U,4))
  1. . W !,"Number of patient records processed: ",$P(DGNODE,U,5)
  1. . W !,"Number of AEAR indexes rebuilt: "
  1. . W $S($P(DGNODE,U,6)'="":$P(DGNODE,U,6),1:"None")
  1. W !!,"*** END OF REPORT ***"
  1. Q
  1. ;
  1. SNDMSG ; send MailMan message
  1. N DGLN,XMDUZ,XMSUB,XMTEXT,XMY,DGTXT
  1. ;
  1. S XMTEXT="^TMP(""DG53P893"",$J,"
  1. S XMSUB="Patch DG*5.3*893 (AEAR INDEX REBULD)"
  1. S XMDUZ=.5 ;indicate PostMaster is the sender
  1. S XMY(DUZ)="" ;Send message to user starting job
  1. ;
  1. K ^TMP("DG53P893",$J)
  1. D MSGADD(XMSUB)
  1. D MSGADD("")
  1. D MSGADD("Started @ "_$$FMTE^XLFDT($P($G(^XTMP("DG53P893",0,0)),U,3)))
  1. D MSGADD("Finished @ "_$$FMTE^XLFDT($P($G(^XTMP("DG53P893",0,0)),U,4)))
  1. D MSGADD("")
  1. D MSGADD("The search/update process has completed. The detailed ")
  1. D MSGADD("report can be viewed by running D EP^DG53P893 from the ")
  1. D MSGADD("programmer prompt. On "_$$FMTE^XLFDT(+$G(^XTMP("DG53P893",0)))_" the data will be purged. ")
  1. D MSGADD("")
  1. D MSGADD("Number of patient records processed: ")
  1. D MSGADD("")
  1. D MSGADD(" "_$P($G(^XTMP("DG53P893",0,0)),U,5))
  1. D MSGADD("Number of AEAR indexes rebuilt:")
  1. D MSGADD("")
  1. I $P($G(^XTMP("DG53P893",0,0)),U,6)="" D MSGADD(" None") Q
  1. D MSGADD(" "_$P(^XTMP("DG53P893",0,0),U,6))
  1. D MSGADD("")
  1. D MSGADD("*** End ***")
  1. D ^XMD ;send Mailman message
  1. K ^TMP("DG53P893",$J)
  1. Q
  1. ;
  1. MSGADD(DGLINE) N MSGLINE
  1. S MSGLINE=$O(^TMP("DG53P893",$J,""),-1)+1
  1. S ^TMP("DG53P893",$J,MSGLINE)=$G(DGLINE)
  1. Q
  1. ;
  1. TASK ;Task the job using TaskMan
  1. N ZTDESC,ZTIO,ZTRTN
  1. S ZTIO="",ZTRTN="PROCESS^DG53P893",ZTDESC=DGDESC
  1. S ZTDTH=$$NOW^XLFDT()
  1. W ! D ^%ZTLOAD
  1. W:$G(ZTSK) "TaskMan Task: ",$G(ZTSK)
  1. Q
  1. ;
  1. PRNHEAD ; Print report heading
  1. S DGLNCNT=8,DGPGNUM=DGPGNUM+1
  1. W @IOF,!!!,?(80-$L(DGDESC)/2),DGDESC
  1. W !!,"Run Date: ",$$HTE^XLFDT($H),?68,"Page: ",DGPGNUM
  1. W !!,"Patient IEN",?15,"Patient Name"
  1. W !,"===========",?15,"============"
  1. Q
  1. ;
  1. USERDESC ;Write description to the screen for the user
  1. W !!,"This process will find all entries in the PATIENT file (#2) that"
  1. W !,"have field APPOINTMENT REQUEST ON 1010EZ (#1010.159) set to Y"
  1. W !,"and do not have an AEAR index for that field. The process will"
  1. W !,"set the index."
  1. W !!,"The clean up process will perform the following steps in order:"
  1. W !," 1) Search/update the patient data. (This step looks at "
  1. W !," every patient in the PATIENT (#2) file.) A summary"
  1. W !," MailMan message will be sent to the user when the"
  1. W !," search/update is complete."
  1. W !," 2) The user will need run D EP^DG53P893 from the programmer"
  1. W !," prompt to view the detailed report within 90 days."
  1. W !," NOTE: The system will purge the process log after 90"
  1. W !," days!"
  1. W !!,"Log data will be stored in the ^XTMP(""DG53P893"") global.",!
  1. ;
  1. Q