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

LRTSTJM1.m

Go to the documentation of this file.
  1. LRTSTJM1 ;DALOI/STAFF- JAM TESTS ONTO (OR OFF) ACCESSIONS (cont.) ;10/25/11 12:14
  1. ;;5.2;LAB SERVICE;**350**;Sep 27, 1994;Build 230
  1. ;
  1. EXPLD ;
  1. S LRTSAD1=0
  1. F S LRTSAD1=$O(LRTSAD(LRTSUB,LRTSAD1)) Q:'LRTSAD1 D EXPLD1
  1. K LRTSAD1,LRTSAD2,LRTSAD3,LRTSAD4
  1. Q
  1. ;
  1. ;
  1. EXPLD1 ;
  1. Q:'$O(^LAB(60,LRTSAD1,2,0)) S LRTSAD4=LRTSAD1 N LRTSAD1,LRTSAD2,LRTSAD3 S LRTSAD2=LRTSAD4,LRTSAD3=0 K LRTSAD4
  1. F S LRTSAD3=$O(^LAB(60,LRTSAD2,2,LRTSAD3)) Q:'LRTSAD3 I $D(^(LRTSAD3,0)),'$D(LRTSAD(LRTSUB,+^(0))) S LRTSAD1=+^(0),LRTSAD(LRTSUB,LRTSAD1)="" D EXPLD1
  1. Q
  1. ;
  1. ;
  1. COMPTST ;
  1. ;
  1. D SCAN
  1. ;
  1. ; After call to SCAN:
  1. ; I LRTSUB=0, then some overlap was found between test being added and the tests already on this accession.
  1. ; I LRTSUB=2, then no overlap was found
  1. ;
  1. I LRTSUB K LRTSAD(2) Q ;no overlap found
  1. ;
  1. ; If LRTSUB=0, then only add those atomic tests that are not already on this accession.
  1. ;
  1. I '$L(LRTSURG) D COMTST2 S LRTSURG=LRURG I 'LRURG S LRTSUB=0 Q
  1. ;
  1. N LRBORTYP,LRBBERF
  1. ; LRBORTYP and LRBBERF are used to backup and restore LRORTYP and LRBERF (respectively)
  1. ; so that user is only prompted for first atomic test in the panel if it's add-on/reflex,
  1. ; and isn't prompted for every subsequent atomic test in the panel.
  1. ;
  1. S (LRTSAD,LRTS)=0 F S LRTS=$O(LRTSAD(2,LRTS)) Q:'LRTS!($D(LRADDTST)) I '$D(LRTSAD(1,LRTS)) D COMTST1
  1. W:'LRTSAD !,"All the individual tests for this panel",!,"are already included on this accession."
  1. K LRTSAD(2),LRTSURG
  1. Q
  1. ;
  1. ;
  1. COMTST1 ;
  1. Q:$O(^LAB(60,LRTS,2,0))
  1. S LRTSAD=1,(Y,LRURG)=$S($L(LRTSURG):LRTSURG,1:$P(^LAB(60,LRTS,0),U,18)) W:'$L(Y) !,$P(^LAB(60,LRTS,0),U,1)
  1. D COMTST2:'$L(Y) S LRFLG=1
  1. I LRURG D
  1. . I $D(LRBORTYP) S LRORDTYP=LRBORTYP I $D(LRBBERF) S LRBERF=LRBBERF
  1. . I '$D(LRBORTYP) D Q:$D(LRADDTST)
  1. . . S LRORDTYP=$$ORDTYP()
  1. . . I LRORDTYP<1 S LRADDTST=1 Q
  1. . . I $P(LRORDTYP,"^")=2 D
  1. . . . N LRORDTST
  1. . . . S LRORDTST=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRTSP,0)),U,9)
  1. . . . I LRORDTST="" S LRORDTST=LRTSP
  1. . . . S $P(LRORDTYP,"^",3)=LRORDTST,$P(LRORDTYP,"^",4)=$$NLT^LRVER1(LRORDTST)
  1. . . I +LRDPF=2,$G(LRSS)'="BB",'$$CHKINP^LRBEBA4(LRDFN,LRODT) S LRBERF=$S(LRORDTYP>0:LRORDTYP-1,1:-1) ;CIDC
  1. . . S LRBORTYP=LRORDTYP
  1. . . I $D(LRBERF) S LRBBERF=LRBERF
  1. . D EN^LRTSTSET
  1. Q
  1. ;
  1. ;
  1. COMTST2 ;
  1. S DIC=62.05,DIC("B")="ROUTINE",DIC(0)="AEMOQ" D ^DIC K DIC("B") I Y<1 W !,"URGENCY must be defined. Test not added." S LRURG=0 Q
  1. W !," ...OK" S %=1 D YN^DICN G COMTST2:%=2 S LRURG=$S((%<1):0,1:+Y)
  1. Q
  1. ;
  1. ;
  1. SCAN ;
  1. N LRTS S LRTS=0 F S LRTS=$O(LRTSAD(2,LRTS)) Q:'LRTS I $D(LRTSAD(1,LRTS)) S LRTSUB=0
  1. Q
  1. ;
  1. ;
  1. ORDTYP() ; Ask if test is "add on" or "reflex"
  1. N DIR,DUOUT,DTOUT,DIRUT,LRX,LRY,X,Y
  1. S DIR(0)="S^1:Add On;2:Reflex",DIR("A")="Type of test order being added"
  1. D ^DIR
  1. I $D(DIRUT) S LRY=-1
  1. E S LRY=+Y
  1. I LRY>0 D
  1. . S LRX=$S(LRY=1:"A",LRY=2:"G",1:"A")
  1. . S $P(LRY,"^",2)=$$FIND1^DIC(64.061,"","OX",LRX,"D","I $P(^(0),U,5)=""0065""")
  1. Q LRY
  1. ;
  1. ;
  1. ORUT(LRDFN,LRAA,LRAD,LRAN,LR60,LRORDTYP,LRURG,LRODT,LRSN) ; Setup ORUT node in file #63 for test just added.
  1. ; Call with LRDFN = file #63 IEN
  1. ; LRAA = file #68 IEN
  1. ; LRAD = accession date
  1. ; LRAN = accession number
  1. ; LR60 = file #60 IEN
  1. ; LRORDTYP = 1(add)/2(reflex)^file #64.061 ien for code^if reflex parent test^if reflex parent NLT^
  1. ; LRURG = file #62.05 urgency ien
  1. ; LRORDT = file #69 order date
  1. ; LRSN = file #69 order ien
  1. ;
  1. ; Called by LRTSTJAM
  1. ;
  1. N LR68,LRFDA,LRFILE,LRIDT,LRIENS,LRJUL,LRNLT,LRORD,LRORIFN,LRORNUM,LRPROV,LRSAMP,LRSPEC,LRSS,LRX,LRY,X,Y
  1. ;
  1. S LRSS=$P($G(^LRO(68,LRAA,0)),"^",2)
  1. S LRFILE=$S(LRSS="CH":63.07,LRSS="MI":63.5,LRSS="SP":63.53,LRSS="CY":63.51,LRSS="EM":63.52,1:"")
  1. Q:'LRFILE
  1. ;
  1. S LR68(0)=$G(^LRO(68,LRAA,1,LRAD,1,LRAN,0))
  1. S X=$O(^LRO(68,LRAA,1,LRAD,1,LRAN,5,0))
  1. S LR68(5)=$G(^LRO(68,LRAA,1,LRAD,1,LRAN,5,X,0))
  1. S LRORD=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,.1)),"^")
  1. S LRSPEC=$P(LR68(5),"^"),LRSAMP=$P(LR68(5),"^",2)
  1. S LRNLT=$$NLT^LRVER1(LR60) Q:+LRNLT<1
  1. S LRPROV=$P(LR68(0),"^",8),LRORNUM=""
  1. I LRORD D
  1. . S LRX=$$FMDIFF^XLFDT(DT,$E(DT,1,3)_"0101",1)
  1. . S LRX=LRX+1,LRJUL=$E("000",1,3-$L(LRX))_LRX
  1. . S LRORNUM="LR-"_LRORD_"-"_$E(DT,1,3)_LRJUL
  1. S LRIDT=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),"^",5)
  1. S LRORIFN=$P($G(^LRO(69,LRODT,1,LRSN,0)),"^",11)
  1. ;
  1. S LRIENS="?+1"_","_LRIDT_","_LRDFN_","
  1. S LRFDA(5,LRFILE,LRIENS,.01)=LRNLT
  1. S LRFDA(5,LRFILE,LRIENS,2)=LRURG
  1. I LRORIFN S LRFDA(5,LRFILE,LRIENS,3)=LRORIFN
  1. I LRORNUM'="" S LRFDA(5,LRFILE,LRIENS,4)=LRORNUM
  1. I $P(LRORDTYP,"^",2) S LRFDA(5,LRFILE,LRIENS,5)=$P(LRORDTYP,"^",2)
  1. ;
  1. ; Check for regular or LEDI provider
  1. I LRPROV'="" D
  1. . I LRPROV?1.N S LRFDA(5,LRFILE,LRIENS,6)=LRPROV Q
  1. . I $E(LRPROV,1,4)="REF:" D ; If LEDI find LEDI provider info on exisitng test.
  1. . . S X=0,LRX=""
  1. . . F S X=$O(^LR(LRDFN,LRSS,LRIDT,"ORUT",X)) Q:X<1 D Q:LRX'=""
  1. . . . S X(0)=$G(^LR(LRDFN,LRSS,LRIDT,X,0))
  1. . . . I $P(X(0),"^",7)'="" S LRX=$P(X(0),"^",7)
  1. . . I LRX'="" S LRPROV=LRX
  1. . S LRFDA(5,LRFILE,LRIENS,7)=LRPROV
  1. ;
  1. I LRSPEC S LRFDA(5,LRFILE,LRIENS,8)=LRSPEC
  1. I LRSAMP S LRFDA(5,LRFILE,LRIENS,9)=LRSAMP
  1. I LR60 S LRFDA(5,LRFILE,LRIENS,13)=LR60
  1. I $P(LRORDTYP,"^",3) D
  1. . S LRFDA(5,LRFILE,LRIENS,14)=$P(LRORDTYP,"^",3)
  1. . S LRFDA(5,LRFILE,LRIENS,15)=$P(LRORDTYP,"^",4)
  1. D UPDATE^DIE("","LRFDA(5)","LRIENS","")
  1. ;
  1. Q