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

LRHYB.m

Go to the documentation of this file.
  1. LRHYB ;DALOI/HOAK - HOWDY B DRIVER ;Sep 16, 2000
  1. ;;5.2;LAB SERVICE;**405,417,446,457,467,491,573**;Sep 27, 1994;Build 7
  1. ;
  1. TEST ;
  1. S DIC=2 S DIC(0)="AEMQZ" D ^DIC
  1. Q:Y=-1
  1. S LRDFN=$G(^DPT(+Y,"LR"))
  1. ;
  1. ;
  1. ;
  1. ORDCHK ; Here is where the search for an order number starts
  1. K LRHYT654
  1. ; The Howdy site file will help determine which orders the site
  1. ; will accept. Once an order has been selected it is handed off
  1. ; to LRORDST to start the accessioning process.
  1. ;
  1. N LRNAAAC
  1. K LRWCZZZ,LRDTF
  1. K LRHYCS33
  1. K ^TMP("LRHYDY",$J,"KILL")
  1. ;
  1. ;
  1. K ^TMP("LRHYDY",$J,"MULTD")
  1. K ^TMP("LRHYDY",$J,"DUPTEST")
  1. K LRHYCS
  1. K ^TMP("LRHYDY",$J,"MT")
  1. S LRHOWDY=1
  1. S LREND=0
  1. S LRORD=""
  1. Q:'LRDFN
  1. ;
  1. K ^TMP("LRHYDY",$J,"LRSN"),LRNPZZX
  1. S LRHYOK=0
  1. ;
  1. ; 18 days ahead
  1. ; 20 days back
  1. ;
  1. S X2=0 K LRNPZZX
  1. S LRAHEAD=$G(^LRHY(69.86,LRHYSITE,18))
  1. S LRPAST=$G(^LRHY(69.86,LRHYSITE,20))
  1. K LRWCZZZ,LREXORD
  1. S LRLOCS=0 ; flag for non-EXLOC and EXLOC on same specimen number
  1. F LRI=-LRPAST:1:LRAHEAD D Q:$G(LRLOCS) ;Search window set by site file.
  1. . S X1=DT S X2=LRI D C^%DTC S LR3DTN=X
  1. . I $D(^LRO(69,LR3DTN,1,"AA",LRDFN)) S LRHYOK=1 D
  1. .. S LR3SN=0
  1. .. F S LR3SN=$O(^LRO(69,LR3DTN,1,"AA",LRDFN,LR3SN)) Q:+LR3SN'>0 D Q:$G(LRLOCS)
  1. ... Q:$P($G(^LRO(69,LR3DTN,1,LR3SN,1)),U,4)="C" ;collected
  1. ... K LRWCZZZ
  1. ... ;
  1. ... K LRCOL99 S LRCOL99=$P(^LRO(69,LR3DTN,1,LR3SN,0),U,3)
  1. ... K LRCSTAT S LRCSTAT=$P(^LRO(69,LR3DTN,1,LR3SN,0),U,4)
  1. ... D CSTATUS^LRHYA Q:LRHYHOK ;Check collection status
  1. ... ;
  1. ... ;LR573 check for accession area conflict:
  1. ... S LRORD=^LRO(69,LR3DTN,1,LR3SN,.1) I '$$Q18^LROE2(DUZ(2)) S (LRLAAX,LRHYHOK)=1
  1. ... Q:LRHYHOK
  1. ... ;
  1. ... D OLT^LRHYA ;print order label tests
  1. ... Q:LRHYHOK
  1. ... ;
  1. ... ;
  1. ... K LRNOTST
  1. ... S LRNODUP=0 D LTE^LRHYA Q:LRHYHOK ;check for excluded lab tests
  1. ... ;
  1. ... S LRORD=^LRO(69,LR3DTN,1,LR3SN,.1)
  1. ... S LRLLOC66=$P(^LRO(69,LR3DTN,1,LR3SN,0),U,9)
  1. ... D EXLOC^LRHYA Q:LRHYHOK ;check for locations to exclude
  1. ... ;
  1. ... S LRLLOC=$G(LRLLOC66)
  1. ... S LRORD24=0
  1. ... D OLT^LRHYA Q:LRHYHOK ;print order label tests
  1. ... ;
  1. ... D URG^LRHYA Q:LRHYHOK ;; CHECK URGENCY
  1. ... K LRCOL99 S LRCOL99=$P(^LRO(69,LR3DTN,1,LR3SN,0),U,3)
  1. ... D CSE^LRHYA Q:LRHYHOK ;check for excluded collection samples
  1. ... ;
  1. ... I $O(^TMP("LRHYDY",$J,"EXLOC",LRORD,0))=$G(LRLLOC66) I $O(^LRO(69,"C",LRORD,0))'=DT QUIT
  1. ... ; CHECK URGENCY
  1. ... S LRTST6=0 ; micro test
  1. ... F S LRTST6=$O(^LRO(69,LR3DTN,1,LR3SN,2,"B",LRTST6)) Q:+LRTST6'>0 D
  1. .... S LRTSTZ99(LRTST6)=""
  1. .... I LRTST6 S LRSUB1=$P(^LAB(60,LRTST6,0),U,4) ; subscript
  1. .... Q:$D(LRNPZZX(^LRO(69,LR3DTN,1,LR3SN,.1),LR3SN,LRTST6))
  1. .... S LRORD=$G(^LRO(69,LR3DTN,1,LR3SN,.1))
  1. .... I $G(LRORD) I $D(^TMP("LRHYDY",$J,"STATUS",LRORD)) QUIT
  1. .... I $D(LRNOTST) I $D(LRNOTST(LRTST6)) K LRORD QUIT
  1. .... S ^TMP("LRHYDY",$J,"LRSN",LR3DTN,^LRO(69,LR3DTN,1,LR3SN,.1))=""
  1. .... S LRDTX=""
  1. .... S LRDTX=$O(^LRO(69,"C",^LRO(69,LR3DTN,1,LR3SN,.1),0))
  1. .... I $D(^LRHY(69.86,LRHYSITE,16,"B",LRLLOC66)),LR3DTN=DT,$G(LRDTX) S ^TMP("LRHYDY",$J,"MT",LRDTX)=""
  1. .... I '$D(^LRHY(69.86,LRHYSITE,16,"B",LRLLOC66)) I $G(LRDTX) S ^TMP("LRHYDY",$J,"MT",LRDTX)=""
  1. ;
  1. ;
  1. K LRMULT
  1. I $G(LRWCMULT) W !!!!,"Multple Orders Present" S LRMULT=1 D LOG1^LRHY0 K LRWCMULT QUIT
  1. ; per Libba 1/14/2002
  1. I $D(^TMP("LRHYDY",$J,"LRSN",DT)) S LR3DTN=DT ; I prefer today's orders but...
  1. E S LR3DTN=$O(^TMP("LRHYDY",$J,"LRSN",0)) ; I'll take whatever ya got
  1. I 'LR3DTN K LRORD QUIT
  1. ;
  1. I '$D(^LRHY(69.86,LRHYSITE,16,"B",LRLLOC66)) I $O(^TMP("LRHYDY",$J,"LRSN",LR3DTN)) W !,"MULTIPLE DAYS WITH ORDERS" S LRMULT=1 D LOG1^LRHY0 QUIT
  1. ;
  1. S LRTIC=0
  1. S LRMULT=0
  1. ;
  1. F S LRTIC=$O(^TMP("LRHYDY",$J,"LRSN",LRTIC)) Q:+LRTIC'>0 S LRMULT=LRMULT+1
  1. I '$D(^LRHY(69.86,LRHYSITE,16,"B",LRLLOC66)) I LRMULT>1 W !,"MULTIPLE DAYS WITH ORDERS" S LRMULT=0 D LOG1^LRHY0 QUIT
  1. ;MODIFIED BY HOAK to flag when wc and sp are on same visit
  1. ;
  1. ;
  1. MOVE ;
  1. I $D(LRNOTST) I $G(LRHYT654) I $D(LRNOTST(LRHYT654)) K LRORD QUIT
  1. I $G(LRORD),$D(LREXORD(LRORD)) K LRORD QUIT
  1. S LRHY3SN3=0
  1. S LRHY3DT3=0
  1. I $G(LRORD),$D(^TMP("LRHYDY",$J,"URG",LRORD)) K LRORD QUIT
  1. I $D(^LRHY(69.86,LRHYSITE,30,"B",LRURGZ19)) K LRORD QUIT
  1. S LRTIC=0
  1. S LRMULT=0
  1. F S LRTIC=$O(^TMP("LRHYDY",$J,"MT",LRTIC)) Q:+LRTIC'>0 S LRMULT=LRMULT+1
  1. S LR3MULT=LRMULT
  1. I LRMULT>1 W !,"MULTIPLE DAYS WITH ORDERS" S LRORD=0 QUIT
  1. E S LRMULT=0
  1. ; may be accessioned.
  1. ; Setting up task to continue based on the specimen.
  1. K LR3ZTST
  1. MOVE1 ;
  1. S LRORD=0
  1. F S LRORD=$O(^TMP("LRHYDY",$J,"LRSN",LR3DTN,LRORD)) Q:+LRORD'>0 D
  1. . S:'$G(LR3ORD) LR3ORD=LRORD
  1. . I $D(^TMP("LRHYDY",$J,"URG",LRORD)) QUIT
  1. . S LRHYORDZ=LRORD
  1. . ;
  1. . S ZTSAVE("^TMP(""LRHYDY"",$J,")=""
  1. . S ZTRTN="PAST^LRHYPH0",ZTSAVE("L*")="",ZTDTH=$H,ZTDESC="HOWDY"
  1. . S ZTIO="NULL"
  1. . S ZTSAVE("L*")=""
  1. . S:$D(ZTQUEUED) ZTREQ="@" D ^%ZTLOAD
  1. . S LRGOTIT=1
  1. . S LRORD=LRHYORDZ
  1. . K LRSTOPZ(LRORD)
  1. K ^TMP("LRHYDY",$J,"MULTD")
  1. S LRORD=$G(LR3ORD) K LR3ORD
  1. K LRHOWDY,LR3SN24,LR3DTN24,LR3ZTST,LROLT1,LRNAAAC
  1. I $G(LRORD) I $D(LRSTOPZ(LRORD)) K LRORD,LRSTOPZ QUIT
  1. ;
  1. QUIT
  1. ;
  1. MMM ;
  1. N LRI S LRI=0
  1. N LR3DTN,LR3SN,LRIENZZ,LRTSTX
  1. K LRHYMORD
  1. K LRHYMULT
  1. F LRI=-LRPAST:1:LRAHEAD D
  1. . S X1=DT S X2=LRI D C^%DTC S LR3DTN=X
  1. . ;
  1. . I $D(^LRO(69,LR3DTN,1,"AA",LRDFN)) D
  1. .. S LR3SN=0
  1. .. F S LR3SN=$O(^LRO(69,LR3DTN,1,"AA",LRDFN,LR3SN)) Q:+LR3SN'>0 D
  1. ... ;
  1. ... Q:$P($G(^LRO(69,LR3DTN,1,LR3SN,1)),U,4)="C" ;collected
  1. ... S LRTSTX=0
  1. ... F S LRTSTX=$O(^LRO(69,LR3DTN,1,LR3SN,2,"B",LRTSTX)) Q:+LRTSTX'>0 D
  1. .... S LRIENZZ=$O(^LRO(69,LR3DTN,1,LR3SN,2,"B",LRTSTX,0))
  1. .... ;
  1. .... Q:$G(^LRO(69,LR3DTN,1,LR3SN,2,LRIENZZ,1.1,1,0))'=""
  1. .... K LRCOL99 S LRCOL99=$P(^LRO(69,LR3DTN,1,LR3SN,0),U,3)
  1. .... S LRHYHOK=0 D CSE^LRHYA Q:LRHYHOK
  1. .... S LRCSTAT=$P(^LRO(69,LR3DTN,1,LR3SN,0),U,4)
  1. .... S LRHYHOK=0 D CSTATUS^LRHYA Q:LRHYHOK
  1. .... S LRLLOC66=$P(^LRO(69,LR3DTN,1,LR3SN,0),U,9)
  1. .... S LRHYHOK=0 D EXLOC^LRHYA Q:LRHYHOK
  1. .... S LRHYMULT(LR3DTN,LR3SN,LRIENZZ)=LRTSTX
  1. N CNT
  1. S CNT=0
  1. S LR3DTN=0
  1. F S LR3DTN=$O(LRHYMULT(LR3DTN)) Q:+LR3DTN'>0 S CNT=CNT+1
  1. I CNT>1 S LRHYMORD=1