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

LRPHSET2.m

Go to the documentation of this file.
LRPHSET2 ;VA/SLC/RWA - COLLECTION LIST TO ACCESSIONS CONT ;JUL 06, 2010 3:14 PM
 ;;5.2;LAB SERVICE;**1018,1027**;NOV 01, 1997
 ;;5.2;LAB SERVICE;**121,202**;Sep 27, 1994
REUP ;FROM LRPHSET1 - ADD TO OR REBUILD TO COLLECTION LIST
 S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3),LRRB=$S(LRDPF=2&$D(^DPT(DFN,.101)):^(.101),1:0),LRRB=$S($L(LRRB):LRRB,1:"")
 S I=0 F  S I=$O(^LRO(69,DT,1,LRSN,2,I)) Q:I<1  S X=^(I,0) I $L($P(X,U,3)) S LRAA($P(X,U,4))=$P(X,U,3)_"^"_$P(X,U,4)_"^"_$P(X,U,5)
 S LRK=0 F  S LRK=$O(^LRO(69,DT,1,LRSN,2,LRK)) Q:LRK<1  S X=^(LRK,0) I '$L($P(X,U,3)),'$P(X,"^",11) D
 . S LRTS=+X,LRAA=$S($D(^LAB(60,LRTS,8,DUZ(2),0)):$P(^(0),U,2),1:"")
 . I LRAA'="",$D(LRAA(LRAA)),$P(^LAB(60,LRTS,0),U,7)'=1 D JAM
 S LRI=0 F  S LRI=$O(^LRO(69,DT,1,LRSN,2,LRI)) Q:LRI<1  S X=^(LRI,0) I '$P(X,U,6),$P(X,U,3) S LRTSTN=+X,LRAD=$P(X,U,3),LRAA=$P(X,U,4),LRAN=$P(X,U,5) I '$D(^LRO(69.1,"LRPH",LRTE,LRLLOC,LRRB,LRDFN,LRSN,LRAA,LRAN,+LRTSTN)) D REUP1
 I $D(REUP) S LRCOUNT=LRCOUNT+1,^LRO(69,DT,1,LRSN,3)=LRDTI
 I '$D(REUP) S $P(^LRO(69,DT,1,LRSN,1),U)=$P(^LRO(69,DT,1,LRSN,3),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,2,K)) Q:K<1  I +^(K,0)=J S LRSN=0,LRSN=$O(T(LRSAMP,J,LRSN)) D @$S(LRPSN>LRSN:"MERG",1:"COMBINE")
 Q
COMBINE S LRSN=0 F  S LRSN=$O(T(LRSAMP,J,LRSN)) Q:LRSN<1  D:LRPSN>LRSN SWAP I LRSN'=LRPSN D CB2
 Q
CB2 I $L($P(^LRO(69,DT,1,LRSN,2,+T(LRSAMP,J,LRSN),0),U,6)),$D(^LRO(69,DT,1,LRSN,.1)),$D(^LRO(69,DT,1,+$O(^LRO(69,"C",+^(.1),DT,0)),1)),$L($P(^(1),U,4)) Q
 I $P(T(LRSAMP,T,LRPSN),U,2)'=$P(T(LRSAMP,J,LRSN),U,2) D URGENCY S $P(^LRO(69,DT,1,LRPSN,2,+T(LRSAMP,T,LRPSN),0),U,2)=LRURG
 S $P(^LRO(69,DT,1,LRPSN,2,+T(LRSAMP,T,LRPSN),0),"^",14)=DT_";"_LRSN_";"_+T(LRSAMP,J,LRSN)
 N X,XI,X1,I,TST
 S X1=^LRO(69,DT,1,LRPSN,.1),TST=^LRO(69,DT,1,LRSN,2,+T(LRSAMP,J,LRSN),0),$P(^(0),U,6)=X1,$P(^LRO(69,DT,1,LRSN,1),U,4)="M",XI=$P(^(1),U,7),XI=XI_X1_"/",$P(^(1),U,7)=XI
 D OERR(TST)
 K T(LRSAMP,J,LRSN)
 Q
MERG S LRSN=0 F  S LRSN=$O(T(LRSAMP,J,LRSN)) Q:LRSN<1  D:LRPSN>LRSN SWAP,SWAP1 I LRSN'=LRPSN D M1
 Q
