source: WorldVistAEHR/trunk/r/SURGERY-SR/SRBLOOD.m@ 834

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

initial load of WorldVistAEHR

File size: 4.2 KB
Line 
1SRBLOOD ;B'HAM ISC/MM,SM - BLOOD PRODUCT VERIFICATION ;08/11/05
2 ;;3.0; Surgery ;**74,85,101,148**;24 Jun 93
3 ;
4 ; References to ^LRD(65 supported by DBIA #2331-A
5 ; References to ^LR( supported by DBIA #894 and 252-B
6 ; References to ^LAB(66 supported by DBIA #210
7 ; Reference to BAR^LRBLB supported by DBIA #2331-B
8 ; Reference to ^LRBLBU supported by DBIA #2333
9 ; Reference to VBECA1B supported by DBIA #4629
10 ;
11 S X="VBECA1B" X ^%ZOSF("TEST") I $T D ^SRBL Q ; check if VBECS installed
12SCAN D BAR^LRBLB ; scan UNIT ID before VBECS
13 ;obtain the LRDFN from the patient's DFN
14 S SRDFN=$P($G(^DPT($P(^SRF(SRTN,0),"^"),"LR")),"^")
15 I SRDFN="" G SRNO
16 K DIR S DIR(0)="F^1:50",DIR("A")="Enter Blood Product Identifier",DIR("?")="Enter or scan the Blood Product Unit Id" D ^DIR G END:$D(DIRUT)
17 W ! D ^LRBLBU S SRUNIT=$G(X) I SRUNIT="" G SRNO
18 ;if patient is not on the "AP" 'DO NOT Give' (no display)
19 I '$O(^LRD(65,"AP",SRDFN,0)) G SRNO
20 I '$O(^LRD(65,"B",SRUNIT,0)),('$O(^LRD(65,"C",SRUNIT,0))) G SRNO
21 S (SRIEN,SRICNT,SROCNT,SROK)=0 F S SRIEN=$O(^LRD(65,"B",SRUNIT,SRIEN)) Q:'SRIEN S SROCNT=SROCNT+1,SRO(SROCNT)=SRIEN
22 S (SRIEN)=0 F S SRIEN=$O(^LRD(65,"C",SRUNIT,SRIEN)) Q:'SRIEN S SROCNT=SROCNT+1,SRO(SROCNT)=SRIEN
23 S (SRLRD,SRICNT)=0 F SRZ=1:1:SROCNT D
24 .;S SRIEN=SRO(SRZ) I '$O(^LRD(65,SRIEN,2,0)) S SRICNT=SRICNT+1,SRB(SRICNT)=SRIEN_"^"_0 Q ;checks for "No date/time unit assigned"
25 .S SRIEN=SRO(SRZ) I '$O(^LRD(65,SRIEN,2,0)) Q
26 .S SRLRD=0 F S SRLRD=$O(^LRD(65,SRIEN,2,SRLRD)) Q:'SRLRD D
27 ..Q:'$D(^LRD(65,"AP",SRLRD,SRIEN))
28 ..S SRICNT=SRICNT+1,SRB(SRICNT)=SRIEN_"^"_SRLRD
29 ..I SRLRD=SRDFN S SROK=1
30 I '$D(SROK) G SRNO
31 ;look through the list of patients assigned to the unit id for selected patient
32 S (SRC2,SRFLAG)=0 F SRZ=1:1:SRICNT D
33 .I SRC2=SROCNT Q
34 .I SRZ=SRICNT,(SRFLAG=0) S SRD(SRC2+1)=SRB(SRZ) Q
35 .I SRZ=SRICNT,(SRFLAG=1) Q
36 .I $P(SRB(SRZ),"^",2)=SRDFN S SRFLAG=1,SRC2=SRC2+1,SRD(SRC2)=SRB(SRZ)
37 .I $P(SRB(SRZ),"^")=$P(SRB(SRZ+1),"^") Q
38 .I SRFLAG=1 S SRFLAG=0 Q
39 .I SRFLAG=0 S SRC2=SRC2+1,SRD(SRC2)=SRB(SRZ)
40 ;
41 ;create the display
42 I '$D(SRD) G SRNO
43 ;if selected patient is assigned to each unit id, no display necessary
44 S SRI="",(SRDS,SRDSP,SRFLAG,SRNODT,SREXP)=0 F S SRI=$O(SRD(SRI)) Q:SRI="" D
45 .I $P(SRD(SRI),"^",2)'=SRDFN S SRDSP=1
46 .;I $D(^LRD(65,"AP",$P(SRD(SRI),"^",2),$P(SRD(SRI),"^")))
47 .;E S SRDS=1,SRD(SRI)=SRD(SRI)_"^"_" **NO DATE/TIME UNIT ASSIGNED **",SRNODT=1
48 .S DFN=$P(SRD(SRI),"^",2)
49 .I DFN'=0 S DFN=$P(^LR(DFN,0),"^",3) D DEM^VADPT S $P(SRD(SRI),"^",6)=VADM(1)_" "_VA("PID")
50 .I DFN=0 S $P(SRD(SRI),"^",6)="Not Assigned"
51 .S SRIEN=$P(SRD(SRI),"^"),SRUNIT=$P(SRD(SRI),"^"),(Y,Z)=$P($G(^LRD(65,SRIEN,0)),"^",6) I Y'="" X ^DD("DD") S $P(SRD(SRI),"^",5)=Y I Z<DT S $P(SRD(SRI),"^",4)="Today's date exceeds the blood product expiration date.",SREXP=1
52 I SRDSP=0,(SRDS=0) I SRNODT=0,(SREXP=0) G SRYES
53 I SROCNT=1,$D(SROK) S Y=1 G CHECKS
54 S SRI="",SRZ=0 F S SRI=$O(SRD(SRI)) Q:SRI="" D
55 .S SRZ=SRZ+1,SRIEN=$P(SRD(SRI),"^"),SRUNIT=$P(^LRD(65,SRIEN,0),"^")
56 .W !!," ",SRI_")"," Unit ID: ",SRUNIT,?45,$P(^LAB(66,$P(^LRD(65,SRIEN,0),"^",4),0),"^")
57 .W !,?4,"Patient: ",$P(SRD(SRI),"^",6),?45,"Expiration Date: ",?40,$P(SRD(SRI),"^",5)
58 .I $P(SRD(SRI),"^",3)'="" W !,$P(SRD(SRI),"^",3)
59 W ! K DIR S DIR(0)="NO^1:"_SRZ,DIR("A")="Select the blood product matching the unit label" D ^DIR K DIR I $D(DTOUT)!$D(DUOUT)!'Y G END
60CHECKS I $P(SRD(Y),"^",2)'=SRDFN G SRNO
61 I $P(SRD(Y),"^",4)'="" S SRFLAG=1 W !!," **WARNING**",!!,$P(SRD(Y),"^",4),!
62 ;I $P(SRD(Y),"^",3)["**NO DATE" S SRFLAG=1 W !!," There is no 'DATE/TIME Unit Assigned' for this entry."
63 I SRFLAG=1 G ASK
64SRYES W !!!,?25,"No Discrepancies Found",!!! K DIR S DIR(0)="FOA",DIR("A")="Press RETURN to continue" D ^DIR G END
65SRNO W !!,?30,"**WARNING**",!!
66 W ?5,"There is no record that this unit has been assigned to this patient."
67 W !!,?8," Please recheck the patient and blood product IDs.",!!
68ASK K DIR S DIR(0)="Y",DIR("A")="Do you want to scan another product (Y/N)",DIR("B")="YES" D ^DIR
69END K SRC2,SRDFN,SRFLAG,SRICNT,SROCNT,SRZ,SRDSP,SRBLOOD,SRB,SRO,SRD,SRDS,SROK,SRIEN,SRLRD,SRUNIT,SRNODT,SREXP,SRI
70 I Y=1 G SCAN
71 Q
72AUDIT S L=0,DIC=19.081,FLDS="[XUOPTLOGP]",BY="[SR BLOOD PRODUCT VERIFICATION]" D EN1^DIP
73 Q
74PAGE I $E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR
75 W @IOF
76 Q
Note: See TracBrowser for help on using the repository browser.