source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRBLU.m@ 841

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

initial load of WorldVistAEHR

File size: 4.4 KB
Line 
1LRBLU ;AVAMC/REG/CYM - BB UTIL ;1/22/97 15:32 ;
2 ;;5.2;LAB SERVICE;**97,90,247**;Sep 27, 1994
3 ;Per VHA Directive 97-033 this routine should not be modified. Medical Device # BK970021
4 ;
5 K:$L(X)<6!($L(X)>11)!(X'?.UN) X ;input trans ^DD(65.54,4,
6 I $D(X),$D(^LRE("C",X)) S W=X(1)+50000 F Y=0:0 Q:'$D(X) S Y=$O(^LRE("C",X,Y)) Q:'Y K:'$D(^LRE(Y,0)) ^LRE("C",X,Y) I $D(^LRE("C",X,Y)) D I
7 Q:'$D(X) I $D(^LRD(65,"B",X))!($D(^LRD(65,"C",X))) W $C(7),!?15,"INVENTORY FILE HAS AN ENTRY WITH SAME ID ! " D O
8 Q
9I F Z=0:0 S Z=$O(^LRE("C",X,Y,Z)) Q:'Z I Z<W W !,$C(7),X," assigned to ",$P(^LRE(Y,0),U) K X Q
10 Q
11 ;
12F Q:X="" S X=$P($P(B,X_":",2),";") Q
13S ;sets C-xref in FILE 65
14 S Y=^LRD(65,DA,0),S=$P(Y,U,2),C=$P(Y,U,4),A=$P(Y,U) I C,S]"" S Y=$O(^LAB(66,C,"SU","B",S,0)) S:Y Y=$L($P(^LAB(66,C,"SU",Y,0),U,10)) S:Y ^LRD(65,"C",$E(A,Y+1,$L(A)),DA)=""
15 Q
16K ;Kill C-xref in FILE 65
17 S LR("DEAD")=0
18 S A="" F S A=$O(^LRD(65,"C",A)) Q:A=""!(LR("DEAD")) I $D(^LRD(65,"C",A,DA)) K ^LRD(65,"C",A,DA) S LR("DEAD")=1
19 K LR("DEAD")
20 Q
21KK S Y=^LRD(65,DA,0),S=$P(Y,U,2),C=$P(Y,U,4),A=LR(65,.01)
22 I C,S]"" D
23 . S Y=$O(^LAB(66,C,"SU","B",S,0))
24 . S:Y Y=$L($P(^LAB(66,C,"SU",Y,0),U,10))
25 I Y K ^LRD(65,"C",$E(A,Y+1,$L(A)),DA) Q
26 Q
27S1 I 1
28 Q
29K1 ;Kill AG x-ref DD(65,4.1,1,
30 S A=^LRD(65,DA,6),Z=$P(A,U,4),A=+A
31 I A,Z D
32 . S B=+$P($G(^LR(A,1.6,Z,0)),U,11)
33 . K ^LRD(65,"AB",$E(X,1,30),DA)
34 . K ^LRD(65,DA,4),^(5),^(6),^(7),^LR(A,1.6,Z),^LR("AB",A,B,Z)
35 . I $D(^LR(A,1.6,0)) S A=^(0),Z=$O(^(0)),^(0)=$P(A,U,1,2)_U_Z_U_$S('Z:Z,1:($P(A,U,4)-1))
36 Q
37A ;Makes change to ^LRD(65,"AP" & date unit assigned if necessary
38 I X'="C",X'="IG" K ^LRD(65,"AP",DA(1),DA(2)) S $P(^LRD(65,DA(2),2,DA(1),0),U,2)="" Q
39 S ^LRD(65,"AP",DA(1),DA(2))="",X(1)=$P(^LRD(65,DA(2),2,DA(1),0),U,2) I 'X(1) S LR=X,X="N",%DT="T" D ^%DT S X=LR,$P(^LRD(65,DA(2),2,DA(1),0),U,2)=Y
40 Q
41EN ;
42 F A=0:0 S A=$O(^LRD(65,"B",X,A)) Q:'A I $D(LR)#2,$D(^LRD(65,A,0)),$P(^(0),U,4)=LR W $C(7),!,"UNIT IN INVENTORY - EDIT TRANSFUSION DATA THERE !" K X Q
43 Q ;input transform ^DD(63.017,.03,0)
44EN1 ;
45 S (DIC,DIE)="^LAB(61.3,"
46 S X=0 F X(1)=0:0 S X=$O(^LAB(61.3,"B","D",X)) Q:'X I X,^(X)="" Q
47 I X S (LRB,DA)=X,DR="2///50710" D ^DIE G END
48 S X="D",DIC(0)="ML",DLAYGO=61 D ^DIC K DIC
49 S DA=+Y,DR="2///50710" D ^DIE S LRB=$O(^LAB(61.3,"C",50710,0))
50 K DLAYGO
51 ;
52EN2 ;called by TRANSFUSION entry in EXECUTE CODE file
53 S X="N",%DT="T" D ^%DT S X1=Y,X2=-3 D C^%DTC S X=9999999-X
54 S A=0 F B=1:1 S A=$O(^LR(LRDFN,"BB",A)) Q:'A!(A>X) W:B=1 $C(7),!,"Specimen(s) received within past 72 hrs:" S Z=^(A,0),Y=+Z D DT^LRU W !,Y,?18,$P(Z,U,6)
55 Q
56EN3 ;delete user print list for transfusion & hematology data
57 D OUT
58 S X="BLOOD BANK" D ^LRUTL
59 G:'LRAA OUT
60 I '$D(^LRO(69.2,LRAA,7,0)) W $C(7),!!,"There are no user lists." G OUT
61 S (DIC,DIE)="^LRO(69.2,LRAA,7,",DIC(0)="AEQM" D ^DIC K DIC G:Y<1 OUT
62 S DA=+Y,DA(1)=LRAA,DR=.01 D ^DIE G EN3
63D S X=$O(^LAB(69.9,1,8,"B","DONOR",0)) I 'X W $C(7),"Must define blood bank site parameters using option:",!?3,"Edit blood bank site parameters [LRBLSSP] under the Supervisor menu" K X Q
64 S X=^LAB(69.9,1,8,X,0),LRH(2)=$P(X,U,3),LRH(3)=$P(X,U,4) I LRH(2)=""!(LRH(3)="") W $C(7),!!,"Must enter second and third defaults for DONOR using:",!?3,"Edit blood bank site parameters [LRBLSSP] under the Supervisor menu" K X Q
65 S LRH(17)=+$P(X,U,6),LRH(20)=+$P(X,U,7) Q
66OUT D V^LRU Q
67O ;enter old donor unit (CAUTION: This unit is in inventory)
68 I '$D(LRD("U")) K X Q
69 W !!,"Do you still want to enter this unit in the donor file " S %=2 D YN^LRU I %=1 W !,"Ok, done." Q
70 K X Q
71P ;from DD(63.01, input transforms for fields 6.1 to 6.4
72 Q:'$D(^LR(LRDFN,"BB",LRI,A,X))&('$D(^LR(LRDFN,B,X)))
73 W !!,$P(^LAB(61.3,X,0),U)," antigen cannot be present & absent.",! K ^LR(LRDFN,"BB",LRI,C,X) S X=^LR(LRDFN,"BB",LRI,C,0),X(1)=$O(^(0)),^(0)=$P(X,U,1,2)_U_X(1)_U_$S('X(1):"",1:($P(X,U,4)-1)) K X Q
74B ;
75 S X="T",%DT="" D ^%DT,D^LRU S LRH=Y
76 S %DT="AETX",%DT(0)="-N",%DT("A")="Start with Date TODAY// " D ^%DT K %DT I X="" S Y=DT W LRH
77 Q:Y<1 S LRSDT=Y
78 S %DT="AETX",%DT("A")="Go to Date TODAY// " D ^%DT K %DT I X="" S Y=DT W LRH
79 Q:Y<1 S LRLDT=Y I LRSDT>LRLDT S X=LRSDT,LRSDT=LRLDT,LRLDT=X
80 S Y=LRSDT D D^LRU S LRSTR=Y,Y=LRLDT D D^LRU S LRLST=Y K LRH Q
81DT W ! S %DT("A")="Date/time work completed: NOW// ",%DT="AEQTX",%DT(0)="-N" D ^%DT K %DT I X[U!(Y>1&(Y'[".")) W $C(7),!?35,"Not allowed, enter date and time.",!?35,"Future times not allowed." G DT
82 I Y<1 S X="N",%DT="EQTX" D ^%DT K %DT
83 S LRK=Y W ! Q
84 ;
85END K DIC,DIE,DR,DA Q
Note: See TracBrowser for help on using the repository browser.