M1 Q:$L($P(^LRO(69,DT,1,LRSN,2,+T(LRSAMP,J,LRSN),0),U,6))
 S X=$P(^LRO(69,DT,1,LRPSN,2,0),"^",3)
LP S X=X+1
 I $D(^LRO(69,DT,1,LRPSN,2,X)) G LP
 S ^LRO(69,DT,1,LRPSN,2,X,0)=^LRO(69,DT,1,LRSN,2,+T(LRSAMP,J,LRSN),0),$P(^(0),"^",14)=DT_";"_LRSN_";"_+T(LRSAMP,J,LRSN),^LRO(69,DT,1,LRPSN,2,"B",J,X)="",$P(^LRO(69,DT,1,LRPSN,2,0),"^",3,4)=X_"^"_X
 ;----- BEGIN IHS MODIFICATION LR*5.2*1018
 ;IHS/ITSC/TPF 11/15/2002 BRING 'SIGN OR SYMPTOM' LAB POV INTO MERGE **1015**
 ; S ^LRO(69,DT,1,LRPSN,2,X,9999999)=^LRO(69,DT,1,LRSN,2,+T(LRSAMP,J,LRSN),9999999)
 S:$D(^LRO(69,DT,1,LRSN,2,+T(LRSAMP,J,LRSN),9999999)) ^LRO(69,DT,1,LRPSN,2,X,9999999)=^LRO(69,DT,1,LRSN,2,+T(LRSAMP,J,LRSN),9999999)  ; IHS/OIT/MKK - LR*5.2*1027
 ;END **1015**
 ;END IHS MODIFICATION
 N I,XI,X1,TST
 S X1=^LRO(69,DT,1,LRPSN,.1),$P(^LRO(69,DT,1,LRSN,2,+T(LRSAMP,J,LRSN),0),"^",6)=X1
 S TST=^LRO(69,DT,1,LRPSN,2,X,0),LRURG=$P(TST,"^",2),T(LRSAMP,J,LRPSN)=T(LRSAMP,J,LRSN),$P(T(LRSAMP,J,LRPSN),"^")=X
 S $P(^LRO(69,DT,1,LRSN,1),U,4)="M",XI=$P(^(1),U,7),XI=XI_X1_"/",$P(^LRO(69,DT,1,LRSN,1),U,7)=XI
 ;----- BEGIN IHS MODIFICATION LR*5.2*1018
 D:BLRLOG ^BLREVTQ("M","O",$G(BLROPT),,DT_","_LRSN)  ;IHS/DIR TUC/AAB 03/27/98
 ;-----END IHS MODIFICATION
 D OERR(TST)
 K T(LRSAMP,J,LRSN)
 Q
SWAP S LRSWAP=LRSN,LRSN=LRPSN,LRPSN=LRSWAP K LRSWAP
 Q
SWAP1 S LRSWAP=J,J=T,T=LRSWAP
 Q
URGENCY S LRURG1=$P(T(LRSAMP,T,LRPSN),U,2),LRURG2=$P(T(LRSAMP,J,LRSN),U,2),LRURG=$S(LRURG1<LRURG2:LRURG1,1:LRURG2)
 K LRURG1,LRURG2
 Q
OERR(TSTNODE) ;OE/RR - CPRS calls
 I $$VER^LR7OU1<3 D  Q  ;OE/RR 2.5
 . N I,ORIFN,OREASON,ORSTS
 . S ORIFN=$P(TSTNODE,U,7)
 . I ORIFN S ORSTS=1,OREASON="D" D ST^ORX
 N X,TTT,LRNATURE,LRSJ ;OE/RR 3.0
 S LRSJ=J,X=$O(^ORD(100.03,"C","LRDUP",0)),LRNATURE=$$DC1^LROR6(X,"Combined with LB #"_X1)
 S TTT(+TSTNODE)="",DIE="^LRO(69,DT,1,LRSN,2,",DA=+T(LRSAMP,LRSJ,LRSN),DA(1)=LRSN,DA(2)=DT,DR="99.1///DUPLICATE TEST: "_$S($L($P($G(LRNATURE),"^",5)):$P(LRNATURE,"^",5),1:"")
 D ^DIE
 D NEW^LR7OB1(DT,LRSN,"OC",$G(LRNATURE),.TTT)
 S $P(^LRO(69,DT,1,LRSN,2,+T(LRSAMP,LRSJ,LRSN),0),"^",3,5)="^^",$P(^(0),"^",9,11)="CA^L^"_DUZ,J=LRSJ
 Q