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

BLRSHDRP.m

Go to the documentation of this file.
  1. BLRSHDRP ;IHS/OIT/MKK - NON-MICRO STATE HEALTH DEPT REPORT PRINTER [ 07/22/2005 ]
  1. ;;5.2;LR;**1020**;Sep 13, 2005
  1. ;;
  1. ; Lab PSG gave permission to retrieve program from PIMC and distribute
  1. ; nationally. This is called by BLRSHDRC.
  1. ;
  1. ; Note that ^BLRSHDRD is the global name for the new dictionary that
  1. ; this routine depends upon: REPORTABLE LAB TESTS (# 90475).
  1. ; It has been distributed with this patch and number given to it by
  1. ; the IHS DBA.
  1. ;
  1. ; This the "printer" routine
  1. ;
  1. ; The following is code to prevent routine from being run by D ^BLRLRSEP.
  1. EP ;
  1. W !,$C(7),$C(7),$C(7),! ; Bell/Beep
  1. W "Run from Label ONLY",!! ; Failsafe code
  1. Q
  1. ;
  1. PEP ; EP
  1. NEW MAXPGLEN ; Max Page Length
  1. NEW BLRQUFLG ; Queued Report Flag
  1. ;
  1. I '$D(^TMP($J)) D Q
  1. . W @IOF,"NO DATA TO REPORT",!!
  1. . ;
  1. . D PRESSRTN ; Press RETURN message
  1. ;
  1. D ^XBCLS ; Clear screen and home cursor
  1. D EN^DDIOL(.HEADERS) ; Write the Screen Header Lines
  1. ;
  1. S %ZIS="Q"
  1. D ^%ZIS ; "Open"
  1. ;
  1. I POP>0 D Q
  1. . W !,*7,*7,*7,"Device Open failed with Abnormal Exit."
  1. . W !,?5,"Printing terminated.",!!
  1. . D PRESSRTN
  1. ;
  1. I IOM<132 D Q
  1. . D ^%ZISC ; "Close"
  1. . W !,*7,*7,*7,"Right Margin MUST BE 132."
  1. . W ?5,"Device's Right Margin = ",IOM,!!
  1. . W !,?5,"Printing terminated.",!!
  1. . D PRESSRTN
  1. ;
  1. I $D(IO("Q")) D Q ; Queue Report
  1. . S BLRQUFLG="TRUE"
  1. . S ZTRTN="LP^BLRSHDRP"
  1. . S ZTSAVE("BLR*")=""
  1. . S ZTSAVE("^TMP($J,")=""
  1. . S ZTDESC="Reportable diseases"
  1. . D ^%ZTLOAD
  1. . K ZTSAVE,ZTDESC,ZTRTN,IO("Q")
  1. . W !!,"End of Queued Report",!!
  1. . D ^%ZISC
  1. ;
  1. LP ;
  1. I $G(BLRQUFLG)="TRUE" D ; If Queued report, need HEADER
  1. . D SETHDRVS^BLRSHDRC($G(^TMP($J,"DIC4PTR")))
  1. . D MAKEHDRS^BLRSHDRC ; Set Header variables
  1. ;
  1. S MAXPGLEN=IOSL-10 ; Give white space at bottom of page
  1. U IO ; Use device
  1. ;
  1. S PEDT=$E(BLRENDT,4,5)_"/"_$E(BLRENDT,6,7)_"/"_$E(BLRENDT,2,3)
  1. S PSDT=$E(BLRSDT,4,5)_"/"_$E(BLRSDT,6,7)_"/"_$E(BLRSDT,2,3)
  1. S FOOTFLG=0,PG=1
  1. S BLRTP=0
  1. F S BLRTP=$O(^TMP($J,BLRTP)) Q:'BLRTP!(BLRTP'?.N) D
  1. .S IENS=BLRTP_","
  1. .S BLRTST=$$GET1^DIQ(90475,IENS,2) ; Reporting Name
  1. .I FOOTFLG=1 D FOOTER
  1. .I PG>1 W @IOF
  1. .D RHEAD
  1. .S LRDFN=""
  1. .F S LRDFN=$O(^TMP($J,BLRTP,LRDFN)) Q:'LRDFN D
  1. ..S LRIDT=""
  1. ..F S LRIDT=$O(^TMP($J,BLRTP,LRDFN,LRIDT)) Q:'LRIDT D PRTIT
  1. D FOOTER W @IOF
  1. ;
  1. I $G(QUEFLAG)'="" Q ; If Queued report then Quit NOW
  1. ;
  1. D ^%ZISC ; "Close"
  1. ;
  1. Q
  1. ;
  1. ; REPORT LOOP
  1. RLOOP1 D:FOOTFLG=1 FOOTER
  1. W @IOF D RHEAD ; W !,"Reporting Test: "_DWBUG,!
  1. S RPNM="" F II=0:0 S RPNM=$O(^UTILITY("CH",$J,DWBUG,RPNM)) Q:RPNM="" D RLOOP2
  1. Q
  1. ;
  1. RLOOP2 S RACC="" F III=0:0 S RACC=$O(^UTILITY("CH",$J,DWBUG,RPNM,RACC)) Q:RACC="" D PRTIT
  1. Q
  1. ;
  1. ; PRINT LINES OF DATA
  1. PRTIT ;
  1. S Y=^TMP($J,BLRTP,LRDFN,LRIDT)
  1. S Y1=^LR(LRDFN,"CH",LRIDT,0)
  1. ;
  1. I ($Y+6)>MAXPGLEN D FOOTER W @IOF D RHEAD
  1. ;
  1. W !!,$E($P(Y,U,1),1,28) ; PATIENT NAME
  1. W ?30,$P(Y,U,2) ; HRN
  1. W ?40,$P(Y,U,3) ; DOB
  1. W ?54,$E($P(Y,U,4),1,1) ; SEX
  1. W ?58,$P(Y1,U,6) ; ACCN
  1. ;
  1. S IENS=LRIDT_","_LRDFN_","
  1. S SPEC=$$GET1^DIQ(63.04,IENS,.05)
  1. W ?74,$E(SPEC,1,12) ; SPECIMEN
  1. ;
  1. S COLDT=$P(Y1,U,1) ; COLLECTION DATE
  1. W ?88,$E(COLDT,4,5)_"/"_$E(COLDT,6,7)_"/"_$E(COLDT,2,3)
  1. ;
  1. S VERDT=$P(Y1,U,3) ; VERIFY OR COMPLETE DATE
  1. W ?98,$E(VERDT,4,5)_"/"_$E(VERDT,6,7)_"/"_$E(VERDT,2,3)
  1. ;
  1. S PROV=$$GET1^DIQ(63.04,IENS,.1)
  1. W ?108,$E(PROV,1,23) ; PROVIDER
  1. ;
  1. W !,?5,$P(Y,U,5) ; PHONE
  1. W ?30,$P(Y,U,6) ; STREET
  1. W ?64,$P(Y,U,7) ; CITY
  1. W ?84,$P(Y,U,8) ; STATE
  1. W ?98,$P(Y,U,9) ; ZIP
  1. W ?108,$E($P(Y1,U,11),1,23) ; LOCATION
  1. ;
  1. W !,?5,"Result: ",$P(Y,U,11)
  1. ;
  1. ; start - vjm 4/14/2000
  1. ;W !?5,"Current COMMUNITY: ",$G(BLRXCOMM)
  1. W !?5,"Current COMMUNITY: "
  1. W $P(Y,U,10) ; CURRENT COMMUNITY
  1. ; end - vjm 4/14/2000
  1. ;
  1. I $Y>MAXPGLEN D FOOTER W @IOF D RHEAD
  1. ;
  1. Q
  1. ;
  1. ; REPORT HEADING
  1. RHEAD ;
  1. W !
  1. W HEADER1
  1. W !
  1. W HEADER2
  1. W !
  1. W "From "_PSDT_" to "_PEDT
  1. W ?53,"****** CONFIDENTIAL ******"
  1. W ?98,"Printed: "_$E(DT,4,5)_"/"_$E(DT,6,7)_"/"_$E(DT,2,3)
  1. W ?120,"Page: "_PG
  1. W !!
  1. W "Name"
  1. W ?30,"ID#"
  1. W ?40,"DOB"
  1. W ?54,"Sex"
  1. W ?58,"Lab #"
  1. W ?74,"Sample"
  1. W ?88,"Col Dt"
  1. W ?98,"Cpl Dt"
  1. W ?108,"Provider"
  1. W !
  1. W ?5,"Phone #"
  1. W ?30,"Address"
  1. W ?108,"Location"
  1. ;
  1. ; start - vjm 4/14/2000
  1. W:$G(BLRGR) !?5,"Current Community"
  1. ; end - vjm 4/14/2000
  1. ;
  1. ; S M=$S($G(IOM):IOM,1:132)
  1. ; W ! F LI=0:1:M-1 W ?LI,"-"
  1. W !
  1. W $TR($J("",IOM)," ","-") ; Dashed line
  1. ; W !
  1. S PG=PG+1
  1. S FOOTFLG=1
  1. I $G(BLRTST)'="" D Q
  1. . W !,"Reporting Test: "_BLRTST
  1. ;
  1. I $G(BRLTST)="" D
  1. . W !,"Reporting Test: "_$G(^TMP($J,BLRTP))
  1. ;
  1. Q
  1. ;
  1. S PLG=MAXPGLEN-$Y F PP=1:1:PLG W !
  1. W !,"________________________________________ ______________________"
  1. W !," Medical Technologist Date",!
  1. Q
  1. ;
  1. ; PRESS RETURN CODE
  1. PRESSRTN ; EP
  1. D ^XBFMK ; Kernel call cleans up FILEMAN vars
  1. S DIR(0)="E",(X,Y)=""
  1. S DIR("A")="Press RETURN to continue" ; Success or failure is irrelevant.
  1. D ^DIR ; Used only prior to exit
  1. Q