[613] | 1 | DG53742 ;ALB/TMK - DG*5.3*764 (formerly 742) Cleanup OEF/OIF site info; 01/10/2007
|
---|
| 2 | ;;5.3;Registration;**764**;Aug 13,1993;Build 16
|
---|
| 3 | ;
|
---|
| 4 | POST ; This routine was previously part of patch DG*5.3*742, now in *764
|
---|
| 5 | N ZTRTN,ZTDESC,ZTSAVE,ZTIO,ZTSK,ZTDTH
|
---|
| 6 | D BMES^XPDUTL("Queue-ing the job to correct OEF/OIF site info...")
|
---|
| 7 | K ^XTMP($$NAMSPC)
|
---|
| 8 | S ZTRTN="RUN^DG53742",ZTDESC="Correct OEF/OIF site info"
|
---|
| 9 | S ZTIO="",ZTDTH=$$NOW^XLFDT D ^%ZTLOAD
|
---|
| 10 | D BMES^XPDUTL("This request queued as Task # "_$G(ZTSK))
|
---|
| 11 | D BMES^XPDUTL("=====================================================")
|
---|
| 12 | D BMES^XPDUTL("")
|
---|
| 13 | Q
|
---|
| 14 | EP ; Queue the conversion
|
---|
| 15 | N %
|
---|
| 16 | S %=$$NEWCP^XPDUTL("POST","POST^DG53742")
|
---|
| 17 | S %=$$NEWCP^XPDUTL("EVC1","EVC1^DG53742")
|
---|
| 18 | S %=$$NEWCP^XPDUTL("END","END^DG53742") ; Leave as last update
|
---|
| 19 | Q
|
---|
| 20 | ;
|
---|
| 21 | EVC1 ; Update the USE FOR Z07 CHECK field #6
|
---|
| 22 | ; in the INCONSISTENT DATA ELEMENTS file #38.6 for CC 718
|
---|
| 23 | N RULE,DA,DIE,DR,X,Y
|
---|
| 24 | S RULE=718
|
---|
| 25 | D BMES^XPDUTL("Modifying entry #"_RULE_" in 38.6 file.")
|
---|
| 26 | S DIE=38.6,DA=$$FIND1^DIC(DIE,"","X",RULE)
|
---|
| 27 | I 'DA D Q
|
---|
| 28 | .D MES^XPDUTL(" *** Entry not found! Nothing Updated!! ***") Q
|
---|
| 29 | S DR="6////0" D ^DIE
|
---|
| 30 | D MES^XPDUTL(" *** Update Complete ***")
|
---|
| 31 | D BMES^XPDUTL("")
|
---|
| 32 | Q
|
---|
| 33 | ;
|
---|
| 34 | END ; Post-install done
|
---|
| 35 | D BMES^XPDUTL("Post install complete.")
|
---|
| 36 | Q
|
---|
| 37 | ;
|
---|
| 38 | RUN ; 'Live' entry point from taskman
|
---|
| 39 | N NAMSPC
|
---|
| 40 | S NAMSPC=$$NAMSPC
|
---|
| 41 | D QUE(NAMSPC,0)
|
---|
| 42 | Q
|
---|
| 43 | ;
|
---|
| 44 | TEST ;entry point for test mode
|
---|
| 45 | N NAMSPC
|
---|
| 46 | S NAMSPC=$$NAMSPC_"_TEST"
|
---|
| 47 | D QUE(NAMSPC,1)
|
---|
| 48 | Q
|
---|
| 49 | ;
|
---|
| 50 | QUE(NAMSPC,TESTING) ;
|
---|
| 51 | N ZTSTOP,DGX,X,Y
|
---|
| 52 | S TESTING=+$G(TESTING)
|
---|
| 53 | D SETUPX(NAMSPC,90)
|
---|
| 54 | S DGX=$G(^XTMP(NAMSPC,0,0))
|
---|
| 55 | I $P(DGX,U,6)="COMPLETED" D MAIL(NAMSPC,TESTING) Q
|
---|
| 56 | S $P(DGX,U,6)="RUNNING"
|
---|
| 57 | S $P(DGX,U,7)=$$NOW^XLFDT
|
---|
| 58 | S ^XTMP(NAMSPC,0,0)=DGX
|
---|
| 59 | ;
|
---|
| 60 | S X=$$LOOP(NAMSPC,TESTING),ZTSTOP=$P(X,U,2)
|
---|
| 61 | S X=$G(^XTMP(NAMSPC,0,0))
|
---|
| 62 | S $P(X,U,6)=$S(ZTSTOP:"STOPPED",1:"COMPLETED")
|
---|
| 63 | S $P(X,U,8)=$$NOW^XLFDT
|
---|
| 64 | S ^XTMP(NAMSPC,0,0)=X
|
---|
| 65 | ;
|
---|
| 66 | D MAIL(NAMSPC,TESTING)
|
---|
| 67 | Q
|
---|
| 68 | ;
|
---|
| 69 | SETUPX(NAMSPC,EXPDAYS) ;
|
---|
| 70 | ; requires EXPDAYS - # days to keep XTMP around
|
---|
| 71 | N BEGTIME,PURGDT
|
---|
| 72 | S NAMSPC=$$NAMSPC
|
---|
| 73 | S BEGTIME=$$NOW^XLFDT()
|
---|
| 74 | S PURGDT=$$FMADD^XLFDT(BEGTIME,EXPDAYS)
|
---|
| 75 | S ^XTMP(NAMSPC,0)=PURGDT_U_BEGTIME
|
---|
| 76 | S $P(^XTMP(NAMSPC,0),U,3)="Correct OEF/OIF site info"
|
---|
| 77 | Q
|
---|
| 78 | ;
|
---|
| 79 | LOOP(NAMSPC,TESTING) ;
|
---|
| 80 | ;returns 0^stop flag
|
---|
| 81 | N X,XREC,LASTREC,TOTREC,TOTPAT
|
---|
| 82 | S LASTREC="",ZTSTOP=0
|
---|
| 83 | S TOTREC=0
|
---|
| 84 | I $D(^XTMP(NAMSPC,0,0)) D
|
---|
| 85 | . S XREC=$G(^XTMP(NAMSPC,0,0))
|
---|
| 86 | . ;last xref entry processed
|
---|
| 87 | . S LASTREC=$P(XREC,U,1)
|
---|
| 88 | . ;total records read
|
---|
| 89 | . S TOTREC=+$P(XREC,U,2)
|
---|
| 90 | . ; total OEIF records updated
|
---|
| 91 | . S TOTPAT=+$P(XREC,U,10)
|
---|
| 92 | . Q
|
---|
| 93 | D OEIF(NAMSPC,TESTING,LASTREC)
|
---|
| 94 | Q 0_"^"_ZTSTOP
|
---|
| 95 | ;
|
---|
| 96 | OEIF(NAMSPC,TESTING,LASTREC) ;
|
---|
| 97 | N GBL,DFN,OEIF,SITE,X,Y,Z,DIE,DR,DA
|
---|
| 98 | S ZTSTOP=0
|
---|
| 99 | S GBL="^DPT(""ALOEIF"""
|
---|
| 100 | I $TR(LASTREC,";")'="" D
|
---|
| 101 | . F Z=1:1:5 Q:$P(LASTREC,";",Z)="" S:Z=1 GBL=GBL_"," S GBL=GBL_""""_$P(LASTREC,";",Z)_""""_$S($P(LASTREC,";",Z+1)'="":",",1:"")
|
---|
| 102 | S GBL=GBL_")"
|
---|
| 103 | F S GBL=$Q(@GBL) Q:GBL=""!($QS(GBL,1)'="ALOEIF")!ZTSTOP S DFN=$QS(GBL,5) I DFN D
|
---|
| 104 | . S OEIF=0 F S OEIF=$O(^DPT(DFN,.3215,OEIF)) Q:'OEIF S SITE=$P($G(^(OEIF,0)),U,6) I SITE,+SITE'=SITE S SITE=+$O(^DIC(4,"D",SITE,0)) I SITE D
|
---|
| 105 | .. S DR=".06////"_SITE,DA(1)=DFN,DA=OEIF,DIE="^DPT("_DA(1)_",.3215," D:'TESTING ^DIE S TOTPAT=TOTPAT+1
|
---|
| 106 | . S ZTSTOP=$$CHKR(NAMSPC,TESTING,GBL,TOTPAT,.TOTREC)
|
---|
| 107 | Q
|
---|
| 108 | ;
|
---|
| 109 | CHKR(NAMSPC,TESTING,GBL,TOTPAT,TOTREC) ;
|
---|
| 110 | N X,Z,ZTSTOP
|
---|
| 111 | S ZTSTOP=0
|
---|
| 112 | F Z=2:1:6 S LASTREC=$QS(GBL,Z)_";"
|
---|
| 113 | S TOTREC=TOTREC+1
|
---|
| 114 | D UPDATEX(NAMSPC,TOTREC,LASTREC,TOTPAT)
|
---|
| 115 | I '(TOTREC#500) S ZTSTOP=$$STOP(NAMSPC)
|
---|
| 116 | Q ZTSTOP
|
---|
| 117 | ;
|
---|
| 118 | UPDATEX(NAMSPC,TOTREC,LASTREC,TOTPAT) ;
|
---|
| 119 | N X
|
---|
| 120 | S X=$G(^XTMP(NAMSPC,0,0))
|
---|
| 121 | S $P(X,U,1)=$G(LASTREC),$P(X,U,2)=$G(TOTREC)
|
---|
| 122 | S $P(X,U,10)=$G(TOTPAT)
|
---|
| 123 | S ^XTMP(NAMSPC,0,0)=X
|
---|
| 124 | Q
|
---|
| 125 | ;
|
---|
| 126 | STATUS ;display status of current run
|
---|
| 127 | N DIR,X,Y,DTOUT,DUOUT,NAMSPC
|
---|
| 128 | S DIR(0)="SA^T:TEST;L:LIVE",DIR("A")="(T)EST OR (L)IVE?: ",DIR("B")="LIVE"
|
---|
| 129 | D ^DIR K DIR
|
---|
| 130 | Q:$D(DTOUT)!$D(DUOUT)
|
---|
| 131 | S NAMSPC=$$NAMSPC_$S(Y="L":"",1:"_TEST")
|
---|
| 132 | I Y'="L" W !,"TEST TEST TEST TEST TEST TEST",!
|
---|
| 133 | S X=$G(^XTMP(NAMSPC,0,0))
|
---|
| 134 | I X="" W !!,"Task not started!!!" Q
|
---|
| 135 | W !!," Current status: ",$P(X,U,6)
|
---|
| 136 | W !," Starting time: ",$$FMTE^XLFDT($P(X,U,7))
|
---|
| 137 | I $P(X,U,8) W !," Ending time: ",$$FMTE^XLFDT($P(X,U,8))
|
---|
| 138 | W !!," Total patient records read: ",$P(X,U,2)
|
---|
| 139 | W !," Last patient record processed: ",$P(X,U,1)
|
---|
| 140 | W !," Total OEF/OIF records changed: ",$P(X,U,10)
|
---|
| 141 | Q
|
---|
| 142 | ;
|
---|
| 143 | STOP(NAMSPC) ; returns stop flag
|
---|
| 144 | N ZTSTOP,X
|
---|
| 145 | S ZTSTOP=0
|
---|
| 146 | I $$S^%ZTLOAD S ZTSTOP=1
|
---|
| 147 | I $D(^XTMP(NAMSPC,"STOP")) S ZTSTOP=1 K ^XTMP(NAMSPC,"STOP")
|
---|
| 148 | I ZTSTOP D
|
---|
| 149 | . S X=$G(^XTMP(NAMSPC,0,0))
|
---|
| 150 | . S $P(X,U,6)="STOPPED",$P(X,U,7)=$$NOW^XLFDT
|
---|
| 151 | . S ^XTMP(NAMSPC,0,0)=X
|
---|
| 152 | . Q
|
---|
| 153 | Q ZTSTOP
|
---|
| 154 | ;
|
---|
| 155 | NAMSPC() ;
|
---|
| 156 | Q $T(+0)
|
---|
| 157 | ;
|
---|
| 158 | MAIL(NAMSPC,TESTING) ; mail stats
|
---|
| 159 | N MSGNO,TOTREC,TOTPAT,STAT,STIME,ETIME,LIN,HTEXT,X
|
---|
| 160 | S X=$G(^XTMP(NAMSPC,0,0))
|
---|
| 161 | S TOTREC=$P(X,U,2)
|
---|
| 162 | S STAT=$P(X,U,6),STIME=$P(X,U,7)
|
---|
| 163 | S ETIME=$P(X,U,8)
|
---|
| 164 | S TOTPAT=$P(X,U,10)
|
---|
| 165 | ;
|
---|
| 166 | D HDNG(NAMSPC,.HTEXT,.LIN,STAT,STIME,ETIME,TESTING)
|
---|
| 167 | D SUMRY(.LIN,TOTREC,TOTPAT)
|
---|
| 168 | D MAILIT(HTEXT,NAMSPC)
|
---|
| 169 | K ^TMP(NAMSPC,$J,"MSG")
|
---|
| 170 | Q
|
---|
| 171 | ;
|
---|
| 172 | HDNG(NAMSPC,HTEXT,LIN,STAT,STIME,ETIME,TESTING) ; build heading lines
|
---|
| 173 | N X,Y,TEXT
|
---|
| 174 | K ^TMP(NAMSPC,$J,"MSG")
|
---|
| 175 | S LIN=0
|
---|
| 176 | S HTEXT="Correct OEF/OIF site info "_STAT_" on "
|
---|
| 177 | S HTEXT=HTEXT_$$FMTE^XLFDT(ETIME)
|
---|
| 178 | D BLDLINE(NAMSPC,HTEXT,.LIN)
|
---|
| 179 | D BLDLINE(NAMSPC,"",.LIN)
|
---|
| 180 | I TESTING D
|
---|
| 181 | . S TEXT="** TESTING - NO CHANGES TO DATABASE EXECUTED **"
|
---|
| 182 | . D BLDLINE(NAMSPC,TEXT,.LIN)
|
---|
| 183 | D BLDLINE(NAMSPC,"",.LIN)
|
---|
| 184 | Q
|
---|
| 185 | ;
|
---|
| 186 | SUMRY(LIN,TOTREC,TOTPAT) ; build summary lines
|
---|
| 187 | N TEXT
|
---|
| 188 | S TEXT=" Total Patient Records Read: "_$J($FN(TOTREC,","),11)
|
---|
| 189 | D BLDLINE(NAMSPC,TEXT,.LIN)
|
---|
| 190 | S TEXT=" Total OEF/OIF Records Changed: "_$J($FN(TOTPAT,","),11)
|
---|
| 191 | D BLDLINE(NAMSPC,TEXT,.LIN)
|
---|
| 192 | Q
|
---|
| 193 | ;
|
---|
| 194 | BLDLINE(NAMSPC,TEXT,LIN) ;build a single line in TMP msg global
|
---|
| 195 | S LIN=LIN+1
|
---|
| 196 | S ^TMP(NAMSPC,$J,"MSG",LIN)=TEXT
|
---|
| 197 | Q
|
---|
| 198 | ;
|
---|
| 199 | MAILIT(HTEXT,NAMSPC) ; send the msg
|
---|
| 200 | N XMY,XMDUZ,XMSUB,XMTEXT
|
---|
| 201 | S XMY(DUZ)="",XMDUZ=.5
|
---|
| 202 | S XMY("G.DGEN ELIGIBILITY ALERT")=""
|
---|
| 203 | S XMSUB=HTEXT
|
---|
| 204 | S XMTEXT="^TMP(NAMSPC,$J,""MSG"","
|
---|
| 205 | D ^XMD
|
---|
| 206 | Q
|
---|
| 207 | ;
|
---|