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

LRLNCSUF.m

Go to the documentation of this file.
LRLNCSUF ;DALOI/RSH-PRINT WKLD/NLT CODE LOINC MAPPINGS ;1-OCT-1998
 ;;5.2;LAB SERVICE;**232**;Sep 27,1994
EN ;
 W @IOF,!! S LREND=0
 W $$CJ^XLFSTR("This option will print WORKLOAD CODES and their LOINC CODES.",IOM)
 W !,$$CJ^XLFSTR("You may use the option 'MAP LOINC TEST TO NLT' to make necessary changes.",IOM)
ASK ;
 K DIR S DIR(0)="S^1:Ready to print WORKLOAD CODES MAPPED TO LOINC;2:Abort"
 D ^DIR K DIR
 G END:$S($G(DIRUT):1,$G(DUOUT):1,$G(DTOUT):1,Y=2:1,1:0)
 S LRSEL=Y K %ZIS S %ZIS="Q" D ^%ZIS
 G END:POP
 I IO'=IO(0) S ZTRTN="DQ^LRLNCSUF",ZTIO=ION,ZTDESC="Print WKLD CODES MAPPED TO LOINC",ZTSAVE("LRSEL")="" D ^%ZTLOAD I $D(ZTSK)'[0 W !!?5," Tasked to Print on : ",ION G END
 W @IOF D DQ
 D END
 Q
DQ ;
 N DIR,LREND
 S $P(LRLINE,"=",IOM)="",LRTOP=1
 S:$D(ZTQUEUED) ZTREQ="@" S LRPDT=$$FMTE^XLFDT($$NOW^XLFDT,"1P")
 S (LRPAGE,LRCNT,LREND)=0
 S LRDEF=""
 D HDR
 ;SORT BY TEST
 S LRNODE="^LAB(60,""B"",0)",LRCNT=0
 F  S LRNODE=$Q(@LRNODE) Q:$QS(LRNODE,2)'="B"  Q:$G(LREND)  D
 . Q:$G(@LRNODE)!($G(LREND))
 . S LRTSTNM=$QS(LRNODE,3)
 . S LRIEN=+$QS(LRNODE,4)
 . S (LRLOINC,LRSMPIEN,LRVWKIEN,LRACCIEN)=""
 . S LRX=$G(^LAB(60,LRIEN,0)) Q:$P(LRX,U,3)="N"
 . S LRVACD=$P($G(^LAB(60,LRIEN,64)),U)
 . S LRRNLT=$P($G(^LAB(60,LRIEN,64)),U,2)
 . D SMPCD D:$G(LRSMPIEN) GRNLT(LRSMPIEN)
 . D VRWKD D:$G(LRVWKIEN) GRNLT(LRVWKIEN)
 . D ACWK D:$G(LRACCIEN) GRNLT(LRACCIEN)
 . I LRSMPIEN=""&(LRVWKIEN="")&(LRACCIEN="") D
 . . I ($G(LRRNLT)) D GRNLT(LRRNLT)
 . . I LRRNLT="" D
 . . . W !,LRTSTNM,?45,"THERE IS NO RESULT NLT CODE"
 . . . W !,LRLINE
 . . . I $Y>24 D HDR,TOP Q:$G(LREND)
 Q
SMPCD ;GET SAMPLE WORKLOAD CODE
 S (LRD1,LRD2)=0
 F  S LRD1=+$O(^LAB(60,LRIEN,3,LRD1)) Q:LRD1<1  D
 . Q:'$O(^LAB(60,LRIEN,3,LRD1,9,0))
 . F  S LRD2=+$O(^LAB(60,LRIEN,3,LRD1,9,LRD2)) Q:LRD2<1  D
 . . S LRSREC=$G(^LAB(60,LRIEN,LRD1,9,LRD2,0))
 . . S LRSMPIEN=$P(LRSREC,U)
 Q
VRWKD ;GET VERIFY WORKLOAD CODE
 S LRD1=0 Q:'$O(^LAB(60,LRIEN,9,0))
 F  S LRD1=+$O(^LAB(60,LRIEN,9,LRD1)) Q:'LRD1  D
 . S LRVREC=$G(^LAB(60,LRIEN,9,LRD1,0))
 . S LRVWKIEN=$P(LRVREC,U)
 Q
ACWK ;GET ACCESSION WORKLOAD CODE
 S LRSUB=0
 Q:'$O(^LAB(60,LRIEN,9.1,0))
 F  S LRSUB=+$O(^LAB(60,LRIEN,9.1,LRSUB)) Q:LRSUB<1  D
 . S LRREC=$G(^LAB(60,LRIEN,9.1,LRSUB,0))
 . S LRACCIEN=$P(LRREC,U)
 Q
GRNLT(LRNLTIEN) ;GET RESULT NLT CODE
 Q:$G(^LAM(LRNLTIEN,0))=""
 Q:'$D(^LAM(LRNLTIEN,0))#2!($P($G(^LAM(LRNLTIEN,0)),U,2)="")  S LRNAME=$P(^(0),U),LRCODE=$P(^(0),U,2)
 D TOP Q:$G(LREND)
 I $O(^LAM(LRNLTIEN,5,0)) D GTLNC
SDEFCD ;SET DEFAULT LOINC CODE
 I $G(^LAM(LRNLTIEN,9)) S LRDEF=$P(^(0),U)
 E  S LRDEF=""  ;USE GENERIC SUFFIX CODE
 I '$O(^LAM(LRNLTIEN,5,0)) D PRT
 Q
GTLNC ;GET LOINC CODE BASED ON THE SPECIMEN
 S LRSPEC=0 F  S LRSPEC=+$O(^LAM(LRNLTIEN,5,LRSPEC)) Q:LRSPEC<1!($G(LREND))  D
 . D TOP Q:$G(LREND)
 . S LRASP=0 F  S LRASP=+$O(^LAM(LRNLTIEN,5,LRSPEC,1,LRASP)) Q:LRASP<1  D
 . . D TOP Q:$G(LREND)
 . . S LRX=+$G(^LAM(LRNLTIEN,5,LRSPEC,1,LRASP,1))
 . . I $D(^LAB(95.3,LRX,0))#2 S LRLOINC=$P(^(0),U)
 . . S LRSPNM=$P($G(^LAB(61,LRSPEC,0)),U),LRFULL=$G(^LAB(95.3,LRX,80))
 . . I $G(LRLOINC) D PRT
 . . S (LRLOINC,LRFULL)=""
 Q
PRT ;PRINT INFO
 D TOP Q:$G(LREND)
 W !?2,$G(LRTSTNM),?47,$G(LRSPNM)
 W !?2,$G(LRNLTIEN),?12,LRCODE_"  "_$G(LRNAME)
 I LRLOINC'="" W !,"LOINC CODE = ",LRLOINC," ",$G(LRFULL)
 I LRDEF'="" W !,"DEFAULT LOINC CODE = ",$G(LRDEF)
 I LRLOINC!LRDEF S LRCNT=LRCNT+1
 W !,LRLINE
 I $Y>24 D HDR,TOP Q:$G(LREND)
 Q
END ;
 I $G(LRCNT) W !?15,"Total Number of Mapped WKLD CODES/Specimens: ",LRCNT,!
 I $E(IOST)="P-" W @IOF
 D ^%ZISC
 K DIR,DIRUT,DUOUT,LRACCIEN,LRASP,LRCODE,LRCNT,LRD1,LRD2,LRDEF
 K LREND,LRFULL,LRIEN,LRLINE,LRLOINC,LRNAME,LRNLTIEN,LRNODE,LRPAGE
 K LRPDT,LRREC,LRRNLT,LRSEL,LRSMPIEN,LRSPEC,LRSPNM,LRSREC,LRSUB
 K LRTOP,LRTSTNM,LRVACD,LRVREC,LRVWKIEN,LRX,POP,ZTIO,ZTDESC,ZTRTN,ZTSAVE
 ;
 Q
TOP ;
 Q:$G(LREND)
 Q:$Y<(IOSL-4)
 I $E(IOST,1,2)="C-" D  Q:$G(LREND)
 . S DIR(0)="E" D ^DIR
 . S:$S($G(DIRUT):1,$G(DUOUT):1,1:0) LREND=1
HDR ;
 I $G(LRPAGE) W @IOF
 S LRPAGE=$G(LRPAGE)+1
 Q:'$G(LRTOP)
 W !,$$CJ^XLFSTR("Alphabetical Listing of Laboratory Tests ",IOM)
 W !,$$CJ^XLFSTR("that are Mapped to LOINC Codes.",IOM)
 W !,?5,LRPDT,?60,"Page: ",LRPAGE
 W !!,"LABORATORY TEST NAME",?45,"SPECIMEN"
 W !,"NLT IEN #   WKLD CODE Name ",!
 Q