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

LRARCHE.m

Go to the documentation of this file.
LRARCHE ; IHS/DIR/AAB - REMOVE OLD DATA FROM PT. FILE 8/10/89 11:11 ;
 ;;5.2;LR;**1002**;JUN 01, 1998
 ;;5.2;LAB SERVICE;**59**;Sep 27, 1994
 Q  ;C2=NUMBER OF PT, C3=NUMBER OF DATES
MOVE S LRCNT=$P(^LR(LRDFN,LRSS,0),U,3,4) S:LRSS="CH" ^LAR("Z",LRDFN,LRSS,0)="^63.999904D^"_LRCNT S:LRSS="MI" ^LAR("Z",LRDFN,LRSS,0)="^63.999905DA^"_LRCNT S %X="^LR(LRDFN,LRSS,LRIDT,",%Y="^LAR(""Z"",LRDFN,LRSS,LRIDT," D %XY^%RCR
 S:C1 C2=C2+1,C1=0,^LAR("Z",LRDFN,0)=^LR(LRDFN,0),^LAR("Z","B",LRDFN,LRDFN)="",^LAR("NAME",PNM,LRDFN)="",^LAR("SSN",SSN,LRDFN)="" S C3=C3+1 Q
PT S PNM="unk",SSN="unk"
 Q:LRDPF<1  D DEM^LRX
 S:SSN="" SSN="unk" S:PNM="" PNM="unk" Q
DFN ;from LRARCHIV
 S LRDFN=$O(^LR(LRDFN)) G TEND:LRDFN'>0 W "."
 G NO0:$D(^LR(LRDFN,0))[0 S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) I +LRDPF=2
 S C1=1 D PT
 F LRSS="CH","MI" I $D(^LR(LRDFN,LRSS,0)) D LAB
 S ^LAB(69.9,1,"LRDFN")=LRDFN G DFN
TEND W !!,"SEARCH PASS DONE" D STAMP^LRX W !,"Total patient count: ",C2,". Specimen count: ",C3,! K LRDFN Q
LAB S LRIDT=$O(^LR(LRDFN,LRSS,$S(LRSS="MI":LR(3),1:LR(2)))) Q:LRIDT<1  S LRIDT=LRIDT-.1
LAB1 S LRIDT=$O(^LR(LRDFN,LRSS,LRIDT)) I LRIDT<1 D UPDT^LRARCHK Q
 IF $D(^LR(LRDFN,LRSS,LRIDT,0))[0 U IO W !,"BAD DATA ",LRDFN,LRSS,LRIDT," KILLED" K ^LR(LRDFN,LRSS,LRIDT) G LAB1
 S LRDAT=^LR(LRDFN,LRSS,LRIDT,0)
 IF LRSS="CH",'$P(LRDAT,U,3) U IO W !,"KILLED UNVERIFIED DATA ",LRDFN,LRSS,LRIDT K ^LR(LRDFN,LRSS,LRIDT) G LAB1
 IF $O(^LR(LRDFN,LRSS,LRIDT,0))="" U IO W !,"KILLED HEADER WITH NO DATA ",LRDFN,LRSS,LRIDT K ^LR(LRDFN,LRSS,LRIDT) G LAB1
 I LRSS="CH",LRDPF=2,'$L($P(LRDAT,U,9)) G LAB1 ;NOT ON CUM CHART PAGE
 D MOVE
 G LAB1
RCC ;REMOVE CONTROL CHAR.
 S X=LRDAT,LRDAT="" F I=1:1:$L(X) S LRDAT=LRDAT_$S($A(X,I)>126:"",$A(X,I)>31:$E(X,I),1:"")
 S ^LR(LRDFN,LRSS,LRIDT,I1)=LRDAT Q
NO0 U IO W !,"NO 0 NODE FOR ^LR(",LRDFN G DFN