source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SD53103B.m@ 1582

Last change on this file since 1582 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1SD53103B ;ALB/MJK - Unique Visit ID Clean Up ; March 10,1997
2 ;;5.3;Scheduling;**103**;AUG 13, 1993
3 ;
4 Q
5 ;
6OE(SDOE) ; -- display oe data
7 N DIQ,DIC,DR,DA,SDLINE
8 S $P(SDLINE,"=",80)=""
9 W !,SDLINE,!
10 S DIC="^SCE(",DA=SDOE,DIQ(0)="CAR" D EN^DIQ
11 W !,SDLINE,!
12 Q
13 ;
14HDR(TEXT) ; -- intro header
15 N X
16 S X=">>>> Encounter Clean Up Tool for -1 Visit ID's ["_TEXT_"] <<<<"
17 S T=(80-$L(X))/2
18 W @IOF,!?T,X
19 Q
20 ;
21INIT() ; -- init global locals
22 N SDOK
23 D HOME^%ZIS
24 S SDOK=1,U="^",SDTALK=0
25 IF '$G(DT) S DT=$$DT^XLFDT()
26 ;
27 IF '$G(DUZ) D G INITQ
28 . W !,"DUZ is not defined."
29 . S SDOK=0
30 ;
31 IF '$O(^DIC(9.4,"C","SD",0)) D G INITQ
32 . W !,"No package with 'SD' namespace exists on the system."
33 . S SDOK=0
34 ELSE D
35 . S SDPKG=$O(^DIC(9.4,"C","SD",0))
36 ;
37INITQ Q SDOK
38 ;
39RESULTS(SDMODE,SDBEG,SDEND,SDRT,SDCNT) ; generate an e-mail bulletin when done
40 N DIFROM,I,LINE,X
41 S SDCOUNT=0
42 D LINE("The Unique Visit ID cleanup has run to completion."),LINE("")
43 D LINE(" Start Time: "_$$FMTE^XLFDT(SDBEG))
44 D LINE(" End Time: "_$$FMTE^XLFDT(SDEND))
45 D LINE(" Run Mode: "_$S(SDMODE=1:"Count Only",1:"Fix Entries")),LINE("")
46 IF $$S^%ZTLOAD D
47 . D LINE(" >>> Task Stopped by user. <<<")
48 . D LINE("")
49 . S ZTSTOP=1
50 ;
51 D LINE("Total number of Outpatient Encounter entries "_$S(SDMODE=1:"that will be ",1:"")_"processed: "_SDCNT),LINE(""),LINE("")
52 ;
53 IF SDMODE=2 D
54 . D LINE("Note: Child encounters re-linked as part of parent")
55 . D LINE(" re-linking process are not listed below nor")
56 . D LINE(" counted in the total above.")
57 . D LINE("")
58 ;
59 ; -- layout of line
60 D LINE("Message Format:")
61 D LINE(" Piece Description")
62 D LINE(" ----- -----------")
63 D LINE(" 1 Status of update")
64 D LINE(" 2 Internal Entry Number of Outpatient Encounter file")
65 D LINE(" 3 Internal Entry Number of Parent Outpatient Encounter file")
66 D LINE(" 4 Internal Entry Number of Visit file")
67 D LINE(" 5 Patient Name")
68 D LINE(" 6 Encounter Date/Time")
69 D LINE(" 7 Hospital Location")
70 D LINE("")
71 ;
72 ; --scan tmp records
73 F I=0:0 S I=$O(@SDRT@(I)) Q:'I D
74 . D LINE(@SDRT@(I))
75 ;
76 ; -- set up and fire bulletin
77 S XMSUB="Unique Visit ID Cleanup is Complete",XMN=0
78 S XMTEXT="^TMP(""SDVISIT MSG"",$J,"
79 S XMDUZ=.5,XMY(DUZ)=""
80 D ^XMD
81 K ^TMP("SDVISIT MSG",$J)
82 K SDCOUNT,SDTEXT,XMDUZ,XMN,XMSUB,XMTEXT,XMY,XMZ
83 Q
84 ;
85 ;
86LINE(TEXT) ; add text to mail message
87 S SDCOUNT=SDCOUNT+1,^TMP("SDVISIT MSG",$J,SDCOUNT)=TEXT
88 Q
89 ;
90RANGE(SDBEG,SDEND) ; -- select range
91 N SDWITCH,SDT,X1,X2,X,DIR
92 S (SDBEG,SDEND)=0,SDT=2961001
93 S DIR("B")=$$FDATE^VALM1(SDT)
94 S DIR(0)="DA"_U_SDT_":"_DT_":EXP",DIR("A")="Select Beginning Date: "
95 S DIR("?",1)="Enter a date between "_$$FMTE^XLFDT(SDT)_" to "_$$FMTE^XLFDT(DT)_".",DIR("?")=" "
96 W ! D ^DIR K DIR G RANGEQ:Y'>0 S SDBEG=Y
97 S DIR("B")=$$FDATE^VALM1(DT)
98 S DIR(0)="DA"_U_SDBEG_":"_DT_":EXP",DIR("A")="Select Ending Date: "
99 S DIR("?",1)="Enter a date between "_$$FMTE^XLFDT(SDBEG)_" to "_$$FMTE^XLFDT(DT)_".",DIR("?")=" "
100 D ^DIR K DIR G RANGEQ:Y'>0 S SDEND=Y_".235959"
101RANGEQ Q SDEND
102 ;
103OK() ; -- ok to continue
104 N DIR,Y
105 S DIR("A")="Ok to continue"
106 S DIR("B")="NO"
107 S DIR(0)="Y"
108 D ^DIR
109 IF Y'=1 S Y=0
110 Q Y
111 ;
112MODE() ; -- select update mode
113 N DIR,Y
114 S DIR(0)="S"_U_"1:Count Only;2:Fix Entries"
115 S DIR("A")="Select update mode"
116 S DIR("B")="Count Only"
117 D ^DIR
118 IF Y'=1,Y'=2 S Y=0
119 Q Y
120 ;
Note: See TracBrowser for help on using the repository browser.