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

SRBL.m

Go to the documentation of this file.
  1. SRBL ;BIR/ADM - BLOOD PRODUCT VERIFICATION FOR VBECS ;09/01/05
  1. ;;3.0; Surgery ;**148,168**;24 Jun 93;Build 5
  1. ;
  1. ; Reference to AVUNIT^VBECA1B supported by DBIA #4629
  1. ;
  1. SCAN D BAR ; test bar code reader
  1. S SRQ=0,DFN=$P(^SRF(SRTN,0),"^") K ^TMP("SRBL",$J)
  1. D AVUNIT^VBECA1B("SRBL",DFN) ; get list of units available for the patient
  1. TST K DIR S DIR(0)="FA^1:50",(SRPROMPT,DIR("A"))="Enter Blood Product Identifier: "
  1. S DIR("?")="Enter or scan the Blood Product Unit Id" D ^DIR K DIR G END:$D(DTOUT)!$D(DUOUT)
  1. D CODA,MATCH I 'SRMATCH G SRNO
  1. I SRMATCH=1 S SRY=SRMATCH D SRYES Q
  1. D LIST I SRQ G END
  1. S SRY=Y D SRYES
  1. Q
  1. LIST W ! S Y=^TMP("SRBL",$J,0),Z=$P(Y,"^",7),SRSSN=$E(Z,1,3)_"-"_$E(Z,4,5)_"-"_$E(Z,6,12)
  1. S SRNAME=$P(Y,"^",5)_","_$P(Y,"^",4)_" "_SRSSN
  1. S (SRI,SRZ)=0 F S SRZ=$O(SRBL(SRZ)) Q:'SRZ D
  1. .S Z=SRBL(SRZ),SRPROD=$P(Z,"^",4),X=$P(Z,"^",2) D ^%DT S SREXP=Y
  1. .W !!," ",SRZ_") Unit ID: ",SRUID,?45,SRPROD
  1. .W !,?4,"Patient: ",SRNAME,?45,"Expiration Date: " S Y=SREXP D DD^%DT W Y
  1. .S SRI=SRI+1
  1. W ! K DIR S DIR(0)="NO^1:"_SRI,DIR("A")="Select the blood product matching the unit label"
  1. D ^DIR K DIR I $D(DTOUT)!$D(DUOUT)!'Y S SRQ=1 Q
  1. S SRY=Y
  1. Q
  1. MATCH ; retrieve matching units from list of available units
  1. S (SRIDT,SRMATCH)=0 F S SRIDT=$O(^TMP("SRBL",$J,SRIDT)) Q:'SRIDT D
  1. .S X=^TMP("SRBL",$J,SRIDT)
  1. .I $P(X,"^",3)=SRUID!($P(X,"^",12)=SRUID) S SRMATCH=SRMATCH+1,SRBL(SRMATCH)=X W !,"Eye Readable ID: ",$P(X,"^",3),!
  1. ;RLM Match either scanned or eye-readable label
  1. Q
  1. CODA ; interpret Codabar barcodes used to label the Unit ID of blood component
  1. I $$ISBTUID(.X) S SRUID=X Q
  1. S SRUID=$$STRIP(X)
  1. W ?45,"UNIT ID: ",SRUID
  1. Q
  1. SRYES S X=$P(SRBL(SRY),"^",2) D ^%DT I Y<DT D D ASK Q
  1. .I SRMATCH=1 D LIST
  1. .W !!,?30,"**WARNING**",!!,"Today's date exceeds the blood product expiration date.",!
  1. W !!!,?25,"No Discrepancies Found",!!! K DIR S DIR(0)="FOA",DIR("A")="Press RETURN to continue" D ^DIR G END
  1. SRNO W !!,?30,"**WARNING**",!!
  1. W ?5,"There is no record that this unit has been assigned to this patient."
  1. W !!,?8," Please recheck the patient and blood product IDs.",!!
  1. ASK K DIR S DIR(0)="Y",DIR("A")="Do you want to scan another product (Y/N)",DIR("B")="YES" D ^DIR I Y D END G SCAN
  1. END K ^TMP("SRBL",$J),DIR,SR,SRBL,SREXP,SRI,SRIDT,SRMATCH,SRNAME,SRPROD,SRPROMPT,SRQ,SRSSN,SRUID,SRY,SRZ,X,Y,Z
  1. Q
  1. STRIP(X) ; strip off any ISBT-128 barcode identifier characters
  1. S X=$TR(X,"=<>&%(","")
  1. Q X
  1. BAR ; test bar code reader
  1. N A,SR,SRABO,SRRH,SRPROMPT,X,Y S SR=""
  1. K DIR S DIR(0)="FAO^1:20" S DIR("A",1)="",(SRPROMPT,DIR("A"))=" => "
  1. S DIR("A",2)=" To use BAR CODE READER"
  1. S DIR("A",3)=" Pass reader wand over a GROUP-TYPE (ABO/Rh) label"
  1. S DIR("?",2)=" To test scanner, scan a GROUP-TYPE (ABO/Rh) label. Otherwise, press"
  1. S DIR("?",1)="",DIR("?")=" the Enter key." D ^DIR K DIR Q:$D(DTOUT)!$D(DUOUT)!(X="")
  1. W $C(13),$J("",79),$C(13),SRPROMPT,"(Bar code)"
  1. D ISBTBG(X,.SRABO,.SRRH) I SRABO]"" D Q
  1. .S SR=1,SR(2)=""
  1. .W " ",SRABO," ",SRRH
  1. S X=$$STRIP(X)
  1. F A=1:1 S Y=$P($T(G+A),";",4) Q:Y="" S X(1)=$F(X,Y) I X(1),$L(X)<X(1) S SR=$L(X)-3,SR(2)=$E(X,1,SR),SR=SR+1 Q
  1. I SR="" W $C(7),!!?28,"Not a GROUP-TYPE label",!?15,"Press <ENTER> key if BAR CODE READER is not used",! G BAR
  1. W " ",$P($T(G+A),";",3)
  1. Q
  1. ISBTBG(SRIN,SRBLABO,SRBLRH) ; check for ISBT-128 valid blood group and return ABO & Rh values
  1. ; Valid codes are prefixed by "=%".
  1. ;
  1. ; INPUT : SRIN = input from Blood Group barcode label.
  1. ; OUTPUT : SRBLABO (passed by reference) = ABO value
  1. ; SRBLRH (passed by reference) = Rh value
  1. ;
  1. N Z S (SRBLABO,SRBLRH)=""
  1. Q:$L(SRIN)'>3
  1. Q:$E(SRIN,1,2)'="=%"
  1. S Z=$E(SRIN,3,4)
  1. S SRBLABO=$S(57<Z&(Z<66):"A POS",46<Z&(Z<55):"O POS",90<Z&(Z<99):"O NEG",1<Z&(Z<10):"A NEG",12<Z&(Z<21):"B NEG",68<Z&(Z<77):"B POS",23<Z&(Z<32):"AB NEG",79<Z&(Z<88):"AB POS",1:"")
  1. Q:SRBLABO=""
  1. S SRBLRH=$P(SRBLABO," ",2)
  1. S SRBLABO=$P(SRBLABO," ")
  1. Q
  1. ISBTUID(SRBLIN) ; Check for and display valid ISBT-128 Unit Id
  1. ; Valid codes are prefixed by "="
  1. ;
  1. ; INPUT : SRBLIN = input from Unit Id barcode label.
  1. ; OUTPUT : Boolean
  1. ;
  1. Q:$E(SRBLIN,1,2)'?1"="1(1A,1N) 0
  1. S SRBLIN=$E(SRBLIN,2,14)
  1. S SRBLIN=$$UP^XLFSTR(SRBLIN) ; make uppercase
  1. W $C(13),$J("",79),$C(13),SRPROMPT,?32,"(Bar code)"
  1. D EN^DDIOL("UNIT ID: "_SRBLIN,"","?46")
  1. Q 1
  1. G ;;
  1. 51 ;;O POS;510
  1. 62 ;;A POS;620
  1. 73 ;;B POS;730
  1. 84 ;;AB POS;840
  1. 95 ;;O NEG;950
  1. 6 ;;A NEG;060
  1. 17 ;;B NEG;170
  1. 28 ;;AB NEG;280
  1. 55 ;;O;550
  1. 66 ;;A;660
  1. 77 ;;B;770
  1. 88 ;;AB;880
  1. ;;NA NA;