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

BLRRLMUU.m

Go to the documentation of this file.
BLRRLMUU ; IHS/MSC/MKK - Reference Lab Meaningful Use Utilities  ; 22-Oct-2013 09:22 ; MKK
 ;;5.2;IHS LABORATORY;**1033**;NOV 1, 1997
 ;
RELAHMID(UID) ; EP - For INCOMING messages, Return the IEN into the ^LAHM(62.49 global for the given UID, if it exists
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,LRPARAM,IOXY,TESTDESC,U,UID,XPARSYS,XQXFLG)
 ;
 S IEN="AAA",FOUNDIT=0
 ; Reverse Order thorugh 62.49 so as to find the latest IEN
 F  S IEN=$O(^LAHM(62.49,IEN),-1)  Q:IEN<1!(FOUNDIT)  D
 . Q:$P($G(^LAHM(62.49,IEN,0)),"^",2)'="I"    ; Only INCOMING messages
 . ;
 . S CNT=0
 . F  S CNT=$O(^LAHM(62.49,IEN,150,CNT))  Q:CNT<1!(FOUNDIT)  D
 .. S STR=$G(^LAHM(62.49,IEN,150,CNT,0))
 .. S:$P(STR,"|")="OBR"&($P($P(STR,"|",3),"^")=UID) FOUNDIT=IEN
 ;
 Q FOUNDIT
 ;
SHL7SEGS(UID) ; EP - Store UID's HL7 Segment numbers for Later Analysis
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,LRPARAM,IOXY,TESTDESC,U,UID,XPARSYS,XQXFLG)
 ;
 ; Don't redo if already created
 I $D(^TMP("BLRRLMUU",$J,UID)) Q $O(^TMP("BLRRLMUU",$J,UID,0))
 ;
 S IEN=$$RELAHMID(UID)
 Q:IEN<1 0
 ;
 ; Don't redo if already created
 Q:$D(^TMP("BLRRLMUU",$J,UID,IEN)) IEN
 ;
 S CNT=0
 F  S CNT=$O(^LAHM(62.49,IEN,150,CNT))  Q:CNT<1  D
 . S SEG=$P($G(^LAHM(62.49,IEN,150,CNT,0)),"|")
 . Q:$L(SEG)<1
 . S ^TMP("BLRRLMUU",$J,UID,IEN,SEG,CNT)=""
 Q IEN
 ;
GETCANCL(UID) ; EP - Get Cancel reason from SPM segment in LAHM 62.49
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,LRPARAM,IOXY,TESTDESC,U,UID,XPARSYS,XQXFLG)
 ;
 S IEN=$$SHL7SEGS(UID)
 Q:IEN<1 ""
 ;
 S WHERE=+$O(^TMP("BLRRLMUU",$J,UID,IEN,"SPM",0))
 Q:WHERE<1 ""
 ;
 Q $P($P($G(^LAHM(62.49,IEN,150,WHERE,0)),"|",22),"^",2)
 ;
LABSTOR(LRDFN,LRSS,LRIDT) ; EP - Store 62.49 IEN
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,LRDFN,LRSS,LRIDT,U,XPARSYS,XQXFLG)
 ;
 S LRUID=+$G(^LR(LRDFN,LRSS,LRIDT,"ORU"))          ; Get UID
 Q:LRUID<1
 ;
 S P6249=$$RELAHMID^BLRRLMUU(LRUID)
 ;
 S:+P2649 ^LR(LRDFN,LRSS,LRIDT,"HL7")=P2649_"^"
 Q
 ;
 ; ================== ^LAH routines follow
 ;
RETLAHID(UID) ; EP - Return the IEN into the ^LAH global for the given UID, if it exists
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,LRPARAM,IOXY,TESTDESC,U,UID,XPARSYS,XQXFLG)
 ;
 S IEN="AAA",FOUNDIT=0
 F  S IEN=$O(^LAH(IEN),-1)  Q:IEN<1!(FOUNDIT)  D
 . S:$O(^LAH(IEN,1,"U",""))=UID FOUNDIT=IEN
 ;
 Q FOUNDIT