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

SD53227.m

Go to the documentation of this file.
  1. SD53227 ;ALB/RBS - Print Encounter/Visit Date/Time 421 error ; 10/11/00 5:23pm
  1. ;;5.3;Scheduling;**227,1015**;AUG 13, 1993;Build 21
  1. ;
  1. ;DBIA Integration Reference # 3211.
  1. ;
  1. ;This routine will print a report of Encounters with a 421 error code
  1. ;(invalid date and time) that can or cannot be cleaned up.
  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. ;
  1. PRINT ; Print report
  1. K @SDTEMP@(3) ;kill E-mail node
  1. N DASH,ENCPTR,ERRPTR,GTOT,HEAD1,LINE,SDI,SDL,SDX,STR
  1. N PAGE,SUBT1,SUBT2,TOTALS,XMITPTR,X,Y
  1. S (ERRPTR,XMITPTR,ENCPTR,SDX,STR,X,Y)=""
  1. S (EXIT,GTOT,PAGE,SDL,TOTALS)=0
  1. D HEAD
  1. ;
  1. ; loop thru error and fix nodes to setup report info
  1. F SDI=1,2 D:$O(@SDTEMP@(SDI,""))'="" Q:EXIT
  1. .D HDR(SDI) Q:EXIT
  1. .F S ERRPTR=$O(@SDTEMP@(SDI,ERRPTR)) Q:ERRPTR="" D Q:EXIT
  1. ..I ($$S^%ZTLOAD) S EXIT=1 Q
  1. ..S $P(TOTALS,U,SDI)=$P(TOTALS,U,SDI)+1,GTOT=GTOT+1
  1. ..F S XMITPTR=$O(@SDTEMP@(SDI,ERRPTR,XMITPTR)) Q:XMITPTR="" D Q:EXIT
  1. ...F S ENCPTR=$O(@SDTEMP@(SDI,ERRPTR,XMITPTR,ENCPTR)) Q:ENCPTR="" D Q:EXIT
  1. ....S STR=@SDTEMP@(SDI,ERRPTR,XMITPTR,ENCPTR)
  1. ....Q:$G(STR)=""
  1. ....D WRT(STR,SDI)
  1. ....Q:EXIT
  1. .D TOTAL(SDI,TOTALS,0)
  1. .S PAGE=0
  1. S $P(TOTALS,U,3)=GTOT,PAGE=0
  1. D HDR(2) Q:EXIT
  1. D MHDR(2)
  1. S SUBT1="GRAND TOTALS:"
  1. W !!,SUBT1,! ;write to device
  1. D XML(""),XML(SUBT1),XML("") ;write to E-mail
  1. F SDI=1,2,3 D TOTAL(SDI,TOTALS,1)
  1. S SUBT1="<End of Report>"
  1. W !!,SUBT1,!
  1. D XML(""),XML(SUBT1),XML(DASH)
  1. Q
  1. ;
  1. LINE1(STR,SDX) ;Format 1st output line
  1. S SDX=""
  1. D XMX(1,$E($P(STR,U,2),1,22)),XMX(25,$P(STR,U,4)),XMX(37,$E($P(STR,U,5),1,20)),XMX(60,$$DT($P(STR,U,6)))
  1. Q
  1. ;
  1. LINE2(STR,SDX) ; Format 2nd output line
  1. S SDX=""
  1. D XMX(50,"New D/T:"),XMX(60,$$DTT(STR))
  1. Q
  1. ;
  1. WRT(STR,SDI) ;Write to screen/device or Add to E-mail report file
  1. S SDX=""
  1. I CRT,($Y>(IOSL-5)) D HDR(SDI) Q:EXIT
  1. D LINE1(STR,.SDX)
  1. W !,SDX
  1. D LINE2($P(STR,U,7),.SDX)
  1. W !,SDX
  1. Q
  1. ;
  1. XMX(X,Y) ;Set message text value
  1. S $E(SDX,X)=Y
  1. Q
  1. ;
  1. XML(X) ;Set message text line
  1. ; ^XTMP("SD53P227",3,#) = E-mail report of all records
  1. S SDL=SDL+1
  1. S @SDTEMP@(3,SDL)=X
  1. Q
  1. ;
  1. DT(SDDT) ;Format slashed date - (Original date/time with seconds)
  1. Q $E(SDDT,4,5)_"/"_$E(SDDT,6,7)_"/"_(17+$E(SDDT))_$E(SDDT,2,3)_"@"_$P(SDDT,".",2)
  1. ;
  1. DTT(SDDT) ;Format slashed date - (New date/time without seconds)
  1. I $E(SDDT)'?1N Q SDDT ;error msg's will kick out
  1. Q $E(SDDT,4,5)_"/"_$E(SDDT,6,7)_"/"_(17+$E(SDDT))_$E(SDDT,2,3)_"@"_$E($P(SDDT,".",2)_"0000",1,4)
  1. ;
  1. HDR(SDI) ; Print header
  1. S (SDX,X)=""
  1. I PAGE,CRT D Q:EXIT
  1. .S DIR(0)="E" D ^DIR K DIR
  1. .I $D(DIRUT)!$D(DTOUT)!$D(DUOUT) S EXIT=1 Q
  1. .S EXIT='+$G(Y)
  1. W @IOF
  1. S PAGE=PAGE+1,X="Page: "_PAGE,SDX=RUNDT,$E(SDX,(80-$L(X)))=X
  1. W TITLE,!,SDX,!,$S(SDI=1:SUBT1,1:SUBT2),!,HEAD1,!,DASH
  1. Q
  1. ;
  1. MHDR(SDI) ; Sets up the Mail msg header
  1. S (SDX,X)="",X="Page: 1",SDX=RUNDT,$E(SDX,(80-$L(X)))=X
  1. D XML(""),XML(TITLE),XML(SDX)
  1. S SDX="",X="Summary of Encounters",$E(SDX,(80-$L(X)\2))=X
  1. D XML(SDX),XML(DASH)
  1. Q
  1. ;
  1. TOTAL(SDI,TOTALS,Y) ; Print out totals
  1. S X="Total Encounters "
  1. S X=X_$S(SDI=1:"Unsendable:",SDI=2:"Flagged...:",SDI=3:"Searched..:",1:"")
  1. S X=X_$J(+$P(TOTALS,U,SDI),10)
  1. W !,X
  1. D:Y XML(X)
  1. Q
  1. ;
  1. N X
  1. S SDTEMP="^XTMP(""SD53P227"")",$P(DASH,"-",80)="",X=TITLE
  1. S:SDRTYP="R" X=$P(TITLE," & Cleanup")
  1. S TITLE="",$E(TITLE,(80-$L(X)\2))=X,X=""
  1. S X="Date Run: "_$P($$FMTE^XLFDT(TIMESTRT),":",1,2),$E(RUNDT,(80-$L(X)\2))=X,X=""
  1. S X="Error listing of Encounters not updated"
  1. S $E(SUBT1,(80-$L(X)\2))=X
  1. S X="Preview list of Encounters to be updated"
  1. S:FIX X="Encounters Updated and Flagged for Retransmission"
  1. S $E(SUBT2,(80-$L(X)\2))=X,X=""
  1. ;
  1. D XMX(1,"Patient"),XMX(25,"SSN"),XMX(37,"Location"),XMX(60,"Encounter Date/Time")
  1. S HEAD1=SDX
  1. Q
  1. ;
  1. NOFIND ; Nothing to report
  1. N DASH,HEAD1,LINE,SDI,SDL,SDX,STR
  1. N PAGE,SUBT1,SUBT2,X,Y
  1. S (SDI,SDL,SDX,STR,SUBT1,SUBT2,X,Y)=""
  1. S (EXIT,PAGE,SDL)=0
  1. D HEAD,HDR(1)
  1. K @SDTEMP@(3) ;kill E-mail node
  1. S X="No Outpatient Encounter 421 Error records found."
  1. W !!,X
  1. D XML(""),XML(X),XML("")
  1. S X="<End of Report>"
  1. W !!,X
  1. D XML(X),XML("")
  1. Q