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

BLRLRRP2.m

Go to the documentation of this file.
BLRLRRP2 ; IHS/DIR/AAB - INTERIM REPORT 10/24/91 09:58 ; [ 07/01/1998  9:18 AM ]
 ;;5.2;BLR;**1001,1003**;JUN 01, 1998
 ;;5.2;LAB SERVICE;**106**;Sep 27, 1994
 ;from option LRRP2
BEGIN D INIT K DIC D ^LRDPA D:LRDFN>0 START G:LRDFN<0 END G BEGIN
END D ^LRRK
 Q
START I $O(^LR(LRDFN,0))="" W !,"NO LAB DATA ON THIS PATIENT!",$C(7) Q
 S LRLAB=$S($D(LRLABKY):1,1:0),LREDT="T-7" D ^LRWU3 Q:LREND  S LRIDT=9999999-LRSDT,LREDT=9999999-LREDT
 S %ZIS="Q" S ZTSAVE("DFN")="",ZTRTN="SDQ^BLRLRRP2" D IO^LRWU
 Q
SDQ ;dequeued
 S:$D(ZTQUEUED) ZTREQ="@" U IO D PT^LRX
 F  S LRCNIDT=+$O(^LR(LRDFN,"CH",LRIDT)),LRMNIDT=+$O(^LR(LRDFN,"MI",LRIDT)) Q:'LRCNIDT&'LRMNIDT  D SWITCH Q:LREND!LRSTOP!(LRIDT>LREDT)
 D FOOT^LRRP1 Q
SWITCH ;I LRCNIDT=LRMNIDT S LRIDT=LRCNIDT Q:LRIDT>LREDT  D CH,MI Q
 S LRMD=$G(LRMD)  ;IHS/OIRM TUC/AAB
 I LRCNIDT=LRMNIDT S LRIDT=LRCNIDT Q:LRIDT>LREDT  D CH,MI Q
 I 'LRMNIDT S LRIDT=LRCNIDT Q:LRIDT>LREDT  D CH Q
 I 'LRCNIDT S LRIDT=LRMNIDT Q:LRIDT>LREDT  D MI Q
 I LRCNIDT<LRMNIDT S LRIDT=LRCNIDT Q:LRIDT>LREDT  D CH Q
 S LRIDT=LRMNIDT Q:LRIDT>LREDT  D MI
 Q
GENP W !!,"Too many tests!  Will use alternate format.  May show extra tests.",!
 S LREDT="T-7" D ^LRWU3 Q:LREND  S LRSDT=9999999-LRSDT,LREDT=9999999-LREDT
 K ^TMP("LR",$J,"T"),LRORD,LRTSTS S ZTSAVE("^TMP(""LR"",$J,")="",ZTSAVE("DFN")="",ZTRTN="GDQ^BLRLRRP2" D IO^LRWU
 Q
GDQ ;dequeued
 S:$D(ZTQUEUED) ZTREQ="@" U IO D PT^LRX
 S LRSUB="" F  S LRSUB=$O(^TMP("LR",$J,"TMP",LRSUB)) Q:LRSUB=""  S X=+$P(LRSUB,";",2),^TMP("LR",$J,"T",X)=""
 S LRIDT=LRSDT F  S LRIDT=$O(^LR(LRDFN,"CH",LRIDT)) Q:LRIDT<1!(LRIDT>LREDT)  I $P(^LR(LRDFN,"CH",LRIDT,0),U,3) D GEN2 Q:LREND!LRSTOP
 K ^TMP("LR",$J,"T"),^TMP("LR",$J,"TMP"),LRSDT,LREDT,LRTSTS,LRSUB,LRIDT
 Q
GEN2 S LRTN=0 F  S LRTN=$O(^LR(LRDFN,"CH",LRIDT,LRTN)) Q:LRTN<1  I $D(^TMP("LR",$J,"T",LRTN)) D CH Q
 Q
