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

BPCLOPRT.m

Go to the documentation of this file.
BPCLOPRT ; IHS/OIT/MJL - PRINT LAB ORDERS FOR GUI ;
 ;;1.5;BPC;;MAY 26, 2005
 ;
PRTORD(BPCARRAY,BPCORDN) ;;EP REMOTE PROC: BPC PRINT LAB ORDER
 D ENT
 K BPCBED,BPCCNTR,BPCCS,BPCCSS,BPCDFN,BPCDOB,BPCDPF,BPCDTO,BPCDUZ,BPCGOT,BPCGUI,BPCHRCN,BPCI,BPCLLOC,BPCLRDFN,BPCLWC,BPCODT,BPCORDTM,BPCPNM,BPCPR,BPCSAMP,BPCSN,BPCSPC,BPCSSN,BPCT,BPCTP,BPCUR,BPCX,DOB,HRCN,LRDFN,Y
 Q
 ;
ENT ;
 ;S BPCORDN=35970 ;USE THIS FOR TESTING
 D ^XBKVAR
 S BPCGUI=1,XWBWRAP=1,BPCX="" K ^TMP($J)
 S BPCARRAY="^TMP("_$J_")"
 S BPCSPC=$J("",77)
 I $G(BPCORDN)="" S ^TMP($J,1)=-1,^TMP($J,2)="LAB ORDER NOT SENT!" Q
 S BPCCNTR=1
 D LAB
 K Y
 I BPCCNTR=1 S ^TMP($J,1)=1,^TMP($J,2)="No Data Available" Q
 Q
 ;
LAB I '$D(^LRO(69,"C",BPCORDN)) S ^TMP($J,1)=-1,^TMP($J,2)="LAB ORDER NOT IN LAB ORDERS FILE" Q
 S BPCODT="" F  S BPCODT=$O(^LRO(69,"C",BPCORDN,BPCODT)) Q:'BPCODT  D
 .S BPCSN="" F  S BPCSN=$O(^LRO(69,"C",BPCORDN,BPCODT,BPCSN)) Q:'BPCSN  D
 ..I '$D(^LRO(69,BPCODT,1,BPCSN,0)) S ^TMP($J,1)=-1,^TMP($J,2)="LAB ORDER NOT SENT!" Q
 ..N BPCSAMP,BPCGOT S BPCGOT=0
 ..S BPCI=0 F  S BPCI=$O(^LRO(69,BPCODT,1,BPCSN,2,BPCI)) Q:BPCI<1  I $D(^(BPCI,0)),'$P(^(0),"^",11) S BPCGOT=1 Q
 ..Q:'BPCGOT
 ..S BPCX=^LRO(69,BPCODT,1,BPCSN,0),BPCCSS=$S($D(^(4,1)):^(1,0),1:0),BPCLRDFN=$P(BPCX,U),(BPCSAMP,BPCCS)=$P(BPCX,U,3)
 ..S BPCLWC=$P(BPCX,U,4),BPCDTO=$P(BPCX,U,5),BPCPR=$P(BPCX,U,6),BPCLLOC=$P(BPCX,U,7),BPCORDTM=$P($P(BPCX,U,8),".",2),BPCDUZ=$P(BPCX,U,2)
 ..S BPCCSS=$S($D(^LAB(61,+BPCCSS,0)):$P(^(0),U),1:""),BPCCS=$S($D(^LAB(62,+BPCCS,0)):^(0),1:"")
 ..S BPCDPF=$P(^LR(BPCLRDFN,0),U,2),BPCDFN=$P(^(0),U,3),BPCX=^DIC(BPCDPF,0,"GL")_BPCDFN_",0)",BPCPNM=$S($D(@BPCX):$P(@BPCX,U),1:"UNKNOWN")
 ..S BPCSSN=$S($D(@BPCX):$P(@BPCX,U,9),1:"UNKNOWN") S BPCX=^DIC(BPCDPF,0,"GL")_BPCDFN_",.101)" S BPCBED=$S($D(@BPCX):^(.101),1:"")
 ..S LRDFN=BPCLRDFN
 ..D PT^LRX  ;IHS/ANMC/CLS 08/18/96
 ..S BPCHRCN=HRCN,BPCDOB=DOB
 ..D:BPCSSN SSN^LRU
 ..S ^TMP($J,BPCCNTR)="",BPCCNTR=BPCCNTR+1
 ..S ^TMP($J,BPCCNTR)="",BPCCNTR=BPCCNTR+1
 ..S ^TMP($J,BPCCNTR)=$E(BPCSPC,1,25)_"LABORATORY: "_^DD("SITE") S BPCCNTR=BPCCNTR+1
 ..S ^TMP($J,BPCCNTR)="",BPCCNTR=BPCCNTR+1
 ..S ^TMP($J,BPCCNTR)="",BPCCNTR=BPCCNTR+1
 ..S Y=BPCODT D DD^LRX
 ..S ^TMP($J,BPCCNTR)=$E(BPCSPC,1,23)_$S(BPCLWC="SP":"Send Patient",BPCLWC="WC":"Ward/Clinic Collect",BPCLWC="I":"Immed Lab Collect ",1:"Lab Collect")_" ORDER FOR "_Y S BPCCNTR=BPCCNTR+1
 ..S ^TMP($J,BPCCNTR)=$E(BPCSPC,1,23)_"ORDER: "_$S($D(^LRO(69,BPCODT,1,BPCSN,.1)):^(.1),1:"")_BPCSPC
 ..S ^TMP($J,BPCCNTR)=$E(^TMP($J,BPCCNTR),1,40)_"LOCATION: "_BPCLLOC
 ..S:$L(BPCBED) ^TMP($J,BPCCNTR)=^TMP($J,BPCCNTR)_"    BED: "_BPCBED
 ..S BPCCNTR=BPCCNTR+1
 ..S ^TMP($J,BPCCNTR)="",BPCCNTR=BPCCNTR+1
 ..S ^TMP($J,BPCCNTR)=BPCPNM_BPCSPC
 ..S ^TMP($J,BPCCNTR)=$E(^TMP($J,BPCCNTR),1,40)_BPCHRCN_BPCSPC
 ..S ^TMP($J,BPCCNTR)=$E(^TMP($J,BPCCNTR),1,51)_"DOB: "_BPCDOB,BPCCNTR=BPCCNTR+1
 ..S ^TMP($J,BPCCNTR)="ENTERED BY: "_$P($G(^VA(200,DUZ,0)),U,1)_BPCSPC
 ..S Y=BPCDTO D DD^LRX
 ..;S ^TMP($J,BPCCNTR)=$E(^TMP($J,BPCCNTR),1,40)_Y,BPCCNTR=BPCCNTR+1
 ..S ^TMP($J,BPCCNTR)=Y,BPCCNTR=BPCCNTR+1
 ..I $L(BPCPR) S ^TMP($J,BPCCNTR)="PRACTITIONER: "_$S($D(^VA(200,BPCPR,0)):$P(^(0),"^"),1:"UNKNOWN")_BPCSPC S ^TMP($J,BPCCNTR)=$E(^TMP($J,BPCCNTR),1,32)
 ..I BPCORDTM S Y=BPCODT_"."_BPCORDTM D DD^LRX
 ..I BPCORDTM S ^TMP($J,BPCCNTR)=^TMP($J,BPCCNTR)_$S(BPCLWC="I":"REQUESTED ",1:" Est.")_" Collect Time: "_Y
 ..S BPCCNTR=BPCCNTR+1
 ..S ^TMP($J,BPCCNTR)="Collection sample: "_$P(BPCCS,U)_"  "_$P(BPCCS,U,3)_BPCSPC,^TMP($J,BPCCNTR)=$E(^TMP($J,BPCCNTR),1,32)
 ..S:$P(BPCCS,U)'[BPCCSS ^TMP($J,BPCCNTR)=" Site/Specimen: "_BPCCSS
 ..S BPCT=0 F  S BPCT=$O(^LRO(69,BPCODT,1,BPCSN,2,BPCT)) Q:BPCT<1  S BPCTP=^(BPCT,0) D:'$P(BPCTP,"^",11) TEST
 ..S ^TMP($J,BPCCNTR)="",BPCCNTR=BPCCNTR+1
 ..S ^TMP($J,BPCCNTR)="",BPCCNTR=BPCCNTR+1
 ..S ^TMP($J,BPCCNTR)="",BPCCNTR=BPCCNTR+1
 ..S ^TMP($J,BPCCNTR)="DATE/TIME OF COLLECTION:__________"
 ..I $G(BPCLWC)="WC" S ^TMP($J,BPCCNTR)="",BPCCNTR=BPCCNTR+1,^TMP($J,BPCCNTR)="",BPCCNTR=BPCCNTR+1,^TMP($J,BPCCNTR)="COLLECTED BY:_____________________________"
 ..S BPCCNTR=BPCCNTR+1
 ..I $D(^LRO(69,BPCODT,1,BPCSN,6,0)) S ^TMP($J,BPCCNTR)="",BPCCNTR=BPCCNTR+1 D
 ...S ^TMP($J,BPCCNTR)="Order comment: " F BPCI=0:0 S BPCI=$O(^LRO(69,BPCODT,1,BPCSN,6,BPCI)) Q:BPCI<1  S ^TMP($J,BPCCNTR)="  "_^(BPCI,0),BPCCNTR=BPCCNTR+1
 ..I $G(BPCLWC)="SP" S ^TMP($J,BPCCNTR)="** PLEASE BRING THIS WITH YOU TO THE LAB **" S BPCCNTR=BPCCNTR+1
 S ^TMP($J,.5)=BPCCNTR Q
 ;
