source: FOIAVistA/trunk/r/RECORD_TRACKING-RT/RTSM1.m@ 1203

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

initial load of FOIAVistA 6/30/08 version

File size: 4.8 KB
Line 
1RTSM1 ;TROY ISC/MJK,PKE-Record File Initialization Utility ; 5/21/87 4:06 PM ; 1/7/03 11:51am
2 ;;2.0;Record Tracking;**4,14,34**;10/22/91
3RTTY ;
4 F RTHOLD=0:0 S RTHOLD=+$O(RTHOLD(RTHOLD)) Q:'RTHOLD S RTTY=RTHOLD(RTHOLD) S RT=+$O(^RT("AT",+RTTY,RTE,0)) D CREATE:'RT,LBL:RTION]""
5 S RTCNTP=RTCNTP+1 I '(RTCNTP#50) H $S(RTION="":0,1:$S($D(^DIC(195.4,1,"COOL")):^("COOL"),1:0))*60 I '(RTCNTP#100) W !,RTCNTP," patients processed. " D NOW^%DTC S Y=$E(%,1,12) D DT^DIQ
6 K RT,RTTY Q
7 ;
8CREATE ;
9 D CREATE^RTDPA1 S:RT RTCNTR=RTCNTR+1 Q
10 ;
11LBL ;
12 H 8 S RTFMT=+$P(RTTY,"^",5) I $D(^DIC(194.4,RTFMT,0)) S IOP=RTION D ^%ZIS K IOP S RTNUM=1,RTIFN=RT U IO D PRT^RTL1 S RTCNTL=RTCNTL+1 Q
13 ;
14LOAD ;Entry load record from DPT
15 ;MUST:
16 ; RTAPL
17 ; RTMES
18 ; RTLOAD
19 ; RTDIV
20 ; RADPT
21 ;
22 ;optional:
23 ; RTION - 'name' of printer to labels on (null for no labels)
24 ; RTERM - list of terminal digits or 'NAME'
25 ;
26 D SEL^RTSM2 G Q:'$D(RTHOLD) S RTVAR="RADPT^RTDIV^RTMES1^RTLOAD^RTHOLD^RTAPL"_$S($D(RTION):"^RTION",1:"")_$S($D(RTERM):"^RTERM",1:"")_$S($D(RTSTART):"^RTSTART",1:""),RTPGM="START^RTSM1" D ZIS^RTUTL G Q:POP
27START K ^TMP($J),RTSHOW,RTADM S (RTCNTR,RTCNTP,RTCNTL)=0,RTBKGRD="" D HOLD S:'$D(RTION) RTION=""
28 I $D(RTERM),RTERM'="NAME" F I=1:1 Q:$P(RTERM,"^",I)="" S RTERM($P(RTERM,"^",I))=""
29 W @IOF,!,RTMES1,!!?5,"START TIME: " D NOW^%DTC S Y=$E(%,1,12) D DT^DIQ W !!,"Log",!,"---" D @RTLOAD
30 W !,"[TOTAL PATIENTS PROCESSED : ",RTCNTP,"]"
31 W !,"[TOTAL NUMBER OF RECORDS CREATED: ",RTCNTR,"]"
32 W !,"[TOTAL RECORD LABELS CREATED : ",RTCNTL,"]"
33 W !!?5,"STOP TIME: " D NOW^%DTC S Y=$E(%,1,12) D DT^DIQ W !
34 I RTION]"" S IOP=RTION D ^%ZIS K IOP U IO W !
35Q K ^TMP($J),RTERM,RADPT,RTHOLD,RTION,RTMES1,RTLOAD,RTN,RTHOLD,RTBKGRD,RTCNTP,RTCNTL,RTCNTR,RTTY D CLOSE^RTUTL
36 K DA,D0,DIC,DIE,DR,I,I1,RTE,RTPGM,RTVAR,RTBC,RTJ,RTPGM,RTXX,X1,Y Q
37HOLD F I1=1:1 Q:'$P(RTHOLD,"^",I1) S Y=$P(RTHOLD,"^",I1) D TYPE1^RTUTL S:$D(RTTY) RTHOLD(Y)=RTTY
38 K I1,RTTY Q
39 ;
40 ;
41SORT D NOW^%DTC S $P(^RTV(194.3,1,0),"^",2,3)=%_"^"
42 S (DFN,LDFN)=$S($D(^RTV(194.3,1,1,0)):+$P(^(0),"^",3),1:0)
43 ;just set it the first time
44 I 'DFN D ONETIM^RTSM4,QS Q
45 ;check for new records
46 F S DFN=$O(^DPT(DFN)) Q:'DFN DO
47 .S LDFN=DFN
48 .I '$D(^RTV(194.3,1,1,DFN,0)) D FILE W:'$D(ZTQUEUED) "." Q
49 ;verify/update old records
50 S (RTCT,TD)=0 F S TD=$O(^RTV(194.3,1,1,"AC",TD)) Q:TD="" DO
51 .S DFN=0 F S DFN=$O(^RTV(194.3,1,1,"AC",TD,DFN)) Q:'DFN DO
52 . .I '$D(^DPT(DFN,0)) K ^RTV(194.3,1,1,"AC",TD,DFN) S DA(1)=1,DA=DFN,DIK="^RTV(194.3,1,1," D ^DIK K DE,DQ Q
53 . .S SSN=$P(^DPT(DFN,0),"^",9),RTCT=RTCT+1
54 . .I '$D(ZTQUEUED),DFN#1000=0 W ","
55 . .I TD'=($E(SSN,8,9)_$E(SSN,6,7)_$E(SSN,1,5)) DO
56 . . .;get rid of old xref and entry
57 . . .K ^RTV(194.3,1,1,"AC",TD,DFN)
58 . . .S DA(1)=1,DA=DFN,DIK="^RTV(194.3,1,1," D ^DIK K DE,DQ
59 . . .;update new one
60 . . .D FILE Q
61QS ;update for next time
62 D NOW^%DTC S $P(^RTV(194.3,1,0),"^",3)=%
63 S $P(^RTV(194.3,1,1,0),"^",3,4)=LDFN_"^"_RTCT
64 K RTCT,LDFN,TD,DFN,SSN,DA,DIC,DIK,DR Q
65 ;
66FILE I '$D(^RTV(194.3,1,1,0)) S ^(0)="^194.31PA^0^0"
67 S DIC="^RTV(194.3,1,1,",DIC(0)="L",DIC("DR")="1///`"_DFN
68 K DD,DO S (X,DINUM)=DFN D FILE^DICN Q
69 ;
7012 ;;Create Terminal Digit Sort Global
71 W !!,"RECORD TRACKING SORT GLOBAL Compilation" S Y=""
72 I $D(^RTV(194.3,1,0)),$P(^(0),"^",2),$P(^(0),"^",3) DO
73 .W !!,*7,"The SORT global already exists.",!?11,"Compilation started: "
74 .S Y1=$P(^(0),"^",2,3),Y=$P(Y1,"^") D DT^DIQ ;naked rtv(194.3,1,0)
75 .I $S('$D(^RTV(194.3,1,1,0)):1,'$P(^(0),"^",3):1,1:0) Q
76 .W !?8,"Last patient processed: ",$P(^(0),"^",3) ;nakd rtv(194.3,1,1,0
77 .W !?8," Compilation finished: "
78 .S Y=$P(Y1,"^",2) D DT^DIQ
79 .K Y
80 S RTRD(1)="Yes^queue job",RTRD(2)="No^not queue job",RTRD(0)="S",RTRD("B")=2,RTRD("A")="Do you wish to queue a job that will "_$S('$D(Y):"Update-",1:"")_"compile this global? " D SET^RTRD K RTRD G Q12:$E(X)'="Y"
81 S RTVAR="",(ION,IOM,IOST)="",RTPGM="SORT^RTSM1" D Q^RTUTL K RTVAR,RTPGM S IOP="" D ^%ZIS
82 ;
83Q12 K IOP,X1,Y,RTVAR,RTPGM,X,X1,Y1 Q
84 ;
8513 ;;Delete Terminal Digit Sort Global
86 W !,"It is not usually necessary to delete this global, just compile it"
87 S RTRD(0)="S",RTRD(1)="Yes^delete global",RTRD(2)="No^keep global",RTRD("A")="Are you sure you want to delete the RT SORT GLOBAL entries? ",RTRD("B")=2 D SET^RTRD K RTRD
88 I $E(X)="Y" DO
89 .K ^RTV(194.3,1,1)
90 .;reset nodes
91 .S ^RTV(194.3,1,0)="TERMINAL DIGITS^^"
92 .S ^RTV(194.3,1,1,0)="^194.31PA^^"
93 .W !?3,"...deleted"
94 K Y,X,X1 Q
95 ;
96 ;set logic 194.3 ac xref
97S1943 I $D(^DPT(X,0)) S SSN=$P(^(0),"^",9),DOB=$P(^(0),"^",3) I SSN,DOB DO
98 .S DVBDIS=$O(^DPT(X,"DIS",0)) I 'DVBDIS
99 .E S DVBDIS=$S('$D(^(DVBDIS,0)):"",1:$P(^(0),"^",4)) ;nakd dpt(x,dis,0)
100 .S ^RTV(194.3,1,1,"AC",$E(SSN,8,9)_$E(SSN,6,7)_$E(SSN,1,5),X)=DVBDIS
101 K SSN,DOB,DVBDIS Q
102 ;
103 ;kill logic 194.3 ac xref
104K1943 I $D(^DPT(X,0)) S SSN=$P(^(0),"^",9),DOB=$P(^(0),"^",3) I SSN,DOB DO
105 .K ^RTV(194.3,1,1,"AC",$E(SSN,8,9)_$E(SSN,6,7)_$E(SSN,1,5),X)
106 K SSN,DOB Q
Note: See TracBrowser for help on using the repository browser.