1 | ORWGAPIB ; SLC/STAFF - Graph Blood Bank ;12/21/05 08:21
|
---|
2 | ;;3.0;ORDER ENTRY/RESULTS REPORTING;**215**;Dec 17, 1997
|
---|
3 | ;
|
---|
4 | BBITEM(ITEMS,DFN,FMT,OLDEST,NEWEST,CNT,TMP) ; from ORWGAPIR
|
---|
5 | N DATE,IDATE,INEWEST,IOLDEST,ITEM,LRDFN,OK,RESULT
|
---|
6 | K ^TMP("ORWGRPC TEMP",$J)
|
---|
7 | S INEWEST=$$LRIDT^ORWGAPIA(NEWEST),IOLDEST=$$LRIDT^ORWGAPIA(OLDEST)
|
---|
8 | S LRDFN=$$LRDFN^ORWGAPIA(DFN)
|
---|
9 | S IDATE=0
|
---|
10 | F S IDATE=$O(^LR(LRDFN,1.6,IDATE)) Q:IDATE<1 D
|
---|
11 | . S ITEM=+$P($G(^LR(LRDFN,1.6,IDATE,0)),U,2)
|
---|
12 | . I 'ITEM Q
|
---|
13 | . S OK=0
|
---|
14 | . I FMT=6 D
|
---|
15 | .. Q:IDATE<INEWEST Q:IDATE>IOLDEST
|
---|
16 | .. S OK=1
|
---|
17 | .. S CNT=CNT+1
|
---|
18 | .. S RESULT="63BB"_U_ITEM
|
---|
19 | . I FMT=3 D
|
---|
20 | .. I '$D(^TMP("ORWGRPC TEMP",$J,ITEM)) D
|
---|
21 | ... S OK=1
|
---|
22 | ... S ^TMP("ORWGRPC TEMP",$J,ITEM)=""
|
---|
23 | ... S DATE=$$LRIDT^ORWGAPIA(IDATE)
|
---|
24 | ... S CNT=CNT+1
|
---|
25 | ... S RESULT="63BB^"_ITEM_"^^"_$P($G(^LAB(66,ITEM,0)),U)_"^^"_DATE
|
---|
26 | . I FMT=0 D
|
---|
27 | .. S OK=1
|
---|
28 | .. S CNT=CNT+1
|
---|
29 | .. S RESULT="63BB^"_ITEM_U_$P($G(^LAB(66,ITEM,0)),U)
|
---|
30 | . I OK D SETUP^ORWGAPIU(.ITEMS,RESULT,TMP,.CNT)
|
---|
31 | K ^TMP("ORWGRPC TEMP",$J)
|
---|
32 | Q
|
---|
33 | ;
|
---|
34 | BBDATA(DATA,ITEM,START,DFN,CNT,TMP) ; from ORWGAPIR
|
---|
35 | N DATE,IDATE,LRDFN,NITEM,RESULT
|
---|
36 | S LRDFN=$$LRDFN^ORWGAPIA(DFN)
|
---|
37 | S IDATE="",CNT=$G(CNT)
|
---|
38 | F S IDATE=$O(^LR(LRDFN,1.6,IDATE)) Q:IDATE="" D
|
---|
39 | . S NITEM=+$P($G(^LR(LRDFN,1.6,IDATE,0)),U,2)
|
---|
40 | . I NITEM'=ITEM Q
|
---|
41 | . S DATE=$$LRIDT^ORWGAPIA(IDATE)
|
---|
42 | . I DATE>START Q
|
---|
43 | . S RESULT="63BB^"_ITEM_U_DATE_U
|
---|
44 | . D SETUP^ORWGAPIU(.DATA,RESULT,TMP,.CNT)
|
---|
45 | Q
|
---|
46 | ;
|
---|
47 | BBX(DFN) ; $$(dfn) -> 1 if patient has blood bank data ,else 0
|
---|
48 | Q $L($O(^LR(+$$LRDFN^ORWGAPIA($G(DFN)),1.6,"")))>0
|
---|
49 | ;
|
---|