EAS155PT ;ALB/SCK - PATCH 55 USER ENROLLEE MT LETTER CLEANUP ; 9-AUG-04 ;;1.0;ENROLLMENT APPLICATION SYSTEM;**55**;Mar 15, 2004 ; Q ; CHECK ; N CURSTN,CURSITE,PRNT,PTYP N MSG,XMDUZ,XMSUB,XMTEXT,XMY,XX ; S XMSUB="EAS*1*55 PARENT CHECK" S XMDUZ="EAS*1*55" S XMY(.5)="",XMY(DUZ)="" S XMTEXT="MSG(" ; S CURSITE=$P($$SITE^VASITE,U,3) S CURSTN=$$STA^XUAF4(CURSITE) S PRNT=$$PRNT^XUAF4(CURSITE) S PTYP=$$GET1^DIQ(4,+PRNT,13) ; S MSG(1)="Current Site: "_CURSITE S MSG(2)="Current Station: "_$$GET1^DIQ(4,CURSTN,.01)_" ("_CURSTN_")" S MSG(3)="Parent Facility: "_$P(PRNT,U,3) S MSG(4)="Parent Type: "_PTYP S MSG(5)="" I PTYP="HCS" D . S MSG(6)="Because your parent facility type is ""HCS"", it's recommended that you run" . S MSG(7)="the MT Letter cleanup at this time. Please refer to the patch for directions" E D . S MSG(6)="Your parent facility type does not appear to be of type ""HCS"". " . S MSG(7)="It is not recommended that you run the MT letter cleanup at this time" . S MSG(8)="If you are experiencing problems with the MT Letters, please contact EVS." D MES^XPDUTL(.MSG) D ^XMD ; Q ; EN ; Que off the background task N ZTRTN,ZTDESC,ZTSK,ZTIO,ZTDH,MSG,ZTSAVE ; W !,"Preparing to run the EAS*1*55 MT Letters Cleanup" W !,"After the cleanup, you will be sent a MailMan summary of the cleanup" W !,"statistics. You will also be asked to select a printer to send the" W !,"detailed results to. This report could be quite lengthy. Please " W !,"DO NOT run the report to your screen!",! D ^%ZIS S ZTRTN="LETTERS^EAS155PT" S ZTDH=$$NOW^XLFDT S ZTSAVE("DUZ")="" S ZTDESC="EAS155 MT LETTER CLEANUP FOR UE STATUS" D ^%ZTLOAD I $D(ZTSK) W !!?5,"Task: "_ZTSK_" Queued." D HOME^%ZIS Q ; LETTERS ; Reflag those MT letters which need to be updated for UE Status update N EASIEN,EASPTR,EASDFN,EASLTR,EASCNT,XX ; K ^TMP("EAS155P",$J) S ^TMP("EAS155P",$J,"START")=$H,^TMP("EAS155P",$J,"COUNT")=0,^TMP("EAS155P",$J,"NOCHANGE")=0 ; F XX="60D","30D","0D","OFF" S EASCNT(XX)=0 S EASIEN=0 F S EASIEN=$O(^EAS(713.2,"AC",0,EASIEN)) Q:'EASIEN D . S EASPTR=$$GET1^DIQ(713.2,EASIEN,2,"I") . Q:$D(^EAS(713.1,"AP",1,EASPTR)) ; Quit if Letter Prohibit Flag set . Q:$$DECEASED^EASMTUTL(EASIEN) ; Quit if patient deceased . ; ** Safety check for bad patient pointers in 713.1 . Q:$$GET1^DIQ(713.2,EASIEN,2)']"" . D TESTLTR(EASIEN) ; S ^TMP("EAS155P",$J,"END")=$H D MAIL D REPORT Q ; TESTLTR(EASIEN) ; Test letter conditions N NODE6,NODE4,NODEZ,IENS,FDA,FIN ; S ^TMP("EAS155P",$J,"COUNT")=^TMP("EAS155P",$J,"COUNT")+1 ; Piece 1: Threshold date, Piece 2: Flag-to-print, Piece 3: Letter Printed?, Piece 4: Date printed S NODE6=$G(^EAS(713.2,EASIEN,6)) S NODE4=$G(^EAS(713.2,EASIEN,4)) S NODEZ=$G(^EAS(713.2,EASIEN,"Z")) ; ; Check 1, check if letters have been completely turned off, No flags to print and no letters printed. Turn back on most appropriate letter. I '$P(NODE6,U,3),'$P(NODE4,U,3),'$P(NODEZ,U,3) D Q:$G(FIN) . I '$P(NODE6,U,2),'$P(NODE4,U,2),'$P(NODEZ,U,2) D . . I $P(NODEZ,U)