source: FOIAVistA/trunk/r/LAB_SERVICE-LR-LS/LRBLB.m@ 1193

Last change on this file since 1193 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.7 KB
Line 
1LRBLB ;AVAMC/REG/CRT - BLOOD BANK BAR CODE READER ; 12/5/00 11:16am
2 ;;5.2;LAB SERVICE**247,267**;Sep 27, 1994
3 ;Per VHA Directive 97-033 this routine should not be modified. Medical Device # BK970021
4X S X=$E(X,LR,$L(X)),A=$E(X),B=$E(X,$L(X)) Q
5W W ?32,"(Bar code)" Q
6STRIP(X) ; Strip off any ISBT-128 barcode identifier characters
7 S X=$TR(X,"=<>&%(","")
8 Q X
9 ;
10U ;from LRBLDRR, LRBLJLG
11 I $$ISBTUID(.X) Q
12 S X=$$STRIP(X)
13 D X I 'LR(3),X?7N S A=+$E(X,1,2),B=A\20,B=$E("FGKL",B),A=A#20+1,A=$E("CEFGHJKLMNPQRSTVWXYZ",A),A=B_A S X=A_$E(X,3,7)
14 D W W ?45,"UNIT ID: ",X Q
15 Q
16A ;ABO/RH GROUPING
17 N XX ; used to preserve original value to redisplay if invalid
18 D ISBTBG(X,.LRABO,.LRRH)
19 I LRABO]"" D W,EN^DDIOL("ABO/Rh: "_LRABO_" "_LRRH,"","?47") Q
20 S XX=$$STRIP(.X)
21 D X I X?3N,$E(X,3)=0 S A=$T(@(+$E(X,1,2))),X=$P(A,";",3) I X="" K X W XX Q:'$D(X) D W W ?46,"ABO/Rh: ",X S LRABO=$P(X," "),LRRH=$P(X," ",2) Q
22 Q
23P ;PRODUCT CODE
24 I $$ISBTPC(.X) Q
25 S X=$$STRIP(X)
26 D X
27 I X?7N&(A=0!(A=3))&(B=3) D
28 .S X=$E(X,2,6),Y=0
29 .D W,C
30 E W X
31 Q
32C N XX S XX=X K X S X=XX ; need to remove leftover X subnodes!!
33 F A=1:1 S Y=$O(^LAB(66,"D",X,Y)) Q:'Y S X(A)=Y_"^"_^LAB(66,Y,0)
34 I A=2 S W(4)=+X(1),P=$P(X(1),U,2),W(9)=$P(X(1),U,20),LRV=$P(X(1),U,11),LRJ=$P(X(1),U,26),X=P W !?24,P Q
35 W ! S Y=0 F A=0:1 S Y=$O(X(Y)) Q:'Y W !?2,Y,")",?5,$P(X(Y),U,2)
36 I A=0 D K X Q
37 .W !!?28,"Product Code '",X,"' not found."
38 .W !?28,"Please add to the Blood Product File"
39H W !,"CHOOSE 1-",A,": " R X:DTIME I X=""!(X[U) K X Q
40 I X<1!(X>A) W $C(7) G H
41 S W(4)=+X(X),P=$P(X(X),U,2),W(9)=$P(X(X),U,20),LRV=$P(X(X),U,11),LRJ=$P(X(X),U,26),X=P W ?25,P Q
42R ;FDA REG #
43 D X I X?9N&(B=1)&(A=0!(A=1)) S X=$E(X,2,8) D W W !?2,"Registration number: ",X Q
44 Q
45D ;DATE CODE
46 I $$ISBTED(.X) Q
47 S X=$$STRIP(X)
48 D X I X'?6N&(X'?8N) W X Q
49 S %DT="" D ^%DT S W(6)=Y I Y<1 K X Q
50 D D^LRU D W W ?44,"Exp date: ",Y Q
51BAR ;TEST BAR CODE READER
52 S LR="" W !!?28,"To use BAR CODE READER",!?15,"Pass reader wand over a GROUP-TYPE (ABO/Rh) label",! S X=$$READ("=>",25) Q:X=""!(X["^") W " (bar code)"
53 D ISBTBG(X,.LRABO,.LRRH) I LRABO]"" D Q
54 .S LR=1,LR(2)=""
55 .W " ",LRABO," ",LRRH
56 S X=$$STRIP(X)
57 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 LR=$L(X)-3,LR(2)=$E(X,1,LR),LR=LR+1 Q
58 I LR="" W $C(7),!!?28,"Not a GROUP-TYPE label",!?15,"Press <RETURN> key if BAR CODE READER is not used",! G BAR
59 W " ",$P($T(G+A),";",3) K X Q
60 ;
61T ;from LRBLDRR1, LRBLJLG
62 F A=1:1 S Y=$P($T(G+A),";",3) Q:Y="" S:X=$E(Y,1,$L(X)) X(A)=Y
63 I $D(X)'=11 K X D S Q
64 K Y S Y=0 F A=1:1 S Y=$O(X(Y)) Q:'Y S Y(A)=X(Y) K X(Y)
65 I A=2 S LRABO=$P(Y(1)," ",1),LRRH=$P(Y(1)," ",2) W $E(Y(1),$L(X)+1,$L(Y(1))) Q
66 W ! S Y=0 F A=0:1 S Y=$O(Y(Y)) Q:'Y W !?2,Y,")",?5,Y(Y)
67AG W !,"CHOOSE 1-",A,": " R X:DTIME I X=""!(X["^") K X Q
68 I X<1!(X>A) W $C(7) G AG
69 W " ",Y(X) S LRABO=$P(Y(X)," ",1),LRRH=$P(Y(X)," ",2) Q
70S W !!,"Select from (NA=not applicable): " F A=1:1 W !?15,$P($T(G+A),";",3) Q:$T(G+A)=""
71 Q
72 ;
73ISBTUID(LRBLIN) ; Check for and display valid ISBT-128 Unit Id
74 ; Valid codes are prefixed by "="
75 ;
76 ; INPUT : LRBLIN = input from Unit Id barcode label.
77 ; OUTPUT : Boolean
78 ;
79 Q:$E(LRBLIN,1,2)'?1"="1(1A,1N) 0
80 S LRBLIN=$E(LRBLIN,2,14)
81 S LRBLIN=$$UP^XLFSTR(LRBLIN) ; make uppercase
82 D W
83 D EN^DDIOL("UNIT ID: "_LRBLIN,"","?46")
84 Q 1
85 ;
86ISBTBG(IN,LRBLABO,LRBLRH) ; Check for ISBT-128 valid Blood Group
87 ; and return ABO & Rh values
88 ; Valid codes are prefixed by "=%"
89 ;
90 ; INPUT : IN = input from Blood Group barcode label.
91 ; OUTPUT : LRBLABO (passed by reference) = ABO value
92 ; LRBLRH (passed by reference) = Rh value
93 ;
94 S (LRBLABO,LRBLRH)=""
95 Q:$L(IN)'>3
96 Q:$E(IN,1,2)'="=%"
97 S IN=$E(IN,3,4)
98 S LRABO=$S(90<IN&(IN<99):"O NEG",46<IN&(IN<55):"O POS",1<IN&(IN<10):"A NEG",57<IN&(IN<66):"A POS",12<IN&(IN<21):"B NEG",68<IN&(IN<77):"B POS",23<IN&(IN<32):"AB NEG",79<IN&(IN<88):"AB POS",1:"")
99 Q:LRABO=""
100 S LRBLRH=$P(LRBLABO," ",2)
101 S LRBLABO=$P(LRBLABO," ")
102 Q
103 ;
104ISBTPC(LRBLIN) ; Check for and display valid ISBT-128 Product Code
105 ; Valid codes prefixed by "=<"
106 ;
107 ; INPUT : LRBLIN = input from Product Code barcode label
108 ; OUTPUT : Boolean
109 ;
110 Q:$E(LRBLIN,1,2)'="=<" 0
111 S LRBLIN=$E(LRBLIN,3,$L(LRBLIN))
112 S LRBLIN=$$UP^XLFSTR(LRBLIN)
113 S Y=0
114 S X=LRBLIN D W,C
115 ;I A=0 D
116 ;.D EN^DDIOL("Product Code not found.",,"!!?28")
117 ;.D EN^DDIOL("Please add to the Blood Product File",,"!?28")
118 Q 1
119 ;
120ISBTED(LRBLIN) ; Check for and display valid ISBT-128 Expiration Date
121 ; Valid codes are prefixed by "&>"
122 ;
123 ; INPUT : LRBLIN = input from Expiration Date barcode label
124 ; OUTPUT : Boolean
125 ;
126 N X,Y
127 ;
128 Q:$E(LRBLIN,1,2)'="&>" 0
129 S LRBLIN=$E(LRBLIN,3,$L(LRBLIN))
130 S X=$$JULIAN(LRBLIN)
131 Q:'X 0
132 S (W(6),Y)=$P(X,".")_"."_$S($E(LRBLIN,7,10)]"":$E(LRBLIN,7,10),1:"2359")
133 D D^LRU,W
134 S LRBLIN=$E(Y,1,12)_"@"_$E(Y,14,18) ; Set LRBLIN to valid input
135 D EN^DDIOL("Exp date: "_Y,"","?45")
136 Q 1
137 ;
138JULIAN(LRBLJD) ;; Julian Date Conversion
139 ;
140 ; INPUT : LRBLJD = Julian Date (format = CYYDDD)
141 ; If C=9 then 19YY, else 2CYY
142 ; DDD=number of days in year (eg 128 = MAY 8)
143 ; OUTPUT : FileMan date or 0 if invalid
144 ;
145 N X,%H,%T,%Y,%
146 ;
147 ; Put year only into FileMan format
148 S X=$S($E(LRBLJD)="9":1900,1:2000+($E(LRBLJD)*100))
149 S X=X+$E(LRBLJD,2,3)
150 S X=X-1700
151 S X=X_"0101"
152 ; Get $H value of Jan 1st
153 D H^%DTC
154 Q:'%H 0
155 ; Add days to $H value
156 S %H=%H+$E(LRBLJD,4,6)-1
157 ; Put date back into FileMan format
158 D YX^%DTC
159 Q +X
160 ;
161READ(PROMPT,POS) ; This extrinsic function will be used to present a prompt that can receive input from a
162 ; scanner or manual data entry. This function returns the entire value of the input.
163 ;
164 N X
165 S:'$G(POS) POS=0
166 W ?POS,PROMPT
167 R X:DTIME
168 W $C(13),$J("",79),$C(13),$J("",POS),PROMPT
169 Q X
170G ;;
17151 ;;O POS;510
17262 ;;A POS;620
17373 ;;B POS;730
17484 ;;AB POS;840
17595 ;;O NEG;950
1766 ;;A NEG;060
17717 ;;B NEG;170
17828 ;;AB NEG;280
17955 ;;O;550
18066 ;;A;660
18177 ;;B;770
18288 ;;AB;880
183 ;;NA NA;
Note: See TracBrowser for help on using the repository browser.