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

LRWRKINC.m

Go to the documentation of this file.
  1. LRWRKINC ;SLC/DCM/CJS - INCOMPLETE STATUS REPORT ;Mar 22, 2021@17:48
  1. ;;5.2;LAB SERVICE;**153,201,221,453,536,543,562,566**;Sep 27, 1994;Build 12
  1. ;
  1. EN ;
  1. K ^TMP($J),^TMP("LR",$J),^TMP("LRWRKINC",$J)
  1. K %ZIS,DIC
  1. S Y=$$NOW^XLFDT D DD^LRX S LRDT=Y
  1. S (LRCNT,LRCUTOFF,LREND,LREXD,LREXTST,LRNOCNTL,LREXNREQ)=0,LRSORTBY=1
  1. S DIC="^LRO(68,",DIC(0)="AEMOQZ"
  1. F D Q:$G(LRAA)<1!(LREND)
  1. . N LAST,LRAD,LRAN,LRFAN,LRLAN,LRWDTL,LRSTAR,LRUSEAA,X,Y,LRDIP
  1. . D ^DIC
  1. . I $D(DUOUT) S LREND=1 Q
  1. . S LRAA=+Y,LRAA(0)=$G(Y(0))
  1. . I LRAA<1 Q
  1. . D CHKAA^LRWRKIN1
  1. . I LREND Q
  1. . I '$L(LRUSEAA) D PHD Q:LREND
  1. . S LRCNT=LRCNT+1,^TMP("LRWRKINC",$J,$P(LRAA(0),"^")_"^"_LRAA,LRCNT,0)=LRAA(0)
  1. . I $G(LRDIP) S LAST=LRDIP
  1. . I $L(LRUSEAA) D
  1. . . N X
  1. . . S X=$P($G(^LRO(68,LRUSEAA,0)),"^")_"^"_LRUSEAA
  1. . . S ^TMP("LRWRKINC",$J,$P(LRAA(0),"^")_"^"_LRAA,LRCNT,1)=^TMP("LRWRKINC",$J,$P(LRUSEAA,"^",1,2),$P(LRUSEAA,"^",3),1)
  1. . E S ^TMP("LRWRKINC",$J,$P(LRAA(0),"^")_"^"_LRAA,LRCNT,1)=$G(LRAD)_"^"_$G(LRFAN)_"^"_$G(LRLAN)_"^"_$G(LRSTAR)_"^"_$G(LAST)_"^"_$G(LRWDTL)
  1. . W !
  1. I LREND!('$D(^TMP("LRWRKINC",$J))) D LREND^LRWRKIN1 Q
  1. K DIC
  1. N DIR,DIRUT,DTOUT,DUOUT
  1. I LRCNT>1 D
  1. . S DIR(0)="SO^1:ACCESSION AREA;2:TEST NAME",DIR("A")="Sort Report By",DIR("B")=1
  1. . S DIR("?",1)="ACCESSION AREA will separate tests by accession area, then by test name."
  1. . S DIR("?")="TEST NAME will list tests alphabetically without regard to accession area."
  1. . D ^DIR
  1. . I $D(DIRUT) S LREND=1 Q
  1. . S LRSORTBY=+Y
  1. I LREND D LREND^LRWRKIN1 Q
  1. S DIR(0)="YO",DIR("A")="Specify detailed sort criteria",DIR("B")="NO"
  1. S DIR("?",1)="Answer 'YES' if you WANT to specify detailed criteria."
  1. S DIR("?",2)="Examples are excluding controls, specifying a lab arrival cut-off time,"
  1. S DIR("?",3)="selecting or excluding specific tests, or excluding non-required tests."
  1. S DIR("?")="Answer 'NO' if you DO NOT want to specify detailed criteria."
  1. D ^DIR
  1. I $D(DIRUT) D LREND^LRWRKIN1 Q
  1. I Y=1 D
  1. . K DIR
  1. . S DIR(0)="DO^::EXT",DIR("A")="Lab Arrival Cut-off"
  1. . S DIR("?",1)="Entering a date/time will exclude uncollected specimens and"
  1. . S DIR("?")="specimens with a lab arrival time after the time specified."
  1. . D ^DIR
  1. . I $D(DUOUT)!($D(DTOUT)) Q
  1. . I Y>0 S LRCUTOFF=+Y
  1. . K DIR
  1. . S DIR(0)="YO",DIR("A")="Do you want to exclude controls",DIR("B")="YES"
  1. . S DIR("?",1)="Answer 'NO' if you WANT accessions for LAB CONTROLS included on"
  1. . S DIR("?")="the report. 'YES' if you DO NOT want accessions for LAB CONTROLS."
  1. . D ^DIR
  1. . I $D(DIRUT) Q
  1. . S LRNOCNTL=+Y
  1. . K DIR
  1. . S DIR(0)="YO",DIR("A")="Do you want a specific test",DIR("B")="NO"
  1. . D ^DIR
  1. . I $D(DIRUT) Q
  1. . I Y=1 D
  1. . . N I,LRY
  1. . . K DIR
  1. . . S DIR(0)="YO",DIR("A")="Check tests on panels also",DIR("B")="YES"
  1. . . S DIR("?",1)="If you select a panel test do you want to also check"
  1. . . S DIR("?")="the tests that make up the panel for an incomplete status."
  1. . . D ^DIR
  1. . . I $D(DIRUT) Q
  1. . . S LRY=+Y
  1. . . N DIC
  1. . . S DIC="^LAB(60,",DIC(0)="AEFOQZ"
  1. . . F D Q:+Y<1
  1. . . . N LRTEST,LRTSTS
  1. . . . D ^DIC Q:+Y<1
  1. . . . S ^TMP("LR",$J,"T",+Y)=Y(0)
  1. . . . I LRY S LRTEST=+Y,LREXPD="D LREXPD^LRWRKINC" D ^LREXPD
  1. . I $D(DIRUT) Q
  1. . K DIR
  1. . S DIR(0)="YO"
  1. . S DIR("A")="Do you want to exclude a specific test",DIR("B")="NO"
  1. . D ^DIR
  1. . I $D(DIRUT) Q
  1. . I Y=1 D
  1. . . N DIC
  1. . . S DIC="^LAB(60,",DIC(0)="AEFOQ",DIC("S")="I '$D(^TMP(""LR"",$J,""T"",Y))"
  1. . . F D ^DIC Q:+Y<1 S LREXTST(+Y)="",LREXTST=1
  1. . K DIR
  1. . S DIR(0)="YO",DIR("A")="Exclude non-required tests",DIR("B")="YES"
  1. . S DIR("?",1)="Answer 'NO' if you WANT incomplete non-required test included on"
  1. . S DIR("?")="the report. 'YES' if you DO NOT want non-required tests."
  1. . D ^DIR
  1. . I $D(DIRUT) Q
  1. . S LREXNREQ=+Y
  1. I $D(DIRUT) D LREND^LRWRKIN1 Q
  1. S DIR(0)="YO",DIR("A")="Do you want an extended display",DIR("B")="NO"
  1. S DIR("?")="Extended display will show UID and other referral information"
  1. D ^DIR
  1. I $D(DIRUT) D LREND^LRWRKIN1 Q
  1. S LREXD=+Y
  1. S %ZIS="Q" D ^%ZIS
  1. I POP D LREND^LRWRKIN1 Q
  1. I $D(IO("Q")) D Q
  1. . S ZTRTN="DQ^LRWRKINC",ZTDESC="Lab incomplete test list",ZTSAVE("LR*")=""
  1. . S ZTSAVE("^TMP(""LRWRKINC"",$J,")=""
  1. . I $D(^TMP("LR",$J,"T")) S ZTSAVE("^TMP(""LR"",$J,""T"",")=""
  1. . D ^%ZTLOAD,^%ZISC
  1. . W !,"Request ",$S($G(ZTSK):"Queued - Task #"_ZTSK,1:"NOT Queued")
  1. . D LREND^LRWRKIN1
  1. ;
  1. DQ ;
  1. U IO
  1. ;LR*5.2*536: Variable LRMI* variables in next line indicate Microbiology accession
  1. N LRMIFLG,LRMIARX,LRMIPND
  1. S (LRAA,LRINDEX,LRPAGE)=0,(LRX,LRY)=""
  1. F S LRX=$O(^TMP("LRWRKINC",$J,LRX)) Q:LRX="" D
  1. . N LRZ
  1. . S LRZ=0
  1. . F S LRZ=$O(^TMP("LRWRKINC",$J,LRX,LRZ)) Q:'LRZ D
  1. . . N LRFAN,LRLAN,LRSTAR,LRLAST,LRY
  1. . . F I=0,1 S LRZ(I)=$G(^TMP("LRWRKINC",$J,LRX,LRZ,I))
  1. . . S LRFAN=$P(LRZ(1),"^",2),LRLAN=$P(LRZ(1),"^",3),LRSTAR=$P(LRZ(1),"^",4),LRLAST=$P(LRZ(1),"^",5)
  1. . . I $P(LRZ(1),"^",7)'="" S LRLAST=$P(LRZ(1),"^",7)
  1. . . I LRSTAR,LRLAST S LRY="From Date: "_$$FMTE^XLFDT(LRSTAR,"5DZ")_" To: "_$$FMTE^XLFDT(LRLAST,"5DZ")
  1. . . E S LRY=" For Date: "_$$FMTE^XLFDT(LRLAST,"5DZ")_" From: "_LRFAN_" To: "_LRLAN
  1. . . S LRINDEX=LRINDEX+1,LRNAME(LRINDEX)=$$LJ^XLFSTR($E($P(LRZ(0),"^"),1,20),22)_LRY
  1. S LRINDEX=LRINDEX+1,LRNAME(LRINDEX)=$S(LRINDEX>1:"Sorted by "_$S(LRSORTBY=1:"Accession Area",1:"Test Name")_"; ",1:"")_"Controls Excluded: "_$S(LRNOCNTL:"YES",1:"NO")_"; Specific Tests: "_$S($D(^TMP("LR",$J,"T")):"YES",1:"NO")
  1. S LRINDEX=LRINDEX+1,LRNAME(LRINDEX)="Exclude Specific Tests: "_$S(LREXTST:"YES",1:"NO")_"; Required Tests Only: "_$S(LREXNREQ:"YES",1:"NO")
  1. I LRCUTOFF S LRINDEX=LRINDEX+1,LRNAME(LRINDEX)="For Tests Received Before: "_$$FMTE^XLFDT(LRCUTOFF,"5MZ")
  1. D HED^LRWRKIN1 D URG^LRX
  1. S LRX=""
  1. F S LRX=$O(^TMP("LRWRKINC",$J,LRX)) Q:LRX="" D
  1. . S LRZ=0
  1. . F S LRZ=$O(^TMP("LRWRKINC",$J,LRX,LRZ)) Q:'LRZ D
  1. . . I LRSORTBY=1 S LRAA("NAME")=$P(LRX,"^")
  1. . . S X=^TMP("LRWRKINC",$J,LRX,LRZ,1)
  1. . . S LRAA=$P(LRX,"^",2),LRAD=$P(X,"^"),LRFAN=$P(X,"^",2),LRLAN=$P(X,"^",3),LRSTAR=$P(X,"^",4),LAST=$P(X,"^",5),LRWDTL=$P(X,"^",6)
  1. . . S:LAST'>LRAD LRAD=LAST-1
  1. . . N LRX,LRZ
  1. . . F S LRAD=$O(^LRO(68,LRAA,1,LRAD)) Q:LRAD<1!(LRAD>LAST) D
  1. . . . I $G(LRSTAR) D AC Q
  1. . . . S LRAN=LRFAN-1
  1. . . . F S LRAN=$O(^LRO(68,LRAA,1,LRAD,1,LRAN)) Q:'LRAN!(LRAN>LRLAN) D
  1. . . . . S LREND=0
  1. . . . . D TD Q:LREND
  1. . . . . I 'LRVERVER D LST1^LRWRKIN1,TESTS
  1. D X^LRWRKIN1
  1. I LREND D LREND^LRWRKIN1 Q
  1. D EQUALS^LRX D WAIT^LRWRKIN1:$E(IOST,1,2)="C-"
  1. K LRDIP D LREND^LRWRKIN1
  1. Q
  1. ;
  1. TD ;
  1. N LRMIAREA,LRDFNX,LRIDTX,LRTST68
  1. K LRMIARX,LRMIPND
  1. I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN,0)) S LREND=1 Q
  1. I LRNOCNTL,$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,0)),"^",2)=62.3 S LREND=1 Q
  1. S LRVERVER=1,(I,LRMIFLG)=0
  1. F S I=$O(^LRO(68,LRAA,1,LRAD,1,LRAN,4,I)) Q:I<.5 I $D(^(I,0)) S LRVERVER=(LRVERVER&$P(^(0),U,5))
  1. ;LR*5.2*536 - if "RPT DATE APPROVED" has not been populated for Microbiology accessions,
  1. ; display accession on the Incomplete list
  1. ; (considered combining logic below with lines above, but decided to keep
  1. ; Microbiology logic separate in case further changes are needed.)
  1. I $P(^LRO(68,LRAA,0),U,2)="MI" D
  1. . S LRDFNX=$P(^LRO(68,LRAA,1,LRAD,1,LRAN,0),U)
  1. . S LRIDTX=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),U,5)
  1. . ;Subscripts: 1 = Bacteriology; 5=Parasitology; 8=Mycology; 11=TB; 16=Virology
  1. . I LRIDTX>1 F LRMIAREA=1,5,8,11,16 D
  1. . . ;using a different flag for Micro so that this change will only affect Micro
  1. . . ;in the TESTS subsection of this routine
  1. . . ;LRMIFLG = "[area] RPT DATE APPROVED" is not populated
  1. . . I $D(^LR(LRDFNX,"MI",LRIDTX,LRMIAREA)),$P(^(LRMIAREA),U)="" D
  1. . . . S LRVERVER=0,LRMIFLG=1
  1. . . . S LRMIARX(LRMIAREA)=""
  1. . Q:'$D(LRMIARX)
  1. . ;determine which tests on the accession are defined for the pending Microbiology
  1. . ;area subscript
  1. . S LRTST68=0
  1. . F S LRTST68=$O(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRTST68)) Q:LRTST68<.5 D
  1. . . ;LR*5.2*543: Do not list if test marked "not performed" or "merged".
  1. . . I $P(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRTST68,0),U,6)]"" Q
  1. . . N LREXCODE
  1. . . S LREXCODE=$P($G(^LAB(60,LRTST68,0)),"^",14)
  1. . . I LREXCODE]"" S LREXCODE=$G(^LAB(62.07,LREXCODE,.1))
  1. . . ;Logic below is the same as the logic in result verification routine LRMIEDZ2 which
  1. . . ;determines which Microbiology area is defined for a Microbiology test
  1. . . S LRMIAREA=$S(LREXCODE["11.5":1,LREXCODE["23":11,LREXCODE["19":8,LREXCODE["15":5,LREXCODE["34":16,1:"")
  1. . . ;setting an array because more than one test on the accession might be defined for the
  1. . . ;Microbiology area
  1. . . I LRMIAREA]"",$D(LRMIARX(LRMIAREA)) S LRMIPND(LRTST68)=""
  1. I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN,4,0)) S LREND=1
  1. Q
  1. ;
  1. TESTS Q:'$D(^LRO(68,LRAA,1,LRAD,1,LRAN,4,0))
  1. N LRI
  1. S LRI=0
  1. F S LRI=$O(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRI)) Q:LRI<.5 D
  1. . N LR60,LRURG,LRTSTN
  1. . S LRI(0)=$G(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRI,0)),LRURG=+$P(LRI(0),U,2)
  1. . S LR60=+LRI(0)
  1. . I $D(^TMP("LR",$J,"T")),'$D(^TMP("LR",$J,"T",LR60)) Q ; Not specific test
  1. . I LREXTST,$D(LREXTST(LR60)) Q ; Exclude specific test
  1. . ;LR*5.2*536:
  1. . ;LRMIFLG of 1 indicates this is a pending Microbiology accession even though
  1. . ;a "complete" date has been set at LRI(0),U,5) by the prompt "[test name] completed:"
  1. . ;(i.e. the "[area] RPT DATE APPROVED:" prompt has not been answered.
  1. . I $P(LRI(0),U,5),'$G(LRMIFLG) Q
  1. . ;LR*5.2*536: This is a Microbiology pending accession but the test being evaluated
  1. . ; is not pending. (There may be more than one Micro test on an accession.)
  1. . ;The check for LRI(0) is necessary because the area subscript may not yet exist in file 63.
  1. . I $G(LRMIFLG),'$D(LRMIPND(LR60)),$P(LRI(0),U,5) Q
  1. . I LRCUTOFF,'LRDLA Q ; Uncollected
  1. . I LRCUTOFF,LRCUTOFF<LRDLA Q ; After cut-off date/time
  1. . S LR60(0)=$G(^LAB(60,LR60,0)) ; Get zeroth node from file #60
  1. . I LREXNREQ,'$P(LR60(0),"^",17) Q ; Exclude non-required tests
  1. . S LRTSTN=$P(LR60(0),U) ; Test name
  1. . I $P(LR60(0),"^")="" S LRTSTN="MISSING FILE 60 - "_LR60
  1. . I LRSORTBY=1 S LRTSTN=LRAA("NAME")_"^"_LRTSTN
  1. . S Y=$G(^LRO(68,LRAA,1,LRAD,1,LRAN,3))
  1. . S LRST=$S($L($P(LRI(0),U,3)):"Load/work list",$L($P(Y,U,3)):"In lab",1:"Not in lab")
  1. . D REF
  1. . S ^TMP($J,LRTSTN,LRURG,$P(LRACC," ",1)_"^"_+$P(LRDX,"^",3),LRAN)=LRST_U_SSN_U_PNM_U_$P(LRDX,U,7)_U_$P(LRDLA,"^",2)_U_LRMAN_U_LRACC
  1. . I $G(LREXD) S ^TMP($J,LRTSTN,LRURG,$P(LRACC," ",1)_"^"_+$P(LRDX,"^",3),LRAN,.3)=$G(^LRO(68,LRAA,1,LRAD,1,LRAN,.3))
  1. Q
  1. ;
  1. REF ; if referred test, get referral status
  1. N LREVNT,LRUID
  1. S LRUID=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,.3)),"^"),LRMAN=$P(LRI(0),"^",10)
  1. I LRMAN S LRMAN=$P($G(^LAHM(62.8,LRMAN,0)),"^")
  1. S LREVNT=$$STATUS^LREVENT(LRUID,LR60,LRMAN)
  1. I LREVNT'="" S LRST=$P(LREVNT,"^")
  1. ;LR*5.2*562 begin
  1. ;NOTE: Amended results do not display a status of "Results received"
  1. ; on the Incomplete report by design. The report should only
  1. ; display tests which currently do not contain a verified result.
  1. ;
  1. ;Only checking "CH" subscripted tests (i.e. not Microbiology).
  1. ;Microbiology will require an NSR due to the amount of code
  1. ;which must be written. Also, according to some SME's, panels
  1. ;should not be defined in Microbiology, even though some sites do.
  1. ;(Anatomic Pathology results are not transmitted through LEDI.)
  1. Q:$P(^LAB(60,LR60,0),"^",4)'="CH"
  1. ;
  1. ;Only display "Results received" status if results are currently
  1. ;waiting in ^LAH waiting to be verified. The previous results
  1. ;received might have been equal to "pending".
  1. ;LRMNF=shipping manifest ien
  1. N LRMNF
  1. S LRMNF=$P(LRI(0),"^",10)
  1. I LRMNF,LRST["Results" D LAH
  1. Q:LRMNF
  1. D PROF
  1. Q
  1. ;
  1. PROF ;
  1. ;Shipping manifest identifier is still null.
  1. ;Is the test a profile component and is the profile on a
  1. ;shipping manifest?
  1. ;LRPRF=parent (profile) indicator
  1. N LRPRF,LRXTST
  1. S LRPRF=$P(LRI(0),"^",9)
  1. ;Should not be null, but checking just in case.
  1. Q:LRPRF=""
  1. ;Quit if test is not a profile component.
  1. I LRPRF'=LR60 D PROFMAN
  1. Q
  1. ;
  1. PROFMAN ;
  1. ;Is the profile on a shipping manifest.
  1. S LRMNF=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRPRF,0)),"^",10)
  1. I LRMNF="" D ORIG(LRPRF)
  1. ;Does the profile contain another profile?
  1. I LRMNF="" D
  1. . N LRPRFCHK,LRPRFZ,LRPROFX
  1. . S LRPRFCHK=LRPRF,LRPRFZ=0
  1. . F S LRPRFZ=$O(^LAB(60,LRPRFCHK,2,LRPRFZ)) Q:'LRPRFZ Q:LRMNF D
  1. . . ;check if a profile within a profile
  1. . . S LRPROFX=$P($G(^LAB(60,LRPRFCHK,2,LRPRFZ,0)),"^")
  1. . . Q:LRPROFX=""
  1. . . I $O(^LAB(60,LRPROFX,2,0))="" Q
  1. . . ;This is a profile within a profile.
  1. . . ;Is "profile within profile" on shipping manifest.
  1. . . S LRMNF=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRPROFX,0)),"^",10)
  1. . . I LRMNF]"" S LRPRF=LRPROFX Q
  1. . . ;Continue searching for shipping manifest.
  1. . . D ORIG(LRPROFX)
  1. . . I LRMNF]"" S LRPRF=LRPROFX Q
  1. . . ;Check atomic tests.
  1. . . N LRATOMIC
  1. . . S LRATOMIC=0
  1. . . F S LRATOMIC=$O(^LAB(60,LRPROFX,2,LRATOMIC)) Q:'LRATOMIC Q:LRMNF D
  1. . . . I $P($G(^LAB(60,LRPROFX,2,LRATOMIC,0)),"^")=LR60 D
  1. . . . . S LRMNF=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRPROFX,0)),"^",10)
  1. . . . . S LRPRF=LRPROFX
  1. I LRMNF]"" D PROFSTAT
  1. Q
  1. ;
  1. ORIG(LRXTST) ;
  1. ;The shipping manifest might be on the original order date
  1. ;for the accession if the accession rolled over.
  1. N LRORIG
  1. S LRORIG=$P(^LRO(68,LRAA,1,LRAD,1,LRAN,0),"^",3)
  1. Q:LRORIG=LRAD
  1. S LRMNF=$P($G(^LRO(68,LRAA,1,LRORIG,1,LRAN,4,LRXTST,0)),"^",10)
  1. Q
  1. ;
  1. PROFSTAT ;
  1. ;Determine profile's status on shipping manifest.
  1. ;LRMNSQ=sequence on shipping manifest
  1. ;LRMNTST=file 60 test ien on shipping manifest
  1. ;LRSTPR=profile's status
  1. N LRMNSQ,LRMNTST,LRSTPR
  1. S (LRMNSQ,LRSTPR)=""
  1. F S LRMNSQ=$O(^LAHM(62.8,LRMNF,10,"UID",LRUID,LRMNSQ)) Q:'LRMNSQ Q:LRSTPR]"" D
  1. . S LRMNTST=$P($G(^LAHM(62.8,LRMNF,10,LRMNSQ,0)),"^",2)
  1. . ;Check the status of the profile on the shipping manifest.
  1. . I LRMNTST=LRPRF D
  1. . . S LREVNT=$$STATUS^LREVENT(LRUID,LRPRF,LRMNF)
  1. . . ;Probably do not need both LRSTPR and LRST at this point,
  1. . . ;but keeping so that won't inadvertently cause other issues.
  1. . . I LREVNT'="" S (LRSTPR,LRST)=$P(LREVNT,"^")
  1. . ;Further checking needed if status of the profile is "Results
  1. . ;received".
  1. . I LRSTPR["Results" D LAH
  1. Q
  1. ;
  1. LAH ;
  1. ;If "Results received" status, are results waiting to be verified.
  1. ;Results might have previously been verified for the profile,
  1. ;but no results are currently waiting to be verified on
  1. ;remaining components. Laboratory personnel use the "Results
  1. ;received" status as an indicator that results are waiting
  1. ;to be manually verified.
  1. ;Need to drill down through globals (re-using variable LRWKLST).
  1. N LRWKLST,LRLAHSQ,LRLAHTST,LRHIT
  1. ;Retrieve shipping configuration ien.
  1. S LRWKLST=$P(^LAHM(62.8,LRMNF,0),"^",2)
  1. ;Retrieve LAB MESSAGING LINK (#.07) field.
  1. S LRWKLST=$P(^LAHM(62.9,LRWKLST,0),"^",7)
  1. ;Retrieve the name of the link.
  1. S LRWKLST=$P(^LAHM(62.48,LRWKLST,0),"^")
  1. ;Finally, retrieve Load/Worklist ien.
  1. S LRWKLST=$O(^LAB(62.4,"B",LRWKLST,""))
  1. Q:LRWKLST=""
  1. S LRWKLST=$P(^LAB(62.4,LRWKLST,0),"^",4)
  1. Q:LRWKLST=""
  1. ;Are any results waiting to be verified for this UID.
  1. I '$D(^LAH(LRWKLST,1,"U",LRUID)) S LRST="Test shipped" Q
  1. ;Check the results.
  1. S LRLAHSQ="",LRHIT=0
  1. F S LRLAHSQ=$O(^LAH(LRWKLST,1,"U",LRUID,LRLAHSQ)) Q:LRLAHSQ="" D
  1. . S LRLAHTST=.3
  1. . F S LRLAHTST=$O(^LAH(LRWKLST,1,LRLAHSQ,LRLAHTST)) Q:'LRLAHTST Q:LRHIT D
  1. . . ;Do any tests in ^LAH have the same data name as the test being
  1. . . ;evaluated. (Considered screening out results of "pending". But comments
  1. . . ;might have been transmitted for pending results which need verification.)
  1. . . I LRLAHTST=$P($P(^LAB(60,LR60,0),"^",5),";",2) S LRHIT=1
  1. . . ;Check profile components.
  1. . . N LRSUB,LRSUBTST
  1. . . S LRSUB=0
  1. . . F S LRSUB=$O(^LAB(60,LR60,2,LRSUB)) Q:'LRSUB D
  1. . . . S LRSUBTST=$P($G(^LAB(60,LR60,2,LRSUB,0)),"^")
  1. . . . I LRLAHTST=$P($P(^LAB(60,LRSUBTST,0),"^",5),";",2) S LRHIT=1
  1. ;No match found in ^LAH, so revert status to "Test shipped".
  1. I 'LRHIT S LRST="Test shipped"
  1. Q
  1. ;
  1. PHD ;
  1. S LREND=0
  1. I $P(LRAA(0),"^",3)="Y" D STAR^LRWU3
  1. I $G(LRSTAR) Q
  1. D ADATE^LRWU Q:LREND
  1. ;LR*5.2*566: Reset LRAD if accession area has rolled over.
  1. ; Only Daily accession areas roll over - not Yearly, Monthly,
  1. ; or Quarterly.
  1. ; 10th piece indicates if Bypass Rollover is set to yes.
  1. ; Adding $G because 1 subscript might not be set yet
  1. ; for new accession areas.
  1. I LRAD<DT,$P(LRAA(0),"^",3)="D",'$P(LRAA(0),"^",10) D Q:LREND
  1. . K DIR
  1. . S DIR(0)="YO",DIR("A")="Are you sure you want to proceed?",DIR("B")="NO"
  1. . S DIR("A",1)="Rollover completed on "_$$DDDATE^LRAFUNC1($$CDHTFM^LRAFUNC1(^LAB(69.9,1,"RO")),1)
  1. . S DIR("A",2)="You are selecting a date in the past."
  1. . S DIR("?")="Answer 'YES' if you want to continue."
  1. . D ^DIR
  1. . I $D(DIRUT)!'Y S LREND=1 Q
  1. . S LRDIP=LRAD
  1. I $P(LRAA(0),"^",3)="D",'$P(LRAA(0),"^",10),$P($G(^LRO(68,LRAA,1,0)),"^",3)>LRAD S LRAD=$P(^LRO(68,LRAA,1,0),"^",3)
  1. S LAST=LRAD,LRAD=LRAD-1
  1. D LRAN^LRWU3
  1. Q
  1. ;
  1. AC S LRTK=LRSTAR-.00001
  1. F S LRTK=$O(^LRO(68,LRAA,1,LRAD,1,"E",LRTK)) Q:LRTK<1!(LAST>1&(LRTK\1>LAST)) D
  1. . S LRAN=0
  1. . F S LRAN=$O(^LRO(68,LRAA,1,LRAD,1,"E",LRTK,LRAN)) Q:'LRAN D
  1. . . S LREND=0
  1. . . I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN,0)) S LREND=1 Q
  1. . . D TD Q:LREND
  1. . . ;I LRUNC!('LRVERVER) D LST,TESTS
  1. . . I 'LRVERVER D LST1^LRWRKIN1,TESTS
  1. Q
  1. ;
  1. % R %:DTIME Q:%=""!(%["N")!(%["Y") W !,"Answer 'Y' or 'N': " G %
  1. Q
  1. ;
  1. LREXPD ;Include panel test in list when selecting specific tests
  1. I $G(S1(+$G(S1))) S ^TMP("LR",$J,"T",S1(S1))=^LAB(60,S1(S1),0)
  1. Q