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

SD53103B.m

Go to the documentation of this file.
  1. SD53103B ;ALB/MJK - Unique Visit ID Clean Up ; March 10,1997
  1. ;;5.3;Scheduling;**103,1015**;AUG 13, 1993;Build 21
  1. ;
  1. Q
  1. ;
  1. OE(SDOE) ; -- display oe data
  1. N DIQ,DIC,DR,DA,SDLINE
  1. S $P(SDLINE,"=",80)=""
  1. W !,SDLINE,!
  1. S DIC="^SCE(",DA=SDOE,DIQ(0)="CAR" D EN^DIQ
  1. W !,SDLINE,!
  1. Q
  1. ;
  1. HDR(TEXT) ; -- intro header
  1. N X
  1. S X=">>>> Encounter Clean Up Tool for -1 Visit ID's ["_TEXT_"] <<<<"
  1. S T=(80-$L(X))/2
  1. W @IOF,!?T,X
  1. Q
  1. ;
  1. INIT() ; -- init global locals
  1. N SDOK
  1. D HOME^%ZIS
  1. S SDOK=1,U="^",SDTALK=0
  1. IF '$G(DT) S DT=$$DT^XLFDT()
  1. ;
  1. IF '$G(DUZ) D G INITQ
  1. . W !,"DUZ is not defined."
  1. . S SDOK=0
  1. ;
  1. IF '$O(^DIC(9.4,"C","SD",0)) D G INITQ
  1. . W !,"No package with 'SD' namespace exists on the system."
  1. . S SDOK=0
  1. ELSE D
  1. . S SDPKG=$O(^DIC(9.4,"C","SD",0))
  1. ;
  1. INITQ Q SDOK
  1. ;
  1. RESULTS(SDMODE,SDBEG,SDEND,SDRT,SDCNT) ; generate an e-mail bulletin when done
  1. N DIFROM,I,LINE,X
  1. S SDCOUNT=0
  1. D LINE("The Unique Visit ID cleanup has run to completion."),LINE("")
  1. D LINE(" Start Time: "_$$FMTE^XLFDT(SDBEG))
  1. D LINE(" End Time: "_$$FMTE^XLFDT(SDEND))
  1. D LINE(" Run Mode: "_$S(SDMODE=1:"Count Only",1:"Fix Entries")),LINE("")
  1. IF $$S^%ZTLOAD D
  1. . D LINE(" >>> Task Stopped by user. <<<")
  1. . D LINE("")
  1. . S ZTSTOP=1
  1. ;
  1. D LINE("Total number of Outpatient Encounter entries "_$S(SDMODE=1:"that will be ",1:"")_"processed: "_SDCNT),LINE(""),LINE("")
  1. ;
  1. IF SDMODE=2 D
  1. . D LINE("Note: Child encounters re-linked as part of parent")
  1. . D LINE(" re-linking process are not listed below nor")
  1. . D LINE(" counted in the total above.")
  1. . D LINE("")
  1. ;
  1. ; -- layout of line
  1. D LINE("Message Format:")
  1. D LINE(" Piece Description")
  1. D LINE(" ----- -----------")
  1. D LINE(" 1 Status of update")
  1. D LINE(" 2 Internal Entry Number of Outpatient Encounter file")
  1. D LINE(" 3 Internal Entry Number of Parent Outpatient Encounter file")
  1. D LINE(" 4 Internal Entry Number of Visit file")
  1. D LINE(" 5 Patient Name")
  1. D LINE(" 6 Encounter Date/Time")
  1. D LINE(" 7 Hospital Location")
  1. D LINE("")
  1. ;
  1. ; --scan tmp records
  1. F I=0:0 S I=$O(@SDRT@(I)) Q:'I D
  1. . D LINE(@SDRT@(I))
  1. ;
  1. ; -- set up and fire bulletin
  1. S XMSUB="Unique Visit ID Cleanup is Complete",XMN=0
  1. S XMTEXT="^TMP(""SDVISIT MSG"",$J,"
  1. S XMDUZ=.5,XMY(DUZ)=""
  1. D ^XMD
  1. K ^TMP("SDVISIT MSG",$J)
  1. K SDCOUNT,SDTEXT,XMDUZ,XMN,XMSUB,XMTEXT,XMY,XMZ
  1. Q
  1. ;
  1. ;
  1. LINE(TEXT) ; add text to mail message
  1. S SDCOUNT=SDCOUNT+1,^TMP("SDVISIT MSG",$J,SDCOUNT)=TEXT
  1. Q
  1. ;
  1. RANGE(SDBEG,SDEND) ; -- select range
  1. N SDWITCH,SDT,X1,X2,X,DIR
  1. S (SDBEG,SDEND)=0,SDT=2961001
  1. S DIR("B")=$$FDATE^VALM1(SDT)
  1. S DIR(0)="DA"_U_SDT_":"_DT_":EXP",DIR("A")="Select Beginning Date: "
  1. S DIR("?",1)="Enter a date between "_$$FMTE^XLFDT(SDT)_" to "_$$FMTE^XLFDT(DT)_".",DIR("?")=" "
  1. W ! D ^DIR K DIR G RANGEQ:Y'>0 S SDBEG=Y
  1. S DIR("B")=$$FDATE^VALM1(DT)
  1. S DIR(0)="DA"_U_SDBEG_":"_DT_":EXP",DIR("A")="Select Ending Date: "
  1. S DIR("?",1)="Enter a date between "_$$FMTE^XLFDT(SDBEG)_" to "_$$FMTE^XLFDT(DT)_".",DIR("?")=" "
  1. D ^DIR K DIR G RANGEQ:Y'>0 S SDEND=Y_".235959"
  1. RANGEQ Q SDEND
  1. ;
  1. OK() ; -- ok to continue
  1. N DIR,Y
  1. S DIR("A")="Ok to continue"
  1. S DIR("B")="NO"
  1. S DIR(0)="Y"
  1. D ^DIR
  1. IF Y'=1 S Y=0
  1. Q Y
  1. ;
  1. MODE() ; -- select update mode
  1. N DIR,Y
  1. S DIR(0)="S"_U_"1:Count Only;2:Fix Entries"
  1. S DIR("A")="Select update mode"
  1. S DIR("B")="Count Only"
  1. D ^DIR
  1. IF Y'=1,Y'=2 S Y=0
  1. Q Y
  1. ;