Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BLSLNCPM

BLSLNCPM.m

Go to the documentation of this file.
BLSLNCPM ;DALOI/FHS/TPF - PRINT LAB TESTS MAPPED/NOT MAPPED TO LOINC CODES - THIS IS MODIFIED TO PRINT OUT LOINC TESTS AS DEVELOPED BY CIMARRON FOR LAB PATCH 15
 ;;5.2T9;LR;**1015,1017,1018**;Nov 17, 2004
 ;;5.2;LAB SERVICE;**215,232,278**;Sep 27,1994
EN ;
 W @IOF K LRMAP,LREND
 W !,$$CJ^XLFSTR("This option prints a list of the LABORATORY TESTS from the LABORATORY TEST FILE.",IOM)
 W !,$$CJ^XLFSTR("You will be prompted to print lab tests that are",IOM)
 W !,$$CJ^XLFSTR("mapped/not mapped to a LOINC code.",IOM)
 W !,$$CJ^XLFSTR("Inactive(Type:Neither) lab tests are not reported.",IOM)
WHICH ;
 W !!!,"Print lab tests that are mapped/not mapped to a LOINC code."
 K DIR,LRMAP
 ;S DIR("?")="Select 1 for mapped, 0 for not mapped or 2 for Individual"
 ;S DIR(0)="SO^0:Not Mapped;1:Mapped test;2:Individual Mapped Test" D ^DIR K DIR
 ;----- BEGIN IHS MODIFICATIONS LR*5.2*1018
 S DIR("?")="Select 1 for mapped or 0 for not mapped"
 S DIR(0)="SO^0:Not Mapped;1:Mapped test" D ^DIR K DIR
 I Y=""!($D(DIRUT)) D EXIT Q
 S LRMAP=Y
 D:+Y=2 SING G:$G(LREND) EXIT
 K %ZIS S %ZIS="Q" D ^%ZIS G:POP EXIT
 I $D(IO("Q")) D QUE Q
 U IO D START,^%ZISC Q
SING ; Select individual lab test for report
 I LRMAP=2 D
 . K LRMAP
 . S LREND=0,LRMAP=2
 . W !,$$CJ^XLFSTR("You can only select test that have been mapped.",IOM)
 . W !,$$CJ^XLFSTR("You can a quick list of mapped tests by entering '?'.",IOM)
 . W !,$$CJ^XLFSTR("Then enter 'Yes' you want a complete list.",IOM),!
 . K DIR,X,Y
 . S DIR(0)="PO^60:EZNMQ"
 . S DIR("S")="I $S($D(^LAM(""AL"",+Y)):1,$D(^LAM(""AM"",+Y)):1,1:0)"
 . S DIR("?")="You must select a Mapped LABORATORY TEST"
 . F  D ^DIR Q:Y<1!($D(DIRUT))  S LRMAP(+Y)=Y
 . I '$O(LRMAP(0)) W !!?5,"Nothing Selected" S LREND=1
 Q
QUE ;
 S ZTRTN="START^LRLNCPMP"
 S ZTDESC="LAB TESTS MAP REPORT",ZTSAVE("LRMAP*")=""
 D ^%ZTLOAD
 I $D(ZTSK)'[0 W !,"REQUEST QUEUED ",ION
 D HOME^%ZIS K IO("Q") Q
START ;BEGINS REPORT
 N LOINCDTA,LOINCDTB,LOINCTAS,LRAA,LRAA1,LRPNTA,LRPNTB
 N LINE
 S LINE=0
 D INI
 I LRMAP'=2 D EN1
 I LRMAP=2 D
 . S LRIEN=0 F  S LRIEN=$O(LRMAP(LRIEN)) Q:LRIEN<1  S LRNODE=$G(^LAB(60,LRIEN,0)) D YMAP
 D YMAPPRT,EXIT
 Q
