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

BLRMLTL1.m

Go to the documentation of this file.
BLRMLTL1 ; IHS/DIR/FJE - SET IHS LAB TRANSACTION LOG - MICRO ; [ 04/13/98  1:11 PM ]
 ;;5.2T9;LR;**1018**;Nov 17, 2004
 ;;5.2;BLR;**1001**;Jun 16, 1998
 ;
 S BLRODT=LRODT,BLRSEQ=LRSN
 S BLRVAL=^LRO(69,BLRODT,1,BLRSEQ,0),BLRLRDFN=$P(BLRVAL,U,1),BLRODTM=$P(BLRVAL,U,5)
 S BLRDUZ=$P(BLRVAL,U,2),BLRDUZ2=DUZ(2)
 S BLRDUZN=$S($D(^VA(200,BLRDUZ,0)):$P(^(0),U,1),1:"UNK"_BLRDUZ)
 S BLRDTC=$P($P(BLRVAL,U,8),"."),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 BLRCLNC="" I BLRLOC'="" S BLRCLNC=$P(^SC(BLRLOC,0),U,7)
 ;S BLRCAT="A" I $L($G(^DPT(BLRLRDFN,.1))) S BLRCAT="I"
 ;----- BEGIN IHS MODIFICATIONS LR*5.2*1018
 S BLRCAT="A" S X=$$GET1^DIQ(2,BLRLRDFN,.103) I X]"",X'["OBSERVATION" S BLRCAT="I"
 ;----- END IHS MODIFICATIONS MOD SUGGESTED BY LINDA FELS
 S BLRPROV=$P(BLRVAL,U,6) S:+BLRPROV>0 BLRPROVN=$P(^VA(200,$P(BLRVAL,U,6),0),U,1) S:BLRPROVN="" BLRPROVN="Unknown Provider"
 S BLRDFN=$P(^LR(BLRLRDFN,0),U,3),BLRFILE=$P(^LR(BLRLRDFN,0),U,2),BLRODTM=$G(BLRODTM)
 S BLRSTR="SEQUENCE NUMBER_$$GETIEN(BLRODTM,BLRSEQ,BLRTEST1)~STATUS FLAG_BLRPHASE~LAB MODULE_""MI""~"
 S BLRSTR=BLRSTR_"LRFILE_BLRFILE~LRDFN_BLRLRDFN~PATIENT POINTER VALUE_BLRDFN~ORDERING PROVIDER POINTER_BLRPROV~VERIFIER POINTER_BLRDUZ~"
 S BLRSTR=BLRSTR_"ORDER DATE_$P(BLRVAL,U,5)~ORDER SEQ. NUMBER_BLRSEQ~ORDERING PROVIDER NAME_BLRPROVN~ORDER NUMBER_^LRO(69,BLRODT,1,BLRSEQ,.1)~"
 S BLRSTR=BLRSTR_"COLLECTION DATE/TIME_BLRDTC~VERIFIER NAME_BLRDUZN~ORDERING LOCATION NAME_BLRLOCN~ENTRY DATE/TIME_BLR(""ORDER DATE"")~CLINIC STOP CODE POINTER_BLRCLNC~"
 ;S BLRSTR=BLRSTR_"ORDERING LOCATION POINTER_BLRLOC~DUZ(2)_BLRDUZ2~I/O CATEGORY_BLRCAT~ACCESSION NUMBER_BLRACCN~"
 S BLRSTR=BLRSTR_"ORDERING LOCATION POINTER_BLRLOC~DUZ(2)_BLRDUZ2~I/O CATEGORY_BLRCAT~ACCESSION NUMBER_BLRACCN~COLLECTION SAMPLE POINTER_BLRCOLSP~"   ;IHS/DIR TUC/AAB 04/09/98
 S BLRLEV=1,BLRTEST1=BLRTEST,BLRLEV(1)=BLRTEST,BLRLEV(1,1)="",BLRATOM=1
 I BLR60F,'BLRSETP S BLRPAR=""
 D SET3 I BLR60F F  D SET2 Q:'BLRLEV
 K BLRLEV I BLR60F,'BLRSETP K BLRPAR
 Q
 ;
