source: FOIAVistA/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RA27PST.m@ 674

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

initial load of FOIAVistA 6/30/08 version

File size: 5.6 KB
Line 
1RA27PST ;HIRMFO/SWM - Clean up after Patch RA*5.0*27 ;12/28/01 14:06
2VERSION ;;5.0;Radiology/Nuclear Medicine;**27**;Mar 16, 1998
3 ; *** Delete duplicate Clinical History from file #74 ***
4 ;
5QOFF ;Post-Install queues off clean-up job
6 I '$D(XPDNM)#2 W !!,"** This entry point must be called from KIDS installation **",!! Q
7 N RATXT,ZTDESC,ZTDTH,ZTIO,ZTRTN S ZTIO=""
8 S ZTRTN="EN^RA27PST"
9 S ZTDESC="RA*5.0*27 Cleanup Duplicate Clin. Hist. from File 74"
10 S ZTDTH=$$FMADD^XLFDT($$NOW^XLFDT(),0,0,2,0) ;add 2 minutes to 'now'
11 D ^%ZTLOAD S RATXT(1)=" "
12 S RATXT(2)="RA*5.0*27 cleanup is running in background."
13 S:$G(ZTSK)>0 RATXT(3)="Task: "_ZTSK_"." D MES^XPDUTL(.RATXT)
14 Q
15MANUAL ;manually queue off clean-up job, only needed if post-install abends
16 ;^XTMP("RA-RA27PST",0)=60days later^date+time this was 1st run^description^subsequent date+time this was run (overwritten each subsequent time)
17 I +$G(DUZ)=0 W !!?5,"** DUZ is required! Nothing done. **",!! Q
18 N RA1 S RA1=""
19 I $D(^XTMP("RA-RA27PST",0))#2 S RA1=^(0)
20 I RA1="" W !,"This clean-up was either never queued off by the Installation of RA*5.0*27,",!,"or it had been completed over 60 days ago.",!! G ASKQ
21 I $P(RA1,"^",4)]"" S Y=$P(RA1,"^",4) D DD^%DT W !!?2,"MANUAL^RA27PST was done previously on ",Y,!!
22 I $P(RA1,"^",4)="" S Y=$P(RA1,"^",2) D DD^%DT W !!?2,"The installation of RA*5*27 tasked this job on ",Y,!?2,"but the job abended.",!!
23 I $G(^XTMP("RA-RA27PST","LAST"))="DONE" W !,"This clean-up was completed. You do not have to queue it again.",!! Q
24ASKQ K DIR,DIROUT,DIRUT,DTOUT,DUOUT
25 S DIR(0)="Y",DIR("B")="No"
26 S DIR("?")="Enter 'Y' if you want to queue the clean-up of duplicate Clin. History for File #74."
27 S DIR("A")="Do you want to continue the clean-up from patch RA*5.0*27"
28 D ^DIR
29 K DIR,DIROUT,DIRUT,DTOUT,DUOUT
30 Q:'Y ;don't queue if answer is NO
31 N ZTDESC,ZTDTH,ZTIO,ZTRTN S ZTIO=""
32 S ZTRTN="EN^RA27PST"
33 S ZTDESC="MANUAL Cleanup Duplicate Clin. Hist. from File 74, (RA*5*27 post-install)"
34 S ZTDTH=$$FMADD^XLFDT($$NOW^XLFDT(),0,0,2,0) ;add 2 minutes to 'now'
35 D ^%ZTLOAD
36 W !?2,"RA*5.0*27 cleanup will start in 2 minutes in the background."
37 I $G(ZTSK)>0 W !?2,"Task: "_ZTSK_".",!!
38 Q
39 ;
40EN ; delete duplicate clinical history from file 74
41 S ZTREQ="@" ; delete from the task global
42 N %,RA70,RA701,RA74,RACNT,RAD0,RADFN,RADTI,RADELCNT,RADUPCNT
43 N RACNI,RACN,RACNT,RADUPHX,RANODE,RAOK,RAPOINT,RAX,RAX1
44 N RA1,RA2,RA3
45 S RA1="To IRM staff:"
46 S RA2=" If this routine abends, you may get the current count"
47 S RA3=" of records processed by listing ^XTMP(""RA-RA27PST"" "
48 S ^XTMP("RA-RA27PST",.1)=" Here are the counts from the post-install cleanup."
49 S ^XTMP("RA-RA27PST",.2)=" "
50 D INIT
51 I RAPOINT="DONE" S ^XTMP("RA-RA27PST",.1)="Already done previously. No need to continue.",^(.3)="----- Previous results are repeated below: ----- ",^(.4)="" D MAIL Q
52 S RAD0=+RAPOINT
53 F S RAD0=$O(^RARPT(RAD0)) Q:'RAD0 D CHKHX D:RADUPHX DELHX S ^XTMP("RA-RA27PST","LAST")=RAD0,RACNT=RACNT+1,$P(^XTMP("RA-RA27PST",.5),"^")=RACNT
54 ; increment "LAST" and RACNT after chkhx and delhx
55 D FINISH
56 D MAIL
57 Q
58CHKHX ; Check History between file 70 and 74.
59 ; Returns RADUPHX 1 = Duplicate
60 ; 0 = Different
61 S RADUPHX=0
62 I '$O(^RARPT(RAD0,"H",0)) Q ;default to 0 to skip DELHX since no data
63 S RANODE=$G(^RARPT(RAD0,0)) Q:RANODE=""
64 S RADFN=$P(RANODE,"^",2),RADTI=9999999.9999-$P(RANODE,"^",3)
65 S RACN=$P(RANODE,"^",4)
66 Q:'RADFN!('RADTI)!('RACN)
67 S RACNI=$O(^RADPT(RADFN,"DT",RADTI,"P","B",RACN,0))
68 Q:'RACNI
69 S RA74=$O(^RARPT(RAD0,"H",""),-1)
70 S RA70=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"H",""),-1),RA701=$O(^(0))
71 Q:RA70=0 Q:RA701="" ;no history in exam record
72 S RAX=RA74-RA70+1 Q:RAX'=1 ;different total lines
73 ; same total lines, so check line by line
74 ; RAOK=1 all lines match, =0 at least 1 difference
75 S RAOK=1
76 F RAX1=RA701:1:RA70 I ^RARPT(RAD0,"H",RAX1,0)'=^RADPT(RADFN,"DT",RADTI,"P",RACNI,"H",RAX1,0) S RAOK=0 Q
77 I 'RAOK Q
78 S RADUPCNT=RADUPCNT+1
79 S $P(^XTMP("RA-RA27PST",.6),"^")=RADUPCNT
80 I $P(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0),"^",17)'=RAD0 D MSG1 Q ;exam not pointing to this report, so skip this report
81 S RADUPHX=1
82 Q
83DELHX ; delete history portion from this report
84 L +^RARPT(RAD0):0 I '$T D MSG2 Q
85 K ^RARPT(RAD0,"H")
86 L -^RARPT(RAD0)
87 S RADELCNT=RADELCNT+1
88 S $P(^XTMP("RA-RA27PST",.7),"^")=RADELCNT
89 Q
90MSG1 ;
91 S ^XTMP("RA-RA27PST",RAD0)=$P(RANODE,"^")_" ien="_RAD0_" but",^XTMP("RA-RA27PST",(RAD0+.1))=" ^RADPT("_RADFN_",""DT"","_RADTI_",""P"","_RACNI_",0)'s 17th piece="_$P(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0),"^",17)
92 Q
93MSG2 ;
94 S ^XTMP("RA-RA27PST",RAD0)=$P(RANODE,"^")_" locked by another process."
95 Q
96INIT ; set point of latest ien processed
97 N %,%H,%I,%T,X,Y,RANOW
98 D NOW^%DTC S RANOW=% ;output NOW's dt+tm is in var %
99 I $D(^XTMP("RA-RA27PST",0))#2 S $P(^(0),"^",4)=RANOW,RAPOINT=^("LAST"),RACNT=+^(.5),RADUPCNT=+^(.6),RADELCNT=+^(.7) Q
100 S (RACNT,RADELCNT,RADUPCNT,RAPOINT)=0
101 S X1=RANOW,X2=60 D C^%DTC ;add 60 days to RANOW, output is X
102 S ^XTMP("RA-RA27PST",0)=X_"^"_RANOW_"^"_"RA*5*27 POST-INSTALL"
103 S ^XTMP("RA-RA27PST","LAST")=0
104 S ^XTMP("RA-RA27PST",.5)="^ reports processed"
105 S ^XTMP("RA-RA27PST",.6)="^ reports with dupl history"
106 S ^XTMP("RA-RA27PST",.7)="^ reports had dupl history purged"
107 Q
108FINISH ; all done
109 S ^XTMP("RA-RA27PST","LAST")="DONE"
110 S ^XTMP("RA-RA27PST",.8)=" "
111 S ^XTMP("RA-RA27PST",.81)=" The cleanup finished."
112 S ^XTMP("RA-RA27PST",.82)=" "
113 I $O(^XTMP("RA-RA27PST",.99)) S ^XTMP("RA-RA27PST",.83)="The following reports' history was not purged:",^(.84)=" "
114 Q
115MAIL ; Send mail message to the installer
116 N XMDUZ,XMSUB,XMTEXT,XMY S XMDUZ=.5
117 S XMTEXT="^XTMP(""RA-RA27PST""," ;only numeric nodes are mailed
118 S XMSUB="Results from patch RA*5*27's post-install rtn RA27PST"
119 S XMY(DUZ)="" D ^XMD
120 Q
Note: See TracBrowser for help on using the repository browser.