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

BLRLTRRR.m

Go to the documentation of this file.
BLRLTRRR ; IHS/MSC/MKK - IHS Lab Laboratory Test (#60) file's Reference Ranges Reports; 22-Oct-2013 09:22 ; MKK
 ;;5.2;IHS LABORATORY;**1033**;NOV 01, 1997
 ;
EEP ; Ersatz EP
 D EEP^BLRGMENU
 Q
 ;
EP ; 
PEP ; EP
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
 ;
 S BLRVERN=$TR($P($T(+1),";")," ")
 ;
 D ADDTMENU^BLRGMENU("MAKERPT^BLRLTRRR","'SEX' Ref Range(s) Report")
 ; D ADDTMENU^BLRGMENU("EMAIL^BLRLTRRR","'SEX' Ref Range(s) Rpt (MailMan)")
 ;
 ; Main Menu driver
 D MENUDRVR^BLRGMENU("RPMS Laboratory Test (#60) File","Reference Ranges Reports")
 Q
 ;
EMAIL ; EP - E-Mail Version 
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
 ;
 D GETDATA
 ;
 Q:$D(^TMP("BLRLTRRR"))<1
 ;
 S TAB=$J("",5),LINE=0
 S TAB2=$J("",7)
 S TAB3=$J("",10)
 D MAILHEAD(.ARRAY,.LINE)
 ;
 S IEN=0
 F  S IEN=$O(^TMP("BLRLTRRR",$J,IEN))  Q:IEN<1  D
 . D MAKELINE(.ARRAY,.LINE," ")
 . S TESTNAME=$$GET1^DIQ(60,IEN,"NAME")
 . D MAKELINE(.ARRAY,.LINE,TAB_"TEST:"_TESTNAME_" ["_IEN_"]")
 . S SSIEN=0
 . F  S SSIEN=$O(^TMP("BLRLTRRR",$J,IEN,SSIEN))  Q:SSIEN<1  D
 .. D BUILDMSG(.ARRAY,.LINE,IEN,SSIEN)
 ;
 ; Send E-Mail
 D SENDMAIL^BLRUTIL3("FILE 60 'SEX' REF RANGE CHECK",.ARRAY,"BLRLTRRR",1)
 ;
 K ^TMP("BLRLTRRR")
 Q
 ;
GETDATA ; EP - Gather Data
 K ^TMP("BLRLTRRR")
 S IEN=.9999999
 F  S IEN=$O(^LAB(60,IEN))  Q:IEN<1  D
 . S SSIEN=0
 . F  S SSIEN=$O(^LAB(60,IEN,1,SSIEN))  Q:SSIEN<1  D
 .. S STR=$G(^LAB(60,IEN,1,SSIEN,0))
 .. S:$P(STR,"^",2,5)["SEX" ^TMP("BLRLTRRR",$J,IEN,SSIEN)=STR
 Q
 ;
MAILHEAD(ARRAY,LINE) ; EP - Build "Header" for E-Mail
 D MAKELINE(.ARRAY,.LINE,$TR($$CJ^XLFSTR("@LABORATORY@TEST@FILE@ENTRIES@",60)," @","= "))
 D MAKELINE(.ARRAY,.LINE," ")
 D MAKELINE(.ARRAY,.LINE,TAB_"Entries with SEX in Reference and/or Critical Ranges")
 Q
 ;
MAKELINE(ARRAY,LINE,LINESTR) ; EP
 S LINE=LINE+1
 S ARRAY(LINE)=LINESTR
 Q
 ;
BUILDMSG(ARRAY,LINE,IEN,SSIEN) ; EP - Build the Message
 D SITESPEC(IEN,SSIEN)
 ;
 D MAKELINE(.ARRAY,.LINE,TAB2_"SITE/SPEC:"_F61DESC_" ["_SSIEN_"]")
 ;
 D:REFLOW["SEX" MAKELINE(.ARRAY,.LINE,TAB3_"Ref Low:"_REFLOW)
 D:REFHIGH["SEX" MAKELINE(.ARRAY,.LINE,TAB3_"Ref High:"_REFHIGH)
 D:CRITLOW["SEX" MAKELINE(.ARRAY,.LINE,TAB3_"Crit Low:"_CRITLOW)
 D:CRITHIGH["SEX" MAKELINE(.ARRAY,.LINE,TAB3_"Crit High:"_CRITHIGH)
 Q
 ;
SITESPEC(IEN,SSIEN) ; EP - Break out SITE/SPECIMEN Values
 S STR=$G(^LAB(60,IEN,1,SSIEN,0))
 S F61PTR=$P(STR,"^")
 S F61DESC=$$GET1^DIQ(61,F61PTR,"NAME")
 S REFLOW=$P(STR,"^",2)
 S REFHIGH=$P(STR,"^",3)
 S CRITLOW=$P(STR,"^",4)
 S CRITHIGH=$P(STR,"^",5)
 S THERLOW=$P(STR,"^",11)
 S THERHIGH=$P(STR,"^",12)
 Q
 ;
MAKERPT ; EP - Report
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
 ;
 D GETDATA
 ;
 I $D(^TMP("BLRLTRRR"))<1 D  Q
 . W !,?4,"No entries in Laboratory Test (#60) File found to have 'SEX' in Ref Ranges."
 . D PRESSKEY^BLRGMENU(9)
 ;
 D MAKERPTI
 ;
 S IEN=0
 F  S IEN=$O(^TMP("BLRLTRRR",$J,IEN))  Q:IEN<1  D
 . S TESTNAME=$$GET1^DIQ(60,IEN,"NAME")
 . S SSIEN=0
 . F  S SSIEN=$O(^TMP("BLRLTRRR",$J,IEN,SSIEN))  Q:SSIEN<1!(QFLG="Q")  D MAKERPTL
 ;
 D ^%ZISC
 D PRESSKEY^BLRGMENU(4)
 Q
 ;
MAKERPTI ; EP - Initialization
 S BLRVERN=$TR($P($T(+1),";")," ")
 ;
 S HEADER(1)="FILE 60 'SEX' REF RANGE CHECK"
 S HEADER(2)=" "
 D HEADERDT^BLRGMENU
 D HEADONE^BLRGMENU(.HDRONE)
 ;
 S HEADER(2)="'SEX' in Reference and/or Critical Ranges"
 S HEADER(3)=" "
 S HEADER(4)=$TR($$CJ^XLFSTR("@File@60@",27)," @","= ")
 S $E(HEADER(4),30)="SITE/"
 S HEADER(5)="IEN"
 S $E(HEADER(5),10)="Description"
 S $E(HEADER(5),30)="SPEC"
 S $E(HEADER(5),40)="Ranges"
 ;
 D ^%ZIS
 U IO
 ;
 S MAXLINES=IOSL-4
 S LINES=MAXLINES+10,PG=0,QFLG="NO"
 Q
 ;
MAKERPTL ; EP - Line of Data
 I LINES>MAXLINES D HEADERPG^BLRGMENU(.PG,.QFLG,.HDRONE)  Q:QFLG="Q"
 ;
 D SITESPEC(IEN,SSIEN)
 ;
 W IEN
 W ?9,$E(TESTNAME,1,18)
 W ?29,SSIEN
 I REFLOW["SEX" W ?39,"Ref Low:",?49,$E(REFLOW,1,31),!  S LINES=LINES+1
 I REFHIGH["SEX" W ?39,"Ref High:",?49,$E(REFHIGH,1,31),!  S LINES=LINES+1
 I CRITLOW["SEX" W ?39,"Crit Low:",?49,$E(CRITLOW,1,31),!  S LINES=LINES+1
 I CRITHIGH["SEX" W ?39,"Crit High:",?49,$E(CRITHIGH,1,31),!  S LINES=LINES+1
 I THERLOW["SEX"  W ?39,"Ther Low:",?49,$E(CRITHIGH,1,31),!  S LINES=LINES+1
 I THERHIGH["SEX" W ?39,"Ther High:",?49,$E(CRITHIGH,1,31),!  S LINES=LINES+1
 Q