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

BLRTNRES.m

Go to the documentation of this file.
BLRTNRES ; IHS/HQT/MJL - CREATE/EDIT TRANSACTIONS (CONTINUED) RESULT ;MAY 06, 2009 9:58 AM
 ;;5.2T1;IHS LABORATORY;**1026**;NOV 01, 1997
 ;
 ; Code removed from BLRTN due to BLRTN becoming too large
RESULT ;
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER RESULT^BLRTN")
 ;
 I BLROPT="MICRO" D ^BLRTNM,^BLRTN1:$G(BLRACCN)'=""  Q
 I BLROPT="BBANK" D ^BLRTNB,^BLRTN1:$G(BLRACCN)'=""  Q
 ;
 S BLRACCN=$P(BLRIDS,","),BLR("ACCESSION NUMBER")=BLRACCN,BLRTEST=$P(BLRIDS,",",2),BLRRSTAG="RESVRS"
 S:BLROPT="BYPASS" BLRCMF="C",BLR("STATUS FLAG")="A"
 ;
 S BLRAA=$G(^BLRSITE(BLRQSITE,20,BLRQDH,1,BLRLTP,"LRAA")),BLRAD=$G(^("LRAD")),BLRAN=$G(^("LRAN")),BLRSS=$G(^("LRSS")),BLRODT=$G(^("LRODT")),BLRSEQ=$G(^("LRSN")),BLRSPEC=$G(^("LRSPEC")),BLRCMP=$P($G(^LRO(68,BLRAA,1,BLRAD,1,BLRAN,3)),U,4)'=""
 S BLRCRSBS="""AAT"",BLRACCN,BLRTEST1",BLRDIR=-1,BLROKCK="",BLRBADCK=""
 ;
 M BLRRVS=^BLRSITE(BLRQSITE,20,BLRQDH,1,BLRLTP,"LRSB")
 ;
 ;CLEAR OUT PENDING OR UNRESULTED TESTS
 S BLRDN=""
 F  S BLRDN=$O(BLRRVS(BLRDN)) Q:BLRDN=""  D
 . I BLRRVS(BLRDN)=""!(BLRRVS(BLRDN)[("pending")) K BLRRVS(BLRDN)  ;IHS/ITSC/TPF  TREAT pending AS NOT A RESULT
 ;
 I $G(BLRCMF)="C" D ORDVRS,ACCVRS^BLRTN  Q:BLRACCN=""
 ;
 S BLRTEST=$G(^BLRSITE(BLRQSITE,20,BLRQDH,1,BLRLTP,"BLRTEST"))
 S:BLRTEST=0 BLRTEST=""
 ;
 ;GET THE COMMENTS  ;IGNORE 0 NODES AND B X-REFS
 K ^BLRSITE(BLRQSITE,20,BLRQDH,1,BLRLTP,"LRCOM",0)
 K ^BLRSITE(BLRQSITE,20,BLRQDH,1,BLRLTP,"LRCOM","B")
 S COMIEN=0
 F  S COMIEN=$O(^BLRSITE(BLRQSITE,20,BLRQDH,1,BLRLTP,"LRCOM",COMIEN)) Q:+COMIEN=0  D
 . S BLR("COMMENTS")=$G(BLR("COMMENTS"))_$G(^(COMIEN,0))_$C(20)
 ;
 D
 . I BLRTEST'="",'$D(BLRRVS)!(BLRCMF="C") D SET1^BLRTN Q
 . ;
 . D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("BEFORE BLRRVS LOOP")
 . S BLRDN=""
 . F  S BLRDN=$O(BLRRVS(BLRDN)) Q:BLRDN=""  D
 .. S BLRCREF=BLRSS_";"_BLRDN_";1"
 .. S BLRTEST=$O(^LAB(60,"C",BLRCREF,""))
 .. I BLRTEST'="",$D(^BLRTXLOG("AAT",BLRACCN,BLRTEST)) D
 ... D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("BEFORE SEQUENCE NUMBER GET")
 ... S BLRTEST1=BLRTEST,BLR("SEQUENCE NUMBER")=$$GETIEN^BLRTN()  Q:BLRERR
 ... D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("IN RESULT BEFORE UPDATE")
 ... S BLRRES=$P(BLRRVS(BLRDN),U)
 ... S BLRNAF=$P(BLRRVS(BLRDN),U,2)
 ... D RES1^BLRTN
 ... D ^BLRNFLTL
 ... D LOINC^BLRTN
 ... D CRSFLDS^BLRTN
 ;
 K BLR("COMMENTS")
 D ^BLRTN1
 K BLRRVS
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("EXIT RESULT^BLRTN")
 Q
 ;
 ; Set the BLR array using the field name or number, e.g.,
 ; S BLR("ORDER NUMBER")=X or S BLR(1103)=X
ORDVRS ;
 D:$G(SNAPSHOT) ENTRYAUD^BLRUTIL("ENTER ORDVRS^BLRTNRES")
 S BLRVAL=$G(^LRO(69,BLRODT,1,BLRSEQ,0))
 S BLRODTM=$P(BLRVAL,U,5)  ;'DATE/TIME ORDERED'
 S BLRDTC=$P($G(^LRO(69,BLRODT,1,BLRSEQ,1)),U)  ;'DATE/TIME OF COLLECTION'
 S:BLRDTC="" BLRDTC=$P(BLRVAL,U,8)  ;'EST. DATE/TIME OF COLLECTION'
 S BLR("COLLECTION DATE/TIME")=BLRDTC
 ;
 I BLRCMF'="C" Q
 ;
 S BLRLRDFN=$P(BLRVAL,U)  ;'LRDFN'
 S BLRFILE=$G(^LR(BLRLRDFN,0))
 S BLRDFN=$P(BLRFILE,U,3)
 S BLR("PATIENT POINTER VALUE")=BLRDFN
 S BLRFILE=$P(BLRFILE,U,2)
 S BLR("LRFILE")=BLRFILE
 S BLR("ORDER DATE")=BLRODTM
 S BLR("ORDER NUMBER")=$G(^LRO(69,BLRODT,1,BLRSEQ,.1))
 S BLR("ORDER SEQUENCE NUMBER")=BLRSEQ
 S BLRLOCN=$P(BLRVAL,U,7)
 ;
 S BLRLOC="" I BLRLOCN'="" S BLRLOC=$O(^SC("B",BLRLOCN,"")) S:BLRLOC="" BLRLOC=$O(^SC("C",BLRLOCN,"")) I BLRLOC="" S X=BLRLOCN,DIC=44,DIC(0)="MX" D ^DIC S BLRLOC=+Y I Y=-1 S BLRLOC=""
 S BLRCAT="A" I $L($G(^DPT(BLRDFN,.1))) S BLRCAT="I"
 S BLRCLNC="",BLRPCC1=0
 I BLRLOC'="" S BLRCLNC=$G(^SC(BLRLOC,0)),BLRIST=$P(BLRCLNC,U,4),BLRCLNC=$P(BLRCLNC,U,7) S:BLRIST="" BLRIST=$G(BLRDUZ2) I BLRXPCC S BLRPCCC=$P($G(^APCCCTRL(BLRIST,11,BLRLPKG,0)),U,3) I BLRPCCC'="" S BLRPCC1=$S(BLRPCCC:1,1:BLRCAT'="I")
 S BLRPROV=$P(BLRVAL,U,6),BLR("ORDERING PROVIDER POINTER")=BLRPROV
 D NOW^%DTC S BLR("ENTRY DATE/TIME")=%
 S BLR("CLINIC STOP CODE POINTER")=BLRCLNC
 S BLR("ORDERING LOCATION POINTER")=BLRLOC
 S BLR("DUZ(2)")=BLRDUZ2
 S BLR("I/O CATEGORY")=BLRCAT
 D LOINC^BLRTN
 Q