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

BPCLIPL.m

Go to the documentation of this file.
BPCLIPL ; IHS/OIT/MJL - GUI PROVIDER PAT LIST FOR LAB DATA ;
 ;;1.5;BPC;;MAY 26, 2005
 ;GETS LIST OF INITIAL PATIENTS FROM LAB OPT
 ;    EDIT/DISP....LAB LISTS MENU
 ;    ADDS TODAY'S PATIENTS WHO HAVE LABS
 ;GETS TODAYS LABS FOR PROVIDER DUZ
TAG(BPCRES) ;EP REMOTE PROC: BPC GET INITIAL LAB LIST
STRT S U="^",XWBWRAP=1,BPCCTR=2,BPCSTAR="" K ^BGUTMP($J),^TMP($J) S BPCRES="^TMP("_$J_")"
 I '$D(DUZ) S ^TMP($J,1)=-1,^TMP($J,2)="NO USER (DUZ) DEFINED" D KILL Q
 D CLIN
 S BPCX="",BPCSTAR="  *L*" F  S BPCX=$O(^BGUTMP($J,"CLIN",BPCX)) Q:BPCX=""  D GETPDAT
 S BPCSTAR="" I $D(^LRO(69.2,1,7,DUZ,1,"C")) S BPCX=0 F  S BPCX=$O(^LRO(69.2,1,7,DUZ,1,"C",BPCX)) Q:BPCX=""  D GETPDAT
 S BPCX="" F  S BPCX=$O(^BGUTMP($J,"NAME",BPCX)) Q:BPCX=""  S ^TMP($J,BPCCTR)=^(BPCX),BPCCTR=BPCCTR+1
 S ^TMP($J,1)=$S(BPCCTR=2:0,1:BPCCTR-1)
 D KILL
 Q
 ;
KILL ;
 K BGUDOB,BPCCTR,BPCDAT,BPCDFN,BPCDOB,BPCEDT,BPCHRCN,BPCIDT,BPCIEN,BPCL0,BPCLOC,BPCNA,BPCP,BPCDFN,BPCPDT,BPCPNM,BPCPRVN,BPCPRVNA,BPCR1,BPCRANGE,BPCRHIGH,BPCRL0W,BPCRLOW,BPCSDT,BPCSEX,BPCSPEC,BPCSR,BPCSSN
 K BPCSTAR,BPCT,BPCTIME,BPCTX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BPCPDT,1,"AN",BPCLOC,BPCLRDFN,BPCIDT)) Q:BPCIDT<1  D LOOK
 Q
 ;
LOOK K BPCT S BPCL0=$S($D(^LR(BPCLRDFN,"CH",BPCIDT,0)):^(0),1:"") Q:BPCL0=""
 S BPCT=0 F BPCI=1:0 S BPCI=$O(^LR(BPCLRDFN,"CH",BPCIDT,BPCI)) Q:BPCI<1  S BPCT=BPCT+1,BPCT(BPCI)=^(BPCI) ;FOR ABN PUT I $P(^(BPCI),U,2)'="" BEFORE S BPCT=BPCT+1
 D GUI:BPCT
 Q
 ;
SETPRV S BPCPRVN=""
 F  S BPCP=$O(^LRO(69,BPCPDT,1,"AA",BPCLRDFN,BPCP)) Q:BPCP=""  D C1
 Q
 ;
C1 S BPCPRVN=$P(^LRO(69,BPCPDT,1,BPCP,0),"^",6)
 S BPCPRVNA=$P($G(^VA(200,BPCPRVN,0)),"^",1)
 Q
 ;
SETUPDT I '$D(BPCL0) S BPCY="" Q
 S Y=$P(BPCL0,"^",1)
 I '$D(Y)!(Y="") S BPCY="" Q
 S BPCY=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3)_" "
 X ^DD("DD")
 S BPCTIME=$P(Y,"@",2),BPCY=BPCY_$E(BPCTIME,1,2)_":"_$E(BPCTIME,4,5)
 Q
 ;
SETRANGE S BPCRL0W="",BPCRHIGH="" I '$D(BPCL0) Q
 I '$D(BPCTX) Q
 S BPCR1=$P(BPCL0,"^",5)
 I '$D(^LAB(60,BPCTX,1,BPCR1,0)) Q
 S BPCRANGE=^LAB(60,BPCTX,1,BPCR1,0)
 ; NEED TO PICK UP TEST UNITS AND SPECIMEN.
 S BPCUNITS=$P(BPCRANGE,U,7),BPCSR=$S(BPCR1=72:70,BPCR1=73:70,1:BPCR1),BPCSPEC=$P(^LAB(61,BPCSR,0),U,1)
 I BPCRANGE["$S" S BPCX="S BPCRLOW="_$P(BPCRANGE,"^",2) X BPCX S BPCX="S BPCRHIGH="_$P(BPCRANGE,"^",3) X BPCX Q
 S BPCRLOW=$P(BPCRANGE,"^",2),BPCRHIGH=$P(BPCRANGE,"^",3)
 Q
 ;
GUI D SETUPDT S LRDFN=BPCLRDFN,BPCX=^LR(BPCLRDFN,0),BPCLRDPF=$P(BPCX,U,2),BPCDFN=$P(BPCX,U,3) D PT^LRX S BPCHRCN=$G(HRCN),BPCPNM=$G(PNM) Q:'$L(BPCPNM)
 S BPCX=^DPT(BPCDFN,0),BPCDOB=$P(BPCX,U,3),BPCSSN=$P(BPCX,U,9)
 S (^TMP($J,BPCCTR),^BGUTMP($J,"CLIN",BPCPNM))="CLIN"_U_"NAME"_U_BPCPNM_U_BPCHRCN_U_$S($D(^DPT(BPCDFN,.1)):^(.1),1:BPCLOC)_U_$P(BPCL0,U,6)_U_BPCY_U_BPCDOB_U_BPCSSN,BPCCTR=BPCCTR+1
 S BPCI=0 F  S BPCI=$O(BPCT(BPCI)) Q:BPCI<1  S BPCTX=$O(^LAB(60,"C","CH;"_BPCI_";1",0)) I BPCTX>0 S ^TMP($J,BPCCTR)="CLIN"_U_"TEST"_U_$P(^LAB(60,BPCTX,0),U,1)_U_$P(BPCT(BPCI),U,1)_U_$P(BPCT(BPCI),U,2) D
 .D SETRANGE S ^TMP($J,BPCCTR)=^TMP($J,BPCCTR)_U_BPCRLOW_U_BPCRHIGH_U_BPCUNITS_U_BPCSPEC S BPCCTR=BPCCTR+1
 K BGUDOB,BGUSSN
 Q