source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRLNCPMP.m@ 1437

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

initial load of WorldVistAEHR

File size: 4.2 KB
RevLine 
[613]1LRLNCPMP ;DALOI/FHS - PRINT LAB TESTS MAPPED/NOT MAPPED TO LOINC CODES ;1-OCT-1998
2 ;;5.2;LAB SERVICE;**215,232,278,303**;Sep 27,1994
3EN ;
4 W @IOF K LRMAP,LREND
5 W !,$$CJ^XLFSTR("This option prints a list of the LABORATORY TESTS from the LABORATORY TEST FILE.",IOM)
6 W !,$$CJ^XLFSTR("You will be prompted to print lab tests that are",IOM)
7 W !,$$CJ^XLFSTR("mapped/not mapped to a LOINC code.",IOM)
8 W !,$$CJ^XLFSTR("Inactive(Type:Neither) lab tests are not reported.",IOM)
9WHICH ;
10 W !!!,"Print lab tests that are mapped/not mapped to a LOINC code."
11 K DIR,LRMAP
12 S DIR("?")="Select 1 for mapped, 0 for not mapped or 2 for Individual"
13 S DIR(0)="SO^0:Not Mapped;1:Mapped test;2:Individual Mapped Test"
14 D ^DIR K DIR
15 I Y=""!($D(DIRUT)) D EXIT Q
16 S LRMAP=Y
17 D:+Y=2 SING G:$G(LREND) EXIT
18 K %ZIS S %ZIS="Q" D ^%ZIS G:POP EXIT
19 I $D(IO("Q")) D QUE Q
20 ;
21 U IO
22 D START,^%ZISC
23 Q
24 ;
25 ;
26SING ; Select individual lab test for report
27 I LRMAP=2 D
28 . K LRMAP
29 . S LREND=0,LRMAP=2
30 . W !,$$CJ^XLFSTR("You can only select test that have been mapped.",IOM)
31 . W !,$$CJ^XLFSTR("You can a quick list of mapped tests by entering '?'.",IOM)
32 . W !,$$CJ^XLFSTR("Then enter 'Yes' you want a complete list.",IOM),!
33 . K DIR,X,Y
34 . S DIR(0)="PO^60:EZNMQ"
35 . S DIR("S")="I $S($D(^LAM(""AL"",+Y)):1,$D(^LAM(""AM"",+Y)):1,1:0)"
36 . S DIR("?")="You must select a Mapped LABORATORY TEST"
37 . F D ^DIR Q:Y<1!($D(DIRUT)) S LRMAP(+Y)=Y
38 . I '$O(LRMAP(0)) W !!?5,"Nothing Selected" S LREND=1
39 Q
40QUE ;
41 S ZTRTN="START^LRLNCPMP"
42 S ZTDESC="LAB TESTS MAP REPORT",ZTSAVE("LRMAP*")=""
43 D ^%ZTLOAD
44 I $D(ZTSK)'[0 W !,"REQUEST QUEUED ",ION
45 D HOME^%ZIS
46 K IO("Q")
47 Q
48 ;
49 ;
50START ; Begins report
51 N LINE,LOINCDTA,LOINCDTB,LOINCTAS,LRAA,LRAA1,LRPNTA,LRPNTB,LRSUB
52 S LINE=0
53 D INI
54 I LRMAP'=2 D EN1
55 I LRMAP=2 D
56 . S LRIEN=0
57 . F S LRIEN=$O(LRMAP(LRIEN)) Q:LRIEN<1 S LRNODE=$G(^LAB(60,LRIEN,0)) D YMAP
58 D YMAPPRT,EXIT
59 Q
60 ;
61 ;
62EN1 ; Print mapped or not mapped lab tests if there is a data name
63 S LRTEST=""
64 S LRTST="^LAB(60,""B"",0)"
65 F S LRTST=$Q(@LRTST) Q:$QS(LRTST,2)'="B" D Q:$G(LREND)
66 . Q:$G(@LRTST)
67 . S LRIEN=$QS(LRTST,4)
68 . Q:'$D(^LAB(60,LRIEN,0))#2 S LRNODE=^(0)
69 . I $S($P(LRNODE,U,3)="":1,$P(LRNODE,U,3)="N":1,'$P($P(LRNODE,U,5),";",2):1,1:0) Q
70 . N LRNLT
71 . S LRNLT=+$P($G(^LAB(60,LRIEN,64)),U,2)
72 . I 'LRMAP,$S(('$D(^LAM("AL",LRIEN))&('$D(^LAM("AM",LRIEN)))):1,1:0) D NMAP
73 . I LRMAP,$S($D(^LAM("AL",LRIEN)):1,$D(^LAM("AM",LRIEN)):1,1:0) D YMAP
74 Q
75 ;
76 ;
77YMAPPRT I $D(^TMP($J,"LRDATA")) D
78 . S LRPRT=0
79 . F S LRPRT=$O(^TMP($J,"LRDATA",LRPRT)) Q:LRPRT="" D Q:$G(LREND)
80 .. I $Y+4>IOSL D HDR Q:$G(LREND)
81 .. W !,^TMP($J,"LRDATA",LRPRT)
82 Q
83 ;
84 ;
85NMAP ;
86 I $Y+4>IOSL D HDR Q:$G(LREND)
87 S LRTESTN=$P(LRNODE,U)
88 W !,?1,LRTESTN
89 S LRNLT=$P($G(^LAB(60,LRIEN,64)),U,2)
90 I LRNLT D
91 . N LROUT
92 . D GETS^DIQ(64,LRNLT_",",".01;1","E","LROUT")
93 . W !?5,$G(LROUT(64,LRNLT_",",1,"E")),?18,$G(LROUT(64,LRNLT_",",.01,"E"))
94 W !
95 Q
96 ;
97 ;
98YMAP ;
99 S LINE=$G(LINE)+1
100 S ^TMP($J,"LRDATA",LINE)="LAB TEST : "_$P(LRNODE,U),LINE=LINE+1
101 S LRSUB="LOCAL REPORT"
102 N LRA,LRNLTX
103 S LRNLT=0
104 F S LRNLT=$O(^LAM("AM",LRIEN,LRNLT)) Q:LRNLT="" I '$D(LRNLTX(LRNLT)) D
105 . S LRA=LRNLT,LRNLTX(LRNLT)=1
106 . D LOINCLA^LRSRVR1
107 S LRNLT=0
108 F S LRNLT=$O(^LAM("AL",LRIEN,LRNLT)) Q:LRNLT="" I '$D(LRNLTX(LRNLT)) D
109 . S LRA=LRNLT,LRNLTX(LRNLT)=1
110 . D LOINCLA^LRSRVR1
111 S LINE=$G(LINE)+1,^TMP($J,"LRDATA",LINE)="-------------------"
112 S LINE=LINE+1,^TMP($J,"LRDATA",LINE)="",LINE=LINE+1
113 Q
114 ;
115 ;
116INI ; Initialize variables
117 K ^TMP($J,"LRDATA")
118 S (LREND,LRPAGE)=0,$P(LRLINE,"=",(IOM-1))=""
119 S LRPDT=$$HTE^XLFDT($H,"MZ")
120 ;
121HDR ; Print heading
122 I LRPAGE,$E(IOST,1,2)="C-" W !,"Press RETURN to continue or '^' to exit: " R N:DTIME S LREND='$T!(N="^") Q:LREND
123 S LRPAGE=LRPAGE+1
124 W @IOF,!?16,"LAB TESTS"_$S(LRMAP=2:" Individual Mapped",LRMAP=1:" Mapped",LRMAP'=1:" NOT Mapped",1:0)_" TO LOINC CODES"
125 W !?5,LRPDT,?(IOM-15)," Page ",$J(LRPAGE,3)
126 I 'LRMAP W !,?5,"LAB TEST"
127 I 'LRMAP W !,?10,"RESULT NLT"
128 W !,LRLINE,!
129 Q
130 ;
131 ;
132EXIT I $E(IOST,1,2)="P-" W @IOF
133 S:$D(ZTQUEUED) ZTREQ="@"
134 Q:$G(LRDBUG)
135 K DIR,DIRUT,LREND,LRPAGE,I,J,LRA,LRLOC,LRIEN,LRPREV,ZTIO,ZTDESC,ZTRTN
136 K LRMAP,LRSPEC,LRTEST,LRTESTN,LRLOINC,LRPDT,LRLINE,LRX,DUOUT,ZTSAVE
137 K LRNLT,LRNLTN,LRNODE,LRPRT,LRSPECN,LRTST,N,Y,POP,ZTSK,ZTQUEUED,ZTREQ
138 K ^TMP($J,"LRDATA")
139 Q
Note: See TracBrowser for help on using the repository browser.