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

SD53P227.m

Go to the documentation of this file.
  1. SD53P227 ;ALB/RBS - Cleanup Encounter/Visit Date/Time 421 error ; 10/11/00 5:24pm
  1. ;;5.3;Scheduling;**227,1015**;AUG 13, 1993;Build 21
  1. ;
  1. ;DBIA Integration Reference # 3211.
  1. ;
  1. ;This routine will search for Encounters that have an invalid date
  1. ;and time setup causing a 421 error code to be setup.
  1. ;An attempt will be made to cleanup the date/time.
  1. ;Two options are provided for finding or fixing the 421 errors.
  1. ;The report will detail all 421 Encounters that can-not or can be
  1. ;fixed and flagged for retransmittion to the NCPD.
  1. ;An e-mail summary will be sent to the user running this utility.
  1. ;
  1. ;The ^XTMP global will be used as an audit file of all encounters
  1. ;that have been fixed and retransmitted to the NPCD.
  1. ;The purge date will be 30 days from last Cleanup option run.
  1. ; ^XTMP("SD53P227",0)=STRING of 10 fields
  1. ; STRING = purge date^run date^start dt/time^stop dt/time...
  1. ; ^option run^last cleanup d/t run^DUZ of user...
  1. ; ^tot errors^tot fixed^tot searched
  1. ; ^XTMP("SD53P227",1)=error node of encounters that can't be fixed
  1. ; ^XTMP("SD53P227",2)=encounters that can be fixed and re-sent
  1. ; ^XTMP("SD53P227",3)=e-mail report sent to user
  1. ; ^XTMP("SD53P227,"SENT")=audit trial of all encounters fixed
  1. Q
  1. ;*;
  1. START ;Check for Programmer DUZ(0)="@", then Prompt for Device.
  1. N EXIT,SDRTYP,TITLE,TXT,X,Y
  1. N ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSK,ZTSAVE,ZTQUEUED,ZTREQ,%ZIS
  1. D TITLE
  1. I $G(DUZ)<1 W !!,$C(7),"DUZ must be defined to run this utility!" Q
  1. I DUZ(0)'="@" D Q
  1. .W !!,$C(7)," Sorry, you may not access this utility program!"
  1. .W !," To insure that data updates contained in this patch are"
  1. .W !," installed correctly, DUZ(0) must be equal the ""@"" symbol!",!! H 3
  1. ;
  1. L +^XTMP("SD53P227"):2
  1. I '$T D Q
  1. .W !!,$C(7),"* This utility is already running. Please try later. *",! H 3
  1. ;
  1. S EXIT=0
  1. I $D(^XTMP("SD53P227")) D
  1. .S X=$G(^XTMP("SD53P227",0))
  1. .Q:X=""
  1. .I $P(X,U,4)="" D Q
  1. ..S EXIT=1
  1. ..W !!!,$C(7),"* This utility is currently running. Start D/T: ",$$FMTE^XLFDT($P(X,U,3)),! H 3
  1. .; if cleanup already run, ask user if they want to run again...
  1. .I $D(^XTMP("SD53P227","SENT")) D
  1. ..W !!,$C(7),"* WARNING * The 'C' (Clean Up & Report) option has already been run"
  1. ..W !?12,"on: ",$$FMTE^XLFDT($P(X,U,6)),!
  1. ..S EXIT=$$ASK()
  1. ..I EXIT'=1 S EXIT=1 Q ;user didn't answer 'Y'es.
  1. ..S EXIT=0
  1. I EXIT D EXIT Q
  1. ;
  1. ; Prompt user for option to run...
  1. D TITLE,MSG
  1. I $$REPORT(.SDRTYP)'>-1 D EXIT Q
  1. ;
  1. W !!
  1. L -^XTMP("SD53P227")
  1. ;
  1. S %ZIS="Q" S:SDRTYP="C" %ZIS="Q0" ;0=can't use own $IO
  1. D ^%ZIS
  1. Q:POP
  1. I $D(IO("Q")) D QUEUE Q
  1. D RUN,^%ZISC
  1. Q
  1. ;
  1. QUEUE ; queue the report
  1. S ZTSAVE("SDRTYP")="",ZTSAVE("TITLE")=""
  1. S ZTRTN="RUN^SD53P227",ZTDESC="Cleanup Encounters w/421 error code"
  1. D ^%ZTLOAD
  1. I $D(ZTSK)[0 W !!?5,"Unable to schedule Task.",!
  1. E W !!?5,"Scheduled as Task #: ",ZTSK
  1. D HOME^%ZIS
  1. Q
  1. ;
  1. ;
  1. RUN ;Loop the 409.75 Transmitted Outpatient Encounter Error file
  1. L +^XTMP("SD53P227"):2
  1. I '$T D Q
  1. .N SDMSG,XMSUB,XMDUZ,XMDUN,XMTEXT,XMY
  1. .S XMSUB=TITLE,(XMDUZ,XMDUN)="Patch SD*5.3*227",XMY(DUZ)=""
  1. .S SDMSG(1)="*WARNING* Processing not started."
  1. .S SDMSG(2)=" Unable to LOCK error."
  1. .S SDMSG(3)=" Please check system."
  1. .S XMTEXT="SDMSG("
  1. .D ^XMD
  1. I '$D(ZTQUEUED),IOST?1"C-".E D WAIT^DICD
  1. N CRT,EXIT,FIX,RUNDT,SDI,SDL,SDTEMP,TIMESTRT,X,Y
  1. S TIMESTRT=$$NOW^XLFDT() ;starting time
  1. S (CRT,EXIT,FIX,SDL)=0,(SDI,X)=""
  1. I '$D(ZTQUEUED),IOST?1"C-".E S CRT=1 ;print to screen
  1. S:SDRTYP="C" FIX=1 ;re-set date/time
  1. ;
  1. ; create ^XTMP() file to save fixed records
  1. I '$D(^XTMP("SD53P227","SENT")) K ^XTMP("SD53P227")
  1. ; If already run, don't kill node of encounters already fixed...
  1. I $D(^XTMP("SD53P227","SENT")) D
  1. .S X=^XTMP("SD53P227",0)
  1. .F SDI=1,2,3 K ^XTMP("SD53P227",SDI)
  1. ; setup 0 node info
  1. S $P(X,U)=$$HTFM^XLFDT(+$H+30),$P(X,U,2)=$$DT^XLFDT()
  1. S $P(X,U,3)=TIMESTRT,$P(X,U,4)="",$P(X,U,5)=SDRTYP,$P(X,U,7)=DUZ
  1. S:FIX $P(X,U,6)=TIMESTRT
  1. S ^XTMP("SD53P227",0)=X,SDTEMP="^XTMP(""SD53P227"")"
  1. ;
  1. D FIND^SD53227P ;search for encounters
  1. ;
  1. I EXIT D MAIL,EXIT Q ;early exit
  1. D PRINT^SD53227,MAIL,EXIT ;do printing & e-mail
  1. S ZTREQ="@"
  1. Q
  1. ;
  1. ;
  1. MAIL ;Send mail message
  1. N XMSUB,XMDUZ,XMDUN,XMTEXT,XMY,XMZ
  1. S XMSUB="SD53P227 Encounter Report"_$S(SDRTYP="R":"",1:" & Cleanup")
  1. S (XMDUZ,XMDUN)="SD*5.3*227",XMY(DUZ)=""
  1. S XMTEXT="^XTMP(""SD53P227"",3,"
  1. D ^XMD
  1. Q
  1. ;
  1. EXIT ;Clean up and quit
  1. ;check to see if process ran
  1. N X
  1. I $D(TIMESTRT) D
  1. .S X=@SDTEMP@(0),$P(X,U,4)=$$NOW^XLFDT(),@SDTEMP@(0)=X ;stop d/t
  1. ;
  1. L -^XTMP("SD53P227")
  1. Q
  1. ;
  1. REPORT(SDR) ;Select Utility action type
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. S DIR(0)="S^R:REPORT ONLY;C:CLEAN UP & REPORT",DIR("A")="Select utility format"
  1. S DIR("?",1)=" R - (REPORT ONLY) - will produce a mail message report of Encounter"
  1. S DIR("?",2)=" records (#409.75 file) with a 421 error code."
  1. S DIR("?",3)=" C - (CLEAN UP & REPORT) - will fix both the Encounter (409.68 file)"
  1. S DIR("?",4)=" and Visit (#9000010 file) records that are found and produce"
  1. S DIR("?")=" a mail message report of those records."
  1. W !!,$C(7) D ^DIR K DIR
  1. I $D(DIRUT)!$D(DTOUT)!$D(DUOUT) S Y=-1 Q Y
  1. S SDR=Y
  1. Q Y
  1. ;
  1. ASK() ; Ask user to contuine or not
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. S DIR(0)="Y"
  1. S DIR("A")="Do you want to continue",DIR("B")="NO"
  1. D ^DIR K DIR
  1. I $D(DIRUT)!$D(DTOUT)!$D(DUOUT) Q 0
  1. Q Y
  1. ;
  1. MSG ; List information message
  1. W !!,"This utility will Report on and Clean Up Encounter Date/Time"
  1. W !,"error code 421 entries in the #409.75 and #9000010 files."
  1. W !,"Both options will E-mail a summary report to the user."
  1. W !,"Updated entries will be flagged for Retransmission to the NPCD."
  1. W !!,"The REPORT ONLY option does NOT update any file information."
  1. W !,"You may run the REPORT ONLY option to your CRT or to a device."
  1. W !,"The CLEAN UP & REPORT option MUST be queued to a device."
  1. Q
  1. ;
  1. TITLE ; Screen title
  1. W @IOF
  1. S TITLE="SD*5.3*227 Encounter 421 Error Report & Cleanup"
  1. W !!,?(80-$L(TITLE)\2),TITLE
  1. S X=$$HTE^XLFDT($H)
  1. W !,?(80-$L(X)\2),X
  1. Q