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

LRVR0.m

Go to the documentation of this file.
  1. LRVR0 ;DALOI/STAFF - LEDI MI/AP Data Verification; Jul 20, 2020@13:53
  1. ;;5.2;LAB SERVICE;**350,427,474,480,537,561**;Sep 27, 1994;Build 2
  1. ;
  1. ; LEDI MI/AP Auto-instrument verification
  1. ; Called from LRVR
  1. Q
  1. ;
  1. ;
  1. EN ;
  1. N EAMODE,LA7X,LRANYAA,LRAO,LRBG0,LRCFL,LRCMNT,LRDINST,LREND,LRFIFO,LRFLAG,LRINTYPE,LRLEDI,LRLLT,LRMIDEF,LRMIOTH
  1. N LRNOP,LRONESPC,LRONETST,LRPG,LRPTP,LRSAME,LRSB,LRSS,LRTM60,LRTX,LRUID,LRVT,LRWRDVEW,LRX,X,Y
  1. ;
  1. S LRSS=$P($G(^LRO(68,+$G(LRAA),0)),U,2) Q:LRSS=""
  1. I LRSS'?1(1"MI",1"SP",1"CY",1"EM") Q
  1. ;
  1. ; If micro accession then set flag to indicate "result entry (RE)".
  1. I LRSS="MI" S LRVT="RE"
  1. ;
  1. S LRDINST=+$$KSP^XUPARAM("INST")
  1. S LRLEDI=1,LRCFL="",EAMODE=1,LRWRDVEW=1
  1. S LRX=$S(+$P($G(^LAB(69.9,1,0)),U,7):+$P(^(0),U,7),1:1)
  1. S LRANYAA=+$P($G(^LRO(68.2,LRLL,10,LRPROF,0)),"^",3)
  1. I $G(LRVBY)=1 D ACC
  1. I $G(LRVBY)=2 S LRUID="" D UID
  1. D CLEAN
  1. Q
  1. ;
  1. ;
  1. UID ;UID driven look-up
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. ;
  1. F D Q:$G(LREND)
  1. . N LRMULTSQ
  1. . I $G(IOF)'="" W @IOF
  1. . K C5,DIC,DIR,DIRUT,DTOUT,DUOUT,LRAB,LRDEL,LRDL,LRFP,LRLDT,LRNG,LRNM,LRNOP,LRSET,LRTEST,LRVER,T,X,Y,Z
  1. . S X=DUZ D DUZ^LRX S LRTEC=LRUSI
  1. . D WLN^LRVRA I $G(LRNOP) D NEXT^LRVRA Q
  1. . ;
  1. . F Q:$G(LRNOP) D
  1. . . N LRSEQCNT
  1. . . D ISQN
  1. . . I $G(LRSEQCNT)>1 S LRMULTSQ=1
  1. . . I $G(LRNOP) Q
  1. . . D ACCSET
  1. . . I $G(LRNOP) Q
  1. . . I "SPCYEM"[LRSS D ^LRVRAP4
  1. . . I LRSS="MI" D PROC,ACCEPT
  1. . . I $G(LRNOP) Q
  1. . . I $G(LRSEQCNT)<2 S LRNOP=1 Q
  1. . . I $G(IOF)'="" W @IOF
  1. . . W !,PNM,?30,SSN," Age: ",AGE(2)
  1. . . W !,"ORDER #: ",LRCEN," ",LRACC," ["_LRUID,"]"
  1. . . W !
  1. . . S (ISQN,LRISQN)=0
  1. . ;
  1. . D UNLOCK,NEXT^LRVRA
  1. D CLEAN
  1. Q
  1. ;
  1. ;
  1. ERR1 ;Look-up Error
  1. W !,"No data for "_LRUID_" in file"
  1. Q
  1. ;
  1. ;
  1. CLEAN ;
  1. ;
  1. ; Task of background jobs for workload and HL7 message processing
  1. D ^LRCAPV2
  1. ;
  1. K ^TMP("LRMI",$J)
  1. K AGE,DFN,I,LRACC,LRCDT,DIRUT
  1. K LRCEN,LRDFN,LRDPF,LRNOP,LRLOCK,LRPUID,LRISQN,LRODT,LROU3,LRPROF
  1. K LRSN,LRSTATUS,LRTEC,LRUSI,LRVBY,PNM,SSN,X,Y
  1. K ZTRTN,ZTIO,ZTDTH,ZTDESC
  1. D ^LRVRKIL
  1. Q
  1. ;
  1. ;
  1. ACC ; Accession number look-up
  1. D ADATE^LRWU
  1. I LRAD<1 S LRNOP=1 Q
  1. S LRAN=0
  1. F D Q:$G(LRDBUG,$G(LREND))
  1. . N LRMULTSQ
  1. . I $G(IOF)'="" W @IOF
  1. . K DIR,DIC,Y,LRNOP
  1. . S LRAN=$O(^LAH(LRLL,1,"C",LRAN)) I 'LRAN D ACCMSG Q
  1. . S Y=LRAN
  1. . S LRISQN=$O(^LAH(LRLL,1,"C",LRAN,0)) I 'LRISQN D ACCMSG Q
  1. . I '$O(^LAH(LRLL,1,LRISQN,0)) D ACCMSG Q
  1. . S DIR(0)="FO^1:10",DIR("A")="Enter Accession number part",DIR("?")="^D LW^LRVR"
  1. . S DIR("S")="I $O(^LAH(LRLL,1,""C"","_Y_",0)"
  1. . I $G(LRAN) S DIR("B")=LRAN
  1. . D ^DIR
  1. . I $D(DIRUT) D STOP^LRVR S LRNOP=1 Q
  1. . S LRAN=+Y I Y<1 D ACCMSG Q
  1. . ;
  1. . F Q:$G(LRNOP) D
  1. . . N LRSEQCNT
  1. . . D ISQN
  1. . . I $G(LRSEQCNT)>1 S LRMULTSQ=1
  1. . . I $G(LRNOP) Q
  1. . . D ACCSET
  1. . . S LRTM60=$$LRTM60^LRVR(LRCDT)
  1. . . I $G(LRNOP) Q
  1. . . I "SPCYEM"[LRSS D ^LRVRAP4
  1. . . I LRSS="MI" D PROC,ACCEPT
  1. . . I $G(LRNOP) Q
  1. . . I $G(LRSEQCNT)<2 S LRNOP=1 Q
  1. . . I $G(IOF)'="" W @IOF
  1. . . S (ISQN,LRISQN)=0
  1. . D UNLOCK
  1. ;
  1. D CLEAN
  1. Q
  1. ;
  1. ;
  1. ACCMSG ;
  1. W !," No accession available for this Load/Worklist",!
  1. D STOP^LRVR S LRNOP=1
  1. Q
  1. ;
  1. ;
  1. PROC ;Process the entry from LAH(LRLL
  1. Q:$$LEDIERR^LRVRMI0(LRLL,LRISQN,0,1)
  1. ;
  1. ; Set MI specific variables
  1. S LRBG0=^LR(LRDFN,"MI",LRIDT,0),LRSSC=$P(LRBG0,U,5)_U_$P(LRBG0,U,11),LRFIFO=1
  1. ;
  1. D EN^LRVRMI1
  1. Q
  1. ;
  1. ;
  1. ACCSET ;Set up accession variables
  1. N DA,DIC,DIR,DIRUT,DTOUT,DUOUT,LRCNT,LRLAHD,LRI,LRNODE
  1. K LRERR
  1. S (LRLOCK,LRNOP)=0,LRLAHD=$G(^LAH(LRLL,1,LRISQN,0))
  1. I LRLAHD="" D Q
  1. . W !,"^LAH("_LRLL_",1,"_LRISQN_",0) Global is corrupt"
  1. . D ZAP S LRNOP=1
  1. ;
  1. S LRAA=$P(LRLAHD,U,3)
  1. I $P(^LRO(68,LRAA,0),U,2)'=LRSS W !,"Not a "_LRSS_" Area - Abort",! S LRNOP=1 Q
  1. S LRAN=$P(LRLAHD,U,5),LRAD=$P(LRLAHD,U,4)
  1. ;
  1. I LRAA=""!(LRAD="")!(LRAN="") D Q
  1. . W !,"^LAH("_LRLL_",1,"_LRISQN_",0) Global is corrupt"
  1. . D ZAP S LRNOP=1
  1. I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN,0)) D Q
  1. . W !,"Accession does not exist in ACCESSION file (#68)"
  1. . D ZAP S LRNOP=1
  1. ;
  1. S LRDFN=+^LRO(68,LRAA,1,LRAD,1,LRAN,0),LRCEN=$S($D(^(.1)):^(.1),1:0)
  1. S LRACC=$G(^LRO(68,LRAA,1,LRAD,1,LRAN,.2)),LRCDT=$P($G(^(3)),U)
  1. S LRODT=$S($P(^(0),U,4):$P(^(0),U,4),1:$P(^(0),U,3)),LRSN=$P(^(0),U,5)
  1. S LRORU3=$G(^LRO(68,LRAA,1,LRAD,1,LRAN,.3)),LRIDT=$P(^(3),U,5)
  1. S LRUID=$P(LRORU3,U),LRTS=""
  1. ;
  1. S LRI=0
  1. F S LRI=$O(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRI)) Q:LRI<1!$G(LRTS) S LRNODE=^(LRI,0) I $P(LRNODE,U,2)<50 S LRTS=+LRNODE
  1. S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3)
  1. D PT^LRX
  1. ;
  1. ; Patient info displayed during UID lookup - display here when lookup by accession number
  1. I $G(LRVBY)'=2 D
  1. . W !,PNM,?30,SSN," Age: ",AGE(2)
  1. . W !,"ORDER #: ",LRCEN," ",LRACC," ["_LRUID,"]"
  1. ;
  1. I $$GET^XPAR("USR^DIV^PKG","LR MI VERIFY DISPLAY PROVIDER",1,"Q") D PROV^LRMIEDZ2
  1. ;
  1. S DIR(0)="E"
  1. D ^DIR
  1. I $D(DIRUT) S LRNOP=1 Q
  1. ;
  1. K LRERR
  1. S X=$$GETLOCK^LRUTIL("^LR(LRDFN,LRSS,LRIDT)",10,1)
  1. I 'X S LRERR=1 D NOLOCK Q
  1. S X=$$GETLOCK^LRUTIL("^LRO(68,LRAA,1,LRAD,1,LRAN)",10,1)
  1. I 'X S LRERR=2 D NOLOCK Q
  1. ;
  1. S LRLOCK=1
  1. I '$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),"^",3) D
  1. . N LRAA,LRAD,LRAN
  1. . S LRSTATUS="C" D P15^LROE1
  1. . I LRCDT<1 S LRNOP=1
  1. ;
  1. I '$G(LRNOP),$P($G(^LRO(69,LRODT,1,LRSN,1)),U,4)'="C" D
  1. . W !,"You cannot verify an accession which has not been collected.",$C(7)
  1. . S LRNOP=1
  1. ;
  1. ; Determine if one or more tests on accession.
  1. S (LRI,LRCNT,LRPTP)=0
  1. F S LRI=$O(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRI)) Q:'LRI D
  1. . I $P(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRI,0),"^",2)<50 S LRCNT=LRCNT+1,LRPTP=LRI
  1. ;
  1. ; If more than one test on accession then select the test to work with (URGENCY<50 - non-workload tests).
  1. I LRCNT>1 D
  1. . K DA,DIC
  1. . S DIC="^LRO(68,LRAA,1,LRAD,1,LRAN,4,",DIC(0)="AEMOQ",DIC("A")="Select TEST/PROCEDURE: ",DIC("S")="I $P(^(0),U,2)<50"
  1. . S DA(2)=LRAA,DA(1)=LRAD,DA=LRAN,LRPTP=0
  1. . D ^DIC
  1. . I Y<1 S LRNOP=1 Q
  1. . S LRPTP=+Y
  1. ;
  1. I $G(LRNOP) Q
  1. ;
  1. S LRMIDEF=$P(^LAB(69.9,1,1),U,10),LRMIOTH=$P(^(1),U,11)
  1. ;
  1. ; Set interface type
  1. S LRINTYPE=$P(^LAH(LRLL,1,LRISQN,0),"^",12)
  1. ;
  1. Q
  1. ;
  1. ;
  1. NOLOCK ; Not able to lock message
  1. W !!,$S($G(LRERR)=1:" **Accession** ",$G(LRERR)=2:"**Patient's ^LR( file**",1:"Record")_" is locked by another user. " H 5
  1. S LRNOP=1
  1. Q
  1. ;
  1. ;
  1. UNLOCK ; Unlock accession and ^LR( global
  1. Q:'$G(LRLOCK)
  1. L -^LRO(68,$G(LRAA),1,$G(LRAD),1,$G(LRAN))
  1. L -^LR($G(LRDFN),$G(LRSS),$G(LRIDT))
  1. Q
  1. ;
  1. ;
  1. ACCEPT ;Display results and accept data
  1. N LRBATCH,LREDITTYPE,LRMODE,LRNPTP
  1. I $G(LREND) S LREND=0 Q
  1. ;
  1. S LRMODE="LDSI",LRBATCH=1,LREDITTYPE=1
  1. D DQ^LRMIPSZ1
  1. ;
  1. ;
  1. N DIR,DIROUT,DIRUT,DUOUT
  1. I LRINTYPE=1 D
  1. . S DIR(0)="SAO^0:Quit;1:Release;2:Comments/Release;3:Edit (full)"
  1. . S DIR("A")="Select RELEASE action: "
  1. . S DIR("B")=$$GET^XPAR("USR^PKG","LR MI UI RELEASE DEFAULT","`"_+LRLL,"E")
  1. . I DIR("B")="" S DIR("B")="Edit (full)"
  1. . S DIR("?")="Selections 1-3 will allow editing of status and approved date/time."
  1. . S DIR("?",1)="Entering 0 will abort review/release."
  1. . S DIR("?",2)="Entering 1 will allow release 'as is' with no editing."
  1. . S DIR("?",3)="Entering 2 will allow you to enter/edit comments then release."
  1. . S DIR("?",4)="Entering 3 will allow you to enter full edit, similar to 'Results entry' option."
  1. ;
  1. E D
  1. . S DIR(0)="Y"
  1. . S DIR("A")="Do you want to APPROVE these results",DIR("B")="NO"
  1. . S DIR("?")="Enter Y if you want to approve these results"
  1. . S DIR("?",1)="Entering Y will store the results in the Lab System"
  1. ;
  1. D ^DIR
  1. S LREDITTYPE=+Y
  1. I $D(DIRUT) S LRNOP=1 Q
  1. I Y=0 D PURG Q
  1. I Y<1 S LRNOP=1 Q
  1. ;
  1. ;LR*5.2*537:
  1. ;Set LRM63ORG array to track organisms already on file for this
  1. ;accession. Used by routine LRCAPVM downstream to determine "new"
  1. ;organisms for workload accumulation. The Isolate ID instead of
  1. ;the organism id is used for reference because an organism id
  1. ;might be filed more than once on an accession. It's standard
  1. ;laboratory practice to not change the isolate id for an organism.
  1. ;In the rare instance that this occurs, workload must be adjusted
  1. ;manually.
  1. N LRM63ORG,LRM63SQ
  1. I LRINTYPE=1 D
  1. . F LRM63SQ=3,6,9,12,17 D
  1. . . M LRM63ORG(LRM63SQ)=^LR(LRDFN,"MI",LRIDT,LRM63SQ,"C")
  1. ;
  1. ; If user just accepting or doing comments then ask for tests.
  1. I LREDITTYPE<3 D
  1. . D EC^LRMIEDZ4
  1. . S LRTS=LRTS(LRI)
  1. ;
  1. D EN^LRVRMI4
  1. ;
  1. ; If Lab UI interface then allow editing remarks (#13), status (#11.5) and approved date/time (#11)
  1. I LRINTYPE=1,LREDITTYPE<3 D
  1. . N DA,DIE,DR,LRANOK,LRLEDI,LRCAPO,LRUNDO
  1. . S (LRCAPOK,LRANOK)=1,LRUNDO=0
  1. . S DA=LRIDT,DA(1)=LRDFN,DIE="^LR(LRDFN,""MI"","
  1. . S DR=$S(LREDITTYPE=2:"13;",1:"")_"11.5;11"
  1. . D ^DIE
  1. . D VT^LRMIUT1
  1. ;
  1. ; If Lab UI interface and user wants to do full editing
  1. I LRINTYPE=1,LREDITTYPE=3 D
  1. . N LRANOK,LRLEDI,LRCAPO,LRUNDO
  1. . S (LRCAPOK,LRANOK)=1,LRUNDO=0
  1. . D AUDRTN^LRMIEDZ2
  1. ;
  1. ; Store performing lab info
  1. I $D(^TMP("LRPL",$J)) D ROLLUPPL^LRRPLUA(LRDFN,LRSS,LRIDT)
  1. ;
  1. ; Ask for performing laboratory assignment
  1. W !! D EDIT^LRRPLU(LRDFN,"MI",LRIDT)
  1. ;
  1. ; Store reporting lab
  1. D SETRL^LRVERA(LRDFN,LRSS,LRIDT,DUZ(2))
  1. ;
  1. ; Update clinical reminders
  1. D UPDATE^LRPXRM(LRDFN,"MI",LRIDT)
  1. ;
  1. ; Ask to send CPRS alert
  1. D ASKXQA^LRMIEDZ2
  1. ;
  1. ; If Lab UI interface then prompt user for accession test complete date/time in EC3^LRMIEDZ2 call.
  1. I LRINTYPE=1 S LRFIFO=0
  1. ;
  1. ; Update accession and order
  1. D EC3^LRMIEDZ2
  1. ;
  1. ;LR*5.2*537: If UI (not LEDI) store workload
  1. ;Downstream LRCAPVM will check other workload related variables
  1. ;which might not be defined at this point in LRVR0
  1. I LRINTYPE=1 D
  1. . D LOOK^LRCAPV1
  1. . ;killing LRM63ORG in case somehow a workflow will cause the array
  1. . ;to be carried over between accessions
  1. . K LRM63ORG
  1. ;
  1. ; Queue results if LEDI and cleanup
  1. D LEDI,ZAP
  1. K ^TMP("LRMI",$J)
  1. ;
  1. Q
  1. ;
  1. ;
  1. PURG ; Ask if the entry should be purged from ^LAH(
  1. W !
  1. N DIR,DIROUT,DIRUT,DUOUT
  1. S DIR(0)="Y",DIR("A")="Do you want to PURGE these results",DIR("B")="NO"
  1. S DIR("?",1)="Enter NO if you want to process these results at a later time"
  1. S DIR("?")="Enter YES to remove these results from the list"
  1. D ^DIR
  1. I $D(DIRUT) S LRNOP=1 Q
  1. I Y=1 D ZAP
  1. Q
  1. ;
  1. ;
  1. ZAP ; Remove entry from ^LAH( global
  1. N REC
  1. S REC=$S($G(ISQN):ISQN,1:$G(LRISQN))
  1. I LRLL,REC D ZAPALL^LRVR3(LRLL,REC)
  1. Q
  1. ;
  1. ;
  1. SETACC ;
  1. N LRFILE,LRIENS,LRFDA,LRERR
  1. S LRFILE=68.04,LRERR=""
  1. S LRIENS=LRTS_","_LRAN_","_LRAD_","_LRAA_","
  1. S LRFDA(1,LRFILE,LRIENS,3)=DUZ
  1. S LRFDA(1,LRFILE,LRIENS,4)=$$NOW^XLFDT
  1. S LRFDA(1,LRFILE,LRIENS,8)=$G(LRCDEF)
  1. D FILE^DIE("KS","LRFDA(1)","LRERR")
  1. Q
  1. ;
  1. ;
  1. LEDI ; If LEDI put results in queue to return to collecting lab
  1. ; Called from above, LRMIEDZ2, LRMISTF1 and LRVRAP4.
  1. N IEN,LRCDEFX,LRERR,LRIDT,LRORDT,LRORU3,LRSS,LRTSDEF
  1. Q:'$D(^LRO(68,+$G(LRAA),1,+$G(LRAD),1,+$G(LRAN),0))
  1. ;
  1. S LRORU3=$G(^LRO(68,LRAA,1,LRAD,1,LRAN,.3))
  1. Q:'$P(LRORU3,U,3)
  1. ;
  1. S LRODT=$P(^LRO(68,LRAA,1,LRAD,1,LRAN,0),U,4)
  1. S LRSS=$P(^LRO(68,LRAA,0),U,2)
  1. S LRIDT=$P(^LRO(68,LRAA,1,LRAD,1,LRAN,3),U,5)
  1. I '$$OK2SEND^LA7SRR D LEDINO Q
  1. ;
  1. I '$G(LRCDEF) N LRCDEF I "SPEMCY"[LRSS S LRCDEF=3241,LRCDEFX=1
  1. I '$G(LRTS) N LRTS D
  1. . S IEN=0
  1. . F S IEN=$O(^LRO(68,LRAA,1,LRAD,1,LRAN,4,IEN)) Q:IEN<1 D Q:$G(LRTS)
  1. . . I $P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,4,IEN,0)),U,2)<50 S LRTS=IEN,LRTSDEF=1
  1. ;LR*5.2*561: Commenting out line below. It caused an issue when preliminary
  1. ; results were verified because the accession will not appear on
  1. ; the Incomplete Test Status Report. Also, if the results have a
  1. ; final status, the file 68 fields are already populated with a
  1. ; complete date/time, etc by upstream routines.
  1. ;I $G(LRTS) D SETACC
  1. ;
  1. ; Comment out the following line after testing is complete
  1. W !!,$$CJ^XLFSTR("Sending report to LEDI collecting site",IOM)
  1. D MIAP^LA7VMSG(LRAA,LRAD,LRAN,+$G(LRTS),LRDFN,LRSS,LRIDT,LRODT)
  1. Q
  1. ;
  1. ;
  1. LEDINO ; LEDI HL7 message sending error message
  1. W !!,$$CJ^XLFSTR("Unable to sent report to LEDI collecting site - no date report approved",IOM)
  1. Q
  1. ;
  1. ;
  1. ISQN ; Find the entry associated with this accession area and accession number
  1. N LRI,LRSQ
  1. S (LRI,LRSEQCNT)=0
  1. F S LRI=$O(^LAH(LRLL,1,"C",LRAN,LRI)) Q:LRI<1 D
  1. . N LRX
  1. . S LRX=$G(^LAH(LRLL,1,LRI,0))
  1. . ; Quit if different accession area.
  1. . I $P(LRX,"^",3),$P(LRX,"^",3)'=LRAA Q
  1. . ; Quit if different accession date and not a rollover accession (same original accession date).
  1. . I $P(LRX,"^",4),$P(LRX,"^",4)'=LRAD,$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,0)),"^",3)'=$P($G(^LRO(68,LRAA,1,$P(LRX,"^",4),1,LRAN,0)),"^",3) Q
  1. . I LRSEQCNT W !
  1. . S LRSEQCNT=LRSEQCNT+1,LRSQ=LRI,LRSQ(LRI)=""
  1. . W !,?2,"Seq #: ",LRI,?13," Accession: ",$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,.2)),"^")
  1. . I $P(LRX,"^",10) W ?40," Results received: ",$$FMTE^XLFDT($P(LRX,"^",10),"1M")
  1. . W !,?20,"UID: ",$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,.3),"UNKNOWN"),"^")
  1. . I $P(LRX,"^",11) W ?44," Last updated: ",$$FMTE^XLFDT($P(LRX,"^",11),"1M")
  1. . I $G(^LAH(LRLL,1,LRI,.1,"OBR","ORDNLT"))'="" D
  1. . . N LR64,LRNLT,LRNLTN,LRPIECE
  1. . . W !,?13," Order NLT: "
  1. . . F LRPIECE=1:1 S LRNLT=$P($G(^LAH(LRLL,1,LRI,.1,"OBR","ORDNLT")),"^",LRPIECE) Q:LRNLT="" D
  1. . . . S LR64=+$O(^LAM("E",LRNLT,0))
  1. . . . S LRNLTN=$$GET1^DIQ(64,LR64_",",.01)
  1. . . . W ?25,$S(LRNLTN'="":LRNLTN,1:LRNLT),!
  1. ;
  1. I LRSEQCNT=0 W !,"No data for that accession" S LRNOP=1 Q
  1. I LRSEQCNT=1,'$G(LRMULTSQ) S (ISQN,LRISQN)=LRSQ Q
  1. ;
  1. ; If multiple entries (sequence - overlay data=no) then ask user which one to use.
  1. N DIR,DIRUT,DIROUT,DTOUT,DUOUT
  1. S DIR(0)=""
  1. S I=0 F S I=$O(LRSQ(I)) Q:'I S DIR(0)=DIR(0)_$S(I=1:"",1:";")_I_":Seq #"_I
  1. S DIR(0)="SO^"_DIR(0),DIR("A")="Choose sequence number"
  1. I LRSEQCNT=1,$G(LRMULTSQ) S DIR("B")=LRSQ
  1. D ^DIR
  1. I $D(DIRUT)!(Y<1) S LRNOP=1 Q
  1. S (ISQN,LRISQN)=+Y Q
  1. Q