AIDQUE D INIT S LRLAB=$S($D(LRLABKY):1,1:0)
 K ^TMP($J)
 S LROCE=$S($D(LROC):LROC,1:""),LROC=$S(LROCE="":$O(^LAB(64.6,"AI","")),1:LROC) D:LROC'="" AI2 F  S LROC=$O(^LAB(64.6,"AI",LROC)) Q:LROC=""!($L(LROCE)&(LROC'=LROCE))  D AI2
 S LROC="UNKNOWN" D AI2
PRT ;Print sorted data
 U IO K VA D KVAR^BLRDPT S LREND=0
 I $O(^TMP($J,0))="" W !!?10,"No Interim report Patients to Print ",!?20,$$DTF^LRAFUNC1($$NOW^LRAFUNC1),!! G QUIT
 S LROC="" F  S LROC=$O(^TMP($J,LROC)) Q:LROC=""!($G(LREND))  S LRPHY="" F  S LRPHY=$O(^TMP($J,LROC,LRPHY)) Q:LRPHY=""!($G(LREND))  D
 . S LRSSN="" F  S LRSSN=$O(^TMP($J,LROC,LRPHY,LRSSN)) Q:LRSSN=""!($G(LREND))  D
 . . S LRDFN=0 F  S LRHF=1,LRDFN=$O(^TMP($J,LROC,LRPHY,LRSSN,LRDFN)) Q:LRDFN<1!($G(LREND))  D  D:$G(LRSS)="CH" FOOT^LRRP1
 . . . S LRIDT=0 F  S LRIDT=$O(^TMP($J,LROC,LRPHY,LRSSN,LRDFN,LRIDT)) Q:LRIDT<1!($G(LREND))  D
 . . . . ;S LRSS="",PNM=^(LRIDT),SSN=$P(PNM,U,2),AGE=$P(PNM,U,3),SEX=$P(PNM,U,4),PNM=$P(PNM,U),LRFOOT=0
 . . . . S LRSS="",PNM=^(LRIDT),HRCN=$P(PNM,U,2),AGE=$P(PNM,U,3),SEX=$P(PNM,U,4),PNM=$P(PNM,U),LRFOOT=0  ;IHS/ANMC/CLS 08/18/96
 . . . . D:$D(^LR(LRDFN,"CH",LRIDT,0))#2 CH
 . . . . S LRFOOT=0 I $D(^LR(LRDFN,"MI",LRIDT,0))#2 D:$G(LRSS)="CH" FOOT^LRRP1 D MI
QUIT S:$D(ZTQUEUED) ZTREQ="@" W !! W:$E(IOST,1,2)="P-" @IOF D ^%ZISC,^LRRK
 Q
AI2 ;
 Q:'$L($G(LROC))
 F LRDFN=0:0 S LRDFN=$O(^LRO(69,"AN",LROC,LRDFN)) Q:LRDFN<1  I $D(^LR(LRDFN,0))#2 D
 . S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) D PT^LRX Q:LREND
 . I '$G(VAERR) D AI3
 Q
AI3 ;
 Q:$G(LREND)
 ;S LRSSN=$P(PNM,",")_SSN(1)
 S LRSSN=$P(PNM,",")_HRCN  ;IHS/ANMC/CLS 08/18/96
 F LRIDT=0:0 S LRIDT=$O(^LRO(69,"AN",LROC,LRDFN,LRIDT)) Q:LRIDT<1  D
 . S LRND=$S($G(^LR(LRDFN,"CH",LRIDT,0)):^(0),$G(^LR(LRDFN,"MI",LRIDT,0)):^(0),1:"") I $P(LRND,U,3) D
 . . S LRPHY=$P($G(^VA(200,+$P(LRND,U,10),0)),U) S:LRPHY="" LRPHY="UNKNOWN"
 . . S ^TMP($J,LROC,LRPHY,LRSSN,LRDFN,LRIDT)=PNM_U_HRCN_U_AGE_U_SEX  ;IHS/ANMC/CLS 08/18/96
 Q
