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

BLRAG09E.m

Go to the documentation of this file.
BLRAG09E ; IHS/MSC/SAT - SUPPORT FOR LABORATORY ACCESSION GUI RPCS ; NOV 14, 2012
 ;;5.2;IHS LABORATORY;**1031**;NOV 01, 1997;Build 185
 ;
 ;support for screen formatted text for manifest display
 ;
INIT ; Initialize variables
 ;
 S DT=$$DT^XLFDT
 S LA7QUIT=0
 ;
 S LA7SCFG(0)=$G(^LAHM(62.9,+LA7SCFG,0))
 Q
 ;
HED ; Header
 S LA7PAGE=LA7PAGE+1
 S BLRY=0
 I +LA7SMST'=4,BLRIOM<132 D WARN
 ;
 S BLRTXT=" "_"Shipping Manifest: "_$P(LA7SM,"^",2)
 S BLRTXT=BLRTXT_$$FILL^BLRAGUT(BLRIOM-11-$L(BLRTXT))_" Page: "_LA7PAGE
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT
 I +LA7SMST'=4,BLRIOM'<132 D WARN
 ;
 ;S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=$$FILL^BLRAGUT(BLRIOM-38)_" Page: "_LA7PAGE
 S BLRTXT=$$FILL^BLRAGUT(10)_"to Site: "_LA7TSITE
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT_$$FILL^BLRAGUT(39-$L(BLRTXT))_" Printed: "_LA7NOW
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=$$FILL^BLRAGUT(8)_"from Site: "_LA7FSITE
 S BLRTXT=""
 ;
 I +LA7SMST=4 S BLRTXT=$$FILL^BLRAGUT(5)_"Date Shipped: "_$P(LA7SDT,"^",2)
 E  S BLRTXT=$$FILL^BLRAGUT(11)_"Status: "_$P(LA7SMST,"^",2)
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT_$$FILL^BLRAGUT(80-41)_" Ship via: "_LA7SVIA
 ;
 ; Print shipping receipt
 I $P(LA7SMR,"^",2) D  Q
 . S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=LA7LINE
 . I $P(LA7SMR,"^",2)=2 D
 . . S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=""
 . . S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)="Following Required Information and/or Test Codes Missing"
 . . S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)="" S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=""
 ;
 S BLRTXT="Shipping Condition: "_$S(LA7SCOND:$$GET1^DIQ(62.93,LA7SCOND_",",.01),1:"None Specified")
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT_$$FILL^BLRAGUT(10)_" Container: "_$S(LA7SCONT:$$GET1^DIQ(62.91,LA7SCONT_",",.01),1:"None Specified")
 ;
 I LA7SBC D SBC1
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=""
 S BLRTXT=$$FILL^BLRAGUT(10)_"Patient Name"
 S BLRTXT=BLRTXT_$$FILL^BLRAGUT(40-$L(BLRTXT))_"Patient ID"
 S BLRTXT=BLRTXT_$$FILL^BLRAGUT(65-$L(BLRTXT))_"Lab Reference #"
 I BLRIOM>131 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT_$$FILL^BLRAGUT(85-$L(BLRTXT))_"Requested By"
 E  S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT
 ;
 S BLRTXT=$$FILL^BLRAGUT(10)_"Date of Birth"
 S BLRTXT=BLRTXT_$$FILL^BLRAGUT(40-$L(BLRTXT))_"Sex"
 S BLRTXT=BLRTXT_$$FILL^BLRAGUT(65-$L(BLRTXT))_"Specimen UID"
 I BLRIOM>131 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT_$$FILL^BLRAGUT(85-$L(BLRTXT))_"Collect Date/Time"
 E  D
 . S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT
 . S BLRTXT=$$FILL^BLRAGUT(10)_"Requested By"
 . S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT_$$FILL^BLRAGUT(40-$L(BLRTXT))_"Collect Date/Time"
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=LA7LINE
 S BLRTXT=""
 Q
 ;
