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

BLRAGUT3.m

Go to the documentation of this file.
BLRAGUT3 ; IHS/MSC/SAT - LABORATORY ACCESSION GUI RPC UTILITIES 3; 27-Jun-2016 08:52 ; MKK
 ;;5.2;IHS LABORATORY;**1039**;NOV 01, 1997;Build 38
 ;
RLALLTST(ORDERN) ; EP - Reference Lab ALL TeSTs
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,ORDERN,U,XPARSYS,XQXFLG)
 ;
 S BLRDT=0
 F  S BLRDT=$O(^LRO(69,"C",ORDERN,BLRDT))  Q:BLRDT<1  D
 . S BLRSP=0
 . F  S BLRSP=$O(^LRO(69,"C",ORDERN,BLRDT,BLRSP))  Q:BLRSP<1  D
 .. S BLRTSN=0
 .. F  S BLRTSN=$O(^LRO(69,BLRDT,1,BLRSP,2,"B",BLRTSN))  Q:BLRTSN<1  D
 ... D REFLABS
 Q
 ;
 ;
REFLABS ; EP - Store Info into 9009026.3
 Q:+$P($G(^BLRSITE(DUZ(2),"RL")),U)<1    ; If not Ref Lab, don't store
 ;
 ; --- DEBUG START
 D
 . NEW TMPBLRRF
 . ; M TMPBLRRF=^TMP("BLRRL",$J)
 . ; D FORCEIT^BLRUTIL7("REFLABS^BLRAGUT3 0.0")
 ; --- DEBUG END
 ;
 NEW AGINS,BDA,BDAC,BLRSEQ,DFN,ERRS,FDA,INSS,LRDFN,LROIEN,ORDIEN,PLCYHLDR,POLICYN,REFLORDN
 ;
 S LROIEN=BLRSP_","_BLRDT
 S REFLORDN=+$$GET1^DIQ(69.01,LROIEN,9.5,"I")
 Q:REFLORDN<1
 ;
 S LRDFN=$$GET1^DIQ(69.01,LROIEN,.01,"I")
 S DFN=$$GET1^DIQ(63,LRDFN,.03,"I")
 ;
 S X=$$ORD^BLRRLEDI(REFLORDN,DFN)     ; Create entry in 9009026.3, if necessary
 S ORDIEN=$$FIND1^DIC(9009026.3,,,REFLORDN)
 Q:ORDIEN<1     ; Quit if Order # NOT in 9009026.3
 ;
 S PLCYHLDR=+$O(^AUPN3PPH("C",DFN,"A"),-1)     ; PoLiCY HoLDeR
 S POLICYN=$$GET1^DIQ(9000003.1,PLCYHLDR,.04,"I")  ; POLICY Number
 ;
 I $L($G(BLRRL("CLIENT"))) S FDA(9009026.3,ORDIEN_",",.03)=$G(BLRRL("CLIENT"))
 E  S:POLICYN FDA(9009026.3,ORDIEN_",",.03)=POLICYN
 S FDA(9009026.3,ORDIEN_",",.05)=BLRBT
 ;
 D UPDATE^DIE(,"FDA",,"ERRS")
 ;
 D STUFFINS(DFN,REFLORDN)
 ; D FORCEIT^BLRUTIL7("REFLABS^BLRAGUT 9.0","BLRRL")
 ; D SETINS^BLRAG05C
 Q
 ;
STUFFINS(DFN,OR) ; "Stuff Insurance" -- OR = Order Number
 ; NEW (BLRDT,BLRSP,DILOCKTM,DISYS,DFN,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,OR,PAT,U,XPARSYS,XQXFLG)
 S BDAC=0
 D ^AGINS
 Q:'$D(AGINS(1))   ; Patient has No Insurance on file
 ;
 D SEQINS^BLRRLEDI(.AGINS,DFN,DT)
 S BDA=0 F  S BDA=$O(BLRSEQ(BDA)) Q:'BDA!(BDAC>3)  D
 . S BDAC=BDAC+1
 . S INSS=$TR($G(BLRSEQ(BDA)),"^","~")  ;have to switch to ~ for filing
 . D UPINS^BLRRLEDI(OR,"",DFN,INSS)
 Q