SET2 ;
 S BLRATOM=$O(^LAB(60,BLRLEV(BLRLEV),2,0))="" I BLRATOM,BLRLEV=1 S BLRLEV=0 Q
 S:'BLRATOM BLRLEV=BLRLEV+1 S BLRLEV(BLRLEV,0)=$O(^LAB(60,BLRLEV(BLRLEV-1),2,$G(BLRLEV(BLRLEV,0),0)))
 I BLRLEV(BLRLEV,0) S BLRTEST1=+^LAB(60,BLRLEV(BLRLEV-1),2,$G(BLRLEV(BLRLEV,0),0),0),BLRLEV(BLRLEV)=BLRTEST1 D SET3 Q
 S BLRLEV(BLRLEV,0)=0,BLRLEV=BLRLEV-2
 Q
 ;
SET3 ;
 I BLR60F S BLRL60=^LAB(60,BLRTEST1,0),BLRCST=$P(BLRL60,U,11)
 ;S (BLRXII,BLRCPTS,BLRCPTP)="" F  S BLRFOUND=0,BLRXII=$O(^BLRCPT("C",BLRTEST1,BLRXII)) Q:(BLRXII=""!(BLRFOUND))  S BLRCPTF=$P(^BLRCPT(BLRXII,1),U,2) Q:BLRCPTF  D GETCPT Q
 D:BLRLEV=1 CPTCODE^BLRSLTL1
 S BLRSTR1=""
 S BLRSPEC=$G(LRSPEC) D:BLRSPEC'="" SET4
 D:BLR60F
 .S BLRSTR1=BLRSTR1_"CPT LAB CODE POINTER_BLRCPTP~CPT CODE_BLRCPTS~PANEL/TEST POINTER_BLRTEST1~PANEL/TEST NAME_BLRTESTN~LAB TEST LIST COST_BLRCST~RESULT_BLRRES" S:BLRCMTS'="" BLRSTR1=BLRSTR1_"~COMMENTS_BLRCMTS"
 I 'BLR60F D
 .S BLRSTR1=BLRSTR1_"PARENT POINTER_BLRPAR~CPT LAB CODE POINTER_BLRCPTP~CPT CODE_BLRCPTS~RESULT_BLRRES~ORGANISM_BLRORG~PANEL/TEST POINTER_BLRCULT"
 .I BLRSPT'=6,BLRANTP'="" S BLRSTR1=BLRSTR1_"~ANTIBIOTIC_BLRANTP~ANTIBIOTIC NAME_BLRANTN~PCC ERROR FLAG_BLRERFS" Q
 .S:BLRSTGN'="" BLRSTR1=BLRSTR1_"~STAGE NAME_BLRSTGN"
 .S:BLRSTG'="" BLRSTR1=BLRSTR1_"~STAGE COUNTER_BLRSTG" Q
 I BLR60F S:BLRLEV(BLRLEV,1)'="" BLRPAR=BLRLEV(BLRLEV,1) S:BLRPAR'="" BLRSTR1=BLRSTR1_"~PARENT POINTER_BLRPAR" S:'BLRATOM BLRSTR1=BLRSTR1_"~@BLRPAR_BLR(""SEQUENCE NUMBER"")"
 S:+BLRCMPD BLRSTR1=BLRSTR1_"~COMPLETE DATE_BLRCMPD"
 D ^BLRFLTL("C",BLRSTR_BLRSTR1)
 I 'BLRATOM S BLRLEV(BLRLEV+1,1)=BLRPAR
 S BLRCMTS=""
 Q
 ;
SET4 ;
 S BLRZ=$G(^LAB(60,BLRTEST1,1,BLRSPEC,0)),BLRUNITS=$P($P(BLRZ,U,7)," ",1)
 S BLRSTR1="UNITS_BLRUNITS~SITE/SPECIMEN POINTER_BLRSPEC~"
 Q
 ;
GETCPT ;
 S BLRFOUND=1
 S BLRCPTP=BLRXII
 S (BLRCPTS,BLRCPTC)="" F  S BLRCPTC=$O(^BLRCPT(BLRXII,11,"B",BLRCPTC)) Q:BLRCPTC=""  S BLRCPTS=BLRCPTS_BLRCPTC_";"
 I $L(BLRCPTS,";")=2 S BLRCPTS=$P(BLRCPTS,";",1)
 I $E(BLRCPTS,$L(BLRCPTS))=";" S BLRCPTS=$E(BLRCPTS,$L(BLRCPTS))
 Q