CH ;Also used by DVBC Package
 N LROC
 ;K ^TMP("LR",$J,"TP"),LRTP S LR0=^LR(LRDFN,"CH",LRIDT,0) Q:'$P(LR0,U,3)  S LRCDT=+LR0,LRSS="CH",LROC=$P(LR0,U,11),LRAA="",LRAAO=1,LRTC=0,LRSPEC=$P(LR0,U,5)
 K ^TMP("LR",$J,"TP"),LRTP S LR0=^LR(LRDFN,"CH",LRIDT,0) Q:'$P(LR0,U,3)  ;IHS/OIRM TUC/AAB 1/21/98
 I LRSINGLE,LRMD="S" Q:LRPHY'=$E($P($G(^VA(200,+$P(LR0,U,10),0)),U),1,20)  ;IHS/OIRM TUC/AAB 7/1/98
 S LRCDT=+LR0,LRSS="CH",LROC=$P(LR0,U,11),LRAA="",LRAAO=1,LRTC=0,LRSPEC=$P(LR0,U,5)  ;IHS/OIRM TUC/AAB 1/21/98
 D CH^LRRP
 Q
MI ;Also used by DVBC package
 ;S BLRPHYS=$P($G(^VA(200,+$P(^LR(LRDFN,"MI",LRIDT,0),U,7),0)),U) Q:'$D(LRPHY(BLRPHYS)) ;IHS/OIRM TUC/AAB 1/21/98 FIX FOR A MORE THAN ONE SELECTED PROVIDER
 I LRSINGLE,LRMD="S" Q:LRPHY'=$E($P($G(^VA(200,+$P(^LR(LRDFN,"MI",LRIDT,0),U,7),0)),U),1,20)  ;IHS/DIR TUC/AAB 7/1/98
 S LRCDT=9999999-LRIDT,^TMP("LR",$J,"TP",1)="^MI",^(1,LRCDT)="",^(LRCDT,-1)="",LRSS="MI",LRH=1 D:LRFOOT FOOT^LRRP1 Q:LRSTOP  D EN1^LRMIPC S LRHF=1,LRFOOT=0 K A,Z,LRH S:LREND LREND=0,LRSTOP=1
 Q
INIT D EN^LRPARAM D:'$D(LRDT0) DT^LRX S (LREND,LRSTOP)=0,LRCW=8,LRHF=1,LRFOOT=0,(LRONESPC,LRONETST)=""  ;IHS/ANMC/CLS 08/18/96  LRDT0 <undef>
 Q
EN69 ;entry point for surgery pkg
 D START,^LRRK
 Q
GEN ;from LRGEN test overflow
 S LRLAB=$S($D(LRLABKY):1,1:0) D INIT,GENP,^LRRK
 Q
DS ;from LRRD, LRRS
 D INIT S DFN=$P(^LR(LRDFN,0),U,3),LRDPF=$P(^(0),U,2) D SDQ
 Q
AIDQ ;tasked from LRTASK DAILY INTERIM
 S LRLAB=0,LRH="",LRWRDVEW="" D INIT,AIDQUE K LRH S:$D(ZTQUEUED) ZTREQ="@" K ^TMP($J)
 Q
DQ ;tasked from LRVER3 thru LRTP for IMMEDIATE INTERIM REPORTING
 S:$D(ZTQUEUED) ZTREQ="@" D INIT S LRLAB=0,LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) D PT^LRX D CH D FOOT^LRRP1 W @IOF D ^%ZISC
 Q
OR ;OE/RR entry point
 Q:'$D(ORVP)  S KILL=1 I '$D(LRPARAM) D EN^LRPARAM S KILL=0
 S (LREND,LRSTOP)=0,LRCW=8,LRHF=1,LRFOOT=0,(LRONESPC,LRONETST)=""
 D DT^LRX K DIC,LRTP S LRTP=0,DFN=+ORVP,LRDPF=+$P(@("^"_$P(ORVP,";",2)_"0)"),"^",2)_"^"_$P(ORVP,";",2) D END^LRDPA Q:LRDFN<1
 D START,^LRRK
 I 'KILL K LRBLOOD,LRDT0,LRORN,LRPARAM,LRPLASMA,LRSERUM,LRSB,LRTP,LRUNKNOW,LRURINE
 K KILL Q