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

LRTSTSET.m

Go to the documentation of this file.
LRTSTSET ;DALOI/STAFF - JAM TESTS ONTO (OR OFF) ACCESSIONS ; 19 Jun 2017  12:20 PM
 ;;5.2;LAB SERVICE;**65,100,121,153,201,202,263,291,350,492**;Sep 27, 1994;Build 3
 ;
 ;Formerly apart of LRTSTJAM
 ;
EN ;
 ; Called from LRTSTJAM, LRPHSET2
 I '($D(^LRO(68,LRAA,1,LRAD,1,LRAN,0))#2) D  Q
 . W !?10,"Sorry  This accession "_LRAN_" No longer exist"
 . W !?10," Accession may have been deleted.",!,$C(7)
 ;
 S ^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRTS,0)=LRTS_"^"_LRURG,$P(^(0),U,9)=+LRTS
 S ^LRO(68,LRAA,1,LRAD,1,LRAN,4,"B",LRTS,LRTS)="",$P(^LRO(68,LRAA,1,LRAD,1,LRAN,3),U,4)=""
 S $P(^LRO(68,LRAA,1,LRAD,1,LRAN,4,0),U,3)=LRTS,$P(^(0),U,4)=$P(^(0),U,4)+1
 ;
 I $P(LRPARAM,U,14),$P(^LRO(68,LRAA,0),U,16) D CAP^LRWLST12
 ;
 S LRACD=$P(^LRO(68,LRAA,1,LRAD,1,LRAN,0),"^",3),LRTSAD(1,LRTS)=""
 I LRACD,LRACD'=LRAD D
 . S ^LRO(68,LRAA,1,LRACD,1,LRAN,4,LRTS,0)=LRTS_"^"_LRURG,$P(^(0),U,9)=+LRTS
 . S ^LRO(68,LRAA,1,LRACD,1,LRAN,4,"B",LRTS,LRTS)="",$P(^LRO(68,LRAA,1,LRAD,1,LRAN,3),"^",4)=""
 . I $P(LRPARAM,U,14),$P(^LRO(68,LRAA,0),U,16) D CAP^LRWLST12
 ;
 ;In certain cases, the order number in file 68 may need to be updated.
 ;MFLG = set by LRPHSET2 for those cases
 ;
 I $G(MFLG) D
 . I LRODT=""!(LRSN="") Q
 . S ^LRO(68,LRAA,1,LRAD,1,LRAN,.1)=$G(^LRO(69,LRODT,1,LRSN,.1))
 ;
 D ORUT^LRTSTJM1(LRDFN,LRAA,LRAD,LRAN,LRTS,LRORDTYP,LRURG,LRODT,LRSN)
 ;
 S LRADL=1
 ;
 F  L +^LRO(69,LRODT,1,LRSN):DILOCKTM Q:$T  W !?7,"Someone else is editing this order",!,$C(7) H 20
 ;
 ; Add stub entry for new test.
 K DA,DIC,DIE,DINUM,DO,DR
 ;
 ;The stub may already exist.
 ;
 I $D(^LRO(69,LRODT,1,LRSN,2,"B",+LRTS)) S Y=$O(^LRO(69,LRODT,1,LRSN,2,"B",+LRTS,0))_"^"_+LRTS_"^1"
 ;
 I '$D(^LRO(69,LRODT,1,LRSN,2,"B",+LRTS)) D
 . S DIC="^LRO(69,"_LRODT_",1,"_LRSN_",2,",DA(2)=LRODT,DA(1)=LRSN
 . S DIC(0)="F",X=+LRTS
 . D FILE^DICN
 ;
69 ; Called by LR7OMERG
 I Y>0 D
 . N LRDIE,LRFDA,LRIENS,I
 . S LRXDA=+Y,LRIENS=LRXDA_","_LRSN_","_LRODT_","
 . S LRXDA(3)=$G(^LRO(68,LRAA,1,LRAD,1,LRAN,.3))
 . S LRFDA(1,69.03,LRIENS,1)=LRURG
 . S LRFDA(1,69.03,LRIENS,2)=LRAODT
 . S LRFDA(1,69.03,LRIENS,3)=LRAA
 . S LRFDA(1,69.03,LRIENS,4)=LRAN
 . S LRFDA(1,69.03,LRIENS,8)="IP"
 . S LRFDA(1,69.03,LRIENS,9)="L"
 . I $P(LRXDA(3),"^")'="" D
 . . S LRFDA(1,69.03,LRIENS,13)=$P(LRXDA(3),"^")
 . . I $P(LRXDA(3),"^",2) F I=2:1:5 S LRFDA(1,69.03,LRIENS,I+12)=$P(LRXDA(3),"^",I)
 . D FILE^DIE("","LRFDA(1)","LRDIE(1)")
 . D:$G(LRTSP)
 . . S LRBETN=$O(^LRO(69,LRODT,1,LRSN,2,"B",LRTSP,""))
 . . I LRBETN D DADD^LRBEBA31(LRODT,LRSN,LRBETN,LRXDA,LRTS,$G(LRBERF))
 . K LRBETN,LRBERF
 ;
 I $G(LRXDA),'$G(MFLG) D
 . ;MFLG = comments are added in LRPHSET2 instead
 . N X
 . S X=1+$S($D(^LRO(69,LRODT,1,LRSN,2,LRXDA,1,0)):$P(^(0),"^",3),1:0),^(0)="^^"_X_"^"_DT,^(X,0)=" Added by "_$G(DUZ)_" on "_$$HTE^XLFDT($H,"M")
 . S ^LRO(69,"AA",+$G(^LRO(69,LRODT,1,LRSN,.1)),LRODT_"|"_LRSN)=""
 ;
 I '$D(LRFLG) K DLAYGO,DA,DIC,DIE,DR,LRXDA L -^LRO(69,LRODT,1,LRSN) Q
 ;
SETOR ;
 N LTS S LTS(LRTS)=""
 D NEW^LR7OB1(LRODT,LRSN,"SN",$G(LRNATURE),.LTS,6)
 K DLAYGO,DA,DIC,DIE,DR,LRBERF,LRBEFN,LRBEX
 L -^LRO(69,LRODT,1,LRSN)
 ;
B Q:$D(LRPHSET)
 W !?5,$P(^LAB(60,LRTS,0),U,1)," ADDED" ;K DIC("B") Q:$D(LRTSAD(2))  G ADDTST^LRTSTJAM
 Q