SH ; Subheader
 S BLRTXT="Item: "_LA7ITEM
 S BLRTXT=BLRTXT_$$FILL^BLRAGUT(10-$L($E(BLRTXT,1,10)))_PNM
 S BLRTXT=BLRTXT_$$FILL^BLRAGUT(40-$L(BLRTXT))_$S(LRDPF=2:$$HRN^AUPNPAT(DFN,DUZ(2)),1:"")
 S BLRTXT=BLRTXT_$$FILL^BLRAGUT(65-$L(BLRTXT))_$$GETORDA^LA7VORM1(LA7UID)  ;cmi/maw 7/6/2010 ref lab now order number
 I BLRIOM>131 S BLRTXT=BLRTXT_$$FILL^BLRAGUT(85-$L(BLRTXT))_$P($G(LA7PROV),"^",2)
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT
 S BLRTXT=""
 I LA7DC S BLRTXT="Cont'd"
 S BLRTXT=BLRTXT_$$FILL^BLRAGUT(10-$L(BLRTXT))_$$FMTE^XLFDT(DOB)
 S BLRTXT=BLRTXT_$$FILL^BLRAGUT(40-$L(BLRTXT))_$S(SEX="M":"Male",SEX="F":"Female",SEX="":"Unknown",1:SEX)
 S BLRTXT=BLRTXT_$$FILL^BLRAGUT(65-$L(BLRTXT))_LA7UID
 I BLRIOM'>131 D
 . S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT
 . S BLRTXT=$$FILL^BLRAGUT(10-$L(BLRTXT))_$$GET1^DIQ(200,$P($G(LA7PROV),"^"),41.99)_"-"_$E($P($G(LA7PROV),"^",2),1,19)
 . S BLRTXT=BLRTXT_$$FILL^BLRAGUT(40-$L(BLRTXT))_$S(LA7CDT:$$FMTE^XLFDT(LA7CDT,"1M"),1:LA7CDT)  ;cmi/maw 7/6/2010 for NPI
 I BLRIOM>131 S BLRTXT=BLRTXT_$$FILL^BLRAGUT(85-$L(BLRTXT))_$S(LA7CDT:$$FMTE^XLFDT(LA7CDT,"1M"),1:LA7CDT)
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT
 S BLRTXT=""
 I +LA7SMST'=4 D
 . D PROV(+$G(LA7PROV))
 . I $P($G(LA762801(0)),"^",6) D
 . . S X=$$GET1^DIQ(62.91,$P(LA762801(0),"^",6),.01)
 . . S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=$$FILL^BLRAGUT(10)_"Specimen Container: "_X
 ;
 ; Print collection sample if micro
 I $G(LA7AA),$P($G(^LRO(68,LA7AA,0)),"^",2)="MI" S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=$$FILL^BLRAGUT(10)_"Collection sample: "_$P(LA762(0),"^")
 ;
 S LA7X=$G(^TMP("LA7SMRI",$J,LA7SCOND,LA7SCONT,LA7UID,1))
 S BLRTXT=""
 I $P(LA7X,"^") D
 . S BLRTXT=$$FILL^BLRAGUT(10)_"Patient Height: "_$P(LA7X,"^",2)_" "_$$GET1^DIQ(64.061,+$P(LA7X,"^",3)_",",.01)
 I $P(LA7X,"^",4) D
 . I $P(LA7X,"^") S BLRTXT=BLRTXT_$$FILL^BLRAGUT(39-$L(BLRTXT))
 . E  S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT S BLRTXT=BLRTXT_$$FILL^BLRAGUT(10)
 . S BLRTXT=BLRTXT_"Patient Weight: "_$P(LA7X,"^",5)_" "_$$GET1^DIQ(64.061,+$P(LA7X,"^",6)_",",.01)
 S:BLRTXT'="" BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT
 S BLRTXT=""
 ;
 S LA7X=$G(^TMP("LA7SMRI",$J,LA7SCOND,LA7SCONT,LA7UID,2))
 S BLRTXT=""
 I $P(LA7X,"^") D
 . S BLRTXT=$$FILL^BLRAGUT(10)_"Collection Volume: "_$P(LA7X,"^",2)_" "_$$GET1^DIQ(64.061,+$P(LA7X,"^",3)_",",.01)
 I $P(LA7X,"^",8) D
 . I $P(LA7X,"^") S BLRTXT=BLRTXT_$$FILL^BLRAGUT(39-$L(BLRTXT))
 . E  S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT S BLRTXT=$$FILL^BLRAGUT(10)
 . S BLRTXT=BLRTXT_"Collection Weight: "_$P(LA7X,"^",9)_" "_$$GET1^DIQ(64.061,+$P(LA7X,"^",10)_",",.01)
 S:BLRTXT'="" BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT
 I $P(LA7X,"^",4) D
 . S BLRTXT=$$FILL^BLRAGUT(10)_"Collection End Date/Time: "_$$FMTE^XLFDT($P(LA7X,"^",5),"1M")
 . S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=BLRTXT_"  (Duration: "_$P(LA7X,"^",6)_" "_$$GET1^DIQ(64.061,+$P(LA7X,"^",7)_",",.01)_")"
 ;
 I LA7SBC D SBC2
 S LA7DC=0
 Q
 ;