TEST S ^TMP($J,BPCCNTR)="TEST/PROCEDURE: "_$P(^LAB(60,+BPCTP,0),U)_BPCSPC,^TMP($J,BPCCNTR)=$E(^TMP($J,BPCCNTR),1,48)
 S BPCUR=+$P(BPCTP,U,2) S:BPCUR ^TMP($J,BPCCNTR)=^TMP($J,BPCCNTR)_$P(^LAB(62.05,BPCUR,0),U)
 S BPCCNTR=BPCCNTR+1
 I $D(^LAB(60,+BPCTP,3,"B",+BPCSAMP)) S BPCX=$O(^(+BPCSAMP,0)) I BPCX,$D(^LAB(60,+BPCTP,3,1,BPCX)) S BPCI=0 D
 . S BPCCNTR=BPCCNTR+1,^TMP($J,BPCCNTR)="Ward Instructions:"
 . F  S BPCI=$O(^LAB(60,+BPCTP,3,1,BPCX,BPCI)) Q:BPCI<1  S BPCCNTR=BPCCNTR+1,^TMP($J,BPCCNTR)="  "_^(BPCI,0)
 I $O(^LRO(69,BPCODT,1,BPCSN,2,BPCT,1,0)) S BPCCNTR=BPCCNTR,^TMP($J,BPCCNTR)="Ward Comments:" S BPCI=0 F  S BPCI=$O(^LRO(69,BPCODT,1,BPCSN,2,BPCT,1,BPCI)) Q:BPCI<1  S BPCCNTR=BPCCNTR+1,^TMP($J,BPCCNTR)="  "_^(BPCI,0)
 Q