source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LR7OB1.m@ 823

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

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1LR7OB1 ;slc/dcm - Build message, backdoor Lab from file 69 ;8/11/97
2 ;;5.2;LAB SERVICE;**121,187,238**;Sep 27, 1994
3 ;
4NEW(ODT,SN,CONTROL,NAT,TESTS,LRSTATI) ;Set-up order message
5 ;Need ODT & SN of entry in ^LRO(69,ODT,1,SN)
6 ;CONTROL=Order Control (SN=new order)
7 ;NAT=Nature of order
8 ;TESTS=Array of tests to be updated (optional). If this array is not included then all tests for the LRSN entry will be updated/included
9 ;LRSTATI=Status of order (ptr to ^ORD(100.01,IFN))
10 Q:'$L($T(MSG^XQOR))
11 Q:'$D(^LRO(69,$G(ODT),1,$G(SN),0)) N LRX0 S LRX0=^(0)
12 I $$VER^LR7OU1>2.5,'$G(^ORD(100.99,1,"CONV")) N Y,DFN,LRDPF S Y=$G(^LR(+LRX0,0)),DFN=$P(Y,"^",3),LRDPF=$P(Y,"^",2)_$G(^DIC(+$P(Y,"^",2),0,"GL")) D
13 . Q:'$D(^ORD(100.99,1,"PTCONV",DFN))
14 . S $P(^LRO(69,ODT,1,SN,0),"^",11)=1 ;Keeps this order from being converted
15 . D EN^LR7OV2(DFN_";"_$P(LRDPF,"^",2),1)
16 Q:$P($G(^LR(+LRX0,0)),"^",2)'=2 ;Only allow messages for patients (file 2)
17 N MSG,ORCHMSG,ORBBMSG,ORAPMSG,I,LRNIFN,LRTMPO
18 K ^TMP("LRAP",$J),^TMP("LRCH",$J),^TMP("LRBB",$J)
19 D ORD1(ODT,SN,.TESTS)
20 I '$D(LRTMPO("LRIFN")) D EN1^LR7OB0(ODT,SN,CONTROL,$G(NAT)),CALL(CONTROL) K ^TMP("LRAP",$J),^TMP("LRCH",$J),^TMP("LRBB",$J) Q
21 S LRNIFN=0 F S LRNIFN=$O(LRTMPO("LRIFN",LRNIFN)) Q:LRNIFN<1 S X=LRTMPO("LRIFN",LRNIFN) D
22 . I $P(X,"^",7)="P" Q ;Test purged from CPRS
23 . I $L($P(X,"^",14)) N ODT,SN D Q
24 .. S ODT=+$P(X,"^",14),SN=$P($P(X,"^",14),";",2)
25 .. I $D(^LRO(69,+ODT,1,+SN,0)) S:CONTROL="RE" LRSTATI=2 D EN1^LR7OB0(ODT,SN,CONTROL,$G(NAT)),CALL(CONTROL) K ^TMP("LRAP",$J),^TMP("LRCH",$J),^TMP("LRBB",$J)
26 . D EN1^LR7OB0(ODT,SN,CONTROL,$G(NAT)),CALL(CONTROL) K ^TMP("LRAP",$J),^TMP("LRCH",$J),^TMP("LRBB",$J)
27 Q
28CALL(CNTRL) ;Make protocol calls
29 Q:'$L($T(MSG^XQOR))
30 S:'$D(CNTRL) CNTRL=""
31 I $D(^TMP("LRCH",$J)) S ORCHMSG="^TMP(""LRCH"",$J)" D MSG^XQOR("LR7O CH EVSEND OR",.ORCHMSG),RESULTS(ORCHMSG,CNTRL) ;Message from lab
32 I $D(^TMP("LRBB",$J)) S ORBBMSG="^TMP(""LRBB"",$J)" D MSG^XQOR("LR7O BB EVSEND OR",.ORBBMSG),RESULTS(ORBBMSG,CNTRL) ;New order from Blood bank
33 I $D(^TMP("LRAP",$J)) S ORAPMSG="^TMP(""LRAP"",$J)" D MSG^XQOR("LR7O AP EVSEND OR",.ORAPMSG),RESULTS(ORAPMSG,CNTRL) ;New order from Anatomic Path
34 Q
35RESULTS(OREMSG,CNTRL) ;Results only protocol
36 Q:$G(CNTRL)'="RE" Q:'$D(OREMSG)
37 D MSG^XQOR("LR7O ALL EVSEND RESULTS",.OREMSG)
38 Q
39ACC(AC,ACDT,ACN,CONTROL,NAT) ;Set-up order message for BB,SP,EM,CY,AU accessions
40 ;ACC=Accession area ptr
41 ;ACDT=Accession Date
42 ;ACN=Accession #
43 Q:'$L($T(MSG^XQOR))
44 N MSG,CHMSG,BBMSG,APMSG
45 K ^TMP("LRAP",$J),^TMP("LRCH",$J),^TMP("LRBB",$J)
46 D EN2^LR7OB0(AC,ACDT,ACN,CONTROL,.CHMSG,.BBMSG,.APMSG,$G(NAT))
47 D CALL(CONTROL)
48 K ^TMP("LRAP",$J),^TMP("LRCH",$J),^TMP("LRBB",$J)
49 Q
50ORD(ORD) ;Set test nodes in LRTMPO("LRIFN" for given Lab #
51 ;ORD=Lab order #
52 Q:'$G(ORD) I $D(LRTMPO("LRIFN")) K LRTMPO("LRIFN")
53 N IFN,ODT,SN,X
54 S (CTR,ODT)=0
55 F S ODT=$O(^LRO(69,"C",ORD,ODT)) Q:ODT<1 S SN=0 F S SN=$O(^LRO(69,"C",ORD,ODT,SN)) Q:SN<1 S IFN=0 F S IFN=$O(^LRO(69,ODT,1,SN,2,IFN)) Q:IFN<1 S X=$G(^(IFN,0)) I X D
56 . S CTR=CTR+1,LRTMPO("LRIFN",CTR)=X
57 Q
58ORD1(ODT,SN,TST) ;Set test nodes in LRTMPO("LRIFN" for given LRODT & LRSN (includes combined tests)
59 ;ODT=LRODT
60 ;SN=LRSN
61 ; TST=Array of tests to be included (optional). If TST is not passed, then all tests for a given LRSN will be included
62 ; Screen out orders with ORIFN if CONTROL=SN (new order)
63 Q:'$G(ODT) Q:'$G(SN) I $D(LRTMPO("LRIFN")) K LRTMPO("LRIFN")
64 N IFN,X,CTR
65 S (CTR,IFN)=0
66 F S IFN=$O(^LRO(69,ODT,1,SN,2,IFN)) Q:IFN<1 S X=$G(^(IFN,0)) I X D
67 . I CONTROL="SN",$P(X,"^",7) S LRTMPO("LRIFN")="" Q ;Don't send a SN for existing order
68 . I $S($O(TST(0)):$D(TST(+X)),1:1) S CTR=CTR+1,LRTMPO("LRIFN",CTR)=X D Q
69 .. I $P(X,"^",14) S X=$P(X,"^",14) D
70 ... I $D(^LRO(69,+X,1,+$P(X,";",2),2,+$P(X,";",3),0)) S X=^(0),CTR=CTR+1,LRTMPO("LRIFN",CTR)=X
71 Q
Note: See TracBrowser for help on using the repository browser.