LRWLST1 ;DALOI/CJS/RWF/FHS - ACCESSION SETUP ; 21-Jul-2015 06:30 ; MKK
;;5.2;LAB SERVICE;**48,65,1010,121,128,1013,153,202,261,1018,286,1027,1030,331,379,331,379,1031,1032,415,1033,1034,1035**;NOV 1, 1997;Build 5
;
; Reference to ^DIC(42 supported by IA #10039
; Reference to ^SC( supported by IA #10040
;
EP ; EP
S LRWLC=0
F S LRWLC=$O(LRTSTS(LRWLC)) Q:LRWLC<1 S LRAD=DT D SPLIT
;
; If LEDI and comments came with order then copy to order in #69
I $G(LRORDRR)="R",$G(LR696),$D(^LRO(69.6,LR696,99)) D
. N LRDIE
. D WP^DIE(69.01,LRSN_","_LRODT_",",16,"A","^LRO(69.6,LR696,99)","LRDIE(16)")
;
K DIC,DLAYGO,DR,DA,DIE,LRIXX
Q:$G(LRORDR)="P"
K LRNM,LRTSTS
K ^TMP("LR",$J,"TMP")
K ^TMP("LRWLST1",$J)
Q
;
SPLIT ;
N LRAA,LRX
; Setup regular accessions (LRUNQ=0)
S LRUNQ=0,LREND=0
I $D(LRTSTS(LRWLC,0)) D
. D GTWLN
. I LREND Q
. S LRAA=0
. F S LRAA=$O(LRTSTS(LRWLC,0,LRAA)) Q:LRAA<1 D
. . S LRSS=LRTSTS(LRWLC,0,LRAA)
. . ; D STWLN,ST2,^LRWLST11,EN^LA7ADL(LRUID)
. . D STWLN,ST2,^LRWLST11,IHSLOG,EN^LA7ADL(LRUID) ; IHS/MSC/MKK - LR*5.2*1031
. D SICA^LRWLST11
;
; Setup accessions requiring 'unique' accession numbers (LRUNQ=1)
S LRUNQ=1,LRAA=0
F S LRAA=$O(LRTSTS(LRWLC,1,LRAA)) Q:LRAA<1 D
. S LRSS=LRTSTS(LRWLC,1,LRAA)
. F D GTWLN Q:LREND D Q:$O(LRTSTS(LRWLC,1,LRAA,0))<1
. . ; D STWLN,ST2,^LRWLST11,EN^LA7ADL(LRUID),SICA^LRWLST11
. . D STWLN,ST2,^LRWLST11,IHSLOG,EN^LA7ADL(LRUID),SICA^LRWLST11 ; IHS/MSC/MKK - LR*5.2*1031
;
Q
;
; ---- BEGIN IHS/OIT/MKK -- LR*5.2*1027
IHSLOG ; EP -- Create entry for PCC transfer
; Q:'BLRLOG
Q:'+$G(BLRLOG) ; IHS/MSC/MKK - LR*5.2*1031
;
D ^BLREVTQ("C","A",$G(BLROPT),,LRODT_","_LRSN_","_LRAA_","_LRAD_","_LRAN_","_LRACC) ;IHS/OIRM TUC/AAB 12/12/96
Q
; ---- END IHS/OIT/MKK -- LR*5.2*1027
;
;
STWLN ; Set accession number
D GETLOCK(LRAA,LRAD)
D CHECK68(LRAA,LRAD)
;
S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3)
;
; Handle 'in common' area that was not setup in GTWLN call.
I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN)) D SETAN(LRAA,LRAD,LRAN)
;
S LREND=0,LRLBLBP=1-$P(LRSS,U,2),LRSS=$P(LRSS,U)
S LRACC=$P(^LRO(68,LRAA,0),U,11)_" "_$S(LRAD["0000":$E(LRAD,2,3),1:$E(LRAD,4,7))_" "_LRAN
;
S LRPRAC=""
I $D(^LRO(69,LRODT,1,LRSN,0)) S LRPRAC=$P(^(0),U,6) S:$D(LRNT) ^(3)=LRNT
;
; Location type
S LRCAPLOC=$P($G(^SC(+LROLLOC,0)),U,3)
I LRCAPLOC="" S LRCAPLOC="Z"
;
; File information in file #68 for this accession
N FDA,LR6802,LRDIE
S LR6802=LRAN_","_LRAD_","_LRAA_","
S FDA(1,68.02,LR6802,.01)=LRDFN
S FDA(1,68.02,LR6802,1)=LRDPF
S FDA(1,68.02,LR6802,2)=LRAD
S FDA(1,68.02,LR6802,3)=LRODT
S FDA(1,68.02,LR6802,4)=LRSN
S FDA(1,68.02,LR6802,6)=LRLLOC
S X=$G(^LRO(69,LRODT,1,LRSN,.1)) I X'="" S FDA(1,68.02,LR6802,14)=X
;
; No ordering provider/location on controls
I LRDPF'=62.3 D
. S FDA(1,68.02,LR6802,6.5)=LRPRAC
. S FDA(1,68.02,LR6802,94)=LROLLOC
;
; Only store treating specialty on file #2 patients
; If no treating specialty then use specialty from file #44 location
I LRDPF=2 D
. S LRTREA=$P($G(^DPT(DFN,.103)),U)
. I 'LRTREA S LRTREA=$P($G(^SC(+LROLLOC,0)),U,20)
. I LRTREA S FDA(1,68.02,LR6802,6.6)=LRTREA
;
S FDA(1,68.02,LR6802,6.7)=DUZ
S FDA(1,68.02,LR6802,15)=LRACC
S FDA(1,68.02,LR6802,26)=DUZ(2)
S FDA(1,68.02,LR6802,92)=LRCAPLOC
;
D FILE^DIE("","FDA(1)","LRDIE(1)")
; I $D(LRDIE(1)) D MAILALRT
I $D(LRDIE(1)) D MAILALRT(1) ; IHS/MSC/MKK - LR*5.2*1031
;
; ----- BEGIN IHS/MSC/MKK - LR*5.2*1032
; ONLY use data from the 69 for the Specimen & data from 60 for the Collection sample
;
; If specimen defined then set nodes, force to ien=1 since many lab
; routines expect the specimen to be record number 1.
; I $G(LRSPEC) D
; I +$G(LRSPEC) D ; IHS/MSC/MKK - LR*5.2*1031
; . N FDAIEN
; . S FDAIEN(1)=1
; . S FDA(2,68.05,"+1,"_LR6802,.01)=LRSPEC
; . S FDA(2,68.05,"+1,"_LR6802,1)=$P(LRSAMP,";",1)
; . ;
; . ; Modification to prevent lock failures - loop 10 times to give system a chance to get lock
; . N LRLOCKOK,LRLOOPCT
; . S LRLOCKOK=0
; . F LRLOOPCT=1:1:10 Q:LRLOCKOK D I 'LRLOCKOK H 5
; . . K LRDIE(2)
; . . D UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)")
; . . S:$D(LRDIE(2))=0 LRLOCKOK=1
; . K LRLOCKOK,LRLOOPCT
; . ;
; . D UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)")
; . I $D(LRDIE(2)) D MAILALRT
; . I $D(LRDIE(2)) D MAILALRT(2) ; IHS/MSC/MKK - LR*5.2*1031
;
; If no specimen defined then use specimen values from file #69.
; I $G(LRSPEC)="",$D(^LRO(69,LRODT,1,LRSN,4,0)) D
; I +$G(LRSPEC)<1,$D(^LRO(69,LRODT,1,LRSN,4,0)) D ; IHS/MSC/MKK - LR*5.2*1031
I $D(^LRO(69,LRODT,1,LRSN,4,0)) D
. ; ----- END IHS/MSC/MKK - LR*5.2*1032
. N FDA,FDAIEN,LRI,LRX
. S LRI=0
. F S LRI=$O(^LRO(69,LRODT,1,LRSN,4,LRI)) Q:'LRI D
. . S FDAIEN(1)=LRI,LRX=$G(^LRO(69,LRODT,1,LRSN,4,LRI,0))
. . S FDA(LRI,68.05,"+1,"_LR6802,.01)=$P(LRX,"^")
. . ; S FDA(LRI,68.05,"+1,"_LR6802,1)=$P($G(^LRO(69,LRODT,1,LRSN,0)),"^",3) ; IHS/MSC/MKK - LR*5.2*1031 - Collection Sample
. . ; D IHSCOLS ; IHS/MSC/MKK - LR*5.2*1032
. . D IHSCOLS^BLRUTIL6 ; IHS/MSC/MKK - LR*5.2*1033
. . D UPDATE^DIE("","FDA(LRI)","FDAIEN","LRDIE(LRI)")
. . ; I $D(LRDIE(LRI)) D MAILALRT
. . I $D(LRDIE(LRI)) D MAILALRT("3 ("_LRI_")") ; IHS/MSC/MKK - LR*5.2*1031
;
; Create UID.
S LRUID=$$LRUID^LRX(LRAA,LRAD,LRAN)
;
D STORACCS(LRODT,LRSN,LRUID)
;
; I '$D(LRPHSET),('$G(LRQUIET)) W !!,"ACCESSION: ",LRACC," <",LRUID,">"
;----- BEGIN IHS/MSC/MKK MODIFICATIONS LR*5.2*1031
D ENTRYAUD^BLRUTIL("STWLN^LRWLST1 8.5","LRDIE")
I '$D(LRPHSET),('$G(LRQUIET)) W:'$G(BLRGUI)&('$D(^TMP("LRWLST1",$J,LRACC,LRUID))) !!,"ACCESSION: ",LRACC," <",LRUID,">" S ^TMP("LRWLST1",$J,LRACC,LRUID)="" S:$G(BLRGUI) BPCACC=BPCACC_" "_LRACC
;----- END IHS/MSC/MKK MODIFICATIONS LR*5.2*1031
;
D UPD696
;
L -^LRO(68,LRAA,1,LRAD,1,0)
Q
;
;
UPD696 ; Update file #69.6 if LEDI referral patient and no existing entry
K LR696IEN
I $G(LRORDRR)="R" D
. S LR696IEN=0
. I $G(LRRSITE("SMID"))'="",$G(LRSD("RUID"))'="" S LR696IEN=+$O(^LRO(69.6,"AD",LRRSITE("SMID"),LRSD("RUID"),0))
. I LR696IEN Q
. I '$G(LRRSTAT(0)) S LRRSTAT(0)=$$FIND1^DIC(64.061,"","OMX","Specimen in process","","I $P(^LAB(64.061,Y,0),U,7)=""U""")
. D PSET^LRPEND(SSN(2),+LRRSITE("RSITE"),LRSD("RUID"),+LRSD("RPSITE"),LRSPEC,LRSAMP,LRRSTAT(0),LRODT,$P(LRCDT,U),LRRSITE("SDT"),LRNT,.LROT)
Q
;
;
ST2 ; Find next available node in LR global
;
N FDA,FDAIEN,LRDIE,LRX,LRXIDT
;
; Autopsy ("AU") is not a mulitple - do not attempt to set in ^LR global
I LRSS="AU" S LRIDT=0 Q
;
S LRIDT=0
F D Q:LRIDT
. S LRXIDT=9999999-LRCDT
. L +^LR(LRDFN,LRSS,LRXIDT,0):5
. I '$T S LRCDT=$$FMADD^XLFDT(LRCDT,0,0,0,1) Q
. I '$D(^LR(LRDFN,LRSS,LRXIDT,0)) S LRIDT=LRXIDT Q
. L -^LR(LRDFN,LRSS,LRXIDT,0)
. S LRCDT=$$FMADD^XLFDT(LRCDT,0,0,0,1)
;
; Create entry in appropriate subscript in LAB DATA file (#63).
S LRX=$S(LRSS="CH":63.04,LRSS="MI":63.05,LRSS="BB":63.01,LRSS="SP":63.08,LRSS="CY":63.09,LRSS="EM":63.02,1:0)
S FDAIEN(1)=LRIDT
S FDA(63,LRX,"+1,"_LRDFN_",",.01)=LRCDT
S FDA(63,LRX,"+1,"_LRDFN_",",.06)=LRACC
I LRSS'="CH" S FDA(63,LRX,"+1,"_LRDFN_",",.1)=LRNT
I LRSS="CH" S FDA(63,LRX,"+1,"_LRDFN_",",.12)=3
I LRSS="MI" S FDA(63,LRX,"+1,"_LRDFN_",",38)=3
I LRX D UPDATE^DIE("","FDA(63)","FDAIEN","LRDIE(63)")
; I $D(LRDIE(63)) D MAILALRT
I $D(LRDIE(63)) D MAILALRT(4) ; IHS/MSC/MKK - LR*5.2*1031
;
; Uncomment following code when new field .9 in"MI" subscript is released
;I LRSS="MI" D
;. N LRN,ERR,IENS
;. S IENS=LRIDT_","_LRDFN_",",LRN=0
;. F S LRN=$O(^LRO(69,LRODT,1,LRSN,2,LRN)) Q:LRN<1 D
;. . I '$D(^LRO(69,LRODT,1,LRSN,2,LRN,1,0)) Q
;. . D WP^DIE(63.05,IENS,.9,"A","^LRO(69,"_LRODT_",1,"_LRSN_",2,"_LRN_",1)","ERR")
;
L -^LR(LRDFN,LRSS,LRIDT,0)
;
Q
;
;
GTWLN ;
N X
;
; Execute accession transform for this area.
S LRAN=0
S X=$G(^LRO(68,LRWLC,.1)) X:X'="" X
;
D GETLOCK(LRWLC,LRAD)
D CHECK68(LRWLC,LRAD)
;
S:'LRAN LRAN=1+$P($G(^LRO(68,LRWLC,1,LRAD,1,0)),U,3)
;
I "CYEMSP"'[LRSS F Q:'$D(^LRO(68,LRWLC,1,LRAD,1,LRAN)) S LRAN=LRAN+1
;
; check for AP Accessions
I "CYEMSP"[LRSS F Q:'$D(^LRO(68,LRWLC,1,LRAD,1,LRAN))&'$D(^LR("A"_LRSS_"A",$E(LRAD,1,3),LRAN)) S LRAN=LRAN+1
;
I '$D(LRPHSET),$D(LRNCWL)!$P(^LAB(69.9,1,0),U,8) D ASK Q:LREND
;
D SETAN(LRWLC,LRAD,LRAN)
;
L -^LRO(68,LRWLC,1,LRAD,1,0)
Q
;
;
ASK ;
; Don't ask if tasked or a "silent" call
I $D(ZTQUEUED)!($G(LRQUIET)) Q
;
N DIR,DIROUT,DIRUT,DTOUT,DUOUT,LROK,LRANX,X,Y
S LROK=0
F D Q:LREND!(LROK)
. K DIR
. S DIR(0)="NO^1:"_$S($P(LRLABKY,U,2):999999,1:LRAN)_":0"
. S DIR("A")="Force to",DIR("B")=LRAN
. D ^DIR
. I $D(DIRUT) S LREND=1 Q
. S LRANX=Y
. I LRANX<+$P($G(^LRO(68,LRWLC,1,LRAD,1,0)),U,3) D
. . W !,"This accession number may be already assigned either in this "
. . W !,"area or a common accession area."
. I $D(^LRO(68,LRWLC,1,LRAD,1,LRANX,0)) D Q:'LROK
. . N LRDFNX S LRDFNX=LRDFN
. . N DFN,LRDFN,LRDPF,PNM,SSN
. . NEW HRCN
. . S LRDFN=+^LRO(68,LRWLC,1,LRAD,1,LRANX,0),LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^LR(LRDFN,0),U,3)
. . D PT^LRX
. . ; W !,"THIS NUMBER BELONGS TO ",!,PNM," SSN: ",SSN
. . W !,"THIS NUMBER BELONGS TO ",!,PNM," HRCN: ",HRCN ; IHS/MSC/MKK - LR*5.2*1031
. . D INF^LRX
. . I LRDFN=LRDFNX S LROK=1
. K DIR
. S DIR(0)="YO",DIR("A")="Are you sure",DIR("B")="NO"
. D ^DIR
. I $D(DIRUT) S LREND=1 Q
. I Y=1 S LRAN=LRANX,LROK=1
;
; Unlock if aborting.
I LREND L -^LRO(68,LRWLC,1,LRAD,1,0)
;
Q
;
;
CHECK68(LRAA,LRAD) ; Check for/set header node of ^LRO(68) 68.01 subfile.
;
; Call with LRAA = ien of entry in file #68
; LRAD = accession date in fileman format
;
; Set accession date in file #68 for this acession.
; Check for existence of accession number multiple but not accession date multiple,
; FileMan DBS call fails when accession number multiple exists but accession date multiple does not.
; If this condition found then set missing node directly and quit.
;
I '$D(^LRO(68,LRAA,1,LRAD,0)) D
. N FDA,FDAIEN,LRDIE,X
. S X=$Q(^LRO(68,LRAA,1,LRAD,0))
. I X'="",$QS(X,4)=LRAD S $P(^LRO(68,LRAA,1,LRAD,0),"^")=LRAD Q
. S (FDAIEN(1),FDA(1,68.01,"+1,"_LRAA_",",.01))=LRAD
. D UPDATE^DIE("","FDA(1)","FDAIEN","LRDIE(1)")
. ; I $D(LRDIE(1)) D MAILALRT
. I $D(LRDIE(1)) D MAILALRT(5) ; IHS/MSC/MKK - LR*5.2*1031
;
Q
;
;
GETLOCK(LRAA,LRAD) ; Obtain lock on zeroth node of this accession date
; Call with LRAA = ien of entry in file #68
; LRAD = accession date in fileman format
;
F L +^LRO(68,LRAA,1,LRAD,1,0):10 Q:$T D
. I $D(ZTQUEUED)!($G(LRQUIET)) Q
. W !!?5,"Accession area ",$P(^LRO(68,LRAA,0),"^")," is locked by another user.",!,$C(7)
Q
;
;
SETAN(LRAA,LRAD,LRAN) ; Create stub entry in file #68 for this acession.
;
; Call with LRAA = ien of entry in file #68
; LRAD = accession date in fileman format
; LRAN = accession number
;
N FDA,FDAIEN,LR6802,LRDIE
;
S LR6802=LRAD_","_LRAA_","
S FDAIEN(1)=LRAN
S FDA(2,68.02,"+1,"_LR6802,.01)=LRDFN
;
; Modification to prevent lock failures - loop 10 times to give system a chance to get lock
N LRLOCKOK,LRLOOPCT
S LRLOCKOK=0
F LRLOOPCT=1:1:10 Q:LRLOCKOK D I 'LRLOCKOK H 5
. K LRDIE(2)
. D UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)")
. S:$D(LRDIE(2))=0 LRLOCKOK=1
K LRLOCKOK,LRLOOPCT
;
;D UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)")
; I $D(LRDIE(2)) D MAILALRT
I $D(LRDIE(2)) D MAILALRT(6) ; IHS/MSC/MKK - LR*5.2*1031
Q
;
;
; MAILALRT ; Send mail message alert when FileMan DBS errors returned
MAILALRT(MSGN) ; Send mail message alert when FileMan DBS errors returned - IHS/MSC/MKK - LR*5.2*1031
; ----- BEGIN IHS/MSC/MKK - LR*5.2*1031
; Known VA Bug. Ignore for now. See LR*5.2*331.
Q:$$UP^XLFSTR($G(LRDIE(MSGN,"DIERR",1,"TEXT",1)))["ALREADY EXISTS"
; ----- END IHS/MSC/MKK - LR*5.2*1031
;
;
N J,LR68,LRCNT,LRMTXT,X,XMINSTR,XMSUB,XMTO
;
I $D(^LRO(68,LRAA,1,LRAD,1,LRAN)) M LR68=^LRO(68,LRAA,1,LRAD,1,LRAN)
;
S LRMTXT(1)="The following debugging information is provided to assist"
S LRMTXT(2)="support staff in resolving error during accessioning."
; S LRMTXT(3)=" "
; S LRCNT=3
;
; ----- BEGIN IHS/OIT/MKK - LR*5.2*1030 -- Better identification of where error occurred
S:+$G(MSGN)<7 LRMTXT(3)=" LRWLST1 Message #:"_$G(MSGN)
S:+$G(MSGN)=7 LRMTXT(3)=" LRWLST11 Message #:"_$G(MSGN)
S LRMTXT(4)=" "
S LRCNT=4
; ----- END IHS/OIT/MKK - LR*5.2*1030
;
; ----- BEGIN IHS/MSC/MKK - LR*5.2*1031
S LRCNT=LRCNT+1,LRMTXT(LRCNT)=" DUZ="_$G(DUZ)
S LRCNT=LRCNT+1,LRMTXT(LRCNT)=" DUZ(2)="_$G(DUZ(2))
S LRCNT=LRCNT+1,LRMTXT(LRCNT)=" "
; ----- END IHS/MSC/MKK - LR*5.2*1031
;
F J="FDA","FDAIEN","LR68","LRAA","LRAD","LRAN","LRDFN","LRDIE","LRSS","LRTSTS","LRUNQ","LRWLC","XQY","XQY0" D
. S X=$G(@J)
. I X'="" S LRCNT=LRCNT+1,LRMTXT(LRCNT)=J_"="_X
. F S J=$Q(@J) Q:J="" S LRCNT=LRCNT+1,LRMTXT(LRCNT)=J_"="_@J
;
; S XMSUB="FileMan DBS call failed during accessioning in routine LRWLST1"
S XMSUB="FileMan DBS call failed during accessioning in routine "_$S(+$G(MSGN)<7:"LRWLST1",1:"LRWLST11") ; IHS/MSC/MKK - LR*5.2*1031
S XMTO("G.LMI")=""
S XMINSTR("FROM")=.5
S XMINSTR("ADDR FLAGS")="R"
D SENDMSG^XMXAPI(DUZ,XMSUB,"LRMTXT",.XMTO,.XMINSTR)
Q
;
; ----- BEGIN IHS/MSC/MKK - LR*5.2*1034
STORACCS(LRODT,LRSN,LRUID) ; EP
NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,LRODT,LRSN,LRUID,U,XPARSYS,XQXFLG)
;
S ORDLOC=+$$GET1^DIQ(69.01,LRSN_","_LRODT,23,"I") ; Ordering Location
S ORDLINST=+$$GET1^DIQ(44,ORDLOC,3,"I") ; Ordering Location's Institution
Q:+$$GET1^DIQ(9009029,ORDLINST,3001,"I")<1 ; Quit if no Reference Lab setup
;
S ORDERN=$$GET1^DIQ(69.01,LRSN_","_LRODT,9.5,"I")
Q:ORDERN<1 ; Quit if no Order #
;
Q:$L(LRUID)<1 ; Quit if no UID
;
D REFLAB68^BLRLINKU ; Make sure ^XTMP("BLRLINKU") is current. See documentation at REFLAB68^BLRLINKU.
S X=$Q(^LRO(68,"C",LRUID,0)),LRAA=+$QS(X,4) ; Get Accession Area IEN
;
Q:$D(^XTMP("BLRLINKU",ORDLINST,LRAA))<1 ; Quit if Accession Area not Reference Lab
;
S LRDFN=$$GET1^DIQ(69.01,LRSN_","_LRODT,.01,"I")
S DFN=$$GET1^DIQ(63,LRDFN,.03,"I")
;
; S X=$$ORD^BLRRLEDI(ORDERN,DFN) ; Store Order # if not in there already
S ORDIEN=$$FIND1^DIC(9009026.3,,,ORDERN)
;
Q:ORDIEN<1 ; Quit if Order # NOT in 9009026.3
;
S LRASIEN=1+$O(^BLRRLO(ORDIEN,3,"A"),-1)
;
K ERRS,FDA
S FDA(9009026.33,"?+1,"_ORDIEN_",",.01)=LRUID
D UPDATE^DIE(,"FDA",,"ERRS")
;
Q
; ----- END IHS/MSC/MKK - LR*5.2*1034
LRWLST1 ;DALOI/CJS/RWF/FHS - ACCESSION SETUP ; 21-Jul-2015 06:30 ; MKK
+1 ;;5.2;LAB SERVICE;**48,65,1010,121,128,1013,153,202,261,1018,286,1027,1030,331,379,331,379,1031,1032,415,1033,1034,1035**;NOV 1, 1997;Build 5
+2 ;
+3 ; Reference to ^DIC(42 supported by IA #10039
+4 ; Reference to ^SC( supported by IA #10040
+5 ;
EP ; EP
+1 SET LRWLC=0
+2 FOR
SET LRWLC=$ORDER(LRTSTS(LRWLC))
IF LRWLC<1
QUIT
SET LRAD=DT
DO SPLIT
+3 ;
+4 ; If LEDI and comments came with order then copy to order in #69
+5 IF $GET(LRORDRR)="R"
IF $GET(LR696)
IF $DATA(^LRO(69.6,LR696,99))
Begin DoDot:1
+6 NEW LRDIE
+7 DO WP^DIE(69.01,LRSN_","_LRODT_",",16,"A","^LRO(69.6,LR696,99)","LRDIE(16)")
End DoDot:1
+8 ;
+9 KILL DIC,DLAYGO,DR,DA,DIE,LRIXX
+10 IF $GET(LRORDR)="P"
QUIT
+11 KILL LRNM,LRTSTS
+12 KILL ^TMP("LR",$JOB,"TMP")
+13 KILL ^TMP("LRWLST1",$JOB)
+14 QUIT
+15 ;
SPLIT ;
+1 NEW LRAA,LRX
+2 ; Setup regular accessions (LRUNQ=0)
+3 SET LRUNQ=0
SET LREND=0
+4 IF $DATA(LRTSTS(LRWLC,0))
Begin DoDot:1
+5 DO GTWLN
+6 IF LREND
QUIT
+7 SET LRAA=0
+8 FOR
SET LRAA=$ORDER(LRTSTS(LRWLC,0,LRAA))
IF LRAA<1
QUIT
Begin DoDot:2
+9 SET LRSS=LRTSTS(LRWLC,0,LRAA)
+10 ; D STWLN,ST2,^LRWLST11,EN^LA7ADL(LRUID)
+11 ; IHS/MSC/MKK - LR*5.2*1031
DO STWLN
DO ST2
DO ^LRWLST11
DO IHSLOG
DO EN^LA7ADL(LRUID)
End DoDot:2
+12 DO SICA^LRWLST11
End DoDot:1
+13 ;
+14 ; Setup accessions requiring 'unique' accession numbers (LRUNQ=1)
+15 SET LRUNQ=1
SET LRAA=0
+16 FOR
SET LRAA=$ORDER(LRTSTS(LRWLC,1,LRAA))
IF LRAA<1
QUIT
Begin DoDot:1
+17 SET LRSS=LRTSTS(LRWLC,1,LRAA)
+18 FOR
DO GTWLN
IF LREND
QUIT
Begin DoDot:2
+19 ; D STWLN,ST2,^LRWLST11,EN^LA7ADL(LRUID),SICA^LRWLST11
+20 ; IHS/MSC/MKK - LR*5.2*1031
DO STWLN
DO ST2
DO ^LRWLST11
DO IHSLOG
DO EN^LA7ADL(LRUID)
DO SICA^LRWLST11
End DoDot:2
IF $ORDER(LRTSTS(LRWLC,1,LRAA,0))<1
QUIT
End DoDot:1
+21 ;
+22 QUIT
+23 ;
+24 ; ---- BEGIN IHS/OIT/MKK -- LR*5.2*1027
IHSLOG ; EP -- Create entry for PCC transfer
+1 ; Q:'BLRLOG
+2 ; IHS/MSC/MKK - LR*5.2*1031
IF '+$GET(BLRLOG)
QUIT
+3 ;
+4 ;IHS/OIRM TUC/AAB 12/12/96
DO ^BLREVTQ("C","A",$GET(BLROPT),,LRODT_","_LRSN_","_LRAA_","_LRAD_","_LRAN_","_LRACC)
+5 QUIT
+6 ; ---- END IHS/OIT/MKK -- LR*5.2*1027
+7 ;
+8 ;
STWLN ; Set accession number
+1 DO GETLOCK(LRAA,LRAD)
+2 DO CHECK68(LRAA,LRAD)
+3 ;
+4 SET LRDPF=$PIECE(^LR(LRDFN,0),U,2)
SET DFN=$PIECE(^(0),U,3)
+5 ;
+6 ; Handle 'in common' area that was not setup in GTWLN call.
+7 IF '$DATA(^LRO(68,LRAA,1,LRAD,1,LRAN))
DO SETAN(LRAA,LRAD,LRAN)
+8 ;
+9 SET LREND=0
SET LRLBLBP=1-$PIECE(LRSS,U,2)
SET LRSS=$PIECE(LRSS,U)
+10 SET LRACC=$PIECE(^LRO(68,LRAA,0),U,11)_" "_$SELECT(LRAD["0000":$EXTRACT(LRAD,2,3),1:$EXTRACT(LRAD,4,7))_" "_LRAN
+11 ;
+12 SET LRPRAC=""
+13 IF $DATA(^LRO(69,LRODT,1,LRSN,0))
SET LRPRAC=$PIECE(^(0),U,6)
IF $DATA(LRNT)
SET ^(3)=LRNT
+14 ;
+15 ; Location type
+16 SET LRCAPLOC=$PIECE($GET(^SC(+LROLLOC,0)),U,3)
+17 IF LRCAPLOC=""
SET LRCAPLOC="Z"
+18 ;
+19 ; File information in file #68 for this accession
+20 NEW FDA,LR6802,LRDIE
+21 SET LR6802=LRAN_","_LRAD_","_LRAA_","
+22 SET FDA(1,68.02,LR6802,.01)=LRDFN
+23 SET FDA(1,68.02,LR6802,1)=LRDPF
+24 SET FDA(1,68.02,LR6802,2)=LRAD
+25 SET FDA(1,68.02,LR6802,3)=LRODT
+26 SET FDA(1,68.02,LR6802,4)=LRSN
+27 SET FDA(1,68.02,LR6802,6)=LRLLOC
+28 SET X=$GET(^LRO(69,LRODT,1,LRSN,.1))
IF X'=""
SET FDA(1,68.02,LR6802,14)=X
+29 ;
+30 ; No ordering provider/location on controls
+31 IF LRDPF'=62.3
Begin DoDot:1
+32 SET FDA(1,68.02,LR6802,6.5)=LRPRAC
+33 SET FDA(1,68.02,LR6802,94)=LROLLOC
End DoDot:1
+34 ;
+35 ; Only store treating specialty on file #2 patients
+36 ; If no treating specialty then use specialty from file #44 location
+37 IF LRDPF=2
Begin DoDot:1
+38 SET LRTREA=$PIECE($GET(^DPT(DFN,.103)),U)
+39 IF 'LRTREA
SET LRTREA=$PIECE($GET(^SC(+LROLLOC,0)),U,20)
+40 IF LRTREA
SET FDA(1,68.02,LR6802,6.6)=LRTREA
End DoDot:1
+41 ;
+42 SET FDA(1,68.02,LR6802,6.7)=DUZ
+43 SET FDA(1,68.02,LR6802,15)=LRACC
+44 SET FDA(1,68.02,LR6802,26)=DUZ(2)
+45 SET FDA(1,68.02,LR6802,92)=LRCAPLOC
+46 ;
+47 DO FILE^DIE("","FDA(1)","LRDIE(1)")
+48 ; I $D(LRDIE(1)) D MAILALRT
+49 ; IHS/MSC/MKK - LR*5.2*1031
IF $DATA(LRDIE(1))
DO MAILALRT(1)
+50 ;
+51 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1032
+52 ; ONLY use data from the 69 for the Specimen & data from 60 for the Collection sample
+53 ;
+54 ; If specimen defined then set nodes, force to ien=1 since many lab
+55 ; routines expect the specimen to be record number 1.
+56 ; I $G(LRSPEC) D
+57 ; I +$G(LRSPEC) D ; IHS/MSC/MKK - LR*5.2*1031
+58 ; . N FDAIEN
+59 ; . S FDAIEN(1)=1
+60 ; . S FDA(2,68.05,"+1,"_LR6802,.01)=LRSPEC
+61 ; . S FDA(2,68.05,"+1,"_LR6802,1)=$P(LRSAMP,";",1)
+62 ; . ;
+63 ; . ; Modification to prevent lock failures - loop 10 times to give system a chance to get lock
+64 ; . N LRLOCKOK,LRLOOPCT
+65 ; . S LRLOCKOK=0
+66 ; . F LRLOOPCT=1:1:10 Q:LRLOCKOK D I 'LRLOCKOK H 5
+67 ; . . K LRDIE(2)
+68 ; . . D UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)")
+69 ; . . S:$D(LRDIE(2))=0 LRLOCKOK=1
+70 ; . K LRLOCKOK,LRLOOPCT
+71 ; . ;
+72 ; . D UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)")
+73 ; . I $D(LRDIE(2)) D MAILALRT
+74 ; . I $D(LRDIE(2)) D MAILALRT(2) ; IHS/MSC/MKK - LR*5.2*1031
+75 ;
+76 ; If no specimen defined then use specimen values from file #69.
+77 ; I $G(LRSPEC)="",$D(^LRO(69,LRODT,1,LRSN,4,0)) D
+78 ; I +$G(LRSPEC)<1,$D(^LRO(69,LRODT,1,LRSN,4,0)) D ; IHS/MSC/MKK - LR*5.2*1031
+79 IF $DATA(^LRO(69,LRODT,1,LRSN,4,0))
Begin DoDot:1
+80 ; ----- END IHS/MSC/MKK - LR*5.2*1032
+81 NEW FDA,FDAIEN,LRI,LRX
+82 SET LRI=0
+83 FOR
SET LRI=$ORDER(^LRO(69,LRODT,1,LRSN,4,LRI))
IF 'LRI
QUIT
Begin DoDot:2
+84 SET FDAIEN(1)=LRI
SET LRX=$GET(^LRO(69,LRODT,1,LRSN,4,LRI,0))
+85 SET FDA(LRI,68.05,"+1,"_LR6802,.01)=$PIECE(LRX,"^")
+86 ; S FDA(LRI,68.05,"+1,"_LR6802,1)=$P($G(^LRO(69,LRODT,1,LRSN,0)),"^",3) ; IHS/MSC/MKK - LR*5.2*1031 - Collection Sample
+87 ; D IHSCOLS ; IHS/MSC/MKK - LR*5.2*1032
+88 ; IHS/MSC/MKK - LR*5.2*1033
DO IHSCOLS^BLRUTIL6
+89 DO UPDATE^DIE("","FDA(LRI)","FDAIEN","LRDIE(LRI)")
+90 ; I $D(LRDIE(LRI)) D MAILALRT
+91 ; IHS/MSC/MKK - LR*5.2*1031
IF $DATA(LRDIE(LRI))
DO MAILALRT("3 ("_LRI_")")
End DoDot:2
End DoDot:1
+92 ;
+93 ; Create UID.
+94 SET LRUID=$$LRUID^LRX(LRAA,LRAD,LRAN)
+95 ;
+96 DO STORACCS(LRODT,LRSN,LRUID)
+97 ;
+98 ; I '$D(LRPHSET),('$G(LRQUIET)) W !!,"ACCESSION: ",LRACC," <",LRUID,">"
+99 ;----- BEGIN IHS/MSC/MKK MODIFICATIONS LR*5.2*1031
+100 DO ENTRYAUD^BLRUTIL("STWLN^LRWLST1 8.5","LRDIE")
+101 IF '$DATA(LRPHSET)
IF ('$GET(LRQUIET))
IF '$GET(BLRGUI)&('$DATA(^TMP("LRWLST1",$JOB,LRACC,LRUID)))
WRITE !!,"ACCESSION: ",LRACC," <",LRUID,">"
SET ^TMP("LRWLST1",$JOB,LRACC,LRUID)=""
IF $GET(BLRGUI)
SET BPCACC=BPCACC_" "_LRACC
+102 ;----- END IHS/MSC/MKK MODIFICATIONS LR*5.2*1031
+103 ;
+104 DO UPD696
+105 ;
+106 LOCK -^LRO(68,LRAA,1,LRAD,1,0)
+107 QUIT
+108 ;
+109 ;
UPD696 ; Update file #69.6 if LEDI referral patient and no existing entry
+1 KILL LR696IEN
+2 IF $GET(LRORDRR)="R"
Begin DoDot:1
+3 SET LR696IEN=0
+4 IF $GET(LRRSITE("SMID"))'=""
IF $GET(LRSD("RUID"))'=""
SET LR696IEN=+$ORDER(^LRO(69.6,"AD",LRRSITE("SMID"),LRSD("RUID"),0))
+5 IF LR696IEN
QUIT
+6 IF '$GET(LRRSTAT(0))
SET LRRSTAT(0)=$$FIND1^DIC(64.061,"","OMX","Specimen in process","","I $P(^LAB(64.061,Y,0),U,7)=""U""")
+7 DO PSET^LRPEND(SSN(2),+LRRSITE("RSITE"),LRSD("RUID"),+LRSD("RPSITE"),LRSPEC,LRSAMP,LRRSTAT(0),LRODT,$PIECE(LRCDT,U),LRRSITE("SDT"),LRNT,.LROT)
End DoDot:1
+8 QUIT
+9 ;
+10 ;
ST2 ; Find next available node in LR global
+1 ;
+2 NEW FDA,FDAIEN,LRDIE,LRX,LRXIDT
+3 ;
+4 ; Autopsy ("AU") is not a mulitple - do not attempt to set in ^LR global
+5 IF LRSS="AU"
SET LRIDT=0
QUIT
+6 ;
+7 SET LRIDT=0
+8 FOR
Begin DoDot:1
+9 SET LRXIDT=9999999-LRCDT
+10 LOCK +^LR(LRDFN,LRSS,LRXIDT,0):5
+11 IF '$TEST
SET LRCDT=$$FMADD^XLFDT(LRCDT,0,0,0,1)
QUIT
+12 IF '$DATA(^LR(LRDFN,LRSS,LRXIDT,0))
SET LRIDT=LRXIDT
QUIT
+13 LOCK -^LR(LRDFN,LRSS,LRXIDT,0)
+14 SET LRCDT=$$FMADD^XLFDT(LRCDT,0,0,0,1)
End DoDot:1
IF LRIDT
QUIT
+15 ;
+16 ; Create entry in appropriate subscript in LAB DATA file (#63).
+17 SET LRX=$SELECT(LRSS="CH":63.04,LRSS="MI":63.05,LRSS="BB":63.01,LRSS="SP":63.08,LRSS="CY":63.09,LRSS="EM":63.02,1:0)
+18 SET FDAIEN(1)=LRIDT
+19 SET FDA(63,LRX,"+1,"_LRDFN_",",.01)=LRCDT
+20 SET FDA(63,LRX,"+1,"_LRDFN_",",.06)=LRACC
+21 IF LRSS'="CH"
SET FDA(63,LRX,"+1,"_LRDFN_",",.1)=LRNT
+22 IF LRSS="CH"
SET FDA(63,LRX,"+1,"_LRDFN_",",.12)=3
+23 IF LRSS="MI"
SET FDA(63,LRX,"+1,"_LRDFN_",",38)=3
+24 IF LRX
DO UPDATE^DIE("","FDA(63)","FDAIEN","LRDIE(63)")
+25 ; I $D(LRDIE(63)) D MAILALRT
+26 ; IHS/MSC/MKK - LR*5.2*1031
IF $DATA(LRDIE(63))
DO MAILALRT(4)
+27 ;
+28 ; Uncomment following code when new field .9 in"MI" subscript is released
+29 ;I LRSS="MI" D
+30 ;. N LRN,ERR,IENS
+31 ;. S IENS=LRIDT_","_LRDFN_",",LRN=0
+32 ;. F S LRN=$O(^LRO(69,LRODT,1,LRSN,2,LRN)) Q:LRN<1 D
+33 ;. . I '$D(^LRO(69,LRODT,1,LRSN,2,LRN,1,0)) Q
+34 ;. . D WP^DIE(63.05,IENS,.9,"A","^LRO(69,"_LRODT_",1,"_LRSN_",2,"_LRN_",1)","ERR")
+35 ;
+36 LOCK -^LR(LRDFN,LRSS,LRIDT,0)
+37 ;
+38 QUIT
+39 ;
+40 ;
GTWLN ;
+1 NEW X
+2 ;
+3 ; Execute accession transform for this area.
+4 SET LRAN=0
+5 SET X=$GET(^LRO(68,LRWLC,.1))
IF X'=""
XECUTE X
+6 ;
+7 DO GETLOCK(LRWLC,LRAD)
+8 DO CHECK68(LRWLC,LRAD)
+9 ;
+10 IF 'LRAN
SET LRAN=1+$PIECE($GET(^LRO(68,LRWLC,1,LRAD,1,0)),U,3)
+11 ;
+12 IF "CYEMSP"'[LRSS
FOR
IF '$DATA(^LRO(68,LRWLC,1,LRAD,1,LRAN))
QUIT
SET LRAN=LRAN+1
+13 ;
+14 ; check for AP Accessions
+15 IF "CYEMSP"[LRSS
FOR
IF '$DATA(^LRO(68,LRWLC,1,LRAD,1,LRAN))&'$DATA(^LR("A"_LRSS_"A",$EXTRACT(LRAD,1,3),LRAN))
QUIT
SET LRAN=LRAN+1
+16 ;
+17 IF '$DATA(LRPHSET)
IF $DATA(LRNCWL)!$PIECE(^LAB(69.9,1,0),U,8)
DO ASK
IF LREND
QUIT
+18 ;
+19 DO SETAN(LRWLC,LRAD,LRAN)
+20 ;
+21 LOCK -^LRO(68,LRWLC,1,LRAD,1,0)
+22 QUIT
+23 ;
+24 ;
ASK ;
+1 ; Don't ask if tasked or a "silent" call
+2 IF $DATA(ZTQUEUED)!($GET(LRQUIET))
QUIT
+3 ;
+4 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,LROK,LRANX,X,Y
+5 SET LROK=0
+6 FOR
Begin DoDot:1
+7 KILL DIR
+8 SET DIR(0)="NO^1:"_$SELECT($PIECE(LRLABKY,U,2):999999,1:LRAN)_":0"
+9 SET DIR("A")="Force to"
SET DIR("B")=LRAN
+10 DO ^DIR
+11 IF $DATA(DIRUT)
SET LREND=1
QUIT
+12 SET LRANX=Y
+13 IF LRANX<+$PIECE($GET(^LRO(68,LRWLC,1,LRAD,1,0)),U,3)
Begin DoDot:2
+14 WRITE !,"This accession number may be already assigned either in this "
+15 WRITE !,"area or a common accession area."
End DoDot:2
+16 IF $DATA(^LRO(68,LRWLC,1,LRAD,1,LRANX,0))
Begin DoDot:2
+17 NEW LRDFNX
SET LRDFNX=LRDFN
+18 NEW DFN,LRDFN,LRDPF,PNM,SSN
+19 NEW HRCN
+20 SET LRDFN=+^LRO(68,LRWLC,1,LRAD,1,LRANX,0)
SET LRDPF=$PIECE(^LR(LRDFN,0),U,2)
SET DFN=$PIECE(^LR(LRDFN,0),U,3)
+21 DO PT^LRX
+22 ; W !,"THIS NUMBER BELONGS TO ",!,PNM," SSN: ",SSN
+23 ; IHS/MSC/MKK - LR*5.2*1031
WRITE !,"THIS NUMBER BELONGS TO ",!,PNM," HRCN: ",HRCN
+24 DO INF^LRX
+25 IF LRDFN=LRDFNX
SET LROK=1
End DoDot:2
IF 'LROK
QUIT
+26 KILL DIR
+27 SET DIR(0)="YO"
SET DIR("A")="Are you sure"
SET DIR("B")="NO"
+28 DO ^DIR
+29 IF $DATA(DIRUT)
SET LREND=1
QUIT
+30 IF Y=1
SET LRAN=LRANX
SET LROK=1
End DoDot:1
IF LREND!(LROK)
QUIT
+31 ;
+32 ; Unlock if aborting.
+33 IF LREND
LOCK -^LRO(68,LRWLC,1,LRAD,1,0)
+34 ;
+35 QUIT
+36 ;
+37 ;
CHECK68(LRAA,LRAD) ; Check for/set header node of ^LRO(68) 68.01 subfile.
+1 ;
+2 ; Call with LRAA = ien of entry in file #68
+3 ; LRAD = accession date in fileman format
+4 ;
+5 ; Set accession date in file #68 for this acession.
+6 ; Check for existence of accession number multiple but not accession date multiple,
+7 ; FileMan DBS call fails when accession number multiple exists but accession date multiple does not.
+8 ; If this condition found then set missing node directly and quit.
+9 ;
+10 IF '$DATA(^LRO(68,LRAA,1,LRAD,0))
Begin DoDot:1
+11 NEW FDA,FDAIEN,LRDIE,X
+12 SET X=$QUERY(^LRO(68,LRAA,1,LRAD,0))
+13 IF X'=""
IF $QSUBSCRIPT(X,4)=LRAD
SET $PIECE(^LRO(68,LRAA,1,LRAD,0),"^")=LRAD
QUIT
+14 SET (FDAIEN(1),FDA(1,68.01,"+1,"_LRAA_",",.01))=LRAD
+15 DO UPDATE^DIE("","FDA(1)","FDAIEN","LRDIE(1)")
+16 ; I $D(LRDIE(1)) D MAILALRT
+17 ; IHS/MSC/MKK - LR*5.2*1031
IF $DATA(LRDIE(1))
DO MAILALRT(5)
End DoDot:1
+18 ;
+19 QUIT
+20 ;
+21 ;
GETLOCK(LRAA,LRAD) ; Obtain lock on zeroth node of this accession date
+1 ; Call with LRAA = ien of entry in file #68
+2 ; LRAD = accession date in fileman format
+3 ;
+4 FOR
LOCK +^LRO(68,LRAA,1,LRAD,1,0):10
IF $TEST
QUIT
Begin DoDot:1
+5 IF $DATA(ZTQUEUED)!($GET(LRQUIET))
QUIT
+6 WRITE !!?5,"Accession area ",$PIECE(^LRO(68,LRAA,0),"^")," is locked by another user.",!,$CHAR(7)
End DoDot:1
+7 QUIT
+8 ;
+9 ;
SETAN(LRAA,LRAD,LRAN) ; Create stub entry in file #68 for this acession.
+1 ;
+2 ; Call with LRAA = ien of entry in file #68
+3 ; LRAD = accession date in fileman format
+4 ; LRAN = accession number
+5 ;
+6 NEW FDA,FDAIEN,LR6802,LRDIE
+7 ;
+8 SET LR6802=LRAD_","_LRAA_","
+9 SET FDAIEN(1)=LRAN
+10 SET FDA(2,68.02,"+1,"_LR6802,.01)=LRDFN
+11 ;
+12 ; Modification to prevent lock failures - loop 10 times to give system a chance to get lock
+13 NEW LRLOCKOK,LRLOOPCT
+14 SET LRLOCKOK=0
+15 FOR LRLOOPCT=1:1:10
IF LRLOCKOK
QUIT
Begin DoDot:1
+16 KILL LRDIE(2)
+17 DO UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)")
+18 IF $DATA(LRDIE(2))=0
SET LRLOCKOK=1
End DoDot:1
IF 'LRLOCKOK
HANG 5
+19 KILL LRLOCKOK,LRLOOPCT
+20 ;
+21 ;D UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)")
+22 ; I $D(LRDIE(2)) D MAILALRT
+23 ; IHS/MSC/MKK - LR*5.2*1031
IF $DATA(LRDIE(2))
DO MAILALRT(6)
+24 QUIT
+25 ;
+26 ;
+27 ; MAILALRT ; Send mail message alert when FileMan DBS errors returned
MAILALRT(MSGN) ; Send mail message alert when FileMan DBS errors returned - IHS/MSC/MKK - LR*5.2*1031
+1 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1031
+2 ; Known VA Bug. Ignore for now. See LR*5.2*331.
+3 IF $$UP^XLFSTR($GET(LRDIE(MSGN,"DIERR",1,"TEXT",1)))["ALREADY EXISTS"
QUIT
+4 ; ----- END IHS/MSC/MKK - LR*5.2*1031
+5 ;
+6 ;
+7 NEW J,LR68,LRCNT,LRMTXT,X,XMINSTR,XMSUB,XMTO
+8 ;
+9 IF $DATA(^LRO(68,LRAA,1,LRAD,1,LRAN))
MERGE LR68=^LRO(68,LRAA,1,LRAD,1,LRAN)
+10 ;
+11 SET LRMTXT(1)="The following debugging information is provided to assist"
+12 SET LRMTXT(2)="support staff in resolving error during accessioning."
+13 ; S LRMTXT(3)=" "
+14 ; S LRCNT=3
+15 ;
+16 ; ----- BEGIN IHS/OIT/MKK - LR*5.2*1030 -- Better identification of where error occurred
+17 IF +$GET(MSGN)<7
SET LRMTXT(3)=" LRWLST1 Message #:"_$GET(MSGN)
+18 IF +$GET(MSGN)=7
SET LRMTXT(3)=" LRWLST11 Message #:"_$GET(MSGN)
+19 SET LRMTXT(4)=" "
+20 SET LRCNT=4
+21 ; ----- END IHS/OIT/MKK - LR*5.2*1030
+22 ;
+23 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1031
+24 SET LRCNT=LRCNT+1
SET LRMTXT(LRCNT)=" DUZ="_$GET(DUZ)
+25 SET LRCNT=LRCNT+1
SET LRMTXT(LRCNT)=" DUZ(2)="_$GET(DUZ(2))
+26 SET LRCNT=LRCNT+1
SET LRMTXT(LRCNT)=" "
+27 ; ----- END IHS/MSC/MKK - LR*5.2*1031
+28 ;
+29 FOR J="FDA","FDAIEN","LR68","LRAA","LRAD","LRAN","LRDFN","LRDIE","LRSS","LRTSTS","LRUNQ","LRWLC","XQY","XQY0"
Begin DoDot:1
+30 SET X=$GET(@J)
+31 IF X'=""
SET LRCNT=LRCNT+1
SET LRMTXT(LRCNT)=J_"="_X
+32 FOR
SET J=$QUERY(@J)
IF J=""
QUIT
SET LRCNT=LRCNT+1
SET LRMTXT(LRCNT)=J_"="_@J
End DoDot:1
+33 ;
+34 ; S XMSUB="FileMan DBS call failed during accessioning in routine LRWLST1"
+35 ; IHS/MSC/MKK - LR*5.2*1031
SET XMSUB="FileMan DBS call failed during accessioning in routine "_$SELECT(+$GET(MSGN)<7:"LRWLST1",1:"LRWLST11")
+36 SET XMTO("G.LMI")=""
+37 SET XMINSTR("FROM")=.5
+38 SET XMINSTR("ADDR FLAGS")="R"
+39 DO SENDMSG^XMXAPI(DUZ,XMSUB,"LRMTXT",.XMTO,.XMINSTR)
+40 QUIT
+41 ;
+42 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1034
STORACCS(LRODT,LRSN,LRUID) ; EP
+1 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,LRODT,LRSN,LRUID,U,XPARSYS,XQXFLG)
+2 ;
+3 ; Ordering Location
SET ORDLOC=+$$GET1^DIQ(69.01,LRSN_","_LRODT,23,"I")
+4 ; Ordering Location's Institution
SET ORDLINST=+$$GET1^DIQ(44,ORDLOC,3,"I")
+5 ; Quit if no Reference Lab setup
IF +$$GET1^DIQ(9009029,ORDLINST,3001,"I")<1
QUIT
+6 ;
+7 SET ORDERN=$$GET1^DIQ(69.01,LRSN_","_LRODT,9.5,"I")
+8 ; Quit if no Order #
IF ORDERN<1
QUIT
+9 ;
+10 ; Quit if no UID
IF $LENGTH(LRUID)<1
QUIT
+11 ;
+12 ; Make sure ^XTMP("BLRLINKU") is current. See documentation at REFLAB68^BLRLINKU.
DO REFLAB68^BLRLINKU
+13 ; Get Accession Area IEN
SET X=$QUERY(^LRO(68,"C",LRUID,0))
SET LRAA=+$QSUBSCRIPT(X,4)
+14 ;
+15 ; Quit if Accession Area not Reference Lab
IF $DATA(^XTMP("BLRLINKU",ORDLINST,LRAA))<1
QUIT
+16 ;
+17 SET LRDFN=$$GET1^DIQ(69.01,LRSN_","_LRODT,.01,"I")
+18 SET DFN=$$GET1^DIQ(63,LRDFN,.03,"I")
+19 ;
+20 ; S X=$$ORD^BLRRLEDI(ORDERN,DFN) ; Store Order # if not in there already
+21 SET ORDIEN=$$FIND1^DIC(9009026.3,,,ORDERN)
+22 ;
+23 ; Quit if Order # NOT in 9009026.3
IF ORDIEN<1
QUIT
+24 ;
+25 SET LRASIEN=1+$ORDER(^BLRRLO(ORDIEN,3,"A"),-1)
+26 ;
+27 KILL ERRS,FDA
+28 SET FDA(9009026.33,"?+1,"_ORDIEN_",",.01)=LRUID
+29 DO UPDATE^DIE(,"FDA",,"ERRS")
+30 ;
+31 QUIT
+32 ; ----- END IHS/MSC/MKK - LR*5.2*1034