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

BLRDOCRM.m

Go to the documentation of this file.
BLRDOCRM ; IHS/MSC/MKK - Patient Reminder Document ; 13-Oct-2017 14:04 ; MKK
 ;;5.2;LAB SERVICE;**1041**;NOV 1, 1997;Build 23
 ;
EEP ; Ersatz EP
 D EEP^BLRGMENU
 Q
 ;
 ;
EP ; EP
PEP ; EP
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
 ;
 D SETBLRVS
 ;
 D ADDTMENU^BLRGMENU("FUTURE^BLRDOCRM","Future/Current Orders")
 D ADDTMENU^BLRGMENU("ALLORDS^BLRDOCRM","All Orders")
 ;
 D MENUDRVR^BLRGMENU("RPMS Lab","Patient Reminder Document")
 Q
 ;
FUTURE ; EP
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
 ;
 D SETBLRVS
 ;
 Q:$$FUTUREI("Patient Reminder Document")="Q"
 ;
 F  S LRODT=$O(^LRO(69,"D",LRDFN,LRODT),-1)  Q:LRODT<TODAY!(QFLG="Q")  D
 . S LRSP="A"
 . F  S LRSP=$O(^LRO(69,"D",LRDFN,LRODT,LRSP),-1)  Q:LRSP<1!(QFLG="Q")  D PATLINE
 ;
 I ORDCNT W !!,?9,ORDCNT," Order",$$PLURAL^BLRUTIL7(ORDCNT),"."
 E  D
 . F I=3:1:5 K HEADER(I)
 . D HEADERDT^BLRGMENU
 . W ?9,"No Future/Current Orders for Patient found."
 ;
 D ^%ZISC
 D PRESSKEY^BLRGMENU
 Q
 ;
FUTUREI(HDR1) ; EP - Initialization
 S HEADER(1)=HDR1
 D HEADERDT^BLRGMENU
 D ^XBFMK
 S DIR(0)="PO^9000001:EMZ"
 D ^DIR
 I +$G(DIRUT) Q $$BADSTUFQ("No/Quit/Invalid input.")
 ;
 S DFN=+Y,PATNAME=$$GET1^DIQ(2,DFN,.01)
 S HEADER(2)=PATNAME_" ["_DFN_"]   HRCN:"_$$GET1^DIQ(9000001.41,DUZ(2)_","_DFN,.02)
 ;
 D ^%ZIS
 I POP Q $$BADSTUFQ("I/O Issue.")
 ;
 U IO
 S HEADER(3)=" "
 S $E(HEADER(4),10)=$$COLHEAD^BLRGMENU("Estimated",19)
 S HEADER(5)="Order #"
 S $E(HEADER(5),10)="Date/Time Collect"
 S $E(HEADER(5),31)="Test Description"
 S $E(HEADER(5),55)="Urgency"
 S $E(HEADER(5),64)="Ordering Provider"
 ;
 S ORDCNT=0
 S MAXLINES=IOSL-4,LINES=MAXLINES+10
 S PG=0,(QFLG,HDRONE)="NO"
 ;
 S LRDFN=$$GET1^DIQ(2,DFN,"LABORATORY REFERENCE","I")
 S LRODT="A",TODAY=$$DT^XLFDT
 Q "OK"
 ;
PATLINE ; EP - Line of Data
 I LINES>MAXLINES D HEADERPG^BLRGMENU(.PG,.QFLG,HDRONE)  Q:QFLG="Q"
 ;
 D PATDATAB
 ;
 W ORDNUM
 W ?9,ESTCPRNT
 S LROT=0
 F  S LROT=$O(^LRO(69,LRODT,1,LRSP,2,LROT))  Q:LROT<1!(QFLG="Q")  D
 . I LINES>MAXLINES D   Q:QFLG="Q"
 .. D HEADERPG^BLRGMENU(.PG,.QFLG,HDRONE)
 .. Q:QFLG="Q"
 .. W ORDNUM
 .. W ?9,ESTCPRNT
 . ;
 . S LROTIEN=LROT_","_ORDIEN
 . S F60DESC=$$GET1^DIQ(69.03,LROTIEN,.01)
 . S URGENCY=$$GET1^DIQ(69.03,LROTIEN,1)
 . ;
 . W ?30,$E(F60DESC,1,22)
 . W ?54,$E(URGENCY,1,7)
 . W ?63,$E(PROVIDER,1,17)
 . W !
 . S LINES=LINES+1
 Q
 ;
PATDATAB ; EP - Breakout Data
 S ORDCNT=ORDCNT+1
 S ORDIEN=LRSP_","_LRODT
 S ORDNUM=$$GET1^DIQ(69.01,ORDIEN,9.5,"I")
 S ORDERDT=$$GET1^DIQ(69.01,ORDIEN,5,"I")
 S PROVIDER=$$GET1^DIQ(69.01,ORDIEN,7)
 S ESTCOLDT=$$GET1^DIQ(69.01,ORDIEN,5.5,"I")     ; EST. DATE/TIME OF COLLECTION
 S ESTCPRNT=$$UP^XLFSTR($$FMTE^XLFDT(ESTCOLDT,"5MPZ"))     ; EST. DATE/TIME OF COLLECTION Print String
 S ESTCPRNT=$P(ESTCPRNT," ")_$J($P(ESTCPRNT," ",2,3),9)
 Q
 ;
 ;
ALLORDS ; EP
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
 ;
 D SETBLRVS
 ;
 Q:$$FUTUREI("Patient Orders Document")="Q"
 ;
 F  S LRODT=$O(^LRO(69,"D",LRDFN,LRODT),-1)  Q:LRODT<1!(QFLG="Q")  D
 . S LRSP="A"
 . F  S LRSP=$O(^LRO(69,"D",LRDFN,LRODT,LRSP),-1)  Q:LRSP<1!(QFLG="Q")  D PATLINE
 ;
 W !!,?9,ORDCNT," Order",$$PLURAL(ORDCNT),"."
 D ^%ZISC
 D PRESSKEY^BLRGMENU
 Q
 ;
 ;
 ; ============================= UTILITIES =============================
 ;
JUSTNEW ; EP - Generic RPMS EXCLUSIVE NEW
 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
 ;
 Q
 ;
SETBLRVS(TWO) ; EP - Set the BLRVERN variable(s)
 K BLRVERN,BLRVERN2
 ;
 S BLRVERN=$P($P($T(+1),";")," ")
 S:$L($G(TWO)) BLRVERN2=$G(TWO)
 Q
 ;
BADSTUFF(STR,TAB) ; EP - BADSTUFF error message
 S TAB=$S($L($G(TAB))<1:4,1:TAB)
 W !!,?TAB,STR,"  Routine Ends."
 D PRESSKEY^BLRGMENU(TAB+5)
 Q
 ;
BADSTUFQ(STR,TAB) ; EP - BADSTUFF error message.  Ends with Q "Q"uit
 D BADSTUFF(STR,$G(TAB))
 Q "Q"
 ;
PLURAL(CNT) ; EP - If CNT'=1, return S else return ""
 Q $S(CNT=1:"",1:"s")
 ;
PLURALI(CNT) ; EP - If CNT'=1, return IES else return Y
 Q $S(CNT=1:"y",1:"ies")