[613] | 1 | ORWDXVB1 ;slc/dcm - Order dialog utilities for Blood Bank Cont.;3/2/04 09:31 ;12/7/05 17:20
|
---|
| 2 | ;;3.0;ORDER ENTRY/RESULTS REPORTING;**215,243**;Dec 17 1997;Build 242
|
---|
| 3 | ;
|
---|
| 4 | PTINFO ;Format patient BB info
|
---|
| 5 | N GCNT,CCNT,GIOSL,GIOM,I,TYPE,ORUA,VBERROR,ABFND,LINE1,LINE2,NOABO,NOPAT,TREQFND
|
---|
| 6 | S (GCNT,NOPAT,NOABO)=0,CCNT=1,GIOSL=999999,GIOM=80
|
---|
| 7 | S OROOT=$NA(^TMP("ORVBEC",$J))
|
---|
| 8 | K ^TMP("ORVBEC",$J)
|
---|
| 9 | ;
|
---|
| 10 | I +$G(ORX("ERROR")) D ERROR^ORWDXVB2 Q
|
---|
| 11 | ; Patient Demographics
|
---|
| 12 | D LN
|
---|
| 13 | I '$D(ORX("PATIENT")) D Q
|
---|
| 14 | . D LINE^ORU4("^TMP(""ORVBEC"",$J)",GIOM),LN
|
---|
| 15 | . S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(10,CCNT,"There is no previous record of this patient in VBECS.",.CCNT) Q
|
---|
| 16 | ;
|
---|
| 17 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT,"Name",.CCNT)_$$S^ORU4(27,CCNT,"SSN",.CCNT)_$$S^ORU4(42,CCNT,"ABO/Rh",.CCNT)
|
---|
| 18 | D LN
|
---|
| 19 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT,"----",.CCNT)_$$S^ORU4(27,CCNT,"---",.CCNT)_$$S^ORU4(42,CCNT,"------",.CCNT) D
|
---|
| 20 | . D LN
|
---|
| 21 | . S X=ORX("PATIENT"),^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT,$P(X,"^",3)_", "_$P(X,"^",2),.CCNT)_$$S^ORU4(27,CCNT,$P(X,"^",4),.CCNT)
|
---|
| 22 | . I $P(ORX("ABORH"),"^")']"" S ^TMP("ORVBEC",$J,GCNT,0)=^TMP("ORVBEC",$J,GCNT,0)_$$S^ORU4(42,CCNT,"unknown",.CCNT) Q
|
---|
| 23 | . S X=ORX("ABORH"),^TMP("ORVBEC",$J,GCNT,0)=^TMP("ORVBEC",$J,GCNT,0)_$$S^ORU4(42,CCNT,$$STRIP^XLFSTR($P(X,"^")," ")_" "_$S($$STRIP^XLFSTR($P(X,"^",2)," ")="P":"Pos",$$STRIP^XLFSTR($P(X,"^",2)," ")="N":"Neg",1:"unknown"),.CCNT) Q
|
---|
| 24 | D LINE^ORU4("^TMP(""ORVBEC"",$J)",GIOM),LN
|
---|
| 25 | D LINE^ORU4("^TMP(""ORVBEC"",$J)",GIOM),LN
|
---|
| 26 | ;
|
---|
| 27 | ; Available Specimens
|
---|
| 28 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT,"Lab Specimen ID",.CCNT)_$$S^ORU4(27,CCNT,"Expiration Date",.CCNT)
|
---|
| 29 | D LN
|
---|
| 30 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT,"----------------------",.CCNT)_$$S^ORU4(27,CCNT,"---------------",.CCNT) D
|
---|
| 31 | . I '$D(ORX("SPECIMEN")) D LN S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT," none",.CCNT) Q
|
---|
| 32 | . D LN
|
---|
| 33 | . S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(2,CCNT,$P(ORX("SPECIMEN"),"^",2),.CCNT)_$$S^ORU4(27,CCNT,$$DATETIME^ORCHTAB($P(ORX("SPECIMEN"),"^")),.CCNT) Q
|
---|
| 34 | D LINE^ORU4("^TMP(""ORVBEC"",$J)",GIOM),LN
|
---|
| 35 | D LINE^ORU4("^TMP(""ORVBEC"",$J)",GIOM),LN
|
---|
| 36 | ;
|
---|
| 37 | ; Antibodies Identified section
|
---|
| 38 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT,"Antibodies Identified",.CCNT)
|
---|
| 39 | D LN
|
---|
| 40 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT,"---------------------",.CCNT) D
|
---|
| 41 | . I '$O(ORX("ABHIS",0)) D LN S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT," none",.CCNT) Q
|
---|
| 42 | . D LN
|
---|
| 43 | . S ABFND=0
|
---|
| 44 | . S I=0 F S I=$O(ORX("ABHIS",I)) Q:I<1 D
|
---|
| 45 | . . S X=ORX("ABHIS",I)
|
---|
| 46 | . . I ABFND S ^TMP("ORVBEC",$J,GCNT,0)=^TMP("ORVBEC",$J,GCNT,0)_$$S^ORU4(2,CCNT,", "_$P(X,"^"),.CCNT) Q
|
---|
| 47 | . . S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(2,CCNT,$P(X,"^"),.CCNT),ABFND=1
|
---|
| 48 | D LINE^ORU4("^TMP(""ORVBEC"",$J)",GIOM),LN
|
---|
| 49 | D LINE^ORU4("^TMP(""ORVBEC"",$J)",GIOM),LN
|
---|
| 50 | ;
|
---|
| 51 | ; Transfusion Requirements section
|
---|
| 52 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT,"Transfusion Requirements",.CCNT)
|
---|
| 53 | D LN
|
---|
| 54 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT,"------------------------",.CCNT) D
|
---|
| 55 | . I '$O(ORX("TRREQ",0)) D LN S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT," none",.CCNT) Q
|
---|
| 56 | . D LN
|
---|
| 57 | . S TREQFND=0
|
---|
| 58 | . S I=0 F S I=$O(ORX("TRREQ",I)) Q:I<1 D
|
---|
| 59 | . . S X=ORX("TRREQ",I)
|
---|
| 60 | . . I TREQFND S ^TMP("ORVBEC",$J,GCNT,0)=^TMP("ORVBEC",$J,GCNT,0)_$$S^ORU4(2,CCNT,", "_X,.CCNT) Q
|
---|
| 61 | . . S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(2,CCNT,X,.CCNT),TREQFND=1
|
---|
| 62 | D LINE^ORU4("^TMP(""ORVBEC"",$J)",GIOM),LN
|
---|
| 63 | D LINE^ORU4("^TMP(""ORVBEC"",$J)",GIOM),LN
|
---|
| 64 | ;
|
---|
| 65 | ; Transfusion Reactions section
|
---|
| 66 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT,"Transfusion Reactions",.CCNT)_$$S^ORU4(27,CCNT,"Date/Time",.CCNT)
|
---|
| 67 | D LN
|
---|
| 68 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT,"---------------------",.CCNT)_$$S^ORU4(27,CCNT,"---------",.CCNT) D
|
---|
| 69 | . I '$O(ORX("TRHX",0)) D LN S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT," none",.CCNT) Q
|
---|
| 70 | . S I=0 F S I=$O(ORX("TRHX",I)) Q:I<1 D
|
---|
| 71 | . . D LN
|
---|
| 72 | . . S X=ORX("TRHX",I),^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(2,CCNT,$P(X,"^"),.CCNT)_$$S^ORU4(27,CCNT,$$DATETIME($P(X,"^",2)),.CCNT)
|
---|
| 73 | D LINE^ORU4("^TMP(""ORVBEC"",$J)",GIOM),LN
|
---|
| 74 | D LINE^ORU4("^TMP(""ORVBEC"",$J)",GIOM),LN
|
---|
| 75 | ;
|
---|
| 76 | ; New Units section
|
---|
| 77 | N INDEX,UNT,ORY,I,CNT,J,K,L,M,X
|
---|
| 78 | S CNT=0
|
---|
| 79 | F INDEX="A","D","C","S" I $O(ORX("UNIT",INDEX,0)) D ; A:Autologous D:Directed C:Crossmatched A:Assigned
|
---|
| 80 | . S I=0 F S I=$O(ORX("UNIT",INDEX,I)) Q:I<1 D
|
---|
| 81 | .. S X=ORX("UNIT",INDEX,I),CNT=CNT+1,ORY("~"_$P(X,"^"),"~"_$P(X,"^",2),"~"_INDEX,"~"_$P(X,"^",4),CNT)=X
|
---|
| 82 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT,"Units Available",.CCNT)
|
---|
| 83 | D LN
|
---|
| 84 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(1,CCNT,"---------------",.CCNT)
|
---|
| 85 | D LN
|
---|
| 86 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(2,CCNT,"Unit ID",.CCNT)_$$S^ORU4(13,CCNT,"Component",.CCNT)_$$S^ORU4(27,CCNT,"Status",.CCNT)_$$S^ORU4(42,CCNT,"Exp Date",.CCNT)_$$S^ORU4(58,CCNT,"Division",.CCNT)
|
---|
| 87 | D LN
|
---|
| 88 | S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(2,CCNT,"-------",.CCNT)_$$S^ORU4(13,CCNT,"---------",.CCNT)_$$S^ORU4(27,CCNT,"------",.CCNT)_$$S^ORU4(42,CCNT,"--------",.CCNT)_$$S^ORU4(58,CCNT,"--------",.CCNT)
|
---|
| 89 | S I="" F S I=$O(ORY(I)) Q:I="" S J="" F S J=$O(ORY(I,J)) Q:J="" S K="" F S K=$O(ORY(I,J,K)) Q:K="" S L="" F S L=$O(ORY(I,J,K,L)) Q:L="" S M="" F S M=$O(ORY(I,J,K,L,M)) Q:M="" D LN D
|
---|
| 90 | . S X=ORY(I,J,K,L,M),INDEX=$E(K,2),UNT=$S(INDEX="A":"Autologous",INDEX="D":"Directed",INDEX="C":"Crossmatched",INDEX="S":"Assigned",1:"Unknown")
|
---|
| 91 | . S ^TMP("ORVBEC",$J,GCNT,0)=$$S^ORU4(2,CCNT,$P(X,"^"),.CCNT)_$$S^ORU4(13,CCNT,$P(X,"^",2),.CCNT)_$$S^ORU4(27,CCNT,UNT,.CCNT)_$$S^ORU4(42,CCNT,$$DATETIME($P(X,"^",4)),.CCNT)_$$S^ORU4(58,CCNT,$P(X,"^",3),.CCNT)
|
---|
| 92 | Q
|
---|
| 93 | LN ;Increment counts
|
---|
| 94 | S GCNT=GCNT+1,CCNT=1
|
---|
| 95 | Q
|
---|
| 96 | DATETIME(X) ; -- Return external form of YYYYMMDDHHNNSS date
|
---|
| 97 | N Y S Y=$$HL7TFM^XLFDT(X),Y=$$DATETIME^ORCHTAB(Y)
|
---|
| 98 | Q Y
|
---|