CMT ; Print comments on manifest
 N LA7I
 F LA7I=1:1:LA7CMT D  Q:LA7EXIT
 . I (BLRY+4)>BLRIOSL D  Q:LA7EXIT
 . . I LA7PAGE S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)="" D WARN
 . . D HED
 . S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=$$FILL^BLRAGUT(10)_LA7CMT(LA7I,0)
 Q
 ;
OCMT(UID) ;now check here for order comment
 N ORD,ORDI,ORDD,ORDA,ORDB
 S ORD=$$GETORDA^LA7VORM1(UID)
 Q:'ORD
 S ORDD=$O(^LRO(69,"C",ORD,0))
 Q:'ORDD
 S ORDI=0 F  S ORDI=$O(^LRO(69,ORDD,1,ORDI)) Q:'ORDI  D
 . S ORDA=0 F  S ORDA=$O(^LRO(69,ORDD,1,ORDI,2,ORDA)) Q:'ORDA  D
 .. Q:$G(^LRO(69,ORDD,1,ORDI,2,ORDA,.3))'=UID
 .. S ORDB=0 F  S ORDB=$O(^LRO(69,ORDD,1,ORDI,2,ORDA,1,ORDB)) Q:'ORDB  D
 ... S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=$$FILL^BLRAGUT(10)_$G(^LRO(69,ORDD,1,ORDI,2,ORDA,1,ORDB,0))
 Q
 ;
