Changeset 623 for WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS
- Timestamp:
- Dec 4, 2009, 12:11:15 AM (15 years ago)
- Location:
- WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LR7OB69.m
r613 r623 1 LR7OB69 ;slc/dcm/JAH - Get Lab order data from 69 - 68 - 63 ;8/10/04 2 ;;5.2;LAB SERVICE;**121,187,224,291,373**;Sep 27, 1994;Build 1 3 ; 4 69(ODT,SN) ;Get data from file 69 5 ;ODT=Order Date subscript in file 69 6 ;SN=Specimen number subscript in file 69 7 ;Y1=Lab order number 8 ;Y2=Start date 9 ;Y3=Sample 10 ;Y4=Collection type/Specimen Action code 11 ;Y5=Order date 12 ;Y6=Provider 13 ;Y7=Routing Location 14 ;Y8=Lab arrival time 15 ;Y9=Date/Time Results Available 16 ;Y10=Specimen 17 ;Y11=OERR Order # 18 ;Y12=Entering person 19 ;^TMP("LRX",$J,69)=Y1^Y2^Y3^Y4^Y5^Y6^Y7^Y8^Y9^Y10^Y11^Y12 20 ;^TMP("LRX",$J,69,i)=Test^Urgency^Accession Date^Accession area^Accession #^Combined on order^ORIFN^Panel exploded 21 ;^TMP("LRX",$J,69,"N",i)=Specimen level comments (6 node) 22 ;^TMP("LRX",$J,69,i,"N",ifn)=Comments by test 23 ;^TMP("LRX",$J,69,i,"NC",ifn)=Free text cancel reason 24 ;^TMP("LRX",$J,69,i,"DGX",ifn)=diagnosis^SC^CV^AO^IR^EC^HNC^MST 25 ;^TMP("LRX",$J,69,i,63,ifn)= 26 ;Test subscript^Result^Flag^Units^Ref Range^Result status^Observation Sub ID^Value type^Natl Procedure code^Natl Procedure Name^Natl Coding System^Verified by^^Theraputic flag (T or "")^Print name^Accession^Order #^Link to 63 27 ;^TMP("LRX",$J,69,i,63,"N",ifn)=Result Comments 28 ;^TMP("LRX",$J,69,i,68)=Lab Order #^LRDFN^Accession^Draw Time^Lab Arrival time^DT Results Available^Inverse Date 29 ;^TMP("LRX",$J,69,i,68,ifn)=Test^Urgency^Technologist^Complete Date 30 ;^TMP("LRX",$J,69,"N",i)= Ward comments on specimen 31 N X,X0,XP1,X1,X4,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8,Y9,Y10,Y11,Y12,IFN,TSTY,NOTE,GOTCOM K ^TMP("LRX",$J,69) 32 Q:'$D(^LRO(69,+ODT,1,+SN,0)) S X0=^(0),XP1=$G(^(.1)),X1=$G(^(1)),X3=$G(^(3)),X4=$O(^(4,0)) 33 Q:'$D(^LR(+X0,0)) ;No matching entry in ^LR 34 S:'$D(DFN) DFN=$P(^LR(+X0,0),"^",3) S:'$D(LRDFN) LRDFN=+X0 S:'$D(LRDPF) LRDPF=$P(^LR(+X0,0),"^",2)_$G(^DIC(+$P(^LR(+X0,0),"^",2),0,"GL")) 35 S Y1=+XP1,Y2=$S($P(X1,"^"):$P(X1,"^"),1:$P(X0,"^",8)),Y3=$P(X0,"^",3),Y4=$P(X0,"^",4),Y5=$P(X0,"^",5),Y6=$P(X0,"^",6),Y7=$P(X0,"^",9),Y8=$P(X3,"^"),Y9=$P(X3,"^",2),Y11=$P(X0,"^",11),Y12=$P(X0,"^",2) 36 ;canceled entries are skipped, so calls to this routine from options 37 ;that are removing tests need to make the call before setting the pieces 38 ;that cancel the test: $P(^LRO(69,ODT,1,SN,2,IFN,0),"^",11) 39 ;See DOUT^LRTSTJAN 40 S IFN=0 F S IFN=$O(^LRO(69,ODT,1,SN,2,IFN)) Q:IFN<1 S X=$G(^(IFN,0)) I X,'$P(X,"^",11) D 41 . I $G(LRNIFN),$D(LRTMPO("LRIFN",LRNIFN)) Q:+X'=+LRTMPO("LRIFN",LRNIFN) 42 . S ^TMP("LRX",$J,69,IFN)=X,I=0 43 . D GDG1^LRBEBA2(ODT,SN,IFN) 44 . F S I=$O(^LRO(69,ODT,1,SN,2,IFN,1,I)) Q:I<1 S X=^(I,0) D 45 .. S ^TMP("LRX",$J,69,IFN,"N",I)=X 46 . S I=0 F S I=$O(^LRO(69,ODT,1,SN,2,IFN,1.1,I)) Q:I<1 S X=^(I,0) D 47 .. S ^TMP("LRX",$J,69,IFN,"NC",I)=X 48 S IFN=0 F S IFN=$O(^LRO(69,ODT,1,SN,6,IFN)) Q:IFN<1 S X=^(IFN,0) D 49 . Q:X["removed ==>" Q:X["deleted by" 50 . S ^TMP("LRX",$J,69,"N",IFN)=X 51 S Y10=$O(^LRO(69,ODT,1,SN,4,0)),Y10=$S(Y10:$P(^(Y10,0),"^"),1:"") 52 S ^TMP("LRX",$J,69)=Y1_"^"_Y2_"^"_Y3_"^"_Y4_"^"_Y5_"^"_Y6_"^"_Y7_"^"_Y8_"^"_Y9_"^"_Y10_"^"_Y11_"^"_Y12 53 S IFN=0 F S IFN=$O(^TMP("LRX",$J,69,IFN)) Q:IFN<1 S X=^TMP("LRX",$J,69,IFN) S X1=$P(X,"^",3),X2=$P(X,"^",4),X3=$P(X,"^",5) K TSTY D EN^LR7OU1(+X,$P(^LAB(60,+X,0),"^",5)) D 68^LR7OB68(IFN,X1,X2,X3,+X) 54 Q 1 LR7OB69 ;slc/dcm/JAH - Get Lab order data from 69 - 68 - 63 ;8/10/04 2 ;;5.2;LAB SERVICE;**121,187,224,291**;Sep 27, 1994 3 ; 4 69(ODT,SN) ;Get data from file 69 5 ;ODT=Order Date subscript in file 69 6 ;SN=Specimen number subscript in file 69 7 ;Y1=Lab order number 8 ;Y2=Start date 9 ;Y3=Sample 10 ;Y4=Collection type/Specimen Action code 11 ;Y5=Order date 12 ;Y6=Provider 13 ;Y7=Routing Location 14 ;Y8=Lab arrival time 15 ;Y9=Date/Time Results Available 16 ;Y10=Specimen 17 ;Y11=OERR Order # 18 ;Y12=Entering person 19 ;^TMP("LRX",$J,69)=Y1^Y2^Y3^Y4^Y5^Y6^Y7^Y8^Y9^Y10^Y11^Y12 20 ;^TMP("LRX",$J,69,i)=Test^Urgency^Accession Date^Accession area^Accession #^Combined on order^ORIFN^Panel exploded 21 ;^TMP("LRX",$J,69,"N",i)=Specimen level comments (6 node) 22 ;^TMP("LRX",$J,69,i,"N",ifn)=Comments by test 23 ;^TMP("LRX",$J,69,i,"NC",ifn)=Free text cancel reason 24 ;^TMP("LRX",$J,69,i,"DGX",ifn)=diagnosis^SC^CV^AO^IR^EC^HNC^MST 25 ;^TMP("LRX",$J,69,i,63,ifn)= 26 ;Test subscript^Result^Flag^Units^Ref Range^Result status^Observation Sub ID^Value type^Natl Procedure code^Natl Procedure Name^Natl Coding System^Verified by^^Theraputic flag (T or "")^Print name^Accession^Order #^Link to 63 27 ;^TMP("LRX",$J,69,i,63,"N",ifn)=Result Comments 28 ;^TMP("LRX",$J,69,i,68)=Lab Order #^LRDFN^Accession^Draw Time^Lab Arrival time^DT Results Available^Inverse Date 29 ;^TMP("LRX",$J,69,i,68,ifn)=Test^Urgency^Technologist^Complete Date 30 ;^TMP("LRX",$J,69,"N",i)= Ward comments on specimen 31 N X,X0,XP1,X1,X4,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8,Y9,Y10,Y11,Y12,IFN,TSTY,NOTE,GOTCOM K ^TMP("LRX",$J,69) 32 Q:'$D(^LRO(69,+ODT,1,+SN,0)) S X0=^(0),XP1=$G(^(.1)),X1=$G(^(1)),X3=$G(^(3)),X4=$O(^(4,0)) 33 Q:'$D(^LR(+X0,0)) ;No matching entry in ^LR 34 S:'$D(DFN) DFN=$P(^LR(+X0,0),"^",3) S:'$D(LRDFN) LRDFN=+X0 S:'$D(LRDPF) LRDPF=$P(^LR(+X0,0),"^",2)_$G(^DIC(+$P(^LR(+X0,0),"^",2),0,"GL")) 35 S Y1=+XP1,Y2=$S($P(X1,"^"):$P(X1,"^"),1:$P(X0,"^",8)),Y3=$P(X0,"^",3),Y4=$P(X0,"^",4),Y5=$P(X0,"^",5),Y6=$P(X0,"^",6),Y7=$P(X0,"^",7),Y8=$P(X3,"^"),Y9=$P(X3,"^",2),Y11=$P(X0,"^",11),Y12=$P(X0,"^",2) 36 S:$L(Y7) Y7=$O(^SC("C",Y7,0)) 37 ;canceled entries are skipped, so calls to this routine from options 38 ;that are removing tests need to make the call before setting the pieces 39 ;that cancel the test: $P(^LRO(69,ODT,1,SN,2,IFN,0),"^",11) 40 ;See DOUT^LRTSTJAN 41 S IFN=0 F S IFN=$O(^LRO(69,ODT,1,SN,2,IFN)) Q:IFN<1 S X=$G(^(IFN,0)) I X,'$P(X,"^",11) D 42 . I $G(LRNIFN),$D(LRTMPO("LRIFN",LRNIFN)) Q:+X'=+LRTMPO("LRIFN",LRNIFN) 43 . S ^TMP("LRX",$J,69,IFN)=X,I=0 44 . D GDG1^LRBEBA2(ODT,SN,IFN) 45 . F S I=$O(^LRO(69,ODT,1,SN,2,IFN,1,I)) Q:I<1 S X=^(I,0) D 46 .. S ^TMP("LRX",$J,69,IFN,"N",I)=X 47 . S I=0 F S I=$O(^LRO(69,ODT,1,SN,2,IFN,1.1,I)) Q:I<1 S X=^(I,0) D 48 .. S ^TMP("LRX",$J,69,IFN,"NC",I)=X 49 S IFN=0 F S IFN=$O(^LRO(69,ODT,1,SN,6,IFN)) Q:IFN<1 S X=^(IFN,0) D 50 . Q:X["removed ==>" Q:X["deleted by" 51 . S ^TMP("LRX",$J,69,"N",IFN)=X 52 S Y10=$O(^LRO(69,ODT,1,SN,4,0)),Y10=$S(Y10:$P(^(Y10,0),"^"),1:"") 53 S ^TMP("LRX",$J,69)=Y1_"^"_Y2_"^"_Y3_"^"_Y4_"^"_Y5_"^"_Y6_"^"_Y7_"^"_Y8_"^"_Y9_"^"_Y10_"^"_Y11_"^"_Y12 54 S IFN=0 F S IFN=$O(^TMP("LRX",$J,69,IFN)) Q:IFN<1 S X=^TMP("LRX",$J,69,IFN) S X1=$P(X,"^",3),X2=$P(X,"^",4),X3=$P(X,"^",5) K TSTY D EN^LR7OU1(+X,$P(^LAB(60,+X,0),"^",5)) D 68^LR7OB68(IFN,X1,X2,X3,+X) 55 Q -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LR7OGG.m
r613 r623 1 LR7OGG ;DALOI/STAFF- Interim report rpc grid ; Feb 9, 2005 2 ;;5.2;LAB SERVICE;**187,290,364**;Sep 27, 1994;Build 3 3 ; 4 TEST ; test use only 5 N CNT,I K ^TMP("LR7OGX",$J) 6 S ^TMP("LR7OGX",$J,"INPUT",1)="2^2970202^2920202" 7 S CNT=1 8 ;F I=1:1:10 I $D(^LAB(60,I,0)) S CNT=CNT+1,^TMP("LR7OGX",$J,"INPUT",CNT)=I 9 F I=7,173,9,1 I $D(^LAB(60,I,0)) S CNT=CNT+1,^TMP("LR7OGX",$J,"INPUT",CNT)=I 10 D GRIDDATA 11 S I=0 F S I=$O(^TMP("LR7OGX",$J,"OUTPUT",I)) Q:I<1 W !,^(I) 12 K ^TMP("LR7OGX",$J) 13 Q 14 ; 15 GRID(ROOT,DFN,DATE1,DATE2,SPEC,TESTS) ; from ORWLRR 16 N CNT,NUM 17 K ^TMP("LR7OGX",$J,"INPUT"),^("OUTPUT") 18 S ROOT=$NA(^TMP("LR7OGX",$J,"OUTPUT")) 19 S ^TMP("LR7OGX",$J,"INPUT",1)=DFN_U_DATE1_U_DATE2_U_+SPEC 20 S CNT=1,NUM=0 F S NUM=$O(TESTS(NUM)) Q:NUM<1 D 21 .S CNT=CNT+1 22 .S ^TMP("LR7OGX",$J,"INPUT",CNT)=+TESTS(NUM) 23 D GRIDDATA 24 Q 25 ; 26 GRIDDATA ; 27 ; input format 28 ; ^TMP("LR7OGX",$J,"INPUT",1)=dfn^start date^end date^spec^all tests 29 ; ^TMP("LR7OGX",$J,"INPUT",#)=test# (tests displayed in this order) 30 ; (these tests should, be atomic, subscript - ch, type - both or output) 31 ; 32 S ^TMP("LR7OGX",$J,"OUTPUT",1)="0^0^0^1" 33 N ABCNT,ABDCNT,ABLINE,ABTCNT,ABTLINE,ADCNT,ADSEQ,AGE,ATCNT,ATSEQ,CDT,CHSUB,COMCNT,COMMENT,DATACNT,DATESEQ,DFN,EDATE,EDT,FLAG,IDT 34 N LINE,LRCW,LRDFN,LRX,NUM,ONLYSPEC,OUTCNT,PNM,PRNTCODE,RESULT,SDATE,SEX,SPEC,SPECNAME,TESTNAME,TESTNUM,TESTSEQ,TESTZERO,X,ZERO,INEXACT,DISPDATE 35 K ^TMP("LR7OG",$J) 36 S DFN=+^TMP("LR7OGX",$J,"INPUT",1),SDATE=+$P(^(1),U,2),EDATE=+$P(^(1),U,3),ONLYSPEC=+$P(^(1),U,4) 37 D DEMO^LR7OGU(DFN,.LRDFN,.PNM,.AGE,.SEX) 38 Q:'DFN Q:'SDATE Q:'EDATE Q:'LRDFN 39 S OUTCNT=1,(ADCNT,ADSEQ,ATCNT,ATSEQ,COMCNT,DATACNT,DATESEQ,TESTSEQ,TCNT)=0 40 S NUM=1 41 F S NUM=$O(^TMP("LR7OGX",$J,"INPUT",NUM)) Q:NUM<1 S TESTNUM=+^(NUM) D 42 . S TESTZERO=$G(^LAB(60,TESTNUM,0)) 43 . S CHSUB=$P($P(TESTZERO,U,5),";",2) 44 . I 'CHSUB Q 45 . S TESTNAME=$P($G(^LAB(60,TESTNUM,.1)),U),PRNTCODE=$P($G(^(.1)),U,3) 46 . I TESTNAME="" S TESTNAME=$P(TESTZERO,U) 47 . S TESTSEQ=TESTSEQ+1 48 . S LINE=TESTSEQ_U_TESTNUM_U_TESTNAME_U_PRNTCODE 49 . S ^TMP("LR7OG",$J,"TEST",CHSUB)=LINE 50 . S OUTCNT=OUTCNT+1 51 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE 52 S ^TMP("LR7OGX",$J,"OUTPUT",1)=TESTSEQ 53 S EDATE=EDATE\1 54 S IDT=9999999-SDATE,EDT=9999999-EDATE 55 F S IDT=$O(^LR(LRDFN,"CH",IDT)) Q:IDT<1 Q:IDT>EDT D 56 . S ZERO=^LR(LRDFN,"CH",IDT,0) 57 . I '$P(ZERO,U,3) Q 58 . S CDT=+ZERO,INEXACT=$P(ZERO,U,2),SPEC=+$P(ZERO,U,5),SPECNAME=$P($G(^LAB(61,SPEC,0)),U),COMMENT=$S($O(^LR(LRDFN,"CH",IDT,1,0)):"**",1:"") 59 . I ONLYSPEC,SPEC'=ONLYSPEC Q 60 . S CHSUB=1 61 . F S CHSUB=$O(^LR(LRDFN,"CH",IDT,CHSUB)) Q:CHSUB="" D 62 . . I '$D(^TMP("LR7OG",$J,"TEST",CHSUB)) Q 63 . . I '$D(^TMP("LR7OG",$J,"DATE",IDT)) S ^(IDT)="" D 64 . . . S DATESEQ=DATESEQ+1 65 . . . S OUTCNT=OUTCNT+1 66 . . . S DISPDATE=$S(INEXACT:CDT\1,1:CDT) 67 . . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=DATESEQ_U_CDT_U_SPEC_U_SPECNAME_U_COMMENT_U_DISPDATE 68 . . . I COMMENT'="" D 69 . . . . S COMCNT=COMCNT+1 70 . . . . S ^TMP("LR7OG",$J,"COMMENT",COMCNT)=$P($$FMTE^XLFDT(CDT),":",1,2)_" ** Comments:" 71 . . . . S NUM=0 72 . . . . F S NUM=$O(^LR(LRDFN,"CH",IDT,1,NUM)) Q:NUM<1 S LINE=$G(^(NUM,0)) D 73 . . . . . S COMCNT=COMCNT+1 74 . . . . . S ^TMP("LR7OG",$J,"COMMENT",COMCNT)=LINE 75 . . . . S COMCNT=COMCNT+1 76 . . . . S ^TMP("LR7OG",$J,"COMMENT",COMCNT)="" 77 . . S LRX=$$TSTRES^LRRPU(LRDFN,"CH",IDT,CHSUB,"") 78 . . S RESULT=$P(LRX,"^"),FLAG=$P(LRX,U,2) 79 . . S PRNTCODE=$P(^TMP("LR7OG",$J,"TEST",CHSUB),U,4) 80 . . I PRNTCODE'="" S X=RESULT,LRCW=8 S @("RESULT="_PRNTCODE) 81 . . E S RESULT=$J(RESULT,8) 82 . . S RESULT=$$STRIP^LR7OGU(RESULT) 83 . . I FLAG'="" D 84 . . . S ABTLINE=^TMP("LR7OG",$J,"TEST",CHSUB) 85 . . . I '$D(^TMP("LR7OG",$J,"ABTSEQ",+ABTLINE)) S ^(+ABTLINE)=U_$P(ABTLINE,U,2,3) 86 . . . I '$D(^TMP("LR7OG",$J,"ABDSEQ",IDT)) S ^(IDT)=U_CDT_U_SPEC_U_SPECNAME_U_COMMENT 87 . . . S ^TMP("LR7OG",$J,"ABDATA",IDT,+ABTLINE)=RESULT_U_FLAG 88 . . S TESTSEQ=+^TMP("LR7OG",$J,"TEST",CHSUB) 89 . . S DATACNT=DATACNT+1 90 . . S ^TMP("LR7OG",$J,"DATA",DATACNT)=DATESEQ_U_TESTSEQ_U_RESULT_U_FLAG 91 . . D TESTSPEC(CHSUB,SPEC,SPECNAME,AGE,SEX) 92 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U,2,3)=DATESEQ_U_DATACNT 93 S DATACNT=0 94 F S DATACNT=$O(^TMP("LR7OG",$J,"DATA",DATACNT)) Q:DATACNT<1 S LINE=^(DATACNT) D 95 . S OUTCNT=OUTCNT+1,^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE 96 S OUTCNT=OUTCNT+1,ABLINE=OUTCNT 97 S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)="0^0^0" 98 ; 99 S (ABTCNT,ATSEQ)=0 100 F S ATSEQ=$O(^TMP("LR7OG",$J,"ABTSEQ",ATSEQ)) Q:ATSEQ<1 D 101 . S ABTCNT=ABTCNT+1 102 . S $P(^TMP("LR7OG",$J,"ABTSEQ",ATSEQ),U)=ABTCNT 103 . S OUTCNT=OUTCNT+1 104 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=^TMP("LR7OG",$J,"ABTSEQ",ATSEQ) 105 ; 106 S (ABDCNT,ADSEQ)=0 107 F S ADSEQ=$O(^TMP("LR7OG",$J,"ABDSEQ",ADSEQ)) Q:ADSEQ<1 D 108 . S ABDCNT=ABDCNT+1 109 . S $P(^TMP("LR7OG",$J,"ABDSEQ",ADSEQ),U)=ABDCNT 110 . S OUTCNT=OUTCNT+1 111 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=^TMP("LR7OG",$J,"ABDSEQ",ADSEQ) 112 ; 113 S (ABCNT,ADSEQ)=0 114 F S ADSEQ=$O(^TMP("LR7OG",$J,"ABDATA",ADSEQ)) Q:ADSEQ<1 D 115 . S ADCNT=+^TMP("LR7OG",$J,"ABDSEQ",ADSEQ) 116 . S ATSEQ=0 117 . F S ATSEQ=$O(^TMP("LR7OG",$J,"ABDATA",ADSEQ,ATSEQ)) Q:ATSEQ<1 D 118 . . S ATCNT=+^TMP("LR7OG",$J,"ABTSEQ",ATSEQ) 119 . . S ABCNT=ABCNT+1 120 . . S OUTCNT=OUTCNT+1 121 . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=ADCNT_U_ATCNT_U_^TMP("LR7OG",$J,"ABDATA",ADSEQ,ATSEQ) 122 ; 123 S ^TMP("LR7OGX",$J,"OUTPUT",ABLINE)=ABTCNT_U_ABDCNT_U_ABCNT 124 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U,4)=OUTCNT 125 S TESTSEQ=0 126 F S TESTSEQ=$O(^TMP("LR7OG",$J,"TESTSPEC",TESTSEQ)) Q:TESTSEQ<1 D 127 . S SPEC=0 128 . F S SPEC=$O(^TMP("LR7OG",$J,"TESTSPEC",TESTSEQ,SPEC)) Q:SPEC<1 S LINE=^(SPEC) D 129 . . S OUTCNT=OUTCNT+1 130 . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE 131 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U,5)=OUTCNT 132 ; 133 S NUM=0 134 F S NUM=$O(^TMP("LR7OG",$J,"COMMENT",NUM)) Q:NUM<1 S LINE=^(NUM) D 135 . S OUTCNT=OUTCNT+1 136 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE 137 K ^TMP("LR7OG",$J) 138 Q 139 ; 140 ; 141 TESTSPEC(CHSUB,SPEC,SPECNAME,AGE,SEX) ; 142 N RANGE,TESTNAME,TESTNUM,TESTSEQ,UNITS 143 S TESTSEQ=+$P(^TMP("LR7OG",$J,"TEST",CHSUB),U),TESTNUM=+$P(^(CHSUB),U,2),TESTNAME=$P(^(CHSUB),U,3) 144 I $D(^TMP("LR7OG",$J,"TESTSPEC",TESTSEQ,SPEC)) Q 145 D URANGE^LR7OGU(TESTNUM,SPEC,AGE,SEX,.UNITS,.RANGE) 146 S ^TMP("LR7OG",$J,"TESTSPEC",TESTSEQ,SPEC)=TESTNUM_U_SPECNAME_U_SPEC_U_UNITS_U_$P(RANGE," - ")_U_$P($P(RANGE," - ",2)," (") 147 Q 1 LR7OGG ;DALOI/STAFF- Interim report rpc grid ; Feb 9, 2005 2 ;;5.2;LAB SERVICE;**187,290**;Sep 27, 1994 3 ; 4 TEST ; test use only 5 N CNT,I K ^TMP("LR7OGX",$J) 6 S ^TMP("LR7OGX",$J,"INPUT",1)="2^2970202^2920202" 7 S CNT=1 8 ;F I=1:1:10 I $D(^LAB(60,I,0)) S CNT=CNT+1,^TMP("LR7OGX",$J,"INPUT",CNT)=I 9 F I=7,173,9,1 I $D(^LAB(60,I,0)) S CNT=CNT+1,^TMP("LR7OGX",$J,"INPUT",CNT)=I 10 D GRIDDATA 11 S I=0 F S I=$O(^TMP("LR7OGX",$J,"OUTPUT",I)) Q:I<1 W !,^(I) 12 K ^TMP("LR7OGX",$J) 13 Q 14 ; 15 GRID(ROOT,DFN,DATE1,DATE2,SPEC,TESTS) ; from ORWLRR 16 N CNT,NUM 17 K ^TMP("LR7OGX",$J,"INPUT"),^("OUTPUT") 18 S ROOT=$NA(^TMP("LR7OGX",$J,"OUTPUT")) 19 S ^TMP("LR7OGX",$J,"INPUT",1)=DFN_U_DATE1_U_DATE2_U_+SPEC 20 S CNT=1,NUM=0 F S NUM=$O(TESTS(NUM)) Q:NUM<1 D 21 .S CNT=CNT+1 22 .S ^TMP("LR7OGX",$J,"INPUT",CNT)=+TESTS(NUM) 23 D GRIDDATA 24 Q 25 ; 26 GRIDDATA ; 27 ; input format 28 ; ^TMP("LR7OGX",$J,"INPUT",1)=dfn^start date^end date^spec^all tests 29 ; ^TMP("LR7OGX",$J,"INPUT",#)=test# (tests displayed in this order) 30 ; (these tests should, be atomic, subscript - ch, type - both or output) 31 ; 32 S ^TMP("LR7OGX",$J,"OUTPUT",1)="0^0^0^1" 33 N ABCNT,ABDCNT,ABLINE,ABTCNT,ABTLINE,ADCNT,ADSEQ,AGE,ATCNT,ATSEQ,CDT,CHSUB,COMCNT,COMMENT,DATACNT,DATESEQ,DFN,EDATE,EDT,FLAG,IDT 34 N LINE,LRCW,LRDFN,LRX,NUM,ONLYSPEC,OUTCNT,PNM,PRNTCODE,RESULT,SDATE,SEX,SPEC,SPECNAME,TESTNAME,TESTNUM,TESTSEQ,TESTZERO,X,ZERO 35 K ^TMP("LR7OG",$J) 36 S DFN=+^TMP("LR7OGX",$J,"INPUT",1),SDATE=+$P(^(1),U,2),EDATE=+$P(^(1),U,3),ONLYSPEC=+$P(^(1),U,4) 37 D DEMO^LR7OGU(DFN,.LRDFN,.PNM,.AGE,.SEX) 38 Q:'DFN Q:'SDATE Q:'EDATE Q:'LRDFN 39 S OUTCNT=1,(ADCNT,ADSEQ,ATCNT,ATSEQ,COMCNT,DATACNT,DATESEQ,TESTSEQ,TCNT)=0 40 S NUM=1 41 F S NUM=$O(^TMP("LR7OGX",$J,"INPUT",NUM)) Q:NUM<1 S TESTNUM=+^(NUM) D 42 . S TESTZERO=$G(^LAB(60,TESTNUM,0)) 43 . S CHSUB=$P($P(TESTZERO,U,5),";",2) 44 . I 'CHSUB Q 45 . S TESTNAME=$P($G(^LAB(60,TESTNUM,.1)),U),PRNTCODE=$P($G(^(.1)),U,3) 46 . I TESTNAME="" S TESTNAME=$P(TESTZERO,U) 47 . S TESTSEQ=TESTSEQ+1 48 . S LINE=TESTSEQ_U_TESTNUM_U_TESTNAME_U_PRNTCODE 49 . S ^TMP("LR7OG",$J,"TEST",CHSUB)=LINE 50 . S OUTCNT=OUTCNT+1 51 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE 52 S ^TMP("LR7OGX",$J,"OUTPUT",1)=TESTSEQ 53 S EDATE=EDATE\1 54 S IDT=9999999-SDATE,EDT=9999999-EDATE 55 F S IDT=$O(^LR(LRDFN,"CH",IDT)) Q:IDT<1 Q:IDT>EDT D 56 . S ZERO=^LR(LRDFN,"CH",IDT,0) 57 . I '$P(ZERO,U,3) Q 58 . S CDT=+ZERO,SPEC=+$P(ZERO,U,5),SPECNAME=$P($G(^LAB(61,SPEC,0)),U),COMMENT=$S($O(^LR(LRDFN,"CH",IDT,1,0)):"**",1:"") 59 . I ONLYSPEC,SPEC'=ONLYSPEC Q 60 . S CHSUB=1 61 . F S CHSUB=$O(^LR(LRDFN,"CH",IDT,CHSUB)) Q:CHSUB="" D 62 . . I '$D(^TMP("LR7OG",$J,"TEST",CHSUB)) Q 63 . . I '$D(^TMP("LR7OG",$J,"DATE",IDT)) S ^(IDT)="" D 64 . . . S DATESEQ=DATESEQ+1 65 . . . S OUTCNT=OUTCNT+1 66 . . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=DATESEQ_U_CDT_U_SPEC_U_SPECNAME_U_COMMENT 67 . . . I COMMENT'="" D 68 . . . . S COMCNT=COMCNT+1 69 . . . . S ^TMP("LR7OG",$J,"COMMENT",COMCNT)=$P($$FMTE^XLFDT(CDT),":",1,2)_" ** Comments:" 70 . . . . S NUM=0 71 . . . . F S NUM=$O(^LR(LRDFN,"CH",IDT,1,NUM)) Q:NUM<1 S LINE=$G(^(NUM,0)) D 72 . . . . . S COMCNT=COMCNT+1 73 . . . . . S ^TMP("LR7OG",$J,"COMMENT",COMCNT)=LINE 74 . . . . S COMCNT=COMCNT+1 75 . . . . S ^TMP("LR7OG",$J,"COMMENT",COMCNT)="" 76 . . S LRX=$$TSTRES^LRRPU(LRDFN,"CH",IDT,CHSUB,"") 77 . . S RESULT=$P(LRX,"^"),FLAG=$P(LRX,U,2) 78 . . S PRNTCODE=$P(^TMP("LR7OG",$J,"TEST",CHSUB),U,4) 79 . . I PRNTCODE'="" S X=RESULT,LRCW=8 S @("RESULT="_PRNTCODE) 80 . . E S RESULT=$J(RESULT,8) 81 . . S RESULT=$$STRIP^LR7OGU(RESULT) 82 . . I FLAG'="" D 83 . . . S ABTLINE=^TMP("LR7OG",$J,"TEST",CHSUB) 84 . . . I '$D(^TMP("LR7OG",$J,"ABTSEQ",+ABTLINE)) S ^(+ABTLINE)=U_$P(ABTLINE,U,2,3) 85 . . . I '$D(^TMP("LR7OG",$J,"ABDSEQ",IDT)) S ^(IDT)=U_CDT_U_SPEC_U_SPECNAME_U_COMMENT 86 . . . S ^TMP("LR7OG",$J,"ABDATA",IDT,+ABTLINE)=RESULT_U_FLAG 87 . . S TESTSEQ=+^TMP("LR7OG",$J,"TEST",CHSUB) 88 . . S DATACNT=DATACNT+1 89 . . S ^TMP("LR7OG",$J,"DATA",DATACNT)=DATESEQ_U_TESTSEQ_U_RESULT_U_FLAG 90 . . D TESTSPEC(CHSUB,SPEC,SPECNAME,AGE,SEX) 91 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U,2,3)=DATESEQ_U_DATACNT 92 S DATACNT=0 93 F S DATACNT=$O(^TMP("LR7OG",$J,"DATA",DATACNT)) Q:DATACNT<1 S LINE=^(DATACNT) D 94 . S OUTCNT=OUTCNT+1,^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE 95 S OUTCNT=OUTCNT+1,ABLINE=OUTCNT 96 S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)="0^0^0" 97 ; 98 S (ABTCNT,ATSEQ)=0 99 F S ATSEQ=$O(^TMP("LR7OG",$J,"ABTSEQ",ATSEQ)) Q:ATSEQ<1 D 100 . S ABTCNT=ABTCNT+1 101 . S $P(^TMP("LR7OG",$J,"ABTSEQ",ATSEQ),U)=ABTCNT 102 . S OUTCNT=OUTCNT+1 103 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=^TMP("LR7OG",$J,"ABTSEQ",ATSEQ) 104 ; 105 S (ABDCNT,ADSEQ)=0 106 F S ADSEQ=$O(^TMP("LR7OG",$J,"ABDSEQ",ADSEQ)) Q:ADSEQ<1 D 107 . S ABDCNT=ABDCNT+1 108 . S $P(^TMP("LR7OG",$J,"ABDSEQ",ADSEQ),U)=ABDCNT 109 . S OUTCNT=OUTCNT+1 110 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=^TMP("LR7OG",$J,"ABDSEQ",ADSEQ) 111 ; 112 S (ABCNT,ADSEQ)=0 113 F S ADSEQ=$O(^TMP("LR7OG",$J,"ABDATA",ADSEQ)) Q:ADSEQ<1 D 114 . S ADCNT=+^TMP("LR7OG",$J,"ABDSEQ",ADSEQ) 115 . S ATSEQ=0 116 . F S ATSEQ=$O(^TMP("LR7OG",$J,"ABDATA",ADSEQ,ATSEQ)) Q:ATSEQ<1 D 117 . . S ATCNT=+^TMP("LR7OG",$J,"ABTSEQ",ATSEQ) 118 . . S ABCNT=ABCNT+1 119 . . S OUTCNT=OUTCNT+1 120 . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=ADCNT_U_ATCNT_U_^TMP("LR7OG",$J,"ABDATA",ADSEQ,ATSEQ) 121 ; 122 S ^TMP("LR7OGX",$J,"OUTPUT",ABLINE)=ABTCNT_U_ABDCNT_U_ABCNT 123 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U,4)=OUTCNT 124 S TESTSEQ=0 125 F S TESTSEQ=$O(^TMP("LR7OG",$J,"TESTSPEC",TESTSEQ)) Q:TESTSEQ<1 D 126 . S SPEC=0 127 . F S SPEC=$O(^TMP("LR7OG",$J,"TESTSPEC",TESTSEQ,SPEC)) Q:SPEC<1 S LINE=^(SPEC) D 128 . . S OUTCNT=OUTCNT+1 129 . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE 130 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U,5)=OUTCNT 131 ; 132 S NUM=0 133 F S NUM=$O(^TMP("LR7OG",$J,"COMMENT",NUM)) Q:NUM<1 S LINE=^(NUM) D 134 . S OUTCNT=OUTCNT+1 135 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE 136 K ^TMP("LR7OG",$J) 137 Q 138 ; 139 ; 140 TESTSPEC(CHSUB,SPEC,SPECNAME,AGE,SEX) ; 141 N RANGE,TESTNAME,TESTNUM,TESTSEQ,UNITS 142 S TESTSEQ=+$P(^TMP("LR7OG",$J,"TEST",CHSUB),U),TESTNUM=+$P(^(CHSUB),U,2),TESTNAME=$P(^(CHSUB),U,3) 143 I $D(^TMP("LR7OG",$J,"TESTSPEC",TESTSEQ,SPEC)) Q 144 D URANGE^LR7OGU(TESTNUM,SPEC,AGE,SEX,.UNITS,.RANGE) 145 S ^TMP("LR7OG",$J,"TESTSPEC",TESTSEQ,SPEC)=TESTNUM_U_SPECNAME_U_SPEC_U_UNITS_U_$P(RANGE," - ")_U_$P($P(RANGE," - ",2)," (") 146 Q -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LR7OGMG.m
r613 r623 1 LR7OGMG ;DALOI/STAFF- Interim report rpc memo grid ;July 19, 2006 2 ;;5.2;LAB SERVICE;**187,230,286,290,331,364**;Sep 27, 1994;Build 3 3 ; 4 GRID(OUTCNT) ; from LR7OGMC 5 N ACC,AGE,CDT,CMNT,DATA,DOC,FLAG,IDT,INTP,LINE,LRCW,LRX,MPLS,PLS,PORDER,PRNTCODE,RANGE,SEX,SPEC,SUB,TCNT,TESTNAME,TESTNUM 6 N UNITS,VALUE,X,ZERO,INEXACT,DISPDATE 7 ; the variables AGE, SEX, LRCW, and X are used withing the lab's print codes and ref ranges 8 K ^TMP("LRMPLS",$J) 9 S AGE=$P(^TMP("LR7OG",$J,"G"),U,4),SEX=$P(^("G"),U,5),LRCW=$P(^("G"),U,6) 10 S CDT=+$O(^TMP("LR7OG",$J,"TP",0)) Q:'CDT 11 S IDT=9999999-CDT 12 S ZERO=$S($D(^TMP("LR7OG",$J,"TP",CDT))#2:^(CDT),1:"") 13 I '$P(ZERO,U,3) Q 14 S SPEC=+$P(ZERO,U,5) 15 S INEXACT=$P(ZERO,U,2),DISPDATE=$S(INEXACT:CDT\1,1:CDT) 16 S DOC=$$NAME^LR7OGMP(+$P(ZERO,U,10)) 17 S ACC=$P(ZERO,U,6) 18 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U,4,6)=SPEC_U_$P($G(^LAB(61,SPEC,0)),U)_U_ACC_U_DOC 19 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U,10)=DISPDATE 20 S (TCNT,MPLS,PORDER,PLS)=0 21 S PLS=$O(^TMP("LRPLS",$J,0)) 22 I $O(^TMP("LRPLS",$J,PLS)) S MPLS=1 ; multiple performing labs 23 F S PORDER=$O(^TMP("LR7OG",$J,"TP",CDT,PORDER)) Q:PORDER'>0 S DATA=^(PORDER) D 24 . I $P(DATA,U,7)="" Q 25 . S TCNT=TCNT+1 26 . S TESTNUM=+DATA,TESTNAME=$P(DATA,U,2),PRNTCODE=$P(DATA,U,5),SUB=$P(DATA,U,6),FLAG=$P(DATA,U,8),X=$P(DATA,U,7),UNITS=$P(DATA,U,9),RANGE=$P(DATA,U,10),PLS=$P(DATA,U,11) 27 . I MPLS,PLS S ^TMP("LRMPLS",$J,PLS,TESTNAME)="" 28 . I PRNTCODE="" S VALUE=$J(X,8) 29 . E S @("VALUE="_PRNTCODE) 30 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=TESTNUM_U_TESTNAME_U_VALUE_U_FLAG_U_UNITS_U_RANGE 31 . S OUTCNT=OUTCNT+1 32 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U)=TCNT 33 ; 34 S PORDER=0 35 F S PORDER=$O(^TMP("LR7OG",$J,"TP",CDT,PORDER)) Q:PORDER'>0 S DATA=^(PORDER) D 36 . I $O(^TMP("LR7OG",$J,"TP",CDT,PORDER,0))>0 D 37 . . S TESTNAME=$P(DATA,U,3) 38 . . S INTP=0 39 . . F S INTP=+$O(^TMP("LR7OG",$J,"TP",CDT,PORDER,INTP)) Q:INTP<1 D 40 . . . S LINE=TESTNAME_" Eval: "_^TMP("LR7OG",$J,"TP",CDT,PORDER,INTP) 41 . . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE 42 . . . S OUTCNT=OUTCNT+1 43 ; 44 I $D(^TMP("LR7OG",$J,"TP",CDT,"C")) D 45 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)="Comment: " 46 . S OUTCNT=OUTCNT+1,CMNT=0 47 . F S CMNT=+$O(^TMP("LR7OG",$J,"TP",CDT,"C",CMNT)) Q:CMNT<1 S LINE=^(CMNT) D 48 . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=" "_LINE 49 . . S OUTCNT=OUTCNT+1 50 ; 51 D PLS 52 Q 53 ; 54 ; 55 PLS ; List performing laboratories 56 ; If multiple performing labs then list tests associated with each lab. 57 ; 58 N CNT,LINE,LRPLS,X 59 S (CNT,LRPLS)=0 60 F S LRPLS=$O(^TMP("LRPLS",$J,LRPLS)) Q:LRPLS<1 D 61 . I CNT S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=" ",OUTCNT=OUTCNT+1 62 . I $D(^TMP("LRMPLS",$J,LRPLS)) D 63 . . S TESTNAME="",LINE="For test(s): " 64 . . F S TESTNAME=$O(^TMP("LRMPLS",$J,LRPLS,TESTNAME)) Q:TESTNAME="" D 65 . . . I ($L(LINE)+$L(TESTNAME))>240 D 66 . . . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE 67 . . . . S OUTCNT=OUTCNT+1,LINE="" 68 . . . S LINE=LINE_TESTNAME_", " 69 . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE,OUTCNT=OUTCNT+1 70 . S LINE=$$NAME^XUAF4(LRPLS) 71 . S X=$$PADD^XUAF4(LRPLS) 72 . S LINE=LINE_" "_$P(X,U)_" "_$P(X,U,2)_", "_$P(X,U,3)_" "_$P(X,U,4) 73 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)="Performing Lab: "_LINE 74 . S OUTCNT=OUTCNT+1,CNT=CNT+1 75 ; 76 K ^TMP("LRPLS",$J),^TMP("LRMPLS",$J) 77 Q 1 LR7OGMG ;DALOI/STAFF- Interim report rpc memo grid ;July 19, 2006 2 ;;5.2;LAB SERVICE;**187,230,286,290,331**;Sep 27, 1994;Build 7 3 ; 4 GRID(OUTCNT) ; from LR7OGMC 5 N ACC,AGE,CDT,CMNT,DATA,DOC,FLAG,IDT,INTP,LINE,LRCW,LRX,MPLS,PLS,PORDER,PRNTCODE,RANGE,SEX,SPEC,SUB,TCNT,TESTNAME,TESTNUM 6 N UNITS,VALUE,X,ZERO 7 ; the variables AGE, SEX, LRCW, and X are used withing the lab's print codes and ref ranges 8 K ^TMP("LRMPLS",$J) 9 S AGE=$P(^TMP("LR7OG",$J,"G"),U,4),SEX=$P(^("G"),U,5),LRCW=$P(^("G"),U,6) 10 S CDT=+$O(^TMP("LR7OG",$J,"TP",0)) Q:'CDT 11 S IDT=9999999-CDT 12 S ZERO=$S($D(^TMP("LR7OG",$J,"TP",CDT))#2:^(CDT),1:"") 13 I '$P(ZERO,U,3) Q 14 S SPEC=+$P(ZERO,U,5) 15 S DOC=$$NAME^LR7OGMP(+$P(ZERO,U,10)) 16 S ACC=$P(ZERO,U,6) 17 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U,4,6)=SPEC_U_$P($G(^LAB(61,SPEC,0)),U)_U_ACC_U_DOC 18 S (TCNT,MPLS,PORDER,PLS)=0 19 S PLS=$O(^TMP("LRPLS",$J,0)) 20 I $O(^TMP("LRPLS",$J,PLS)) S MPLS=1 ; multiple performing labs 21 F S PORDER=$O(^TMP("LR7OG",$J,"TP",CDT,PORDER)) Q:PORDER'>0 S DATA=^(PORDER) D 22 . I $P(DATA,U,7)="" Q 23 . S TCNT=TCNT+1 24 . S TESTNUM=+DATA,TESTNAME=$P(DATA,U,2),PRNTCODE=$P(DATA,U,5),SUB=$P(DATA,U,6),FLAG=$P(DATA,U,8),X=$P(DATA,U,7),UNITS=$P(DATA,U,9),RANGE=$P(DATA,U,10),PLS=$P(DATA,U,11) 25 . I MPLS,PLS S ^TMP("LRMPLS",$J,PLS,TESTNAME)="" 26 . I PRNTCODE="" S VALUE=$J(X,8) 27 . E S @("VALUE="_PRNTCODE) 28 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=TESTNUM_U_TESTNAME_U_VALUE_U_FLAG_U_UNITS_U_RANGE 29 . S OUTCNT=OUTCNT+1 30 S $P(^TMP("LR7OGX",$J,"OUTPUT",1),U)=TCNT 31 ; 32 S PORDER=0 33 F S PORDER=$O(^TMP("LR7OG",$J,"TP",CDT,PORDER)) Q:PORDER'>0 S DATA=^(PORDER) D 34 . I $O(^TMP("LR7OG",$J,"TP",CDT,PORDER,0))>0 D 35 . . S TESTNAME=$P(DATA,U,3) 36 . . S INTP=0 37 . . F S INTP=+$O(^TMP("LR7OG",$J,"TP",CDT,PORDER,INTP)) Q:INTP<1 D 38 . . . S LINE=TESTNAME_" Eval: "_^TMP("LR7OG",$J,"TP",CDT,PORDER,INTP) 39 . . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE 40 . . . S OUTCNT=OUTCNT+1 41 ; 42 I $D(^TMP("LR7OG",$J,"TP",CDT,"C")) D 43 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)="Comment: " 44 . S OUTCNT=OUTCNT+1,CMNT=0 45 . F S CMNT=+$O(^TMP("LR7OG",$J,"TP",CDT,"C",CMNT)) Q:CMNT<1 S LINE=^(CMNT) D 46 . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=" "_LINE 47 . . S OUTCNT=OUTCNT+1 48 ; 49 D PLS 50 Q 51 ; 52 ; 53 PLS ; List performing laboratories 54 ; If multiple performing labs then list tests associated with each lab. 55 ; 56 N CNT,LINE,LRPLS,X 57 S (CNT,LRPLS)=0 58 F S LRPLS=$O(^TMP("LRPLS",$J,LRPLS)) Q:LRPLS<1 D 59 . I CNT S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=" ",OUTCNT=OUTCNT+1 60 . I $D(^TMP("LRMPLS",$J,LRPLS)) D 61 . . S TESTNAME="",LINE="For test(s): " 62 . . F S TESTNAME=$O(^TMP("LRMPLS",$J,LRPLS,TESTNAME)) Q:TESTNAME="" D 63 . . . I ($L(LINE)+$L(TESTNAME))>240 D 64 . . . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE 65 . . . . S OUTCNT=OUTCNT+1,LINE="" 66 . . . S LINE=LINE_TESTNAME_", " 67 . . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE,OUTCNT=OUTCNT+1 68 . S LINE=$$NAME^XUAF4(LRPLS) 69 . S X=$$PADD^XUAF4(LRPLS) 70 . S LINE=LINE_" "_$P(X,U)_" "_$P(X,U,2)_", "_$P(X,U,3)_" "_$P(X,U,4) 71 . S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)="Performing Lab: "_LINE 72 . S OUTCNT=OUTCNT+1,CNT=CNT+1 73 ; 74 K ^TMP("LRPLS",$J),^TMP("LRMPLS",$J) 75 Q -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LR7OGMM.m
r613 r623 1 LR7OGMM ;SLC/STAFF- Interim report rpc memo micro ;5/20/97 18:52 2 ;;5.2;LAB SERVICE;**187,312,364**;Sep 27, 1994;Build 3 3 ; 4 MI(LRDFN,IDT,MICROSUB,ALL,OUTCNT,FORMAT,DONE) ; from LR7OGM 5 N MISUB,OK,ZERO,INEXACT,DISPDATE,XDT 6 I '$D(^LR(LRDFN,"MI",IDT)) Q 7 S OK=ALL 8 I 'OK S MISUB=0 F S MISUB=+$O(MICROSUB(MISUB)) Q:MISUB<1 I $D(^LR(LRDFN,"MI",IDT,MISUB)) S OK=1 Q 9 I 'OK Q 10 I $G(FORMAT) D 11 .S XDT=9999999-IDT 12 .S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)="^MI^"_XDT D 13 ..; determine if collection time is "inexact" and put the 14 ..; collection day/time that is to be displayed in piece 10 15 ..S ZERO=$G(^LR(LRDFN,"MI",IDT,0)) Q:ZERO="" 16 ..S INEXACT=$P(ZERO,U,2) 17 ..S DISPDATE=$S(INEXACT:XDT\1,1:XDT) 18 ..S $P(^TMP("LR7OGX",$J,"OUTPUT",OUTCNT),U,10)=DISPDATE 19 .S OUTCNT=OUTCNT+1 20 .S DONE=1 21 D MIC(LRDFN,IDT,.OUTCNT) 22 Q 23 ; 24 MIC(LRDFN,LRIDT,OUTCNT) ; 25 N AGE,GCNT,GIOM,LINE,LREND,LRONESPC,LRONETST,NUM,SEX 26 S GCNT=0,GIOM=80,LREND=0,LRONESPC="",LRONETST=0 27 S AGE=$P(^TMP("LR7OG",$J,"G"),U,5),SEX=$P(^("G"),U,6) 28 ; new variables used by LR7OSMZ0 29 N %,A,A8,AB,B,B1,B2,B3,C,CCNT,DIC,DZ,I,IA,II,INC,J,K,LR1PASS,LR2ORMOR,LRAA,LRABCNT,LRACC,LRACNT,LRAD,LRADM,LRADX,LRAFS,LRAMT,LRAN,LRAO,LRAX 30 N LRBN,LRBRR,LRBUG,LRCMNT,LRCOMTAB,LRCS,LRDCOM,LRDOC,LRDRTM1,LRDRTM2,LREF,LRFLAG,LRFMT,LRGRM,LRIFN,LRINT,LRJ02,LRLABKY,LRLLT,LRMYC,LRNS,LRNUM 31 N LRORG,LRPAR,LRPATLOC,LRPC,LRPG,LRPRE,LRPRINT,LRQU,LRRC,LRRES,LRSB,LRSBC1,LRSBC2,LRSET,LRSIC1,LRSIC2,LRSET,LRSIC1,LRSIC2,LRSPEC,LRSSD,LRST 32 N LRTA,LRTB,LRTBA,LRTBC,LRTBS,LRTK,LRTS,LRTSTS,LRTUS,LRUS,LRWRD,LRWRDVEW,N,S1,SP,X,X1,Y,Y1 33 K DIC,LR1PASS,LRBUG,LRDCOM,LRINT,LRRES,LRTS K ^TMP("LR",$J),^TMP("LRC",$J),^TMP("LRT",$J) 34 D EN1^LR7OSMZ0 35 I '$O(^TMP("LRC",$J,0)) Q 36 S NUM=0 F S NUM=$O(^TMP("LRC",$J,NUM)) Q:NUM<1 S LINE=^(NUM,0) D 37 .S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE,OUTCNT=OUTCNT+1 38 S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)="===============================================================================",OUTCNT=OUTCNT+1 39 K ^TMP("LR",$J),^TMP("LRC",$J),^TMP("LRT",$J) 40 Q 1 LR7OGMM ;SLC/STAFF- Interim report rpc memo micro ;5/20/97 18:52 2 ;;5.2;LAB SERVICE;**187,312**;Sep 27, 1994 3 ; 4 MI(LRDFN,IDT,MICROSUB,ALL,OUTCNT,FORMAT,DONE) ; from LR7OGM 5 N MISUB,OK 6 I '$D(^LR(LRDFN,"MI",IDT)) Q 7 S OK=ALL 8 I 'OK S MISUB=0 F S MISUB=+$O(MICROSUB(MISUB)) Q:MISUB<1 I $D(^LR(LRDFN,"MI",IDT,MISUB)) S OK=1 Q 9 I 'OK Q 10 I $G(FORMAT) D 11 .S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)="^MI^"_(9999999-IDT) 12 .S OUTCNT=OUTCNT+1 13 .S DONE=1 14 D MIC(LRDFN,IDT,.OUTCNT) 15 Q 16 ; 17 MIC(LRDFN,LRIDT,OUTCNT) ; 18 N AGE,GCNT,GIOM,LINE,LREND,LRONESPC,LRONETST,NUM,SEX 19 S GCNT=0,GIOM=80,LREND=0,LRONESPC="",LRONETST=0 20 S AGE=$P(^TMP("LR7OG",$J,"G"),U,5),SEX=$P(^("G"),U,6) 21 ; new variables used by LR7OSMZ0 22 N %,A,A8,AB,B,B1,B2,B3,C,CCNT,DIC,DZ,I,IA,II,INC,J,K,LR1PASS,LR2ORMOR,LRAA,LRABCNT,LRACC,LRACNT,LRAD,LRADM,LRADX,LRAFS,LRAMT,LRAN,LRAO,LRAX 23 N LRBN,LRBRR,LRBUG,LRCMNT,LRCOMTAB,LRCS,LRDCOM,LRDOC,LRDRTM1,LRDRTM2,LREF,LRFLAG,LRFMT,LRGRM,LRIFN,LRINT,LRJ02,LRLABKY,LRLLT,LRMYC,LRNS,LRNUM 24 N LRORG,LRPAR,LRPATLOC,LRPC,LRPG,LRPRE,LRPRINT,LRQU,LRRC,LRRES,LRSB,LRSBC1,LRSBC2,LRSET,LRSIC1,LRSIC2,LRSET,LRSIC1,LRSIC2,LRSPEC,LRSSD,LRST 25 N LRTA,LRTB,LRTBA,LRTBC,LRTBS,LRTK,LRTS,LRTSTS,LRTUS,LRUS,LRWRD,LRWRDVEW,N,S1,SP,X,X1,Y,Y1 26 K DIC,LR1PASS,LRBUG,LRDCOM,LRINT,LRRES,LRTS K ^TMP("LR",$J),^TMP("LRC",$J),^TMP("LRT",$J) 27 D EN1^LR7OSMZ0 28 I '$O(^TMP("LRC",$J,0)) Q 29 S NUM=0 F S NUM=$O(^TMP("LRC",$J,NUM)) Q:NUM<1 S LINE=^(NUM,0) D 30 .S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)=LINE,OUTCNT=OUTCNT+1 31 S ^TMP("LR7OGX",$J,"OUTPUT",OUTCNT)="===============================================================================",OUTCNT=OUTCNT+1 32 K ^TMP("LR",$J),^TMP("LRC",$J),^TMP("LRT",$J) 33 Q -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LR7OSAP2.m
r613 r623 1 LR7OSAP2 ;ISL/RAB/WTY/KLL - Silent Routine for autopsy report;3/28/2002 2 ;;5.2;LAB SERVICE;**230,256,259,317,365**;Sep 27, 1994;Build 9 3 ; 4 ;Reference to ^DD(63 supported by IA #999 5 ; 6 EN(LRDFN) ; 7 N CCNT,GIOM,XPOS,LR,LRSS,X,I,LRAU,LRS,VERIFIED,LRTEXT,LRPTR,X2 8 S XPOS=0,(LRS(5),LR("M"),CCNT)=1,LRSS="AU",GIOM=80 9 D EN^LRUA,^LRAPU 10 S X=$S($D(^LRO(69.2,+Y,0)):^(0),1:""),LRAU(3)=$P(X,"^",3),LRAU(4)=$P(X,"^",4) 11 D LINE,LN 12 S ^TMP("LRH",$J,"AUTOPSY")=GCNT,^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(28,CCNT,"---- AUTOPSY ----") 13 S VERIFIED=$P($G(^LR(LRDFN,"AU")),U,15) 14 I 'VERIFIED D Q 15 . D LN 16 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Report not verified.") 17 D TIUCHK^LRAPUTL(.LRPTR,LRDFN,LRSS) 18 I +$G(LRPTR) D Q 19 .D MAIN^LR7OSAP3(LRPTR) 20 D ZZ,LINE 21 I $D(^LR(LRDFN,84)) D 22 .D LN 23 .S LRTEXT="SUPPLEMENTARY REPORT HAS BEEN ADDED" 24 .S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(14,CCNT,"*+* "_LRTEXT_" *+*") 25 .D LN 26 .S LRTEXT="REFER TO BOTTOM OF REPORT" 27 .S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(19,CCNT,"*+* "_LRTEXT_" *+*") 28 .D LN 29 I $D(^LR(LRDFN,81)) D 30 . D LN 31 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,LRAU(3)) 32 . D F(81) 33 I $D(^LR(LRDFN,82)) D 34 . D LN 35 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,LRAU(4)) 36 . D F(82) 37 I $O(^LR(LRDFN,84,0)) D 38 . S I=0 F S I=$O(^LR(LRDFN,84,I)) Q:'I S X=^(I,0) D 39 .. ;Don't print supp date and text if supp has not been released 40 .. S X1=$P(X,"^",1),X2=$P(X,"^",2) 41 .. Q:'X2 42 .. D LINE,LN 43 .. S LRTEXT="SUPPLEMENTARY REPORT DATE: "_$$FMTE^XLFDT(X1,"1P") 44 .. S ^TMP("LRC",$J,GCNT,0)=LRTEXT 45 .. I $O(^LR(LRDFN,84,I,2,0)) D MODSR 46 .. D WRAP^LR7OSAP1("^LR("_LRDFN_",84,"_I_",1)",79) 47 Q:'$D(^LR(LRDFN,"AW"))&('$D(^("AY")))&('$D(^("AWI"))) 48 D WT 49 D LRAPT3 50 ;Removed code that prints SNOMED codes per LR*5.2*259 51 Q 52 MODSR ;Modified Autopsy Supplementary Report Audit Info 53 N LRTEXT,LRSP1,LRSP2,LRFILE,LRIENS,LRR1,LRR2 54 S LRFILE=63.3242 55 D LN 56 S LRTEXT="SUPPLEMENTARY REPORT HAS BEEN ADDED/MODIFIED" 57 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(14,CCNT,"*** "_LRTEXT_" ***") 58 D LN 59 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"(Added/Last modified: ") 60 S LRIENS=I_","_LRDFN_"," 61 S LRSP1=0 62 F S LRSP1=$O(^LR(LRDFN,84,I,2,LRSP1)) Q:'LRSP1 D 63 .S LRSP2=LRSP1 64 Q:'$D(^LR(LRDFN,84,I,2,LRSP2,0)) 65 S LRS2=^LR(LRDFN,84,I,2,LRSP2,0),Y=+LRS2,LRS2A=$P(LRS2,"^",2),LRSGN=" typed by " 66 ;If supp rpt is released, display 'signed by' instead of 'typed by' 67 I $P(LRS2,"^",3) S Y=$P(LRS2,"^",4),LRS2A=$P(LRS2,"^",3),LRSGN=" signed by " 68 S LRS2A=$S($D(^VA(200,LRS2A,0)):$P(^(0),"^"),1:LRS2A) 69 D D^LRU 70 S LRR1=Y,LRR2=LRS2A 71 S ^(0)=^TMP("LRC",$J,GCNT,0)_LRR1_LRSGN_LRR2_")" 72 ;If RELEASED SUPP REPORT MODIFIED set to 1, display "NOT VERIFIED" 73 I $P(^LR(LRDFN,84,I,0),"^",3) D 74 .D LN 75 .S LRTEXT="NOT VERIFIED" 76 .S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(25,CCNT,"**-* "_LRTEXT_" *-**") 77 Q 78 LN ;Increment the counter 79 S GCNT=GCNT+1,CCNT=1 80 Q 81 LINE ;Fill in the global with bank lines 82 N X 83 D LN 84 S X="",$P(X," ",GIOM)="",^TMP("LRC",$J,GCNT,0)=X 85 Q 86 F(NODE) ;; 87 D WRAP^LR7OSAP1("^LR("_LRDFN_","_NODE_")",79) 88 Q 89 D ; 90 N LRB,M,X 91 S LRB=0 92 F S LRB=$O(^LR(LRDFN,"AY",I,1,LRB)) Q:'LRB S X=^(LRB,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,$P(^LAB(61.4,+X,0),"^")) 93 S LRB=0 94 F S LRB=$O(^LR(LRDFN,"AY",I,3,LRB)) Q:'LRB S X=^(LRB,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,$P(^LAB(61.3,+X,0),"^")) 95 S LRB=0 96 F S LRB=$O(^LR(LRDFN,"AY",I,4,LRB)) Q:'LRB S X=^(LRB,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,$P(^LAB(61.5,+X,0),"^")) 97 S M=0 98 F S M=$O(^LR(LRDFN,"AY",I,2,M)) Q:'M S X=^(M,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,$P(^LAB(61.1,+X,0),"^")) D E 99 Q 100 E ; 101 N E 102 S E=0 103 F S E=$O(^LR(LRDFN,"AY",I,2,M,1,E)) Q:'E S X=^(E,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(7,CCNT,$P(^LAB(61.2,+X,0),"^")) 104 Q 105 HD ; 106 D LINE 107 D LN 108 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Organ/tissue:")_$$S^LR7OS(33,CCNT,"SNOMED CODING") 109 Q 110 WT ; 111 N B,X,OUT 112 I '$D(^LR(LRDFN,"AW")) D 113 . D LINE,LN 114 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(20,CCNT,"No organ weights entered.") 115 . D LINE 116 I $D(^LR(LRDFN,"AW")) S X=^("AW") D 117 . S B(9)=$P(X,"^",9),B(1)=$P(X,"^",11,99) 118 . D LINE,LN 119 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Rt--Lung--Lt Liver Spleen RT--Kidney--Lt Brain Body Wt(lb) Ht(in)") 120 I $D(B) D 121 . D LN 122 . S OUT=$$S^LR7OS(XPOS,CCNT,$J($P(X,"^",3),4))_$$S^LR7OS(9,CCNT,$J($P(X,"^",4),4))_$$S^LR7OS(15,CCNT,$J($P(X,"^",5),5))_$$S^LR7OS(22,CCNT,$J($P(X,"^",6),5))_$$S^LR7OS(29,CCNT,$J($P(X,"^",7),4))_$$S^LR7OS(39,CCNT,$J($P(X,"^",8),4)) 123 . S OUT=OUT_$$S^LR7OS(45,CCNT,$J($P(X,"^",10),4))_$$S^LR7OS(55,CCNT,$P(X,"^",2))_$$S^LR7OS(68,CCNT,$P(X,"^")) 124 . S ^TMP("LRC",$J,GCNT,0)=OUT 125 D LINE,LN 126 S ^TMP("LRC",$J,GCNT,0)="" 127 I $D(B) S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Heart(gm)") 128 I $D(^LR(LRDFN,"AV")) S X=^("AV"),B(2)=$P(X,"^",7,99),^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(12,CCNT,"TV(cm) PV(cm) MV(cm) AV(cm) RV(cm) LV(cm)") 129 D LN 130 S ^TMP("LRC",$J,GCNT,0)="" 131 I $D(B(9)) S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,$J(B(9),5)) 132 I $D(B(2)) D 133 . S OUT=$$S^LR7OS(12,CCNT,$J($P(X,"^"),4))_$$S^LR7OS(20,CCNT,$J($P(X,"^",2),4))_$$S^LR7OS(28,CCNT,$J($P(X,"^",3),4))_$$S^LR7OS(36,CCNT,$J($P(X,"^",4),4))_$$S^LR7OS(44,CCNT,$J($P(X,"^",5),4))_$$S^LR7OS(52,CCNT,$J($P(X,"^",6),4)) 134 . S ^(0)=^TMP("LRC",$J,GCNT,0)_OUT 135 . D LINE,LN 136 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Cavities(ml): Rt--Pleural--Lt Pericardial Peritoneal") 137 . D LN 138 . S OUT=$$S^LR7OS(14,CCNT,$J($P(B(2),"^",2),4))_$$S^LR7OS(25,CCNT,$J($P(B(2),"^"),4))_$$S^LR7OS(33,CCNT,$J($P(B(2),"^",3),4))_$$S^LR7OS(45,CCNT,$J($P(B(2),"^",4),4)) 139 . S ^TMP("LRC",$J,GCNT,0)=OUT 140 I $D(B(1)) F B=1:1:8 D 141 . I $P(B(1),"^",B) D 142 .. S X="25."_B 143 .. D LN 144 .. S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,$P(^DD(63,X,0),"^")_": "_$P(B(1),"^",B)) 145 I $D(^LR(LRDFN,"AWI")) S Y=^("AWI") F B=1:1:5 I $P(Y,"^",B) D LN S X=$S(B=1:25.9,1:25.9_(B-1)),^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,$P(^DD(63,X,0),"^")_": "_$P(Y,"^",B)) 146 Q 147 ZZ ;; 148 D LN 149 N OUT,X,LRLLOC,DA,A,B,C,LR,Y 150 S:$G(PNM)="" PNM=$P(^DPT(DFN,0),U) ;DBIA #10035 151 S OUT=$$S^LR7OS(XPOS,CCNT,"Acc #")_$$S^LR7OS(9,CCNT,"Date/time Died")_$$S^LR7OS(27,CCNT,"Age")_$$S^LR7OS(33,CCNT,"AUTOPSY DATA")_$$S^LR7OS(53,CCNT,"Date/time of Autopsy"),^TMP("LRC",$J,GCNT,0)=OUT 152 S X=^LR(LRDFN,"AU"),LRLLOC=$P(X,"^",8),DA=LRDFN 153 D D^LRAUAW 154 S Y=LR(63,12) 155 D D^LRU,LN 156 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,($P(X,"^",6)_" "_Y))_$$S^LR7OS(26,CCNT,$J($P(X,"^",9),3))_$$S^LR7OS(33,CCNT,$G(PNM)) 157 S Y=+X 158 D D^LRU 159 I Y'[1700 S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(53,CCNT,Y) 160 D LN 161 S ^TMP("LRC",$J,GCNT,0)="" 162 F X(1)=7,10 D 163 . S Y=$P(X,"^",X(1)),Y=$S(Y="":Y,$D(^VA(200,Y,0)):$P(^(0),"^"),1:Y) 164 . I Y]"" S ^TMP("LRC",$J,GCNT,0)=^TMP("LRC",$J,GCNT,0)_$S(X(1)=7:$$S^LR7OS(1,CCNT,"Resident: ")_Y,1:$$S^LR7OS(38,CCNT,"Senior: ")_Y) 165 Q 166 LRAPT3 ;COPIED FROM ^LRAPT3 167 ;; 168 N A,C,X,T,F 169 S (F,A)=0 170 F S A=$O(^LR(LRDFN,"AY",A)) Q:'A D 171 .I $D(^LR(LRDFN,"AY",A,0)) S T=+^(0) D 172 ..S T(1)=$P($G(^LAB(61,T,0)),"^") 173 ..S C=0 F S C=$O(^LR(LRDFN,"AY",A,5,C)) Q:'C D 174 ...S X=^LR(LRDFN,"AY",A,5,C,0) D SP(X) S F=1 175 ;Removed code that prints ICD codes per LR*5.2*259 176 Q 177 SP(NODE) ; 178 N Y,E,X,A1,B 179 S Y=$P(NODE,"^",2),E=$P(NODE,"^",3),X=$P(NODE,"^")_":",A1=$P($P(LRAU("S"),X,2),";",1) 180 D D^LRU 181 S T(2)=Y 182 I 'F D LINE,LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,T(1)) 183 D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,A1_" "_E_" Date: "_T(2)) 184 D WRAP^LR7OSAP1("^LR("_LRDFN_",""AY"","_A_",5,"_C_",1)",80) 185 Q 186 OUT ;Show output 187 Q:'$D(^TMP("LRC",$J)) 188 N I 189 S I=0 190 F S I=$O(^TMP("LRC",$J,I)) Q:'I W !,^(I,0) 191 Q 1 LR7OSAP2 ;ISL/RAB/WTY/KLL -Silent Routine for autopsy report;3/28/2002 2 ;;5.2;LAB SERVICE;**230,256,259,317**;Sep 27, 1994 3 ; 4 ;Reference to ^DD(63 supported by IA #999 5 ; 6 EN(LRDFN) ; 7 N CCNT,GIOM,XPOS,LR,LRSS,X,I,LRAU,LRS,VERIFIED,LRTEXT,LRPTR,X2 8 S XPOS=0,(LRS(5),LR("M"),CCNT)=1,LRSS="AU",GIOM=80 9 D EN^LRUA,^LRAPU 10 S X=$S($D(^LRO(69.2,+Y,0)):^(0),1:""),LRAU(3)=$P(X,"^",3),LRAU(4)=$P(X,"^",4) 11 D LINE,LN 12 S ^TMP("LRH",$J,"AUTOPSY")=GCNT,^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(28,CCNT,"---- AUTOPSY ----") 13 S VERIFIED=$P($G(^LR(LRDFN,"AU")),U,15) 14 I 'VERIFIED D Q 15 . D LN 16 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Report not verified.") 17 D TIUCHK^LRAPUTL(.LRPTR,LRDFN,LRSS) 18 I +$G(LRPTR) D Q 19 .D MAIN^LR7OSAP3(LRPTR) 20 D ZZ,LINE 21 I $D(^LR(LRDFN,84)) D 22 .D LN 23 .S LRTEXT="SUPPLEMENTARY REPORT HAS BEEN ADDED" 24 .S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(14,CCNT,"*+* "_LRTEXT_" *+*") 25 .D LN 26 .S LRTEXT="REFER TO BOTTOM OF REPORT" 27 .S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(19,CCNT,"*+* "_LRTEXT_" *+*") 28 .D LN 29 I $D(^LR(LRDFN,81)) D 30 . D LN 31 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,LRAU(3)) 32 . D F(81) 33 I $D(^LR(LRDFN,82)) D 34 . D LN 35 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,LRAU(4)) 36 . D F(82) 37 I $O(^LR(LRDFN,84,0)) D 38 . S I=0 F S I=$O(^LR(LRDFN,84,I)) Q:'I S X=^(I,0) D 39 .. ;Don't print supp date and text if supp has not been released 40 .. S X1=$P(X,"^",1),X2=$P(X,"^",2) 41 .. Q:'X2 42 .. D LINE,LN 43 .. S LRTEXT="SUPPLEMENTARY REPORT DATE: "_$$FMTE^XLFDT(X1,"1P") 44 .. S ^TMP("LRC",$J,GCNT,0)=LRTEXT 45 .. I $O(^LR(LRDFN,84,I,2,0)) D MODSR 46 .. D WRAP^LR7OSAP1("^LR("_LRDFN_",84,"_I_",1)",79) 47 Q:'$D(^LR(LRDFN,"AW"))&('$D(^("AY")))&('$D(^("AWI"))) 48 D WT 49 D LRAPT3 50 ;Removed code that prints SNOMED codes per LR*5.2*259 51 Q 52 MODSR ;Modified Autopsy Supplementary Report Audit Info 53 N LRTEXT,LRSP1,LRSP2,LRFILE,LRIENS,LRR1,LRR2 54 S LRFILE=63.3242 55 D LN 56 S LRTEXT="SUPPLEMENTARY REPORT HAS BEEN ADDED/MODIFIED" 57 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(14,CCNT,"*** "_LRTEXT_" ***") 58 D LN 59 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"(Added/Last modified: ") 60 S LRIENS=I_","_LRDFN_"," 61 S LRSP1=0 62 F S LRSP1=$O(^LR(LRDFN,84,I,2,LRSP1)) Q:'LRSP1 D 63 .S LRSP2=LRSP1 64 Q:'$D(^LR(LRDFN,84,I,2,LRSP2,0)) 65 S LRS2=^(0),Y=+LRS2,LRS2A=$P(LRS2,"^",2),LRSGN=" typed by " 66 ;If supp rpt is released, display 'signed by' instead of 'typed by' 67 I $P(LRS2,"^",3) S Y=$P(LRS2,"^",4),LRS2A=$P(LRS2,"^",3),LRSGN=" signed by " 68 S LRS2A=$S($D(^VA(200,LRS2A,0)):$P(^(0),"^"),1:LRS2A) 69 D D^LRU 70 S LRR1=Y,LRR2=LRS2A 71 S ^(0)=^TMP("LRC",$J,GCNT,0)_LRR1_LRSGN_LRR2_")" 72 ;If RELEASED SUPP REPORT MODIFIED set to 1, display "NOT VERIFIED" 73 I $P(^LR(LRDFN,84,I,0),"^",3) D 74 .D LN 75 .S LRTEXT="NOT VERIFIED" 76 .S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(25,CCNT,"**-* "_LRTEXT_" *-**") 77 Q 78 LN ;Increment the counter 79 S GCNT=GCNT+1,CCNT=1 80 Q 81 LINE ;Fill in the global with bank lines 82 N X 83 D LN 84 S X="",$P(X," ",GIOM)="",^TMP("LRC",$J,GCNT,0)=X 85 Q 86 F(NODE) ;; 87 D WRAP^LR7OSAP1("^LR("_LRDFN_","_NODE_")",79) 88 Q 89 D ; 90 N LRB,M,X 91 S LRB=0 92 F S LRB=$O(^LR(LRDFN,"AY",I,1,LRB)) Q:'LRB S X=^(LRB,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,$P(^LAB(61.4,+X,0),"^")) 93 S LRB=0 94 F S LRB=$O(^LR(LRDFN,"AY",I,3,LRB)) Q:'LRB S X=^(LRB,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,$P(^LAB(61.3,+X,0),"^")) 95 S LRB=0 96 F S LRB=$O(^LR(LRDFN,"AY",I,4,LRB)) Q:'LRB S X=^(LRB,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,$P(^LAB(61.5,+X,0),"^")) 97 S M=0 98 F S M=$O(^LR(LRDFN,"AY",I,2,M)) Q:'M S X=^(M,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,$P(^LAB(61.1,+X,0),"^")) D E 99 Q 100 E ; 101 N E 102 S E=0 103 F S E=$O(^LR(LRDFN,"AY",I,2,M,1,E)) Q:'E S X=^(E,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(7,CCNT,$P(^LAB(61.2,+X,0),"^")) 104 Q 105 HD ; 106 D LINE 107 D LN 108 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Organ/tissue:")_$$S^LR7OS(33,CCNT,"SNOMED CODING") 109 Q 110 WT ; 111 N B,X,OUT 112 I '$D(^LR(LRDFN,"AW")) D 113 . D LINE,LN 114 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(20,CCNT,"No organ weights entered.") 115 . D LINE 116 I $D(^LR(LRDFN,"AW")) S X=^("AW") D 117 . S B(9)=$P(X,"^",9),B(1)=$P(X,"^",11,99) 118 . D LINE,LN 119 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Rt--Lung--Lt Liver Spleen RT--Kidney--Lt Brain Body Wt(lb) Ht(in)") 120 I $D(B) D 121 . D LN 122 . S OUT=$$S^LR7OS(XPOS,CCNT,$J($P(X,"^",3),4))_$$S^LR7OS(9,CCNT,$J($P(X,"^",4),4))_$$S^LR7OS(15,CCNT,$J($P(X,"^",5),5))_$$S^LR7OS(22,CCNT,$J($P(X,"^",6),5))_$$S^LR7OS(29,CCNT,$J($P(X,"^",7),4))_$$S^LR7OS(39,CCNT,$J($P(X,"^",8),4)) 123 . S OUT=OUT_$$S^LR7OS(45,CCNT,$J($P(X,"^",10),4))_$$S^LR7OS(55,CCNT,$P(X,"^",2))_$$S^LR7OS(68,CCNT,$P(X,"^")) 124 . S ^TMP("LRC",$J,GCNT,0)=OUT 125 D LINE,LN 126 S ^TMP("LRC",$J,GCNT,0)="" 127 I $D(B) S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Heart(gm)") 128 I $D(^LR(LRDFN,"AV")) S X=^("AV"),B(2)=$P(X,"^",7,99),^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(12,CCNT,"TV(cm) PV(cm) MV(cm) AV(cm) RV(cm) LV(cm)") 129 D LN 130 S ^TMP("LRC",$J,GCNT,0)="" 131 I $D(B(9)) S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,$J(B(9),5)) 132 I $D(B(2)) D 133 . S OUT=$$S^LR7OS(12,CCNT,$J($P(X,"^"),4))_$$S^LR7OS(20,CCNT,$J($P(X,"^",2),4))_$$S^LR7OS(28,CCNT,$J($P(X,"^",3),4))_$$S^LR7OS(36,CCNT,$J($P(X,"^",4),4))_$$S^LR7OS(44,CCNT,$J($P(X,"^",5),4))_$$S^LR7OS(52,CCNT,$J($P(X,"^",6),4)) 134 . S ^(0)=^TMP("LRC",$J,GCNT,0)_OUT 135 . D LINE,LN 136 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Cavities(ml): Rt--Pleural--Lt Pericardial Peritoneal") 137 . D LN 138 . S OUT=$$S^LR7OS(14,CCNT,$J($P(B(2),"^",2),4))_$$S^LR7OS(25,CCNT,$J($P(B(2),"^"),4))_$$S^LR7OS(33,CCNT,$J($P(B(2),"^",3),4))_$$S^LR7OS(45,CCNT,$J($P(B(2),"^",4),4)) 139 . S ^TMP("LRC",$J,GCNT,0)=OUT 140 I $D(B(1)) F B=1:1:8 D 141 . I $P(B(1),"^",B) D 142 .. S X="25."_B 143 .. D LN 144 .. S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,$P(^DD(63,X,0),"^")_": "_$P(B(1),"^",B)) 145 I $D(^LR(LRDFN,"AWI")) S Y=^("AWI") F B=1:1:5 I $P(Y,"^",B) D LN S X=$S(B=1:25.9,1:25.9_(B-1)),^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,$P(^DD(63,X,0),"^")_": "_$P(Y,"^",B)) 146 Q 147 ZZ ;; 148 D LN 149 N OUT,X,LRLLOC,DA,A,B,C,LR,Y 150 S OUT=$$S^LR7OS(XPOS,CCNT,"Acc #")_$$S^LR7OS(9,CCNT,"Date/time Died")_$$S^LR7OS(27,CCNT,"Age")_$$S^LR7OS(33,CCNT,"AUTOPSY DATA")_$$S^LR7OS(53,CCNT,"Date/time of Autopsy"),^TMP("LRC",$J,GCNT,0)=OUT 151 S X=^LR(LRDFN,"AU"),LRLLOC=$P(X,"^",8),DA=LRDFN 152 D D^LRAUAW 153 S Y=LR(63,12) 154 D D^LRU,LN 155 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,($P(X,"^",6)_" "_Y))_$$S^LR7OS(26,CCNT,$J($P(X,"^",9),3))_$$S^LR7OS(33,CCNT,PNM) 156 S Y=+X 157 D D^LRU 158 I Y'[1700 S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(53,CCNT,Y) 159 D LN 160 S ^TMP("LRC",$J,GCNT,0)="" 161 F X(1)=7,10 D 162 . S Y=$P(X,"^",X(1)),Y=$S(Y="":Y,$D(^VA(200,Y,0)):$P(^(0),"^"),1:Y) 163 . I Y]"" S ^TMP("LRC",$J,GCNT,0)=^TMP("LRC",$J,GCNT,0)_$S(X(1)=7:$$S^LR7OS(1,CCNT,"Resident: ")_Y,1:$$S^LR7OS(38,CCNT,"Senior: ")_Y) 164 Q 165 LRAPT3 ;COPIED FROM ^LRAPT3 166 ;; 167 N A,C,X,T,F 168 S (F,A)=0 169 F S A=$O(^LR(LRDFN,"AY",A)) Q:'A D 170 .I $D(^LR(LRDFN,"AY",A,0)) S T=+^(0) D 171 ..S T(1)=$P($G(^LAB(61,T,0)),"^") 172 ..S C=0 F S C=$O(^LR(LRDFN,"AY",A,5,C)) Q:'C D 173 ...S X=^LR(LRDFN,"AY",A,5,C,0) D SP(X) S F=1 174 ;Removed code that prints ICD codes per LR*5.2*259 175 Q 176 SP(NODE) ; 177 N Y,E,X,A1,B 178 S Y=$P(NODE,"^",2),E=$P(NODE,"^",3),X=$P(NODE,"^")_":",A1=$P($P(LRAU("S"),X,2),";",1) 179 D D^LRU 180 S T(2)=Y 181 I 'F D LINE,LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,T(1)) 182 D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,A1_" "_E_" Date: "_T(2)) 183 D WRAP^LR7OSAP1("^LR("_LRDFN_",""AY"","_A_",5,"_C_",1)",80) 184 Q 185 OUT ;Show output 186 Q:'$D(^TMP("LRC",$J)) 187 N I 188 S I=0 189 F S I=$O(^TMP("LRC",$J,I)) Q:'I W !,^(I,0) 190 Q -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRAPBR1.m
r613 r623 1 LRAPBR1 ;DALOI/WTY/KLL;AP Browser Print Cont.;11/08/01 2 ;;5.2;LAB SERVICE;**259,317,363**;Sep 27, 1994;Build 3 3 ; 4 ; 5 ENTER ;from LRAPBR 6 N LRCNT,LRTMP,LRA1,LRADESC,LRLENG1,LRLENG2,LRFILE,LRAPMD 7 N LRFLD,LRV,LRV1,LRV2,LRB1,LRTEXT,LRSPCE,LRIENS,LRAPMR 8 Q:'$D(^LR(LRDFN,LRSS,LRI,0)) 9 S:'LRTIU GROOT="^TMP(""LRAPBR"",$J," 10 S:LRTIU GROOT="^TMP(""TIUP"",$J," 11 D INP^VADPT S LRPRAC=+VAIN(2) 12 S:'LRPRAC LRPRAC(1)="" 13 I LRPRAC S X=LRPRAC D D^LRUA S LRPRAC(1)=X 14 S LRQ=0 D ^LRUA,HEADER 15 S LR("F")=1 16 D DASH 17 D:LRTIU GLENTRY("$TEXT",,1) 18 D GLENTRY("Submitted by: "_LRW(5),"",1) 19 D GLENTRY("Date obtained: "_LRTK,44) 20 D:LRA DASH 21 MAIN ; 22 D SPEC 23 D MODCHK 24 D SUPBNNR 25 D DIAG 26 D DOC 27 D WPFLD 28 D SUPRPT 29 D SSJR 30 Q 31 SPEC ;List specimens 32 D GLENTRY("Specimen (Received "_LRTK(1)_"):","",1) 33 S LRCNT=$P(^LR(LRDFN,LRSS,LRI,.1,0),U,4) 34 Q:'LRCNT 35 S LRFILE=+$$GET1^DID(LRSF,.012,"","SPECIFIER") 36 S LRIENS=LRI_","_LRDFN_"," 37 S LRCT2=0 38 F LRB1=1:1 D Q:LRCT2=LRCNT 39 .D GETS^DIQ(LRFILE,LRB1_","_LRIENS,.01,"","LRTMP("_LRB1_")") 40 .I $D(LRTMP(LRB1)) S LRCT2=LRCT2+1 41 S LRA1=0 F S LRA1=$O(LRTMP(LRA1)) Q:'LRA1 D 42 .S LRTEXT=LRTMP(LRA1,LRFILE,LRA1_","_LRIENS,.01) 43 .D GLENTRY(LRTEXT,"",1) 44 Q 45 MODCHK ;Display modified banner if required 46 S LRAPMR=$$GET1^DIQ(LRSF,LRIENS,.17,"I") 47 Q:'LRAPMR 48 S LRAPMD=$$GET1^DIQ(LRSF,LRIENS,.172,"I") 49 D GLENTRY("","",1) 50 S LRTEXT="" 51 F LRCNT=1:1:$S(LRAPMD:14,1:15) D 52 .S LRTEXT=LRTEXT_"*+" 53 S LRTEXT=LRTEXT_" MODIFIED " 54 S LRTEXT=LRTEXT_$S(LRAPMD:"DIAGNOSIS ",1:"REPORT ") 55 F LRCNT=1:1:$S(LRAPMD:14,1:15) D 56 .S LRTEXT=LRTEXT_"*+" 57 D GLENTRY(LRTEXT,"",1) 58 D GLENTRY("","",1) 59 Q 60 SUPBNNR ;Display supplementary report header if one or more has been added 61 I $P($G(^LR(LRDFN,LRSS,LRI,1.2,0)),U,4) D 62 .S LRTEXT="*+* SUPPLEMENTARY REPORT HAS BEEN ADDED *+*" 63 .D GLENTRY($$CJ^XLFSTR(LRTEXT,IOM),"",1) 64 .S LRTEXT="*+* REFER TO BOTTOM OF REPORT *+*" 65 .D GLENTRY($$CJ^XLFSTR(LRTEXT,IOM),"",1) 66 .D GLENTRY("","",1) 67 Q 68 DIAG ; 69 ;Display the Brief Clinical History, Preoperative Diagnosis, 70 ;Operative Findings, and Postoperative Diagnosis 71 S LRFILE=LRSF,LRCNT=0,LRIENS=LRI_","_LRDFN_"," 72 F LRFLD=.013:.001:.016 D 73 .D:LRA DASH 74 .S LRCNT=LRCNT+1 75 .D GLENTRY($P($T(TEXT1+LRCNT),";",2),"",1) 76 .D WP 77 Q 78 DOC ; 79 ;Pathologist information 80 D GLENTRY("","",1) 81 D GLENTRY("Surgeon/physician: "_LRMD,27,1) 82 D:LRA GLENTRY(LR("%1"),"",1) 83 D DASH 84 D HEADER2 85 D:LRA DASH 86 I LRRC="" D 87 .D GLENTRY("+*+* REPORT INCOMPLETE *+*+",20,1) 88 .D GLENTRY("","",1) 89 D GLENTRY("","",1) 90 I LRRMD'="" D 91 .S LRCNT=0 F LRA1="SP","CY","EM" D 92 ..S LRCNT=LRCNT+1 93 ..S LRTMP(LRA1)=$P($T(TEXT2+LRCNT),";",3) 94 .S LRTMP=LRTMP(LRSS) 95 .D GLENTRY(LRTMP_" "_LRRMD,31) 96 Q 97 WPFLD ; 98 ;Display Frozen Section, Gross Description, Microscopic Description 99 ;and Surgical Path Diagnosis 100 F LRCNT=1:1:4 D 101 .S X=$T(FIELDS+LRCNT) 102 .S LRV=$P(X,";",2),LRV1=$P(X,";",3),LRV2=$P(X,";",4) 103 .D TEXTCHK 104 .I $P($G(^LR(LRDFN,LRSS,LRI,LRV,0)),U,4) D 105 ..D GLENTRY("","",1),GLENTRY(LR(69.2,LRV1),"",1) 106 ..S LRFILE=LRSF,LRIENS=LRI_","_LRDFN_",",LRFLD=LRV 107 ..I $P($G(^LR(LRDFN,LRSS,LRI,LRV2,0)),U,4) D 108 ...S LRFILE1=+$$GET1^DID(LRSF,LRV2,"","SPECIFIER") 109 ...D GLENTRY("*+* MODIFIED REPORT *+*",28,1) 110 ...D GLENTRY("(Last modified: ","",1) 111 ...S (LRA1,LRB1)=0 112 ...F S LRA1=$O(^LR(LRDFN,LRSS,LRI,LRV2,LRA1)) Q:'LRA1 S LRB1=LRA1 113 ...Q:'$D(^LR(LRDFN,LRSS,LRI,LRV2,LRB1,0)) 114 ...S LRSR1=$$GET1^DIQ(LRFILE1,LRB1_","_LRIENS,.01) 115 ...S LRSR2=$$GET1^DIQ(LRFILE1,LRB1_","_LRIENS,.02) 116 ...S LRTEXT=LRSR1_" typed by "_LRSR2_")" 117 ...D GLENTRY(LRTEXT,BTAB) 118 ..D WP 119 Q 120 SUPRPT ;Supplementary Report 121 I $P($G(^LR(LRDFN,LRSS,LRI,1.2,0)),U,4) D 122 .S LRFILE=+$$GET1^DID(LRSF,1.2,"","SPECIFIER") 123 .S LRIENS1=LRI_","_LRDFN_"," 124 .D GLENTRY("","",1),GLENTRY("SUPPLEMENTARY REPORT(S):","",1) 125 .S LRV=0 F S LRV=$O(^LR(LRDFN,LRSS,LRI,1.2,LRV)) Q:'LRV D 126 ..S LRIENS=LRV_","_LRIENS1 127 ..S LRSR1=$$GET1^DIQ(LRFILE,LRIENS,.01) 128 ..S LRSR2=+$$GET1^DIQ(LRFILE,LRIENS,.02) 129 ..D GLENTRY("Supplementary Report Date: "_LRSR1,3,1) 130 ..I $D(LR("R")),'LRSR2 D GLENTRY(" not verified",BTAB) Q 131 ..I $P($G(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,0)),U,4) D 132 ...S LRTEXT="*+* SUPPLEMENTARY REPORT HAS BEEN ADDED/MODIFIED *+*" 133 ...D GLENTRY($$CJ^XLFSTR(LRTEXT,IOM),"",1) 134 ...D GLENTRY("(Added/Last","",1) 135 ...S (LRA1,LRB1)=0 136 ...F S LRA1=$O(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,LRA1)) Q:'LRA1 D 137 ....S LRB1=LRA1 138 ...Q:'$D(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,LRB1,0)) 139 ...S LRA2=^(0),Y=+LRA2,LRA2A=$P(LRA2,"^",2),LRSGN=" Typed by ",LRDSC=" modified: " 140 ...I $P(LRA2,"^",3) S LRSGN=" Signed by ",LRDSC=" released: ",LRA2A=$P(LRA2,"^",3),Y=$P(LRA2,"^",4) 141 ...S LRA2A=$S($D(^VA(200,LRA2A,0)):$P(^(0),"^"),1:LRA2A) 142 ...D D^LRU 143 ...D GLENTRY(LRDSC_Y_LRSGN_LRA2A_")",BTAB) 144 ..S LRFLD=1 D WP 145 ..D GLENTRY("","",1) 146 Q 147 SSJR ;Print special studies/journal references 148 D ^LRAPBR3 149 S LREFLG=1 150 Q 151 WP ;Display word procesing fields 152 K LRTMP,^UTILITY($J,"W") 153 N X,DIWR,DIWL,LRINC 154 S X=$$GET1^DIQ(LRFILE,LRIENS,LRFLD,"","LRTMP",) 155 S DIWR=IOM-5,DIWL=5,DIWF="" 156 S X=+$$GET1^DID(LRFILE,LRFLD,"","SPECIFIER") 157 I $$GET1^DID(X,.01,"","SPECIFIER")["L" S DIWF="N" 158 S LRINC=0 159 F S LRINC=$O(LRTMP(LRINC)) Q:'LRINC S X=LRTMP(LRINC) D ^DIWP 160 S LRINC=0 161 F S LRINC=$O(^UTILITY($J,"W",DIWL,LRINC)) Q:'LRINC D 162 .D GLENTRY(^UTILITY($J,"W",DIWL,LRINC,0),DIWL,1) 163 K ^UTILITY($J,"W") 164 Q 165 HEADER ; 166 D:LRTIU GLENTRY("$APHDR",,1) 167 D GLENTRY("","",1) 168 D DASH 169 D GLENTRY("MEDICAL RECORD |",5,1) 170 D GLENTRY(LRAA1,40) 171 D DASH 172 HEADER2 ; 173 S LRADESC="Accession No. "_$S(LRQ(8)]"":LRQ(8)_LRW(1)_" "_LRAC,1:LRAC) 174 S LRLENG1=$L(LRQ(1)),LRLENG2=$L(LRADESC),LRSPCE=IOM-LRLENG2-14 175 S:LRLENG1>LRSPCE LRQ(1)=$E(LRQ(1),1,LRSPCE) 176 D GLENTRY("PATHOLOGY REPORT",30,1) 177 D GLENTRY("Laboratory: "_LRQ(1),"",1) 178 D GLENTRY(LRADESC,IOM-LRLENG2-1) 179 Q 180 FOOTER ;Footer-called from ^LRAPBR 181 D:LRTIU GLENTRY("$FTR",,1) 182 D DASH 183 S LRTEXT=$S('$D(LR("W")):"",1:"See signed copy in chart") 184 D GLENTRY(LRTEXT,"",1) 185 S LRTEXT="("_$S($D(LREFLG):"End of report",1:"See next page")_")" 186 D GLENTRY(LRTEXT,57) 187 D GLENTRY(LRPMD,"",1),GLENTRY(LRW(9),52),GLENTRY("| Date "_LRRC,55) 188 D DASH 189 D GLENTRY(LRP,"",1) 190 S LRTEXT=$S('$D(LR("W")):"STANDARD FORM 515",1:"WORK COPY ONLY !!") 191 D GLENTRY(LRTEXT,50) 192 D GLENTRY("ID:"_SSN,"",1) 193 D GLENTRY("SEX:"_SEX,16),GLENTRY(" DOB:"_DOB,BTAB) 194 I AGE D 195 .S LRTEXT=$S($G(VADM(6))]"":" AGE AT DEATH: ",1:" AGE: ")_AGE 196 .D GLENTRY(LRTEXT,BTAB) 197 D GLENTRY(" LOC:"_LRLLOC,BTAB) 198 D GLENTRY("","",1) 199 D:$L(LRADM) GLENTRY("ADM:"_$P(LRADM,"@"),BTAB) 200 D:$L(LRADX) GLENTRY("DX:"_$E(LRADX,1,26),17) 201 D GLENTRY("PCP:",46) 202 D:$L(LRPRAC) GLENTRY($E(LRPRAC(1),1,28),51) 203 Q 204 ESIGLN ;Write signature block name, title, and date of signature 205 D GLENTRY(,,1) 206 I $D(^VA(200,DUZ,0)) D 207 .S LRFILE=200,LRFLD=20.2,LRFLD2=20.3 208 .S X=$$GET1^DIQ(LRFILE,DUZ,LRFLD) 209 ;Compare DUZ to pathologist, if different, use proxy signature 210 S:LRSS="AU" LRPATH=$$GET1^DIQ(63,LRDFN,13.6,"I") 211 I LRSS'="AU" D 212 .S LRFL2=$S(LRSS="EM":63.02,LRSS="CY":63.09,LRSS="SP":63.08,1:0) 213 .S LRIENS=LRI_","_LRDFN_"," 214 .S LRPATH=$$GET1^DIQ(LRFL2,LRIENS,.02,"I") 215 S LRPATH2="" 216 S:LRPATH'=DUZ LRPATH2=" FOR "_$$GET1^DIQ(LRFILE,LRPATH,LRFLD) 217 S LRTEXT="/es/ "_X_LRPATH2 218 ;S LRTEXT="/es/ "_X 219 D GLENTRY(LRTEXT,,1) 220 S X=$$GET1^DIQ(LRFILE,DUZ,LRFLD2) 221 S LRTEXT=X 222 D GLENTRY(LRTEXT,,1) 223 S Y=LRNTIME D DD^%DT 224 S LRTEXT="Signed "_Y 225 D GLENTRY(LRTEXT,,1) 226 Q 227 DASH ;Display a line of dashes 228 D GLENTRY(LR("%"),"",1) 229 Q 230 GLENTRY(LRPR1,LRPR2,LRPR3) ;Write to global 231 ;LRPR1 = Text to be written to global 232 ;LRPR2 = Tab position 233 ;LRPR3 = 1 means start a new line. Othewise, write an current line. 234 S LRPR1=$G(LRPR1) 235 S LRPR2=+$G(LRPR2) 236 S LRPR3=+$G(LRPR3) 237 D:LRPR3 NEWLN^LRAPUTL(LRPR1,LRPR2) 238 D:'LRPR3 GLBWRT^LRAPUTL(LRPR1,LRPR2) 239 Q 240 TEXT1 ;Text for top of report 241 ;BRIEF CLINICAL HISTORY: 242 ;PREOPERATIVE DIAGNOSIS: 243 ;OPERATIVE FINDINGS: 244 ;POSTOPERATIVE DIAGNOSIS: 245 TEXT2 ;Descriptive text based on section 246 ;SP;Pathology Resident: 247 ;CY;Screened by: 248 ;EM;Prepared by: 249 FIELDS ;Field numbers for word processing fields 250 ;1.3;.13;6 251 ;1;.03;7 252 ;1.1;.04;4 253 ;1.4;.14;5 254 TEXTCHK ; update text line counter if it is missing (Remedy 116253) 255 N I,X,DATA 256 S I=0 257 K ^TMP("WP",$J) 258 S X=$G(^LR(LRDFN,LRSS,LRI,LRV,0)) 259 I X'="",$L(X,"^")=1 D 260 . F S I=$O(^LR(LRDFN,LRSS,LRI,LRV,I)) Q:I="" D 261 . . S DATA=$G(^LR(LRDFN,LRSS,LRI,LRV,I,0)) 262 . . S ^TMP("WP",$J,I,0)=DATA 263 I $D(^TMP("WP",$J)) D 264 . D WP^DIE(63.08,LRI_","_LRDFN_",",LRV,"","^TMP(""WP"",$J)") 265 . K ^TMP("WP",$J) 266 Q 1 LRAPBR1 ;DALOI/WTY/KLL;AP Browser Print Cont.;11/08/01 2 ;;5.2;LAB SERVICE;**259,317**;Sep 27, 1994 3 ; 4 ; 5 ENTER ;from LRAPBR 6 N LRCNT,LRTMP,LRA1,LRADESC,LRLENG1,LRLENG2,LRFILE,LRAPMD 7 N LRFLD,LRV,LRV1,LRV2,LRB1,LRTEXT,LRSPCE,LRIENS,LRAPMR 8 Q:'$D(^LR(LRDFN,LRSS,LRI,0)) 9 S:'LRTIU GROOT="^TMP(""LRAPBR"",$J," 10 S:LRTIU GROOT="^TMP(""TIUP"",$J," 11 D INP^VADPT S LRPRAC=+VAIN(2) 12 S:'LRPRAC LRPRAC(1)="" 13 I LRPRAC S X=LRPRAC D D^LRUA S LRPRAC(1)=X 14 S LRQ=0 D ^LRUA,HEADER 15 S LR("F")=1 16 D DASH 17 D:LRTIU GLENTRY("$TEXT",,1) 18 D GLENTRY("Submitted by: "_LRW(5),"",1) 19 D GLENTRY("Date obtained: "_LRTK,44) 20 D:LRA DASH 21 MAIN ; 22 D SPEC 23 D MODCHK 24 D SUPBNNR 25 D DIAG 26 D DOC 27 D WPFLD 28 D SUPRPT 29 D SSJR 30 Q 31 SPEC ;List specimens 32 D GLENTRY("Specimen (Received "_LRTK(1)_"):","",1) 33 S LRCNT=$P(^LR(LRDFN,LRSS,LRI,.1,0),U,4) 34 Q:'LRCNT 35 S LRFILE=+$$GET1^DID(LRSF,.012,"","SPECIFIER") 36 S LRIENS=LRI_","_LRDFN_"," 37 S LRCT2=0 38 F LRB1=1:1 D Q:LRCT2=LRCNT 39 .D GETS^DIQ(LRFILE,LRB1_","_LRIENS,.01,"","LRTMP("_LRB1_")") 40 .I $D(LRTMP(LRB1)) S LRCT2=LRCT2+1 41 S LRA1=0 F S LRA1=$O(LRTMP(LRA1)) Q:'LRA1 D 42 .S LRTEXT=LRTMP(LRA1,LRFILE,LRA1_","_LRIENS,.01) 43 .D GLENTRY(LRTEXT,"",1) 44 Q 45 MODCHK ;Display modified banner if required 46 S LRAPMR=$$GET1^DIQ(LRSF,LRIENS,.17,"I") 47 Q:'LRAPMR 48 S LRAPMD=$$GET1^DIQ(LRSF,LRIENS,.172,"I") 49 D GLENTRY("","",1) 50 S LRTEXT="" 51 F LRCNT=1:1:$S(LRAPMD:14,1:15) D 52 .S LRTEXT=LRTEXT_"*+" 53 S LRTEXT=LRTEXT_" MODIFIED " 54 S LRTEXT=LRTEXT_$S(LRAPMD:"DIAGNOSIS ",1:"REPORT ") 55 F LRCNT=1:1:$S(LRAPMD:14,1:15) D 56 .S LRTEXT=LRTEXT_"*+" 57 D GLENTRY(LRTEXT,"",1) 58 D GLENTRY("","",1) 59 Q 60 SUPBNNR ;Display supplementary report header if one or more has been added 61 I $P($G(^LR(LRDFN,LRSS,LRI,1.2,0)),U,4) D 62 .S LRTEXT="*+* SUPPLEMENTARY REPORT HAS BEEN ADDED *+*" 63 .D GLENTRY($$CJ^XLFSTR(LRTEXT,IOM),"",1) 64 .S LRTEXT="*+* REFER TO BOTTOM OF REPORT *+*" 65 .D GLENTRY($$CJ^XLFSTR(LRTEXT,IOM),"",1) 66 .D GLENTRY("","",1) 67 Q 68 DIAG ; 69 ;Display the Brief Clinical History, Preoperative Diagnosis, 70 ;Operative Findings, and Postoperative Diagnosis 71 S LRFILE=LRSF,LRCNT=0,LRIENS=LRI_","_LRDFN_"," 72 F LRFLD=.013:.001:.016 D 73 .D:LRA DASH 74 .S LRCNT=LRCNT+1 75 .D GLENTRY($P($T(TEXT1+LRCNT),";",2),"",1) 76 .D WP 77 Q 78 DOC ; 79 ;Pathologist information 80 D GLENTRY("","",1) 81 D GLENTRY("Surgeon/physician: "_LRMD,27,1) 82 D:LRA GLENTRY(LR("%1"),"",1) 83 D DASH 84 D HEADER2 85 D:LRA DASH 86 I LRRC="" D 87 .D GLENTRY("+*+* REPORT INCOMPLETE *+*+",20,1) 88 .D GLENTRY("","",1) 89 D GLENTRY("","",1) 90 I LRRMD'="" D 91 .S LRCNT=0 F LRA1="SP","CY","EM" D 92 ..S LRCNT=LRCNT+1 93 ..S LRTMP(LRA1)=$P($T(TEXT2+LRCNT),";",3) 94 .S LRTMP=LRTMP(LRSS) 95 .D GLENTRY(LRTMP_" "_LRRMD,31) 96 Q 97 WPFLD ; 98 ;Display Frozen Section, Gross Description, Microscopic Description 99 ;and Surgical Path Diagnosis 100 F LRCNT=1:1:4 D 101 .S X=$T(FIELDS+LRCNT) 102 .S LRV=$P(X,";",2),LRV1=$P(X,";",3),LRV2=$P(X,";",4) 103 .I $P($G(^LR(LRDFN,LRSS,LRI,LRV,0)),U,4) D 104 ..D GLENTRY("","",1),GLENTRY(LR(69.2,LRV1),"",1) 105 ..S LRFILE=LRSF,LRIENS=LRI_","_LRDFN_",",LRFLD=LRV 106 ..I $P($G(^LR(LRDFN,LRSS,LRI,LRV2,0)),U,4) D 107 ...S LRFILE1=+$$GET1^DID(LRSF,LRV2,"","SPECIFIER") 108 ...D GLENTRY("*+* MODIFIED REPORT *+*",28,1) 109 ...D GLENTRY("(Last modified: ","",1) 110 ...S (LRA1,LRB1)=0 111 ...F S LRA1=$O(^LR(LRDFN,LRSS,LRI,LRV2,LRA1)) Q:'LRA1 S LRB1=LRA1 112 ...Q:'$D(^LR(LRDFN,LRSS,LRI,LRV2,LRB1,0)) 113 ...S LRSR1=$$GET1^DIQ(LRFILE1,LRB1_","_LRIENS,.01) 114 ...S LRSR2=$$GET1^DIQ(LRFILE1,LRB1_","_LRIENS,.02) 115 ...S LRTEXT=LRSR1_" typed by "_LRSR2_")" 116 ...D GLENTRY(LRTEXT,BTAB) 117 ..D WP 118 Q 119 SUPRPT ;Supplementary Report 120 I $P($G(^LR(LRDFN,LRSS,LRI,1.2,0)),U,4) D 121 .S LRFILE=+$$GET1^DID(LRSF,1.2,"","SPECIFIER") 122 .S LRIENS1=LRI_","_LRDFN_"," 123 .D GLENTRY("","",1),GLENTRY("SUPPLEMENTARY REPORT(S):","",1) 124 .S LRV=0 F S LRV=$O(^LR(LRDFN,LRSS,LRI,1.2,LRV)) Q:'LRV D 125 ..S LRIENS=LRV_","_LRIENS1 126 ..S LRSR1=$$GET1^DIQ(LRFILE,LRIENS,.01) 127 ..S LRSR2=+$$GET1^DIQ(LRFILE,LRIENS,.02) 128 ..D GLENTRY("Supplementary Report Date: "_LRSR1,3,1) 129 ..I $D(LR("R")),'LRSR2 D GLENTRY(" not verified",BTAB) Q 130 ..I $P($G(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,0)),U,4) D 131 ...S LRTEXT="*+* SUPPLEMENTARY REPORT HAS BEEN ADDED/MODIFIED *+*" 132 ...D GLENTRY($$CJ^XLFSTR(LRTEXT,IOM),"",1) 133 ...D GLENTRY("(Added/Last","",1) 134 ...S (LRA1,LRB1)=0 135 ...F S LRA1=$O(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,LRA1)) Q:'LRA1 D 136 ....S LRB1=LRA1 137 ...Q:'$D(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,LRB1,0)) 138 ...S LRA2=^(0),Y=+LRA2,LRA2A=$P(LRA2,"^",2),LRSGN=" Typed by ",LRDSC=" modified: " 139 ...I $P(LRA2,"^",3) S LRSGN=" Signed by ",LRDSC=" released: ",LRA2A=$P(LRA2,"^",3),Y=$P(LRA2,"^",4) 140 ...S LRA2A=$S($D(^VA(200,LRA2A,0)):$P(^(0),"^"),1:LRA2A) 141 ...D D^LRU 142 ...D GLENTRY(LRDSC_Y_LRSGN_LRA2A_")",BTAB) 143 ..S LRFLD=1 D WP 144 ..D GLENTRY("","",1) 145 Q 146 SSJR ;Print special studies/journal references 147 D ^LRAPBR3 148 S LREFLG=1 149 Q 150 WP ;Display word procesing fields 151 K LRTMP,^UTILITY($J,"W") 152 N X,DIWR,DIWL,LRINC 153 S X=$$GET1^DIQ(LRFILE,LRIENS,LRFLD,"","LRTMP",) 154 S DIWR=IOM-5,DIWL=5,DIWF="" 155 S X=+$$GET1^DID(LRFILE,LRFLD,"","SPECIFIER") 156 I $$GET1^DID(X,.01,"","SPECIFIER")["L" S DIWF="N" 157 S LRINC=0 158 F S LRINC=$O(LRTMP(LRINC)) Q:'LRINC S X=LRTMP(LRINC) D ^DIWP 159 S LRINC=0 160 F S LRINC=$O(^UTILITY($J,"W",DIWL,LRINC)) Q:'LRINC D 161 .D GLENTRY(^UTILITY($J,"W",DIWL,LRINC,0),DIWL,1) 162 K ^UTILITY($J,"W") 163 Q 164 HEADER ; 165 D:LRTIU GLENTRY("$APHDR",,1) 166 D GLENTRY("","",1) 167 D DASH 168 D GLENTRY("MEDICAL RECORD |",5,1) 169 D GLENTRY(LRAA1,40) 170 D DASH 171 HEADER2 ; 172 S LRADESC="Accession No. "_$S(LRQ(8)]"":LRQ(8)_LRW(1)_" "_LRAC,1:LRAC) 173 S LRLENG1=$L(LRQ(1)),LRLENG2=$L(LRADESC),LRSPCE=IOM-LRLENG2-14 174 S:LRLENG1>LRSPCE LRQ(1)=$E(LRQ(1),1,LRSPCE) 175 D GLENTRY("PATHOLOGY REPORT",30,1) 176 D GLENTRY("Laboratory: "_LRQ(1),"",1) 177 D GLENTRY(LRADESC,IOM-LRLENG2-1) 178 Q 179 FOOTER ;Footer-called from ^LRAPBR 180 D:LRTIU GLENTRY("$FTR",,1) 181 D DASH 182 S LRTEXT=$S('$D(LR("W")):"",1:"See signed copy in chart") 183 D GLENTRY(LRTEXT,"",1) 184 S LRTEXT="("_$S($D(LREFLG):"End of report",1:"See next page")_")" 185 D GLENTRY(LRTEXT,57) 186 D GLENTRY(LRPMD,"",1),GLENTRY(LRW(9),52),GLENTRY("| Date "_LRRC,55) 187 D DASH 188 D GLENTRY(LRP,"",1) 189 S LRTEXT=$S('$D(LR("W")):"STANDARD FORM 515",1:"WORK COPY ONLY !!") 190 D GLENTRY(LRTEXT,50) 191 D GLENTRY("ID:"_SSN,"",1) 192 D GLENTRY("SEX:"_SEX,16),GLENTRY(" DOB:"_DOB,BTAB) 193 I AGE D 194 .S LRTEXT=$S($G(VADM(6))]"":" AGE AT DEATH: ",1:" AGE: ")_AGE 195 .D GLENTRY(LRTEXT,BTAB) 196 D GLENTRY(" LOC:"_LRLLOC,BTAB) 197 D GLENTRY("","",1) 198 D:$L(LRADM) GLENTRY("ADM:"_$P(LRADM,"@"),BTAB) 199 D:$L(LRADX) GLENTRY("DX:"_$E(LRADX,1,26),17) 200 D GLENTRY("PCP:",46) 201 D:$L(LRPRAC) GLENTRY($E(LRPRAC(1),1,28),51) 202 Q 203 ESIGLN ;Write signature block name, title, and date of signature 204 D GLENTRY(,,1) 205 I $D(^VA(200,DUZ,0)) D 206 .S LRFILE=200,LRFLD=20.2,LRFLD2=20.3 207 .S X=$$GET1^DIQ(LRFILE,DUZ,LRFLD) 208 ;Compare DUZ to pathologist, if different, use proxy signature 209 S:LRSS="AU" LRPATH=$$GET1^DIQ(63,LRDFN,13.6,"I") 210 I LRSS'="AU" D 211 .S LRFL2=$S(LRSS="EM":63.02,LRSS="CY":63.09,LRSS="SP":63.08,1:0) 212 .S LRIENS=LRI_","_LRDFN_"," 213 .S LRPATH=$$GET1^DIQ(LRFL2,LRIENS,.02,"I") 214 S LRPATH2="" 215 S:LRPATH'=DUZ LRPATH2=" FOR "_$$GET1^DIQ(LRFILE,LRPATH,LRFLD) 216 S LRTEXT="/es/ "_X_LRPATH2 217 ;S LRTEXT="/es/ "_X 218 D GLENTRY(LRTEXT,,1) 219 S X=$$GET1^DIQ(LRFILE,DUZ,LRFLD2) 220 S LRTEXT=X 221 D GLENTRY(LRTEXT,,1) 222 S Y=LRNTIME D DD^%DT 223 S LRTEXT="Signed "_Y 224 D GLENTRY(LRTEXT,,1) 225 Q 226 DASH ;Display a line of dashes 227 D GLENTRY(LR("%"),"",1) 228 Q 229 GLENTRY(LRPR1,LRPR2,LRPR3) ;Write to global 230 ;LRPR1 = Text to be written to global 231 ;LRPR2 = Tab position 232 ;LRPR3 = 1 means start a new line. Othewise, write an current line. 233 S LRPR1=$G(LRPR1) 234 S LRPR2=+$G(LRPR2) 235 S LRPR3=+$G(LRPR3) 236 D:LRPR3 NEWLN^LRAPUTL(LRPR1,LRPR2) 237 D:'LRPR3 GLBWRT^LRAPUTL(LRPR1,LRPR2) 238 Q 239 TEXT1 ;Text for top of report 240 ;BRIEF CLINICAL HISTORY: 241 ;PREOPERATIVE DIAGNOSIS: 242 ;OPERATIVE FINDINGS: 243 ;POSTOPERATIVE DIAGNOSIS: 244 TEXT2 ;Descriptive text based on section 245 ;SP;Pathology Resident: 246 ;CY;Screened by: 247 ;EM;Prepared by: 248 FIELDS ;Field numbers for word processing fields 249 ;1.3;.13;6 250 ;1;.03;7 251 ;1.1;.04;4 252 ;1.4;.14;5 -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRAPDA.m
r613 r623 1 LRAPDA ;DALOI/REG/WTY/KLL/CKA - ANATOMIC PATH DATA ENTRY;11/02/01 2 ;;5.2;LAB SERVICE;**72,73,91,121,248,259,295,317,365**;Sep 27, 1994;Build 9 3 ; 4 ;Reference to ^%DT supported by IA #10003 5 ;Reference to ^DIE supported by IA #10018 6 ;Reference to ^VA(200 supported by IA #10060 7 ;Reference to EN^DDIOL supported by IA #10142 8 ; 9 W !?20,LRO(68)," (",LRABV,")",! 10 S:'$D(LRSOP) LRSOP=1 S:'$D(LRD(1)) LRD(1)="0" 11 S:'$D(^LRO(69.2,LRAA,2,0)) ^(0)="^69.23A^0^0" 12 SEL K LR(1) 13 I $D(LR(2)) D G:%<1 END S:%=1 LR(1)=1 14 .W !!,"Enter Etiology, Function, Procedure & Disease " 15 .S %=2 D YN^LRU 16 AK ;from LRAPD1 17 N CORRECT 18 S:'$D(LRSFLG) LRSFLG="" 19 W !!,"Data entry for ",LRH(0)," " 20 S %=1 D YN^LRU G:%<1 END 21 I %=2 D G:Y<1 END S LRAD=$E(Y,1,3)_"0000",LRH(0)=$E(Y,1,3)+1700 22 .S %DT="AE",%DT(0)="-N",%DT("A")="Enter YEAR: " D ^%DT K %DT 23 I '$O(^LRO(68,LRAA,1,LRAD,1,0)) D Q 24 .W $C(7),!!,"NO ",LRO(68)," ACCESSIONS IN FILE FOR ",LRH(0),!! 25 W K X,Y,LR("CK") 26 R !!,"Select Accession Number/Pt name: ",LRAN:DTIME 27 G:LRAN=""!(LRAN[U) END 28 I LRAN["?" D G W 29 .W !!,"Enter the year ",LRH(0)," ",LRO(68)," accession number to be " 30 .W "updated" 31 .W !,"or locate the accession by entering the patient name." 32 I LRAN'?1N.N D PNAME G:LRAN<1 W D OE1^LR7OB63D,REST,OERR^LR7OB63D G W 33 D OE1^LR7OB63D,REST S:$D(DR(1))#2 DR=DR(1) D OERR^LR7OB63D G W 34 REST ; 35 N LRXSTOP,LRX,LRX1 36 W " for ",LRH(0) 37 I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN,0)) D Q 38 .W $C(7),!!,"Accession # ",LRAN," for ",LRH(0)," not in ",LRO(68),!! 39 S X=^LRO(68,LRAA,1,LRAD,1,LRAN,0),LRLLOC=$P(X,"^",7),LRDFN=+X 40 Q:'$D(^LR(LRDFN,0)) S X=^(0) D ^LRUP 41 W !,LRP," ID: ",SSN 42 S LRI=+$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),"^",5) 43 I LRSS'="AU",'$D(^LR(LRDFN,LRSS,LRI,0)) D Q 44 .W $C(7),!,"Inverse date missing or incorrect in Accession Area file " 45 .W "for",!,LRO(68)," Year: ",$E(LRAD,2,3)," Accession: ",LRAN 46 I "SPCYEM"[LRSS,$O(^LR(LRDFN,LRSS,LRI,.1,0)) D 47 .W !,"Specimen(s):" 48 .S X=0 F S X=$O(^LR(LRDFN,LRSS,LRI,.1,X)) Q:'X D 49 ..W !,$P($G(^LR(LRDFN,LRSS,LRI,.1,X,0)),"^") 50 ; 51 ;Don't allow supp. report to be added to a released report if 52 ; modifications are being added via MM option 53 S LRXSTOP=0,(LRX,LRX1)="" 54 I LRSS'="AU",LRD(1)="S" D 55 .S LRX=$P($G(^LR(LRDFN,LRSS,LRI,0)),"^",11) ;release date/time 56 .S LRX1=$P($G(^LR(LRDFN,LRSS,LRI,0)),"^",15) ;orig rel date/time 57 I LRSS="AU",LRSOP="R" D 58 .S LRX=$P($G(^LR(LRDFN,"AU")),"^",15) ;release date/time 59 .S LRX1=$P($G(^LR(LRDFN,"AU")),"^",3) ;date report completed 60 I 'LRX,LRX1 D 61 .W $C(7),!!,"This "_$G(LRAA(1))_" report is currently being" 62 .W !,"modified; it must first be released before Supplementary" 63 .W !,"report can be added.",! 64 .S LRXSTOP=1 65 Q:LRXSTOP 66 ; 67 DIE ;Edit 68 I LRSS="AU" D AUE Q 69 N LRRDT1,LRRDT2,LRIENS,LREL,LRQUIT,LRSNO,LRCPT,LRESCPT 70 S (LREL,LRESCPT,LRQUIT,LRSNO,LRCPT)=0,LRIENS=LRI_","_LRDFN_"," 71 S LRRDT1=$$GET1^DIQ(LRSF,LRIENS,.11,"I") 72 S LRRDT2=$$GET1^DIQ(LRSF,LRIENS,.15,"I") 73 S:LRRDT1!LRRDT2 LREL=1 74 ;Determine if CPT activated 75 I $T(ES^LRCAPES)'="" S LRESCPT=$$ES^LRCAPES() 76 I LRSOP="G",LREL D Q 77 .W $C(7),!!,"Report verified. Cannot edit with this option." 78 I LRSOP'="","ABM"[LRSOP,LREL D Q:LRQUIT 79 .;Allow SNOMED and CPT coding even after release. 80 .W $C(7),!!,"Report has been verified. " 81 .I 'LRESCPT,LRSOP'="B" D Q 82 ..W "Cannot edit with this option." 83 ..S LRQUIT=1 84 .W "Only " 85 .I LRESCPT W "CPT " W:LRSOP="B" "and " 86 .W:LRSOP="B" "SNOMED " 87 .W "coding permitted.",! 88 .I LRSOP="B" D 89 ..K DIR S DIR(0)="Y",DIR("A")="Enter SNOMED coding",DIR("B")="NO" 90 ..D ^DIR W ! 91 ..S LRSNO=+Y 92 .Q:'LRESCPT 93 .K DIR S DIR(0)="Y",DIR("A")="Enter CPT coding",DIR("B")="NO" 94 .D ^DIR W ! 95 .S LRCPT=+Y 96 .I "AM"[LRSOP,'LRCPT S LRQUIT=1 Q 97 .I LRSOP="B",'LRCPT,'LRSNO S LRQUIT=1 98 RESET ;Reset DR string if altered by prior accession/patient 99 ;Reset DR to orig value in LRAPD1 100 I LRSOP'="","AMBS"[LRSOP,$G(LRD)'="" D @LRD 101 I LRSFLG="S",$G(LRD)'="" D @LRD ;For CY,EM Supp entry 102 S:LRSNO DR=10 ;Modify DR string if only SNOMED coding permitted 103 I 'LRSNO,LRCPT S DR="" ;Set DR string to null in only CPT coding 104 ;If adding supp rpt to released rpt, remove date rpt completed from DR 105 I LRRDT1,LRSOP="S"!(LRSFLG="S") S DR=".09///^S X=LRWHO;10" 106 EDIT ;Call to ^DIE 107 W ! S LRA=^LR(LRDFN,LRSS,LRI,0),LRRC=$P(LRA,"^",10) 108 I LRCAPA,"SPCYEM"[LRSS D C^LRAPSWK 109 S DIE="^LR(LRDFN,LRSS,",DA=LRI,DA(1)=LRDFN 110 D CK^LRU Q:$D(LR("CK")) 111 I LRSS="SP",LRSOP="B",$O(^LR(LRDFN,LRSS,LRI,1.3,0)) D 112 .W $C(7),!!,"This accession has a FROZEN SECTION report." 113 .W !,"Be sure 'FROZEN SECTION' is entered as a SNOMED code in the " 114 .W "PROCEDURE field" 115 .W !,"for the appropriate organ or tissue.",!! 116 ;Code S LRELSD is in DR string setup in LRAPR 117 N LRELSD S LRELSD=0 118 D ^DIE 119 S LRAC=$P(LRA,U,6) 120 I LRELSD D MAIN^LRAPRES1(LRDFN,LRSS,LRI,LRSF,LRP,LRAC) 121 D UPDATE^LRPXRM(LRDFN,LRSS,LRI) 122 D:LRSFLG="S"&('$D(Y)) ^LRAPDSR 123 D FRE^LRU 124 I LRSOP'="","ABM"[LRSOP D CPTCOD 125 WKLD ;Capture Workload 126 I LRSOP="Z","CYSP"[LRSS,LRCAPA D S^LRAPR Q 127 I LRCAPA,"SPCYEM"[LRSS,LRD(1)'="","MBA"[LRD(1) D C1^LRAPSWK 128 I LRCAPA,"SPCYEM"[LRSS,LRSOP="G" D C1^LRAPSWK 129 QUEUES ;Update Queues 130 S X=$P(^LR(LRDFN,LRSS,LRI,0),"^",4) 131 I X,$D(^VA(200,X,0)) S LR("TR")=$P(^(0),"^") 132 I "CYEMSP"[LRSS,$D(LR(6)),LRSOP="G" Q:$D(^LRO(69.2,LRAA,1,LRAN,0)) D Q 133 .L +^LRO(69.2,LRAA,1):5 I '$T D Q 134 ..S MSG(1)="The preliminary reports queue is in use by another person." 135 ..S MSG(1,"F")="!!" 136 ..S MSG(2)=" You will need to add this accession to the queue later." 137 ..D EN^DDIOL(.MSG) K MSG 138 .S ^LRO(69.2,LRAA,1,LRAN,0)=LRDFN_"^"_LRI_"^"_LRH(0) 139 .S X=^LRO(69.2,LRAA,1,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1) 140 .L -^LRO(69.2,LRAA,1) 141 I "CYEMSP"[LRSS,$D(LR(7)),'$D(^LRO(69.2,LRAA,2,LRAN,0)),LRD(1)'="S" D 142 .L +^LRO(69.2,LRAA,2):5 I '$T D Q 143 ..S MSG(1)="The final reports queue is in use by another person. " 144 ..S MSG(1,"F")="!!" 145 ..S MSG(2)="You will need to add this accession to the queue later." 146 ..D EN^DDIOL(.MSG) K MSG 147 .S ^LRO(69.2,LRAA,2,LRAN,0)=LRDFN_"^"_LRI_"^"_LRH(0) 148 .S X=^LRO(69.2,LRAA,2,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1) 149 .L -^LRO(69.2,LRAA,2) 150 D:LRSOP="M"!(LRSOP="B") EN^LRSPGD 151 Q 152 NM ; 153 I X'["@"!(X["@"&(Y(Z)="")) D Q 154 .W $C(7),!?4,"ENTER WHOLE NUMBERS ONLY",! K X 155 I Y(Z)'="" W $C(7),?40,"OK TO DELETE" S %=2 D YN^LRU I %'=1 K X Q 156 S Y(Z)="" Q 157 ; 158 AUE ;Autopsy Data Entry 159 W ! 160 N LREL,LRQUIT,LRSNO,LRESCPT,LRCPT 161 S (LREL,LRQUIT,LRSNO,LRCPT)=0 162 S LREL=+$$GET1^DIQ(63,LRDFN_",",14.7,"I") 163 ;Determine if CPT activated 164 I $T(ES^LRCAPES)'="" S LRESCPT=$$ES^LRCAPES() 165 ; Allow supp report to be added on verified AU 166 I LRSOP'="","AFIP"[LRSOP,LREL D Q:LRQUIT 167 .Q:LRESCPT&("AP"[LRSOP) 168 .W $C(7),!!,"Report verified. Cannot edit with this option!" 169 .S LRQUIT=1 170 I LRSOP'="","ABP"[LRSOP,LREL D Q:LRQUIT 171 .W $C(7),!!,"Report has been verified. " 172 .W "Only " 173 .I LRESCPT W "CPT " W:LRSOP="B" "and " 174 .W:LRSOP="B" "SNOMED " 175 .W "coding permitted.",! 176 .I LRSOP="B" D 177 ..K DIR S DIR(0)="Y",DIR("A")="Enter SNOMED coding",DIR("B")="NO" 178 ..D ^DIR W ! 179 ..S LRSNO=+Y 180 .Q:'LRESCPT 181 .K DIR S DIR(0)="Y",DIR("A")="Enter CPT coding",DIR("B")="NO" 182 .D ^DIR W ! 183 .S LRCPT=+Y 184 .I "AP"[LRSOP,'LRCPT S LRQUIT=1 Q 185 .I LRSOP="B",'LRCPT,'LRSNO S LRQUIT=1 186 AURESET ;Reset DR to orig value in LRAUDA 187 I LRSOP'="","AP"[LRSOP D @(LRSOP_"DR^LRAUDA") 188 I LRSOP="B" D BDR^LRAUDA 189 S:LRSNO DR=32 ;Modify DR string if only SNOMED coding permitted 190 I 'LRSNO,LRCPT S DR="" ;Set DR string to null inf only CPT coding 191 ; ; 192 ;Not all of the autopsy fields are within the AU subscript. 193 ;Therefore, we must lock the entire LRDFN. 194 L +^LR(LRDFN):5 I '$T D Q 195 .S MSG="This record is locked by another user. " 196 .S MSG=MSG_"Please wait and try again." 197 .D EN^DDIOL(MSG,"","!!") K MSG 198 I LRSFLG'="S" D 199 .N LRELSD S LRELSD=0 200 .S DIE="^LR(",DA=LRDFN 201 .D ^DIE 202 .S LRA=^LR(LRDFN,"AU") 203 .S LRI=$P(LRA,U) 204 .S LRAC=$P(LRA,U,6) 205 .I LRELSD D MAIN^LRAPRES1(LRDFN,LRSS,LRI,LRSF,LRP,LRAC) 206 D:LRSFLG="S" ^LRAPDSR 207 D UPDATE^LRPXRM(LRDFN,"AU") 208 L -^LR(LRDFN) 209 D:"BAP"[LRSOP AU 210 D:LRSOP="R" R 211 I LRSOP'="","ABP"[LRSOP D CPTCOD 212 Q 213 AU I '$D(^LRO(69.2,LRAA,2,LRAN,0)) D 214 .L +^LRO(69.2,LRAA,2):5 I '$T D Q 215 ..S MSG(1)="The final reports queue is in use by another person. " 216 ..S MSG(1,"F")="!!" 217 ..S MSG(2)="You will need to add this accession to the queue later." 218 ..D EN^DDIOL(.MSG) K MSG 219 .S ^LRO(69.2,LRAA,2,LRAN,0)=LRDFN 220 .S X=^LRO(69.2,LRAA,2,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1) 221 .L -^LRO(69.2,LRAA,2) 222 D AU^LRSPGD 223 Q 224 R I '$D(^LRO(69.2,LRAA,3,LRAN,0)) D 225 .L +^LRO(69.2,LRAA,3):5 I '$T D Q 226 ..S MSG(1)="The interim reports queue is in use by another person. " 227 ..S MSG(1,"F")="!!" 228 ..S MSG(2)="You will need to add this accession to the queue later." 229 ..D EN^DDIOL(.MSG) K MSG 230 .S ^LRO(69.2,LRAA,3,LRAN,0)=LRDFN 231 .S X=^LRO(69.2,LRAA,3,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1) 232 .L -^LRO(69.2,LRAA,3) 233 Q 234 PNAME ;Patient Name Lookup 235 N LRPFLG ;LRPFLG tells LRUPS to limit accessions to 236 S X=LRAN,LRPFLG=1 ;the chosen year. 237 K LRAN,DIC,VADM,VAIN,VA 238 S DFN=-1,DIC(0)="EQM",(LRX,LRDPF)="" 239 D:'$D(LRLABKY) LABKEY^LRPARAM 240 D DPA1^LRDPA 241 I DFN=-1 S LRAN=-1 Q 242 D I^LRUPS 243 Q 244 CPTCOD ;CPT Coding 245 N LRPRO 246 Q:$T(CPT^LRCAPES)="" 247 Q:LREL&('LRCPT) 248 I 'LREL D 249 .K DIR S DIR(0)="Y",DIR("A")="Enter CPT coding",DIR("B")="NO" 250 .D ^DIR W ! 251 .S LRCPT=+Y 252 Q:'LRCPT 253 ;SET PROVIDER TO CURRENT USER, ALLOW UPDATES 254 S LRPRO=DUZ 255 D PROVIDR^LRAPUTL 256 Q:LRQUIT 257 D CPT^LRCAPES(LRAA,LRAD,LRAN,LRPRO) 258 Q 259 END K LRSFLG 260 D:$T(CLEAN^LRCAPES)'="" CLEAN^LRCAPES 261 D V^LRU 262 Q 1 LRAPDA ;AVAMC/REG/WTY/KLL - ANATOMIC PATH DATA ENTRY;11/02/01 2 ;;5.2;LAB SERVICE;**72,73,91,121,248,259,295,317**;Sep 27, 1994 3 ; 4 ;Reference to ^%DT supported by IA #10003 5 ;Reference to ^DIE supported by IA #10018 6 ;Reference to ^VA(200 supported by IA #10060 7 ;Reference to EN^DDIOL supported by IA #10142 8 ; 9 W !?20,LRO(68)," (",LRABV,")",! 10 S:'$D(LRSOP) LRSOP=1 S:'$D(LRD(1)) LRD(1)="0" 11 S:'$D(^LRO(69.2,LRAA,2,0)) ^(0)="^69.23A^0^0" 12 SEL K LR(1) 13 I $D(LR(2)) D G:%<1 END S:%=1 LR(1)=1 14 .W !!,"Enter Etiology, Function, Procedure & Disease " 15 .S %=2 D YN^LRU 16 AK ;from LRAPD1 17 N CORRECT 18 S:'$D(LRSFLG) LRSFLG="" 19 W !!,"Data entry for ",LRH(0)," " 20 S %=1 D YN^LRU G:%<1 END 21 I %=2 D G:Y<1 END S LRAD=$E(Y,1,3)_"0000",LRH(0)=$E(Y,1,3)+1700 22 .S %DT="AE",%DT(0)="-N",%DT("A")="Enter YEAR: " D ^%DT K %DT 23 I '$O(^LRO(68,LRAA,1,LRAD,1,0)) D Q 24 .W $C(7),!!,"NO ",LRO(68)," ACCESSIONS IN FILE FOR ",LRH(0),!! 25 W K X,Y,LR("CK") 26 R !!,"Select Accession Number/Pt name: ",LRAN:DTIME 27 G:LRAN=""!(LRAN[U) END 28 I LRAN["?" D G W 29 .W !!,"Enter the year ",LRH(0)," ",LRO(68)," accession number to be " 30 .W "updated" 31 .W !,"or locate the accession by entering the patient name." 32 I LRAN'?1N.N D PNAME G:LRAN<1 W D OE1^LR7OB63D,REST,OERR^LR7OB63D G W 33 D OE1^LR7OB63D,REST S:$D(DR(1))#2 DR=DR(1) D OERR^LR7OB63D G W 34 REST ; 35 N LRXSTOP,LRX,LRX1 36 W " for ",LRH(0) 37 I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN,0)) D Q 38 .W $C(7),!!,"Accession # ",LRAN," for ",LRH(0)," not in ",LRO(68),!! 39 S X=^LRO(68,LRAA,1,LRAD,1,LRAN,0),LRLLOC=$P(X,"^",7),LRDFN=+X 40 Q:'$D(^LR(LRDFN,0)) S X=^(0) D ^LRUP 41 W !,LRP," ID: ",SSN 42 S LRI=+$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),"^",5) 43 I LRSS'="AU",'$D(^LR(LRDFN,LRSS,LRI,0)) D Q 44 .W $C(7),!,"Inverse date missing or incorrect in Accession Area file " 45 .W "for",!,LRO(68)," Year: ",$E(LRAD,2,3)," Accession: ",LRAN 46 I "SPCYEM"[LRSS,$O(^LR(LRDFN,LRSS,LRI,.1,0)) D 47 .W !,"Specimen(s):" 48 .S X=0 F S X=$O(^LR(LRDFN,LRSS,LRI,.1,X)) Q:'X D 49 ..W !,$P($G(^LR(LRDFN,LRSS,LRI,.1,X,0)),"^") 50 ; 51 ;Don't allow supp. report to be added to a released report if 52 ; modifications are being added via MM option 53 S LRXSTOP=0,(LRX,LRX1)="" 54 I LRSS'="AU",LRD(1)="S" D 55 .S LRX=$P($G(^LR(LRDFN,LRSS,LRI,0)),"^",11) ;release date/time 56 .S LRX1=$P($G(^LR(LRDFN,LRSS,LRI,0)),"^",15) ;orig rel date/time 57 I LRSS="AU",LRSOP="R" D 58 .S LRX=$P($G(^LR(LRDFN,"AU")),"^",15) ;release date/time 59 .S LRX1=$P($G(^LR(LRDFN,"AU")),"^",3) ;date report completed 60 I 'LRX,LRX1 D 61 .W $C(7),!!,"This "_$G(LRAA(1))_" report is currently being" 62 .W !,"modified; it must first be released before Supplementary" 63 .W !,"report can be added.",! 64 .S LRXSTOP=1 65 Q:LRXSTOP 66 ; 67 DIE ;Edit 68 I LRSS="AU" D AUE Q 69 N LRRDT1,LRRDT2,LRIENS,LREL,LRQUIT,LRSNO,LRCPT,LRESCPT 70 S (LREL,LRESCPT,LRQUIT,LRSNO,LRCPT)=0,LRIENS=LRI_","_LRDFN_"," 71 S LRRDT1=$$GET1^DIQ(LRSF,LRIENS,.11,"I") 72 S LRRDT2=$$GET1^DIQ(LRSF,LRIENS,.15,"I") 73 S:LRRDT1!LRRDT2 LREL=1 74 I $T(ES^LRCAPES)'="" S LRESCPT=$$ES^LRCAPES() 75 I LRSOP="G",LREL D Q 76 .W $C(7),!!,"Report verified. Cannot edit with this option." 77 I LRSOP'="","ABM"[LRSOP,LREL D Q:LRQUIT 78 .;Allow SNOMED and CPT coding even after release. 79 .W $C(7),!!,"Report has been verified. " 80 .I 'LRESCPT,LRSOP'="B" D Q 81 ..W "Cannot edit with this option." 82 ..S LRQUIT=1 83 .W "Only " 84 .I LRESCPT W "CPT " W:LRSOP="B" "and " 85 .W:LRSOP="B" "SNOMED " 86 .W "coding permitted.",! 87 .I LRSOP="B" D 88 ..K DIR S DIR(0)="Y",DIR("A")="Enter SNOMED coding",DIR("B")="NO" 89 ..D ^DIR W ! 90 ..S LRSNO=+Y 91 .Q:'LRESCPT 92 .K DIR S DIR(0)="Y",DIR("A")="Enter CPT coding",DIR("B")="NO" 93 .D ^DIR W ! 94 .S LRCPT=+Y 95 .I "AM"[LRSOP,'LRCPT S LRQUIT=1 Q 96 .I LRSOP="B",'LRCPT,'LRSNO S LRQUIT=1 97 RESET ;Reset DR string if altered by prior accession/patient 98 ;Reset DR to orig value in LRAPD1 99 I LRSOP'="","AMBS"[LRSOP,$G(LRD)'="" D @LRD 100 I LRSFLG="S",$G(LRD)'="" D @LRD ;For CY,EM Supp entry 101 S:LRSNO DR=10 ;Modify DR string if only SNOMED coding permitted 102 I 'LRSNO,LRCPT S DR="" ;Set DR string to null in only CPT coding 103 ;If adding supp rpt to released rpt, remove date rpt completed from DR 104 I LRRDT1,LRSOP="S"!(LRSFLG="S") S DR=".09///^S X=LRWHO;10" 105 EDIT ;Call to ^DIE 106 W ! S LRA=^LR(LRDFN,LRSS,LRI,0),LRRC=$P(LRA,"^",10) 107 I LRCAPA,"SPCYEM"[LRSS D C^LRAPSWK 108 S DIE="^LR(LRDFN,LRSS,",DA=LRI,DA(1)=LRDFN 109 D CK^LRU Q:$D(LR("CK")) 110 I LRSS="SP",LRSOP="B",$O(^LR(LRDFN,LRSS,LRI,1.3,0)) D 111 .W $C(7),!!,"This accession has a FROZEN SECTION report." 112 .W !,"Be sure 'FROZEN SECTION' is entered as a SNOMED code in the " 113 .W "PROCEDURE field" 114 .W !,"for the appropriate organ or tissue.",!! 115 D ^DIE 116 D UPDATE^LRPXRM(LRDFN,LRSS,LRI) 117 D:LRSFLG="S"&('$D(Y)) ^LRAPDSR 118 D FRE^LRU 119 I LRSOP'="","ABM"[LRSOP D CPTCOD 120 WKLD ;Capture Workload 121 I LRSOP="Z","CYSP"[LRSS,LRCAPA D S^LRAPR Q 122 I LRCAPA,"SPCYEM"[LRSS,LRD(1)'="","MBA"[LRD(1) D C1^LRAPSWK 123 I LRCAPA,"SPCYEM"[LRSS,LRSOP="G" D C1^LRAPSWK 124 QUEUES ;Update Queues 125 S X=$P(^LR(LRDFN,LRSS,LRI,0),"^",4) 126 I X,$D(^VA(200,X,0)) S LR("TR")=$P(^(0),"^") 127 I "CYEMSP"[LRSS,$D(LR(6)),LRSOP="G" Q:$D(^LRO(69.2,LRAA,1,LRAN,0)) D Q 128 .L +^LRO(69.2,LRAA,1):5 I '$T D Q 129 ..S MSG(1)="The preliminary reports queue is in use by another person." 130 ..S MSG(1,"F")="!!" 131 ..S MSG(2)=" You will need to add this accession to the queue later." 132 ..D EN^DDIOL(.MSG) K MSG 133 .S ^LRO(69.2,LRAA,1,LRAN,0)=LRDFN_"^"_LRI_"^"_LRH(0) 134 .S X=^LRO(69.2,LRAA,1,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1) 135 .L -^LRO(69.2,LRAA,1) 136 I "CYEMSP"[LRSS,$D(LR(7)),'$D(^LRO(69.2,LRAA,2,LRAN,0)),LRD(1)'="S" D 137 .L +^LRO(69.2,LRAA,2):5 I '$T D Q 138 ..S MSG(1)="The final reports queue is in use by another person. " 139 ..S MSG(1,"F")="!!" 140 ..S MSG(2)="You will need to add this accession to the queue later." 141 ..D EN^DDIOL(.MSG) K MSG 142 .S ^LRO(69.2,LRAA,2,LRAN,0)=LRDFN_"^"_LRI_"^"_LRH(0) 143 .S X=^LRO(69.2,LRAA,2,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1) 144 .L -^LRO(69.2,LRAA,2) 145 D:LRSOP="M"!(LRSOP="B") EN^LRSPGD 146 Q 147 NM ; 148 I X'["@"!(X["@"&(Y(Z)="")) D Q 149 .W $C(7),!?4,"ENTER WHOLE NUMBERS ONLY",! K X 150 I Y(Z)'="" W $C(7),?40,"OK TO DELETE" S %=2 D YN^LRU I %'=1 K X Q 151 S Y(Z)="" Q 152 ; 153 AUE ;Autopsy Data Entry 154 W ! 155 N LREL,LRQUIT,LRSNO,LRESCPT,LRCPT 156 S (LREL,LRQUIT,LRSNO,LRCPT)=0 157 S LREL=+$$GET1^DIQ(63,LRDFN_",",14.7,"I") 158 I $T(ES^LRCAPES)'="" S LRESCPT=$$ES^LRCAPES() 159 ; Allow supp report to be added on verified AU 160 I LRSOP'="","AFIP"[LRSOP,LREL D Q:LRQUIT 161 .Q:LRESCPT&("AP"[LRSOP) 162 .W $C(7),!!,"Report verified. Cannot edit with this option!" 163 .S LRQUIT=1 164 I LRSOP'="","ABP"[LRSOP,LREL D Q:LRQUIT 165 .W $C(7),!!,"Report has been verified. " 166 .W "Only " 167 .I LRESCPT W "CPT " W:LRSOP="B" "and " 168 .W:LRSOP="B" "SNOMED " 169 .W "coding permitted.",! 170 .I LRSOP="B" D 171 ..K DIR S DIR(0)="Y",DIR("A")="Enter SNOMED coding",DIR("B")="NO" 172 ..D ^DIR W ! 173 ..S LRSNO=+Y 174 .Q:'LRESCPT 175 .K DIR S DIR(0)="Y",DIR("A")="Enter CPT coding",DIR("B")="NO" 176 .D ^DIR W ! 177 .S LRCPT=+Y 178 .I "AP"[LRSOP,'LRCPT S LRQUIT=1 Q 179 .I LRSOP="B",'LRCPT,'LRSNO S LRQUIT=1 180 AURESET ;Reset DR to orig value in LRAUDA 181 I LRSOP'="","AP"[LRSOP D @(LRSOP_"DR^LRAUDA") 182 I LRSOP="B" D BDR^LRAUDA 183 S:LRSNO DR=32 ;Modify DR string if only SNOMED coding permitted 184 I 'LRSNO,LRCPT S DR="" ;Set DR string to null inf only CPT coding 185 ; ; 186 ;Not all of the autopsy fields are within the AU subscript. 187 ;Therefore, we must lock the entire LRDFN. 188 L +^LR(LRDFN):5 I '$T D Q 189 .S MSG="This record is locked by another user. " 190 .S MSG=MSG_"Please wait and try again." 191 .D EN^DDIOL(MSG,"","!!") K MSG 192 I LRSFLG'="S" D 193 .S DIE="^LR(",DA=LRDFN 194 .D ^DIE 195 D:LRSFLG="S" ^LRAPDSR 196 D UPDATE^LRPXRM(LRDFN,"AU") 197 L -^LR(LRDFN) 198 D:"BAP"[LRSOP AU 199 D:LRSOP="R" R 200 I LRSOP'="","ABP"[LRSOP D CPTCOD 201 Q 202 AU I '$D(^LRO(69.2,LRAA,2,LRAN,0)) D 203 .L +^LRO(69.2,LRAA,2):5 I '$T D Q 204 ..S MSG(1)="The final reports queue is in use by another person. " 205 ..S MSG(1,"F")="!!" 206 ..S MSG(2)="You will need to add this accession to the queue later." 207 ..D EN^DDIOL(.MSG) K MSG 208 .S ^LRO(69.2,LRAA,2,LRAN,0)=LRDFN 209 .S X=^LRO(69.2,LRAA,2,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1) 210 .L -^LRO(69.2,LRAA,2) 211 D AU^LRSPGD 212 Q 213 R I '$D(^LRO(69.2,LRAA,3,LRAN,0)) D 214 .L +^LRO(69.2,LRAA,3):5 I '$T D Q 215 ..S MSG(1)="The interim reports queue is in use by another person. " 216 ..S MSG(1,"F")="!!" 217 ..S MSG(2)="You will need to add this accession to the queue later." 218 ..D EN^DDIOL(.MSG) K MSG 219 .S ^LRO(69.2,LRAA,3,LRAN,0)=LRDFN 220 .S X=^LRO(69.2,LRAA,3,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1) 221 .L -^LRO(69.2,LRAA,3) 222 Q 223 PNAME ;Patient Name Lookup 224 N LRPFLG ;LRPFLG tells LRUPS to limit accessions to 225 S X=LRAN,LRPFLG=1 ;the chosen year. 226 K LRAN,DIC,VADM,VAIN,VA 227 S DFN=-1,DIC(0)="EQM",(LRX,LRDPF)="" 228 D:'$D(LRLABKY) LABKEY^LRPARAM 229 D DPA1^LRDPA 230 I DFN=-1 S LRAN=-1 Q 231 D I^LRUPS 232 Q 233 CPTCOD ;CPT Coding 234 N LRPRO 235 Q:$T(CPT^LRCAPES)="" 236 Q:LREL&('LRCPT) 237 I 'LREL D 238 .K DIR S DIR(0)="Y",DIR("A")="Enter CPT coding",DIR("B")="NO" 239 .D ^DIR W ! 240 .S LRCPT=+Y 241 Q:'LRCPT 242 ;SET PROVIDER TO CURRENT USER, ALLOW UPDATES 243 S LRPRO=DUZ 244 D PROVIDR^LRAPUTL 245 Q:LRQUIT 246 D CPT^LRCAPES(LRAA,LRAD,LRAN,LRPRO) 247 Q 248 END K LRSFLG 249 D:$T(CLEAN^LRCAPES)'="" CLEAN^LRCAPES 250 D V^LRU 251 Q -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRAPR.m
r613 r623 1 LRAPR ;DALOI/REG/WTY/KLL/CKA - ANAT RELEASE REPORTS ;10/30/01 2 ;;5.2;LAB SERVICE;**72,248,259,317,365**;Sep 27, 1994;Build 9 3 ; 4 N LRESSW 5 D SWITCH 6 I +LRESSW D Q 7 .D ^LRAPRES 8 .D END 9 W !!?27,"Release Pathology Reports",!! 10 D A 11 I '$D(LRSS) D END Q 12 I LRCAPA D G:'$D(X) END 13 .S X=$S(LRSS="CY":"CYTOLOGY REPORTING",LRSS="SP":"SURGICAL PATH REPORTING",1:"") 14 .D:X]"" X^LRUWK 15 I LRSS="AU" D B Q 16 S LRSOP="Z" 17 S DR="S A=^LR(LRDFN,LRSS,LRI,0),LRZ=$P(A,U,3),LRZ(1)=$P(A,U,13)," 18 S DR=DR_"LRZ(2)=$P(A,U,11),LRZ(3)=$P(A,U,2);" 19 S DR=DR_"I 'LRZ W $C(7),!,""No date report completed. " 20 S DR=DR_"Cannot release."" S Y=0;" 21 S DR=DR_"I 'LRZ(2) D NMPATH^LRAPR;" 22 S DR=DR_"I LRZ(2) D RINFO^LRAPR S Y=0;" 23 ;Perform supp edit regardless if date rept released since supp rpt 24 ; is added to released report 25 S DR=DR_"D SUPCHK^LRAPR;" 26 S DR=DR_"S DIR(0)=""YA"",DIR(""A"")=""Release report? """ 27 S DR=DR_",DIR(""B"")=""NO"" D ^DIR K:Y Y S:$D(Y) Y=0;" 28 S DR=DR_".11////^D NOW^%DTC S X=%;.13////^S X=DUZ;" 29 S DR=DR_"S LRELSD=1 W !!,""Report released...""" 30 D ^LRAPDA 31 D END 32 Q 33 ; 34 B ;Autopsy 35 S LRSOP="Z" 36 S DR="S A=$G(^LR(LRDFN,""AU"")) I A="""" S Y=0;" 37 S DR=DR_"S LRZ=$P(A,U,3),LRZ(1)=$P(A,U,16),LRZ(2)=$P(A,U,15)," 38 ;KLL-LRZ(3)=SR PATHOLOGIST,LRZ(4)=PROVISIONAL DATE 39 S DR=DR_"LRZ(3)=$P(A,U,10),LRZ(4)=$P(A,U,17);" 40 ;KLL-PROVISIONAL OR DATE REPORT COMPLETED IS REQUIRED 41 S DR=DR_"I 'LRZ(4),'LRZ W $C(7),!,""Provisional date or date report completed required. " 42 S DR=DR_"Cannot release."" S Y=0;" 43 S DR=DR_"I 'LRZ(2) D NMPATH^LRAPR;" 44 S DR=DR_"I LRZ(2) D RINFO^LRAPR S Y=0;" 45 ;Perform supp edit regardless if date rept released since supp rpt 46 ; is added to released report 47 S DR=DR_"D SUPCHK^LRAPR;" 48 S DR=DR_"D RELEASE^LRAPR;" 49 S DR=DR_"D NOW^%DTC S LRDTE=%;" 50 S DR=DR_"14.7////^S X=$S(LRZ(2):""@"",1:LRDTE);" 51 S DR=DR_"14.8////^S X=$S(LRZ(2):""@"",1:DUZ);" 52 S DR=DR_"S:'LRZ(2) LRELSD=1 " 53 S DR=DR_"W !!,""Report "" W:LRZ(2) ""un"" W ""released..."";K LRDTE" 54 D ^LRAPDA 55 D END 56 Q 57 EN ;Supplementary Report Entry Point 58 N LRESSW 59 D SWITCH 60 W !!?20,"Release Supplementary Pathology Reports",! 61 ;D A 62 ;Section prompt replaces the line above 63 S LRQUIT=0 64 D SECTION^LRAPRES 65 I '$D(LRSS) D END Q 66 ;Verify User ID has access to release supp. reports 67 S LREND=0 68 I LRESSW D CLSSCHK^LRAPRES1(DUZ,.LREND) 69 Q:LREND 70 ; 71 W !!,"Data entry for ",LRH(0)," " 72 S %=1 D YN^LRU G:%<1 END 73 I %=2 D G:Y<1 END 74 .S %DT="AE",%DT(0)="-N",%DT("A")="Enter YEAR: " D ^%DT K %DT 75 .Q:Y<1 S LRAD=$E(Y,1,3)_"0000",LRH(0)=$E(Y,1,3)+1700 76 I '$D(^LRO(68,LRAA,1,LRAD,0)) D Q 77 .W $C(7),!!,"NO ",LRAA(1)," ACCESIONS IN FILE FOR ",LRH(0),!! 78 W K X,Y,LR("CK") R !!,"Select Accession Number/Pt name: ",LRAN:DTIME 79 G:LRAN=""!(LRAN[U) END 80 I LRAN'?1N.N D G:LRAN<1 END G W 81 .D PNAME^LRAPDA 82 .Q:LRAN<1 83 .D DIE 84 D REST 85 G W 86 REST W " for ",LRH(0) 87 I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN,0)) D Q 88 .W $C(7),!!,"Accession # ",LRAN," for ",LRH(0) 89 .W " not in ACCESSION file",!! 90 S X=^LRO(68,LRAA,1,LRAD,1,LRAN,0),LRLLOC=$P(X,"^",7),LRDFN=+X 91 Q:'$D(^LR(LRDFN,0)) S X=^(0) D ^LRUP 92 W !,LRP," ID: ",SSN 93 I LRSS'="AU" D 94 .S LRI=$P(^LRO(68,LRAA,1,LRAD,1,LRAN,3),"^",5) 95 .W !,"Specimen(s):" 96 .S X=0 F S X=$O(^LR(LRDFN,LRSS,LRI,.1,X)) Q:'X D 97 ..I $D(^LR(LRDFN,LRSS,LRI,.1,X,0)),$L(^(0)) W !,^(0) 98 DIE ;Define default supplementary report 99 N LRFILE,LRIENS,LRIENS1,LRX,LRRLS,LRFDA,LRLKFL,LRDA,LRQUIT,LRNOSP 100 N LRMSG,LRSRFL,LRFDA2,LRSRMD,LRRLM 101 S DIC("B")="",LRNOSP=0 102 I LRSS'="AU" D 103 .S LRFILE=+$$GET1^DID(LRSF,1.2,"","SPECIFIER") 104 .S LRIENS1=LRI_","_LRDFN_"," 105 .I '+$P($G(^LR(LRDFN,LRSS,LRI,1.2,0)),"^",4) S LRNOSP=1 Q 106 .S LRX=0 F S LRX=$O(^LR(LRDFN,LRSS,LRI,1.2,LRX)) Q:'LRX D 107 ..S LRIENS=LRX_","_LRIENS1 108 ..S LRSRFL=$$GET1^DIQ(LRFILE,LRIENS,.02,"I") 109 ..;LRSRMD-set to 1 if supp rpt modified and requires release 110 ..S LRSRMD=$$GET1^DIQ(LRFILE,LRIENS,.03,"I") 111 ..Q:LRSRFL&('LRSRMD) 112 ..S DIC("B")=$$GET1^DIQ(LRFILE,LRIENS,.01,"I") 113 I LRSS="AU" D 114 .S LRFILE=63.324,LRIENS1=LRDFN_"," 115 .I '+$P($G(^LR(LRDFN,84,0)),"^",4) S LRNOSP=1 Q 116 .S LRX=0 F S LRX=$O(^LR(LRDFN,84,LRX)) Q:'LRX D 117 ..S LRIENS=LRX_","_LRIENS1 118 ..S LRSRFL=$$GET1^DIQ(LRFILE,LRIENS,.02,"I") 119 ..;LRSRMD-set to 1 if supp rpt modified and requires release 120 ..S LRSRMD=$$GET1^DIQ(LRFILE,LRIENS,.03,"I") 121 ..Q:LRSRFL&('LRSRMD) 122 ..S DIC("B")=$$GET1^DIQ(LRFILE,LRIENS,.01,"I") 123 I LRNOSP D Q 124 .K LRMSG 125 .S LRMSG=$C(7)_"No supplementary reports exist for this accession." 126 .D EN^DDIOL(LRMSG,"","!!") 127 I 'DIC("B") D Q 128 .K LRMSG 129 .S LRMSG=$C(7)_"All supplementary reports have been released." 130 .D EN^DDIOL(LRMSG,"","!!") 131 DIE1 ; 132 S (LRQUIT,LRRLM)=0 133 F D Q:LRQUIT 134 .W ! 135 .S:LRSS="AU" (LRLKFL,DIC)="^LR(LRDFN,84," 136 .S:LRSS'="AU" (LRLKFL,DIC)="^LR(LRDFN,LRSS,LRI,1.2," 137 .S DIC("A")="Select SUPPLEMENTARY REPORT DATE: " 138 .S DIC(0)="AEQM" 139 .D ^DIC K DIC 140 .I Y<1 S LRQUIT=1 Q 141 .S LRDA=+Y 142 .S LRIENS=LRDA_","_LRIENS1 143 .S LRRLS=+$$GET1^DIQ(LRFILE,LRIENS,.02,"I") 144 .;If E-Sign OFF, must check LRRLM. LRRLM=1 if supp rpt has been 145 .; modified and requires release 146 .S LRRLM=+$$GET1^DIQ(LRFILE,LRIENS,.03,"I") 147 .I LRESSW,LRRLS D Q 148 ..W !!,"This supplementary report has already been released.",! 149 .I 'LRESSW,LRRLS D Q:'LRRLM 150 ..I 'LRRLM W !!,"This supplementary rept has already been released.",! 151 .W ! 152 .I LRESSW D Q 153 ..D ESIG Q:LRQUIT 154 ..D UPDATE 155 .S DIR("A")="Release supplementary report",DIR(0)="Y",DIR("B")="NO" 156 .D ^DIR K DIR 157 .Q:'Y 158 .D UPDATE 159 .;If E-sign switch OFF and orig report released, must verify all 160 .; supp reports released before release main report. 161 .I LRCKREL,'LRESSW D CHKSUP^LRAPR1 162 Q 163 ; 164 A D ^LRAP G:'$D(Y) END 165 Q 166 C ; 167 S LRDICS="SPCYEM" D ^LRAP 168 G:'$D(Y) END 169 Q 170 S ;from LRAPDA 171 S LRK=$P(^LR(LRDFN,LRSS,LRI,0),"^",11) Q:'LRK S:'$D(^LRO(68,LRAA,1,LRAD,1,LRAN,4,0)) ^(0)="^68.04PA^^" 172 Q:$D(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRT,0)) S ^(0)=LRT_"^50^^"_DUZ_"^"_LRK,X=^LRO(68,LRAA,1,LRAD,1,LRAN,4,0),^(0)=$P(X,"^",1,2)_"^"_LRT_"^"_($P(X,"^",4)+1) 173 S:'$D(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRT,1,0)) ^(0)="^68.14P^^" 174 S C=0 F S C=$O(LRT(C)) Q:'C D CAP 175 S ^LRO(68,"AA",LRAA_"|"_LRAD_"|"_LRAN_"|"_LRT)="" 176 Q 177 ; 178 CAP S ^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRT,1,C,0)=C_"^1^0^0^^"_LRK_"^"_DUZ_"^"_DUZ(2)_"^"_LRAA_"^"_LRAA_"^"_LRAA 179 S X=^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRT,1,0),^(0)=$P(X,"^",1,2)_"^"_C_"^"_($P(X,"^",4)+1) 180 Q 181 ; 182 SWITCH ;Check to see if electronic signature is enabled 183 D GETDATA^LRAPESON(.LRESSW) 184 Q 185 ESIG ;Prompt for electronic signature 186 S LRQUIT=0 187 D SIG^XUSESIG 188 I X1="" D 189 .W " SIGNATURE NOT VERIFIED" 190 .S LRQUIT=1 191 Q 192 UPDATE ; 193 S LRLKFL=LRLKFL_LRDA_",0)" 194 L +@(LRLKFL):5 I '$T D Q 195 .S LRMSG="This record is locked by another user. " 196 .S LRMSG=LRMSG_"Please wait and try again." 197 .D EN^DDIOL(LRMSG,"","!!") 198 S LRFDA(LRFILE,LRIENS,.02)=1 199 S LRFDA2(LRFILE,LRIENS,.02)="@" ;Set but don't file unless unrel needed 200 ;File signer ID and Date/time of released supp report 201 D CKSIGNR^LRAPR1 202 D FILE^DIE("","LRFDA") 203 W "...Released" 204 L -@(LRLKFL) 205 I LRSS="AU" D 206 .S LRA=^LR(LRDFN,"AU") 207 .S LRAC=$$GET1^DIQ(63,LRDFN_",",14,"I") 208 .S LRI=$P(LRA,U) 209 I LRSS'="AU" D 210 .S LRA=^LR(LRDFN,LRSS,LRI,0) 211 .S LRAC=$$GET1^DIQ(LRSF,LRIENS,.06,"I") 212 D MAIN^LRAPRES1(LRDFN,LRSS,LRI,LRSF,LRP,LRAC) 213 ;If all supp reports released, and E-Sign switch is ON, proceed to 214 ; release main report 215 S LRCKREL=0 216 S:LRSS'="AU" LRCKREL=$P(^LR(LRDFN,LRSS,LRI,0),"^",11) 217 S:LRSS="AU" LRCKREL=$P(^LR(LRDFN,LRSS),"^",15) 218 I LRCKREL,LRESSW D RELMN 219 Q 220 SUPCHK ;Check for unreleased supplementary reports 221 N LRSR,LRSR1,LRSR2 222 S LRSR=0,LRSR1=1 223 I LRSS'="AU" D 224 .Q:'+$P($G(^LR(LRDFN,LRSS,LRI,1.2,0)),U,4) 225 .F S LRSR=$O(^LR(LRDFN,LRSS,LRI,1.2,LRSR)) Q:LRSR'>0!('LRSR1) D 226 ..S LRSR1=+$P(^LR(LRDFN,LRSS,LRI,1.2,LRSR,0),U,2) 227 ..I 'LRSR1 D 228 ...S Y=+$P(^LR(LRDFN,LRSS,LRI,1.2,LRSR,0),U) 229 ...D DD^%DT S LRSR2=Y 230 I LRSS="AU" D 231 .Q:'+$P($G(^LR(LRDFN,84,0)),U,4) 232 .F S LRSR=$O(^LR(LRDFN,84,LRSR)) Q:LRSR'>0!('LRSR1) D 233 ..S LRSR1=+$P(^LR(LRDFN,84,LRSR,0),U,2) 234 ..I 'LRSR1 D 235 ...S Y=+$P(^LR(LRDFN,84,LRSR,0),U) 236 ...D DD^%DT S LRSR2=Y 237 I 'LRSR1 D 238 .W $C(7),!,"Supplementary report "_LRSR2_" has not been released. " 239 .W "Cannot release." 240 .S Y=0 241 Q 242 RINFO ;Display release information 243 W $C(7),!,"Report " 244 W:LRZ(2)=1 "has already been " 245 W "released " 246 S Y=LRZ(2) 247 D DD^%DT 248 W:LRZ(2)>1 Y 249 W:LRZ(1)'="" " by "_$P($G(^VA(200,LRZ(1),0)),U) 250 K Y 251 Q 252 NMPATH ;Check for missing pathologist name 253 I 'LRZ(3) D 254 .W $C(7),!,"Pathologist name missing. Cannot release." 255 .S Y=0 256 Q 257 RELEASE ;Prompt for release/unrelease 258 W ! S DIR(0)="YA",DIR("B")="NO" 259 S:LRZ(2) DIR("A")="Unrelease report? " 260 S:'LRZ(2) DIR("A")="Release report? " 261 D ^DIR 262 K:Y Y 263 I $D(Y) S Y=0 264 Q 265 RELMN ;Allow release of main report as long as all supp reports are 266 ; released, and signer is same person for main and supp report(s) 267 ;Make sure all supp reports signed out 268 S LRQT=0 269 D RELCHK^LRAPR1 270 Q:LRQT 271 ; 272 ;Continue with electronic signature and storage in TIU 273 S LRAU=$S(LRSS="AU":1,1:0) 274 I 'LRAU D 275 .S LRPAT=+$$GET1^DIQ(LRSF,LRIENS1,.02,"I") 276 .S LRZ=$$GET1^DIQ(LRSF,LRIENS1,.03,"I") 277 .S LRZ(1)=$$GET1^DIQ(LRSF,LRIENS1,.13,"I") 278 .S LRZ(1.1)=$$GET1^DIQ(LRSF,LRIENS1,.13) 279 .S LRZ(2)=$$GET1^DIQ(LRSF,LRIENS1,.11,"I") 280 I LRAU D 281 .S LRPAT=+$$GET1^DIQ(63,LRDFN_",",13.6,"I") 282 .S LRZ=$$GET1^DIQ(63,LRDFN_",",13,"I") 283 .S LRZ(1)=$$GET1^DIQ(63,LRDFN_",",14.8,"I") 284 .S LRZ(1.1)=$$GET1^DIQ(63,LRDFN_",",14.8) 285 .S LRZ(2)=$$GET1^DIQ(63,LRDFN_",",14.7,"I") 286 W !!,?25,"*** Main Report Release ***",! 287 D NOW^%DTC S LRNTIME=% 288 D TIUPREP^LRAPRES 289 D STORE^LRAPRES 290 I LRQUIT D FILE^DIE("","LRFDA2") Q 291 D UNRLSE^LRAPR1 292 D RELEASE^LRAPRES 293 I LRQUIT D FILE^DIE("","LRFDA2") Q 294 D OERR^LR7OB63D 295 S LRQUIT=1 296 Q 297 END ; 298 D V^LRU 299 Q 1 LRAPR ;AVAMC/REG/WTY/KLL- ANAT RELEASE REPORTS ;10/30/01 2 ;;5.2;LAB SERVICE;**72,248,259,317**;Sep 27, 1994 3 ; 4 N LRESSW 5 D SWITCH 6 I +LRESSW D Q 7 .D ^LRAPRES 8 .D END 9 W !!?27,"Release Pathology Reports",!! 10 D A 11 I '$D(LRSS) D END Q 12 I LRCAPA D G:'$D(X) END 13 .S X=$S(LRSS="CY":"CYTOLOGY REPORTING",LRSS="SP":"SURGICAL PATH REPORTING",1:"") 14 .D:X]"" X^LRUWK 15 I LRSS="AU" D B Q 16 S LRSOP="Z" 17 S DR="S A=^LR(LRDFN,LRSS,LRI,0),LRZ=$P(A,U,3),LRZ(1)=$P(A,U,13)," 18 S DR=DR_"LRZ(2)=$P(A,U,11),LRZ(3)=$P(A,U,2);" 19 S DR=DR_"I 'LRZ W $C(7),!,""No date report completed. " 20 S DR=DR_"Cannot release."" S Y=0;" 21 S DR=DR_"I 'LRZ(2) D NMPATH^LRAPR;" 22 S DR=DR_"I LRZ(2) D RINFO^LRAPR S Y=0;" 23 ;Perform supp edit regardless if date rept released since supp rpt 24 ; is added to released report 25 S DR=DR_"D SUPCHK^LRAPR;" 26 S DR=DR_"S DIR(0)=""YA"",DIR(""A"")=""Release report? """ 27 S DR=DR_",DIR(""B"")=""NO"" D ^DIR K:Y Y S:$D(Y) Y=0;" 28 S DR=DR_".11////^D NOW^%DTC S X=%;.13////^S X=DUZ;" 29 S DR=DR_"W !!,""Report released...""" 30 D ^LRAPDA 31 D END 32 Q 33 ; 34 B ;Autopsy 35 S LRSOP="Z" 36 S DR="S A=$G(^LR(LRDFN,""AU"")) I A="""" S Y=0;" 37 S DR=DR_"S LRZ=$P(A,U,3),LRZ(1)=$P(A,U,16),LRZ(2)=$P(A,U,15)," 38 ;KLL-LRZ(3)=SR PATHOLOGIST,LRZ(4)=PROVISIONAL DATE 39 S DR=DR_"LRZ(3)=$P(A,U,10),LRZ(4)=$P(A,U,17);" 40 ;KLL-PROVISIONAL OR DATE REPORT COMPLETED IS REQUIRED 41 S DR=DR_"I 'LRZ(4),'LRZ W $C(7),!,""Provisional date or date report completed required. " 42 S DR=DR_"Cannot release."" S Y=0;" 43 S DR=DR_"I 'LRZ(2) D NMPATH^LRAPR;" 44 S DR=DR_"I LRZ(2) D RINFO^LRAPR S Y=0;" 45 ;Perform supp edit regardless if date rept released since supp rpt 46 ; is added to released report 47 S DR=DR_"D SUPCHK^LRAPR;" 48 S DR=DR_"D RELEASE^LRAPR;" 49 S DR=DR_"D NOW^%DTC S LRDTE=%;" 50 S DR=DR_"14.7////^S X=$S(LRZ(2):""@"",1:LRDTE);" 51 S DR=DR_"14.8////^S X=$S(LRZ(2):""@"",1:DUZ);" 52 S DR=DR_"W !!,""Report "" W:LRZ(2) ""un"" W ""released..."";K LRDTE" 53 D ^LRAPDA 54 D END 55 Q 56 EN ;Supplementary Report Entry Point 57 N LRESSW 58 D SWITCH 59 W !!?20,"Release Supplementary Pathology Reports",! 60 ;D A 61 ;Section prompt replaces the line above 62 S LRQUIT=0 63 D SECTION^LRAPRES 64 I '$D(LRSS) D END Q 65 ;Verify User ID has access to release supp. reports 66 S LREND=0 67 I LRESSW D CLSSCHK^LRAPRES1(DUZ,.LREND) 68 Q:LREND 69 ; 70 W !!,"Data entry for ",LRH(0)," " 71 S %=1 D YN^LRU G:%<1 END 72 I %=2 D G:Y<1 END 73 .S %DT="AE",%DT(0)="-N",%DT("A")="Enter YEAR: " D ^%DT K %DT 74 .Q:Y<1 S LRAD=$E(Y,1,3)_"0000",LRH(0)=$E(Y,1,3)+1700 75 I '$D(^LRO(68,LRAA,1,LRAD,0)) D Q 76 .W $C(7),!!,"NO ",LRAA(1)," ACCESIONS IN FILE FOR ",LRH(0),!! 77 W K X,Y,LR("CK") R !!,"Select Accession Number/Pt name: ",LRAN:DTIME 78 G:LRAN=""!(LRAN[U) END 79 I LRAN'?1N.N D G:LRAN<1 END G W 80 .D PNAME^LRAPDA 81 .Q:LRAN<1 82 .D DIE 83 D REST 84 G W 85 REST W " for ",LRH(0) 86 I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN,0)) D Q 87 .W $C(7),!!,"Accession # ",LRAN," for ",LRH(0) 88 .W " not in ACCESSION file",!! 89 S X=^LRO(68,LRAA,1,LRAD,1,LRAN,0),LRLLOC=$P(X,"^",7),LRDFN=+X 90 Q:'$D(^LR(LRDFN,0)) S X=^(0) D ^LRUP 91 W !,LRP," ID: ",SSN 92 I LRSS'="AU" D 93 .S LRI=$P(^LRO(68,LRAA,1,LRAD,1,LRAN,3),"^",5) 94 .W !,"Specimen(s):" 95 .S X=0 F S X=$O(^LR(LRDFN,LRSS,LRI,.1,X)) Q:'X D 96 ..I $D(^LR(LRDFN,LRSS,LRI,.1,X,0)),$L(^(0)) W !,^(0) 97 DIE ;Define default supplementary report 98 N LRFILE,LRIENS,LRIENS1,LRX,LRRLS,LRFDA,LRLKFL,LRDA,LRQUIT,LRNOSP 99 N LRMSG,LRSRFL,LRFDA2,LRSRMD,LRRLM 100 S DIC("B")="",LRNOSP=0 101 I LRSS'="AU" D 102 .S LRFILE=+$$GET1^DID(LRSF,1.2,"","SPECIFIER") 103 .S LRIENS1=LRI_","_LRDFN_"," 104 .I '+$P($G(^LR(LRDFN,LRSS,LRI,1.2,0)),"^",4) S LRNOSP=1 Q 105 .S LRX=0 F S LRX=$O(^LR(LRDFN,LRSS,LRI,1.2,LRX)) Q:'LRX D 106 ..S LRIENS=LRX_","_LRIENS1 107 ..S LRSRFL=$$GET1^DIQ(LRFILE,LRIENS,.02,"I") 108 ..;LRSRMD-set to 1 if supp rpt modified and requires release 109 ..S LRSRMD=$$GET1^DIQ(LRFILE,LRIENS,.03,"I") 110 ..Q:LRSRFL&('LRSRMD) 111 ..S DIC("B")=$$GET1^DIQ(LRFILE,LRIENS,.01,"I") 112 I LRSS="AU" D 113 .S LRFILE=63.324,LRIENS1=LRDFN_"," 114 .I '+$P($G(^LR(LRDFN,84,0)),"^",4) S LRNOSP=1 Q 115 .S LRX=0 F S LRX=$O(^LR(LRDFN,84,LRX)) Q:'LRX D 116 ..S LRIENS=LRX_","_LRIENS1 117 ..S LRSRFL=$$GET1^DIQ(LRFILE,LRIENS,.02,"I") 118 ..;LRSRMD-set to 1 if supp rpt modified and requires release 119 ..S LRSRMD=$$GET1^DIQ(LRFILE,LRIENS,.03,"I") 120 ..Q:LRSRFL&('LRSRMD) 121 ..S DIC("B")=$$GET1^DIQ(LRFILE,LRIENS,.01,"I") 122 I LRNOSP D Q 123 .K LRMSG 124 .S LRMSG=$C(7)_"No supplementary reports exist for this accession." 125 .D EN^DDIOL(LRMSG,"","!!") 126 I 'DIC("B") D Q 127 .K LRMSG 128 .S LRMSG=$C(7)_"All supplementary reports have been released." 129 .D EN^DDIOL(LRMSG,"","!!") 130 DIE1 ; 131 S (LRQUIT,LRRLM)=0 132 F D Q:LRQUIT 133 .W ! 134 .S:LRSS="AU" (LRLKFL,DIC)="^LR(LRDFN,84," 135 .S:LRSS'="AU" (LRLKFL,DIC)="^LR(LRDFN,LRSS,LRI,1.2," 136 .S DIC("A")="Select SUPPLEMENTARY REPORT DATE: " 137 .S DIC(0)="AEQM" 138 .D ^DIC K DIC 139 .I Y<1 S LRQUIT=1 Q 140 .S LRDA=+Y 141 .S LRIENS=LRDA_","_LRIENS1 142 .S LRRLS=+$$GET1^DIQ(LRFILE,LRIENS,.02,"I") 143 .;If E-Sign OFF, must check LRRLM. LRRLM=1 if supp rpt has been 144 .; modified and requires release 145 .S LRRLM=+$$GET1^DIQ(LRFILE,LRIENS,.03,"I") 146 .I LRESSW,LRRLS D Q 147 ..W !!,"This supplementary report has already been released.",! 148 .I 'LRESSW,LRRLS D Q:'LRRLM 149 ..I 'LRRLM W !!,"This supplementary rept has already been released.",! 150 .W ! 151 .I LRESSW D Q 152 ..D ESIG Q:LRQUIT 153 ..D UPDATE 154 .S DIR("A")="Release supplementary report",DIR(0)="Y",DIR("B")="NO" 155 .D ^DIR K DIR 156 .Q:'Y 157 .D UPDATE 158 .;If E-sign switch OFF and orig report released, must verify all 159 .; supp reports released before release main report. 160 .I LRCKREL,'LRESSW D CHKSUP^LRAPR1 161 Q 162 ; 163 A D ^LRAP G:'$D(Y) END 164 Q 165 C ; 166 S LRDICS="SPCYEM" D ^LRAP 167 G:'$D(Y) END 168 Q 169 S ;from LRAPDA 170 S LRK=$P(^LR(LRDFN,LRSS,LRI,0),"^",11) Q:'LRK S:'$D(^LRO(68,LRAA,1,LRAD,1,LRAN,4,0)) ^(0)="^68.04PA^^" 171 Q:$D(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRT,0)) S ^(0)=LRT_"^50^^"_DUZ_"^"_LRK,X=^LRO(68,LRAA,1,LRAD,1,LRAN,4,0),^(0)=$P(X,"^",1,2)_"^"_LRT_"^"_($P(X,"^",4)+1) 172 S:'$D(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRT,1,0)) ^(0)="^68.14P^^" 173 S C=0 F S C=$O(LRT(C)) Q:'C D CAP 174 S ^LRO(68,"AA",LRAA_"|"_LRAD_"|"_LRAN_"|"_LRT)="" 175 Q 176 ; 177 CAP S ^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRT,1,C,0)=C_"^1^0^0^^"_LRK_"^"_DUZ_"^"_DUZ(2)_"^"_LRAA_"^"_LRAA_"^"_LRAA 178 S X=^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRT,1,0),^(0)=$P(X,"^",1,2)_"^"_C_"^"_($P(X,"^",4)+1) 179 Q 180 ; 181 SWITCH ;Check to see if electronic signature is enabled 182 D GETDATA^LRAPESON(.LRESSW) 183 Q 184 ESIG ;Prompt for electronic signature 185 S LRQUIT=0 186 D SIG^XUSESIG 187 I X1="" D 188 .W " SIGNATURE NOT VERIFIED" 189 .S LRQUIT=1 190 Q 191 UPDATE ; 192 S LRLKFL=LRLKFL_LRDA_",0)" 193 L +@(LRLKFL):5 I '$T D Q 194 .S LRMSG="This record is locked by another user. " 195 .S LRMSG=LRMSG_"Please wait and try again." 196 .D EN^DDIOL(LRMSG,"","!!") 197 S LRFDA(LRFILE,LRIENS,.02)=1 198 S LRFDA2(LRFILE,LRIENS,.02)="@" ;Set but don't file unless unrel needed 199 ;File signer ID and Date/time of released supp report 200 D CKSIGNR^LRAPR1 201 D FILE^DIE("","LRFDA") 202 W "...Released" 203 L -@(LRLKFL) 204 ;If all supp reports released, and E-Sign switch is ON, proceed to 205 ; release main report 206 S LRCKREL=0 207 S:LRSS'="AU" LRCKREL=$P(^LR(LRDFN,LRSS,LRI,0),"^",11) 208 S:LRSS="AU" LRCKREL=$P(^LR(LRDFN,LRSS),"^",15) 209 I LRCKREL,LRESSW D RELMN 210 Q 211 SUPCHK ;Check for unreleased supplementary reports 212 N LRSR,LRSR1,LRSR2 213 S LRSR=0,LRSR1=1 214 I LRSS'="AU" D 215 .Q:'+$P($G(^LR(LRDFN,LRSS,LRI,1.2,0)),U,4) 216 .F S LRSR=$O(^LR(LRDFN,LRSS,LRI,1.2,LRSR)) Q:LRSR'>0!('LRSR1) D 217 ..S LRSR1=+$P(^LR(LRDFN,LRSS,LRI,1.2,LRSR,0),U,2) 218 ..I 'LRSR1 D 219 ...S Y=+$P(^LR(LRDFN,LRSS,LRI,1.2,LRSR,0),U) 220 ...D DD^%DT S LRSR2=Y 221 I LRSS="AU" D 222 .Q:'+$P($G(^LR(LRDFN,84,0)),U,4) 223 .F S LRSR=$O(^LR(LRDFN,84,LRSR)) Q:LRSR'>0!('LRSR1) D 224 ..S LRSR1=+$P(^LR(LRDFN,84,LRSR,0),U,2) 225 ..I 'LRSR1 D 226 ...S Y=+$P(^LR(LRDFN,84,LRSR,0),U) 227 ...D DD^%DT S LRSR2=Y 228 I 'LRSR1 D 229 .W $C(7),!,"Supplementary report "_LRSR2_" has not been released. " 230 .W "Cannot release." 231 .S Y=0 232 Q 233 RINFO ;Display release information 234 W $C(7),!,"Report " 235 W:LRZ(2)=1 "has already been " 236 W "released " 237 S Y=LRZ(2) 238 D DD^%DT 239 W:LRZ(2)>1 Y 240 W:LRZ(1)'="" " by "_$P($G(^VA(200,LRZ(1),0)),U) 241 K Y 242 Q 243 NMPATH ;Check for missing pathologist name 244 I 'LRZ(3) D 245 .W $C(7),!,"Pathologist name missing. Cannot release." 246 .S Y=0 247 Q 248 RELEASE ;Prompt for release/unrelease 249 W ! S DIR(0)="YA",DIR("B")="NO" 250 S:LRZ(2) DIR("A")="Unrelease report? " 251 S:'LRZ(2) DIR("A")="Release report? " 252 D ^DIR 253 K:Y Y 254 I $D(Y) S Y=0 255 Q 256 RELMN ;Allow release of main report as long as all supp reports are 257 ; released, and signer is same person for main and supp report(s) 258 ;Make sure all supp reports signed out 259 S LRQT=0 260 D RELCHK^LRAPR1 261 Q:LRQT 262 ; 263 ;Continue with electronic signature and storage in TIU 264 S LRAU=$S(LRSS="AU":1,1:0) 265 I 'LRAU D 266 .S LRPAT=+$$GET1^DIQ(LRSF,LRIENS1,.02,"I") 267 .S LRZ=$$GET1^DIQ(LRSF,LRIENS1,.03,"I") 268 .S LRZ(1)=$$GET1^DIQ(LRSF,LRIENS1,.13,"I") 269 .S LRZ(1.1)=$$GET1^DIQ(LRSF,LRIENS1,.13) 270 .S LRZ(2)=$$GET1^DIQ(LRSF,LRIENS1,.11,"I") 271 I LRAU D 272 .S LRPAT=+$$GET1^DIQ(63,LRDFN_",",13.6,"I") 273 .S LRZ=$$GET1^DIQ(63,LRDFN_",",13,"I") 274 .S LRZ(1)=$$GET1^DIQ(63,LRDFN_",",14.8,"I") 275 .S LRZ(1.1)=$$GET1^DIQ(63,LRDFN_",",14.8) 276 .S LRZ(2)=$$GET1^DIQ(63,LRDFN_",",14.7,"I") 277 .S LRI="" 278 W !!,?25,"*** Main Report Release ***",! 279 D NOW^%DTC S LRNTIME=% 280 D TIUPREP^LRAPRES 281 D STORE^LRAPRES 282 I LRQUIT D FILE^DIE("","LRFDA2") Q 283 D UNRLSE^LRAPR1 284 D RELEASE^LRAPRES 285 I LRQUIT D FILE^DIE("","LRFDA2") Q 286 D MAIN^LRAPRES1(LRDFN,LRSS,LRI,LRSF,LRP,LRAC) 287 D OERR^LR7OB63D 288 S LRQUIT=1 289 Q 290 END ; 291 D V^LRU 292 Q -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRAPRES1.m
r613 r623 1 LRAPRES1 ;DALOI/WTY/KLL/CKA- AP ESIG RELEASE REPORT/ALERT;11/13/012 ;;5.2;LAB SERVICE;**259,336,369,365**;Sep 27, 1994;Build 9 3 4 ;Referenceto FILE^TIUSRVP supported by IA #35405 ;Referenceto ^TIULQ supported by IA #26936 ;Reference to ^ORB3LAB supported by IA #4287 7 ;Reference to DIC lookup on MAIL GROUP file (#3.8) supported by IA #10111 8 ; 9 MAIN(LRDFN,LRSS,LRI,LRSF,LRP,LRAC) ;Main subroutine 10 Q:'$D(LRDFN)!('$D(LRSS))!('$D(LRP))!('$D(LRAC)) 11 N LRDOCS,LRMSG,LRC,LRDOCSN,LRNUM,LRADL,LRMORE,LRQUIT,LRXQA 12 N DIR,DIRUT,DTOUT,DUOUT,X,Y,DIC,XQA,XQAMSG 13 S LRQUIT=0 14 I $G(LRAU) D 15 .S LRA=^LR(LRDFN,"AU") 16 .S LRI=$P(LRA,U) 17 D DOCS 18 Q:LRQUIT 19 D MORE 20 I LRMORE D LOOKUP 21 D SEND 22 Q 23 DOCS ;GET ORDERING PROVIDER AND PCP TO SEND ALERT 24 W ! 25 S:$G(LRSF)="" LRSF=63 26 D GETDOCS^LRAPUTL(.LRDOCS,LRDFN,LRSS,$G(LRI),LRSF) 27 S:LRDOCS(1)=LRDOCS(2) LRDOCS(2)=0 28 F LRC=1:1:2 D 29 .I LRDOCS(LRC) D 30 ..S LRDOCSN(LRC)=$$NAME^XUSER(LRDOCS(LRC),"F") 31 ..I LRDOCSN(LRC)'="" S LRXQA(LRDOCS(LRC))="" 32 S LRNUM=1 33 K LRMSG 34 D 35 .S LRMSG(LRNUM)="Alert will be sent to:",LRMSG(LRNUM,"F")="!!" 36 .I LRDOCS(1) D 37 ..S LRNUM=LRNUM+1,LRMSG(LRNUM)=LRDOCSN(1),LRMSG(LRNUM,"F")="?24" 38 .I LRDOCS(2)D39 ..S LRNUM=LRNUM+1,LRMSG(LRNUM)=LRDOCSN(2) 40 ..S LRMSG(LRNUM,"F")=$S(LRDOCS(1):"!",1:"")_"?24" 41 I LRQUIT D 42 .S LRMSG(LRNUM)="No Ordering Provider or PCP for alert" 43 .S LRMSG(LRNUM,"F")="!!" 44 D EN^DDIOL(.LRMSG) 45 Q 46 MORE ;Add names or mail groups to the lookup list? 47 N DIR,DIRUT,DTOUT,DUOUT,X,Y 48 W ! 49 S LRMORE=1 50 S DIR(0)="Y" 51 S DIR("A")="Send the alert to additional names or mail groups" 52 S X=$$GET^XPAR("USR^DIV^PKG","LRAPRES1 AP ALERT",1,"Q") 53 S X=$S(X=1:"YES",X=0:"NO",1:"NO") 54 S DIR("B")=X 55 D ^DIR 56 I Y=0 S LRMORE=0 Q 57 I $D(DUOUT)!($D(DTOUT)) S LRQUIT=1,LRMORE=0 58 Q 59 LOOKUP ;Add additional names or mail groups to alert list. 60 F D Q:LRQUIT 61 .W ! 62 .K DIR 63 .;S DIR(0)="F^3:30^I X'?1""U."".E&(X'?1""G."".E) K X" 64 .S DIR(0)="FO^3:30^I X["".""&((X'?1""G."".E)&(X'?1""g."".E)) K X"65 .S DIR("A")="Enter name or mail group"66 .S DIR("?")="Enter lastname,firstname OR G.mailgroup OR ^ to exit"67 .D ^DIR 68 .I $D(DIRUT) S LRQUIT=1 Q 69 .S X=Y,LRADL="" 70 .I Y["." S LRADL=$P(Y,"."),X=$P(Y,".",2) 71 .S Y=$$UP^XLFSTR(Y)72 .I LRADL="g" S LRADL="G" 73 .K DIC 74 .S DIC(0)="QEZ" 75 .S DIC=$S(LRADL="G":3.8,1:200) 76 .D ^DIC 77 .Q:Y=-1 78 .S:LRADL="" XQA($P(Y,"^"))=""79 .S:LRADL="G" XQA("G."_$P(Y,"^",2))="" 80 Q 81 SEND ;Send the alert 82 ;S XQAMSG=$E(LRP,1,9)_" ("_$E(LRP,1)_VA("BID")_"): Pathology report signed for "_LRAC_"." 83 ;D SETUP^XQALERT 84 M XQA=LRXQA 85 D LAB^ORB3LAB(DFN,LRDFN,LRI,$G(LRA),LRSS,.XQA)86 I $D(LRADL) D 87 .S LRMSG="Alerts have been sent to the specified additional users."88 .D EN^DDIOL(LRMSG,"","!!")89 .K LRMSG90 91 AHELP 92 93 94 95 S LRMSG(2)="provider andthe surgeon/physician that this report has"96 S LRMSG(3)="been electronically signed and is nowavailable for"97 S LRMSG(4)="viewing.You will also have the opportunity to send the"98 99 100 101 RETRACT(LRDFN,LRSS,LRI,LRTIUPTR) 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 CLSSCHK(DUZ,LREND) 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 1 LRAPRES1 ;DALOI/WTY/KLL - AP ESIG RELEASE REPORT/ALERT;11/13/01 2 ;;5.2;LAB SERVICE;**259,336,369**;Sep 27, 1994;Build 2 3 ; 4 ;Reference to FILE^TIUSRVP supported by IA #3540 5 ;Reference to ^TIULQ supported by IA #2693 6 ; 7 MAIN(LRDFN,LRSS,LRI,LRSF,LRP,LRAC) ;Main subroutine 8 Q:'$D(LRDFN)!('$D(LRSS))!('$D(LRP))!('$D(LRAC)) 9 N LRDOCS,LRMSG,XQA,LRC,LRDOCSN,LRNUM,LRADL,LRMORE,LRQUIT 10 N DIR,DIRUT,DTOUT,DUOUT,X,Y,DIC,XQA,XQAMSG 11 S LRQUIT=0 12 D ASK 13 Q:LRQUIT 14 D MORE 15 Q:LRQUIT 16 D:LRMORE LOOKUP 17 D ALERT 18 Q 19 ASK ;Ask if alert is to be sent 20 W ! 21 S DIR(0)="Y",DIR("B")="NO" 22 S DIR("A")="Do you wish to send an alert" 23 S DIR("??")="^D AHELP^LRAPRES1" 24 D ^DIR 25 I 'Y S LRQUIT=1 Q 26 S:$G(LRSF)="" LRSF=63 27 D GETDOCS^LRAPUTL(.LRDOCS,LRDFN,LRSS,$G(LRI),LRSF) 28 S:LRDOCS(1)=LRDOCS(2) LRDOCS(2)=0 29 S LRQUIT=1 30 F LRC=1:1:2 D 31 .I LRDOCS(LRC) D 32 ..S LRQUIT=0 33 ..S X=LRDOCS(LRC) D D^LRUA S LRDOCSN(LRC)=X 34 ..I LRDOCSN(LRC)'="" S XQA(LRDOCS(LRC))="" 35 ;Q:LRQUIT 36 S LRNUM=1 37 K LRMSG 38 I 'LRQUIT D 39 .S LRMSG(LRNUM)="Alert will be sent to:",LRMSG(LRNUM,"F")="!!" 40 .I LRDOCS(1) D 41 ..S LRNUM=LRNUM+1,LRMSG(LRNUM)=LRDOCSN(1),LRMSG(LRNUM,"F")="?24" 42 .I LRDOCS(2) D 43 ..S LRNUM=LRNUM+1,LRMSG(LRNUM)=LRDOCSN(2) 44 ..S LRMSG(LRNUM,"F")=$S(LRDOCS(1):"!",1:"")_"?24" 45 I LRQUIT D 46 .S LRMSG(LRNUM)="No Physician or PCP selected for alert" 47 .S LRMSG(LRNUM,"F")="!!" 48 .S LRQUIT=0 49 D EN^DDIOL(.LRMSG) 50 Q 51 MORE ;Add names or mail groups to the lookup list? 52 W ! 53 S LRMORE=1 54 S DIR(0)="Y",DIR("B")="NO" 55 S DIR("A")="Send the alert to additional names or mail groups" 56 D ^DIR 57 I Y=0 S LRMORE=0 Q 58 I $D(DUOUT)!($D(DTOUT)) S LRQUIT=1 59 Q 60 LOOKUP ;Add additional names or mail groups to alert list. 61 F D Q:LRQUIT 62 .W ! 63 .K DIR 64 .;S DIR(0)="F^3:30^I X'?1""U."".E&(X'?1""G."".E) K X" 65 .S DIR(0)="F^3:30^I X["".""&(X'?1""G."".E) K X" 66 .S DIR("A")="Enter name or mail group" 67 .S DIR("?")="Enter lastname,firstname OR G.mailgroup OR ^ to exit" 68 .D ^DIR 69 .I $D(DUOUT)!($D(DTOUT)) S LRQUIT=1 Q 70 .S X=Y,LRADL="" 71 .I Y["." S LRADL=$P(Y,"."),X=$P(Y,".",2) 72 .K DIC 73 .S DIC(0)="QEZ" 74 .S DIC=$S(LRADL="G":3.8,1:200) 75 .D ^DIC 76 .Q:Y=-1 77 .S:LRADL="" XQA($P(Y,"^"))="" 78 .S:LRADL="G" XQA("G."_$P(Y,"^",2))="" 79 .K LRMSG 80 .S LRMSG=$S(LRADL="G":"Mail group ",1:"User ")_$P(Y,"^",2) 81 .S LRMSG=LRMSG_" added to alert list." 82 .D EN^DDIOL(LRMSG,"","!!") 83 Q 84 ALERT ;Send the alert 85 S XQAMSG="Pathology report signed for "_LRAC_" - "_$E(LRP,1,30) 86 D SETUP^XQALERT 87 S LRMSG="Alerts have been sent." 88 D EN^DDIOL(LRMSG,"","!!") 89 K LRMSG 90 Q 91 AHELP ;Help Frame 92 K LRMSG 93 S LRMSG(1)="If answered 'Yes', the alert will notify the primary care" 94 S LRMSG(1,"F")="!" 95 S LRMSG(2)="provider and the surgeon/physician that this report has" 96 S LRMSG(3)="been electronically signed and is now available for" 97 S LRMSG(4)="viewing. You will also have the opportunity to send the" 98 S LRMSG(5)="alert to additional names or mail groups." 99 D EN^DDIOL(.LRMSG) 100 Q 101 RETRACT(LRDFN,LRSS,LRI,LRTIUPTR) ; 102 ;Change prior TIU versions of report to RETRACTED status 103 N LRROOT,LRIENS,LRFILE,LRTIUP,LRTIUAR,LRERR,LRSTAT,LRTIUX,LREXRR 104 I LRSS=""!("AUSPEMCY"'[LRSS) S LRPTR=0 Q 105 I LRSS="AU" D 106 .S LRROOT="^LR(LRDFN,101,""C""",LRIENS=LRDFN_"," 107 .S LRFILE=63.101 108 I LRSS'="AU" D 109 .S LRROOT="^LR(LRDFN,LRSS,LRI,.05,""C""" 110 .S LRIENS=LRI_","_LRDFN_"," 111 .S LRFILE=$S(LRSS="SP":63.19,LRSS="CY":63.47,LRSS="EM":63.49,1:"") 112 Q:'$D(@(LRROOT_")")) 113 S LRTIUP=0,LRTIUX(.05)=15 114 F S LRTIUP=$O(@(LRROOT_",LRTIUP)")) Q:LRTIUP'>0!(LRTIUP=LRTIUPTR) D 115 .K LRTIUAR S (LRSTAT,LRERR)=0 116 .D EXTRACT^TIULQ(LRTIUP,"LRTIUAR",.LRERR,".05",,,"I") 117 .Q:+LRERR 118 .M LRSTAT=LRTIUAR(LRTIUP,.05,"I") 119 .Q:LRSTAT'=7 ;Quit if current status is not COMPLETED 120 .D FILE^TIUSRVP(.LREXRR,LRTIUP,.LRTIUX) 121 .;Update new TIU version of report with previous TIU pointer value 122 .N LREXRR,LRTIUX 123 .S LRTIUX(1406)=LRTIUP 124 .D FILE^TIUSRVP(.LREXRR,LRTIUPTR,.LRTIUX) 125 Q 126 CLSSCHK(DUZ,LREND) ;Determine if user has the proper class settings and 127 ;PROVIDER key 128 N LRMSG,LRPRCLSS,LRPCEXP,LRVCDE,LRPCSTR,LRMTCH 129 ;First, check for PROVIDER key 130 I '$D(^XUSEC("PROVIDER",DUZ)) D Q 131 .K LRMSG S LRMSG=$C(7)_"Electronic signature not authorized. Missing " 132 .S LRMSG=LRMSG_"PROVIDER key." 133 .D EN^DDIOL(LRMSG,"","!!") 134 .K LRMSG S LREND=1 135 ;Next, check the provider class 136 S LRPRCLSS=$$GET1^DIQ(200,DUZ_",",53.5) 137 ;PROVIDER CL MUST CONTAIN PHYSICIAN, OR CYTOTECH ONLY FOR CY SECTION 138 ;OR DENTIST FOR ORAL AND MAXILLOFACIAL PATHOLOGY 139 S LRMTCH=0 140 I LRPRCLSS'["PHYSICIAN",LRPRCLSS'["DENTIST" D 141 .I LRPRCLSS'["CYTOTECH" S LRMTCH=1 142 .I LRSS'="CY" S LRMTCH=1 143 I LRMTCH=1 D Q 144 .K LRMSG 145 .S LRMSG(1)=$C(7)_"You are not authorized to electronically sign " 146 .S LRMSG(1)=LRMSG(1)_"reports." 147 .S LRMSG(1,"F")="!!" 148 .S LRMSG(2)="PROVIDER CLASS must include PHYSICIAN," 149 .S LRMSG(2,"F")="!" 150 .S LRMSG(3)=" OR CYTOTECHNOLOGIST FOR CY SECTIONS ONLY," 151 .S LRMSG(3,"F")="!" 152 .S LRMSG(4)=" OR DENTIST FOR ORAL AND MAXILLOFACIAL PATHOLOGY." 153 .S LRMSG(4,"F")="!" 154 .D EN^DDIOL(.LRMSG) K LRMSG 155 .S LREND=1 156 ;Finally, check the person class 157 S LRPCSTR=$$GET^XUA4A72(DUZ) ;Supported reference #1625 158 I LRPCSTR<0 D Q 159 .K LRMSG 160 .S LRMSG="PERSON CLASS is inactive or undefined. Electronic signature" 161 .S LRMSG=LRMSG_" is not authorized." 162 .D EN^DDIOL(LRMSG,"","!!") 163 .K LRMSG 164 .S LREND=1 165 S LRPCEXP=+$P(LRPCSTR,"^",6) 166 I LRPCEXP D Q 167 .K LRMSG 168 .S LRMSG="PERSON CLASS has expired. Electronic signature" 169 .S LRMSG=LRMSG_" is not authorized." 170 .D EN^DDIOL(LRMSG,"","!!") K LRMSG 171 .S LREND=1 172 S LRVCDE=$P(LRPCSTR,"^",7),LRMTCH=0 173 ;CORRECT PERSON CLASS SHOULD MATCH PROVIDER CLASS 174 I LRPRCLSS["PHYSICIAN" D 175 .I $E(LRVCDE,1,6)="V11370","123568"[+$E(LRVCDE,7) S LRMTCH=1 176 .I $E(LRVCDE,1,6)="V11371","03"[+$E(LRVCDE,7) S LRMTCH=1 177 .I $E(LRVCDE,1,6)="V18240","124579"[+$E(LRVCDE,7) S LRMTCH=1 178 .I LRVCDE="V182413" S LRMTCH=1 179 I LRPRCLSS["CYTOTECH" D 180 .I LRVCDE="V150113" S LRMTCH=1 181 I LRPRCLSS["DENTIST" D 182 .I LRVCDE="V030503" S LRMTCH=1 183 I 'LRMTCH D 184 .K LRMSG 185 .S LRMSG="Invalid PERSON CLASS. Electronic Signature is not " 186 .S LRMSG=LRMSG_"authorized." 187 .D EN^DDIOL(LRMSG,"","!!") 188 .K LRMSG 189 .S LREND=1 190 Q -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRSPT.m
r613 r623 1 LRSPT 2 ;;5.2;LAB SERVICE;**1,72,248,259,373**;Sep 27, 1994;Build 1 3 4 5 6 7 8 9 10 11 12 13 GETP 14 15 16 17 18 19 20 21 22 23 24 CH 25 26 27 28 29 30 DEV 31 32 33 34 35 36 37 38 39 QUE 40 41 42 43 44 45 46 47 48 49 50 51 52 K 53 54 55 56 57 58 59 D 60 61 62 63 64 65 66 AU 67 68 69 .D:$Y>(IOSL-13) F^LRAPF,H S X=^LRO(69.2,LRAA,10,LR("A"),0) D ^DIWP70 71 72 73 H 74 75 END 76 77 78 SGL 79 CONT 80 81 82 83 1 LRSPT ;AVAMC/REG/WTY - AP PRELIMINARY REPORTS ;10/16/01 2 ;;5.2;LAB SERVICE;**1,72,248,259**;Sep 27, 1994 3 ; 4 ;Reference to ^%DT supported by IA #10003 5 ;Reference to ^DPT supported by IA #918 6 ;Reference to ^DIWP suppported by IA #10011 7 ;Reference to ^DIWW suppported by IA #10029 8 ;Reference to EN^DDIOL supported by IA #10142 9 ; 10 S X="T",%DT="" D ^%DT,D^LRU S LRTOD=Y D EN2^LRUA 11 W !!,"Preliminary reports for ",LRO(68) 12 G END:LRAPX=2,SGL:LRAPX=3,CH:LRAPX=4 13 GETP D EN1^LRUPS Q:LRAN=-1 14 G:$D(^LRO(69.2,LRAA,1,LRAN,0)) GETP 15 L +^LRO(69.2,LRAA,1):5 I '$T D G GETP 16 .S MSG(1)="The preliminary reports queue is in use by another person. " 17 .S MSG(1,"F")="!!" 18 .S MSG(2)="You will need to add this accession to the queue later." 19 .D EN^DDIOL(.MSG) K MSG 20 S ^LRO(69.2,LRAA,1,LRAN,0)=LRDFN_"^"_LRI 21 S X=^LRO(69.2,LRAA,1,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1) 22 L -^LRO(69.2,LRAA,1) 23 G GETP 24 CH S LRAPX(1)=1 D EN^LRSPRPT2 Q:%<1 25 W !!,"Save preliminary reports for reprinting " 26 S %=2 D YN^LRU S:%=1 LRSAV=1 27 ;Variable LR("DVD") is used to divide reports displayed in the browser 28 K LR("DVD") 29 S $P(LR("DVD"),"|",IOM)="" 30 DEV ; 31 W ! 32 S %ZIS="Q" D ^%ZIS 33 I POP W ! Q 34 I $D(IO("Q")) D Q 35 .S ZTDESC="ANAT PATH PRELIM REPORT" 36 .S ZTSAVE("LR*")="",ZTRTN="QUE^LRSPT" 37 .D ^%ZTLOAD W:$D(ZTSK) !,"Request Queued, #",ZTSK W ! 38 .K ZTSK,IO("Q") D HOME^%ZIS 39 QUE ; 40 U IO 41 ;LRSF515=1 means this is generating and SF515. 42 S:'$D(LRSF515) LRSF515=0 43 D L^LRU,L1^LRU,S^LRU,SET^LRUA 44 S LR("SPSM")=1 ;Set flag to suppress printing of SNOMED codes 45 S LRS(5)=1,LRQ(2)=1,LRA=$S($D(^LRO(69.2,LRAA,0)):$P(^(0),U,9),1:1) 46 S:LRA="" LRA=1 47 S LR("DIWF")=$S($P(^LRO(69.2,LRAA,0),"^",6)="D":"D",1:"")_"W" 48 I $D(LRAP) S LRDFN=$P(LRAP,"^"),LRI=$P(LRAP,"^",2) D D G K 49 S LRAN=0 F S LRAN=$O(^LRO(69.2,LRAA,1,LRAN)) Q:'LRAN!(LR("Q")) D 50 .S X=^LRO(69.2,LRAA,1,LRAN,0),LRDFN=+X,LRI=$P(X,"^",2) D D 51 .W:IOST["BROWSER" !!,LR("DVD") 52 K K:'$D(LRSAV) ^LRO(69.2,LRAA,1) K P,S,LRAN 53 S ^LRO(69.2,LRAA,1,0)="^69.21A^^" 54 I 'LR("Q"),$D(LR("F")),IOST?1"C".E D CONT 55 K LRSAV 56 W:IOST?1"P-".E @IOF D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@" 57 K %,DIR,DTOUT,DUOUT,DIRUT,X,Y 58 Q 59 D K ^UTILITY($J) I '$D(^LR(LRDFN,0)) K ^LRO(69.2,LRAA,1,LRAN) Q 60 N LRPRE S LRPRE=1 ;Notifies EN^LRSPRPT that this is a prelim report 61 D EN^LRSPRPT Q:LR("Q") 62 I $P($G(^LR(LRDFN,0)),"^",2)=2 D Q:LR("Q") 63 .D ^LRAPPOW 64 G:'$D(^LR(LRDFN,"SP",0))&('$D(^LR(LRDFN,"CY",0)))&('$D(^LR(LRDFN,"EM",0))) AU 65 D ^LRAPT1 Q:LR("Q") 66 AU I $D(^LR(LRDFN,"AU")),$L($P(^LR(LRDFN,"AU"),"^")) D ^LRAPT2 Q:LR("Q") 67 K ^UTILITY($J) S DIWR=IOM-5,DIWF="W",LR("A")=0 68 W ! F LRZ=0:1 S LR("A")=$O(^LRO(69.2,LRAA,10,LR("A"))) Q:'LR("A") D 69 .D:$Y>(IOSL-6) H S X=^LRO(69.2,LRAA,10,LR("A"),0) D ^DIWP 70 D:LRZ ^DIWW 71 S LRO=1 D F^LRAPF 72 Q 73 H ;from LRAPPF1 74 D F^LRU W !,"ANATOMIC PATHOLOGY",!,LR("%") Q 75 END W $C(7),!!,"OK TO DELETE THE ",LRO(68)," PRELIMINARY REPORT LIST" S %=2 D YN^LRU I %=1 K ^LRO(69.2,LRAA,1) S ^LRO(69.2,LRAA,1,0)="^69.21A^0^0" W $C(7),!,"LIST DELETED !" Q 76 W !!,"FINE, LET'S FORGET IT",! Q 77 ; 78 SGL D EN1^LRUPS Q:LRAN=-1 S LRAP=LRDFN_"^"_LRI,LRSAV=1 D EN2^LRUA G DEV 79 CONT ; 80 K DIR S DIR(0)="E" 81 D ^DIR W ! 82 S:$D(DTOUT)!(X[U) LR("Q")=1 83 Q -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRSRVR6.m
r613 r623 1 LRSRVR6 ;DALIO/JMC - LAB DATA SERVER CONT'D SNOMED EXTRACT ;Aug 17, 2006 2 ;;5.2;LAB SERVICE;**346,378**;Sep 27, 1994;Build 1 3 ; Produces SNOMED extract via LRLABSERVER option 4 ; 5 Q 6 ; 7 ; 8 SERVER ; Server entry Point 9 N I,LRCNT,LREND,LRL,LRMSUBJ,LRST,LRSTN,LRTXT,LRX,LRY 10 D BUILD 11 S LRMSUBJ=LRST_" "_LRSTN_" SNOMED EXTRACT "_$$HTE^XLFDT($H,"1M") 12 D MAILSEND(LRMSUBJ) 13 D CLEAN 14 Q 15 ; 16 ; 17 BUILD ; Build extract 18 N J,LRCNT,LRCRLF,LRETIME,LRFN,LRLEX,LRNAME,LRQUIT,LRROOT,LRSCT,LRSCTEC,LRSCTVER,LRSCTX,LRSPEC,LRSTIME,LRSTR,LRVAL,LRVUID,LRX,LRY,X,Y 19 ; 20 S LRSTIME=$$NOW^XLFDT,LRVAL=$$SITE^VASITE,LRST=$P(LRVAL,"^",3),LRSTN=$P(LRVAL,"^",2),LRSCTVER="" 21 I LRST="" S LRST="???" 22 K ^TMP($J,"LRDATA") 23 S (LRCNT,LRCNT("SCT"))=0,LRCRLF=$C(13,10),LRSTR="" 24 F I=61,61.1,61.2,61.3,61.4,61.5,61.6,62 S LRCNT(I)=0,LRCNT(I,"SCT")=0 25 D HDR 26 ; 27 ; Flag to indicate if SNOMED CT is available from LEXICON. 28 S LRLEX=0 29 I $T(CODE^LEXTRAN)'="" S LRLEX=1 30 ; 31 F LRFN=61,61.1,61.2,61.3,61.4,61.5,61.6,62 D 32 . S LRROOT="^LAB("_LRFN_",""B"")" 33 . D FILE 34 ; 35 S LRETIME=$$NOW^XLFDT 36 ; Set the final info into the ^TMP message global 37 S LRNODE=$O(^TMP($J,"LRDATA",""),-1) 38 I LRSTR'="" S LRNODE=LRNODE+1,^TMP($J,"LRDATA",LRNODE)=$$UUEN^LRSRVR4(LRSTR) 39 S ^TMP($J,"LRDATA",LRNODE+1)=" " 40 S ^TMP($J,"LRDATA",LRNODE+2)="end" 41 ; 42 S ^TMP($J,"LRDATA",1)=^TMP($J,"LRDATA",1)_" (Run time:"_$$FMDIFF^XLFDT(LRETIME,LRSTIME,3)_")" 43 S ^TMP($J,"LRDATA",3)="SNOMED CT version......: "_LRSCTVER 44 S J=6 45 S ^TMP($J,"LRDATA",J)="Number of records per file:" 46 F I=61,61.1,61.2,61.3,61.4,61.5,61.6,62 D 47 . S J=J+1 48 . S ^TMP($J,"LRDATA",J)=" "_$$LJ^XLFSTR($$GET1^DID(I,"","","NAME")_" File (#"_I_")",32,".")_": "_$J(LRCNT(I),5)_" ("_LRCNT(I,"SCT")_" mapped)" 49 S ^TMP($J,"LRDATA",J+1)=$$LJ^XLFSTR("Total number of records",33,".")_": "_$J(LRCNT,5)_" ("_LRCNT("SCT")_" mapped)" 50 ; 51 Q 52 ; 53 ; 54 CLEAN ; 55 K ^TMP($J,"LR61") 56 K LRIEN,LRLEN,LRNODE,LRSNM,LRSPECN 57 D CLEAN^LRSRVR 58 D ^%ZISC 59 Q 60 ; 61 ; 62 FILE ; Search file entry and build record. 63 ; 64 F S LRROOT=$Q(@LRROOT) Q:LRROOT="" Q:$QS(LRROOT,2)'="B" D 65 . Q:$G(@LRROOT) 66 . S LRIEN=$QS(LRROOT,4),LRSPEC="" 67 . S LRNAME=$P($G(^LAB(LRFN,LRIEN,0)),"^"),LRNAME=$$TRIM^XLFSTR(LRNAME,"RL"," ") 68 . S X=$P($G(^LAB(LRFN,LRIEN,0)),"^",2) 69 . S LRSNM=$S(LRFN'=62:X,1:"") 70 . I LRFN=62 S LRSPEC=X 71 . I LRSNM'="",LRFN>60.9,LRFN<61.61 S LRX=((LRFN*10)#610)+1,LRSNM=$E("TMEFDPJ",LRX)_"-"_LRSNM 72 . S LRSCT=$P($G(^LAB(LRFN,LRIEN,"SCT")),"^"),(LRSCTEC,LRSCTX,LRVUID)="" 73 . I LRLEX,LRSCT'="" D 74 . . K LRX 75 . . S LRX=$$CODE^LEXTRAN(LRSCT,"SCT",DT,"LRX") 76 . . S LRSCTX=$G(LRX("F")),LRSCTEC=$S(LRX<1:$P(LRX,"^",2),1:"") 77 . . I LRSCTVER="",LRX>0 S LRSCTVER=$P($G(LRX(0)),"^",3) 78 . S LRSTR=LRSTR_LRST_"-"_LRFN_"-"_LRIEN_"|"_LRNAME_"|"_LRSNM_"|"_LRVUID_"|"_LRSCT_"|"_LRSCTX_"|"_LRSCTEC_"|" 79 . S LRSPECN="|" 80 . I LRFN=62,LRSPEC D 81 . . S LRSPECN=$P($G(^LAB(61,LRSPEC,0)),"^") 82 . . S LRSPECN=LRSPECN_"|"_LRST_"-61-"_LRSPEC 83 . S LRSTR=LRSTR_LRSPECN_"|1.1|" 84 . S LRCNT=LRCNT+1,LRCNT(LRFN)=LRCNT(LRFN)+1 S:LRSCT LRCNT("SCT")=LRCNT("SCT")+1,LRCNT(LRFN,"SCT")=LRCNT(LRFN,"SCT")+1 85 . D SETDATA 86 Q 87 ; 88 ; 89 SETDATA ; Set data into report structure 90 S LRSTR=LRSTR_LRCRLF 91 S LRNODE=$O(^TMP($J,"LRDATA",""),-1) 92 D ENCODE^LRSRVR4(.LRSTR) 93 Q 94 ; 95 ; 96 HDR ; Set the header information 97 N LRFILENM 98 S LRFILENM=$TR(LRSTN," ","_")_"-"_LRSUB_"-"_$P($$FMTHL7^XLFDT(LRSTIME),"-")_".TXT" 99 S ^TMP($J,"LRDATA",1)="Report Generated.......: "_$$FMTE^XLFDT(LRSTIME)_" at "_LRSTN 100 S ^TMP($J,"LRDATA",2)="Report requested.......: "_LRSUB 101 S ^TMP($J,"LRDATA",3)="SNOMED CT version......: " 102 S ^TMP($J,"LRDATA",4)="Extract version........: 1.1" 103 F I=5,15,16,18,23 S ^TMP($J,"LRDATA",I)=" " 104 S ^TMP($J,"LRDATA",17)="Attached file..........: "_LRFILENM 105 S ^TMP($J,"LRDATA",19)="Legend:" 106 S X="Station #-File #-IEN|Entry Name|SNOMED I|VUID|SNOMED CT|SNOMED CT TERM|Mapping Exception|Related Specimen|Related Specimen ID|Extract Ver|" 107 S ^TMP($J,"LRDATA",20)=X 108 S X=" 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |" 109 S ^TMP($J,"LRDATA",21)=X 110 S ^TMP($J,"LRDATA",22)=$$REPEAT^XLFSTR("-",$L(X)) 111 S ^TMP($J,"LRDATA",24)=$$UUBEGFN^LRSRVR2A(LRFILENM) 112 Q 113 ; 114 ; 115 MAILSEND(LRMSUBJ) ; Send extract back to requestor. 116 ; 117 N LRINSTR,LRTASK,LRTO,XMERR,XMZ 118 S LRTO(XQSND)="" 119 S LRINSTR("ADDR FLAGS")="R" 120 S LRINSTR("FROM")="LAB_PACKAGE" 121 S LRMSUBJ=$E(LRMSUBJ,1,65) 122 D SENDMSG^XMXAPI(.5,LRMSUBJ,"^TMP($J,""LRDATA"")",.LRTO,.LRINSTR,.LRTASK) 123 Q 1 LRSRVR6 ;DALIO/JMC - LAB DATA SERVER CONT'D SNOMED EXTRACT ;Aug 17, 2006 2 ;;5.2;LAB SERVICE;**346**;Sep 27, 1994;Build 10 3 ; Produces SNOMED extract via LRLABSERVER option 4 ; 5 Q 6 ; 7 ; 8 SERVER ; Server entry Point 9 N I,LRCNT,LREND,LRL,LRMSUBJ,LRST,LRSTN,LRTXT,LRX,LRY 10 D BUILD 11 S LRMSUBJ=LRST_" "_LRSTN_" SNOMED EXTRACT "_$$HTE^XLFDT($H,"1M") 12 D MAILSEND(LRMSUBJ) 13 D CLEAN 14 Q 15 ; 16 ; 17 BUILD ; Build extract 18 N J,LRCNT,LRCRLF,LRETIME,LRFN,LRLEX,LRNAME,LRQUIT,LRROOT,LRSCT,LRSCTEC,LRSCTVER,LRSCTX,LRSPEC,LRSTIME,LRSTR,LRVAL,LRVUID,LRX,LRY,X,Y 19 ; 20 S LRSTIME=$$NOW^XLFDT,LRVAL=$$SITE^VASITE,LRST=$P(LRVAL,"^",3),LRSTN=$P(LRVAL,"^",2),LRSCTVER="" 21 I LRST="" S LRST="???" 22 K ^TMP($J,"LRDATA") 23 S (LRCNT,LRCNT("SCT"))=0,LRCRLF=$C(13,10),LRSTR="" 24 F I=61,61.1,61.2,61.3,61.4,61.5,61.6,62 S LRCNT(I)=0,LRCNT(I,"SCT")=0 25 D HDR 26 ; 27 ; Flag to indicate if SNOMED CT is available from LEXICON. 28 S LRLEX=0 29 I $T(CODE^LEXTRAN)'="" S LRLEX=1 30 ; 31 F LRFN=61,61.1,61.2,61.3,61.4,61.5,61.6,62 D 32 . S LRROOT="^LAB("_LRFN_",""B"")" 33 . D FILE 34 ; 35 S LRETIME=$$NOW^XLFDT 36 ; Set the final info into the ^TMP message global 37 S LRNODE=$O(^TMP($J,"LRDATA",""),-1) 38 I LRSTR'="" S LRNODE=LRNODE+1,^TMP($J,"LRDATA",LRNODE)=$$UUEN^LRSRVR4(LRSTR) 39 S ^TMP($J,"LRDATA",LRNODE+1)=" " 40 S ^TMP($J,"LRDATA",LRNODE+2)="end" 41 ; 42 S ^TMP($J,"LRDATA",1)=^TMP($J,"LRDATA",1)_" (Run time:"_$$FMDIFF^XLFDT(LRETIME,LRSTIME,3)_")" 43 S ^TMP($J,"LRDATA",3)="SNOMED CT version......: "_LRSCTVER 44 S J=6 45 S ^TMP($J,"LRDATA",J)="Number of records per file:" 46 F I=61,61.1,61.2,61.3,61.4,61.5,61.6,62 D 47 . S J=J+1 48 . S ^TMP($J,"LRDATA",J)=" "_$$LJ^XLFSTR($$GET1^DID(I,"","","NAME")_" File (#"_I_")",32,".")_": "_$J(LRCNT(I),5)_" ("_LRCNT(I,"SCT")_" mapped)" 49 S ^TMP($J,"LRDATA",J+1)=$$LJ^XLFSTR("Total number of records",33,".")_": "_$J(LRCNT,5)_" ("_LRCNT("SCT")_" mapped)" 50 ; 51 Q 52 ; 53 ; 54 CLEAN ; 55 K ^TMP($J,"LR61") 56 K LRIEN,LRLEN,LRNODE,LRSNM,LRSPECN 57 D CLEAN^LRSRVR 58 D ^%ZISC 59 Q 60 ; 61 ; 62 FILE ; Search file entry and build record. 63 ; 64 F S LRROOT=$Q(@LRROOT) Q:LRROOT="" Q:$QS(LRROOT,2)'="B" D 65 . Q:$G(@LRROOT) 66 . S LRIEN=$QS(LRROOT,4),LRSPEC="" 67 . S LRNAME=$P($G(^LAB(LRFN,LRIEN,0)),"^"),LRNAME=$$TRIM^XLFSTR(LRNAME,"RL"," ") 68 . S X=$P($G(^LAB(LRFN,LRIEN,0)),"^",2) 69 . S LRSNM=$S(LRFN'=62:X,1:"") 70 . I LRFN=62 S LRSPEC=X 71 . I LRSNM'="",LRFN>60.9,LRFN<61.61 S LRX=((LRFN*10)#610)+1,LRSNM=$E("TMEFDPJ",LRX)_"-"_LRSNM 72 . S LRSCT=$P($G(^LAB(LRFN,LRIEN,"SCT")),"^"),(LRSCTEC,LRSCTX,LRVUID)="" 73 . I LRLEX,LRSCT'="" D 74 . . K LRX 75 . . S LRX=$$CODE^LEXTRAN(LRSCT,"SCT",DT,"LRX") 76 . . S LRSCTX=$G(LRX("F")),LRSCTEC=$S(LRX<1:$P(LRX,"^",2),1:"") 77 . . I LRSCTVER="",LRX>0 S LRSCTVER=$P($G(LRX(0)),"^",3) 78 . S LRSTR=LRSTR_LRST_"-"_LRFN_"-"_LRIEN_"|"_LRNAME_"|"_LRSNM_"|"_LRVUID_"|"_LRSCT_"|"_LRSCTX_"|"_LRSCTEC_"|" 79 . S LRSPECN="|" 80 . I LRFN=62,LRSPEC D 81 . . S LRSPECN=$P($G(^LAB(61,LRSPEC,0)),"^") 82 . . S LRSPECN=LRSPECN_"|"_LRST_"-61-"_LRSPEC 83 . S LRSTR=LRSTR_LRSPECN_"|1.1|" 84 . S LRCNT=LRCNT+1,LRCNT(LRFN)=LRCNT(LRFN)+1 S:LRSCT LRCNT("SCT")=LRCNT("SCT")+1,LRCNT(LRFN,"SCT")=LRCNT(LRFN,"SCT")+1 85 . D SETDATA 86 Q 87 ; 88 ; 89 SETDATA ; Set data into report structure 90 S LRSTR=LRSTR_LRCRLF 91 S LRNODE=$O(^TMP($J,"LRDATA",""),-1) 92 D ENCODE^LRSRVR4(.LRSTR) 93 Q 94 ; 95 ; 96 HDR ; Set the header information 97 N LRFILENM 98 S LRFILENM=$TR(LRSTN," ","_")_"-"_LRSUB_"-"_$P($$FMTHL7^XLFDT(LRSTIME),"-")_".TXT" 99 S ^TMP($J,"LRDATA",1)="Report Generated.......: "_$$FMTE^XLFDT(LRSTIME)_" at "_LRSTN 100 S ^TMP($J,"LRDATA",2)="Report requested.......: "_LRSUB 101 S ^TMP($J,"LRDATA",3)="SNOMED CT version......: " 102 S ^TMP($J,"LRDATA",4)="Extract version........: 1.1" 103 F I=5,15,16,18,23 S ^TMP($J,"LRDATA",I)=" " 104 S ^TMP($J,"LRDATA",17)="Attached file..........: "_LRFILENM 105 S ^TMP($J,"LRDATA",19)="Legend:" 106 S X="Station #-File #-IEN|Entry Name|SNOMED I|VUID|SNOMED CT|SNOMED CT TERM|Mapping Exception|Related Specimen|Related Specimen ID|Extract Ver|" 107 S ^TMP($J,"LRDATA",20)=X 108 S X=" 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |" 109 S ^TMP($J,"LRDATA",21)=X 110 S ^TMP($J,"LRDATA",22)=$$REPEAT^XLFSTR("-",$L(X)) 111 S ^TMP($J,"LRDATA",24)=$$UUBEGFN^LRSRVR2A(LRFILENM) 112 Q 113 ; 114 ; 115 MAILSEND(LRMSUBJ) ; Send extract back to requestor. 116 ; 117 N LRINSTR,LRTASK,LRTO,XMERR,XMZ 118 S LRTO(XQSND)="" 119 S LRINSTR("ADDR FLAGS")="R" 120 S LRINSTR("FROM")="LAB_PACKAGE" 121 D SENDMSG^XMXAPI(.5,LRMSUBJ,"^TMP($J,""LRDATA"")",.LRTO,.LRINSTR,.LRTASK) 122 Q -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRVER3A.m
r613 r623 1 LRVER3A 2 ;;5.2;LAB SERVICE;**1,5,42,100,121,153,190,221,254,263,266,274,295,373**;Sep 27, 1994;Build 1 3 4 5 6 7 8 9 VER 10 11 12 13 14 S:'($D(^LRO(68,LRAA,1,LRACD,1,LRAN,0))#2)LRACD=LRAD15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 I $D(^LRO(69,LRODT,1,LRSN,0)) S^(3)=$S($D(^(3)):+^(3),1:LRNOW) S:'$P(^(3),U,2) $P(^(3),U,2)=LRNOW41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 XREF 56 57 58 59 60 61 62 63 64 65 66 67 TSKM 68 69 70 REQ 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 REQ1 89 90 91 FCS 92 93 94 95 1 LRVER3A ;SLC/CJS/DALOI/FHS - DATA VERIFICATION ;5/27/03 14:49 2 ;;5.2;LAB SERVICE;**1,5,42,100,121,153,190,221,254,263,266,274,295**;Sep 27, 1994 3 ;Also contains LRORFLG to restrict multiple OERR alerts (VER+2) 4 ; Reference to ^DIC(42 supported by IA #10039 5 ; Reference to ^%ZTLOAD supported by DBIA #10063 6 ; Reference to IN5^VADPT supported by DBIA #10061 7 ; Reference to $$NOW^XLFDT supported by DBIA #10103 8 ; 9 VER ;Call with L ^LR(LRDFN,LRSS,LRIDT) from LRGV2, LRGVG1, LRSTUF1, LRSTUF2, LRVR3 10 Q:'$O(LRSB(0)) 11 N LRVCHK,LRORTST,LRORFLG,LRT 12 S LRORU3=$G(^LRO(68,LRAA,1,LRAD,1,LRAN,.3)),(LRAOD,LRACD)=$P(^(0),U,3) 13 S LRACD=$S($D(^LRO(68,LRAA,1,LRAD,1,LRAN,9)):^(9),1:LRACD) 14 S:'$D(^LRO(68,LRAA,1,LRACD,1,LRAN,0))#2 LRACD=LRAD 15 S LRAOD=$S($D(^LRO(68,LRAA,1,LRAOD,1,LRAN,0))#2:LRAOD,1:LRAD) 16 I '$G(LRFIX) S LRNOW=$$NOW^XLFDT,$P(^LR(LRDFN,LRSS,LRIDT,0),U,3,4)=LRNOW_U_$S($G(LRDUZ):LRDUZ,1:DUZ) 17 K A2 I '$D(PNM) S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) D PT^LRX S:PNM="" PNM="NONAME" 18 N LRT S LRT=0 F S LRT=$O(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRT)) Q:LRT<.5 S:$P(^(LRT,0),U,5)="" A2(LRT)=1 I $D(^TMP("LR",$J,"VTO",LRT)) S LRVCHK=+^(LRT) D 19 . I $S(LRVCHK<1:1,$D(LRSB(LRVCHK))#2:1,1:0) D 20 . . I $D(LRSB(LRVCHK)) Q:$P(LRSB(LRVCHK),U)="" 21 . . I LRVCHK<1,$L($P(^LRO(68,LRAA,1,LRAD,1,LRAN,4,LRT,0),U,6)) Q 22 . . D 23 . . . S $P(^LRO(68,LRAA,1,LRAD,1,LRAN,4,+LRT,0),U,4)=$S($G(LRDUZ):LRDUZ,$G(DUZ):DUZ,1:"") 24 . . . S:'$P(^(0),U,5) $P(^(0),U,5)=LRNOW 25 . . . S $P(^(0),U,6)="",$P(^(0),U,8)=$G(LRCDEF) 26 . . S LRORTST(LRT)="" 27 . . I LRACD'=LRAD D 28 . . . Q:'$D(^LRO(68,LRAA,1,LRACD,1,LRAN,4,+LRT,0)) D 29 . . . . S $P(^LRO(68,LRAA,1,LRACD,1,LRAN,4,+LRT,0),U,4)=$S($G(LRDUZ):LRDUZ,$G(DUZ):DUZ,1:"") 30 . . . . S:'$P(^(0),U,5) $P(^(0),U,5)=LRNOW 31 . . . . S $P(^(0),U,6)="",$P(^(0),U,8)=$G(LRCDEF) 32 . . I $P($G(LRPARAM),U,14),$P($G(^LRO(68,+LRAA,0)),U,16) S ^LRO(68,"AA",LRAA_"|"_LRAD_"|"_LRAN_"|"_LRT)="" 33 . . K A2(LRT) 34 . . I +$G(LRDPF)=2,$$VER^LR7OU1<3 D 35 . . . N I,Y 36 . . . S Y=LRNOW,I=LRT D V^LROR ;OE/RR 2.5 37 ;-K ZZCARE,ZRECORD I $D(^LR(LRDFN,.3)),^LR(LRDFN,.3)'="" D FCS ; CJS/MPLS 12-4-91 LINK TO CIS ; CJS/MPLS 3-16-92 KILL LOCAL VARIABLES 38 ;-I $P(^LR(LRDFN,0),U,2)=2 I '$D(ZZCARE) S ZRECORD=0,ZRECORD=$O(^SC("C",LRLLOC,ZRECORD)) I ZRECORD'="",$D(^LRTXFCS(5000024,1,618001,"B",ZRECORD)) D FCS ; CJS/MPLS 3-16-92 LINE ADDED TO CHECK IF REQUESTING LOCATION IS CAREVUE SUPPORTED ++RG 39 S D1=1,X=0 F S X=$O(^TMP("LR",$J,"TMP",X)) Q:X<1 S LRT=+^(X) I $D(LRM(X)) D REQ 40 S:$D(^LRO(69,LRODT,1,LRSN,0)) ^(3)=$S($D(^(3)):+^(3),1:LRNOW) S:'$P(^(3),U,2) $P(^(3),U,2)=LRNOW 41 I D1,'$D(A2) S:'$P(^LRO(68,LRAA,1,LRAD,1,LRAN,3),U,4) $P(^(3),U,4)=LRNOW,^LRO(68,LRAA,1,LRAD,1,"AC",LRNOW,LRAN)="" 42 ; Class I CareVue routine TASKED if CareVue ward - pwc/10-2000 43 D 44 . N I,LR7DLOC D IN5^VADPT S LR7DLOC=$G(^DIC(42,+$P($G(VAIP(5)),"^"),44)) 45 . Q:'LR7DLOC D:$D(^LAB(62.487,"C",LR7DLOC)) ;good ward location 46 . . S ZTRTN="^LA7DLOC",ZTDESC="LAB AUTOMATION CAREVUE SUPPORTED WARDS" 47 . . S ZTIO="",ZTDTH=$H,ZTSAVE("L*")="" D ^%ZTLOAD 48 . . K ZTSAVE,ZTSK,ZTRTN,ZTIO,ZTDTH,ZTDESC,ZTREQ,ZTQUEUED 49 ;D ^VEICVLOC ;* PLS 6/3/99 -For HL7 interface 50 I D1,'$D(A2),LRAD'=LRACD S:'$P(^LRO(68,LRAA,1,LRACD,1,LRAN,3),U,4) $P(^(3),U,4)=LRNOW,^LRO(68,LRAA,1,LRACD,1,"AC",LRNOW,LRAN)="" 51 D XREF I $D(^LRO(68,LRAA,.2))'[0 X ^(.2) 52 N CORRECT S:$G(LRCORECT) CORRECT=1 D NEW^LR7OB1(LRODT,LRSN,"RE",,.LRORTST) 53 L -^LR(LRDFN,LRSS,LRIDT) ;unlock 54 Q 55 XREF ;from COM1^LRVER4 and VER^LRVER3A 56 I +$G(LRDPF)=2,$$VER^LR7OU1<3 D EN^LROR(LRAA,LRAD,LRAN) ;OE/RR 2.5 57 I LRDPF=62.3 S ^LRO(68,LRAA,1,LRAD,1,"AD",DT,LRAN)="" Q 58 S LRPRAC=$$PRAC^LRX($P(^LR(LRDFN,LRSS,LRIDT,0),U,10)) ;get doc name 59 S ^LRO(68,LRAA,1,LRAD,1,"AD",DT,LRAN)="" 60 S ^LRO(69,9999999-LRIDT\1,1,"AL",$E(LRLLOC,1,15),$E(PNM,1,20),LRDFN)="" 61 S ^LRO(69,9999999-LRIDT\1,1,"AP",LRPRAC,$E(PNM,1,20),LRDFN)="" 62 S ^LRO(69,DT,1,"AN",$E(LRLLOC,1,15),LRDFN,LRIDT)="" 63 S ^LRO(69,DT,1,"AR",$E(LRLLOC,1,15),$E(PNM,1,20),LRDFN)="" 64 S ^LRO(69,"AN",$E(LRLLOC,1,20),LRDFN,LRIDT)="" 65 D CHSET^LRPX(LRDFN,LRIDT) 66 Q:'$P(LRPARAM,U,3) 67 TSKM F KK="LRDFN","LRAA","LRAOD","LRAD","LRAN","LRIDT","LRSS","LRLLOC","LRSN","LRODT" S ZTSAVE(KK)="" 68 N %X S ZTRTN="DQ^LRTP",ZTIO="",ZTDTH=$H,ZTDESC="LAB INTERIM REPORTS" D ^%ZTLOAD 69 K KK,ZTSK,ZTRTN,ZTDTH,ZTSAVE,ZTIO Q 70 REQ ; 71 Q:$P($G(LRSB(X)),U)="comment" 72 I $D(LRSB(X)),$P(LRSB(X),U)="canc" Q 73 I $D(LRSB(X)),$P(LRSB(X),U)'["pending" Q 74 I $L($P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,4,+LRT,0)),U,6)) Q 75 S:'$G(LRALERT) LRALERT=$S($G(LROUTINE):LROUTINE,1:9) 76 S D1=0 N A,LRPPURG 77 I $D(LRSB(X)),LRSB(X)["pending",$D(^LRO(68,LRAA,1,LRAD,1,LRAN,4,+LRT,0))#2 D G REQ1 78 . S $P(^LRO(68,LRAA,1,LRAD,1,LRAN,4,+LRT,0),U,4)="",$P(^(0),U,5,6)="^",$P(^(0),U,9)=+$G(LRM(X,"P")) 79 I '$D(LRSB(X)),'$L($P($G(^LR(LRDFN,"CH",LRIDT,X)),U)) S $P(^(X),U)="pending" 80 I '$D(LRSB(X)),$P($G(^LR(LRDFN,"CH",LRIDT,X)),U)'="pending" Q 81 I $D(^LRO(68,LRAA,1,LRAD,1,LRAN,4,+LRT,0))#2 S $P(^(0),U,4,5)="^",A=$P(^(0),U,2) I A>49 S $P(^(0),U,2)=$S(A=50:9,1:A-50) 82 I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN,4,+LRT,0))#2 D 83 . S ^LRO(68,LRAA,1,LRAD,1,LRAN,4,"B",+LRT,+LRT)="" 84 . S LRPPURG=$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,4,+$G(LRM(X,"P")),0)),U,2) 85 . S:'LRPPURG LRPPURG=$S($G(LRALERT):+LRALERT,1:9) 86 . S ^LRO(68,LRAA,1,LRAD,1,LRAN,4,+LRT,0)=+LRT_U_LRPPURG,$P(^(0),U,9)=+$G(LRM(X,"P")) 87 . S $P(^LRO(68,LRAA,1,LRAD,1,LRAN,4,0),U,3)=+LRT,$P(^(0),U,4)=$P(^(0),U,4)+1 Q 88 REQ1 ; 89 Q:LRACD=LRAD I $D(^LRO(68,LRAA,1,LRACD,1,LRAN,4,+LRT,0))#2,'$L($P(^(0),U,6)) S ^(0)=$P(^(0),U,1,2),$P(^(0),U,7)=1,$P(^(0),U,9)=+$G(LRM(X,"P")) 90 K CNT,LRAMC Q 91 FCS ; SET UP FOR FOREIGN COMPUTER SYSTEM ; CJS/MPLS 12-4-91 LINK TO CIS 92 ;-S:'$D(ZRECORD) ZZCARE=1 S:$D(ZRECORD) ZTSAVE("LRLLOC")="" ; CJS/MPLS 3-18-92 SET ZZCARE IF PATIENT IN ICU'S, SET ZTSAVE IF TEST REQUESTED FROM PAR/OR 93 ;-F KK="LRDFN","LRIDT","DFN" S ZTSAVE(KK)="" 94 ;-S ZTRTN="EN^LAFCCVX2",ZTIO="",ZTDTH=$H D ^%ZTLOAD 95 ;-Q -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRWLST1.m
r613 r623 1 LRWLST1 ;DALOI/CJS/RWF/FHS - ACCESSION SETUP ; July 19, 2006 2 ;;5.2;LAB SERVICE;**48,65,121,153,261,286,331,379**;Sep 27, 1994;Build 2 3 ; 4 ; Reference to ^DIC(42 supported by IA #10039 5 ; Reference to ^SC( supported by IA #10040 6 ; 7 S LRWLC=0 8 F S LRWLC=$O(LRTSTS(LRWLC)) Q:LRWLC<1 S LRAD=DT D SPLIT 9 ; 10 ; If LEDI and comments came with order then copy to order in #69 11 I $G(LRORDRR)="R",$G(LR696),$D(^LRO(69.6,LR696,99)) D 12 . N LRDIE 13 . D WP^DIE(69.01,LRSN_","_LRODT_",",16,"A","^LRO(69.6,LR696,99)","LRDIE(16)") 14 ; 15 K DIC,DLAYGO,DR,DA,DIE,LRIXX 16 Q:$G(LRORDR)="P" 17 K LRNM,LRTSTS 18 K ^TMP("LR",$J,"TMP") 19 Q 20 ; 21 SPLIT ; 22 N LRAA,LRX 23 ; Setup regular accessions (LRUNQ=0) 24 S LRUNQ=0,LREND=0 25 I $D(LRTSTS(LRWLC,0)) D 26 . D GTWLN 27 . I LREND Q 28 . S LRAA=0 29 . F S LRAA=$O(LRTSTS(LRWLC,0,LRAA)) Q:LRAA<1 D 30 . . S LRSS=LRTSTS(LRWLC,0,LRAA) 31 . . D STWLN,ST2,^LRWLST11,EN^LA7ADL(LRUID) 32 . D SICA^LRWLST11 33 ; 34 ; Setup accessions requiring 'unique' accession numbers (LRUNQ=1) 35 S LRUNQ=1,LRAA=0 36 F S LRAA=$O(LRTSTS(LRWLC,1,LRAA)) Q:LRAA<1 D 37 . S LRSS=LRTSTS(LRWLC,1,LRAA) 38 . F D GTWLN Q:LREND D Q:$O(LRTSTS(LRWLC,1,LRAA,0))<1 39 . . D STWLN,ST2,^LRWLST11,EN^LA7ADL(LRUID),SICA^LRWLST11 40 Q 41 ; 42 ; 43 STWLN ; Set accession number 44 ; 45 D GETLOCK(LRAA,LRAD) 46 D CHECK68(LRAA,LRAD) 47 ; 48 S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) 49 ; 50 ; Handle 'in common' area that was not setup in GTWLN call. 51 I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN)) D SETAN(LRAA,LRAD,LRAN) 52 ; 53 S LREND=0,LRLBLBP=1-$P(LRSS,U,2),LRSS=$P(LRSS,U) 54 S LRACC=$P(^LRO(68,LRAA,0),U,11)_" "_$S(LRAD["0000":$E(LRAD,2,3),1:$E(LRAD,4,7))_" "_LRAN 55 ; 56 S LRPRAC="" 57 I $D(^LRO(69,LRODT,1,LRSN,0)) S LRPRAC=$P(^(0),U,6) S:$D(LRNT) ^(3)=LRNT 58 ; 59 ; Location type 60 S LRCAPLOC=$P($G(^SC(+LROLLOC,0)),U,3) 61 I LRCAPLOC="" S LRCAPLOC="Z" 62 ; 63 ; File information in file #68 for this accession 64 N FDA,LR6802,LRDIE 65 S LR6802=LRAN_","_LRAD_","_LRAA_"," 66 S FDA(1,68.02,LR6802,.01)=LRDFN 67 S FDA(1,68.02,LR6802,1)=LRDPF 68 S FDA(1,68.02,LR6802,2)=LRAD 69 S FDA(1,68.02,LR6802,3)=LRODT 70 S FDA(1,68.02,LR6802,4)=LRSN 71 S FDA(1,68.02,LR6802,6)=LRLLOC 72 S X=$G(^LRO(69,LRODT,1,LRSN,.1)) I X'="" S FDA(1,68.02,LR6802,14)=X 73 ; 74 ; No ordering provider/location on controls 75 I LRDPF'=62.3 D 76 . S FDA(1,68.02,LR6802,6.5)=LRPRAC 77 . S FDA(1,68.02,LR6802,94)=LROLLOC 78 ; 79 ; Only store treating specialty on file #2 patients 80 ; If no treating specialty then use specialty from file #44 location 81 I LRDPF=2 D 82 . S LRTREA=$P($G(^DPT(DFN,.103)),U) 83 . I 'LRTREA S LRTREA=$P($G(^SC(+LROLLOC,0)),U,20) 84 . I LRTREA S FDA(1,68.02,LR6802,6.6)=LRTREA 85 ; 86 S FDA(1,68.02,LR6802,6.7)=DUZ 87 S FDA(1,68.02,LR6802,15)=LRACC 88 S FDA(1,68.02,LR6802,26)=DUZ(2) 89 S FDA(1,68.02,LR6802,92)=LRCAPLOC 90 ; 91 D FILE^DIE("","FDA(1)","LRDIE(1)") 92 I $D(LRDIE(1)) D MAILALRT 93 ; 94 ; If specimen defined then set nodes, force to ien=1 since many lab 95 ; routines expect the specimen to be record number 1. 96 I $G(LRSPEC) D 97 . N FDAIEN 98 . S FDAIEN(1)=1 99 . S FDA(2,68.05,"+1,"_LR6802,.01)=LRSPEC 100 . S FDA(2,68.05,"+1,"_LR6802,1)=$P(LRSAMP,";",1) 101 . ; 102 . ; Modification to prevent lock failures - loop 10 times to give system a chance to get lock 103 . N LRLOCKOK,LRLOOPCT 104 . S LRLOCKOK=0 105 . F LRLOOPCT=1:1:10 Q:LRLOCKOK D I 'LRLOCKOK H 5 106 . . K LRDIE(2) 107 . . D UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)") 108 . . S:$D(LRDIE(2))=0 LRLOCKOK=1 109 . K LRLOCKOK,LRLOOPCT 110 . ; 111 . ;D UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)") 112 . I $D(LRDIE(2)) D MAILALRT 113 ; 114 ; If no specimen defined then use specimen values from file #69. 115 I $G(LRSPEC)="",$D(^LRO(69,LRODT,1,LRSN,4,0)) D 116 . N FDA,FDAIEN,LRI,LRX 117 . S LRI=0 118 . F S LRI=$O(^LRO(69,LRODT,1,LRSN,4,LRI)) Q:'LRI D 119 . . S FDAIEN(1)=LRI,LRX=$G(^LRO(69,LRODT,1,LRSN,4,LRI,0)) 120 . . S FDA(LRI,68.05,"+1,"_LR6802,.01)=$P(LRX,"^") 121 . . D UPDATE^DIE("","FDA(LRI)","FDAIEN","LRDIE(LRI)") 122 . . I $D(LRDIE(LRI)) D MAILALRT 123 ; 124 ; Create UID. 125 S LRUID=$$LRUID^LRX(LRAA,LRAD,LRAN) 126 ; 127 I '$D(LRPHSET),('$G(LRQUIET)) W !!,"ACCESSION: ",LRACC," <",LRUID,">" 128 ; 129 D UPD696 130 ; 131 L -^LRO(68,LRAA,1,LRAD,1,0) 132 Q 133 ; 134 ; 135 UPD696 ; Update file #69.6 if LEDI referral patient and no existing entry 136 K LR696IEN 137 I $G(LRORDRR)="R" D 138 . S LR696IEN=0 139 . I $G(LRRSITE("SMID"))'="",$G(LRSD("RUID"))'="" S LR696IEN=+$O(^LRO(69.6,"AD",LRRSITE("SMID"),LRSD("RUID"),0)) 140 . I LR696IEN Q 141 . I '$G(LRRSTAT(0)) S LRRSTAT(0)=$$FIND1^DIC(64.061,"","OMX","Specimen in process","","I $P(^LAB(64.061,Y,0),U,7)=""U""") 142 . D PSET^LRPEND(SSN(2),+LRRSITE("RSITE"),LRSD("RUID"),+LRSD("RPSITE"),LRSPEC,LRSAMP,LRRSTAT(0),LRODT,$P(LRCDT,U),LRRSITE("SDT"),LRNT,.LROT) 143 Q 144 ; 145 ; 146 ST2 ; Find next available node in LR global 147 ; 148 N FDA,FDAIEN,LRDIE,LRX,LRXIDT 149 ; 150 ; Autopsy ("AU") is not a mulitple - do not attempt to set in ^LR global 151 I LRSS="AU" S LRIDT=0 Q 152 ; 153 S LRIDT=0 154 F D Q:LRIDT 155 . S LRXIDT=9999999-LRCDT 156 . L +^LR(LRDFN,LRSS,LRXIDT,0):5 157 . I '$T S LRCDT=$$FMADD^XLFDT(LRCDT,0,0,0,1) Q 158 . I '$D(^LR(LRDFN,LRSS,LRXIDT,0)) S LRIDT=LRXIDT Q 159 . L -^LR(LRDFN,LRSS,LRXIDT,0) 160 . S LRCDT=$$FMADD^XLFDT(LRCDT,0,0,0,1) 161 ; 162 ; Create entry in appropriate subscript in LAB DATA file (#63). 163 S LRX=$S(LRSS="CH":63.04,LRSS="MI":63.05,LRSS="BB":63.01,LRSS="SP":63.08,LRSS="CY":63.09,LRSS="EM":63.02,1:0) 164 S FDAIEN(1)=LRIDT 165 S FDA(63,LRX,"+1,"_LRDFN_",",.01)=LRCDT 166 S FDA(63,LRX,"+1,"_LRDFN_",",.06)=LRACC 167 I LRSS'="CH" S FDA(63,LRX,"+1,"_LRDFN_",",.1)=LRNT 168 I LRSS="CH" S FDA(63,LRX,"+1,"_LRDFN_",",.12)=3 169 I LRSS="MI" S FDA(63,LRX,"+1,"_LRDFN_",",38)=3 170 I LRX D UPDATE^DIE("","FDA(63)","FDAIEN","LRDIE(63)") 171 I $D(LRDIE(63)) D MAILALRT 172 ; 173 ; Uncomment following code when new field .9 in"MI" subscript is released 174 ;I LRSS="MI" D 175 ;. N LRN,ERR,IENS 176 ;. S IENS=LRIDT_","_LRDFN_",",LRN=0 177 ;. F S LRN=$O(^LRO(69,LRODT,1,LRSN,2,LRN)) Q:LRN<1 D 178 ;. . I '$D(^LRO(69,LRODT,1,LRSN,2,LRN,1,0)) Q 179 ;. . D WP^DIE(63.05,IENS,.9,"A","^LRO(69,"_LRODT_",1,"_LRSN_",2,"_LRN_",1)","ERR") 180 ; 181 L -^LR(LRDFN,LRSS,LRIDT,0) 182 ; 183 Q 184 ; 185 ; 186 GTWLN ; 187 N X 188 ; 189 ; Execute accession transform for this area. 190 S LRAN=0 191 S X=$G(^LRO(68,LRWLC,.1)) X:X'="" X 192 ; 193 D GETLOCK(LRWLC,LRAD) 194 D CHECK68(LRWLC,LRAD) 195 ; 196 S:'LRAN LRAN=1+$P($G(^LRO(68,LRWLC,1,LRAD,1,0)),U,3) 197 ; 198 I "CYEMSP"'[LRSS F Q:'$D(^LRO(68,LRWLC,1,LRAD,1,LRAN)) S LRAN=LRAN+1 199 ; 200 ; check for AP Accessions 201 I "CYEMSP"[LRSS F Q:'$D(^LRO(68,LRWLC,1,LRAD,1,LRAN))&'$D(^LR("A"_LRSS_"A",$E(LRAD,1,3),LRAN)) S LRAN=LRAN+1 202 ; 203 I '$D(LRPHSET),$D(LRNCWL)!$P(^LAB(69.9,1,0),U,8) D ASK Q:LREND 204 ; 205 D SETAN(LRWLC,LRAD,LRAN) 206 ; 207 L -^LRO(68,LRWLC,1,LRAD,1,0) 208 Q 209 ; 210 ; 211 ASK ; 212 ; Don't ask if tasked or a "silent" call 213 I $D(ZTQUEUED)!($G(LRQUIET)) Q 214 ; 215 N DIR,DIROUT,DIRUT,DTOUT,DUOUT,LROK,LRANX,X,Y 216 S LROK=0 217 F D Q:LREND!(LROK) 218 . K DIR 219 . S DIR(0)="NO^1:"_$S($P(LRLABKY,U,2):999999,1:LRAN)_":0" 220 . S DIR("A")="Force to",DIR("B")=LRAN 221 . D ^DIR 222 . I $D(DIRUT) S LREND=1 Q 223 . S LRANX=Y 224 . I LRANX<+$P($G(^LRO(68,LRWLC,1,LRAD,1,0)),U,3) D 225 . . W !,"This accession number may be already assigned either in this " 226 . . W !,"area or a common accession area." 227 . I $D(^LRO(68,LRWLC,1,LRAD,1,LRANX,0)) D Q:'LROK 228 . . N LRDFNX S LRDFNX=LRDFN 229 . . N DFN,LRDFN,LRDPF,PNM,SSN 230 . . S LRDFN=+^LRO(68,LRWLC,1,LRAD,1,LRANX,0),LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^LR(LRDFN,0),U,3) 231 . . D PT^LRX 232 . . W !,"THIS NUMBER BELONGS TO ",!,PNM," SSN: ",SSN 233 . . D INF^LRX 234 . . I LRDFN=LRDFNX S LROK=1 235 . K DIR 236 . S DIR(0)="YO",DIR("A")="Are you sure",DIR("B")="NO" 237 . D ^DIR 238 . I $D(DIRUT) S LREND=1 Q 239 . I Y=1 S LRAN=LRANX,LROK=1 240 ; 241 ; Unlock if aborting. 242 I LREND L -^LRO(68,LRWLC,1,LRAD,1,0) 243 ; 244 Q 245 ; 246 ; 247 CHECK68(LRAA,LRAD) ; Check for/set header node of ^LRO(68) 68.01 subfile. 248 ; 249 ; Call with LRAA = ien of entry in file #68 250 ; LRAD = accession date in fileman format 251 ; 252 ; Set accession date in file #68 for this acession. 253 ; Check for existence of accession number multiple but not accession date multiple, 254 ; FileMan DBS call fails when accession number multiple exists but accession date multiple does not. 255 ; If this condition found then set missing node directly and quit. 256 ; 257 I '$D(^LRO(68,LRAA,1,LRAD,0)) D 258 . N FDA,FDAIEN,LRDIE,X 259 . S X=$Q(^LRO(68,LRAA,1,LRAD,0)) 260 . I X'="",$QS(X,4)=LRAD S $P(^LRO(68,LRAA,1,LRAD,0),"^")=LRAD Q 261 . S (FDAIEN(1),FDA(1,68.01,"+1,"_LRAA_",",.01))=LRAD 262 . D UPDATE^DIE("","FDA(1)","FDAIEN","LRDIE(1)") 263 . I $D(LRDIE(1)) D MAILALRT 264 ; 265 Q 266 ; 267 ; 268 GETLOCK(LRAA,LRAD) ; Obtain lock on zeroth node of this accession date 269 ; Call with LRAA = ien of entry in file #68 270 ; LRAD = accession date in fileman format 271 ; 272 F L +^LRO(68,LRAA,1,LRAD,1,0):10 Q:$T D 273 . I $D(ZTQUEUED)!($G(LRQUIET)) Q 274 . W !!?5,"Accession area ",$P(^LRO(68,LRAA,0),"^")," is locked by another user.",!,$C(7) 275 Q 276 ; 277 ; 278 SETAN(LRAA,LRAD,LRAN) ; Create stub entry in file #68 for this acession. 279 ; 280 ; Call with LRAA = ien of entry in file #68 281 ; LRAD = accession date in fileman format 282 ; LRAN = accession number 283 ; 284 N FDA,FDAIEN,LR6802,LRDIE 285 ; 286 S LR6802=LRAD_","_LRAA_"," 287 S FDAIEN(1)=LRAN 288 S FDA(2,68.02,"+1,"_LR6802,.01)=LRDFN 289 ; 290 ; Modification to prevent lock failures - loop 10 times to give system a chance to get lock 291 N LRLOCKOK,LRLOOPCT 292 S LRLOCKOK=0 293 F LRLOOPCT=1:1:10 Q:LRLOCKOK D I 'LRLOCKOK H 5 294 . K LRDIE(2) 295 . D UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)") 296 . S:$D(LRDIE(2))=0 LRLOCKOK=1 297 K LRLOCKOK,LRLOOPCT 298 ; 299 ;D UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)") 300 I $D(LRDIE(2)) D MAILALRT 301 Q 302 ; 303 ; 304 MAILALRT ; Send mail message alert when FileMan DBS errors returned 305 ; 306 N J,LR68,LRCNT,LRMTXT,X,XMINSTR,XMSUB,XMTO 307 ; 308 I $D(^LRO(68,LRAA,1,LRAD,1,LRAN)) M LR68=^LRO(68,LRAA,1,LRAD,1,LRAN) 309 ; 310 S LRMTXT(1)="The following debugging information is provided to assist" 311 S LRMTXT(2)="support staff in resolving error during accessioning." 312 S LRMTXT(3)=" " 313 S LRCNT=3 314 ; 315 F J="FDA","FDAIEN","LR68","LRAA","LRAD","LRAN","LRDFN","LRDIE","LRSS","LRTSTS","LRUNQ","LRWLC","XQY","XQY0" D 316 . S X=$G(@J) 317 . I X'="" S LRCNT=LRCNT+1,LRMTXT(LRCNT)=J_"="_X 318 . F S J=$Q(@J) Q:J="" S LRCNT=LRCNT+1,LRMTXT(LRCNT)=J_"="_@J 319 ; 320 S XMSUB="FileMan DBS call failed during accessioning in routine LRWLST1" 321 S XMTO("G.LMI")="" 322 S XMINSTR("FROM")=.5 323 S XMINSTR("ADDR FLAGS")="R" 324 D SENDMSG^XMXAPI(DUZ,XMSUB,"LRMTXT",.XMTO,.XMINSTR) 325 Q 1 LRWLST1 ;DALOI/CJS/RWF/FHS - ACCESSION SETUP ; July 19, 2006 2 ;;5.2;LAB SERVICE;**48,65,121,153,261,286,331**;Sep 27, 1994;Build 7 3 ; 4 ; Reference to ^DIC(42 supported by IA #10039 5 ; Reference to ^SC( supported by IA #10040 6 ; 7 S LRWLC=0 8 F S LRWLC=$O(LRTSTS(LRWLC)) Q:LRWLC<1 S LRAD=DT D SPLIT 9 ; 10 ; If LEDI and comments came with order then copy to order in #69 11 I $G(LRORDRR)="R",$G(LR696),$D(^LRO(69.6,LR696,99)) D 12 . N LRDIE 13 . D WP^DIE(69.01,LRSN_","_LRODT_",",16,"A","^LRO(69.6,LR696,99)","LRDIE(16)") 14 ; 15 K DIC,DLAYGO,DR,DA,DIE,LRIXX 16 Q:$G(LRORDR)="P" 17 K LRNM,LRTSTS 18 K ^TMP("LR",$J,"TMP") 19 Q 20 ; 21 SPLIT ; 22 N LRAA,LRX 23 ; Setup regular accessions (LRUNQ=0) 24 S LRUNQ=0,LREND=0 25 I $D(LRTSTS(LRWLC,0)) D 26 . D GTWLN 27 . I LREND Q 28 . S LRAA=0 29 . F S LRAA=$O(LRTSTS(LRWLC,0,LRAA)) Q:LRAA<1 D 30 . . S LRSS=LRTSTS(LRWLC,0,LRAA) 31 . . D STWLN,ST2,^LRWLST11,EN^LA7ADL(LRUID) 32 . D SICA^LRWLST11 33 ; 34 ; Setup accessions requiring 'unique' accession numbers (LRUNQ=1) 35 S LRUNQ=1,LRAA=0 36 F S LRAA=$O(LRTSTS(LRWLC,1,LRAA)) Q:LRAA<1 D 37 . S LRSS=LRTSTS(LRWLC,1,LRAA) 38 . F D GTWLN Q:LREND D Q:$O(LRTSTS(LRWLC,1,LRAA,0))<1 39 . . D STWLN,ST2,^LRWLST11,EN^LA7ADL(LRUID),SICA^LRWLST11 40 Q 41 ; 42 ; 43 STWLN ; Set accession number 44 ; 45 D GETLOCK(LRAA,LRAD) 46 D CHECK68(LRAA,LRAD) 47 ; 48 S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) 49 ; 50 ; Handle 'in common' area that was not setup in GTWLN call. 51 I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN)) D SETAN(LRAA,LRAD,LRAN) 52 ; 53 S LREND=0,LRLBLBP=1-$P(LRSS,U,2),LRSS=$P(LRSS,U) 54 S LRACC=$P(^LRO(68,LRAA,0),U,11)_" "_$S(LRAD["0000":$E(LRAD,2,3),1:$E(LRAD,4,7))_" "_LRAN 55 ; 56 S LRPRAC="" 57 I $D(^LRO(69,LRODT,1,LRSN,0)) S LRPRAC=$P(^(0),U,6) S:$D(LRNT) ^(3)=LRNT 58 ; 59 ; Location type 60 S LRCAPLOC=$P($G(^SC(+LROLLOC,0)),U,3) 61 I LRCAPLOC="" S LRCAPLOC="Z" 62 ; 63 ; File information in file #68 for this accession 64 N FDA,LR6802,LRDIE 65 S LR6802=LRAN_","_LRAD_","_LRAA_"," 66 S FDA(1,68.02,LR6802,.01)=LRDFN 67 S FDA(1,68.02,LR6802,1)=LRDPF 68 S FDA(1,68.02,LR6802,2)=LRAD 69 S FDA(1,68.02,LR6802,3)=LRODT 70 S FDA(1,68.02,LR6802,4)=LRSN 71 S FDA(1,68.02,LR6802,6)=LRLLOC 72 S X=$G(^LRO(69,LRODT,1,LRSN,.1)) I X'="" S FDA(1,68.02,LR6802,14)=X 73 ; 74 ; No ordering provider/location on controls 75 I LRDPF'=62.3 D 76 . S FDA(1,68.02,LR6802,6.5)=LRPRAC 77 . S FDA(1,68.02,LR6802,94)=LROLLOC 78 ; 79 ; Only store treating specialty on file #2 patients 80 ; If no treating specialty then use specialty from file #44 location 81 I LRDPF=2 D 82 . S LRTREA=$P($G(^DPT(DFN,.103)),U) 83 . I 'LRTREA S LRTREA=$P($G(^SC(+LROLLOC,0)),U,20) 84 . I LRTREA S FDA(1,68.02,LR6802,6.6)=LRTREA 85 ; 86 S FDA(1,68.02,LR6802,6.7)=DUZ 87 S FDA(1,68.02,LR6802,15)=LRACC 88 S FDA(1,68.02,LR6802,26)=DUZ(2) 89 S FDA(1,68.02,LR6802,92)=LRCAPLOC 90 ; 91 D FILE^DIE("","FDA(1)","LRDIE(1)") 92 I $D(LRDIE(1)) D MAILALRT 93 ; 94 ; If specimen defined then set nodes, force to ien=1 since many lab 95 ; routines expect the specimen to be record number 1. 96 I $G(LRSPEC) D 97 . N FDAIEN 98 . S FDAIEN(1)=1 99 . S FDA(2,68.05,"+1,"_LR6802,.01)=LRSPEC 100 . S FDA(2,68.05,"+1,"_LR6802,1)=$P(LRSAMP,";",1) 101 . D UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)") 102 . I $D(LRDIE(2)) D MAILALRT 103 ; 104 ; If no specimen defined then use specimen values from file #69. 105 I $G(LRSPEC)="",$D(^LRO(69,LRODT,1,LRSN,4,0)) D 106 . N FDA,FDAIEN,LRI,LRX 107 . S LRI=0 108 . F S LRI=$O(^LRO(69,LRODT,1,LRSN,4,LRI)) Q:'LRI D 109 . . S FDAIEN(1)=LRI,LRX=$G(^LRO(69,LRODT,1,LRSN,4,LRI,0)) 110 . . S FDA(LRI,68.05,"+1,"_LR6802,.01)=$P(LRX,"^") 111 . . D UPDATE^DIE("","FDA(LRI)","FDAIEN","LRDIE(LRI)") 112 . . I $D(LRDIE(LRI)) D MAILALRT 113 ; 114 ; Create UID. 115 S LRUID=$$LRUID^LRX(LRAA,LRAD,LRAN) 116 ; 117 I '$D(LRPHSET),('$G(LRQUIET)) W !!,"ACCESSION: ",LRACC," <",LRUID,">" 118 ; 119 D UPD696 120 ; 121 L -^LRO(68,LRAA,1,LRAD,1,0) 122 Q 123 ; 124 ; 125 UPD696 ; Update file #69.6 if LEDI referral patient and no existing entry 126 K LR696IEN 127 I $G(LRORDRR)="R" D 128 . S LR696IEN=0 129 . I $G(LRRSITE("SMID"))'="",$G(LRSD("RUID"))'="" S LR696IEN=+$O(^LRO(69.6,"AD",LRRSITE("SMID"),LRSD("RUID"),0)) 130 . I LR696IEN Q 131 . I '$G(LRRSTAT(0)) S LRRSTAT(0)=$$FIND1^DIC(64.061,"","OMX","Specimen in process","","I $P(^LAB(64.061,Y,0),U,7)=""U""") 132 . D PSET^LRPEND(SSN(2),+LRRSITE("RSITE"),LRSD("RUID"),+LRSD("RPSITE"),LRSPEC,LRSAMP,LRRSTAT(0),LRODT,$P(LRCDT,U),LRRSITE("SDT"),LRNT,.LROT) 133 Q 134 ; 135 ; 136 ST2 ; Find next available node in LR global 137 ; 138 N FDA,FDAIEN,LRDIE,LRX,LRXIDT 139 ; 140 ; Autopsy ("AU") is not a mulitple - do not attempt to set in ^LR global 141 I LRSS="AU" S LRIDT=0 Q 142 ; 143 S LRIDT=0 144 F D Q:LRIDT 145 . S LRXIDT=9999999-LRCDT 146 . L +^LR(LRDFN,LRSS,LRXIDT,0):5 147 . I '$T S LRCDT=$$FMADD^XLFDT(LRCDT,0,0,0,1) Q 148 . I '$D(^LR(LRDFN,LRSS,LRXIDT,0)) S LRIDT=LRXIDT Q 149 . L -^LR(LRDFN,LRSS,LRXIDT,0) 150 . S LRCDT=$$FMADD^XLFDT(LRCDT,0,0,0,1) 151 ; 152 ; Create entry in appropriate subscript in LAB DATA file (#63). 153 S LRX=$S(LRSS="CH":63.04,LRSS="MI":63.05,LRSS="BB":63.01,LRSS="SP":63.08,LRSS="CY":63.09,LRSS="EM":63.02,1:0) 154 S FDAIEN(1)=LRIDT 155 S FDA(63,LRX,"+1,"_LRDFN_",",.01)=LRCDT 156 S FDA(63,LRX,"+1,"_LRDFN_",",.06)=LRACC 157 I LRSS'="CH" S FDA(63,LRX,"+1,"_LRDFN_",",.1)=LRNT 158 I LRSS="CH" S FDA(63,LRX,"+1,"_LRDFN_",",.12)=3 159 I LRSS="MI" S FDA(63,LRX,"+1,"_LRDFN_",",38)=3 160 I LRX D UPDATE^DIE("","FDA(63)","FDAIEN","LRDIE(63)") 161 I $D(LRDIE(63)) D MAILALRT 162 ; 163 ; Uncomment following code when new field .9 in"MI" subscript is released 164 ;I LRSS="MI" D 165 ;. N LRN,ERR,IENS 166 ;. S IENS=LRIDT_","_LRDFN_",",LRN=0 167 ;. F S LRN=$O(^LRO(69,LRODT,1,LRSN,2,LRN)) Q:LRN<1 D 168 ;. . I '$D(^LRO(69,LRODT,1,LRSN,2,LRN,1,0)) Q 169 ;. . D WP^DIE(63.05,IENS,.9,"A","^LRO(69,"_LRODT_",1,"_LRSN_",2,"_LRN_",1)","ERR") 170 ; 171 L -^LR(LRDFN,LRSS,LRIDT,0) 172 ; 173 Q 174 ; 175 ; 176 GTWLN ; 177 N X 178 ; 179 ; Execute accession transform for this area. 180 S LRAN=0 181 S X=$G(^LRO(68,LRWLC,.1)) X:X'="" X 182 ; 183 D GETLOCK(LRWLC,LRAD) 184 D CHECK68(LRWLC,LRAD) 185 ; 186 S:'LRAN LRAN=1+$P($G(^LRO(68,LRWLC,1,LRAD,1,0)),U,3) 187 ; 188 I "CYEMSP"'[LRSS F Q:'$D(^LRO(68,LRWLC,1,LRAD,1,LRAN)) S LRAN=LRAN+1 189 ; 190 ; check for AP Accessions 191 I "CYEMSP"[LRSS F Q:'$D(^LRO(68,LRWLC,1,LRAD,1,LRAN))&'$D(^LR("A"_LRSS_"A",$E(LRAD,1,3),LRAN)) S LRAN=LRAN+1 192 ; 193 I '$D(LRPHSET),$D(LRNCWL)!$P(^LAB(69.9,1,0),U,8) D ASK Q:LREND 194 ; 195 D SETAN(LRWLC,LRAD,LRAN) 196 ; 197 L -^LRO(68,LRWLC,1,LRAD,1,0) 198 Q 199 ; 200 ; 201 ASK ; 202 ; Don't ask if tasked or a "silent" call 203 I $D(ZTQUEUED)!($G(LRQUIET)) Q 204 ; 205 N DIR,DIROUT,DIRUT,DTOUT,DUOUT,LROK,LRANX,X,Y 206 S LROK=0 207 F D Q:LREND!(LROK) 208 . K DIR 209 . S DIR(0)="NO^1:"_$S($P(LRLABKY,U,2):999999,1:LRAN)_":0" 210 . S DIR("A")="Force to",DIR("B")=LRAN 211 . D ^DIR 212 . I $D(DIRUT) S LREND=1 Q 213 . S LRANX=Y 214 . I LRANX<+$P($G(^LRO(68,LRWLC,1,LRAD,1,0)),U,3) D 215 . . W !,"This accession number may be already assigned either in this " 216 . . W !,"area or a common accession area." 217 . I $D(^LRO(68,LRWLC,1,LRAD,1,LRANX,0)) D Q:'LROK 218 . . N LRDFNX S LRDFNX=LRDFN 219 . . N DFN,LRDFN,LRDPF,PNM,SSN 220 . . S LRDFN=+^LRO(68,LRWLC,1,LRAD,1,LRANX,0),LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^LR(LRDFN,0),U,3) 221 . . D PT^LRX 222 . . W !,"THIS NUMBER BELONGS TO ",!,PNM," SSN: ",SSN 223 . . D INF^LRX 224 . . I LRDFN=LRDFNX S LROK=1 225 . K DIR 226 . S DIR(0)="YO",DIR("A")="Are you sure",DIR("B")="NO" 227 . D ^DIR 228 . I $D(DIRUT) S LREND=1 Q 229 . I Y=1 S LRAN=LRANX,LROK=1 230 ; 231 ; Unlock if aborting. 232 I LREND L -^LRO(68,LRWLC,1,LRAD,1,0) 233 ; 234 Q 235 ; 236 ; 237 CHECK68(LRAA,LRAD) ; Check for/set header node of ^LRO(68) 68.01 subfile. 238 ; 239 ; Call with LRAA = ien of entry in file #68 240 ; LRAD = accession date in fileman format 241 ; 242 ; Set accession date in file #68 for this acession. 243 ; Check for existence of accession number multiple but not accession date multiple, 244 ; FileMan DBS call fails when accession number multiple exists but accession date multiple does not. 245 ; If this condition found then set missing node directly and quit. 246 ; 247 I '$D(^LRO(68,LRAA,1,LRAD,0)) D 248 . N FDA,FDAIEN,LRDIE,X 249 . S X=$Q(^LRO(68,LRAA,1,LRAD,0)) 250 . I X'="",$QS(X,4)=LRAD S $P(^LRO(68,LRAA,1,LRAD,0),"^")=LRAD Q 251 . S (FDAIEN(1),FDA(1,68.01,"+1,"_LRAA_",",.01))=LRAD 252 . D UPDATE^DIE("","FDA(1)","FDAIEN","LRDIE(1)") 253 . I $D(LRDIE(1)) D MAILALRT 254 ; 255 Q 256 ; 257 ; 258 GETLOCK(LRAA,LRAD) ; Obtain lock on zeroth node of this accession date 259 ; Call with LRAA = ien of entry in file #68 260 ; LRAD = accession date in fileman format 261 ; 262 F L +^LRO(68,LRAA,1,LRAD,1,0):10 Q:$T D 263 . I $D(ZTQUEUED)!($G(LRQUIET)) Q 264 . W !!?5,"Accession area ",$P(^LRO(68,LRAA,0),"^")," is locked by another user.",!,$C(7) 265 Q 266 ; 267 ; 268 SETAN(LRAA,LRAD,LRAN) ; Create stub entry in file #68 for this acession. 269 ; 270 ; Call with LRAA = ien of entry in file #68 271 ; LRAD = accession date in fileman format 272 ; LRAN = accession number 273 ; 274 N FDA,FDAIEN,LR6802,LRDIE 275 ; 276 S LR6802=LRAD_","_LRAA_"," 277 S FDAIEN(1)=LRAN 278 S FDA(2,68.02,"+1,"_LR6802,.01)=LRDFN 279 D UPDATE^DIE("","FDA(2)","FDAIEN","LRDIE(2)") 280 I $D(LRDIE(2)) D MAILALRT 281 Q 282 ; 283 ; 284 MAILALRT ; Send mail message alert when FileMan DBS errors returned 285 ; 286 N J,LR68,LRCNT,LRMTXT,X,XMINSTR,XMSUB,XMTO 287 ; 288 I $D(^LRO(68,LRAA,1,LRAD,1,LRAN)) M LR68=^LRO(68,LRAA,1,LRAD,1,LRAN) 289 ; 290 S LRMTXT(1)="The following debugging information is provided to assist" 291 S LRMTXT(2)="support staff in resolving error during accessioning." 292 S LRMTXT(3)=" " 293 S LRCNT=3 294 ; 295 F J="FDA","FDAIEN","LR68","LRAA","LRAD","LRAN","LRDFN","LRDIE","LRSS","LRTSTS","LRUNQ","LRWLC","XQY","XQY0" D 296 . S X=$G(@J) 297 . I X'="" S LRCNT=LRCNT+1,LRMTXT(LRCNT)=J_"="_X 298 . F S J=$Q(@J) Q:J="" S LRCNT=LRCNT+1,LRMTXT(LRCNT)=J_"="_@J 299 ; 300 S XMSUB="FileMan DBS call failed during accessioning in routine LRWLST1" 301 S XMTO("G.LMI")="" 302 S XMINSTR("FROM")=.5 303 S XMINSTR("ADDR FLAGS")="R" 304 D SENDMSG^XMXAPI(DUZ,XMSUB,"LRMTXT",.XMTO,.XMINSTR) 305 Q -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRWLST11.m
r613 r623 1 LRWLST11 2 ;;5.2;LAB SERVICE;**121,128,153,202,286,331,375**;Sep 27, 1994;Build 3 3 4 ST21 5 6 7 8 9 10 11 COMMON 12 13 14 . I 'LRUNQ,$D(LRTSTS(LRWLC,LRUNQ,LRWLC)) Q15 16 17 18 19 20 21 22 23 24 25 26 27 28 SCDT 29 30 31 32 33 34 35 36 37 38 39 40 SLRSS 41 42 43 44 45 46 47 48 49 50 51 52 53 ST3 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 ST4 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 ST5 87 88 89 90 91 92 SET 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 RUID 126 127 128 129 130 131 132 133 134 % 135 136 137 LRCCOM 138 139 140 141 142 143 144 145 146 147 Z 148 149 Z1 150 151 152 153 154 155 156 157 158 ORUT 159 160 161 162 163 164 165 166 167 168 169 ORUT2 170 171 172 173 174 175 176 177 178 179 180 181 182 183 SICA 184 185 186 187 188 189 190 191 1 LRWLST11 ;DALOI/CJS,RWF/FHS - ACCESSION SETUP ;July 19, 2006 2 ;;5.2;LAB SERVICE;**121,128,153,202,286,331**;Sep 27, 1994;Build 7 3 ; 4 ST21 ; 5 S LRTS="",LRIX=0 6 F S LRIX=$O(LRTSTS(LRWLC,LRUNQ,LRAA,LRIX)) Q:LRIX<1 D SET Q:LRUNQ 7 ; 8 S LRNT=$$NOW^XLFDT 9 D SCDT,SLRSS 10 ; 11 COMMON ; Setup 'in common' accession if not already setup unless it will be 12 ; when tests are acessioned to the 'in common' area. 13 I +LRWLC,+LRWLC'=+LRAA,$G(^LRO(68,LRWLC,1,LRAD,1,LRAN,0))=$G(LRDFN) D 14 . I $D(LRTSTS(LRWLC,LRUNQ,LRWLC)) Q 15 . Q:$G(^LRO(68,LRWLC,1,LRAD,1,LRAN,.1)) 16 . N LRAA,LRACC,LRCDTX,LRCOMMON,LREND,LRIDT,LRNODE3,LRORDRR,LRORU3,LRQUIET,LRTJ,LRUID,X,Y 17 . S (LRQUIET,LRCOMMON)=1,LRAA=+LRWLC,LRORDRR="" 18 . S X=LRSS,LRCDTX=LRCDT 19 . N LRCDT,LRSS 20 . S LRCDT=LRCDTX,LRSS=X_U_(1+$G(LRLBLBP)) 21 . D STWLN^LRWLST1 Q:$G(LREND) 22 . D ST2^LRWLST1 Q:$G(LREND) 23 . D SCDT,SLRSS 24 ; 25 Q 26 ; 27 ; 28 SCDT ; Set collection, inverse and lab arrival date/times on accession 29 N FDA,LR6802,LRDIE 30 S LR6802=LRAN_","_LRAD_","_LRAA_"," 31 S FDA(4,68.02,LR6802,9)=LRCDT 32 S FDA(4,68.02,LR6802,10)=LREAL 33 I '$D(LRPHSET) S FDA(4,68.02,LR6802,12)=LRNT 34 S FDA(4,68.02,LR6802,13.5)=LRIDT 35 D FILE^DIE("","FDA(4)","LRDIE(4)") 36 I $D(LRDIE(4)) D MAILALRT^LRWLST1 37 Q 38 ; 39 ; 40 SLRSS ; 41 ; 42 S X=$G(^LRO(68,LRAA,1,LRAD,1,LRAN,5,1,0)) ; change for AP 43 S H8=$S($D(LRSPEC):LRSPEC,1:X)_U_$S("CYEMSPAU"[LRSS:LRACC,1:LRACC)_U_$S(LRSS="MI":LRPRAC,1:"")_U_$S(LRSS="MI":LRLLOC,1:"")_"^^"_$S(LRSS="CH":LRPRAC,1:"")_"^"_$S(LRSS="MI":$P(LRSAMP,";",1),LRSS="CH":LRLLOC,1:"") 44 ; 45 I $S(LRSS="CH":1,LRSS="MI":1,1:0) D 46 . I $G(LRORDRR)="R",+$G(LRRSITE("RSITE")) S $P(H8,U,9)=+LRRSITE("RSITE")_";DIC(4," 47 . I $G(LROLLOC),$G(LRORDRR)'="R" S $P(H8,U,9)=LROLLOC_";SC(" 48 . S $P(H8,U,10)=$S($G(LRDUZ(2)):LRDUZ(2),1:$G(DUZ(2))) 49 ; 50 S ^LR(LRDFN,LRSS,LRIDT,0)=LRCDT_U_LREAL_"^^^"_H8 51 I $G(LRORU3)'="" S ^LR(LRDFN,LRSS,LRIDT,"ORU")=LRORU3 52 ; 53 ST3 D ST4:(LRSS="MI"),LRCCOM 54 ; 55 S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3),LRPR=1 56 S LRRB=0 57 I LRDPF=2 S LRRB=$$GET1^DIQ(2,DFN_",",.101),LRRB=$S(LRRB'="":LRRB,1:0) 58 ; 59 Q:$G(LRORDR)="P" 60 ; 61 I '$D(LRTJ) D Q 62 . I $G(LRORDRR)="R",LRSS="CH",$G(LRORU3)'="",$P(LRORU3,"^")'=$P(LRORU3,"^",4) Q ; Don't print, use label from sending facility. 63 . I LRLBLBP,'$G(LRCOMMON) S LRLBL(LRAA,LRAN)=LRSN_U_LRAD_U_LRODT_U_LRRB_U_LRLLOC_U_LRACC_U_$S($D(LRORD):LRORD,1:"") 64 S I=0 65 F S I=$O(^LRO(68,LRAA,1,LRAD,1,LRAN,4,I)) Q:I<.5 S LRTS=^(I,0) D Z 66 Q 67 ; 68 ; 69 ST4 ; 70 S $P(^LR(LRDFN,LRSS,LRIDT,0),U,10)=$S($D(LRNT):LRNT,1:""),$P(^(0),U,8)=LRLLOC 71 ; Used to be LRSPCDSC,63.05,.9 (Word Processing field) replaces 63.05,.99 72 S:$D(LRCCOM) ^LR(LRDFN,LRSS,LRIDT,99)=LRCCOM 73 I '$D(LRPHSET) D 74 . N DA,DIE,DR 75 . S DIE="^LR("_LRDFN_",""MI"",",DA=LRIDT,DA(1)=LRDFN 76 . ;S DR=.9 77 . ;I '$G(LRQUIET) W:DR'=.9 !!,"Order comment:" 78 . S DR=.99_$S($L($G(LRGCOM)):"///"_LRGCOM,$L($G(LRCCOM)):"//"_LRCCOM,1:"") 79 . I '$G(LRQUIET) W:DR'=.99 !!,"Order comment:" 80 . D ^DIE 81 I '$G(LRQUIET),'$D(LRPHSET),'$D(LRGCOM) W !,"Description OK? Y//" D % G ST4:%["N" 82 K DR,DIC,DIE 83 Q 84 ; 85 ; 86 ST5 S I("SUBSC")=$S(I("EDIT")[11.5:26,I("EDIT")[15:27,I("EDIT")[19:28,I("EDIT")[23:29,I("EDIT")[34:30,1:-1) Q:I("SUBSC")=-1 87 S I("PNTR")=$S(I("EDIT")[11.5:"^63.061A^",I("EDIT")[15:"^63.361A^",I("EDIT")[19:"^63.111A^",I("EDIT")[23:"^63.181A^",1:"^63.432A^") 88 S I("N")=1+$S($D(^LR(LRDFN,"MI",LRIDT,I("SUBSC"),0)):$P(^(0),U,4),1:0),^(0)=I("PNTR")_I("N")_U_I("N"),^(I("N"),0)=I("TEST") 89 Q 90 ; 91 ; 92 SET S LRTS=LRTSTS(LRWLC,LRUNQ,LRAA,LRIX),LRIN=$P(LRTS,U,3),LRORIFN=$P(LRTS,U,4),LRTSORU=+$P(LRTS,U,6),LRTS=$P(LRTS,U,1,2),LRBACK=$P(LRTS,U,5) 93 ; 94 I '$G(LRQUIET),'$D(LRPHSET) D 95 . W !,$P(^LAB(60,+LRTS,0),U) 96 . I $D(LRSPEC),LRSPEC D 97 . . S I=$S($D(^LAB(61,+LRSPEC,0)):$P(^(0),U),1:""),J=$S($D(^LAB(62,+LRSAMP,0)):$P(^(0),U),1:"") 98 . . W ?30,J W:I'=J " ",I 99 ; 100 I '$G(LRQUIET),'$D(LRPHSET),+LRTS,$O(^LAB(60,+LRTS,7,0))>0 D 101 . N S 102 . S DIC="^LAB(60,",DA=+LRTS,DR=7 103 . D EN^DIQ H 3 104 I '$G(LRQUIET),'$D(LRPHSET),+LRTS D 105 . N S 106 . S DIC="^LAB(60,"_(+LRTS)_",3," 107 . S DA=+$O(^LAB(60,+LRTS,3,"B",+LRSAMP,0)),DR=2 108 . I DA>0,$O(^LAB(60,+LRTS,3,DA,2,0))>0 D EN^DIQ H 3 109 ; 110 D ORUT 111 D CAP^LRWLST12 112 K LRTSTS(LRWLC,LRUNQ,LRAA,LRIX) 113 ; 114 S ^LRO(69,LRODT,1,LRSN,2,LRIN,0)=LRTS_U_LRAD_U_LRAA_U_LRAN_"^^"_LRORIFN_"^^IP^L^^^^"_LRBACK 115 S ^LRO(69,LRODT,1,LRSN,2,"B",+LRTS,LRIN)="" 116 ; 117 ; When file 63 is enhanced to accept comments per test comments should 118 ; be put there instead of field 99. 119 I $O(^LRO(69,LRODT,1,LRSN,2,LRIN,1,0)) D 120 . I LRSS'="CH"!($D(^LR(LRDFN,LRSS,LRIDT,0))[0) Q 121 . S X=$S($D(^LR(LRDFN,LRSS,LRIDT,1,0)):$P(^(0),"^",3),1:0),I=0 122 . F S I=$O(^LRO(69,LRODT,1,LRSN,2,LRIN,1,I)) Q:I<1 S II=^(I,0) S X=X+1,^LR(LRDFN,LRSS,LRIDT,1,X,0)=II 123 . S:X ^LR(LRDFN,LRSS,LRIDT,1,0)="^63.041^"_X_U_X 124 ; 125 RUID I $G(LRORU3)'="" D 126 . N DA,DIE,DIC,DLAYGO,DR,X,Y 127 . S DLAYGO=69 128 . S DA=LRIN,DA(1)=LRSN,DA(2)=LRODT,DIC="^LRO(69,"_DA(2)_",1,"_DA(1)_",2," 129 . S DIE=DIC,DR="13////"_$P(LRORU3,U)_";14////"_$P(LRORU3,U,2)_";15////"_$P(LRORU3,U,3)_";16////"_$P(LRORU3,U,4)_";17////"_$P(LRORU3,U,5) 130 . D ^DIE 131 Q 132 ; 133 ; 134 % R %:DTIME Q:%=""!(%["N")!(%["Y") W !,"Answer 'Y' or 'N': " G % 135 ; 136 ; 137 LRCCOM ; 138 N I,LRCCOM,LRTN,X 139 S (I,LRTN,LRCCOM)=0 Q:LRSS'="CH"!($D(^LR(LRDFN,LRSS,LRIDT,0))[0) 140 F S I=$O(^LRO(69,LRODT,1,LRSN,6,I)) Q:I<1 I $D(^(I,0)) S X=^(0),LRCCOM=LRCCOM+1,^LR(LRDFN,LRSS,LRIDT,1,LRCCOM,0)=X 141 F S LRTN=$O(^LRO(69,LRODT,1,LRSN,2,LRTN)) Q:'LRTN I $D(^(LRTN,0)) S X=^(0) I $P(X,"^",8),'$P(X,"^",3),$O(^(1,0)) D ;Get comments for expanded panels 142 . S I=0 F S I=$O(^LRO(69,LRODT,1,LRSN,2,LRTN,1,I)) Q:'I I $D(^(I,0)) S X=^(0),LRCCOM=LRCCOM+1,^LR(LRDFN,LRSS,LRIDT,1,LRCCOM,0)=X 143 S:LRCCOM ^LR(LRDFN,LRSS,LRIDT,1,0)="^63.041^"_LRCCOM_U_LRCCOM 144 Q 145 ; 146 ; 147 Z L +^LRO(69.1,LRTE) 148 S LRZ3=$S($D(^LRO(69.1,LRTE,1,0)):$P(^(0),U,3),1:0) 149 Z1 S LRZ3=LRZ3+1 G:$D(^LRO(69.1,LRTE,1,LRZ3)) Z1 150 S LRZO="^LRO(69.1,"_LRTE_",1,",LRZ1="69.11P",LRZB=+LRTS,LRIFN=LRZ3 151 D Z^LRWU 152 S ^LRO(69.1,LRTE,1,LRIFN,0)=+LRTS_"^"_LRLLOC_"^"_LRRB_"^"_LRDFN_"^"_LRSN_"^"_LRTJ_"^"_LRAD_"^"_LRAA_"^"_LRAN_"^"_+LROLLOC 153 S ^LRO(69.1,"LRPH",LRTE,LRLLOC,LRRB,LRDFN,LRSN)=LRTJ_"^"_LRAD_"^"_LRIFN,^(LRSN,LRAA,LRAN,+LRTS)=+LRTS 154 L -^LRO(69.1,LRTE) 155 Q 156 ; 157 ; 158 ORUT Q:'$G(LRTSORU)!($G(LRSS)'="CH") 159 N LRTT,DLAYGO,DIC,DIE,DR,LRTST,DA,LRURG 160 S DA=LRIDT,DA(1)=LRDFN 161 S LRNLT=$$NLT^LRVER1(+LRTSORU) Q:+LRNLT<1 Q:$D(^LR(DA(1),LRSS,DA,"ORUT","B",LRNLT)) 162 S DR=".35///^S X=LRNLT",DR(1)=".35" 163 S DR(1,63.04)=".35///^S X=LRNLT" 164 S DR(1,63.07)=".01///^S X=LRNLT" 165 S DIC="^LR("_DA(1)_","""_LRSS_"""," 166 S DIC(0)="MNL",DIE=DIC W:$G(LRDBUG) !,LRNLT 167 D ^DIE 168 ; 169 ORUT2 S LRTST=$P($G(^LAM($O(^LAM("E",LRNLT,0)),0)),U) Q:LRTST=""!('$G(LR696IEN)) 170 Q:'($D(^LRO(69.6,LR696IEN,0))#2)!($D(^LRO(69.6,LR696IEN,2,"C",LRNLT))) 171 S:'$D(^LRO(69.6,LR696IEN,2,0)) ^(0)="^69.64A^" 172 S DLAYGO=69.6 173 K DIC,DIE,DA,DR,DA 174 S DA=LR696IEN 175 S LRURG="R",LRURG=$S($L($P($G(^LAB(62.05,+$P(LRTS,U,2),0)),U,4)):$P(^(0),U,4),1:LRURG) 176 S (DIE,DIC)="^LRO(69.6,",DIC(0)="LM" 177 S DR=20_"///"_LRTST_";",DR(1,69.6)="20///"_LRTST_";" 178 S DR(2,69.64)=".01///"_LRTST_";1///"_LRNLT_";4///"_LRURG_";5////160;8///"_LRNT_";9///"_LRUID 179 D ^DIE 180 Q 181 ; 182 ; 183 SICA ; Check accessions 'in common' and setup reference to this accession 184 N FDA,LR6802,LRDIE,LRAA 185 S LRX=$P($G(^LRO(68,LRWLC,1,LRAD,1,LRAN,.2)),"^"),LRAA=0 186 F S LRAA=$O(LRTSTS(LRWLC,LRUNQ,LRAA)) Q:LRAA<1 I LRWLC'=LRAA D 187 . S LR6802=LRAN_","_LRAD_","_LRAA_"," 188 . S FDA(5,68.02,LR6802,15.1)=LRX 189 . D FILE^DIE("","FDA(5)","LRDIE(5)") 190 . I $D(LRDIE(5)) D MAILALRT^LRWLST1 191 Q -
WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRWOMEN.m
r613 r623 1 LRWOMEN ;DALOI/CYM/FT/CKA -LINK TO WOMEN'S HEALTH PROGRAM ;10/22/04 13:142 ;;5.2;LAB SERVICE;**231,248,311,324,365**;Sep 27, 1994;Build 9 3 4 5 6 ;Reference to CREATE^WVLABCHK supported by IA #4525 7 ; 8 ADD ; From DD 63.08,.11 and 63.09,.11 9 Q:+$G(LRDPF)'=2 10 Q:'$D(LRSS) 11 Q:$P(^LR(LRDFN,LRSS,LRI,0),U,11)']"" 12 Q:$G(SEX)'["F" 13 Q:$T(CREATE^WVLRLINK)']"" 14 D CREATE^WVLRLINK(DFN,LRDFN,LRI,$G(LRA),LRSS) 15 Q 16 ; 17 ; 18 DEL ; From LRAPM 19 Q:$G(SEX)'["F"20 Q:+$G(LRDPF)'=2 21 Q:'$D(LRSS) 22 Q:$P(^LR(LRDFN,LRSS,LRI,0),U,11)]"" 23 Q:$T(DELETE^WVLRLINK)']""24 D DELETE^WVLRLINK(DFN,LRDFN,LRI,X,LRSS) 25 Q 26 ; 27 ; 28 MOVE ; From LRAPMV 29 ; no longer used after LR*5.2*259 30 Q 31 ; 32 ; 33 SNOMED 34 35 36 37 38 39 40 1 LRWOMEN ;DALOI/CYM/FT - LINK TO WOMEN'S HEALTH PROGRAM ;10/22/04 13:14 2 ;;5.2;LAB SERVICE;**231,248,311,324**;Sep 27, 1994 3 ; 4 ;Reference to CREATE^WVLRLINK supported by IA #2772 5 ;Reference to DELETE^WVLRLINK supported by IA #2772 6 ;Reference to MOVE^WVLRLINK supported by IA #2772 7 ;Reference to ^XPDUTL supported by IA #10141 8 ;Reference to ^ORB3LAB supported by IA #4287 9 ;Reference to CREATE^WVLABCHK supported by IA #4525 10 ; 11 ADD ; From DD 63.08,.11 and 63.09,.11 12 Q:+$G(LRDPF)'=2 13 Q:'$D(LRSS) 14 Q:$P(^LR(LRDFN,LRSS,LRI,0),U,11)']"" 15 I $$PATCH^XPDUTL("OR*3.0*210") D 16 .Q:$G(LRAPOLDF)=1 17 .D LAB^ORB3LAB(DFN,LRDFN,LRI,$G(LRA),LRSS) 18 Q:$G(SEX)'["F" 19 Q:$T(CREATE^WVLRLINK)']"" 20 D CREATE^WVLRLINK(DFN,LRDFN,LRI,$G(LRA),LRSS) 21 Q 22 DEL ; From LRAPM 23 Q:$G(SEX)'["F" 24 Q:+$G(LRDPF)'=2 25 Q:'$D(LRSS) 26 Q:$P(^LR(LRDFN,LRSS,LRI,0),U,11)]"" 27 Q:$T(DELETE^WVLRLINK)']"" 28 D DELETE^WVLRLINK(DFN,LRDFN,LRI,X,LRSS) 29 Q 30 MOVE ; From LRAPMV 31 ; no longer used after LR*5.2*259 32 Q 33 SNOMED ; From DD 63.08,10 and 63.09,10 34 Q:+$G(LRDPF)'=2 35 Q:'$D(LRSS) 36 Q:$P(^LR(LRDFN,LRSS,LRI,0),U,11)="" 37 Q:$G(SEX)'["F" 38 Q:$T(CREATE^WVLABCHK)']"" 39 D CREATE^WVLABCHK(DFN,LRDFN,LRI,$G(LRA),LRSS) 40 Q
Note:
See TracChangeset
for help on using the changeset viewer.