source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORWLR1.m@ 1310

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

initial load of FOIAVistA 6/30/08 version

File size: 3.4 KB
Line 
1ORWLR1 ; slc/dcm - VBEC Blood Bank Report ;01/16/03 15:02
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**172**;Dec 17, 1997
3 ;Re-write of ^LR7OSBR
4EN(DFN) ;Get Blood Bank Report
5 Q:'$G(DFN)
6 N GCNT,CCNT,GIOSL,GIOM,ORABORH,PATID,PATNAM,PATDOB,ORN
7 S PATID="`"_DFN,PATNAM=$P(^DPT(DFN,0),"^"),PATDOB=$P(^(0),"^",3) ;Why PATNAM and PATDOB???
8 K ^TMP("ORLRC",$J)
9 S GCNT=0,CCNT=1,GIOSL=999999,GIOM=80
10 S ORABORH=$$ABORH^VBECA1(PATID,PATNAM,PATDOB) ;Get ABO/RH
11 S ORN(2.91)="DIRECT AHG TEST COMMENT",ORN(8)="ANTIBODY SCREEN COMMENT"
12 S ORN(10.3)="ABO TESTING COMMENT",ORN(11.3)="RH TESTING COMMENT"
13 D EN^ORWLR2
14 Q
15 ;
16REPORT ;Blood Bank Report for M reports menu
17 Q:'$G(DFN)
18 N DIC,ID,ORDFN,ORY,PAGE,XQORNOD
19 S ORDFN=DFN,ID=2
20 D BLR^ORWRP1(.ORY,.ORDFN,.ID,.ORALPHA,.OROMEGA,.ORDAYSBK,.REMOTE)
21 Q:'$L(ORY)
22 S PAGE=1
23 D HEAD^ORWRPP1(ORDFN,PAGE,"PATIENT BLOOD BANK REPORT",$G(STATION))
24 D HURL^ORWRPP1(.ORY,ORDFN,"PATIENT BLOOD BANK REPORT",,,1)
25 Q
26TEST ;Test calls
27 N ORVP,PATID,PATNAM,PATDOB,LRDFN,ERR,ABORH,ID,ID1,ID2,ARR,GMI,DI2,BPN,VBECERR
28 D EN2^ORUDPA
29 Q:'ORVP
30 K ^TMP("BBD",$J),^TMP("TRRX",$J),^TMP("TRAN",$J)
31 S PATID="`"_+ORVP,PATNAM=ORPNM,PATDOB=$P(^DPT(+ORVP,0),"^",3)
32 D PAT^VBECA1A W !,LRDFN I $O(VBECERR(0)) S ERR=0 F S ERR=$O(VBECERR(ERR)) Q:'ERR W !?5," ERR:"_VBECERR(1)
33 S ABORH=$$ABORH^VBECA1(PATID,PATNAM,PATDOB) W !,"ABO/RH: "_ABORH
34 D ABID^VBECA1(PATID,PATNAM,PATDOB,.PARENT,.ARR) I $O(ARR("ABID",0)) D
35 . W !,"Antibodies Identified: " S ID=0 F S ID=$O(ARR("ABID",ID)) Q:'ID W !?2,ARR("ABID",ID)
36 D TRRX^VBECA1(PATID,PATNAM,PATDOB,.PARENT,.ARR) I $O(ARR("TRRX",0)) D
37 . W !,"Transfusion reactions: " S ID=0 F S ID=$O(ARR("TRRX",ID)) Q:'ID W !?2,ARR("TRRX",ID)
38 D DFN^VBECA3A(DFN),CPRS^VBECA3B
39 I $O(^TMP("BBD",$J,"CROSSMATCH",0)) D
40 . W !,"Crossmatched Units: " S ID=0 F S ID=$O(^TMP("BBD",$J,"CROSSMATCH",ID)) Q:'ID W !?2,^(ID)
41 I $O(^TMP("BBD",$J,"COMPONENT REQUEST",0)) D
42 . W !,"Component request: " S ID=0 F S ID=$O(^TMP("BBD",$J,"COMPONENT REQUEST",ID)) Q:'ID W !?2,^(ID) D
43 .. S ID1=0 F S ID1=$O(^TMP("BBD",$J,"COMPONENT REQUEST",ID,ID1)) Q:'ID1 W !,"."_^(ID1)
44 D TRAN^VBECA4(+ORVP,"TRAN")
45 I $O(^TMP("TRAN",$J,0)) D
46 . N ID,GMR,GMA
47 . W !,"Transfused Units: ",! S ID=0
48 . F S ID=$O(^TMP("TRAN",$J,ID)) Q:'ID S GMR=^(ID) D
49 .. D PARSE,WRT
50 . I $O(^TMP("TRAN",$J,"A"))'="" D
51 .. W !
52 .. W " Blood Product Key: "
53 . S GMI="A" F S GMI=$O(^TMP("TRAN",$J,GMI)) Q:GMI="" D
54 .. W ?21,GMI," = ",$G(^TMP("TRAN",$J,GMI)),!
55 I $O(^TMP("BBD",$J,"SPECIMEN",0)) D
56 . W !,"Specimen: " S ID=0 F S ID=$O(^TMP("BBD",$J,"SPECIMEN",ID)) Q:'ID W !?2,^(ID) D
57 .. S ID1=0 F S ID1=$O(^TMP("BBD",$J,"SPECIMEN",ID,ID1)) Q:'ID1 W:$D(^(ID1))#2 !,"."_^(ID1) D
58 ... S ID2=0 F S ID2=$O(^TMP("BBD",$J,"SPECIMEN",ID,ID1,ID2)) Q:'ID2 W:$D(^(ID2))#2 !,".."_^(ID2)
59 K ^TMP("BBD",$J),^TMP("TRRX",$J),^TMP("TRAN",$J)
60 Q
61PARSE ;Parse Record
62 N GMI,X S TD=$$FMTE^XLFDT(+GMR)
63 S GMA(1)=$P(GMR,U,2),BPN=$L(GMA(1),";")
64 I $P(GMA(1),";",BPN)="" S BPN=BPN-1
65 F GMI=2:1:BPN S GMA(GMI)="("_$P($P(GMA(1),";",GMI),"\")_") "_$P($P(GMA(1),";",GMI),"\",2)
66 S GMA(1)="("_$P($P(GMA(1),";",1),"\")_") "_$P($P(GMA(1),";",1),"\",2)
67 Q
68WRT ; Writes the Transfusion Record for each day
69 N GML,GMI1,GMI2,GMM,GMJ
70 S GMM=$S(BPN#4:1,1:0),GML=BPN\4+GMM
71 W TD
72 F GMI1=1:1:GML D
73 . F GMI2=1:1:($S((GMI1=GML)&(BPN#4):BPN#4,1:4)) D
74 .. S GMJ=((GMI1-1)*4)+GMI2
75 .. W ?(((GMI2-1)*15)+13),GMA(GMJ)
76 .. I $S(GMI2#4=0:1,GMI2=BPN:1,GMI2+(4*(GMI1-1))=BPN:1,1:0) W !
77 Q
Note: See TracBrowser for help on using the repository browser.