PROV(LA7OP) ; Print ordering provider contact on working copy
 ; Call with LA7OP = provider's file #200 ien
 ;
 N LRERR,X,Y
 I LA7OP D GETS^DIQ(200,LA7OP_",",".132;.137;.138","E","LA7OP(LA7OP)","LRERR")
 I '$D(LA7OP(LA7OP)) Q
 S X="Requestor's "
 S BLRTXT=""
 I LA7OP(LA7OP,200,LA7OP_",",.132,"E")'="" D
 . S BLRTXT=$$FILL^BLRAGUT(10)_X_"Phone: "_LA7OP(LA7OP,200,LA7OP_",",.132,"E")
 . S X=""
 I LA7OP(LA7OP,200,LA7OP_",",.137,"E")'="" D
 . S Y=0
 . I X="" S Y=$L(LA7OP(LA7OP,200,LA7OP_",",.137,"E"))+$L(BLRTX)+16
 . I Y>BLRIOM!(X'="") S BLRI=BLRI+1,BLRY=BLRY+1,BLRTXT(BLRI)=BLRTXT,BLRTXT=$$FILL^BLRAGUT(10)
 . E  S X="  "_X
 . S BLRTXT=BLRTXT_X_"Voice Pager: "_LA7OP(LA7OP,200,LA7OP_",",.137,"E")
 . S X=""
 I LA7OP(LA7OP,200,LA7OP_",",.138,"E")'="" D
 . S Y=0
 . I X="" S Y=$L(LA7OP(LA7OP,200,LA7OP_",",.138,"E"))+$L(BLRTXT)+18
 . I Y>BLRIOM!(X'="") S BLRI=BLRI+1,BLRY=BLRY+1,BLRTXT(BLRI)=BLRTXT,BLRTXT=$$FILL^BLRAGUT(10)
 . E  S X="  "_X
 . S BLRTXT=BLRTXT_X_"Digital Pager: "_LA7OP(LA7OP,200,LA7OP_",",.138,"E")
 . S X=""
 S:BLRTXT'="" BLRI=BLRI+1,BLRY=BLRY+1,BLRTXT(BLRI)=BLRTXT
 ;
 I X="" S BLRI=BLRI+1,BLRY=BLRY+1,BLRTXT(BLRI)=""
 Q
 ;
WARN ; Write warning for work copy.
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)="*** DO NOT USE FOR SHIPPING DOCUMENT - WORK COPY ONLY ***"
 Q
 ;
SBC1 ; Site bar codes
 ;
 ; Print "SM" bar code
 ; Calculate/append LPC to barcode. 
 I $G(LA7SM("BARCODE"))="" D
 . N LA7X,X,Y
 . I LA7SBC=1 D
 . . S LA7X="STX^SITE^"_LA7FSITE(99)_"^"_$P($G(LA7SDT),"^")_"^"_$P(LA7SM,"^",2)_"^ETX"
 . I LA7SBC=2 D
 . .S LA7X="SITE^"_LA7FSITE(99)_"^"_$P($G(LA7SDT),"^")_"^"_$P(LA7SM,"^",2)_"^"
 . S X=LA7X X ^%ZOSF("LPC") S LA7SM("LPC")=Y,LA7SM("BARCODE")=LA7X_Y
 ;
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=$$FILL^BLRAGUT(17)_"SM: "_$$BC128^LA7SBC(LA7SM("BARCODE"),1,60,"","",2)
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=""
 ;
 Q
 ;
SBC2 ; Patient bar codes
 ;
 N LA7SDATA
 ;
 ; Print "PD" bar code
 I LA7SBC=1 D
 . S LA7SDATA="STX^PD^"_SSN(2)_"^"_LA7FSITE(99)_"^"_LA7UID_"^"_$G(SEX)_"^"_LA7CDT_"^ETX"_$G(LA7SM("LPC"))
 ;
 I LA7SBC=2 D
 . S LA7SDATA="PD^"_SSN(2)_"^"_LA7FSITE(99)_"^"_LA7UID_"^"_LA7CDT_"^"_$G(LA7SM("LPC"))
 ;
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=""
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=$$FILL^BLRAGUT(17)_"PD: "_$$BC128^LA7SBC(LA7SDATA,1,60,"","",2)
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=""
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=$$FILL^BLRAGUT(10)_$E(LA7LINE,1,69)
 ;
 ; Print "PD1" bar code
 I LA7SBC=1 D
 . S LA7SDATA="STX^PD1^"_SSN(2)_"^"_PNM_"^"_DOB_"^ETX"_$G(LA7SM("LPC"))
 I LA7SBC=2 D
 . S LA7SDATA="PD1^"_SSN(2)_"^"_PNM_"^"_DOB_"^"_SEX_"^"_$G(LA7SM("LPC"))
 ;
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=$$FILL^BLRAGUT($S(BLRIOM<131:18,1:50))_"PD1: "_$$BC128^LA7SBC(LA7SDATA,1,60,"","",2)
 S BLRI=BLRI+1,BLRY=BLRY+1 S BLRTXT(BLRI)=""
 ;
 Q