EN1 ;PRINT MAPPED OR NOT MAPPED LAB TESTS IF THERE IS A DATA NAME 
 S LRTEST=""
 S LRTST="^LAB(60,""B"",0)"
 F  S LRTST=$Q(@LRTST) Q:$QS(LRTST,2)'="B"  D  Q:$G(LREND)
 . Q:$G(@LRTST)
 . S LRIEN=$QS(LRTST,4)
 . Q:'$D(^LAB(60,LRIEN,0))#2  S LRNODE=^(0)
 . I $S($P(LRNODE,U,3)="":1,$P(LRNODE,U,3)="N":1,'$P($P(LRNODE,U,5),";",2):1,1:0) Q
 .;----- BEGIN IHS MODIFCATIONS LR*5.2*1018
 .D BLRLOINC  ;SEARCH FOR IHS LOINC ENTRIES
 .Q
 .;----- END IHS MODIFICATIONS
 . N LRNLT
 . S LRNLT=+$P($G(^LAB(60,LRIEN,64)),U,2)
 . I 'LRMAP,$S(('$D(^LAM("AL",LRIEN))&('$D(^LAM("AM",LRIEN)))):1,1:0) D NMAP
 . I LRMAP,$S($D(^LAM("AL",LRIEN)):1,$D(^LAM("AM",LRIEN)):1,1:0) D YMAP
 Q
YMAPPRT I $D(^TMP($J,"LRDATA")) D
 . S LRPRT=0
 . F  S LRPRT=$O(^TMP($J,"LRDATA",LRPRT)) Q:LRPRT=""  D  Q:$G(LREND)
 .. I $Y+4>IOSL D HDR Q:$G(LREND)
 .. W !,^TMP($J,"LRDATA",LRPRT)
 Q
NMAP ;
 I $Y+4>IOSL D HDR Q:$G(LREND)
 S LRTESTN=$P(LRNODE,U)
 W !,?1,LRTESTN
 S LRNLT=$P($G(^LAB(60,LRIEN,64)),U,2)
 I LRNLT D
 . N LROUT
 . D GETS^DIQ(64,LRNLT_",",".01;1","E","LROUT")
 . W !?5,$G(LROUT(64,LRNLT_",",1,"E")),?18,$G(LROUT(64,LRNLT_",",.01,"E"))
 W !
 Q
YMAP ;
 S LINE=$G(LINE)+1
 S ^TMP($J,"LRDATA",LINE)="LAB TEST :  "_$P(LRNODE,U),LINE=LINE+1
 N LRA,LRNLTX
 S LRNLT=0
 F  S LRNLT=$O(^LAM("AM",LRIEN,LRNLT)) Q:LRNLT=""  I '$D(LRNLTX(LRNLT)) D
 . S LRA=LRNLT,LRNLTX(LRNLT)=1
 . D LOINCLA^LRSRVR
 S LRNLT=0
 F  S LRNLT=$O(^LAM("AL",LRIEN,LRNLT)) Q:LRNLT=""  I '$D(LRNLTX(LRNLT)) D
 . S LRA=LRNLT,LRNLTX(LRNLT)=1
 . D LOINCLA^LRSRVR
 S LINE=$G(LINE)+1,^TMP($J,"LRDATA",LINE)="-------------------"
 S LINE=LINE+1,^TMP($J,"LRDATA",LINE)="",LINE=LINE+1
 Q
INI ;INITIALIZE VARIABLES
 K ^TMP($J,"LRDATA")
 S (LREND,LRPAGE)=0,$P(LRLINE,"=",(IOM-1))=""
 S LRPDT=$$FMTE^XLFDT($$NOW^XLFDT,"Z5M")
HDR ;PRINT HEADING
 I LRPAGE,$E(IOST,1,2)="C-" W !,"Press RETURN to continue or '^' to exit: " R N:DTIME S LREND='$T!(N="^") Q:LREND
 S LRPAGE=LRPAGE+1 W @IOF
 ;PRINT HEADING
 W !?16,"LAB TESTS"_$S(LRMAP=2:" Individual Mapped",LRMAP=1:" Mapped",LRMAP'=1:" NOT Mapped",1:0)_" TO LOINC CODES"
 W !?5,LRPDT,?(IOM-15)," Page ",$J(LRPAGE,3)
 ;I 'LRMAP W !?5,"LAB TEST"
 ;I 'LRMAP W !,?10,"RESULT NLT"
 I LRMAP=1 W !!?5,"LAB TEST",?37,"SPECIMEN",?67,"LOINC CODE"
 I LRMAP=0 W !!?5,"LAB TEST",?37,"SPECIMEN"
 W !,LRLINE,!
 Q
EXIT I $E(IOST,1,2)="P-" W @IOF
 S:$D(ZTQUEUED) ZTREQ="@"
 Q:$G(LRDBUG)
 K DIR,DIRUT,LREND,LRPAGE,I,J,LRA,LRLOC,LRIEN,LRPREV,ZTIO,ZTDESC,ZTRTN
 K LRMAP,LRSPEC,LRTEST,LRTESTN,LRLOINC,LRPDT,LRLINE,LRX,DUOUT,ZTSAVE
 K LRNLT,LRNLTN,LRNODE,LRPRT,LRSPECN,LRTST,N,Y,POP,ZTSK,ZTQUEUED,ZTREQ
 K ^TMP($J,"LRDATA")
 Q
 ;IHS LOINC REPORT
BLRLOINC ;
 S LRTEST=$P(LRNODE,U)
 S LRX=0
 F  S LRX=$O(^LAB(60,LRIEN,1,LRX)) Q:'LRX  D  Q:$G(LREND)
 .S BLRLOINC=+$G(^LAB(60,LRIEN,1,LRX,95.3))
 .I $G(LRMAP)=0,BLRLOINC'=0 Q
 .I $G(LRMAP)=1,BLRLOINC=0 Q
 .S LRSPEC=$P($G(^LAB(61,LRX,0)),U)
 .;S LRTEST=$P($G(^LAB(60,LRIEN,0)),U)
 .I $Y+4>IOSL D HDR Q:$G(LREND)
 .W !?1,LRTEST,?37,$E(LRSPEC,1,30) I $G(LRMAP)=1 W ?67,BLRLOINC,!,$G(^LAB(95.3,BLRLOINC,80)),!
 Q